<?php
 declare(strict_types=1); namespace Square\Models; use stdClass; class CreateSubscriptionRequest implements \JsonSerializable { private $idempotencyKey; private $locationId; private $planId; private $customerId; private $startDate; private $canceledDate; private $taxPercentage; private $priceOverrideMoney; private $cardId; private $timezone; private $source; public function __construct(string $locationId, string $planId, string $customerId) { $this->locationId = $locationId; $this->planId = $planId; $this->customerId = $customerId; } public function getIdempotencyKey(): ?string { return $this->idempotencyKey; } public function setIdempotencyKey(?string $idempotencyKey): void { $this->idempotencyKey = $idempotencyKey; } public function getLocationId(): string { return $this->locationId; } public function setLocationId(string $locationId): void { $this->locationId = $locationId; } public function getPlanId(): string { return $this->planId; } public function setPlanId(string $planId): void { $this->planId = $planId; } public function getCustomerId(): string { return $this->customerId; } public function setCustomerId(string $customerId): void { $this->customerId = $customerId; } public function getStartDate(): ?string { return $this->startDate; } public function setStartDate(?string $startDate): void { $this->startDate = $startDate; } public function getCanceledDate(): ?string { return $this->canceledDate; } public function setCanceledDate(?string $canceledDate): void { $this->canceledDate = $canceledDate; } public function getTaxPercentage(): ?string { return $this->taxPercentage; } public function setTaxPercentage(?string $taxPercentage): void { $this->taxPercentage = $taxPercentage; } public function getPriceOverrideMoney(): ?Money { return $this->priceOverrideMoney; } public function setPriceOverrideMoney(?Money $priceOverrideMoney): void { $this->priceOverrideMoney = $priceOverrideMoney; } public function getCardId(): ?string { return $this->cardId; } public function setCardId(?string $cardId): void { $this->cardId = $cardId; } public function getTimezone(): ?string { return $this->timezone; } public function setTimezone(?string $timezone): void { $this->timezone = $timezone; } public function getSource(): ?SubscriptionSource { return $this->source; } public function setSource(?SubscriptionSource $source): void { $this->source = $source; } #[\ReturnTypeWillChange] public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; if (isset($this->idempotencyKey)) { $json['idempotency_key'] = $this->idempotencyKey; } $json['location_id'] = $this->locationId; $json['plan_id'] = $this->planId; $json['customer_id'] = $this->customerId; if (isset($this->startDate)) { $json['start_date'] = $this->startDate; } if (isset($this->canceledDate)) { $json['canceled_date'] = $this->canceledDate; } if (isset($this->taxPercentage)) { $json['tax_percentage'] = $this->taxPercentage; } if (isset($this->priceOverrideMoney)) { $json['price_override_money'] = $this->priceOverrideMoney; } if (isset($this->cardId)) { $json['card_id'] = $this->cardId; } if (isset($this->timezone)) { $json['timezone'] = $this->timezone; } if (isset($this->source)) { $json['source'] = $this->source; } $json = array_filter($json, function ($val) { return $val !== null; }); return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; } } 