<?php
 declare(strict_types=1); namespace Square\Models; use stdClass; class Refund implements \JsonSerializable { private $id; private $locationId; private $transactionId; private $tenderId; private $createdAt; private $reason; private $amountMoney; private $status; private $processingFeeMoney; private $additionalRecipients; public function __construct( string $id, string $locationId, string $tenderId, string $reason, Money $amountMoney, string $status ) { $this->id = $id; $this->locationId = $locationId; $this->tenderId = $tenderId; $this->reason = $reason; $this->amountMoney = $amountMoney; $this->status = $status; } public function getId(): string { return $this->id; } public function setId(string $id): void { $this->id = $id; } public function getLocationId(): string { return $this->locationId; } public function setLocationId(string $locationId): void { $this->locationId = $locationId; } public function getTransactionId(): ?string { return $this->transactionId; } public function setTransactionId(?string $transactionId): void { $this->transactionId = $transactionId; } public function getTenderId(): string { return $this->tenderId; } public function setTenderId(string $tenderId): void { $this->tenderId = $tenderId; } public function getCreatedAt(): ?string { return $this->createdAt; } public function setCreatedAt(?string $createdAt): void { $this->createdAt = $createdAt; } public function getReason(): string { return $this->reason; } public function setReason(string $reason): void { $this->reason = $reason; } public function getAmountMoney(): Money { return $this->amountMoney; } public function setAmountMoney(Money $amountMoney): void { $this->amountMoney = $amountMoney; } public function getStatus(): string { return $this->status; } public function setStatus(string $status): void { $this->status = $status; } public function getProcessingFeeMoney(): ?Money { return $this->processingFeeMoney; } public function setProcessingFeeMoney(?Money $processingFeeMoney): void { $this->processingFeeMoney = $processingFeeMoney; } public function getAdditionalRecipients(): ?array { return $this->additionalRecipients; } public function setAdditionalRecipients(?array $additionalRecipients): void { $this->additionalRecipients = $additionalRecipients; } #[\ReturnTypeWillChange] public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; $json['id'] = $this->id; $json['location_id'] = $this->locationId; if (isset($this->transactionId)) { $json['transaction_id'] = $this->transactionId; } $json['tender_id'] = $this->tenderId; if (isset($this->createdAt)) { $json['created_at'] = $this->createdAt; } $json['reason'] = $this->reason; $json['amount_money'] = $this->amountMoney; $json['status'] = $this->status; if (isset($this->processingFeeMoney)) { $json['processing_fee_money'] = $this->processingFeeMoney; } if (isset($this->additionalRecipients)) { $json['additional_recipients'] = $this->additionalRecipients; } $json = array_filter($json, function ($val) { return $val !== null; }); return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; } } 