Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
  • Loading branch information
crynobone committed May 2, 2023
1 parent cc377ba commit b284c7c
Show file tree
Hide file tree
Showing 13 changed files with 78 additions and 78 deletions.
36 changes: 18 additions & 18 deletions tests/Base/BankAccountTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ public function it_can_get_a_bank_account()
$expected = '{"name":"sara","id_no":"820909101001","acc_no":"1234567890","code":"MBBEMYKL","organization":false,"authorization_date":"2015-12-03","status":"pending","processed_at":null,"rejected_desc":null}';

$faker = $this->expectRequest('GET', "bank_verification_services/{$bank_account_number}")
->shouldResponseWithJson(200, $expected);
->shouldResponseWithJson(200, $expected);

$response = $this->makeClient($faker)
->uses('BankAccount')
->get($bank_account_number);
->uses('BankAccount')
->get($bank_account_number);

$this->assertInstanceOf(Response::class, $response);
$this->assertSame(200, $response->getStatusCode());
Expand All @@ -51,17 +51,17 @@ public function it_can_create_bank_account()
];

$faker = $this->expectRequest('POST', 'bank_verification_services', [], $data)
->shouldResponseWithJson(200, $expected);
->shouldResponseWithJson(200, $expected);

$response = $this->makeClient($faker)
->uses('BankAccount')
->create(
$data['name'],
$data['id_no'],
$data['acc_no'],
$data['code'],
$data['organization']
);
->uses('BankAccount')
->create(
$data['name'],
$data['id_no'],
$data['acc_no'],
$data['code'],
$data['organization']
);

$this->assertInstanceOf(Response::class, $response);
$this->assertSame(200, $response->getStatusCode());
Expand All @@ -77,11 +77,11 @@ public function it_can_check_account_registration()
$expected = '{"verified":true}';

$faker = $this->expectRequest('GET', 'check/bank_account_number/jomlaunch')
->shouldResponseWithJson(200, $expected);
->shouldResponseWithJson(200, $expected);

$response = $this->makeClient($faker)
->uses('BankAccount')
->checkAccount('jomlaunch');
->uses('BankAccount')
->checkAccount('jomlaunch');

$this->assertInstanceOf(Response::class, $response);
$this->assertSame(200, $response->getStatusCode());
Expand All @@ -97,11 +97,11 @@ public function it_can_return_supported_fpx()
$expected = '{"bank":[{"name":"PBB0233","active":true},{"name":"MBB0227","active":true},{"name":"MBB0228","active":true}]}';

$faker = $this->expectRequest('GET', 'fpx_banks')
->shouldResponseWithJson(200, $expected);
->shouldResponseWithJson(200, $expected);

$response = $this->makeClient($faker)
->uses('BankAccount')
->supportedForFpx();
->uses('BankAccount')
->supportedForFpx();

$this->assertInstanceOf(Response::class, $response);
$this->assertSame(200, $response->getStatusCode());
Expand Down
6 changes: 3 additions & 3 deletions tests/Base/Bill/TransactionTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ public function it_can_check_bill_transaction()
$expected = '{"bill_id":"inbmmepb","transactions":[{"id":"60793D4707CD","status":"completed","completed_at":"2017-02-23T12:49:23.612+08:00","payment_channel":"FPX"},{"id":"28F3D3194138","status":"failed","completed_at":,"payment_channel":"FPX"}],"page":1}';

$faker = $this->expectRequest('GET', 'bills/inbmmepb/transactions')
->shouldResponseWithJson(200, $expected);
->shouldResponseWithJson(200, $expected);

$response = $this->makeClient($faker)
->uses('Bill.Transaction')
->get('inbmmepb');
->uses('Bill.Transaction')
->get('inbmmepb');

$this->assertInstanceOf(Response::class, $response);
$this->assertSame(200, $response->getStatusCode());
Expand Down
2 changes: 1 addition & 1 deletion tests/Base/Collection/PaymentMethodTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function it_can_set_payment_methods()
];

$faker = $this->expectRequest('PUT', 'collections/0idsxnh5/payment_methods', [], $payload)
->shouldResponseWithJson(200, $expected);
->shouldResponseWithJson(200, $expected);

$response = $this->makeClient($faker)->uses('Collection.PaymentMethod')->update('0idsxnh5', ['fpx', 'paypal']);

Expand Down
30 changes: 15 additions & 15 deletions tests/Base/CollectionTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ public function it_can_create_collection()
$expected = '{"id":"inbmmepb","title":"My First V4 API Collection","logo":{"thumb_url":null,"avatar_url":null},"split_header":false,"split_payments":[]}';

$faker = $this->expectStreamRequest('POST', 'collections', [], $payload)
->shouldResponseWithJson(200, $expected);
->shouldResponseWithJson(200, $expected);

