From c6c83401129ccd7f12ca0c6bfc9f6d2837ca7914 Mon Sep 17 00:00:00 2001 From: Guillermo Gutierrez Almazor Date: Fri, 17 Apr 2026 16:27:04 +0200 Subject: [PATCH 1/2] chore: sync listCharges fixture with certificate-purchase entry --- tests/Dnsimple/Service/BillingTest.php | 9 +++++++-- tests/fixtures/v2/api/listCharges/success.http | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/Dnsimple/Service/BillingTest.php b/tests/Dnsimple/Service/BillingTest.php index a1c56a2..5d108aa 100644 --- a/tests/Dnsimple/Service/BillingTest.php +++ b/tests/Dnsimple/Service/BillingTest.php @@ -27,7 +27,7 @@ public function testListCharges() self::assertEquals(200, $response->getStatusCode()); $data = $response->getData(); - self::assertCount(3, $data); + self::assertCount(4, $data); $charge = $data[0]; self::assertInstanceOf(Charge::class, $charge); @@ -40,6 +40,11 @@ public function testListCharges() self::assertInstanceOf(BigDecimal::class, $item->amount); self::assertEquals(BigDecimal::of("14.50"), $item->amount); self::assertEquals("Register bubble-registered.com", $item->description); + + $certCharge = $data[3]; + self::assertEquals("5-2", $certCharge->reference); + self::assertEquals("certificate-purchase", $certCharge->items[0]->productType); + self::assertSame("42", $certCharge->items[0]->productReference); } public function testListChargesSupportsFilters() @@ -67,7 +72,7 @@ public function testListChargesHasPaginationObject() self::assertEquals(1, $pagination->currentPage); self::assertEquals(30, $pagination->perPage); - self::assertEquals(3, $pagination->totalEntries); + self::assertEquals(4, $pagination->totalEntries); self::assertEquals(1, $pagination->totalPages); } diff --git a/tests/fixtures/v2/api/listCharges/success.http b/tests/fixtures/v2/api/listCharges/success.http index 70e5d03..851d232 100644 --- a/tests/fixtures/v2/api/listCharges/success.http +++ b/tests/fixtures/v2/api/listCharges/success.http @@ -9,4 +9,4 @@ cache-control: no-store, must-revalidate, private, max-age=0 x-request-id: a57a87c8-626a-4361-9fb8-b55ca9be8e5d x-runtime: 0.060526 -{"data":[{"invoiced_at":"2023-08-17T05:53:36Z","total_amount":"14.50","balance_amount":"0.00","reference":"1-2","state":"collected","items":[{"description":"Register bubble-registered.com","amount":"14.50","product_id":1,"product_type":"domain-registration","product_reference":"bubble-registered.com"}]},{"invoiced_at":"2023-08-17T05:57:53Z","total_amount":"14.50","balance_amount":"0.00","reference":"2-2","state":"refunded","items":[{"description":"Register example.com","amount":"14.50","product_id":2,"product_type":"domain-registration","product_reference":"example.com"}]},{"invoiced_at":"2023-10-24T07:49:05Z","total_amount":"1099999.99","balance_amount":"0.00","reference":"4-2","state":"collected","items":[{"description":"Test Line Item 1","amount":"99999.99","product_id":null,"product_type":"manual","product_reference":null},{"description":"Test Line Item 2","amount":"1000000.00","product_id":null,"product_type":"manual","product_reference":null}]}],"pagination":{"current_page":1,"per_page":30,"total_entries":3,"total_pages":1}} +{"data":[{"invoiced_at":"2023-08-17T05:53:36Z","total_amount":"14.50","balance_amount":"0.00","reference":"1-2","state":"collected","items":[{"description":"Register bubble-registered.com","amount":"14.50","product_id":1,"product_type":"domain-registration","product_reference":"bubble-registered.com"}]},{"invoiced_at":"2023-08-17T05:57:53Z","total_amount":"14.50","balance_amount":"0.00","reference":"2-2","state":"refunded","items":[{"description":"Register example.com","amount":"14.50","product_id":2,"product_type":"domain-registration","product_reference":"example.com"}]},{"invoiced_at":"2023-10-24T07:49:05Z","total_amount":"1099999.99","balance_amount":"0.00","reference":"4-2","state":"collected","items":[{"description":"Test Line Item 1","amount":"99999.99","product_id":null,"product_type":"manual","product_reference":null},{"description":"Test Line Item 2","amount":"1000000.00","product_id":null,"product_type":"manual","product_reference":null}]},{"invoiced_at":"2023-10-24T09:00:00Z","total_amount":"20.00","balance_amount":"0.00","reference":"5-2","state":"collected","items":[{"description":"Purchase Certificate www.bubble-registered.com","amount":"20.00","product_id":42,"product_type":"certificate-purchase","product_reference":"42"}]}],"pagination":{"current_page":1,"per_page":30,"total_entries":4,"total_pages":1}} From 667c5760333b2d7d34df7d0b591e3d283351fa3f Mon Sep 17 00:00:00 2001 From: Guillermo Gutierrez Almazor Date: Sat, 18 Apr 2026 09:30:36 +0200 Subject: [PATCH 2/2] chore: add CHANGELOG entry for listCharges fixture sync --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bfc4f75..f99da1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ This project uses [Semantic Versioning 2.0.0](http://semver.org/), the format is ## main +### Changed + +- Updated the `listCharges` test fixture to include a certificate purchase entry demonstrating that `productReference` is a string even when it represents a numeric ID. (#166) + ### Removed - **BREAKING**: Removed the deprecated `contactId` field from the `Certificate` struct. The field was deprecated on 2022-05-17 and is no longer required for certificate operations.