| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
namespace Square\Legacy\Models; |
| 6 |
|
| 7 |
use stdClass; |
| 8 |
|
| 9 |
/** |
| 10 |
* A request to retrieve payout records. |
| 11 |
*/ |
| 12 |
class ListPayoutsRequest implements \JsonSerializable |
| 13 |
{ |
| 14 |
/** |
| 15 |
* @var array |
| 16 |
*/ |
| 17 |
private $locationId = []; |
| 18 |
|
| 19 |
/** |
| 20 |
* @var string|null |
| 21 |
*/ |
| 22 |
private $status; |
| 23 |
|
| 24 |
/** |
| 25 |
* @var array |
| 26 |
*/ |
| 27 |
private $beginTime = []; |
| 28 |
|
| 29 |
/** |
| 30 |
* @var array |
| 31 |
*/ |
| 32 |
private $endTime = []; |
| 33 |
|
| 34 |
/** |
| 35 |
* @var string|null |
| 36 |
*/ |
| 37 |
private $sortOrder; |
| 38 |
|
| 39 |
/** |
| 40 |
* @var array |
| 41 |
*/ |
| 42 |
private $cursor = []; |
| 43 |
|
| 44 |
/** |
| 45 |
* @var array |
| 46 |
*/ |
| 47 |
private $limit = []; |
| 48 |
|
| 49 |
/** |
| 50 |
* Returns Location Id. |
| 51 |
* The ID of the location for which to list the payouts. |
| 52 |
* By default, payouts are returned for the default (main) location associated with the seller. |
| 53 |
*/ |
| 54 |
public function getLocationId(): ?string |
| 55 |
{ |
| 56 |
if (count($this->locationId) == 0) { |
| 57 |
return null; |
| 58 |
} |
| 59 |
return $this->locationId['value']; |
| 60 |
} |
| 61 |
|
| 62 |
/** |
| 63 |
* Sets Location Id. |
| 64 |
* The ID of the location for which to list the payouts. |
| 65 |
* By default, payouts are returned for the default (main) location associated with the seller. |
| 66 |
* |
| 67 |
* @maps location_id |
| 68 |
*/ |
| 69 |
public function setLocationId(?string $locationId): void |
| 70 |
{ |
| 71 |
$this->locationId['value'] = $locationId; |
| 72 |
} |
| 73 |
|
| 74 |
/** |
| 75 |
* Unsets Location Id. |
| 76 |
* The ID of the location for which to list the payouts. |
| 77 |
* By default, payouts are returned for the default (main) location associated with the seller. |
| 78 |
*/ |
| 79 |
public function unsetLocationId(): void |
| 80 |
{ |
| 81 |
$this->locationId = []; |
| 82 |
} |
| 83 |
|
| 84 |
/** |
| 85 |
* Returns Status. |
| 86 |
* Payout status types |
| 87 |
*/ |
| 88 |
public function getStatus(): ?string |
| 89 |
{ |
| 90 |
return $this->status; |
| 91 |
} |
| 92 |
|
| 93 |
/** |
| 94 |
* Sets Status. |
| 95 |
* Payout status types |
| 96 |
* |
| 97 |
* @maps status |
| 98 |
*/ |
| 99 |
public function setStatus(?string $status): void |
| 100 |
{ |
| 101 |
$this->status = $status; |
| 102 |
} |
| 103 |
|
| 104 |
/** |
| 105 |
* Returns Begin Time. |
| 106 |
* The timestamp for the beginning of the payout creation time, in RFC 3339 format. |
| 107 |
* Inclusive. Default: The current time minus one year. |
| 108 |
*/ |
| 109 |
public function getBeginTime(): ?string |
| 110 |
{ |
| 111 |
if (count($this->beginTime) == 0) { |
| 112 |
return null; |
| 113 |
} |
| 114 |
return $this->beginTime['value']; |
| 115 |
} |
| 116 |
|
| 117 |
/** |
| 118 |
* Sets Begin Time. |
| 119 |
* The timestamp for the beginning of the payout creation time, in RFC 3339 format. |
| 120 |
* Inclusive. Default: The current time minus one year. |
| 121 |
* |
| 122 |
* @maps begin_time |
| 123 |
*/ |
| 124 |
public function setBeginTime(?string $beginTime): void |
| 125 |
{ |
| 126 |
$this->beginTime['value'] = $beginTime; |
| 127 |
} |
| 128 |
|
| 129 |
/** |
| 130 |
* Unsets Begin Time. |
| 131 |
* The timestamp for the beginning of the payout creation time, in RFC 3339 format. |
| 132 |
* Inclusive. Default: The current time minus one year. |
| 133 |
*/ |
| 134 |
public function unsetBeginTime(): void |
| 135 |
{ |
| 136 |
$this->beginTime = []; |
| 137 |
} |
| 138 |
|
| 139 |
/** |
| 140 |
* Returns End Time. |
| 141 |
* The timestamp for the end of the payout creation time, in RFC 3339 format. |
| 142 |
* Default: The current time. |
| 143 |
*/ |
| 144 |
public function getEndTime(): ?string |
| 145 |
{ |
| 146 |
if (count($this->endTime) == 0) { |
| 147 |
return null; |
| 148 |
} |
| 149 |
return $this->endTime['value']; |
| 150 |
} |
| 151 |
|
| 152 |
/** |
| 153 |
* Sets End Time. |
| 154 |
* The timestamp for the end of the payout creation time, in RFC 3339 format. |
| 155 |
* Default: The current time. |
| 156 |
* |
| 157 |
* @maps end_time |
| 158 |
*/ |
| 159 |
public function setEndTime(?string $endTime): void |
| 160 |
{ |
| 161 |
$this->endTime['value'] = $endTime; |
| 162 |
} |
| 163 |
|
| 164 |
/** |
| 165 |
* Unsets End Time. |
| 166 |
* The timestamp for the end of the payout creation time, in RFC 3339 format. |
| 167 |
* Default: The current time. |
| 168 |
*/ |
| 169 |
public function unsetEndTime(): void |
| 170 |
{ |
| 171 |
$this->endTime = []; |
| 172 |
} |
| 173 |
|
| 174 |
/** |
| 175 |
* Returns Sort Order. |
| 176 |
* The order (e.g., chronological or alphabetical) in which results from a request are returned. |
| 177 |
*/ |
| 178 |
public function getSortOrder(): ?string |
| 179 |
{ |
| 180 |
return $this->sortOrder; |
| 181 |
} |
| 182 |
|
| 183 |
/** |
| 184 |
* Sets Sort Order. |
| 185 |
* The order (e.g., chronological or alphabetical) in which results from a request are returned. |
| 186 |
* |
| 187 |
* @maps sort_order |
| 188 |
*/ |
| 189 |
public function setSortOrder(?string $sortOrder): void |
| 190 |
{ |
| 191 |
$this->sortOrder = $sortOrder; |
| 192 |
} |
| 193 |
|
| 194 |
/** |
| 195 |
* Returns Cursor. |
| 196 |
* A pagination cursor returned by a previous call to this endpoint. |
| 197 |
* Provide this cursor to retrieve the next set of results for the original query. |
| 198 |
* For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api- |
| 199 |
* patterns/pagination). |
| 200 |
* If request parameters change between requests, subsequent results may contain duplicates or missing |
| 201 |
* records. |
| 202 |
*/ |
| 203 |
public function getCursor(): ?string |
| 204 |
{ |
| 205 |
if (count($this->cursor) == 0) { |
| 206 |
return null; |
| 207 |
} |
| 208 |
return $this->cursor['value']; |
| 209 |
} |
| 210 |
|
| 211 |
/** |
| 212 |
* Sets Cursor. |
| 213 |
* A pagination cursor returned by a previous call to this endpoint. |
| 214 |
* Provide this cursor to retrieve the next set of results for the original query. |
| 215 |
* For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api- |
| 216 |
* patterns/pagination). |
| 217 |
* If request parameters change between requests, subsequent results may contain duplicates or missing |
| 218 |
* records. |
| 219 |
* |
| 220 |
* @maps cursor |
| 221 |
*/ |
| 222 |
public function setCursor(?string $cursor): void |
| 223 |
{ |
| 224 |
$this->cursor['value'] = $cursor; |
| 225 |
} |
| 226 |
|
| 227 |
/** |
| 228 |
* Unsets Cursor. |
| 229 |
* A pagination cursor returned by a previous call to this endpoint. |
| 230 |
* Provide this cursor to retrieve the next set of results for the original query. |
| 231 |
* For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api- |
| 232 |
* patterns/pagination). |
| 233 |
* If request parameters change between requests, subsequent results may contain duplicates or missing |
| 234 |
* records. |
| 235 |
*/ |
| 236 |
public function unsetCursor(): void |
| 237 |
{ |
| 238 |
$this->cursor = []; |
| 239 |
} |
| 240 |
|
| 241 |
/** |
| 242 |
* Returns Limit. |
| 243 |
* The maximum number of results to be returned in a single page. |
| 244 |
* It is possible to receive fewer results than the specified limit on a given page. |
| 245 |
* The default value of 100 is also the maximum allowed value. If the provided value is |
| 246 |
* greater than 100, it is ignored and the default value is used instead. |
| 247 |
* Default: `100` |
| 248 |
*/ |
| 249 |
public function getLimit(): ?int |
| 250 |
{ |
| 251 |
if (count($this->limit) == 0) { |
| 252 |
return null; |
| 253 |
} |
| 254 |
return $this->limit['value']; |
| 255 |
} |
| 256 |
|
| 257 |
/** |
| 258 |
* Sets Limit. |
| 259 |
* The maximum number of results to be returned in a single page. |
| 260 |
* It is possible to receive fewer results than the specified limit on a given page. |
| 261 |
* The default value of 100 is also the maximum allowed value. If the provided value is |
| 262 |
* greater than 100, it is ignored and the default value is used instead. |
| 263 |
* Default: `100` |
| 264 |
* |
| 265 |
* @maps limit |
| 266 |
*/ |
| 267 |
public function setLimit(?int $limit): void |
| 268 |
{ |
| 269 |
$this->limit['value'] = $limit; |
| 270 |
} |
| 271 |
|
| 272 |
/** |
| 273 |
* Unsets Limit. |
| 274 |
* The maximum number of results to be returned in a single page. |
| 275 |
* It is possible to receive fewer results than the specified limit on a given page. |
| 276 |
* The default value of 100 is also the maximum allowed value. If the provided value is |
| 277 |
* greater than 100, it is ignored and the default value is used instead. |
| 278 |
* Default: `100` |
| 279 |
*/ |
| 280 |
public function unsetLimit(): void |
| 281 |
{ |
| 282 |
$this->limit = []; |
| 283 |
} |
| 284 |
|
| 285 |
/** |
| 286 |
* Encode this object to JSON |
| 287 |
* |
| 288 |
* @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields |
| 289 |
* are set. (default: false) |
| 290 |
* |
| 291 |
* @return array|stdClass |
| 292 |
*/ |
| 293 |
#[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) |
| 294 |
public function jsonSerialize(bool $asArrayWhenEmpty = false) |
| 295 |
{ |
| 296 |
$json = []; |
| 297 |
if (!empty($this->locationId)) { |
| 298 |
$json['location_id'] = $this->locationId['value']; |
| 299 |
} |
| 300 |
if (isset($this->status)) { |
| 301 |
$json['status'] = $this->status; |
| 302 |
} |
| 303 |
if (!empty($this->beginTime)) { |
| 304 |
$json['begin_time'] = $this->beginTime['value']; |
| 305 |
} |
| 306 |
if (!empty($this->endTime)) { |
| 307 |
$json['end_time'] = $this->endTime['value']; |
| 308 |
} |
| 309 |
if (isset($this->sortOrder)) { |
| 310 |
$json['sort_order'] = $this->sortOrder; |
| 311 |
} |
| 312 |
if (!empty($this->cursor)) { |
| 313 |
$json['cursor'] = $this->cursor['value']; |
| 314 |
} |
| 315 |
if (!empty($this->limit)) { |
| 316 |
$json['limit'] = $this->limit['value']; |
| 317 |
} |
| 318 |
$json = array_filter($json, function ($val) { |
| 319 |
return $val !== null; |
| 320 |
}); |
| 321 |
|
| 322 |
return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; |
| 323 |
} |
| 324 |
} |
| 325 |
|