| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?php
- namespace App\Data\Pagarme\Response;
- final readonly class PagarmeTransferResponseData
- {
- public function __construct(
- public ?string $id,
- public ?int $amount,
- public ?string $type,
- public ?string $status,
- public ?int $fee,
- public ?string $fundingDate,
- public ?string $fundingEstimatedDate,
- public ?array $bankAccount,
- public ?string $bankResponse,
- public ?string $createdAt,
- public ?array $metadata,
- ) {}
- public function id(): ?string
- {
- return $this->id;
- }
- public function status(): ?string
- {
- return $this->status;
- }
- //
- public static function fromArray(array $payload): self
- {
- return new self(
- id: $payload['id'] ?? null,
- amount: $payload['amount'] ?? null,
- type: $payload['type'] ?? null,
- status: $payload['status'] ?? null,
- fee: $payload['fee'] ?? null,
- fundingDate: $payload['funding_date'] ?? null,
- fundingEstimatedDate: $payload['funding_estimated_date'] ?? null,
- bankAccount: $payload['bank_account'] ?? null,
- bankResponse: $payload['bank_response'] ?? null,
- createdAt: $payload['created_at'] ?? $payload['date_created'] ?? null,
- metadata: $payload['metadata'] ?? null,
- );
- }
- public function toArray(): array
- {
- return [
- 'id' => $this->id,
- 'amount' => $this->amount,
- 'type' => $this->type,
- 'status' => $this->status,
- 'fee' => $this->fee,
- 'funding_date' => $this->fundingDate,
- 'funding_estimated_date' => $this->fundingEstimatedDate,
- 'bank_account' => $this->bankAccount,
- 'bank_response' => $this->bankResponse,
- 'created_at' => $this->createdAt,
- 'metadata' => $this->metadata,
- ];
- }
- }
|