From 5532416c7af715f53c22b27b4bec751de41fefe9 Mon Sep 17 00:00:00 2001 From: Matias Yocca Date: Fri, 5 Apr 2024 21:57:40 -0300 Subject: [PATCH 1/3] Fix invoice external reference type for preapprovals with alphanumeric IDs --- src/MercadoPago/Resources/Invoice.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MercadoPago/Resources/Invoice.php b/src/MercadoPago/Resources/Invoice.php index dd2b0a25..d0afab93 100644 --- a/src/MercadoPago/Resources/Invoice.php +++ b/src/MercadoPago/Resources/Invoice.php @@ -30,7 +30,7 @@ class Invoice extends MPResource public ?string $reason; /** The external reference for the invoice. */ - public ?int $external_reference; + public ?string $external_reference; /** The currency ID. */ public ?string $currency_id; From 2ae2c86c89fd2249649438db32d5149c8d01a9bc Mon Sep 17 00:00:00 2001 From: Matias Yocca Date: Fri, 5 Apr 2024 22:00:15 -0300 Subject: [PATCH 2/3] Add missing invoice fields --- src/MercadoPago/Resources/Invoice.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/MercadoPago/Resources/Invoice.php b/src/MercadoPago/Resources/Invoice.php index d0afab93..5eab7284 100644 --- a/src/MercadoPago/Resources/Invoice.php +++ b/src/MercadoPago/Resources/Invoice.php @@ -38,9 +38,15 @@ class Invoice extends MPResource /** The transaction amount. */ public ?float $transaction_amount; + /** The date for the next retry attempt. */ + public ?string $next_retry_date; + /** The debit date and time for the invoice. */ public ?string $debit_date; + /** The payment method ID. */ + public ?string $payment_method_id; + /** The retry attempt count. */ public ?int $retry_attempt; From 32a1430da07b5d3c08c6a1cabf85024e1c95d516 Mon Sep 17 00:00:00 2001 From: Matias Yocca Date: Fri, 5 Apr 2024 22:08:09 -0300 Subject: [PATCH 3/3] Update test cases and invoice search result --- src/MercadoPago/Resources/Invoice/InvoiceSearchResult.php | 2 +- tests/MercadoPago/Client/Unit/Invoice/InvoiceClientUnitTest.php | 2 +- .../Resources/Mocks/Response/Invoice/invoice_base.json | 2 +- .../Resources/Mocks/Response/Invoice/invoice_list.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/MercadoPago/Resources/Invoice/InvoiceSearchResult.php b/src/MercadoPago/Resources/Invoice/InvoiceSearchResult.php index 577bfae7..6d9cc6fd 100644 --- a/src/MercadoPago/Resources/Invoice/InvoiceSearchResult.php +++ b/src/MercadoPago/Resources/Invoice/InvoiceSearchResult.php @@ -29,7 +29,7 @@ class InvoiceSearchResult public ?string $reason; /** The external reference for the invoice. */ - public ?int $external_reference; + public ?string $external_reference; /** The currency ID. */ public ?string $currency_id; diff --git a/tests/MercadoPago/Client/Unit/Invoice/InvoiceClientUnitTest.php b/tests/MercadoPago/Client/Unit/Invoice/InvoiceClientUnitTest.php index ea22b0be..2335c318 100644 --- a/tests/MercadoPago/Client/Unit/Invoice/InvoiceClientUnitTest.php +++ b/tests/MercadoPago/Client/Unit/Invoice/InvoiceClientUnitTest.php @@ -31,7 +31,7 @@ public function testGetSuccess(): void $this->assertSame("2022-01-01T11:12:25.892-04:00", $invoice->last_modified); $this->assertSame("2c938084726fca480172750000000000", $invoice->preapproval_id); $this->assertSame("Yoga classes", $invoice->reason); - $this->assertSame(23546246234, $invoice->external_reference); + $this->assertSame("YG-23546246234", $invoice->external_reference); $this->assertSame("ARS", $invoice->currency_id); $this->assertSame(10.0, $invoice->transaction_amount); $this->assertSame("2022-01-01T11:12:25.892-04:00", $invoice->debit_date); diff --git a/tests/MercadoPago/Resources/Mocks/Response/Invoice/invoice_base.json b/tests/MercadoPago/Resources/Mocks/Response/Invoice/invoice_base.json index d097ed26..c12b58c8 100644 --- a/tests/MercadoPago/Resources/Mocks/Response/Invoice/invoice_base.json +++ b/tests/MercadoPago/Resources/Mocks/Response/Invoice/invoice_base.json @@ -5,7 +5,7 @@ "last_modified": "2022-01-01T11:12:25.892-04:00", "preapproval_id": "2c938084726fca480172750000000000", "reason": "Yoga classes", - "external_reference": 23546246234, + "external_reference": "YG-23546246234", "currency_id": "ARS", "transaction_amount": 10, "debit_date": "2022-01-01T11:12:25.892-04:00", diff --git a/tests/MercadoPago/Resources/Mocks/Response/Invoice/invoice_list.json b/tests/MercadoPago/Resources/Mocks/Response/Invoice/invoice_list.json index d2b9802f..21a7275b 100644 --- a/tests/MercadoPago/Resources/Mocks/Response/Invoice/invoice_list.json +++ b/tests/MercadoPago/Resources/Mocks/Response/Invoice/invoice_list.json @@ -12,7 +12,7 @@ "last_modified": "2022-01-01T11:12:25.892-04:00", "preapproval_id": "2c938084726fca480172750000000000", "reason": "Yoga classes", - "external_reference": 23546246234, + "external_reference": "YG-23546246234", "currency_id": "ARS", "transaction_amount": 10, "debit_date": "2022-01-01T11:12:25.892-04:00",