| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- namespace App\Data\Pagarme\Response\PagarmeRecipientResponseData;
- final readonly class PagarmeRecipientResponseData
- {
- public function __construct(
- public ?string $id,
- public ?string $name,
- public ?string $email,
- public ?string $document,
- public ?string $type,
- public ?string $status,
- public ?PagarmeRecipientBankAccountResponseData $defaultBankAccount = null,
- public ?string $createdAt = null,
- public ?string $updatedAt = null,
- ) {}
- public function defaultBankAccount(): ?PagarmeRecipientBankAccountResponseData
- {
- return $this->defaultBankAccount;
- }
- public function id(): ?string
- {
- return $this->id;
- }
- public function requireId(): string
- {
- if (! $this->id) {
- throw new \RuntimeException('Pagar.me recipient creation returned an empty id.');
- }
- return $this->id;
- }
- //
- public function toArray(): array
- {
- return [
- 'id' => $this->id,
- 'name' => $this->name,
- 'email' => $this->email,
- 'document' => $this->document,
- 'type' => $this->type,
- 'status' => $this->status,
- 'default_bank_account' => $this->defaultBankAccount?->toArray(),
- 'created_at' => $this->createdAt,
- 'updated_at' => $this->updatedAt,
- ];
- }
- }
|