<?php
 declare(strict_types=1); namespace Square\Models; use stdClass; class CreateRefundRequest implements \JsonSerializable { private $idempotencyKey; private $tenderId; private $reason; private $amountMoney; public function __construct(string $idempotencyKey, string $tenderId, Money $amountMoney) { $this->idempotencyKey = $idempotencyKey; $this->tenderId = $tenderId; $this->amountMoney = $amountMoney; } public function getIdempotencyKey(): string { return $this->idempotencyKey; } public function setIdempotencyKey(string $idempotencyKey): void { $this->idempotencyKey = $idempotencyKey; } public function getTenderId(): string { return $this->tenderId; } public function setTenderId(string $tenderId): void { $this->tenderId = $tenderId; } 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; } #[\ReturnTypeWillChange] public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; $json['idempotency_key'] = $this->idempotencyKey; $json['tender_id'] = $this->tenderId; if (isset($this->reason)) { $json['reason'] = $this->reason; } $json['amount_money'] = $this->amountMoney; $json = array_filter($json, function ($val) { return $val !== null; }); return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; } } 