$response = $this->makeClient($faker)
->uses('Collection')
->create($payload['title']);
->uses('Collection')
->create($payload['title']);

$this->assertInstanceOf(Response::class, $response);
$this->assertSame(200, $response->getStatusCode());
Expand All @@ -46,11 +46,11 @@ public function it_can_list_collections()
$expected = '{"collections":[{"id":"inbmmepb","title":"My First API Collection","logo":{"thumb_url":null,"avatar_url":null},"split_payment":{"email":null,"fixed_cut":null,"variable_cut":null,"split_header":false},"status":"active"}],"page":1}';

$faker = $this->expectRequest('GET', 'collections')
->shouldResponseWithJson(200, $expected);
->shouldResponseWithJson(200, $expected);

$response = $this->makeClient($faker)
->uses('Collection')
->all();
->uses('Collection')
->all();

$this->assertInstanceOf(Response::class, $response);
$this->assertSame(200, $response->getStatusCode());
Expand All @@ -66,11 +66,11 @@ public function it_can_show_collection()
$expected = '{"id":"inbmmepb","title":"My First API Collection","logo":{"thumb_url":null,"avatar_url":null},"split_payment":{"email":null,"fixed_cut":null,"variable_cut":null,"split_header":false},"status":"active"}';

$faker = $this->expectRequest('GET', 'collections/inbmmepb')
->shouldResponseWithJson(200, $expected);
->shouldResponseWithJson(200, $expected);

$response = $this->makeClient($faker)
->uses('Collection')
->get('inbmmepb');
->uses('Collection')
->get('inbmmepb');

$this->assertInstanceOf(Response::class, $response);
$this->assertSame(200, $response->getStatusCode());
Expand All @@ -86,11 +86,11 @@ public function it_can_activate_collection()
$expected = '{}';

$faker = $this->expectRequest('POST', 'collections/inbmmepb/activate')
->shouldResponseWithJson(200, $expected);
->shouldResponseWithJson(200, $expected);

$response = $this->makeClient($faker)
->uses('Collection')
->activate('inbmmepb');
->uses('Collection')
->activate('inbmmepb');

$this->assertInstanceOf(Response::class, $response);
$this->assertSame(200, $response->getStatusCode());
Expand All @@ -106,11 +106,11 @@ public function it_can_deactivate_collection()
$expected = '{}';

$faker = $this->expectRequest('POST', 'collections/inbmmepb/deactivate')
->shouldResponseWithJson(200, $expected);
->shouldResponseWithJson(200, $expected);

$response = $this->makeClient($faker)
->uses('Collection')
->deactivate('inbmmepb');
->uses('Collection')
->deactivate('inbmmepb');

$this->assertInstanceOf(Response::class, $response);
$this->assertSame(200, $response->getStatusCode());
Expand Down
18 changes: 9 additions & 9 deletions tests/Base/OpenCollectionTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ public function it_can_create_collection()
$expected = '{"id":"0pp87t_6","title":"My First API Collection","description":"Maecenas eu placerat ante. Fusce ut neque justo, et aliquet enim. In hac habitasse platea dictumst.","reference_1_label":null,"reference_2_label":null,"email_link":null,"amount":299,"fixed_amount":true,"tax":null,"fixed_quantity":true,"payment_button":"pay","photo":["retina_url":null,"avatar_url":null],"split_payment":["email":null,"fixed_cut":null,"variable_cut":null],"url":"https://www.billplz.com/0pp87t_6"}';

$faker = $this->expectStreamRequest('POST', 'open_collections', [], $payload)
->shouldResponseWithJson(200, $expected);
->shouldResponseWithJson(200, $expected);

$response = $this->makeClient($faker)
->uses('OpenCollection')
->create($payload['title'], $payload['description'], $payload['amount']);
->uses('OpenCollection')
->create($payload['title'], $payload['description'], $payload['amount']);

$this->assertInstanceOf(Response::class, $response);
$this->assertSame(200, $response->getStatusCode());
Expand All @@ -48,11 +48,11 @@ public function it_can_list_collections()
$expected = '{"collections":[{"id":"0pp87t_6","title":"My First API Collection","description":"Maecenas eu placerat ante. Fusce ut neque justo, et aliquet enim. In hac habitasse platea dictumst.","reference_1_label":null,"reference_2_label":null,"email_link":null,"amount":299,"fixed_amount":true,"tax":null,"fixed_quantity":true,"payment_button":"pay","photo":["retina_url":null,"avatar_url":null],"split_payment":["email":null,"fixed_cut":null,"variable_cut":null],"url":"https://www.billplz.com/0pp87t_6"}],"page":1}';

