<?php
 declare(strict_types=1); namespace Square\Models; use stdClass; class CreateTerminalRefundRequest implements \JsonSerializable { private $idempotencyKey; private $refund; public function __construct(string $idempotencyKey) { $this->idempotencyKey = $idempotencyKey; } public function getIdempotencyKey(): string { return $this->idempotencyKey; } public function setIdempotencyKey(string $idempotencyKey): void { $this->idempotencyKey = $idempotencyKey; } public function getRefund(): ?TerminalRefund { return $this->refund; } public function setRefund(?TerminalRefund $refund): void { $this->refund = $refund; } #[\ReturnTypeWillChange] public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; $json['idempotency_key'] = $this->idempotencyKey; if (isset($this->refund)) { $json['refund'] = $this->refund; } $json = array_filter($json, function ($val) { return $val !== null; }); return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; } } 