diff --git a/src/BigCommerce/ResponseModels/Order/RefundsResponse.php b/src/BigCommerce/ResponseModels/Order/RefundsResponse.php index 6f023769..74aae1f1 100644 --- a/src/BigCommerce/ResponseModels/Order/RefundsResponse.php +++ b/src/BigCommerce/ResponseModels/Order/RefundsResponse.php @@ -2,13 +2,13 @@ namespace BigCommerce\ApiV3\ResponseModels\Order; -use BigCommerce\ApiV3\ResourceModels\Order\RefundQuote; +use BigCommerce\ApiV3\ResourceModels\Order\Refund; use BigCommerce\ApiV3\ResponseModels\PaginatedResponse; class RefundsResponse extends PaginatedResponse { /** - * @return RefundQuote[] + * @return Refund[] */ public function refunds(): array { @@ -16,6 +16,6 @@ public function refunds(): array } protected function resourceClass(): string { - return RefundQuote::class; + return Refund::class; } } diff --git a/tests/BigCommerce/Orders/RefundsApiTest.php b/tests/BigCommerce/Orders/RefundsApiTest.php index c06d312f..8a4ddbda 100644 --- a/tests/BigCommerce/Orders/RefundsApiTest.php +++ b/tests/BigCommerce/Orders/RefundsApiTest.php @@ -28,7 +28,13 @@ public function testCanCreateQuoteRefund() public function testCanGetAll() { - $this->markTestIncomplete(); + $this->setReturnData('orders__order_refunds__get_all.json', 201); + $orderId = 1; + + $response = $this->getApi()->order($orderId)->refunds()->getAll(); + $this->assertCount(1, $response->refunds()); + $this->assertCount(1, $response->refunds()[0]->items); + $this->assertInstanceOf(OrderRefundItem::class, $response->refunds()[0]->items[0]); } public function testCanCreateRefund() diff --git a/tests/BigCommerce/responses/orders__order_refunds__get_all.json b/tests/BigCommerce/responses/orders__order_refunds__get_all.json new file mode 100644 index 00000000..95f20b47 --- /dev/null +++ b/tests/BigCommerce/responses/orders__order_refunds__get_all.json @@ -0,0 +1,42 @@ +{ + "data": [{ + "id": 1, + "order_id": 1, + "user_id": 1, + "created": "", + "reason": "test reason", + "total_amount": 1.99, + "total_tax": 1, + "items": [ + { + "item_type": "HANDLING", + "item_id": 1, + "reason": "", + "quantity": 1, + "requested_amount": 0.05 + } + ], + "payments": [ + { + "id": 1, + "provider_id": "checkout_paypalexpress", + "amount": 1.99, + "offline": true, + "is_declined": true, + "declined_message": "" + } + ] + }], + "meta": { + "pagination": { + "total": 1, + "count": 1, + "per_page": 50, + "current_page": 1, + "total_pages": 1, + "links": { + "current": "?page=1&limit=50" + } + } + } +}