Skip to content

Commit

Permalink
Add account
Browse files Browse the repository at this point in the history
  • Loading branch information
mojoblanco committed Nov 4, 2019
1 parent 41dfef6 commit 3c71d3f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/Models/AccountEnquiry.php → src/Models/Account.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Mojoblanco\RITS\Helpers\Encryptor;

class AccountEnquiry {
class Account {

public $accountNo;
public $bankCode;
Expand All @@ -17,11 +17,11 @@ public function __construct($iv, $key) {
$this->key = $key;
}

public function getAccountNo() {
public function encryptedAccountNo() {
return Encryptor::encrypt($this->accountNo, $this->iv, $this->key);
}

public function getBankCode() {
public function encryptedBankCode() {
return Encryptor::encrypt($this->bankCode, $this->iv, $this->key);
}
}
15 changes: 14 additions & 1 deletion src/RITSService.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function accountEnquiry($payload)
$url = $this->baseUrl . Urls::$accountInquiry;

$data = [
'accountNo' => $payload->getAccountNo(),
'accountNo' => $payload->encryptedAccountNo(),
'bankCode' => $payload->encryptedBankCode()
];

Expand All @@ -42,6 +42,19 @@ public function accountEnquiry($payload)
return $result;
}

public function addAccount($payload)
{
$headers = ApiHelper::getHeaders($this->credentials);
$url = $this->baseUrl . Urls::$addAccount;

$data = [
'accountNo' => $payload->encryptedAccountNo(),
'bankCode' => $payload->encryptedBankCode()
];

return ApiHelper::makeRequest('POST', $url, $headers, $data);;
}

public function getSinglePaymentStatus($payload)
{
$headers = ApiHelper::getHeaders($this->credentials);
Expand Down

0 comments on commit 3c71d3f

Please sign in to comment.