From a9e44b3ff0a10c9ef90467170090da8cc3e636f5 Mon Sep 17 00:00:00 2001 From: Sander van Hooft Date: Mon, 23 Oct 2023 13:11:55 +0200 Subject: [PATCH] wip --- .../SettlementChargebackEndpointTest.php | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 tests/Mollie/API/Endpoints/SettlementChargebackEndpointTest.php diff --git a/tests/Mollie/API/Endpoints/SettlementChargebackEndpointTest.php b/tests/Mollie/API/Endpoints/SettlementChargebackEndpointTest.php new file mode 100644 index 00000000..cdafc483 --- /dev/null +++ b/tests/Mollie/API/Endpoints/SettlementChargebackEndpointTest.php @@ -0,0 +1,88 @@ +mockApiCall( + new Request( + 'GET', + '/v2/settlements/stl_jDk30akdN/chargebacks?limit=5&foo=bar' + ), + new Response( + 200, + [], + '{ + "count": 1, + "_embedded": { + "chargebacks": [ + { + "resource": "chargeback", + "id": "chb_n9z0tp", + "amount": { + "value": "43.38", + "currency": "USD" + }, + "settlementAmount": { + "value": "-37.14", + "currency": "EUR" + }, + "createdAt": "2018-03-14T17:00:52.0Z", + "reversedAt": null, + "paymentId": "tr_WDqYK6vllg", + "settlementId": "stl_jDk30akdN", + "_links": { + "self": { + "href": "https://api.mollie.com/v2/payments/tr_WDqYK6vllg/chargebacks/chb_n9z0tp", + "type": "application/hal+json" + }, + "payment": { + "href": "https://api.mollie.com/v2/payments/tr_WDqYK6vllg", + "type": "application/hal+json" + }, + "settlement": { + "href": "https://api.mollie.com/v2/settlements/stl_jDk30akdN", + "type": "application/hal+json" + } + } + } + ] + }, + "_links": { + "documentation": { + "href": "https://docs.mollie.com/reference/v2/settlements-api/list-settlement-chargebacks", + "type": "text/html" + }, + "self": { + "href": "https://api.mollie.com/v2/settlements/stl_jDk30akdN/chargebacks", + "type": "application/hal+json" + }, + "previous": null, + "next": null + } + }' + ) + ); + + $settlement = new Settlement($this->apiClient); + $settlement->id = 'stl_jDk30akdN'; + + $chargebacks = $settlement->chargebacks(5, ['foo' => 'bar']); + + $this->assertInstanceOf(ChargebackCollection::class, $chargebacks); + $this->assertCount(1, $chargebacks); + + $chargeback = $chargebacks[0]; + $this->assertInstanceOf(Chargeback::class, $chargeback); + $this->assertEquals("chb_n9z0tp", $chargeback->id); + } +} \ No newline at end of file