<?php
 declare(strict_types=1); namespace Square\Models; use stdClass; class OrderMoneyAmounts implements \JsonSerializable { private $totalMoney; private $taxMoney; private $discountMoney; private $tipMoney; private $serviceChargeMoney; public function getTotalMoney(): ?Money { return $this->totalMoney; } public function setTotalMoney(?Money $totalMoney): void { $this->totalMoney = $totalMoney; } public function getTaxMoney(): ?Money { return $this->taxMoney; } public function setTaxMoney(?Money $taxMoney): void { $this->taxMoney = $taxMoney; } public function getDiscountMoney(): ?Money { return $this->discountMoney; } public function setDiscountMoney(?Money $discountMoney): void { $this->discountMoney = $discountMoney; } public function getTipMoney(): ?Money { return $this->tipMoney; } public function setTipMoney(?Money $tipMoney): void { $this->tipMoney = $tipMoney; } public function getServiceChargeMoney(): ?Money { return $this->serviceChargeMoney; } public function setServiceChargeMoney(?Money $serviceChargeMoney): void { $this->serviceChargeMoney = $serviceChargeMoney; } #[\ReturnTypeWillChange] public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; if (isset($this->totalMoney)) { $json['total_money'] = $this->totalMoney; } if (isset($this->taxMoney)) { $json['tax_money'] = $this->taxMoney; } if (isset($this->discountMoney)) { $json['discount_money'] = $this->discountMoney; } if (isset($this->tipMoney)) { $json['tip_money'] = $this->tipMoney; } if (isset($this->serviceChargeMoney)) { $json['service_charge_money'] = $this->serviceChargeMoney; } $json = array_filter($json, function ($val) { return $val !== null; }); return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; } } 