$faker = $this->expectRequest('GET', 'open_collections')
->shouldResponseWithJson(200, $expected);
->shouldResponseWithJson(200, $expected);

$response = $this->makeClient($faker)
->uses('OpenCollection')
->all();
->uses('OpenCollection')
->all();

$this->assertInstanceOf(Response::class, $response);
$this->assertSame(200, $response->getStatusCode());
Expand All @@ -68,11 +68,11 @@ public function it_can_show_collection()
$expected = '{"id":"0pp87t_6","title":"My First API Collection","description":"Maecenas eu placerat ante. Fusce ut neque justo, et aliquet enim. In hac habitasse platea dictumst.","reference_1_label":null,"reference_2_label":null,"email_link":null,"amount":299,"fixed_amount":true,"tax":null,"fixed_quantity":true,"payment_button":"pay","photo":["retina_url":null,"avatar_url":null],"split_payment":["email":null,"fixed_cut":null,"variable_cut":null],"url":"https://www.billplz.com/0pp87t_6"}';

$faker = $this->expectRequest('GET', 'open_collections/0pp87t_6')
->shouldResponseWithJson(200, $expected);
->shouldResponseWithJson(200, $expected);

$response = $this->makeClient($faker)
->uses('OpenCollection')
->get('0pp87t_6');
->uses('OpenCollection')
->get('0pp87t_6');

$this->assertInstanceOf(Response::class, $response);
$this->assertSame(200, $response->getStatusCode());
Expand Down
6 changes: 3 additions & 3 deletions tests/Four/BillTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ public function it_can_charge_credit_card_via_token()
$expected = '{"amount":10000,"status":"success","reference_id":"15681981586116610","hash_value":"1b66606732d846192b0b6aa4b754b3c8addd59072fce4bdd066b5d631c31d5e8","message":"Payment was successful"}';

$faker = $this->expectRequest('POST', 'bills/awyzmy0m/charge', [], $payload)
->shouldResponseWith(200, $expected);
->shouldResponseWith(200, $expected);

$response = $this->makeClient($faker)
->uses('Bill')
->charge('awyzmy0m', $payload['card_id'], $payload['token']);
->uses('Bill')
->charge('awyzmy0m', $payload['card_id'], $payload['token']);

$this->assertInstanceOf(Response::class, $response);
$this->assertSame(200, $response->getStatusCode());
Expand Down
32 changes: 16 additions & 16 deletions tests/Four/CardTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,18 @@ public function it_can_create_a_valid_credit_card()
$expected = '{"id":"8727fc3a-c04c-4c2b-9b67-947b5cfc2fb6","card_number":"xxxx1118","expiry":"0521","provider":"mastercard","token":"77d62ad5a3ae56aafc8e3529b89d0268afa205303f6017afbd9826afb8394740","active":true}';

$faker = $this->expectRequest('POST', 'cards', [], $payload)
->shouldResponseWith(200, $expected);
->shouldResponseWith(200, $expected);

$response = $this->makeClient($faker)
->uses('Card')
->create(
$payload['name'],
$payload['email'],
$payload['phone'],
$payload['card_number'],
$payload['cvv'],
$payload['expiry']
);
->uses('Card')
->create(
$payload['name'],
$payload['email'],
$payload['phone'],
$payload['card_number'],
$payload['cvv'],
$payload['expiry']
);

$this->assertInstanceOf(Response::class, $response);
$this->assertSame(200, $response->getStatusCode());
Expand Down Expand Up @@ -86,11 +86,11 @@ public function it_can_activate_a_credit_card()
$expected = '{"id":"8727fc3a-c04c-4c2b-9b67-947b5cfc2fb6","card_number":"xxxx1118","expiry":"0521","provider":"mastercard","token":"77d62ad5a3ae56aafc8e3529b89d0268afa205303f6017afbd9826afb8394740","active":true}';

$faker = $this->expectRequest('PUT', "cards/{$cardId}", [], $payload)
->shouldResponseWith(200, $expected);
->shouldResponseWith(200, $expected);

$response = $this->makeClient($faker)
->uses('Card')
->activate($cardId, $payload['token']);
->uses('Card')
->activate($cardId, $payload['token']);

$this->assertInstanceOf(Response::class, $response);
$this->assertSame(200, $response->getStatusCode());
Expand Down Expand Up @@ -118,11 +118,11 @@ public function it_can_deactivate_a_credit_card()
$expected = '{"id":"8727fc3a-c04c-4c2b-9b67-947b5cfc2fb6","card_number":"xxxx1118","expiry":"0521","provider":"mastercard","token":"77d62ad5a3ae56aafc8e3529b89d0268afa205303f6017afbd9826afb8394740","active":false}';

$faker = $this->expectRequest('PUT', "cards/{$cardId}", [], $payload)
->shouldResponseWith(200, $expected);
->shouldResponseWith(200, $expected);

