Skip to content

Commit

Permalink
Merge pull request #457 from mercadopago/fix/deprecated-properties
Browse files Browse the repository at this point in the history
Fix resources mapping
  • Loading branch information
rhames07 authored Sep 27, 2023
2 parents cf42402 + cddf0b8 commit 895b86d
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 11 deletions.
3 changes: 3 additions & 0 deletions src/MercadoPago/Resources/Common/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
/** Address class. */
class Address
{
/** Addess ID. */
public ?string $id;

/** Zip code. */
public ?string $zip_code;

Expand Down
3 changes: 3 additions & 0 deletions src/MercadoPago/Resources/CustomerCard.php
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
16 changes: 11 additions & 5 deletions src/MercadoPago/Resources/MerchantOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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",
];

/**
Expand Down
7 changes: 5 additions & 2 deletions src/MercadoPago/Resources/MerchantOrder/Collector.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@

class Collector
{
/** Payer ID. */
/** Collector ID. */
public ?int $id;

/** Payer nickname. */
/** Collector nickname. */
public ?string $nickname;

/** Email. */
public ?string $email;
}
15 changes: 15 additions & 0 deletions src/MercadoPago/Resources/PaymentRefund.php
Original file line number Diff line number Diff line change
Expand Up @@ -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"
];
Expand Down
21 changes: 21 additions & 0 deletions src/MercadoPago/Resources/Preference.php
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
9 changes: 6 additions & 3 deletions src/MercadoPago/Resources/Preference/PaymentMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 895b86d

Please sign in to comment.