| 123456789101112131415161718192021222324252627282930313233343536373839 |
- <?php
- namespace App\Data\Pagarme\Request\PagarmeOrderRequestData;
- use App\Data\Pagarme\PagarmeData;
- /**
- * @param array<int, array{code?: string, amount?: int, quantity?: int, description?: string, ...}> $items Lista de itens do pedido
- * @param array<int, array{payment_method: string, ...}> $payments Lista de formas de pagamento
- * @param array<string, mixed> $metadata Metadados do pedido (ex: payment_id, schedule_id, client_id, provider_id)
- * @param array<string, mixed>|null $customer Dados do cliente (name, email, document, type, etc.)
- */
- readonly class PagarmeOrderRequestData extends PagarmeData
- {
- public function __construct(
- public string $code,
- public array $items,
- public array $payments,
- public array $metadata,
- public ?array $customer = null,
- public ?string $customerId = null,
- public bool $closed = true,
- public ?string $channel = null,
- ) {}
- public function toArray(): array
- {
- return $this->filterFilledRecursive([
- 'code' => $this->code,
- 'items' => $this->items,
- 'payments' => $this->payments,
- 'closed' => $this->closed,
- 'metadata' => $this->metadata,
- 'customer_id' => $this->customerId,
- 'customer' => $this->customer,
- 'channel' => $this->channel,
- ]);
- }
- }
|