| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?php
- namespace App\Data\Pagarme\Request\PagarmeCustomerRequestData;
- use App\Data\Pagarme\PagarmeData;
- final readonly class PagarmeCustomerUpdateRequestData extends PagarmeData
- {
- public function __construct(
- public ?string $name = null,
- public ?string $email = null,
- public ?string $document = null,
- public ?string $type = null,
- public ?string $documentType = null,
- public ?string $code = null,
- public ?PagarmeCustomerAddressRequestData $address = null,
- public ?PagarmeCustomerPhonesRequestData $phones = null,
- ) {
- if ($this->type !== null) {
- self::requireIn($this->type, ['individual', 'company'], 'type');
- }
- if ($this->documentType !== null) {
- self::requireIn($this->documentType, ['CPF', 'CNPJ'], 'document_type');
- }
- }
- public function toArray(): array
- {
- return $this->filterFilledRecursive([
- 'name' => $this->name,
- 'email' => $this->email,
- 'document' => $this->document,
- 'type' => $this->type,
- 'document_type' => $this->documentType,
- 'code' => $this->code,
- 'address' => $this->address,
- 'phones' => $this->phones,
- ]);
- }
- }
|