Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/chilled-tips-sort.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

fix(be,api-definitions): Loosen Address validation rules Rebilly/rebilly#17436
5 changes: 5 additions & 0 deletions .changeset/eighty-foxes-repeat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

fix(backend): Permanently block above and Temporary block above use the independent pool of attributes (#16938) Rebilly/rebilly#17628
5 changes: 5 additions & 0 deletions .changeset/famous-seas-try.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

feat(be,api-definitions): Add GetPayoutRequestV2PaymentInstrument endpoint for new payout-request flow Rebilly/rebilly#17540
5 changes: 5 additions & 0 deletions .changeset/lovely-worms-destroy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

revert: fix(backend): Permanently block above and Temporary block above use the independent pool of attributes (#16938) Rebilly/rebilly#17594
5 changes: 5 additions & 0 deletions .changeset/many-onions-admire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

feat(api-defs): Add POST /payment-request-allocations Rebilly/rebilly#17567
5 changes: 5 additions & 0 deletions .changeset/perfect-yaks-try.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

chore(deps): bump @redocly/cli from 2.12.3 to 2.13.0 in /website/api-definitions Rebilly/rebilly#17461
5 changes: 5 additions & 0 deletions .changeset/poor-schools-relate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

chore(deps): bump es-toolkit from 1.42.0 to 1.43.0 in /website/api-definitions Rebilly/rebilly#17460
5 changes: 5 additions & 0 deletions .changeset/popular-stingrays-talk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

feat(api-definitions, be, payment-gateways): Implement Powertranz payment gateway adapter Rebilly/rebilly#17587
5 changes: 5 additions & 0 deletions .changeset/red-sloths-hope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

chore(api): Revert unintentional API changes Rebilly/rebilly#17423
5 changes: 5 additions & 0 deletions .changeset/selfish-adults-fry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

feat(api-definitions): Add payout request reversed and fulfilled to webhooks api definitions Rebilly/rebilly#17632
5 changes: 5 additions & 0 deletions .changeset/six-windows-joke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

feat(api-definitions): Payout processing MVP Rebilly/rebilly#17551
5 changes: 5 additions & 0 deletions .changeset/ten-suits-sleep.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

feat(api-defs): Add PATCH /payout-request-allocation/{id} Rebilly/rebilly#17591
5 changes: 5 additions & 0 deletions .changeset/unlucky-poems-knock.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

SDK Generator updated
5 changes: 5 additions & 0 deletions .changeset/wicked-news-dance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

feat(api-definition, be, payment-gateways): Add delay setting to Paybilt Rebilly/rebilly#17522
62 changes: 62 additions & 0 deletions src/Api/PayoutRequestAllocationsApi.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?php

/**
* This source file is proprietary and part of Rebilly.
*
* (c) Rebilly SRL
* Rebilly Ltd.
* Rebilly Inc.
*
* @see https://www.rebilly.com
*/

declare(strict_types=1);

namespace Rebilly\Sdk\Api;

use GuzzleHttp\ClientInterface;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Utils;
use Rebilly\Sdk\Model\PatchPayoutRequestAllocationRequest;
use Rebilly\Sdk\Model\PayoutRequestAllocation;
use Rebilly\Sdk\Model\PostPayoutRequestAllocationRequest;

class PayoutRequestAllocationsApi
{
public function __construct(protected ?ClientInterface $client)
{
}

public function create(
PostPayoutRequestAllocationRequest $postPayoutRequestAllocationRequest,
): PayoutRequestAllocation {
$uri = '/payout-request-allocations';

$request = new Request('POST', $uri, headers: [
'Accept' => 'application/json',
], body: Utils::jsonEncode($postPayoutRequestAllocationRequest));
$response = $this->client->send($request);
$data = Utils::jsonDecode((string) $response->getBody(), true);

return PayoutRequestAllocation::from($data);
}

public function update(
string $id,
PatchPayoutRequestAllocationRequest $patchPayoutRequestAllocationRequest,
): PayoutRequestAllocation {
$pathParams = [
'{id}' => $id,
];

$uri = str_replace(array_keys($pathParams), array_values($pathParams), '/payout-request-allocations/{id}');

$request = new Request('PATCH', $uri, headers: [
'Accept' => 'application/json',
], body: Utils::jsonEncode($patchPayoutRequestAllocationRequest));
$response = $this->client->send($request);
$data = Utils::jsonDecode((string) $response->getBody(), true);

return PayoutRequestAllocation::from($data);
}
}
139 changes: 139 additions & 0 deletions src/Api/PayoutRequestsApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@
use GuzzleHttp\Utils;
use Rebilly\Sdk\Collection;
use Rebilly\Sdk\Model\GetPayoutRequestPaymentInstrumentsResponse;
use Rebilly\Sdk\Model\PatchPayoutRequestRequest;
use Rebilly\Sdk\Model\PayoutRequest;
use Rebilly\Sdk\Model\PayoutRequestCancellation;
use Rebilly\Sdk\Model\PayoutRequestTimelineMessage;
use Rebilly\Sdk\Paginator;

class PayoutRequestsApi
Expand Down Expand Up @@ -62,6 +64,40 @@ public function create(
return PayoutRequest::from($data);
}

public function createTimelineComment(
string $id,
PayoutRequestTimelineMessage $payoutRequestTimelineMessage,
): PayoutRequestTimelineMessage {
$pathParams = [
'{id}' => $id,
];

$uri = str_replace(array_keys($pathParams), array_values($pathParams), '/payout-requests/{id}/timeline');

$request = new Request('POST', $uri, headers: [
'Accept' => 'application/json',
], body: Utils::jsonEncode($payoutRequestTimelineMessage));
$response = $this->client->send($request);
$data = Utils::jsonDecode((string) $response->getBody(), true);

return PayoutRequestTimelineMessage::from($data);
}

public function deleteTimelineMessage(
string $id,
string $messageId,
): void {
$pathParams = [
'{id}' => $id,
'{messageId}' => $messageId,
];

$uri = str_replace(array_keys($pathParams), array_values($pathParams), '/payout-requests/{id}/timeline/{messageId}');

$request = new Request('DELETE', $uri);
$this->client->send($request);
}

public function get(
string $id,
): PayoutRequest {
Expand Down Expand Up @@ -133,6 +169,70 @@ public function getAllPaginator(
);
}

/**
* @return Collection<PayoutRequestTimelineMessage>
*/
public function getAllTimelineMessages(
string $id,
?int $limit = null,
?int $offset = null,
?string $filter = null,
?array $sort = null,
?string $q = null,
): Collection {
$pathParams = [
'{id}' => $id,
];

$queryParams = [
'limit' => $limit,
'offset' => $offset,
'filter' => $filter,
'sort' => $sort ? implode(',', $sort) : null,
'q' => $q,
];
$uri = str_replace(array_keys($pathParams), array_values($pathParams), '/payout-requests/{id}/timeline?') . 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): PayoutRequestTimelineMessage => PayoutRequestTimelineMessage::from($item), $data),
(int) $response->getHeaderLine(Collection::HEADER_LIMIT),
(int) $response->getHeaderLine(Collection::HEADER_OFFSET),
(int) $response->getHeaderLine(Collection::HEADER_TOTAL),
);
}

