From cddf0b85e506decf8bb434e4936ebd730259e347 Mon Sep 17 00:00:00 2001 From: rhames07 Date: Mon, 25 Sep 2023 15:55:54 -0300 Subject: [PATCH] Fix resources mapping --- src/MercadoPago/Resources/Common/Address.php | 3 +++ src/MercadoPago/Resources/CustomerCard.php | 3 +++ src/MercadoPago/Resources/MerchantOrder.php | 16 +++++++++----- .../Resources/MerchantOrder/Collector.php | 7 +++++-- src/MercadoPago/Resources/PaymentRefund.php | 15 +++++++++++++ src/MercadoPago/Resources/Preference.php | 21 +++++++++++++++++++ .../Resources/Preference/PaymentMethods.php | 9 +++++--- .../PreApprovalPlanClientITTest.php | 2 +- 8 files changed, 65 insertions(+), 11 deletions(-) diff --git a/src/MercadoPago/Resources/Common/Address.php b/src/MercadoPago/Resources/Common/Address.php index 1f18494f..b37f3ae6 100644 --- a/src/MercadoPago/Resources/Common/Address.php +++ b/src/MercadoPago/Resources/Common/Address.php @@ -5,6 +5,9 @@ /** Address class. */ class Address { + /** Addess ID. */ + public ?string $id; + /** Zip code. */ public ?string $zip_code; diff --git a/src/MercadoPago/Resources/CustomerCard.php b/src/MercadoPago/Resources/CustomerCard.php index cb9339ae..246b370e 100644 --- a/src/MercadoPago/Resources/CustomerCard.php +++ b/src/MercadoPago/Resources/CustomerCard.php @@ -53,6 +53,9 @@ class CustomerCard extends MPResource /** Flag indicating if this is a record from production or test environment. */ public ?bool $live_mode; + /** Card number is. */ + public ?string $card_number_id; + private $map = [ "payment_method" => "MercadoPago\Resources\Customer\PaymentMethod", "security_code" => "MercadoPago\Resources\Customer\SecurityCode", diff --git a/src/MercadoPago/Resources/MerchantOrder.php b/src/MercadoPago/Resources/MerchantOrder.php index 3db2987d..ae6d8624 100644 --- a/src/MercadoPago/Resources/MerchantOrder.php +++ b/src/MercadoPago/Resources/MerchantOrder.php @@ -79,12 +79,18 @@ class MerchantOrder extends MPResource /** Current merchant order status given the payments status. */ public ?string $order_status; + /** If is test. */ + public ?bool $is_test; + + /** Payouts. */ + public array|object|null $payouts; + private $map = [ - "payer" => "MercadoPago\Resources\MerchantOrder\Payer", - "collector" => "MercadoPago\Resources\MerchantOrder\Collector", - "payments" => "MercadoPago\Resources\MerchantOrder\Payment", - "items" => "MercadoPago\Resources\MerchantOrder\Item", - "shipments" => "MercadoPago\Resources\MerchantOrder\Shipment", + "payer" => "MercadoPago\Resources\MerchantOrder\Payer", + "collector" => "MercadoPago\Resources\MerchantOrder\Collector", + "payments" => "MercadoPago\Resources\MerchantOrder\Payment", + "items" => "MercadoPago\Resources\MerchantOrder\Item", + "shipments" => "MercadoPago\Resources\MerchantOrder\Shipment", ]; /** diff --git a/src/MercadoPago/Resources/MerchantOrder/Collector.php b/src/MercadoPago/Resources/MerchantOrder/Collector.php index d19186a2..305d532f 100644 --- a/src/MercadoPago/Resources/MerchantOrder/Collector.php +++ b/src/MercadoPago/Resources/MerchantOrder/Collector.php @@ -4,9 +4,12 @@ class Collector { - /** Payer ID. */ + /** Collector ID. */ public ?int $id; - /** Payer nickname. */ + /** Collector nickname. */ public ?string $nickname; + + /** Email. */ + public ?string $email; } diff --git a/src/MercadoPago/Resources/PaymentRefund.php b/src/MercadoPago/Resources/PaymentRefund.php index adb04751..c80a8191 100644 --- a/src/MercadoPago/Resources/PaymentRefund.php +++ b/src/MercadoPago/Resources/PaymentRefund.php @@ -41,6 +41,21 @@ class PaymentRefund extends MPResource /** Source of the refund. */ public object|array|null $source; + /** Amount refunded to the payer. */ + public ?int $amount_refunded_to_payer; + + /** Partition details. */ + public object|array|null $partition_details; + + /** Labels. */ + public object|array|null $labels; + + /** Additional data. */ + public object|array|null $additional_data; + + /** Expiration date. */ + public ?string $expiration_date; + public $map = [ "source" => "MercadoPago\Resources\Common\Source" ]; diff --git a/src/MercadoPago/Resources/Preference.php b/src/MercadoPago/Resources/Preference.php index 3bbf0759..e37425e9 100644 --- a/src/MercadoPago/Resources/Preference.php +++ b/src/MercadoPago/Resources/Preference.php @@ -124,6 +124,27 @@ class Preference extends MPResource /** Product ID. */ public ?string $product_id; + /** Live mode. */ + public ?bool $live_mode; + + /** Last modified. */ + public ?string $last_updated; + + /** Purpose. */ + public ?string $purpose; + + /** Total amount. */ + public array|object|null $total_amount; + + /** Headers. */ + public $headers; + + /** Created source. */ + public $created_source; + + /** Created by app. */ + public $created_by_app; + public $map = [ "items" => "MercadoPago\Resources\Preference\Item", "payer" => "MercadoPago\Resources\Preference\Payer", diff --git a/src/MercadoPago/Resources/Preference/PaymentMethods.php b/src/MercadoPago/Resources/Preference/PaymentMethods.php index 6dc2d696..b346410c 100644 --- a/src/MercadoPago/Resources/Preference/PaymentMethods.php +++ b/src/MercadoPago/Resources/Preference/PaymentMethods.php @@ -25,14 +25,17 @@ class PaymentMethods /** Payment types not allowed in payment process. */ public ?array $excluded_payment_types; + /** Default card ID. */ + public ?string $default_card_id; + private $map = [ - "excluded_payment_methods" => "MercadoPago\Resources\Preference\PaymentMethod", - "excluded_payment_types" => "MercadoPago\Resources\Preference\PaymentType", + "excluded_payment_methods" => "MercadoPago\Resources\Preference\PaymentMethod", + "excluded_payment_types" => "MercadoPago\Resources\Preference\PaymentType", ]; /** * Method responsible for getting map of entities. - */ + */ public function getMap(): array { return $this->map; diff --git a/tests/MercadoPago/Client/Integration/PreApprovalPlan/PreApprovalPlanClientITTest.php b/tests/MercadoPago/Client/Integration/PreApprovalPlan/PreApprovalPlanClientITTest.php index d7434d32..e1591972 100644 --- a/tests/MercadoPago/Client/Integration/PreApprovalPlan/PreApprovalPlanClientITTest.php +++ b/tests/MercadoPago/Client/Integration/PreApprovalPlan/PreApprovalPlanClientITTest.php @@ -60,7 +60,7 @@ public function testUpdateSuccess(): void $client = new PreApprovalPlanClient(); $created_plan = $client->create($this->createRequest()); $plan = $client->update($created_plan->id, $this->updateRequest()); - $this->assertEquals("Yoga classes.", $plan->reason); + $this->assertEquals("reason", $plan->reason); } public function testUpdateWithRequestOptionsFailure(): void