|
@@ -15,20 +15,20 @@ use App\Enums\PaymentStatusEnum;
|
|
|
final readonly class PagarmeOrderResponseData
|
|
final readonly class PagarmeOrderResponseData
|
|
|
{
|
|
{
|
|
|
public function __construct(
|
|
public function __construct(
|
|
|
- public ?string $id,
|
|
|
|
|
- public ?string $code,
|
|
|
|
|
- public ?int $amount,
|
|
|
|
|
- public ?string $currency,
|
|
|
|
|
- public ?bool $closed,
|
|
|
|
|
- public ?string $status,
|
|
|
|
|
- public array $items,
|
|
|
|
|
- public ?PagarmeCustomerResponseData $customer,
|
|
|
|
|
- public array $charges,
|
|
|
|
|
- public array $checkouts,
|
|
|
|
|
- public array $metadata,
|
|
|
|
|
- public ?string $createdAt = null,
|
|
|
|
|
- public ?string $updatedAt = null,
|
|
|
|
|
- public ?string $closedAt = null,
|
|
|
|
|
|
|
+ public ?string $id,
|
|
|
|
|
+ public ?string $code,
|
|
|
|
|
+ public ?int $amount,
|
|
|
|
|
+ public ?string $currency,
|
|
|
|
|
+ public ?bool $closed,
|
|
|
|
|
+ public ?string $status,
|
|
|
|
|
+ public array $items,
|
|
|
|
|
+ public ?PagarmeCustomerResponseData $customer,
|
|
|
|
|
+ public array $charges,
|
|
|
|
|
+ public array $checkouts,
|
|
|
|
|
+ public array $metadata,
|
|
|
|
|
+ public ?string $createdAt = null,
|
|
|
|
|
+ public ?string $updatedAt = null,
|
|
|
|
|
+ public ?string $closedAt = null,
|
|
|
) {}
|
|
) {}
|
|
|
|
|
|
|
|
public function authorizedAt(): ?string
|
|
public function authorizedAt(): ?string
|
|
@@ -175,12 +175,14 @@ final readonly class PagarmeOrderResponseData
|
|
|
public static function fromArray(array $payload): self
|
|
public static function fromArray(array $payload): self
|
|
|
{
|
|
{
|
|
|
return new self(
|
|
return new self(
|
|
|
- id: $payload['id'] ?? null,
|
|
|
|
|
- code: $payload['code'] ?? null,
|
|
|
|
|
- amount: isset($payload['amount']) ? (int) $payload['amount'] : null,
|
|
|
|
|
- currency: $payload['currency'] ?? null,
|
|
|
|
|
- closed: $payload['closed'] ?? null,
|
|
|
|
|
- status: $payload['status'] ?? null,
|
|
|
|
|
|
|
+ id: $payload['id'] ?? null,
|
|
|
|
|
+ code: $payload['code'] ?? null,
|
|
|
|
|
+
|
|
|
|
|
+ amount: isset($payload['amount']) ? (int) $payload['amount'] : null,
|
|
|
|
|
+
|
|
|
|
|
+ currency: $payload['currency'] ?? null,
|
|
|
|
|
+ closed: $payload['closed'] ?? null,
|
|
|
|
|
+ status: $payload['status'] ?? null,
|
|
|
|
|
|
|
|
items: array_map(
|
|
items: array_map(
|
|
|
static fn (array $item) => PagarmeOrderItemResponseData::fromArray($item),
|
|
static fn (array $item) => PagarmeOrderItemResponseData::fromArray($item),
|
|
@@ -238,7 +240,7 @@ final readonly class PagarmeOrderResponseData
|
|
|
$this->checkouts,
|
|
$this->checkouts,
|
|
|
),
|
|
),
|
|
|
|
|
|
|
|
- 'metadata' => $this->metadata,
|
|
|
|
|
|
|
+ 'metadata' => $this->metadata,
|
|
|
];
|
|
];
|
|
|
}
|
|
}
|
|
|
|
|
|