| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- <?php
- namespace App\Data\Pagarme\Response;
- final readonly class PagarmeCardResponseData
- {
- public function __construct(
- public ?string $id,
- public ?string $firstSixDigits,
- public ?string $lastFourDigits,
- public ?string $brand,
- public ?string $holderName,
- public ?int $expMonth,
- public ?int $expYear,
- public ?string $status,
- public ?string $type,
- public ?string $createdAt = null,
- public ?string $updatedAt = null,
- ) {}
- public function brand(): ?string
- {
- return $this->brand;
- }
- public function id(): ?string
- {
- return $this->id;
- }
- public function lastFourDigits(): ?string
- {
- return $this->lastFourDigits;
- }
- public function requireId(): string
- {
- if (! $this->id) {
- throw new \RuntimeException('Pagar.me card creation returned an empty id.');
- }
- return $this->id;
- }
- //
- public function toArray(): array
- {
- return [
- 'id' => $this->id,
- 'first_six_digits' => $this->firstSixDigits,
- 'last_four_digits' => $this->lastFourDigits,
- 'brand' => $this->brand,
- 'holder_name' => $this->holderName,
- 'exp_month' => $this->expMonth,
- 'exp_year' => $this->expYear,
- 'status' => $this->status,
- 'type' => $this->type,
- 'created_at' => $this->createdAt,
- 'updated_at' => $this->updatedAt,
- ];
- }
- }
|