From da2382276bd6195803b49a7586373167a1499fa0 Mon Sep 17 00:00:00 2001 From: Sander van Hooft Date: Mon, 23 Oct 2023 13:07:46 +0200 Subject: [PATCH] wip --- tests/SettlementRefundEndpointTest.php | 91 ++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 tests/SettlementRefundEndpointTest.php diff --git a/tests/SettlementRefundEndpointTest.php b/tests/SettlementRefundEndpointTest.php new file mode 100644 index 00000000..15cd656b --- /dev/null +++ b/tests/SettlementRefundEndpointTest.php @@ -0,0 +1,91 @@ +mockApiCall( + new Request( + 'GET', + '/v2/settlements/stl_jDk30akdN/refunds?limit=5&foo=bar' + ), + new Response( + 200, + [], + '{ + "_embedded": { + "refunds": [ + { + "resource": "refund", + "id": "re_3aKhkUNigy", + "amount": { + "value": "10.00", + "currency": "EUR" + }, + "status": "refunded", + "createdAt": "2018-08-30T07:59:02+00:00", + "description": "Order #33", + "paymentId": "tr_maJaG2j8OM", + "settlementAmount": { + "value": "-10.00", + "currency": "EUR" + }, + "settlementId": "stl_jDk30akdN", + "_links": { + "self": { + "href": "https://api.mollie.com/v2/payments/tr_maJaG2j8OM/refunds/re_3aKhkUNigy", + "type": "application/hal+json" + }, + "payment": { + "href": "https://api.mollie.com/v2/payments/tr_maJaG2j8OM", + "type": "application/hal+json" + }, + "settlement": { + "href": "https://api.mollie.com/v2/settlements/stl_jDk30akdN", + "type": "application/hal+json" + } + } + }, + { } + ] + }, + "count": 1, + "_links": { + "documentation": { + "href": "https://docs.mollie.com/reference/v2/settlements-api/list-settlement-refunds", + "type": "text/html" + }, + "self": { + "href": "https://api.mollie.com/v2/settlements/stl_jDk30akdN/refunds?limit=50", + "type": "application/hal+json" + }, + "previous": null, + "next": null + } + }' + ) + ); + + $settlement = new Settlement($this->apiClient); + $settlement->id = 'stl_jDk30akdN'; + + $refunds = $settlement->refunds(5, ['foo' => 'bar']); + + $this->assertInstanceOf(RefundCollection::class, $refunds); + $this->assertCount(2, $refunds); + + $refund = $refunds[0]; + $this->assertInstanceOf(Refund::class, $refund); + $this->assertEquals("re_3aKhkUNigy", $refund->id); + } +} \ No newline at end of file