Skip to content

Commit

Permalink
Account statement and matchTX
Browse files Browse the repository at this point in the history
  • Loading branch information
Aslam97 committed Feb 28, 2022
1 parent c27bdb7 commit 9685df2
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 6 deletions.
59 changes: 55 additions & 4 deletions src/Traits/MutasibankAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,92 @@

trait MutasibankAPI
{
/**
* getCurrentUser
*
* @return \Aslam\Response\Response
*/
public function getCurrentUser()
{
return $this->send('GET', 'user');
}

/**
* getAllAccount
*
* @return \Aslam\Response\Response
*/
public function getAllAccount()
{
return $this->send('GET', 'accounts');
}

/**
* getAccountById
*
* @param mixed $id
* @return \Aslam\Response\Response
*/
public function getAccountById($id)
{
return $this->send('GET', 'account/' . $id);
}

/**
* validateTransaction
*
* @param mixed $id
* @return \Aslam\Response\Response
*/
public function validateTransaction($id)
{
return $this->send('GET', 'validate/' . $id);
}

/**
* rerunCheckMutasi
*
* @param mixed $accountId
* @return \Aslam\Response\Response
*/
public function rerunCheckMutasi($accountId)
{
return $this->send('GET', 'rerun/' . $accountId);
}

public function matchTransaction()
/**
* getAccountStatement
*
* @param mixed $accountId
* @return \Aslam\Response\Response
*/
public function getAccountStatement(int $accountId, string $dateFrom = '', string $dateTo = '')
{
return $this->send('POST', 'match');
$options = ['form_params' => ['date_from' => $dateFrom, 'date_to' => $dateTo]];

if (!$dateFrom || !$dateTo) {
$options = [];
}

return $this->send('POST', 'statements/' . $accountId, $options);
}

public function getAccountStatement($accountId)
/**
* matchTransaction
*
* @return \Aslam\Response\Response
*/
public function matchTransaction($accountId, $amount)
{
return $this->send('POST', 'statements/' . $accountId);
return $this->send('POST', 'match/' . $accountId, ['form_params' => ['amount' => $amount]]);
}

/**
* onOffAccount
*
* @param mixed $accountId
* @return \Aslam\Response\Response
*/
public function onOffAccount($accountId)
{
return $this->send('POST', 'on_off/' . $accountId);
Expand Down
4 changes: 2 additions & 2 deletions src/config/config.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

return [
'url' => env('MUTASIBANK_URL', 'https://mutasibank.co.id/api/v1'),
'token' => 'SDI2VVJ4a2JuT2dWMXl3cjdSZnQwTDlsanBkenptNUlUZFF5bmphVE1pVkx1SU9OazEzYk1CRnZadzBS621b45862e287',
'url' => env('MUTASIBANK_URL', 'https://mutasibank.co.id/api/v1/'),
'token' => env('MUTASIBANK_TOKEN', ''),
];

0 comments on commit 9685df2

Please sign in to comment.