<?php
 declare(strict_types=1); namespace Square\Models; use stdClass; class TerminalRefund implements \JsonSerializable { private $id; private $refundId; private $paymentId; private $orderId; private $amountMoney; private $reason; private $deviceId; private $deadlineDuration; private $status; private $cancelReason; private $createdAt; private $updatedAt; private $appId; private $locationId; public function __construct(string $paymentId, Money $amountMoney, string $reason, string $deviceId) { $this->paymentId = $paymentId; $this->amountMoney = $amountMoney; $this->reason = $reason; $this->deviceId = $deviceId; } public function getId(): ?string { return $this->id; } public function setId(?string $id): void { $this->id = $id; } public function getRefundId(): ?string { return $this->refundId; } public function setRefundId(?string $refundId): void { $this->refundId = $refundId; } public function getPaymentId(): string { return $this->paymentId; } public function setPaymentId(string $paymentId): void { $this->paymentId = $paymentId; } public function getOrderId(): ?string { return $this->orderId; } public function setOrderId(?string $orderId): void { $this->orderId = $orderId; } public function getAmountMoney(): Money { return $this->amountMoney; } public function setAmountMoney(Money $amountMoney): void { $this->amountMoney = $amountMoney; } public function getReason(): string { return $this->reason; } public function setReason(string $reason): void { $this->reason = $reason; } public function getDeviceId(): string { return $this->deviceId; } public function setDeviceId(string $deviceId): void { $this->deviceId = $deviceId; } public function getDeadlineDuration(): ?string { return $this->deadlineDuration; } public function setDeadlineDuration(?string $deadlineDuration): void { $this->deadlineDuration = $deadlineDuration; } public function getStatus(): ?string { return $this->status; } public function setStatus(?string $status): void { $this->status = $status; } public function getCancelReason(): ?string { return $this->cancelReason; } public function setCancelReason(?string $cancelReason): void { $this->cancelReason = $cancelReason; } public function getCreatedAt(): ?string { return $this->createdAt; } public function setCreatedAt(?string $createdAt): void { $this->createdAt = $createdAt; } public function getUpdatedAt(): ?string { return $this->updatedAt; } public function setUpdatedAt(?string $updatedAt): void { $this->updatedAt = $updatedAt; } public function getAppId(): ?string { return $this->appId; } public function setAppId(?string $appId): void { $this->appId = $appId; } public function getLocationId(): ?string { return $this->locationId; } public function setLocationId(?string $locationId): void { $this->locationId = $locationId; } #[\ReturnTypeWillChange] public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; if (isset($this->id)) { $json['id'] = $this->id; } if (isset($this->refundId)) { $json['refund_id'] = $this->refundId; } $json['payment_id'] = $this->paymentId; if (isset($this->orderId)) { $json['order_id'] = $this->orderId; } $json['amount_money'] = $this->amountMoney; $json['reason'] = $this->reason; $json['device_id'] = $this->deviceId; if (isset($this->deadlineDuration)) { $json['deadline_duration'] = $this->deadlineDuration; } if (isset($this->status)) { $json['status'] = $this->status; } if (isset($this->cancelReason)) { $json['cancel_reason'] = $this->cancelReason; } if (isset($this->createdAt)) { $json['created_at'] = $this->createdAt; } if (isset($this->updatedAt)) { $json['updated_at'] = $this->updatedAt; } if (isset($this->appId)) { $json['app_id'] = $this->appId; } if (isset($this->locationId)) { $json['location_id'] = $this->locationId; } $json = array_filter($json, function ($val) { return $val !== null; }); return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; } } 