/**
* @return Paginator<PayoutRequestTimelineMessage>
*/
public function getAllTimelineMessagesPaginator(
string $id,
?int $limit = null,
?int $offset = null,
?string $filter = null,
?array $sort = null,
?string $q = null,
): Paginator {
$closure = fn (?int $limit, ?int $offset): Collection => $this->getAllTimelineMessages(
id: $id,
limit: $limit,
offset: $offset,
filter: $filter,
sort: $sort,
q: $q,
);

return new Paginator(
$limit !== null || $offset !== null ? $closure(limit: $limit, offset: $offset) : null,
$closure,
);
}

/**
* @return GetPayoutRequestPaymentInstrumentsResponse[]
*/
Expand All @@ -154,6 +254,45 @@ public function getPaymentInstruments(
return array_map(fn (array $item): GetPayoutRequestPaymentInstrumentsResponse => GetPayoutRequestPaymentInstrumentsResponse::from($item), $data);
}

public function getTimelineMessage(
string $id,
string $messageId,
): PayoutRequestTimelineMessage {
$pathParams = [
'{id}' => $id,
'{messageId}' => $messageId,
];

$uri = str_replace(array_keys($pathParams), array_values($pathParams), '/payout-requests/{id}/timeline/{messageId}');

$request = new Request('GET', $uri, headers: [
'Accept' => 'application/json',
]);
$response = $this->client->send($request);
$data = Utils::jsonDecode((string) $response->getBody(), true);

return PayoutRequestTimelineMessage::from($data);
}

public function patch(
string $id,
PatchPayoutRequestRequest $patchPayoutRequestRequest,
): PayoutRequest {
$pathParams = [
'{id}' => $id,
];

$uri = str_replace(array_keys($pathParams), array_values($pathParams), '/payout-requests/{id}');

$request = new Request('PATCH', $uri, headers: [
'Accept' => 'application/json',
], body: Utils::jsonEncode($patchPayoutRequestRequest));
$response = $this->client->send($request);
$data = Utils::jsonDecode((string) $response->getBody(), true);

return PayoutRequest::from($data);
}

public function update(
string $id,
PayoutRequest $payoutRequest,
Expand Down
67 changes: 67 additions & 0 deletions src/Api/PayoutRequestsV2Api.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php

/**
* This source file is proprietary and part of Rebilly.
*
* (c) Rebilly SRL
* Rebilly Ltd.
* Rebilly Inc.
*
* @see https://www.rebilly.com
*/

declare(strict_types=1);

namespace Rebilly\Sdk\Api;

use GuzzleHttp\ClientInterface;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Utils;
use Rebilly\Sdk\Model\GetPayoutRequestV2PaymentInstrumentsResponse;
use Rebilly\Sdk\Model\PayoutRequestV2;

class PayoutRequestsV2Api
{
public function __construct(protected ?ClientInterface $client)
{
}

/**
* @return GetPayoutRequestV2PaymentInstrumentsResponse[]
*/
public function getPaymentInstrumentsV2(
string $id,
): array {
$pathParams = [
'{id}' => $id,
];

$uri = str_replace(array_keys($pathParams), array_values($pathParams), '/payout-requests-v2/{id}/payment-instruments');

$request = new Request('GET', $uri, headers: [
'Accept' => 'application/json',
]);
$response = $this->client->send($request);
$data = Utils::jsonDecode((string) $response->getBody(), true);

return array_map(fn (array $item): GetPayoutRequestV2PaymentInstrumentsResponse => GetPayoutRequestV2PaymentInstrumentsResponse::from($item), $data);
}

public function getV2(
string $id,
): PayoutRequestV2 {
$pathParams = [
'{id}' => $id,
];

$uri = str_replace(array_keys($pathParams), array_values($pathParams), '/payout-requests-v2/{id}');

$request = new Request('GET', $uri, headers: [
'Accept' => 'application/json',
]);
$response = $this->client->send($request);
$data = Utils::jsonDecode((string) $response->getBody(), true);

return PayoutRequestV2::from($data);
}
}
Loading