diff --git a/.changeset/afraid-trees-impress.md b/.changeset/afraid-trees-impress.md new file mode 100644 index 000000000..09d8513c5 --- /dev/null +++ b/.changeset/afraid-trees-impress.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +fix(be, payment-gateways): Update Paybilt payout new flow Rebilly/rebilly#18734 diff --git a/.changeset/calm-plums-kick.md b/.changeset/calm-plums-kick.md new file mode 100644 index 000000000..bd6089fcb --- /dev/null +++ b/.changeset/calm-plums-kick.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +feat(be, recomm, api-definitions): Add MaximumOrderAmount coupon restriction Rebilly/rebilly#17757 diff --git a/.changeset/fair-pumas-wink.md b/.changeset/fair-pumas-wink.md new file mode 100644 index 000000000..b7f204666 --- /dev/null +++ b/.changeset/fair-pumas-wink.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +feat(be, api-definitions): Add data export functionality for payout requests and allocations Rebilly/rebilly#18168 diff --git a/.changeset/few-tomatoes-reply.md b/.changeset/few-tomatoes-reply.md new file mode 100644 index 000000000..44a22096f --- /dev/null +++ b/.changeset/few-tomatoes-reply.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +fix(api-definitions): Fix api defs patch order item Rebilly/rebilly#18565 diff --git a/.changeset/five-pets-search.md b/.changeset/five-pets-search.md new file mode 100644 index 000000000..7261b51cb --- /dev/null +++ b/.changeset/five-pets-search.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +feat(be,metadata,api-definitions): Update NMI API key authentication Rebilly/rebilly#18559 diff --git a/.changeset/flat-vans-attend.md b/.changeset/flat-vans-attend.md new file mode 100644 index 000000000..d2b07cf80 --- /dev/null +++ b/.changeset/flat-vans-attend.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +docs(website, api-definitions ): Add more noun phrase guidance for API fields Rebilly/rebilly#18686 diff --git a/.changeset/fluffy-candles-attack.md b/.changeset/fluffy-candles-attack.md new file mode 100644 index 000000000..febc9f4dd --- /dev/null +++ b/.changeset/fluffy-candles-attack.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +chore(deps): bump @redocly/cli from 2.14.4 to 2.14.5 in /website/api-definitions Rebilly/rebilly#18058 diff --git a/.changeset/fluffy-insects-warn.md b/.changeset/fluffy-insects-warn.md new file mode 100644 index 000000000..c3c1f4904 --- /dev/null +++ b/.changeset/fluffy-insects-warn.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +fix(be,api-definitions,recomm): Add missing Discover dispute reason codes Rebilly/rebilly#18032 diff --git a/.changeset/funny-meals-clean.md b/.changeset/funny-meals-clean.md new file mode 100644 index 000000000..d12e8c8d6 --- /dev/null +++ b/.changeset/funny-meals-clean.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +fix(api-definitions): Add missing required method in schemas Rebilly/rebilly#18742 diff --git a/.changeset/gentle-impalas-promise.md b/.changeset/gentle-impalas-promise.md new file mode 100644 index 000000000..212feb1dd --- /dev/null +++ b/.changeset/gentle-impalas-promise.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +fix(api-definitions): Fix orders experimental API fields Rebilly/rebilly#18768 diff --git a/.changeset/gentle-numbers-compete.md b/.changeset/gentle-numbers-compete.md new file mode 100644 index 000000000..677b76915 --- /dev/null +++ b/.changeset/gentle-numbers-compete.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +feat(be, api-definitions): preview orders enhancements Rebilly/rebilly#17844 diff --git a/.changeset/gentle-seas-tap.md b/.changeset/gentle-seas-tap.md new file mode 100644 index 000000000..c104238d3 --- /dev/null +++ b/.changeset/gentle-seas-tap.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +feat(api-definition, be, payment-gateways): Implement Paybilt payout Rebilly/rebilly#18651 diff --git a/.changeset/kind-tigers-eat.md b/.changeset/kind-tigers-eat.md new file mode 100644 index 000000000..e47716480 --- /dev/null +++ b/.changeset/kind-tigers-eat.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +fix(api-definitions): Mark invoiceTimeShift field as deprecated and readOnly Rebilly/rebilly#18532 diff --git a/.changeset/many-bears-exist.md b/.changeset/many-bears-exist.md new file mode 100644 index 000000000..b6e8632f2 --- /dev/null +++ b/.changeset/many-bears-exist.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +feat(api,be): Add batchId to payout request allocation Rebilly/rebilly#18380 diff --git a/.changeset/nasty-melons-fold.md b/.changeset/nasty-melons-fold.md new file mode 100644 index 000000000..5c7db01b2 --- /dev/null +++ b/.changeset/nasty-melons-fold.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +fix(backend,recomm,api-definitions): Permanently block above and Temporary block above use the independent pool of attributes - remove backward compatibility Rebilly/rebilly#18099 diff --git a/.changeset/ninety-colts-dress.md b/.changeset/ninety-colts-dress.md new file mode 100644 index 000000000..2deaf8c57 --- /dev/null +++ b/.changeset/ninety-colts-dress.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +feat(be, api-definitions): Add AML report endpoint Rebilly/rebilly#18271 diff --git a/.changeset/old-lamps-raise.md b/.changeset/old-lamps-raise.md new file mode 100644 index 000000000..006314bb8 --- /dev/null +++ b/.changeset/old-lamps-raise.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +revert(api-definitions): Fix orders experimental API fields Rebilly/rebilly#18789 diff --git a/.changeset/olive-ducks-talk.md b/.changeset/olive-ducks-talk.md new file mode 100644 index 000000000..8ad19f6d6 --- /dev/null +++ b/.changeset/olive-ducks-talk.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +chore(website): Fine-tune API descriptions review in Gemini Rebilly/rebilly#18723 diff --git a/.changeset/olive-peas-film.md b/.changeset/olive-peas-film.md new file mode 100644 index 000000000..8f341ba08 --- /dev/null +++ b/.changeset/olive-peas-film.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +build(deps): merge passing FE dependabot PRs Rebilly/rebilly#18118 diff --git a/.changeset/orange-zebras-carry.md b/.changeset/orange-zebras-carry.md new file mode 100644 index 000000000..0759dc886 --- /dev/null +++ b/.changeset/orange-zebras-carry.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +chore(deps): merge passing FE dependabot PRs Rebilly/rebilly#18528 diff --git a/.changeset/plenty-buckets-retire.md b/.changeset/plenty-buckets-retire.md new file mode 100644 index 000000000..42b3aa002 --- /dev/null +++ b/.changeset/plenty-buckets-retire.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +feat(be): Implement AmlProvenance Rebilly/rebilly#17982 diff --git a/.changeset/plenty-lemons-return.md b/.changeset/plenty-lemons-return.md new file mode 100644 index 000000000..dd7fd2027 --- /dev/null +++ b/.changeset/plenty-lemons-return.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +build(deps): merge passing FE dependabot PRs Rebilly/rebilly#18191 diff --git a/.changeset/polite-cobras-prove.md b/.changeset/polite-cobras-prove.md new file mode 100644 index 000000000..beeb4ad29 --- /dev/null +++ b/.changeset/polite-cobras-prove.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +feat(api-defs): Add payout request batch operations Rebilly/rebilly#17873 diff --git a/.changeset/purple-ravens-bake.md b/.changeset/purple-ravens-bake.md new file mode 100644 index 000000000..dfd279507 --- /dev/null +++ b/.changeset/purple-ravens-bake.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +feat(be,api-definitions): Add payout request batches data table Rebilly/rebilly#18278 diff --git a/.changeset/quick-glasses-mix.md b/.changeset/quick-glasses-mix.md new file mode 100644 index 000000000..07150897a --- /dev/null +++ b/.changeset/quick-glasses-mix.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +feat(be,api-definitions): Add payout request allocations data table Rebilly/rebilly#18273 diff --git a/.changeset/quiet-baboons-press.md b/.changeset/quiet-baboons-press.md new file mode 100644 index 000000000..edbd6d7b2 --- /dev/null +++ b/.changeset/quiet-baboons-press.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +feat(be): Include gatewayPayoutInstruction in payout request payment instruments data Rebilly/rebilly#18507 diff --git a/.changeset/selfish-dolls-punch.md b/.changeset/selfish-dolls-punch.md new file mode 100644 index 000000000..8bb569d4e --- /dev/null +++ b/.changeset/selfish-dolls-punch.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +feat(be, api-definitions): Add startTime to creation quotes Rebilly/rebilly#18022 diff --git a/.changeset/shaggy-squids-sell.md b/.changeset/shaggy-squids-sell.md new file mode 100644 index 000000000..c1ce3aa49 --- /dev/null +++ b/.changeset/shaggy-squids-sell.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +docs(api-definitions): Remove Trigger from summaries Rebilly/rebilly#18212 diff --git a/.changeset/silent-moose-pretend.md b/.changeset/silent-moose-pretend.md new file mode 100644 index 000000000..5ed187b4e --- /dev/null +++ b/.changeset/silent-moose-pretend.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +build(deps): merge passing FE dependabot PRs Rebilly/rebilly#18806 diff --git a/.changeset/soft-spiders-deny.md b/.changeset/soft-spiders-deny.md new file mode 100644 index 000000000..e4adf17b1 --- /dev/null +++ b/.changeset/soft-spiders-deny.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +feat(api-definitions): Add AML checks report path Rebilly/rebilly#18613 diff --git a/.changeset/spotty-badgers-cover.md b/.changeset/spotty-badgers-cover.md new file mode 100644 index 000000000..4d0998a5a --- /dev/null +++ b/.changeset/spotty-badgers-cover.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +SDK Generator updated diff --git a/.changeset/strange-seahorses-watch.md b/.changeset/strange-seahorses-watch.md new file mode 100644 index 000000000..117c4c3e7 --- /dev/null +++ b/.changeset/strange-seahorses-watch.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +docs: Add other missing KYC tile type Rebilly/rebilly#18368 diff --git a/.changeset/strong-penguins-draw.md b/.changeset/strong-penguins-draw.md new file mode 100644 index 000000000..7bbc357d3 --- /dev/null +++ b/.changeset/strong-penguins-draw.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +revert(backend): Permanently block above and Temporary block above use the independent pool of attributes - remove backward compatibility Rebilly/rebilly#17885 diff --git a/.changeset/strong-poets-count.md b/.changeset/strong-poets-count.md new file mode 100644 index 000000000..b929b8ef9 --- /dev/null +++ b/.changeset/strong-poets-count.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +feat(backend,api-definitions): expose tax number updates to storefront Rebilly/rebilly#18625 diff --git a/.changeset/stupid-doors-tell.md b/.changeset/stupid-doors-tell.md new file mode 100644 index 000000000..4d0998a5a --- /dev/null +++ b/.changeset/stupid-doors-tell.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +SDK Generator updated diff --git a/.changeset/tame-files-smoke.md b/.changeset/tame-files-smoke.md new file mode 100644 index 000000000..a0d0c87ea --- /dev/null +++ b/.changeset/tame-files-smoke.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +chore(builds): Bump fast-xml-parser to resolve security issues Rebilly/rebilly#18581 diff --git a/.changeset/tender-bobcats-joke.md b/.changeset/tender-bobcats-joke.md new file mode 100644 index 000000000..06b55edff --- /dev/null +++ b/.changeset/tender-bobcats-joke.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +fix(api-definitions): Fix api defs plan id required Rebilly/rebilly#18580 diff --git a/.changeset/tender-comics-teach.md b/.changeset/tender-comics-teach.md new file mode 100644 index 000000000..81d74ee65 --- /dev/null +++ b/.changeset/tender-comics-teach.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +feat(be,api-definitions): Implement Storefront endpoints for transactions DCC offer Rebilly/rebilly#18749 diff --git a/.changeset/three-carpets-relate.md b/.changeset/three-carpets-relate.md new file mode 100644 index 000000000..34990f403 --- /dev/null +++ b/.changeset/three-carpets-relate.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +feat(backend): KYC - detect photocopies Rebilly/rebilly#18256 diff --git a/.changeset/two-days-doubt.md b/.changeset/two-days-doubt.md new file mode 100644 index 000000000..0d56eb95b --- /dev/null +++ b/.changeset/two-days-doubt.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +feat(api-definitions): Add new metrics for AML check histogram report Rebilly/rebilly#18012 diff --git a/.changeset/violet-years-cross.md b/.changeset/violet-years-cross.md new file mode 100644 index 000000000..53722b540 --- /dev/null +++ b/.changeset/violet-years-cross.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +fix(backend): Permanently block above and Temporary block above use the independent pool of attributes - remove backward compatibility Rebilly/rebilly#17885 diff --git a/.changeset/wet-scissors-drive.md b/.changeset/wet-scissors-drive.md new file mode 100644 index 000000000..a29f9362d --- /dev/null +++ b/.changeset/wet-scissors-drive.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +feat(be): Add productOptions to PatchOrderItem Rebilly/rebilly#18533 diff --git a/.changeset/witty-zebras-drop.md b/.changeset/witty-zebras-drop.md new file mode 100644 index 000000000..b53e79202 --- /dev/null +++ b/.changeset/witty-zebras-drop.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +build(deps): merge passing FE dependabot PRs Rebilly/rebilly#18610 diff --git a/.changeset/yellow-foxes-hope.md b/.changeset/yellow-foxes-hope.md new file mode 100644 index 000000000..9922ec92e --- /dev/null +++ b/.changeset/yellow-foxes-hope.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +docs: Add missing KYC tile type Rebilly/rebilly#18362 diff --git a/src/Api/OrdersApi.php b/src/Api/OrdersApi.php index 0cf131c56..bb5bb4b0a 100644 --- a/src/Api/OrdersApi.php +++ b/src/Api/OrdersApi.php @@ -26,6 +26,7 @@ use Rebilly\Sdk\Model\OrderItemUpdate; use Rebilly\Sdk\Model\OrderUpcomingInvoice; use Rebilly\Sdk\Model\SubscriptionInvoice; +use Rebilly\Sdk\Model\SubscriptionOrOneTimeSaleItem; use Rebilly\Sdk\Model\UpcomingInvoice; use Rebilly\Sdk\Paginator; @@ -242,7 +243,7 @@ public function updateItem( string $id, string $itemId, OrderItemUpdate $orderItemUpdate, - ): Order { + ): SubscriptionOrOneTimeSaleItem { $pathParams = [ '{id}' => $id, '{itemId}' => $itemId, @@ -256,7 +257,7 @@ public function updateItem( $response = $this->client->send($request); $data = Utils::jsonDecode((string) $response->getBody(), true); - return OrderFactory::from($data); + return SubscriptionOrOneTimeSaleItem::from($data); } public function void( diff --git a/src/Api/PayoutRequestAllocationsApi.php b/src/Api/PayoutRequestAllocationsApi.php index 73e75833e..a37d74257 100644 --- a/src/Api/PayoutRequestAllocationsApi.php +++ b/src/Api/PayoutRequestAllocationsApi.php @@ -17,10 +17,13 @@ use GuzzleHttp\ClientInterface; use GuzzleHttp\Psr7\Request; use GuzzleHttp\Utils; +use Rebilly\Sdk\Collection; use Rebilly\Sdk\Model\PatchPayoutRequestAllocationRequest; use Rebilly\Sdk\Model\PayoutRequestAllocation; use Rebilly\Sdk\Model\PostPayoutRequestAllocationRequest; +use Rebilly\Sdk\Model\PostPayoutRequestAllocationsProcessRequest; use Rebilly\Sdk\Model\PostPayoutRequestAutoAllocationRequest; +use Rebilly\Sdk\Paginator; class PayoutRequestAllocationsApi { @@ -51,6 +54,86 @@ public function create( return PayoutRequestAllocation::from($data); } + public function get( + string $id, + ): PayoutRequestAllocation { + $pathParams = [ + '{id}' => $id, + ]; + + $uri = str_replace(array_keys($pathParams), array_values($pathParams), '/payout-request-allocations/{id}'); + + $request = new Request('GET', $uri, headers: [ + 'Accept' => 'application/json', + ]); + $response = $this->client->send($request); + $data = Utils::jsonDecode((string) $response->getBody(), true); + + return PayoutRequestAllocation::from($data); + } + + /** + * @return Collection + */ + public function getAll( + ?int $limit = null, + ?int $offset = null, + ?string $filter = null, + ?array $sort = null, + ): Collection { + $queryParams = [ + 'limit' => $limit, + 'offset' => $offset, + 'filter' => $filter, + 'sort' => $sort ? implode(',', $sort) : null, + ]; + $uri = '/payout-request-allocations?' . http_build_query($queryParams); + + $request = new Request('GET', $uri, headers: [ + 'Accept' => 'application/json', + ]); + $response = $this->client->send($request); + $data = Utils::jsonDecode((string) $response->getBody(), true); + + return new Collection( + array_map(fn (array $item): PayoutRequestAllocation => PayoutRequestAllocation::from($item), $data), + (int) $response->getHeaderLine(Collection::HEADER_LIMIT), + (int) $response->getHeaderLine(Collection::HEADER_OFFSET), + (int) $response->getHeaderLine(Collection::HEADER_TOTAL), + ); + } + + /** + * @return Paginator + */ + public function getAllPaginator( + ?int $limit = null, + ?int $offset = null, + ?string $filter = null, + ?array $sort = null, + ): Paginator { + $closure = fn (?int $limit, ?int $offset): Collection => $this->getAll( + limit: $limit, + offset: $offset, + filter: $filter, + sort: $sort, + ); + + return new Paginator( + $limit !== null || $offset !== null ? $closure(limit: $limit, offset: $offset) : null, + $closure, + ); + } + + public function process( + PostPayoutRequestAllocationsProcessRequest $postPayoutRequestAllocationsProcessRequest, + ): void { + $uri = '/payout-request-allocations/process'; + + $request = new Request('POST', $uri, body: Utils::jsonEncode($postPayoutRequestAllocationsProcessRequest)); + $this->client->send($request); + } + public function update( string $id, PatchPayoutRequestAllocationRequest $patchPayoutRequestAllocationRequest, diff --git a/src/Api/PayoutRequestBatchesApi.php b/src/Api/PayoutRequestBatchesApi.php new file mode 100644 index 000000000..83ceeab35 --- /dev/null +++ b/src/Api/PayoutRequestBatchesApi.php @@ -0,0 +1,169 @@ + $id, + ]; + + $uri = str_replace(array_keys($pathParams), array_values($pathParams), '/payout-request-batches/{id}/approve'); + + $request = new Request('POST', $uri, headers: [ + 'Accept' => 'application/json', + ]); + $response = $this->client->send($request); + $data = Utils::jsonDecode((string) $response->getBody(), true); + + return PayoutRequestBatch::from($data); + } + + public function autoAllocate( + string $id, + ): PayoutRequestBatch { + $pathParams = [ + '{id}' => $id, + ]; + + $uri = str_replace(array_keys($pathParams), array_values($pathParams), '/payout-request-batches/{id}/auto-allocate'); + + $request = new Request('POST', $uri, headers: [ + 'Accept' => 'application/json', + ]); + $response = $this->client->send($request); + $data = Utils::jsonDecode((string) $response->getBody(), true); + + return PayoutRequestBatch::from($data); + } + + public function block( + string $id, + ): PayoutRequestBatch { + $pathParams = [ + '{id}' => $id, + ]; + + $uri = str_replace(array_keys($pathParams), array_values($pathParams), '/payout-request-batches/{id}/block'); + + $request = new Request('POST', $uri, headers: [ + 'Accept' => 'application/json', + ]); + $response = $this->client->send($request); + $data = Utils::jsonDecode((string) $response->getBody(), true); + + return PayoutRequestBatch::from($data); + } + + public function create( + PostPayoutRequestBatchRequest $postPayoutRequestBatchRequest, + ): PayoutRequestBatch { + $uri = '/payout-request-batches'; + + $request = new Request('POST', $uri, headers: [ + 'Accept' => 'application/json', + ], body: Utils::jsonEncode($postPayoutRequestBatchRequest)); + $response = $this->client->send($request); + $data = Utils::jsonDecode((string) $response->getBody(), true); + + return PayoutRequestBatch::from($data); + } + + public function get( + string $id, + ): PayoutRequestBatch { + $pathParams = [ + '{id}' => $id, + ]; + + $uri = str_replace(array_keys($pathParams), array_values($pathParams), '/payout-request-batches/{id}'); + + $request = new Request('GET', $uri, headers: [ + 'Accept' => 'application/json', + ]); + $response = $this->client->send($request); + $data = Utils::jsonDecode((string) $response->getBody(), true); + + return PayoutRequestBatch::from($data); + } + + /** + * @return Collection + */ + public function getAll( + ?int $limit = null, + ?int $offset = null, + ?string $filter = null, + ?array $sort = null, + ): Collection { + $queryParams = [ + 'limit' => $limit, + 'offset' => $offset, + 'filter' => $filter, + 'sort' => $sort ? implode(',', $sort) : null, + ]; + $uri = '/payout-request-batches?' . http_build_query($queryParams); + + $request = new Request('GET', $uri, headers: [ + 'Accept' => 'application/json', + ]); + $response = $this->client->send($request); + $data = Utils::jsonDecode((string) $response->getBody(), true); + + return new Collection( + array_map(fn (array $item): PayoutRequestBatch => PayoutRequestBatch::from($item), $data), + (int) $response->getHeaderLine(Collection::HEADER_LIMIT), + (int) $response->getHeaderLine(Collection::HEADER_OFFSET), + (int) $response->getHeaderLine(Collection::HEADER_TOTAL), + ); + } + + /** + * @return Paginator + */ + public function getAllPaginator( + ?int $limit = null, + ?int $offset = null, + ?string $filter = null, + ?array $sort = null, + ): Paginator { + $closure = fn (?int $limit, ?int $offset): Collection => $this->getAll( + limit: $limit, + offset: $offset, + filter: $filter, + sort: $sort, + ); + + return new Paginator( + $limit !== null || $offset !== null ? $closure(limit: $limit, offset: $offset) : null, + $closure, + ); + } +} diff --git a/src/Api/ReportsApi.php b/src/Api/ReportsApi.php index e7cfab1b3..5275e176a 100644 --- a/src/Api/ReportsApi.php +++ b/src/Api/ReportsApi.php @@ -26,6 +26,7 @@ use Rebilly\Sdk\Model\GetKycAcceptanceSummaryReportResponse; use Rebilly\Sdk\Model\JournalSummaryReport; use Rebilly\Sdk\Model\RenewalSales; +use Rebilly\Sdk\Model\ReportAmlChecks; use Rebilly\Sdk\Model\ReportAnnualRecurringRevenue; use Rebilly\Sdk\Model\ReportDeclinedTransactions; use Rebilly\Sdk\Model\ReportDeferredRevenue; @@ -52,6 +53,31 @@ public function __construct(protected ?ClientInterface $client) { } + public function getAmlChecks( + ?DateTimeImmutable $periodStart = null, + ?DateTimeImmutable $periodEnd = null, + ?string $metric = null, + ?bool $includePropagatedResults = null, + ?string $filter = null, + ): ReportAmlChecks { + $queryParams = [ + 'periodStart' => $periodStart->format('Y-m-d\TH:i:s\Z'), + 'periodEnd' => $periodEnd->format('Y-m-d\TH:i:s\Z'), + 'metric' => $metric, + 'includePropagatedResults' => $includePropagatedResults, + 'filter' => $filter, + ]; + $uri = '/experimental/reports/aml-checks?' . http_build_query($queryParams); + + $request = new Request('GET', $uri, headers: [ + 'Accept' => 'application/json', + ]); + $response = $this->client->send($request); + $data = Utils::jsonDecode((string) $response->getBody(), true); + + return ReportAmlChecks::from($data); + } + public function getAnnualRecurringRevenue( string $currency, string $periodStart, diff --git a/src/Model/AmlCheck.php b/src/Model/AmlCheck.php index 972c2b235..e4876da94 100644 --- a/src/Model/AmlCheck.php +++ b/src/Model/AmlCheck.php @@ -20,6 +20,10 @@ class AmlCheck implements JsonSerializable { + public const REVIEWER_TYPE_HUMAN = 'human'; + + public const REVIEWER_TYPE_BOT = 'bot'; + public const SOURCE_SIGN_UP = 'sign-up'; public const SOURCE_RECURRING = 'recurring'; @@ -55,6 +59,9 @@ public function __construct(array $data = []) if (array_key_exists('reviewerId', $data)) { $this->setReviewerId($data['reviewerId']); } + if (array_key_exists('reviewerType', $data)) { + $this->setReviewerType($data['reviewerType']); + } if (array_key_exists('reviewerName', $data)) { $this->setReviewerName($data['reviewerName']); } @@ -82,6 +89,9 @@ public function __construct(array $data = []) if (array_key_exists('tags', $data)) { $this->setTags($data['tags']); } + if (array_key_exists('provenance', $data)) { + $this->setProvenance($data['provenance']); + } if (array_key_exists('_links', $data)) { $this->setLinks($data['_links']); } @@ -138,6 +148,11 @@ public function setReviewerId(null|string $reviewerId): static return $this; } + public function getReviewerType(): ?string + { + return $this->fields['reviewerType'] ?? null; + } + public function getReviewerName(): ?string { return $this->fields['reviewerName'] ?? null; @@ -258,6 +273,22 @@ public function getTags(): ?array return $this->fields['tags'] ?? null; } + public function getProvenance(): ?AmlCheckProvenance + { + return $this->fields['provenance'] ?? null; + } + + public function setProvenance(null|AmlCheckProvenance|array $provenance): static + { + if ($provenance !== null && !($provenance instanceof AmlCheckProvenance)) { + $provenance = AmlCheckProvenance::from($provenance); + } + + $this->fields['provenance'] = $provenance; + + return $this; + } + /** * @return null|ResourceLink[] */ @@ -284,6 +315,9 @@ public function jsonSerialize(): array if (array_key_exists('reviewerId', $this->fields)) { $data['reviewerId'] = $this->fields['reviewerId']; } + if (array_key_exists('reviewerType', $this->fields)) { + $data['reviewerType'] = $this->fields['reviewerType']; + } if (array_key_exists('reviewerName', $this->fields)) { $data['reviewerName'] = $this->fields['reviewerName']; } @@ -321,6 +355,9 @@ public function jsonSerialize(): array ) : null; } + if (array_key_exists('provenance', $this->fields)) { + $data['provenance'] = $this->fields['provenance']?->jsonSerialize(); + } if (array_key_exists('_links', $this->fields)) { $data['_links'] = $this->fields['_links'] !== null ? array_map( @@ -355,6 +392,13 @@ private function setUpdatedTime(null|DateTimeImmutable|string $updatedTime): sta return $this; } + private function setReviewerType(null|string $reviewerType): static + { + $this->fields['reviewerType'] = $reviewerType; + + return $this; + } + private function setStatus(null|string $status): static { $this->fields['status'] = $status; diff --git a/src/Model/AmlCheckProvenance.php b/src/Model/AmlCheckProvenance.php new file mode 100644 index 000000000..4e90dbeda --- /dev/null +++ b/src/Model/AmlCheckProvenance.php @@ -0,0 +1,130 @@ +setInherited($data['inherited']); + } + if (array_key_exists('inheritedFromAmlCheckId', $data)) { + $this->setInheritedFromAmlCheckId($data['inheritedFromAmlCheckId']); + } + if (array_key_exists('scope', $data)) { + $this->setScope($data['scope']); + } + if (array_key_exists('reasons', $data)) { + $this->setReasons($data['reasons']); + } + } + + public static function from(array $data = []): self + { + return new self($data); + } + + public function getInherited(): ?bool + { + return $this->fields['inherited'] ?? null; + } + + public function setInherited(null|bool $inherited): static + { + $this->fields['inherited'] = $inherited; + + return $this; + } + + public function getInheritedFromAmlCheckId(): ?string + { + return $this->fields['inheritedFromAmlCheckId'] ?? null; + } + + public function setInheritedFromAmlCheckId(null|string $inheritedFromAmlCheckId): static + { + $this->fields['inheritedFromAmlCheckId'] = $inheritedFromAmlCheckId; + + return $this; + } + + /** + * @return null|string[] + */ + public function getScope(): ?array + { + return $this->fields['scope'] ?? null; + } + + /** + * @param null|string[] $scope + */ + public function setScope(null|array $scope): static + { + $this->fields['scope'] = $scope; + + return $this; + } + + /** + * @return null|string[] + */ + public function getReasons(): ?array + { + return $this->fields['reasons'] ?? null; + } + + /** + * @param null|string[] $reasons + */ + public function setReasons(null|array $reasons): static + { + $this->fields['reasons'] = $reasons; + + return $this; + } + + public function jsonSerialize(): array + { + $data = []; + if (array_key_exists('inherited', $this->fields)) { + $data['inherited'] = $this->fields['inherited']; + } + if (array_key_exists('inheritedFromAmlCheckId', $this->fields)) { + $data['inheritedFromAmlCheckId'] = $this->fields['inheritedFromAmlCheckId']; + } + if (array_key_exists('scope', $this->fields)) { + $data['scope'] = $this->fields['scope']; + } + if (array_key_exists('reasons', $this->fields)) { + $data['reasons'] = $this->fields['reasons']; + } + + return $data; + } +} diff --git a/src/Model/ConfigurablePlan.php b/src/Model/ConfigurablePlan.php index 24e25bc71..662fd1365 100644 --- a/src/Model/ConfigurablePlan.php +++ b/src/Model/ConfigurablePlan.php @@ -18,5 +18,5 @@ interface ConfigurablePlan extends JsonSerializable { - public function getId(): ?string; + public function getId(): string; } diff --git a/src/Model/CouponRestrictionFactory.php b/src/Model/CouponRestrictionFactory.php index 8665f8729..3bee1e431 100644 --- a/src/Model/CouponRestrictionFactory.php +++ b/src/Model/CouponRestrictionFactory.php @@ -23,6 +23,7 @@ public static function from(array $data = []): CouponRestriction return match ($data['type']) { 'discounts-per-redemption' => CouponRestrictionDiscountPerRedemption::from($data), 'restrict-to-exclusive-application' => CouponRestrictionExclusiveApplication::from($data), + 'maximum-order-amount' => CouponRestrictionMaximumOrderAmount::from($data), 'minimum-order-amount' => CouponRestrictionMinimumOrderAmount::from($data), 'paid-by-time' => CouponRestrictionPaidByTime::from($data), 'redemptions-per-customer' => CouponRestrictionRedemptionsPerCustomer::from($data), diff --git a/src/Model/CouponRestrictionMaximumOrderAmount.php b/src/Model/CouponRestrictionMaximumOrderAmount.php new file mode 100644 index 000000000..8c8ee3a47 --- /dev/null +++ b/src/Model/CouponRestrictionMaximumOrderAmount.php @@ -0,0 +1,83 @@ +setAmount($data['amount']); + } + if (array_key_exists('currency', $data)) { + $this->setCurrency($data['currency']); + } + } + + public static function from(array $data = []): self + { + return new self($data); + } + + public function getType(): string + { + return 'maximum-order-amount'; + } + + public function getAmount(): float + { + return $this->fields['amount']; + } + + public function setAmount(float|string $amount): static + { + if (is_string($amount)) { + $amount = (float) $amount; + } + + $this->fields['amount'] = $amount; + + return $this; + } + + public function getCurrency(): string + { + return $this->fields['currency']; + } + + public function setCurrency(string $currency): static + { + $this->fields['currency'] = $currency; + + return $this; + } + + public function jsonSerialize(): array + { + $data = [ + 'type' => 'maximum-order-amount', + ]; + if (array_key_exists('amount', $this->fields)) { + $data['amount'] = $this->fields['amount']; + } + if (array_key_exists('currency', $this->fields)) { + $data['currency'] = $this->fields['currency']; + } + + return $data; + } +} diff --git a/src/Model/CreationQuoteOrder.php b/src/Model/CreationQuoteOrder.php index ac071c246..caf3f5610 100644 --- a/src/Model/CreationQuoteOrder.php +++ b/src/Model/CreationQuoteOrder.php @@ -14,6 +14,8 @@ namespace Rebilly\Sdk\Model; +use DateTimeImmutable; +use DateTimeInterface; use JsonSerializable; class CreationQuoteOrder implements JsonSerializable @@ -40,6 +42,9 @@ public function __construct(array $data = []) if (array_key_exists('billingAddress', $data)) { $this->setBillingAddress($data['billingAddress']); } + if (array_key_exists('startTime', $data)) { + $this->setStartTime($data['startTime']); + } } public static function from(array $data = []): self @@ -135,6 +140,22 @@ public function setBillingAddress(null|ContactObject|array $billingAddress): sta return $this; } + public function getStartTime(): ?DateTimeImmutable + { + return $this->fields['startTime'] ?? null; + } + + public function setStartTime(null|DateTimeImmutable|string $startTime): static + { + if ($startTime !== null && !($startTime instanceof DateTimeImmutable)) { + $startTime = new DateTimeImmutable($startTime); + } + + $this->fields['startTime'] = $startTime; + + return $this; + } + public function jsonSerialize(): array { $data = []; @@ -159,6 +180,9 @@ public function jsonSerialize(): array if (array_key_exists('billingAddress', $this->fields)) { $data['billingAddress'] = $this->fields['billingAddress']?->jsonSerialize(); } + if (array_key_exists('startTime', $this->fields)) { + $data['startTime'] = $this->fields['startTime']?->format(DateTimeInterface::RFC3339); + } return $data; } diff --git a/src/Model/DashboardResponse.php b/src/Model/DashboardResponse.php index 4228f8c3c..81b8ad24e 100644 --- a/src/Model/DashboardResponse.php +++ b/src/Model/DashboardResponse.php @@ -90,6 +90,10 @@ class DashboardResponse implements JsonSerializable public const METRIC_CREDIT_FILE_PROOF_ACCEPTANCE_RATE = 'creditFileProofAcceptanceRate'; + public const METRIC_KYC_ACCEPTANCE_RATE = 'kycAcceptanceRate'; + + public const METRIC_KYC_REVIEW_TIME = 'kycReviewTime'; + public const METRIC_KYC_REJECTION_RATE = 'kycRejectionRate'; public const METRIC_KYC_ACCURACY_RATE = 'kycAccuracyRate'; diff --git a/src/Model/DataExport.php b/src/Model/DataExport.php index df9b7839b..502c009a0 100644 --- a/src/Model/DataExport.php +++ b/src/Model/DataExport.php @@ -82,7 +82,7 @@ public function setDateRange(null|DataExportDateRange|array $dateRange): static; */ public function getLinks(): ?array; - public function getEmbedded(): null|AmlChecksDataExportEmbedded|CustomersDataExportEmbedded|DisputesDataExportEmbedded|InvoiceItemsDataExportEmbedded|InvoicesDataExportEmbedded|JournalRecordsDataExportEmbedded|SubscriptionsDataExportEmbedded|TransactionsDataExportEmbedded; + public function getEmbedded(): null|AmlChecksDataExportEmbedded|CustomersDataExportEmbedded|DisputesDataExportEmbedded|InvoiceItemsDataExportEmbedded|InvoicesDataExportEmbedded|JournalRecordsDataExportEmbedded|PayoutRequestAllocationsDataExportEmbedded|PayoutRequestsDataExportEmbedded|SubscriptionsDataExportEmbedded|TransactionsDataExportEmbedded; public function setEmbedded(null|array $embedded): static; } diff --git a/src/Model/DataExportFactory.php b/src/Model/DataExportFactory.php index 6911d842a..c18ba1097 100644 --- a/src/Model/DataExportFactory.php +++ b/src/Model/DataExportFactory.php @@ -27,6 +27,8 @@ public static function from(array $data = []): DataExport 'invoiceItems' => InvoiceItemsDataExport::from($data), 'invoices' => InvoicesDataExport::from($data), 'journalRecords' => JournalRecordsDataExport::from($data), + 'payoutRequestAllocations' => PayoutRequestAllocationsDataExport::from($data), + 'payoutRequests' => PayoutRequestsDataExport::from($data), 'subscriptions' => SubscriptionsDataExport::from($data), 'transactions' => TransactionsDataExport::from($data), default => throw new UnknownDiscriminatorValueException(), diff --git a/src/Model/FlexiblePlan.php b/src/Model/FlexiblePlan.php index 6e776b9ef..ba4c18f77 100644 --- a/src/Model/FlexiblePlan.php +++ b/src/Model/FlexiblePlan.php @@ -18,7 +18,7 @@ interface FlexiblePlan extends ConfigurablePlan { - public function getId(): ?string; + public function getId(): string; public function getName(): string; diff --git a/src/Model/GetPayoutRequestV2PaymentInstrumentsResponse.php b/src/Model/GetPayoutRequestV2PaymentInstrumentsResponse.php index c39761661..aae245f73 100644 --- a/src/Model/GetPayoutRequestV2PaymentInstrumentsResponse.php +++ b/src/Model/GetPayoutRequestV2PaymentInstrumentsResponse.php @@ -466,6 +466,14 @@ class GetPayoutRequestV2PaymentInstrumentsResponse implements JsonSerializable public const GATEWAY_NAME_ZOTAPAY = 'Zotapay'; + public const GATEWAY_PAYOUT_INSTRUCTION_ALL = 'all'; + + public const GATEWAY_PAYOUT_INSTRUCTION_COVERED_PAYOUT = 'covered-payout'; + + public const GATEWAY_PAYOUT_INSTRUCTION_APPROVED_PAYMENT = 'approved-payment'; + + public const GATEWAY_PAYOUT_INSTRUCTION_NONE = 'none'; + private array $fields = []; public function __construct(array $data = []) @@ -479,6 +487,9 @@ public function __construct(array $data = []) if (array_key_exists('gatewayAccountId', $data)) { $this->setGatewayAccountId($data['gatewayAccountId']); } + if (array_key_exists('gatewayPayoutInstruction', $data)) { + $this->setGatewayPayoutInstruction($data['gatewayPayoutInstruction']); + } if (array_key_exists('exposureAmount', $data)) { $this->setExposureAmount($data['exposureAmount']); } @@ -534,6 +545,18 @@ public function setGatewayAccountId(null|string $gatewayAccountId): static return $this; } + public function getGatewayPayoutInstruction(): ?string + { + return $this->fields['gatewayPayoutInstruction'] ?? null; + } + + public function setGatewayPayoutInstruction(null|string $gatewayPayoutInstruction): static + { + $this->fields['gatewayPayoutInstruction'] = $gatewayPayoutInstruction; + + return $this; + } + public function getExposureAmount(): ?float { return $this->fields['exposureAmount'] ?? null; @@ -610,6 +633,9 @@ public function jsonSerialize(): array if (array_key_exists('gatewayAccountId', $this->fields)) { $data['gatewayAccountId'] = $this->fields['gatewayAccountId']; } + if (array_key_exists('gatewayPayoutInstruction', $this->fields)) { + $data['gatewayPayoutInstruction'] = $this->fields['gatewayPayoutInstruction']; + } if (array_key_exists('exposureAmount', $this->fields)) { $data['exposureAmount'] = $this->fields['exposureAmount']; } diff --git a/src/Model/GridSegmentData.php b/src/Model/GridSegmentData.php index 7bf7ad474..fa24ef052 100644 --- a/src/Model/GridSegmentData.php +++ b/src/Model/GridSegmentData.php @@ -50,6 +50,10 @@ class GridSegmentData implements JsonSerializable public const TYPE_PAYOUT_REQUESTS = 'payout-requests'; + public const TYPE_PAYOUT_ALLOCATIONS = 'payout-allocations'; + + public const TYPE_PAYOUT_REQUEST_BATCHES = 'payout-request-batches'; + public const TYPE_ORGANIZATIONS = 'organizations'; public const TYPE_QUOTES = 'quotes'; diff --git a/src/Model/KycIdentityMatches.php b/src/Model/KycIdentityMatches.php index fb33a69b9..e53b35f0e 100644 --- a/src/Model/KycIdentityMatches.php +++ b/src/Model/KycIdentityMatches.php @@ -131,6 +131,9 @@ public function __construct(array $data = []) if (array_key_exists('isDigitallyTampered', $data)) { $this->setIsDigitallyTampered($data['isDigitallyTampered']); } + if (array_key_exists('isPhotocopy', $data)) { + $this->setIsPhotocopy($data['isPhotocopy']); + } if (array_key_exists('hasCompletedFaceLiveness', $data)) { $this->setHasCompletedFaceLiveness($data['hasCompletedFaceLiveness']); } @@ -361,6 +364,18 @@ public function setIsDigitallyTampered(null|bool $isDigitallyTampered): static return $this; } + public function getIsPhotocopy(): ?bool + { + return $this->fields['isPhotocopy'] ?? null; + } + + public function setIsPhotocopy(null|bool $isPhotocopy): static + { + $this->fields['isPhotocopy'] = $isPhotocopy; + + return $this; + } + public function getHasCompletedFaceLiveness(): ?bool { return $this->fields['hasCompletedFaceLiveness'] ?? null; @@ -439,6 +454,9 @@ public function jsonSerialize(): array if (array_key_exists('isDigitallyTampered', $this->fields)) { $data['isDigitallyTampered'] = $this->fields['isDigitallyTampered']; } + if (array_key_exists('isPhotocopy', $this->fields)) { + $data['isPhotocopy'] = $this->fields['isPhotocopy']; + } if (array_key_exists('hasCompletedFaceLiveness', $this->fields)) { $data['hasCompletedFaceLiveness'] = $this->fields['hasCompletedFaceLiveness']; } diff --git a/src/Model/KycSettingsIdentityWeights.php b/src/Model/KycSettingsIdentityWeights.php index 94fd8b979..5e9c58885 100644 --- a/src/Model/KycSettingsIdentityWeights.php +++ b/src/Model/KycSettingsIdentityWeights.php @@ -64,6 +64,9 @@ public function __construct(array $data = []) if (array_key_exists('isTampered', $data)) { $this->setIsTampered($data['isTampered']); } + if (array_key_exists('isPhotocopy', $data)) { + $this->setIsPhotocopy($data['isPhotocopy']); + } } public static function from(array $data = []): self @@ -239,6 +242,18 @@ public function setIsTampered(null|int $isTampered): static return $this; } + public function getIsPhotocopy(): ?int + { + return $this->fields['isPhotocopy'] ?? null; + } + + public function setIsPhotocopy(null|int $isPhotocopy): static + { + $this->fields['isPhotocopy'] = $isPhotocopy; + + return $this; + } + public function jsonSerialize(): array { $data = []; @@ -284,6 +299,9 @@ public function jsonSerialize(): array if (array_key_exists('isTampered', $this->fields)) { $data['isTampered'] = $this->fields['isTampered']; } + if (array_key_exists('isPhotocopy', $this->fields)) { + $data['isPhotocopy'] = $this->fields['isPhotocopy']; + } return $data; } diff --git a/src/Model/NMICredentials.php b/src/Model/NMICredentials.php index c9fbe0de3..2befb579a 100644 --- a/src/Model/NMICredentials.php +++ b/src/Model/NMICredentials.php @@ -28,6 +28,9 @@ public function __construct(array $data = []) if (array_key_exists('password', $data)) { $this->setPassword($data['password']); } + if (array_key_exists('apiKey', $data)) { + $this->setApiKey($data['apiKey']); + } } public static function from(array $data = []): self @@ -59,6 +62,18 @@ public function setPassword(string $password): static return $this; } + public function getApiKey(): ?string + { + return $this->fields['apiKey'] ?? null; + } + + public function setApiKey(null|string $apiKey): static + { + $this->fields['apiKey'] = $apiKey; + + return $this; + } + public function jsonSerialize(): array { $data = []; @@ -68,6 +83,9 @@ public function jsonSerialize(): array if (array_key_exists('password', $this->fields)) { $data['password'] = $this->fields['password']; } + if (array_key_exists('apiKey', $this->fields)) { + $data['apiKey'] = $this->fields['apiKey']; + } return $data; } diff --git a/src/Model/OneTimeSalePlan.php b/src/Model/OneTimeSalePlan.php index a3f4651d5..62f325663 100644 --- a/src/Model/OneTimeSalePlan.php +++ b/src/Model/OneTimeSalePlan.php @@ -81,9 +81,9 @@ public static function from(array $data = []): self return new self($data); } - public function getId(): ?string + public function getId(): string { - return $this->fields['id'] ?? null; + return $this->fields['id']; } public function getName(): string @@ -316,7 +316,7 @@ public function jsonSerialize(): array return $data; } - private function setId(null|string $id): static + private function setId(string $id): static { $this->fields['id'] = $id; diff --git a/src/Model/OrderItemUpdate.php b/src/Model/OrderItemUpdate.php index 649d8d431..9d28c0192 100644 --- a/src/Model/OrderItemUpdate.php +++ b/src/Model/OrderItemUpdate.php @@ -28,6 +28,9 @@ public function __construct(array $data = []) if (array_key_exists('excludeFromMrr', $data)) { $this->setExcludeFromMrr($data['excludeFromMrr']); } + if (array_key_exists('plan', $data)) { + $this->setPlan($data['plan']); + } } public static function from(array $data = []): self @@ -35,12 +38,12 @@ public static function from(array $data = []): self return new self($data); } - public function getQuantityFilled(): float + public function getQuantityFilled(): ?float { - return $this->fields['quantityFilled']; + return $this->fields['quantityFilled'] ?? null; } - public function setQuantityFilled(float|string $quantityFilled): static + public function setQuantityFilled(null|float|string $quantityFilled): static { if (is_string($quantityFilled)) { $quantityFilled = (float) $quantityFilled; @@ -63,6 +66,22 @@ public function setExcludeFromMrr(null|bool $excludeFromMrr): static return $this; } + public function getPlan(): ?OrderItemUpdatePlan + { + return $this->fields['plan'] ?? null; + } + + public function setPlan(null|OrderItemUpdatePlan|array $plan): static + { + if ($plan !== null && !($plan instanceof OrderItemUpdatePlan)) { + $plan = OrderItemUpdatePlan::from($plan); + } + + $this->fields['plan'] = $plan; + + return $this; + } + public function jsonSerialize(): array { $data = []; @@ -72,6 +91,9 @@ public function jsonSerialize(): array if (array_key_exists('excludeFromMrr', $this->fields)) { $data['excludeFromMrr'] = $this->fields['excludeFromMrr']; } + if (array_key_exists('plan', $this->fields)) { + $data['plan'] = $this->fields['plan']?->jsonSerialize(); + } return $data; } diff --git a/src/Model/OrderItemUpdatePlan.php b/src/Model/OrderItemUpdatePlan.php new file mode 100644 index 000000000..65f910670 --- /dev/null +++ b/src/Model/OrderItemUpdatePlan.php @@ -0,0 +1,62 @@ +setProductOptions($data['productOptions']); + } + } + + public static function from(array $data = []): self + { + return new self($data); + } + + /** + * @return null|array + */ + public function getProductOptions(): ?array + { + return $this->fields['productOptions'] ?? null; + } + + /** + * @param null|array $productOptions + */ + public function setProductOptions(null|array $productOptions): static + { + $this->fields['productOptions'] = $productOptions; + + return $this; + } + + public function jsonSerialize(): array + { + $data = []; + if (array_key_exists('productOptions', $this->fields)) { + $data['productOptions'] = $this->fields['productOptions']; + } + + return $data; + } +} diff --git a/src/Model/OrderPreview.php b/src/Model/OrderPreview.php index 0f279aecb..db32129ea 100644 --- a/src/Model/OrderPreview.php +++ b/src/Model/OrderPreview.php @@ -67,6 +67,12 @@ public function __construct(array $data = []) if (array_key_exists('total', $data)) { $this->setTotal($data['total']); } + if (array_key_exists('initialAmounts', $data)) { + $this->setInitialAmounts($data['initialAmounts']); + } + if (array_key_exists('recurringAmounts', $data)) { + $this->setRecurringAmounts($data['recurringAmounts']); + } if (array_key_exists('shipping', $data)) { $this->setShipping($data['shipping']); } @@ -224,6 +230,38 @@ public function getTotal(): ?float return $this->fields['total'] ?? null; } + public function getInitialAmounts(): ?OrderPreviewInitialAmounts + { + return $this->fields['initialAmounts'] ?? null; + } + + public function setInitialAmounts(null|OrderPreviewInitialAmounts|array $initialAmounts): static + { + if ($initialAmounts !== null && !($initialAmounts instanceof OrderPreviewInitialAmounts)) { + $initialAmounts = OrderPreviewInitialAmounts::from($initialAmounts); + } + + $this->fields['initialAmounts'] = $initialAmounts; + + return $this; + } + + public function getRecurringAmounts(): ?OrderPreviewRecurringAmounts + { + return $this->fields['recurringAmounts'] ?? null; + } + + public function setRecurringAmounts(null|OrderPreviewRecurringAmounts|array $recurringAmounts): static + { + if ($recurringAmounts !== null && !($recurringAmounts instanceof OrderPreviewRecurringAmounts)) { + $recurringAmounts = OrderPreviewRecurringAmounts::from($recurringAmounts); + } + + $this->fields['recurringAmounts'] = $recurringAmounts; + + return $this; + } + public function getShipping(): ?Shipping { return $this->fields['shipping'] ?? null; @@ -311,6 +349,12 @@ public function jsonSerialize(): array if (array_key_exists('total', $this->fields)) { $data['total'] = $this->fields['total']; } + if (array_key_exists('initialAmounts', $this->fields)) { + $data['initialAmounts'] = $this->fields['initialAmounts']?->jsonSerialize(); + } + if (array_key_exists('recurringAmounts', $this->fields)) { + $data['recurringAmounts'] = $this->fields['recurringAmounts']?->jsonSerialize(); + } if (array_key_exists('shipping', $this->fields)) { $data['shipping'] = $this->fields['shipping']?->jsonSerialize(); } diff --git a/src/Model/OrderPreviewInitialAmounts.php b/src/Model/OrderPreviewInitialAmounts.php new file mode 100644 index 000000000..67d832566 --- /dev/null +++ b/src/Model/OrderPreviewInitialAmounts.php @@ -0,0 +1,148 @@ +setAmount($data['amount']); + } + if (array_key_exists('subtotalAmount', $data)) { + $this->setSubtotalAmount($data['subtotalAmount']); + } + if (array_key_exists('discountAmount', $data)) { + $this->setDiscountAmount($data['discountAmount']); + } + if (array_key_exists('shippingAmount', $data)) { + $this->setShippingAmount($data['shippingAmount']); + } + if (array_key_exists('taxAmount', $data)) { + $this->setTaxAmount($data['taxAmount']); + } + } + + public static function from(array $data = []): self + { + return new self($data); + } + + public function getAmount(): ?float + { + return $this->fields['amount'] ?? null; + } + + public function setAmount(null|float|string $amount): static + { + if (is_string($amount)) { + $amount = (float) $amount; + } + + $this->fields['amount'] = $amount; + + return $this; + } + + public function getSubtotalAmount(): ?float + { + return $this->fields['subtotalAmount'] ?? null; + } + + public function setSubtotalAmount(null|float|string $subtotalAmount): static + { + if (is_string($subtotalAmount)) { + $subtotalAmount = (float) $subtotalAmount; + } + + $this->fields['subtotalAmount'] = $subtotalAmount; + + return $this; + } + + public function getDiscountAmount(): ?float + { + return $this->fields['discountAmount'] ?? null; + } + + public function setDiscountAmount(null|float|string $discountAmount): static + { + if (is_string($discountAmount)) { + $discountAmount = (float) $discountAmount; + } + + $this->fields['discountAmount'] = $discountAmount; + + return $this; + } + + public function getShippingAmount(): ?float + { + return $this->fields['shippingAmount'] ?? null; + } + + public function setShippingAmount(null|float|string $shippingAmount): static + { + if (is_string($shippingAmount)) { + $shippingAmount = (float) $shippingAmount; + } + + $this->fields['shippingAmount'] = $shippingAmount; + + return $this; + } + + public function getTaxAmount(): ?float + { + return $this->fields['taxAmount'] ?? null; + } + + public function setTaxAmount(null|float|string $taxAmount): static + { + if (is_string($taxAmount)) { + $taxAmount = (float) $taxAmount; + } + + $this->fields['taxAmount'] = $taxAmount; + + return $this; + } + + public function jsonSerialize(): array + { + $data = []; + if (array_key_exists('amount', $this->fields)) { + $data['amount'] = $this->fields['amount']; + } + if (array_key_exists('subtotalAmount', $this->fields)) { + $data['subtotalAmount'] = $this->fields['subtotalAmount']; + } + if (array_key_exists('discountAmount', $this->fields)) { + $data['discountAmount'] = $this->fields['discountAmount']; + } + if (array_key_exists('shippingAmount', $this->fields)) { + $data['shippingAmount'] = $this->fields['shippingAmount']; + } + if (array_key_exists('taxAmount', $this->fields)) { + $data['taxAmount'] = $this->fields['taxAmount']; + } + + return $data; + } +} diff --git a/src/Model/OrderPreviewRecurringAmounts.php b/src/Model/OrderPreviewRecurringAmounts.php new file mode 100644 index 000000000..3db468b0c --- /dev/null +++ b/src/Model/OrderPreviewRecurringAmounts.php @@ -0,0 +1,148 @@ +setAmount($data['amount']); + } + if (array_key_exists('subtotalAmount', $data)) { + $this->setSubtotalAmount($data['subtotalAmount']); + } + if (array_key_exists('discountAmount', $data)) { + $this->setDiscountAmount($data['discountAmount']); + } + if (array_key_exists('shippingAmount', $data)) { + $this->setShippingAmount($data['shippingAmount']); + } + if (array_key_exists('taxAmount', $data)) { + $this->setTaxAmount($data['taxAmount']); + } + } + + public static function from(array $data = []): self + { + return new self($data); + } + + public function getAmount(): ?float + { + return $this->fields['amount'] ?? null; + } + + public function setAmount(null|float|string $amount): static + { + if (is_string($amount)) { + $amount = (float) $amount; + } + + $this->fields['amount'] = $amount; + + return $this; + } + + public function getSubtotalAmount(): ?float + { + return $this->fields['subtotalAmount'] ?? null; + } + + public function setSubtotalAmount(null|float|string $subtotalAmount): static + { + if (is_string($subtotalAmount)) { + $subtotalAmount = (float) $subtotalAmount; + } + + $this->fields['subtotalAmount'] = $subtotalAmount; + + return $this; + } + + public function getDiscountAmount(): ?float + { + return $this->fields['discountAmount'] ?? null; + } + + public function setDiscountAmount(null|float|string $discountAmount): static + { + if (is_string($discountAmount)) { + $discountAmount = (float) $discountAmount; + } + + $this->fields['discountAmount'] = $discountAmount; + + return $this; + } + + public function getShippingAmount(): ?float + { + return $this->fields['shippingAmount'] ?? null; + } + + public function setShippingAmount(null|float|string $shippingAmount): static + { + if (is_string($shippingAmount)) { + $shippingAmount = (float) $shippingAmount; + } + + $this->fields['shippingAmount'] = $shippingAmount; + + return $this; + } + + public function getTaxAmount(): ?float + { + return $this->fields['taxAmount'] ?? null; + } + + public function setTaxAmount(null|float|string $taxAmount): static + { + if (is_string($taxAmount)) { + $taxAmount = (float) $taxAmount; + } + + $this->fields['taxAmount'] = $taxAmount; + + return $this; + } + + public function jsonSerialize(): array + { + $data = []; + if (array_key_exists('amount', $this->fields)) { + $data['amount'] = $this->fields['amount']; + } + if (array_key_exists('subtotalAmount', $this->fields)) { + $data['subtotalAmount'] = $this->fields['subtotalAmount']; + } + if (array_key_exists('discountAmount', $this->fields)) { + $data['discountAmount'] = $this->fields['discountAmount']; + } + if (array_key_exists('shippingAmount', $this->fields)) { + $data['shippingAmount'] = $this->fields['shippingAmount']; + } + if (array_key_exists('taxAmount', $this->fields)) { + $data['taxAmount'] = $this->fields['taxAmount']; + } + + return $data; + } +} diff --git a/src/Model/PatchPayoutRequestRequest.php b/src/Model/PatchPayoutRequestRequest.php index 2087e5f9c..60c1a04da 100644 --- a/src/Model/PatchPayoutRequestRequest.php +++ b/src/Model/PatchPayoutRequestRequest.php @@ -20,7 +20,7 @@ class PatchPayoutRequestRequest implements JsonSerializable { public const STATUS_PENDING = 'pending'; - public const STATUS_FLUSHED = 'flushed'; + public const STATUS_READY = 'ready'; public const STATUS_APPROVED = 'approved'; diff --git a/src/Model/PayoutRequest.php b/src/Model/PayoutRequest.php index 1f1fa74b5..478379f7d 100644 --- a/src/Model/PayoutRequest.php +++ b/src/Model/PayoutRequest.php @@ -61,6 +61,12 @@ public function __construct(array $data = []) if (array_key_exists('status', $data)) { $this->setStatus($data['status']); } + if (array_key_exists('blocked', $data)) { + $this->setBlocked($data['blocked']); + } + if (array_key_exists('batchId', $data)) { + $this->setBatchId($data['batchId']); + } if (array_key_exists('selectPaymentInstrumentUrl', $data)) { $this->setSelectPaymentInstrumentUrl($data['selectPaymentInstrumentUrl']); } @@ -180,6 +186,23 @@ public function getStatus(): ?string return $this->fields['status'] ?? null; } + public function getBlocked(): ?bool + { + return $this->fields['blocked'] ?? null; + } + + public function setBlocked(null|bool $blocked): static + { + $this->fields['blocked'] = $blocked; + + return $this; + } + + public function getBatchId(): ?string + { + return $this->fields['batchId'] ?? null; + } + public function getSelectPaymentInstrumentUrl(): ?string { return $this->fields['selectPaymentInstrumentUrl'] ?? null; @@ -269,6 +292,12 @@ public function jsonSerialize(): array if (array_key_exists('status', $this->fields)) { $data['status'] = $this->fields['status']; } + if (array_key_exists('blocked', $this->fields)) { + $data['blocked'] = $this->fields['blocked']; + } + if (array_key_exists('batchId', $this->fields)) { + $data['batchId'] = $this->fields['batchId']; + } if (array_key_exists('selectPaymentInstrumentUrl', $this->fields)) { $data['selectPaymentInstrumentUrl'] = $this->fields['selectPaymentInstrumentUrl']; } @@ -329,6 +358,13 @@ private function setStatus(null|string $status): static return $this; } + private function setBatchId(null|string $batchId): static + { + $this->fields['batchId'] = $batchId; + + return $this; + } + private function setSelectPaymentInstrumentUrl(null|string $selectPaymentInstrumentUrl): static { $this->fields['selectPaymentInstrumentUrl'] = $selectPaymentInstrumentUrl; diff --git a/src/Model/PayoutRequestAllocation.php b/src/Model/PayoutRequestAllocation.php index b59ac0dd6..32e2d9c36 100644 --- a/src/Model/PayoutRequestAllocation.php +++ b/src/Model/PayoutRequestAllocation.php @@ -40,6 +40,9 @@ public function __construct(array $data = []) if (array_key_exists('payoutRequestId', $data)) { $this->setPayoutRequestId($data['payoutRequestId']); } + if (array_key_exists('batchId', $data)) { + $this->setBatchId($data['batchId']); + } if (array_key_exists('paymentInstrumentId', $data)) { $this->setPaymentInstrumentId($data['paymentInstrumentId']); } @@ -87,6 +90,11 @@ public function getPayoutRequestId(): string return $this->fields['payoutRequestId']; } + public function getBatchId(): ?string + { + return $this->fields['batchId'] ?? null; + } + public function getPaymentInstrumentId(): string { return $this->fields['paymentInstrumentId']; @@ -195,6 +203,9 @@ public function jsonSerialize(): array if (array_key_exists('payoutRequestId', $this->fields)) { $data['payoutRequestId'] = $this->fields['payoutRequestId']; } + if (array_key_exists('batchId', $this->fields)) { + $data['batchId'] = $this->fields['batchId']; + } if (array_key_exists('paymentInstrumentId', $this->fields)) { $data['paymentInstrumentId'] = $this->fields['paymentInstrumentId']; } @@ -248,6 +259,13 @@ private function setPayoutRequestId(string $payoutRequestId): static return $this; } + private function setBatchId(null|string $batchId): static + { + $this->fields['batchId'] = $batchId; + + return $this; + } + private function setTransactionId(null|string $transactionId): static { $this->fields['transactionId'] = $transactionId; diff --git a/src/Model/PayoutRequestAllocationsDataExport.php b/src/Model/PayoutRequestAllocationsDataExport.php new file mode 100644 index 000000000..bb1dc067b --- /dev/null +++ b/src/Model/PayoutRequestAllocationsDataExport.php @@ -0,0 +1,424 @@ +setId($data['id']); + } + if (array_key_exists('name', $data)) { + $this->setName($data['name']); + } + if (array_key_exists('format', $data)) { + $this->setFormat($data['format']); + } + if (array_key_exists('arguments', $data)) { + $this->setArguments($data['arguments']); + } + if (array_key_exists('emailNotification', $data)) { + $this->setEmailNotification($data['emailNotification']); + } + if (array_key_exists('fields', $data)) { + $this->setFields($data['fields']); + } + if (array_key_exists('recurring', $data)) { + $this->setRecurring($data['recurring']); + } + if (array_key_exists('userId', $data)) { + $this->setUserId($data['userId']); + } + if (array_key_exists('fileId', $data)) { + $this->setFileId($data['fileId']); + } + if (array_key_exists('recordCount', $data)) { + $this->setRecordCount($data['recordCount']); + } + if (array_key_exists('scheduledTime', $data)) { + $this->setScheduledTime($data['scheduledTime']); + } + if (array_key_exists('createdTime', $data)) { + $this->setCreatedTime($data['createdTime']); + } + if (array_key_exists('updatedTime', $data)) { + $this->setUpdatedTime($data['updatedTime']); + } + if (array_key_exists('status', $data)) { + $this->setStatus($data['status']); + } + if (array_key_exists('dateRange', $data)) { + $this->setDateRange($data['dateRange']); + } + if (array_key_exists('_links', $data)) { + $this->setLinks($data['_links']); + } + if (array_key_exists('_embedded', $data)) { + $this->setEmbedded($data['_embedded']); + } + } + + public static function from(array $data = []): self + { + return new self($data); + } + + public function getResource(): string + { + return 'payoutRequestAllocations'; + } + + public function getId(): ?string + { + return $this->fields['id'] ?? null; + } + + public function getName(): string + { + return $this->fields['name']; + } + + public function setName(string $name): static + { + $this->fields['name'] = $name; + + return $this; + } + + public function getFormat(): string + { + return $this->fields['format']; + } + + public function setFormat(string $format): static + { + $this->fields['format'] = $format; + + return $this; + } + + public function getArguments(): ?DataExportArguments + { + return $this->fields['arguments'] ?? null; + } + + public function setArguments(null|DataExportArguments|array $arguments): static + { + if ($arguments !== null && !($arguments instanceof DataExportArguments)) { + $arguments = DataExportArguments::from($arguments); + } + + $this->fields['arguments'] = $arguments; + + return $this; + } + + /** + * @return null|string[] + */ + public function getEmailNotification(): ?array + { + return $this->fields['emailNotification'] ?? null; + } + + /** + * @param null|string[] $emailNotification + */ + public function setEmailNotification(null|array $emailNotification): static + { + $this->fields['emailNotification'] = $emailNotification; + + return $this; + } + + /** + * @return null|string[] + */ + public function getFields(): ?array + { + return $this->fields['fields'] ?? null; + } + + /** + * @param null|string[] $fields + */ + public function setFields(null|array $fields): static + { + $this->fields['fields'] = $fields; + + return $this; + } + + public function getRecurring(): ?DataExportRecurring + { + return $this->fields['recurring'] ?? null; + } + + public function setRecurring(null|DataExportRecurring|array $recurring): static + { + if ($recurring !== null && !($recurring instanceof DataExportRecurring)) { + $recurring = DataExportRecurring::from($recurring); + } + + $this->fields['recurring'] = $recurring; + + return $this; + } + + public function getUserId(): ?string + { + return $this->fields['userId'] ?? null; + } + + public function getFileId(): ?string + { + return $this->fields['fileId'] ?? null; + } + + public function getRecordCount(): ?int + { + return $this->fields['recordCount'] ?? null; + } + + public function getScheduledTime(): ?DateTimeImmutable + { + return $this->fields['scheduledTime'] ?? null; + } + + public function getCreatedTime(): ?DateTimeImmutable + { + return $this->fields['createdTime'] ?? null; + } + + public function getUpdatedTime(): ?DateTimeImmutable + { + return $this->fields['updatedTime'] ?? null; + } + + public function getStatus(): ?string + { + return $this->fields['status'] ?? null; + } + + public function getDateRange(): ?DataExportDateRange + { + return $this->fields['dateRange'] ?? null; + } + + public function setDateRange(null|DataExportDateRange|array $dateRange): static + { + if ($dateRange !== null && !($dateRange instanceof DataExportDateRange)) { + $dateRange = DataExportDateRange::from($dateRange); + } + + $this->fields['dateRange'] = $dateRange; + + return $this; + } + + /** + * @return null|ResourceLink[] + */ + public function getLinks(): ?array + { + return $this->fields['_links'] ?? null; + } + + public function getEmbedded(): ?PayoutRequestAllocationsDataExportEmbedded + { + return $this->fields['_embedded'] ?? null; + } + + public function setEmbedded(null|PayoutRequestAllocationsDataExportEmbedded|array $embedded): static + { + if ($embedded !== null && !($embedded instanceof PayoutRequestAllocationsDataExportEmbedded)) { + $embedded = PayoutRequestAllocationsDataExportEmbedded::from($embedded); + } + + $this->fields['_embedded'] = $embedded; + + return $this; + } + + public function jsonSerialize(): array + { + $data = [ + 'resource' => 'payoutRequestAllocations', + ]; + if (array_key_exists('id', $this->fields)) { + $data['id'] = $this->fields['id']; + } + if (array_key_exists('name', $this->fields)) { + $data['name'] = $this->fields['name']; + } + if (array_key_exists('format', $this->fields)) { + $data['format'] = $this->fields['format']; + } + if (array_key_exists('arguments', $this->fields)) { + $data['arguments'] = $this->fields['arguments']?->jsonSerialize(); + } + if (array_key_exists('emailNotification', $this->fields)) { + $data['emailNotification'] = $this->fields['emailNotification']; + } + if (array_key_exists('fields', $this->fields)) { + $data['fields'] = $this->fields['fields']; + } + if (array_key_exists('recurring', $this->fields)) { + $data['recurring'] = $this->fields['recurring']?->jsonSerialize(); + } + if (array_key_exists('userId', $this->fields)) { + $data['userId'] = $this->fields['userId']; + } + if (array_key_exists('fileId', $this->fields)) { + $data['fileId'] = $this->fields['fileId']; + } + if (array_key_exists('recordCount', $this->fields)) { + $data['recordCount'] = $this->fields['recordCount']; + } + if (array_key_exists('scheduledTime', $this->fields)) { + $data['scheduledTime'] = $this->fields['scheduledTime']?->format(DateTimeInterface::RFC3339); + } + if (array_key_exists('createdTime', $this->fields)) { + $data['createdTime'] = $this->fields['createdTime']?->format(DateTimeInterface::RFC3339); + } + if (array_key_exists('updatedTime', $this->fields)) { + $data['updatedTime'] = $this->fields['updatedTime']?->format(DateTimeInterface::RFC3339); + } + if (array_key_exists('status', $this->fields)) { + $data['status'] = $this->fields['status']; + } + if (array_key_exists('dateRange', $this->fields)) { + $data['dateRange'] = $this->fields['dateRange']?->jsonSerialize(); + } + if (array_key_exists('_links', $this->fields)) { + $data['_links'] = $this->fields['_links'] !== null + ? array_map( + static fn (ResourceLink $resourceLink) => $resourceLink->jsonSerialize(), + $this->fields['_links'], + ) + : null; + } + if (array_key_exists('_embedded', $this->fields)) { + $data['_embedded'] = $this->fields['_embedded']?->jsonSerialize(); + } + + return $data; + } + + private function setId(null|string $id): static + { + $this->fields['id'] = $id; + + return $this; + } + + private function setUserId(null|string $userId): static + { + $this->fields['userId'] = $userId; + + return $this; + } + + private function setFileId(null|string $fileId): static + { + $this->fields['fileId'] = $fileId; + + return $this; + } + + private function setRecordCount(null|int $recordCount): static + { + $this->fields['recordCount'] = $recordCount; + + return $this; + } + + private function setScheduledTime(null|DateTimeImmutable|string $scheduledTime): static + { + if ($scheduledTime !== null && !($scheduledTime instanceof DateTimeImmutable)) { + $scheduledTime = new DateTimeImmutable($scheduledTime); + } + + $this->fields['scheduledTime'] = $scheduledTime; + + return $this; + } + + private function setCreatedTime(null|DateTimeImmutable|string $createdTime): static + { + if ($createdTime !== null && !($createdTime instanceof DateTimeImmutable)) { + $createdTime = new DateTimeImmutable($createdTime); + } + + $this->fields['createdTime'] = $createdTime; + + return $this; + } + + private function setUpdatedTime(null|DateTimeImmutable|string $updatedTime): static + { + if ($updatedTime !== null && !($updatedTime instanceof DateTimeImmutable)) { + $updatedTime = new DateTimeImmutable($updatedTime); + } + + $this->fields['updatedTime'] = $updatedTime; + + return $this; + } + + private function setStatus(null|string $status): static + { + $this->fields['status'] = $status; + + return $this; + } + + /** + * @param null|array[]|ResourceLink[] $links + */ + private function setLinks(null|array $links): static + { + $links = $links !== null ? array_map( + fn ($value) => $value instanceof ResourceLink ? $value : ResourceLink::from($value), + $links, + ) : null; + + $this->fields['_links'] = $links; + + return $this; + } +} diff --git a/src/Model/PayoutRequestAllocationsDataExportEmbedded.php b/src/Model/PayoutRequestAllocationsDataExportEmbedded.php new file mode 100644 index 000000000..a565debbf --- /dev/null +++ b/src/Model/PayoutRequestAllocationsDataExportEmbedded.php @@ -0,0 +1,82 @@ +setFile($data['file']); + } + if (array_key_exists('user', $data)) { + $this->setUser($data['user']); + } + } + + public static function from(array $data = []): self + { + return new self($data); + } + + public function getFile(): ?File + { + return $this->fields['file'] ?? null; + } + + public function setFile(null|File|array $file): static + { + if ($file !== null && !($file instanceof File)) { + $file = File::from($file); + } + + $this->fields['file'] = $file; + + return $this; + } + + public function getUser(): ?User + { + return $this->fields['user'] ?? null; + } + + public function setUser(null|User|array $user): static + { + if ($user !== null && !($user instanceof User)) { + $user = User::from($user); + } + + $this->fields['user'] = $user; + + return $this; + } + + public function jsonSerialize(): array + { + $data = []; + if (array_key_exists('file', $this->fields)) { + $data['file'] = $this->fields['file']?->jsonSerialize(); + } + if (array_key_exists('user', $this->fields)) { + $data['user'] = $this->fields['user']?->jsonSerialize(); + } + + return $data; + } +} diff --git a/src/Model/PayoutRequestBatch.php b/src/Model/PayoutRequestBatch.php new file mode 100644 index 000000000..147f572e7 --- /dev/null +++ b/src/Model/PayoutRequestBatch.php @@ -0,0 +1,276 @@ +setId($data['id']); + } + if (array_key_exists('userId', $data)) { + $this->setUserId($data['userId']); + } + if (array_key_exists('status', $data)) { + $this->setStatus($data['status']); + } + if (array_key_exists('totalCount', $data)) { + $this->setTotalCount($data['totalCount']); + } + if (array_key_exists('successCount', $data)) { + $this->setSuccessCount($data['successCount']); + } + if (array_key_exists('failureCount', $data)) { + $this->setFailureCount($data['failureCount']); + } + if (array_key_exists('payoutRequestIds', $data)) { + $this->setPayoutRequestIds($data['payoutRequestIds']); + } + if (array_key_exists('description', $data)) { + $this->setDescription($data['description']); + } + if (array_key_exists('createdTime', $data)) { + $this->setCreatedTime($data['createdTime']); + } + if (array_key_exists('updatedTime', $data)) { + $this->setUpdatedTime($data['updatedTime']); + } + if (array_key_exists('_links', $data)) { + $this->setLinks($data['_links']); + } + } + + public static function from(array $data = []): self + { + return new self($data); + } + + public function getId(): ?string + { + return $this->fields['id'] ?? null; + } + + public function getUserId(): ?string + { + return $this->fields['userId'] ?? null; + } + + public function getStatus(): ?string + { + return $this->fields['status'] ?? null; + } + + public function getTotalCount(): ?int + { + return $this->fields['totalCount'] ?? null; + } + + public function getSuccessCount(): ?int + { + return $this->fields['successCount'] ?? null; + } + + public function getFailureCount(): ?int + { + return $this->fields['failureCount'] ?? null; + } + + /** + * @return null|string[] + */ + public function getPayoutRequestIds(): ?array + { + return $this->fields['payoutRequestIds'] ?? null; + } + + public function getDescription(): ?string + { + return $this->fields['description'] ?? null; + } + + public function setDescription(null|string $description): static + { + $this->fields['description'] = $description; + + return $this; + } + + public function getCreatedTime(): ?DateTimeImmutable + { + return $this->fields['createdTime'] ?? null; + } + + public function getUpdatedTime(): ?DateTimeImmutable + { + return $this->fields['updatedTime'] ?? null; + } + + /** + * @return null|ResourceLink[] + */ + public function getLinks(): ?array + { + return $this->fields['_links'] ?? null; + } + + public function jsonSerialize(): array + { + $data = []; + if (array_key_exists('id', $this->fields)) { + $data['id'] = $this->fields['id']; + } + if (array_key_exists('userId', $this->fields)) { + $data['userId'] = $this->fields['userId']; + } + if (array_key_exists('status', $this->fields)) { + $data['status'] = $this->fields['status']; + } + if (array_key_exists('totalCount', $this->fields)) { + $data['totalCount'] = $this->fields['totalCount']; + } + if (array_key_exists('successCount', $this->fields)) { + $data['successCount'] = $this->fields['successCount']; + } + if (array_key_exists('failureCount', $this->fields)) { + $data['failureCount'] = $this->fields['failureCount']; + } + if (array_key_exists('payoutRequestIds', $this->fields)) { + $data['payoutRequestIds'] = $this->fields['payoutRequestIds']; + } + if (array_key_exists('description', $this->fields)) { + $data['description'] = $this->fields['description']; + } + if (array_key_exists('createdTime', $this->fields)) { + $data['createdTime'] = $this->fields['createdTime']?->format(DateTimeInterface::RFC3339); + } + if (array_key_exists('updatedTime', $this->fields)) { + $data['updatedTime'] = $this->fields['updatedTime']?->format(DateTimeInterface::RFC3339); + } + if (array_key_exists('_links', $this->fields)) { + $data['_links'] = $this->fields['_links'] !== null + ? array_map( + static fn (ResourceLink $resourceLink) => $resourceLink->jsonSerialize(), + $this->fields['_links'], + ) + : null; + } + + return $data; + } + + private function setId(null|string $id): static + { + $this->fields['id'] = $id; + + return $this; + } + + private function setUserId(null|string $userId): static + { + $this->fields['userId'] = $userId; + + return $this; + } + + private function setStatus(null|string $status): static + { + $this->fields['status'] = $status; + + return $this; + } + + private function setTotalCount(null|int $totalCount): static + { + $this->fields['totalCount'] = $totalCount; + + return $this; + } + + private function setSuccessCount(null|int $successCount): static + { + $this->fields['successCount'] = $successCount; + + return $this; + } + + private function setFailureCount(null|int $failureCount): static + { + $this->fields['failureCount'] = $failureCount; + + return $this; + } + + /** + * @param null|string[] $payoutRequestIds + */ + private function setPayoutRequestIds(null|array $payoutRequestIds): static + { + $this->fields['payoutRequestIds'] = $payoutRequestIds; + + return $this; + } + + private function setCreatedTime(null|DateTimeImmutable|string $createdTime): static + { + if ($createdTime !== null && !($createdTime instanceof DateTimeImmutable)) { + $createdTime = new DateTimeImmutable($createdTime); + } + + $this->fields['createdTime'] = $createdTime; + + return $this; + } + + private function setUpdatedTime(null|DateTimeImmutable|string $updatedTime): static + { + if ($updatedTime !== null && !($updatedTime instanceof DateTimeImmutable)) { + $updatedTime = new DateTimeImmutable($updatedTime); + } + + $this->fields['updatedTime'] = $updatedTime; + + return $this; + } + + /** + * @param null|array[]|ResourceLink[] $links + */ + private function setLinks(null|array $links): static + { + $links = $links !== null ? array_map( + fn ($value) => $value instanceof ResourceLink ? $value : ResourceLink::from($value), + $links, + ) : null; + + $this->fields['_links'] = $links; + + return $this; + } +} diff --git a/src/Model/PayoutRequestTimelineMessage.php b/src/Model/PayoutRequestTimelineMessage.php index 9d372b9ec..fe599b730 100644 --- a/src/Model/PayoutRequestTimelineMessage.php +++ b/src/Model/PayoutRequestTimelineMessage.php @@ -24,9 +24,9 @@ class PayoutRequestTimelineMessage implements JsonSerializable public const TYPE_PAYOUT_REQUEST_CREATED = 'payout-request-created'; - public const TYPE_PAYOUT_REQUEST_FLUSHED = 'payout-request-flushed'; + public const TYPE_PAYOUT_REQUEST_READY = 'payout-request-ready'; - public const TYPE_PAYOUT_REQUEST_FLUSH_UNDONE = 'payout-request-flush-undone'; + public const TYPE_PAYOUT_REQUEST_RETURNED_TO_PENDING = 'payout-request-returned-to-pending'; public const TYPE_PAYOUT_REQUEST_APPROVED = 'payout-request-approved'; diff --git a/src/Model/PayoutRequestV2.php b/src/Model/PayoutRequestV2.php index e74b0eecd..57fe11c98 100644 --- a/src/Model/PayoutRequestV2.php +++ b/src/Model/PayoutRequestV2.php @@ -22,7 +22,7 @@ class PayoutRequestV2 implements JsonSerializable { public const STATUS_PENDING = 'pending'; - public const STATUS_FLUSHED = 'flushed'; + public const STATUS_READY = 'ready'; public const STATUS_APPROVED = 'approved'; @@ -76,6 +76,9 @@ public function __construct(array $data = []) if (array_key_exists('blocked', $data)) { $this->setBlocked($data['blocked']); } + if (array_key_exists('batchId', $data)) { + $this->setBatchId($data['batchId']); + } if (array_key_exists('selectPaymentInstrumentUrl', $data)) { $this->setSelectPaymentInstrumentUrl($data['selectPaymentInstrumentUrl']); } @@ -214,6 +217,11 @@ public function setBlocked(null|bool $blocked): static return $this; } + public function getBatchId(): ?string + { + return $this->fields['batchId'] ?? null; + } + public function getSelectPaymentInstrumentUrl(): ?string { return $this->fields['selectPaymentInstrumentUrl'] ?? null; @@ -306,6 +314,9 @@ public function jsonSerialize(): array if (array_key_exists('blocked', $this->fields)) { $data['blocked'] = $this->fields['blocked']; } + if (array_key_exists('batchId', $this->fields)) { + $data['batchId'] = $this->fields['batchId']; + } if (array_key_exists('selectPaymentInstrumentUrl', $this->fields)) { $data['selectPaymentInstrumentUrl'] = $this->fields['selectPaymentInstrumentUrl']; } @@ -359,6 +370,13 @@ private function setAvailableAmount(null|float|string $availableAmount): static return $this; } + private function setBatchId(null|string $batchId): static + { + $this->fields['batchId'] = $batchId; + + return $this; + } + private function setSelectPaymentInstrumentUrl(null|string $selectPaymentInstrumentUrl): static { $this->fields['selectPaymentInstrumentUrl'] = $selectPaymentInstrumentUrl; diff --git a/src/Model/PayoutRequestsDataExport.php b/src/Model/PayoutRequestsDataExport.php new file mode 100644 index 000000000..b482088c1 --- /dev/null +++ b/src/Model/PayoutRequestsDataExport.php @@ -0,0 +1,424 @@ +setId($data['id']); + } + if (array_key_exists('name', $data)) { + $this->setName($data['name']); + } + if (array_key_exists('format', $data)) { + $this->setFormat($data['format']); + } + if (array_key_exists('arguments', $data)) { + $this->setArguments($data['arguments']); + } + if (array_key_exists('emailNotification', $data)) { + $this->setEmailNotification($data['emailNotification']); + } + if (array_key_exists('fields', $data)) { + $this->setFields($data['fields']); + } + if (array_key_exists('recurring', $data)) { + $this->setRecurring($data['recurring']); + } + if (array_key_exists('userId', $data)) { + $this->setUserId($data['userId']); + } + if (array_key_exists('fileId', $data)) { + $this->setFileId($data['fileId']); + } + if (array_key_exists('recordCount', $data)) { + $this->setRecordCount($data['recordCount']); + } + if (array_key_exists('scheduledTime', $data)) { + $this->setScheduledTime($data['scheduledTime']); + } + if (array_key_exists('createdTime', $data)) { + $this->setCreatedTime($data['createdTime']); + } + if (array_key_exists('updatedTime', $data)) { + $this->setUpdatedTime($data['updatedTime']); + } + if (array_key_exists('status', $data)) { + $this->setStatus($data['status']); + } + if (array_key_exists('dateRange', $data)) { + $this->setDateRange($data['dateRange']); + } + if (array_key_exists('_links', $data)) { + $this->setLinks($data['_links']); + } + if (array_key_exists('_embedded', $data)) { + $this->setEmbedded($data['_embedded']); + } + } + + public static function from(array $data = []): self + { + return new self($data); + } + + public function getResource(): string + { + return 'payoutRequests'; + } + + public function getId(): ?string + { + return $this->fields['id'] ?? null; + } + + public function getName(): string + { + return $this->fields['name']; + } + + public function setName(string $name): static + { + $this->fields['name'] = $name; + + return $this; + } + + public function getFormat(): string + { + return $this->fields['format']; + } + + public function setFormat(string $format): static + { + $this->fields['format'] = $format; + + return $this; + } + + public function getArguments(): ?DataExportArguments + { + return $this->fields['arguments'] ?? null; + } + + public function setArguments(null|DataExportArguments|array $arguments): static + { + if ($arguments !== null && !($arguments instanceof DataExportArguments)) { + $arguments = DataExportArguments::from($arguments); + } + + $this->fields['arguments'] = $arguments; + + return $this; + } + + /** + * @return null|string[] + */ + public function getEmailNotification(): ?array + { + return $this->fields['emailNotification'] ?? null; + } + + /** + * @param null|string[] $emailNotification + */ + public function setEmailNotification(null|array $emailNotification): static + { + $this->fields['emailNotification'] = $emailNotification; + + return $this; + } + + /** + * @return null|string[] + */ + public function getFields(): ?array + { + return $this->fields['fields'] ?? null; + } + + /** + * @param null|string[] $fields + */ + public function setFields(null|array $fields): static + { + $this->fields['fields'] = $fields; + + return $this; + } + + public function getRecurring(): ?DataExportRecurring + { + return $this->fields['recurring'] ?? null; + } + + public function setRecurring(null|DataExportRecurring|array $recurring): static + { + if ($recurring !== null && !($recurring instanceof DataExportRecurring)) { + $recurring = DataExportRecurring::from($recurring); + } + + $this->fields['recurring'] = $recurring; + + return $this; + } + + public function getUserId(): ?string + { + return $this->fields['userId'] ?? null; + } + + public function getFileId(): ?string + { + return $this->fields['fileId'] ?? null; + } + + public function getRecordCount(): ?int + { + return $this->fields['recordCount'] ?? null; + } + + public function getScheduledTime(): ?DateTimeImmutable + { + return $this->fields['scheduledTime'] ?? null; + } + + public function getCreatedTime(): ?DateTimeImmutable + { + return $this->fields['createdTime'] ?? null; + } + + public function getUpdatedTime(): ?DateTimeImmutable + { + return $this->fields['updatedTime'] ?? null; + } + + public function getStatus(): ?string + { + return $this->fields['status'] ?? null; + } + + public function getDateRange(): ?DataExportDateRange + { + return $this->fields['dateRange'] ?? null; + } + + public function setDateRange(null|DataExportDateRange|array $dateRange): static + { + if ($dateRange !== null && !($dateRange instanceof DataExportDateRange)) { + $dateRange = DataExportDateRange::from($dateRange); + } + + $this->fields['dateRange'] = $dateRange; + + return $this; + } + + /** + * @return null|ResourceLink[] + */ + public function getLinks(): ?array + { + return $this->fields['_links'] ?? null; + } + + public function getEmbedded(): ?PayoutRequestsDataExportEmbedded + { + return $this->fields['_embedded'] ?? null; + } + + public function setEmbedded(null|PayoutRequestsDataExportEmbedded|array $embedded): static + { + if ($embedded !== null && !($embedded instanceof PayoutRequestsDataExportEmbedded)) { + $embedded = PayoutRequestsDataExportEmbedded::from($embedded); + } + + $this->fields['_embedded'] = $embedded; + + return $this; + } + + public function jsonSerialize(): array + { + $data = [ + 'resource' => 'payoutRequests', + ]; + if (array_key_exists('id', $this->fields)) { + $data['id'] = $this->fields['id']; + } + if (array_key_exists('name', $this->fields)) { + $data['name'] = $this->fields['name']; + } + if (array_key_exists('format', $this->fields)) { + $data['format'] = $this->fields['format']; + } + if (array_key_exists('arguments', $this->fields)) { + $data['arguments'] = $this->fields['arguments']?->jsonSerialize(); + } + if (array_key_exists('emailNotification', $this->fields)) { + $data['emailNotification'] = $this->fields['emailNotification']; + } + if (array_key_exists('fields', $this->fields)) { + $data['fields'] = $this->fields['fields']; + } + if (array_key_exists('recurring', $this->fields)) { + $data['recurring'] = $this->fields['recurring']?->jsonSerialize(); + } + if (array_key_exists('userId', $this->fields)) { + $data['userId'] = $this->fields['userId']; + } + if (array_key_exists('fileId', $this->fields)) { + $data['fileId'] = $this->fields['fileId']; + } + if (array_key_exists('recordCount', $this->fields)) { + $data['recordCount'] = $this->fields['recordCount']; + } + if (array_key_exists('scheduledTime', $this->fields)) { + $data['scheduledTime'] = $this->fields['scheduledTime']?->format(DateTimeInterface::RFC3339); + } + if (array_key_exists('createdTime', $this->fields)) { + $data['createdTime'] = $this->fields['createdTime']?->format(DateTimeInterface::RFC3339); + } + if (array_key_exists('updatedTime', $this->fields)) { + $data['updatedTime'] = $this->fields['updatedTime']?->format(DateTimeInterface::RFC3339); + } + if (array_key_exists('status', $this->fields)) { + $data['status'] = $this->fields['status']; + } + if (array_key_exists('dateRange', $this->fields)) { + $data['dateRange'] = $this->fields['dateRange']?->jsonSerialize(); + } + if (array_key_exists('_links', $this->fields)) { + $data['_links'] = $this->fields['_links'] !== null + ? array_map( + static fn (ResourceLink $resourceLink) => $resourceLink->jsonSerialize(), + $this->fields['_links'], + ) + : null; + } + if (array_key_exists('_embedded', $this->fields)) { + $data['_embedded'] = $this->fields['_embedded']?->jsonSerialize(); + } + + return $data; + } + + private function setId(null|string $id): static + { + $this->fields['id'] = $id; + + return $this; + } + + private function setUserId(null|string $userId): static + { + $this->fields['userId'] = $userId; + + return $this; + } + + private function setFileId(null|string $fileId): static + { + $this->fields['fileId'] = $fileId; + + return $this; + } + + private function setRecordCount(null|int $recordCount): static + { + $this->fields['recordCount'] = $recordCount; + + return $this; + } + + private function setScheduledTime(null|DateTimeImmutable|string $scheduledTime): static + { + if ($scheduledTime !== null && !($scheduledTime instanceof DateTimeImmutable)) { + $scheduledTime = new DateTimeImmutable($scheduledTime); + } + + $this->fields['scheduledTime'] = $scheduledTime; + + return $this; + } + + private function setCreatedTime(null|DateTimeImmutable|string $createdTime): static + { + if ($createdTime !== null && !($createdTime instanceof DateTimeImmutable)) { + $createdTime = new DateTimeImmutable($createdTime); + } + + $this->fields['createdTime'] = $createdTime; + + return $this; + } + + private function setUpdatedTime(null|DateTimeImmutable|string $updatedTime): static + { + if ($updatedTime !== null && !($updatedTime instanceof DateTimeImmutable)) { + $updatedTime = new DateTimeImmutable($updatedTime); + } + + $this->fields['updatedTime'] = $updatedTime; + + return $this; + } + + private function setStatus(null|string $status): static + { + $this->fields['status'] = $status; + + return $this; + } + + /** + * @param null|array[]|ResourceLink[] $links + */ + private function setLinks(null|array $links): static + { + $links = $links !== null ? array_map( + fn ($value) => $value instanceof ResourceLink ? $value : ResourceLink::from($value), + $links, + ) : null; + + $this->fields['_links'] = $links; + + return $this; + } +} diff --git a/src/Model/PayoutRequestsDataExportEmbedded.php b/src/Model/PayoutRequestsDataExportEmbedded.php new file mode 100644 index 000000000..5f4672b2b --- /dev/null +++ b/src/Model/PayoutRequestsDataExportEmbedded.php @@ -0,0 +1,82 @@ +setFile($data['file']); + } + if (array_key_exists('user', $data)) { + $this->setUser($data['user']); + } + } + + public static function from(array $data = []): self + { + return new self($data); + } + + public function getFile(): ?File + { + return $this->fields['file'] ?? null; + } + + public function setFile(null|File|array $file): static + { + if ($file !== null && !($file instanceof File)) { + $file = File::from($file); + } + + $this->fields['file'] = $file; + + return $this; + } + + public function getUser(): ?User + { + return $this->fields['user'] ?? null; + } + + public function setUser(null|User|array $user): static + { + if ($user !== null && !($user instanceof User)) { + $user = User::from($user); + } + + $this->fields['user'] = $user; + + return $this; + } + + public function jsonSerialize(): array + { + $data = []; + if (array_key_exists('file', $this->fields)) { + $data['file'] = $this->fields['file']?->jsonSerialize(); + } + if (array_key_exists('user', $this->fields)) { + $data['user'] = $this->fields['user']?->jsonSerialize(); + } + + return $data; + } +} diff --git a/src/Model/Plan.php b/src/Model/Plan.php index 5d7771c12..568b3b1c6 100644 --- a/src/Model/Plan.php +++ b/src/Model/Plan.php @@ -19,7 +19,7 @@ interface Plan extends JsonSerializable { - public function getId(): ?string; + public function getId(): string; public function getName(): string; diff --git a/src/Model/PostDisputeRequest.php b/src/Model/PostDisputeRequest.php index 7c3f66f06..2fa00039d 100644 --- a/src/Model/PostDisputeRequest.php +++ b/src/Model/PostDisputeRequest.php @@ -310,6 +310,36 @@ class PostDisputeRequest implements JsonSerializable public const REASON_CODE_4999 = '4999'; + public const REASON_CODE_4534 = '4534'; + + public const REASON_CODE_4541 = '4541'; + + public const REASON_CODE_4542 = '4542'; + + public const REASON_CODE_4550 = '4550'; + + public const REASON_CODE_4553 = '4553'; + + public const REASON_CODE_4586 = '4586'; + + public const REASON_CODE_4752 = '4752'; + + public const REASON_CODE_4753 = '4753'; + + public const REASON_CODE_4755 = '4755'; + + public const REASON_CODE_4865 = '4865'; + + public const REASON_CODE_4866 = '4866'; + + public const REASON_CODE_4867 = '4867'; + + public const REASON_CODE_7010 = '7010'; + + public const REASON_CODE_7030 = '7030'; + + public const REASON_CODE_8002 = '8002'; + public const REASON_CODE_A = 'A'; public const REASON_CODE_A01 = 'A01'; diff --git a/src/Model/PostPayoutRequestAllocationsProcessRequest.php b/src/Model/PostPayoutRequestAllocationsProcessRequest.php new file mode 100644 index 000000000..19d42a1d9 --- /dev/null +++ b/src/Model/PostPayoutRequestAllocationsProcessRequest.php @@ -0,0 +1,62 @@ +setAllocationIds($data['allocationIds']); + } + } + + public static function from(array $data = []): self + { + return new self($data); + } + + /** + * @return string[] + */ + public function getAllocationIds(): array + { + return $this->fields['allocationIds']; + } + + /** + * @param string[] $allocationIds + */ + public function setAllocationIds(array $allocationIds): static + { + $this->fields['allocationIds'] = $allocationIds; + + return $this; + } + + public function jsonSerialize(): array + { + $data = []; + if (array_key_exists('allocationIds', $this->fields)) { + $data['allocationIds'] = $this->fields['allocationIds']; + } + + return $data; + } +} diff --git a/src/Model/PostPayoutRequestBatchRequest.php b/src/Model/PostPayoutRequestBatchRequest.php new file mode 100644 index 000000000..6814373d7 --- /dev/null +++ b/src/Model/PostPayoutRequestBatchRequest.php @@ -0,0 +1,80 @@ +setPayoutRequestIds($data['payoutRequestIds']); + } + if (array_key_exists('description', $data)) { + $this->setDescription($data['description']); + } + } + + public static function from(array $data = []): self + { + return new self($data); + } + + /** + * @return string[] + */ + public function getPayoutRequestIds(): array + { + return $this->fields['payoutRequestIds']; + } + + /** + * @param string[] $payoutRequestIds + */ + public function setPayoutRequestIds(array $payoutRequestIds): static + { + $this->fields['payoutRequestIds'] = $payoutRequestIds; + + return $this; + } + + public function getDescription(): ?string + { + return $this->fields['description'] ?? null; + } + + public function setDescription(null|string $description): static + { + $this->fields['description'] = $description; + + return $this; + } + + public function jsonSerialize(): array + { + $data = []; + if (array_key_exists('payoutRequestIds', $this->fields)) { + $data['payoutRequestIds'] = $this->fields['payoutRequestIds']; + } + if (array_key_exists('description', $this->fields)) { + $data['description'] = $this->fields['description']; + } + + return $data; + } +} diff --git a/src/Model/RedemptionRestrictionFactory.php b/src/Model/RedemptionRestrictionFactory.php index 94a9be511..632fa7904 100644 --- a/src/Model/RedemptionRestrictionFactory.php +++ b/src/Model/RedemptionRestrictionFactory.php @@ -22,6 +22,7 @@ public static function from(array $data = []): RedemptionRestriction { return match ($data['type']) { 'discounts-per-redemption' => CouponRestrictionDiscountPerRedemption::from($data), + 'maximum-order-amount' => CouponRestrictionMaximumOrderAmount::from($data), 'minimum-order-amount' => CouponRestrictionMinimumOrderAmount::from($data), 'paid-by-time' => CouponRestrictionPaidByTime::from($data), 'restrict-to-invoices' => CouponRestrictionRestrictToInvoices::from($data), diff --git a/src/Model/ReportAmlChecks.php b/src/Model/ReportAmlChecks.php new file mode 100644 index 000000000..22d302e59 --- /dev/null +++ b/src/Model/ReportAmlChecks.php @@ -0,0 +1,110 @@ +setTotal($data['total']); + } + if (array_key_exists('propagated', $data)) { + $this->setPropagated($data['propagated']); + } + if (array_key_exists('resulted', $data)) { + $this->setResulted($data['resulted']); + } + if (array_key_exists('pending', $data)) { + $this->setPending($data['pending']); + } + } + + public static function from(array $data = []): self + { + return new self($data); + } + + public function getTotal(): ?int + { + return $this->fields['total'] ?? null; + } + + public function setTotal(null|int $total): static + { + $this->fields['total'] = $total; + + return $this; + } + + public function getPropagated(): ?int + { + return $this->fields['propagated'] ?? null; + } + + public function setPropagated(null|int $propagated): static + { + $this->fields['propagated'] = $propagated; + + return $this; + } + + public function getResulted(): ?int + { + return $this->fields['resulted'] ?? null; + } + + public function setResulted(null|int $resulted): static + { + $this->fields['resulted'] = $resulted; + + return $this; + } + + public function getPending(): ?int + { + return $this->fields['pending'] ?? null; + } + + public function setPending(null|int $pending): static + { + $this->fields['pending'] = $pending; + + return $this; + } + + public function jsonSerialize(): array + { + $data = []; + if (array_key_exists('total', $this->fields)) { + $data['total'] = $this->fields['total']; + } + if (array_key_exists('propagated', $this->fields)) { + $data['propagated'] = $this->fields['propagated']; + } + if (array_key_exists('resulted', $this->fields)) { + $data['resulted'] = $this->fields['resulted']; + } + if (array_key_exists('pending', $this->fields)) { + $data['pending'] = $this->fields['pending']; + } + + return $data; + } +} diff --git a/src/Model/RiskScoreBlocklist.php b/src/Model/RiskScoreBlocklist.php index 70c5181ef..1936fc45d 100644 --- a/src/Model/RiskScoreBlocklist.php +++ b/src/Model/RiskScoreBlocklist.php @@ -22,36 +22,6 @@ class RiskScoreBlocklist implements JsonSerializable public function __construct(array $data = []) { - if (array_key_exists('address', $data)) { - $this->setAddress($data['address']); - } - if (array_key_exists('bank-account', $data)) { - $this->setBankAccount($data['bank-account']); - } - if (array_key_exists('bin', $data)) { - $this->setBin($data['bin']); - } - if (array_key_exists('country', $data)) { - $this->setCountry($data['country']); - } - if (array_key_exists('customer-id', $data)) { - $this->setCustomerId($data['customer-id']); - } - if (array_key_exists('email', $data)) { - $this->setEmail($data['email']); - } - if (array_key_exists('email-domain', $data)) { - $this->setEmailDomain($data['email-domain']); - } - if (array_key_exists('fingerprint', $data)) { - $this->setFingerprint($data['fingerprint']); - } - if (array_key_exists('ip-address', $data)) { - $this->setIpAddress($data['ip-address']); - } - if (array_key_exists('payment-card', $data)) { - $this->setPaymentCard($data['payment-card']); - } if (array_key_exists('permanentlyBlockList', $data)) { $this->setPermanentlyBlockList($data['permanentlyBlockList']); } @@ -65,166 +35,6 @@ public static function from(array $data = []): self return new self($data); } - public function getAddress(): ?RiskScoreBlocklistType - { - return $this->fields['address'] ?? null; - } - - public function setAddress(null|RiskScoreBlocklistType|array $address): static - { - if ($address !== null && !($address instanceof RiskScoreBlocklistType)) { - $address = RiskScoreBlocklistType::from($address); - } - - $this->fields['address'] = $address; - - return $this; - } - - public function getBankAccount(): ?RiskScoreBlocklistType - { - return $this->fields['bank-account'] ?? null; - } - - public function setBankAccount(null|RiskScoreBlocklistType|array $bankAccount): static - { - if ($bankAccount !== null && !($bankAccount instanceof RiskScoreBlocklistType)) { - $bankAccount = RiskScoreBlocklistType::from($bankAccount); - } - - $this->fields['bank-account'] = $bankAccount; - - return $this; - } - - public function getBin(): ?RiskScoreBlocklistType - { - return $this->fields['bin'] ?? null; - } - - public function setBin(null|RiskScoreBlocklistType|array $bin): static - { - if ($bin !== null && !($bin instanceof RiskScoreBlocklistType)) { - $bin = RiskScoreBlocklistType::from($bin); - } - - $this->fields['bin'] = $bin; - - return $this; - } - - public function getCountry(): ?RiskScoreBlocklistType - { - return $this->fields['country'] ?? null; - } - - public function setCountry(null|RiskScoreBlocklistType|array $country): static - { - if ($country !== null && !($country instanceof RiskScoreBlocklistType)) { - $country = RiskScoreBlocklistType::from($country); - } - - $this->fields['country'] = $country; - - return $this; - } - - public function getCustomerId(): ?RiskScoreBlocklistType - { - return $this->fields['customer-id'] ?? null; - } - - public function setCustomerId(null|RiskScoreBlocklistType|array $customerId): static - { - if ($customerId !== null && !($customerId instanceof RiskScoreBlocklistType)) { - $customerId = RiskScoreBlocklistType::from($customerId); - } - - $this->fields['customer-id'] = $customerId; - - return $this; - } - - public function getEmail(): ?RiskScoreBlocklistType - { - return $this->fields['email'] ?? null; - } - - public function setEmail(null|RiskScoreBlocklistType|array $email): static - { - if ($email !== null && !($email instanceof RiskScoreBlocklistType)) { - $email = RiskScoreBlocklistType::from($email); - } - - $this->fields['email'] = $email; - - return $this; - } - - public function getEmailDomain(): ?RiskScoreBlocklistType - { - return $this->fields['email-domain'] ?? null; - } - - public function setEmailDomain(null|RiskScoreBlocklistType|array $emailDomain): static - { - if ($emailDomain !== null && !($emailDomain instanceof RiskScoreBlocklistType)) { - $emailDomain = RiskScoreBlocklistType::from($emailDomain); - } - - $this->fields['email-domain'] = $emailDomain; - - return $this; - } - - public function getFingerprint(): ?RiskScoreBlocklistType - { - return $this->fields['fingerprint'] ?? null; - } - - public function setFingerprint(null|RiskScoreBlocklistType|array $fingerprint): static - { - if ($fingerprint !== null && !($fingerprint instanceof RiskScoreBlocklistType)) { - $fingerprint = RiskScoreBlocklistType::from($fingerprint); - } - - $this->fields['fingerprint'] = $fingerprint; - - return $this; - } - - public function getIpAddress(): ?RiskScoreBlocklistType - { - return $this->fields['ip-address'] ?? null; - } - - public function setIpAddress(null|RiskScoreBlocklistType|array $ipAddress): static - { - if ($ipAddress !== null && !($ipAddress instanceof RiskScoreBlocklistType)) { - $ipAddress = RiskScoreBlocklistType::from($ipAddress); - } - - $this->fields['ip-address'] = $ipAddress; - - return $this; - } - - public function getPaymentCard(): ?RiskScoreBlocklistType - { - return $this->fields['payment-card'] ?? null; - } - - public function setPaymentCard(null|RiskScoreBlocklistType|array $paymentCard): static - { - if ($paymentCard !== null && !($paymentCard instanceof RiskScoreBlocklistType)) { - $paymentCard = RiskScoreBlocklistType::from($paymentCard); - } - - $this->fields['payment-card'] = $paymentCard; - - return $this; - } - public function getPermanentlyBlockList(): ?RiskScoreBlocklistPermanentRules { return $this->fields['permanentlyBlockList'] ?? null; @@ -260,36 +70,6 @@ public function setTemporaryBlockList(null|RiskScoreBlocklistTemporaryRules|arra public function jsonSerialize(): array { $data = []; - if (array_key_exists('address', $this->fields)) { - $data['address'] = $this->fields['address']?->jsonSerialize(); - } - if (array_key_exists('bank-account', $this->fields)) { - $data['bank-account'] = $this->fields['bank-account']?->jsonSerialize(); - } - if (array_key_exists('bin', $this->fields)) { - $data['bin'] = $this->fields['bin']?->jsonSerialize(); - } - if (array_key_exists('country', $this->fields)) { - $data['country'] = $this->fields['country']?->jsonSerialize(); - } - if (array_key_exists('customer-id', $this->fields)) { - $data['customer-id'] = $this->fields['customer-id']?->jsonSerialize(); - } - if (array_key_exists('email', $this->fields)) { - $data['email'] = $this->fields['email']?->jsonSerialize(); - } - if (array_key_exists('email-domain', $this->fields)) { - $data['email-domain'] = $this->fields['email-domain']?->jsonSerialize(); - } - if (array_key_exists('fingerprint', $this->fields)) { - $data['fingerprint'] = $this->fields['fingerprint']?->jsonSerialize(); - } - if (array_key_exists('ip-address', $this->fields)) { - $data['ip-address'] = $this->fields['ip-address']?->jsonSerialize(); - } - if (array_key_exists('payment-card', $this->fields)) { - $data['payment-card'] = $this->fields['payment-card']?->jsonSerialize(); - } if (array_key_exists('permanentlyBlockList', $this->fields)) { $data['permanentlyBlockList'] = $this->fields['permanentlyBlockList']?->jsonSerialize(); } diff --git a/src/Model/RiskScoreBlocklistType.php b/src/Model/RiskScoreBlocklistType.php deleted file mode 100644 index c1d6ed5f9..000000000 --- a/src/Model/RiskScoreBlocklistType.php +++ /dev/null @@ -1,74 +0,0 @@ -setRiskScoreThreshold($data['riskScoreThreshold']); - } - if (array_key_exists('ttl', $data)) { - $this->setTtl($data['ttl']); - } - } - - public static function from(array $data = []): self - { - return new self($data); - } - - public function getRiskScoreThreshold(): int - { - return $this->fields['riskScoreThreshold']; - } - - public function setRiskScoreThreshold(int $riskScoreThreshold): static - { - $this->fields['riskScoreThreshold'] = $riskScoreThreshold; - - return $this; - } - - public function getTtl(): int - { - return $this->fields['ttl']; - } - - public function setTtl(int $ttl): static - { - $this->fields['ttl'] = $ttl; - - return $this; - } - - public function jsonSerialize(): array - { - $data = []; - if (array_key_exists('riskScoreThreshold', $this->fields)) { - $data['riskScoreThreshold'] = $this->fields['riskScoreThreshold']; - } - if (array_key_exists('ttl', $this->fields)) { - $data['ttl'] = $this->fields['ttl']; - } - - return $data; - } -} diff --git a/src/Model/SubscriptionPlan.php b/src/Model/SubscriptionPlan.php index f895a163f..4d61d314c 100644 --- a/src/Model/SubscriptionPlan.php +++ b/src/Model/SubscriptionPlan.php @@ -93,9 +93,9 @@ public static function from(array $data = []): self return new self($data); } - public function getId(): ?string + public function getId(): string { - return $this->fields['id'] ?? null; + return $this->fields['id']; } public function getName(): string @@ -300,17 +300,6 @@ public function getInvoiceTimeShift(): ?InvoiceTimeShift return $this->fields['invoiceTimeShift'] ?? null; } - public function setInvoiceTimeShift(null|InvoiceTimeShift|array $invoiceTimeShift): static - { - if ($invoiceTimeShift !== null && !($invoiceTimeShift instanceof InvoiceTimeShift)) { - $invoiceTimeShift = InvoiceTimeShift::from($invoiceTimeShift); - } - - $this->fields['invoiceTimeShift'] = $invoiceTimeShift; - - return $this; - } - public function getCreatedTime(): ?DateTimeImmutable { return $this->fields['createdTime'] ?? null; @@ -404,7 +393,7 @@ public function jsonSerialize(): array return $data; } - private function setId(null|string $id): static + private function setId(string $id): static { $this->fields['id'] = $id; @@ -432,6 +421,17 @@ private function setIsTrialOnly(null|bool $isTrialOnly): static return $this; } + private function setInvoiceTimeShift(null|InvoiceTimeShift|array $invoiceTimeShift): static + { + if ($invoiceTimeShift !== null && !($invoiceTimeShift instanceof InvoiceTimeShift)) { + $invoiceTimeShift = InvoiceTimeShift::from($invoiceTimeShift); + } + + $this->fields['invoiceTimeShift'] = $invoiceTimeShift; + + return $this; + } + private function setCreatedTime(null|DateTimeImmutable|string $createdTime): static { if ($createdTime !== null && !($createdTime instanceof DateTimeImmutable)) { diff --git a/src/Model/TransactionDcc.php b/src/Model/TransactionDcc.php index 3d08b44d9..b5116aec9 100644 --- a/src/Model/TransactionDcc.php +++ b/src/Model/TransactionDcc.php @@ -18,12 +18,12 @@ class TransactionDcc implements JsonSerializable { + public const OUTCOME_UNPROCESSED = 'unprocessed'; + public const OUTCOME_REJECTED = 'rejected'; public const OUTCOME_SELECTED = 'selected'; - public const OUTCOME_UNKNOWN = 'unknown'; - private array $fields = []; public function __construct(array $data = []) diff --git a/src/Model/TrialOnlyPlan.php b/src/Model/TrialOnlyPlan.php index 36442a5f3..6e02b4b4f 100644 --- a/src/Model/TrialOnlyPlan.php +++ b/src/Model/TrialOnlyPlan.php @@ -84,9 +84,9 @@ public static function from(array $data = []): self return new self($data); } - public function getId(): ?string + public function getId(): string { - return $this->fields['id'] ?? null; + return $this->fields['id']; } public function getName(): string @@ -243,17 +243,6 @@ public function getInvoiceTimeShift(): ?InvoiceTimeShift return $this->fields['invoiceTimeShift'] ?? null; } - public function setInvoiceTimeShift(null|InvoiceTimeShift|array $invoiceTimeShift): static - { - if ($invoiceTimeShift !== null && !($invoiceTimeShift instanceof InvoiceTimeShift)) { - $invoiceTimeShift = InvoiceTimeShift::from($invoiceTimeShift); - } - - $this->fields['invoiceTimeShift'] = $invoiceTimeShift; - - return $this; - } - public function getCreatedTime(): ?DateTimeImmutable { return $this->fields['createdTime'] ?? null; @@ -338,7 +327,7 @@ public function jsonSerialize(): array return $data; } - private function setId(null|string $id): static + private function setId(string $id): static { $this->fields['id'] = $id; @@ -366,6 +355,17 @@ private function setIsTrialOnly(null|bool $isTrialOnly): static return $this; } + private function setInvoiceTimeShift(null|InvoiceTimeShift|array $invoiceTimeShift): static + { + if ($invoiceTimeShift !== null && !($invoiceTimeShift instanceof InvoiceTimeShift)) { + $invoiceTimeShift = InvoiceTimeShift::from($invoiceTimeShift); + } + + $this->fields['invoiceTimeShift'] = $invoiceTimeShift; + + return $this; + } + private function setCreatedTime(null|DateTimeImmutable|string $createdTime): static { if ($createdTime !== null && !($createdTime instanceof DateTimeImmutable)) { diff --git a/src/Service.php b/src/Service.php index e7d94b438..0f450ebb1 100644 --- a/src/Service.php +++ b/src/Service.php @@ -160,6 +160,8 @@ class Service private Api\PayoutRequestAllocationsApi $payoutRequestAllocations; + private Api\PayoutRequestBatchesApi $payoutRequestBatches; + private Api\ProfileApi $profile; private Api\PreviewsApi $previews; @@ -265,6 +267,7 @@ public function __construct(?Client $client = null, array $config = []) $this->payoutRequests = new Api\PayoutRequestsApi($this->client); $this->payoutRequestsV2 = new Api\PayoutRequestsV2Api($this->client); $this->payoutRequestAllocations = new Api\PayoutRequestAllocationsApi($this->client); + $this->payoutRequestBatches = new Api\PayoutRequestBatchesApi($this->client); $this->profile = new Api\ProfileApi($this->client); $this->previews = new Api\PreviewsApi($this->client); $this->roles = new Api\RolesApi($this->client); @@ -638,6 +641,11 @@ public function payoutRequestAllocations(): Api\PayoutRequestAllocationsApi return $this->payoutRequestAllocations; } + public function payoutRequestBatches(): Api\PayoutRequestBatchesApi + { + return $this->payoutRequestBatches; + } + public function profile(): Api\ProfileApi { return $this->profile;