Skip to content
This repository was archived by the owner on May 30, 2022. It is now read-only.

Commit 9b62bc6

Browse files
author
Mohamed Jinas
committed
2 parents a083799 + 24d5a8c commit 9b62bc6

File tree

4 files changed

+31
-31
lines changed

4 files changed

+31
-31
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,6 @@ All available commands will have autocompletion.
4444

4545
- [x] Ability to add contacts
4646
- [x] Ability to delete contacts
47+
- [x] Ability to make Tranfer to a given account number
4748
- [ ] Ability to make transfers to account saved in contacts.
4849

src/Commands/DeleteContact.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public function handle(BML $bml, OutputInterface $output, InputInterface $input)
3333

3434
if (!array_key_exists($contact_key, $contacts)) {
3535
$output->writeln("<error> Contact doesn't exist! </error>");
36+
3637
return 0;
3738
}
3839

src/Commands/Transfer.php

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
namespace Jinas\BMLConsole\Commands;
44

55
use Jinas\BMLConsole\Helpers\BML;
6-
use Symfony\Component\Console\Output\OutputInterface;
7-
use Symfony\Component\Console\Input\InputInterface;
86
use Symfony\Component\Console\Helper\QuestionHelper;
9-
use Symfony\Component\Console\Question\Question;
107
use Symfony\Component\Console\Helper\Table;
8+
use Symfony\Component\Console\Input\InputInterface;
9+
use Symfony\Component\Console\Output\OutputInterface;
10+
use Symfony\Component\Console\Question\Question;
1111

1212
class Transfer
1313
{
@@ -42,12 +42,12 @@ public function handle(BML $bml, OutputInterface $output, InputInterface $input)
4242
}));
4343

4444
$bml->transfer([
45-
"transfertype" => "IAT",
46-
"channel" => "mobile",
47-
"debitAmount" => $amount,
48-
"currency" => "MVR",
49-
"creditAccount" => $account,
50-
"debitAccount" => $bml->guid
45+
'transfertype' => 'IAT',
46+
'channel' => 'mobile',
47+
'debitAmount' => $amount,
48+
'currency' => 'MVR',
49+
'creditAccount' => $account,
50+
'debitAccount' => $bml->guid,
5151
]);
5252

5353
$otp = $question->ask($input, $output, (new Question("<question>What is the Verification Code?</question> \n"))
@@ -64,34 +64,33 @@ public function handle(BML $bml, OutputInterface $output, InputInterface $input)
6464
}));
6565

6666
$invoice = $bml->transfer([
67-
"transfertype" => "IAT",
68-
"channel" => "mobile",
69-
"debitAmount" => $amount,
70-
"currency" => "MVR",
71-
"creditAccount" => $account,
72-
"debitAccount" => $bml->guid,
73-
"otp" => $otp
67+
'transfertype' => 'IAT',
68+
'channel' => 'mobile',
69+
'debitAmount' => $amount,
70+
'currency' => 'MVR',
71+
'creditAccount' => $account,
72+
'debitAccount' => $bml->guid,
73+
'otp' => $otp,
7474
]);
7575

76-
if(!$invoice["success"])
77-
{
78-
throw new \Exception("whoops!. something went wrong. Transaction cannot be completed");
76+
if (!$invoice['success']) {
77+
throw new \Exception('whoops!. something went wrong. Transaction cannot be completed');
7978
}
8079

8180
$table = new Table($output);
82-
$table->setHeaderTitle("Invoice");
81+
$table->setHeaderTitle('Invoice');
8382
$table->setHeaders(['Status', 'Message', 'Ref #', 'Date', 'From', 'To', 'Ammount', 'Remarks']);
8483

85-
$row[] = [
86-
"SUCCESS",
87-
"Transfer transaction is successful",
88-
$invoice["payload"]["reference"],
89-
$invoice["payload"]["timestamp"],
90-
$invoice["payload"]["from"]["name"],
91-
$invoice["payload"]["to"]["account"],
92-
$invoice["payload"]["debitamount"],
93-
""
94-
];
84+
$row[] = [
85+
'SUCCESS',
86+
'Transfer transaction is successful',
87+
$invoice['payload']['reference'],
88+
$invoice['payload']['timestamp'],
89+
$invoice['payload']['from']['name'],
90+
$invoice['payload']['to']['account'],
91+
$invoice['payload']['debitamount'],
92+
'',
93+
];
9594

9695
$table->setRows($row);
9796
$table->render();

src/Http/Client.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ public function post(array $params, string $route): array
4747
* Send Get request to BML API
4848
*
4949
* @param mixed $route
50-
*
5150
*/
5251
public function get(string $route)
5352
{

0 commit comments

Comments
 (0)