$response = $this->makeClient($faker)
->uses('Card')
->deactivate($cardId, $payload['token']);
->uses('Card')
->deactivate($cardId, $payload['token']);

$this->assertInstanceOf(Response::class, $response);
$this->assertSame(200, $response->getStatusCode());
Expand Down
4 changes: 2 additions & 2 deletions tests/Four/Collection/PayoutTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function it_can_get_mass_payment_for_collection()
$expected = '{"id":"4po8no8h","title":"My First API MPI Collection","mass_payment_instructions_count":"0","paid_amount":"0","status":"active"}';

$faker = $this->expectRequest('GET', 'mass_payment_instruction_collections/4po8no8h')
->shouldResponseWithJson(200, $expected);
->shouldResponseWithJson(200, $expected);

$response = $this->makeClient($faker)->uses('Collection.Payout')->get('4po8no8h');

Expand All @@ -47,7 +47,7 @@ public function it_can_create_mass_payment_for_collection()
$expected = '{"id":"4po8no8h","title":"My First API MPI Collection","mass_payment_instructions_count":"0","paid_amount":"0","status":"active"}';

$faker = $this->expectRequest('POST', 'mass_payment_instruction_collections', [], ['title' => 'My First API MPI Collection'])
->shouldResponseWithJson(200, $expected);
->shouldResponseWithJson(200, $expected);

$response = $this->makeClient($faker)->uses('Collection.Payout')->create('My First API MPI Collection');

Expand Down
2 changes: 1 addition & 1 deletion tests/Four/PaymentGatewayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function it_can_get_payment_gateway_index()
$expected = '{"payment_gateways":[{"code":"MBU0227","active":true,"category":"fpx"},{"code":"OCBC0229","active":false,"category":"fpx"},{"code":"BP-FKR01","active":true,"category":"billplz"},{"code":"BP-PPL01","active":true,"category":"paypal"},{"code":"BP-2C2P1","active":false,"category":"2c2p"},{"code":"BP-OCBC1","active":true,"category":"ocbc"}]}';

$faker = $this->expectRequest('GET', 'payment_gateways')
->shouldResponseWithJson(200, $expected);
->shouldResponseWithJson(200, $expected);

$response = $this->makeClient($faker)->uses('PaymentGateway')->all();

Expand Down
4 changes: 2 additions & 2 deletions tests/Four/PayoutTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function it_can_get_mass_payment()
$expected = '{"id":"afae4bqf","mass_payment_instruction_collection_id":"4po8no8h","bank_code":"MBBEMYKL","bank_account_number":"820808062202123","identity_number":820808062202,"name":"Michael Yap","description":"Maecenas eu placerat ante.","email":"hello@billplz.com","status":"processing","notification":false,"recipient_notification":true,"total":"2000"}';

$faker = $this->expectRequest('GET', 'mass_payment_instructions/afae4bqf')
->shouldResponseWithJson(200, $expected);
->shouldResponseWithJson(200, $expected);

$response = $this->makeClient($faker)->uses('Payout')->get('afae4bqf');

Expand Down Expand Up @@ -57,7 +57,7 @@ public function it_can_create_mass_payment()
];

$faker = $this->expectRequest('POST', 'mass_payment_instructions', [], $payload)
->shouldResponseWithJson(200, $expected);
->shouldResponseWithJson(200, $expected);

$response = $this->makeClient($faker)->uses('Payout')->create(
'4po8no8h', 'MBBEMYKL', '820808062202123', '820808062202', 'Michael Yap', 'Maecenas eu placerat ante.', 2000
Expand Down
2 changes: 1 addition & 1 deletion tests/Four/WebhookTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function it_can_get_webhook_rank()
$expected = '{"rank":1.2}';

$faker = $this->expectRequest('GET', 'webhook_rank')
->shouldResponseWithJson(200, $expected);
->shouldResponseWithJson(200, $expected);

$response = $this->makeClient($faker)->uses('Webhook')->rank();

Expand Down
8 changes: 4 additions & 4 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ protected function expectRequest($method = 'GET', $uri = '/', array $headers = [
);

return Faker::create()
->expectEndpointIs($endpoint)
->call($method, $headers, http_build_query($body, '', '&'));
->expectEndpointIs($endpoint)
->call($method, $headers, http_build_query($body, '', '&'));
}

/**
Expand All @@ -83,8 +83,8 @@ protected function expectStreamRequest($method = 'GET', $uri = '/', array $heade
);

return Faker::create()
->expectEndpointIs($endpoint)
->stream($method, $headers);
->expectEndpointIs($endpoint)
->stream($method, $headers);
}

/**
Expand Down
Loading

0 comments on commit b284c7c

Please sign in to comment.