<?php
 declare(strict_types=1); namespace Square\Models; use stdClass; class CreateCardRequest implements \JsonSerializable { private $idempotencyKey; private $sourceId; private $verificationToken; private $card; public function __construct(string $idempotencyKey, string $sourceId, Card $card) { $this->idempotencyKey = $idempotencyKey; $this->sourceId = $sourceId; $this->card = $card; } public function getIdempotencyKey(): string { return $this->idempotencyKey; } public function setIdempotencyKey(string $idempotencyKey): void { $this->idempotencyKey = $idempotencyKey; } public function getSourceId(): string { return $this->sourceId; } public function setSourceId(string $sourceId): void { $this->sourceId = $sourceId; } public function getVerificationToken(): ?string { return $this->verificationToken; } public function setVerificationToken(?string $verificationToken): void { $this->verificationToken = $verificationToken; } public function getCard(): Card { return $this->card; } public function setCard(Card $card): void { $this->card = $card; } #[\ReturnTypeWillChange] public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; $json['idempotency_key'] = $this->idempotencyKey; $json['source_id'] = $this->sourceId; if (isset($this->verificationToken)) { $json['verification_token'] = $this->verificationToken; } $json['card'] = $this->card; $json = array_filter($json, function ($val) { return $val !== null; }); return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; } } 