<?php
 declare(strict_types=1); namespace Square\Models; use stdClass; class ChargeRequest implements \JsonSerializable { private $idempotencyKey; private $amountMoney; private $cardNonce; private $customerCardId; private $delayCapture; private $referenceId; private $note; private $customerId; private $billingAddress; private $shippingAddress; private $buyerEmailAddress; private $orderId; private $additionalRecipients; private $verificationToken; public function __construct(string $idempotencyKey, Money $amountMoney) { $this->idempotencyKey = $idempotencyKey; $this->amountMoney = $amountMoney; } public function getIdempotencyKey(): string { return $this->idempotencyKey; } public function setIdempotencyKey(string $idempotencyKey): void { $this->idempotencyKey = $idempotencyKey; } public function getAmountMoney(): Money { return $this->amountMoney; } public function setAmountMoney(Money $amountMoney): void { $this->amountMoney = $amountMoney; } public function getCardNonce(): ?string { return $this->cardNonce; } public function setCardNonce(?string $cardNonce): void { $this->cardNonce = $cardNonce; } public function getCustomerCardId(): ?string { return $this->customerCardId; } public function setCustomerCardId(?string $customerCardId): void { $this->customerCardId = $customerCardId; } public function getDelayCapture(): ?bool { return $this->delayCapture; } public function setDelayCapture(?bool $delayCapture): void { $this->delayCapture = $delayCapture; } public function getReferenceId(): ?string { return $this->referenceId; } public function setReferenceId(?string $referenceId): void { $this->referenceId = $referenceId; } public function getNote(): ?string { return $this->note; } public function setNote(?string $note): void { $this->note = $note; } public function getCustomerId(): ?string { return $this->customerId; } public function setCustomerId(?string $customerId): void { $this->customerId = $customerId; } public function getBillingAddress(): ?Address { return $this->billingAddress; } public function setBillingAddress(?Address $billingAddress): void { $this->billingAddress = $billingAddress; } public function getShippingAddress(): ?Address { return $this->shippingAddress; } public function setShippingAddress(?Address $shippingAddress): void { $this->shippingAddress = $shippingAddress; } public function getBuyerEmailAddress(): ?string { return $this->buyerEmailAddress; } public function setBuyerEmailAddress(?string $buyerEmailAddress): void { $this->buyerEmailAddress = $buyerEmailAddress; } public function getOrderId(): ?string { return $this->orderId; } public function setOrderId(?string $orderId): void { $this->orderId = $orderId; } public function getAdditionalRecipients(): ?array { return $this->additionalRecipients; } public function setAdditionalRecipients(?array $additionalRecipients): void { $this->additionalRecipients = $additionalRecipients; } public function getVerificationToken(): ?string { return $this->verificationToken; } public function setVerificationToken(?string $verificationToken): void { $this->verificationToken = $verificationToken; } #[\ReturnTypeWillChange] public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; $json['idempotency_key'] = $this->idempotencyKey; $json['amount_money'] = $this->amountMoney; if (isset($this->cardNonce)) { $json['card_nonce'] = $this->cardNonce; } if (isset($this->customerCardId)) { $json['customer_card_id'] = $this->customerCardId; } if (isset($this->delayCapture)) { $json['delay_capture'] = $this->delayCapture; } if (isset($this->referenceId)) { $json['reference_id'] = $this->referenceId; } if (isset($this->note)) { $json['note'] = $this->note; } if (isset($this->customerId)) { $json['customer_id'] = $this->customerId; } if (isset($this->billingAddress)) { $json['billing_address'] = $this->billingAddress; } if (isset($this->shippingAddress)) { $json['shipping_address'] = $this->shippingAddress; } if (isset($this->buyerEmailAddress)) { $json['buyer_email_address'] = $this->buyerEmailAddress; } if (isset($this->orderId)) { $json['order_id'] = $this->orderId; } if (isset($this->additionalRecipients)) { $json['additional_recipients'] = $this->additionalRecipients; } if (isset($this->verificationToken)) { $json['verification_token'] = $this->verificationToken; } $json = array_filter($json, function ($val) { return $val !== null; }); return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; } } 