<?php
 declare(strict_types=1); namespace Square\Models; use stdClass; class ExternalPaymentDetails implements \JsonSerializable { private $type; private $source; private $sourceId; private $sourceFeeMoney; public function __construct(string $type, string $source) { $this->type = $type; $this->source = $source; } public function getType(): string { return $this->type; } public function setType(string $type): void { $this->type = $type; } public function getSource(): string { return $this->source; } public function setSource(string $source): void { $this->source = $source; } public function getSourceId(): ?string { return $this->sourceId; } public function setSourceId(?string $sourceId): void { $this->sourceId = $sourceId; } public function getSourceFeeMoney(): ?Money { return $this->sourceFeeMoney; } public function setSourceFeeMoney(?Money $sourceFeeMoney): void { $this->sourceFeeMoney = $sourceFeeMoney; } #[\ReturnTypeWillChange] public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; $json['type'] = $this->type; $json['source'] = $this->source; if (isset($this->sourceId)) { $json['source_id'] = $this->sourceId; } if (isset($this->sourceFeeMoney)) { $json['source_fee_money'] = $this->sourceFeeMoney; } $json = array_filter($json, function ($val) { return $val !== null; }); return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; } } 