Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update SDK from api-definitions #677

Merged
merged 1 commit into from
Mar 27, 2024
Merged
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/brave-needles-drive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

Fix GatewayAccount PUT SDK operation name Rebilly/api-definitions#1845
5 changes: 5 additions & 0 deletions .changeset/brave-pandas-protect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

Add subscription billingPortalToken Rebilly/api-definitions#1834
5 changes: 5 additions & 0 deletions .changeset/breezy-rats-sniff.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

Add paypal-claim dispute type Rebilly/api-definitions#1825
5 changes: 5 additions & 0 deletions .changeset/cold-cows-build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

Add interimOnly for ChangeQuote Rebilly/api-definitions#1819
5 changes: 5 additions & 0 deletions .changeset/curvy-ligers-serve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

Bump @redocly/cli from 1.10.5 to 1.10.6 Rebilly/api-definitions#1847
5 changes: 5 additions & 0 deletions .changeset/dirty-jeans-judge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

Add StorefrontPostSubscriptionReactivation Rebilly/api-definitions#1830
5 changes: 5 additions & 0 deletions .changeset/friendly-gifts-sin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

Make WebhookCredential type readonly Rebilly/api-definitions#1832
5 changes: 5 additions & 0 deletions .changeset/happy-bananas-mix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

Add KYC links to Storefront transaction Rebilly/api-definitions#1850
5 changes: 5 additions & 0 deletions .changeset/khaki-news-do.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

Adjust SubscriptionChange items-quantity Rebilly/api-definitions#1829
5 changes: 5 additions & 0 deletions .changeset/odd-singers-eat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

Flatten plan related schemas Rebilly/api-definitions#1838
5 changes: 5 additions & 0 deletions .changeset/popular-trains-think.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

Simplify service credential Rebilly/api-definitions#1831
5 changes: 5 additions & 0 deletions .changeset/purple-plums-lick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

Add method to payout request allocation Rebilly/api-definitions#1833
5 changes: 5 additions & 0 deletions .changeset/quiet-carpets-try.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

add parameters to GetEventCollection Rebilly/api-definitions#1835
5 changes: 5 additions & 0 deletions .changeset/rich-badgers-pay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

Add query collection parameter to GetEventCollection Rebilly/api-definitions#1837
5 changes: 5 additions & 0 deletions .changeset/rotten-feet-hear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

bump deps and remove extra deps Rebilly/api-definitions#1842
5 changes: 5 additions & 0 deletions .changeset/ten-avocados-pull.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

Rename Subscription endTime to churnTime Rebilly/api-definitions#1836
5 changes: 5 additions & 0 deletions .changeset/tidy-poets-watch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

feat: Allow clearing sticky gateway from payment instrument by sending value Rebilly/api-definitions#1786
44 changes: 39 additions & 5 deletions src/Api/EventsApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,17 +141,51 @@ public function get(
}

/**
* @return SystemEvent[]
* @return Collection<SystemEvent>
*/
public function getAll(): array
{
$uri = '/events';
public function getAll(
?int $limit = null,
?int $offset = null,
?string $filter = null,
?string $q = null,
): Collection {
$queryParams = [
'limit' => $limit,
'offset' => $offset,
'filter' => $filter,
'q' => $q,
];
$uri = '/events?' . http_build_query($queryParams);

$request = new Request('GET', $uri);
$response = $this->client->send($request);
$data = Utils::jsonDecode((string) $response->getBody(), true);

return array_map(fn (array $item): SystemEvent => SystemEvent::from($item), $data);
return new Collection(
array_map(fn (array $item): SystemEvent => SystemEvent::from($item), $data),
(int) $response->getHeaderLine(Collection::HEADER_LIMIT),
(int) $response->getHeaderLine(Collection::HEADER_OFFSET),
(int) $response->getHeaderLine(Collection::HEADER_TOTAL),
);
}

public function getAllPaginator(
?int $limit = null,
?int $offset = null,
?string $filter = null,
?string $q = null,
): Paginator {
$closure = fn (?int $limit, ?int $offset): Collection => $this->getAll(
limit: $limit,
offset: $offset,
filter: $filter,
q: $q,
);

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

/**
Expand Down
6 changes: 3 additions & 3 deletions src/Api/GatewayAccountsApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ public function update(

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

$request = new Request('PUT', $uri, body: Utils::jsonEncode($gatewayAccount));
$request = new Request('PATCH', $uri, body: Utils::jsonEncode($gatewayAccount));
$response = $this->client->send($request);
$data = Utils::jsonDecode((string) $response->getBody(), true);

Expand Down Expand Up @@ -590,7 +590,7 @@ public function updateVolumeLimit(
/**
* @return GatewayAccount
*/
public function update_0(
public function upsert(
string $id,
GatewayAccount $gatewayAccount,
): GatewayAccount {
Expand All @@ -600,7 +600,7 @@ public function update_0(

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

$request = new Request('PATCH', $uri, body: Utils::jsonEncode($gatewayAccount));
$request = new Request('PUT', $uri, body: Utils::jsonEncode($gatewayAccount));
$response = $this->client->send($request);
$data = Utils::jsonDecode((string) $response->getBody(), true);

Expand Down
5 changes: 2 additions & 3 deletions src/Api/ServiceCredentialsApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
use Rebilly\Sdk\Collection;
use Rebilly\Sdk\Model\GoogleSpreadsheet;
use Rebilly\Sdk\Model\PatchServiceCredentialRequest;
use Rebilly\Sdk\Model\PostServiceCredentialRequest;
use Rebilly\Sdk\Model\ServiceCredential;
use Rebilly\Sdk\Model\ServiceCredentialFactory;
use Rebilly\Sdk\Paginator;
Expand All @@ -35,15 +34,15 @@ public function __construct(protected ?ClientInterface $client)
*/
public function create(
string $type,
PostServiceCredentialRequest $postServiceCredentialRequest,
ServiceCredential $serviceCredential,
): ServiceCredential {
$pathParams = [
'{type}' => $type,
];

$uri = str_replace(array_keys($pathParams), array_values($pathParams), '/service-credentials/{type}');

$request = new Request('POST', $uri, body: Utils::jsonEncode($postServiceCredentialRequest));
$request = new Request('POST', $uri, body: Utils::jsonEncode($serviceCredential));
$response = $this->client->send($request);
$data = Utils::jsonDecode((string) $response->getBody(), true);

Expand Down
2 changes: 2 additions & 0 deletions src/Model/Dispute.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ class Dispute implements JsonSerializable

public const TYPE_BANK_RETURN = 'bank-return';

public const TYPE_PAYPAL_CLAIM = 'paypal-claim';

public const STATUS_RESPONSE_NEEDED = 'response-needed';

public const STATUS_UNDER_REVIEW = 'under-review';
Expand Down
16 changes: 8 additions & 8 deletions src/Model/FlexiblePlan.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,15 +204,15 @@ public function setPricing(PlanPriceFormula|array $pricing): static
return $this;
}

public function getSetup(): ?OneTimeSalePlanSetup
public function getSetup(): ?PlanSetup
{
return $this->fields['setup'] ?? null;
}

public function setSetup(null|OneTimeSalePlanSetup|array $setup): static
public function setSetup(null|PlanSetup|array $setup): static
{
if ($setup !== null && !($setup instanceof OneTimeSalePlanSetup)) {
$setup = OneTimeSalePlanSetup::from($setup);
if ($setup !== null && !($setup instanceof PlanSetup)) {
$setup = PlanSetup::from($setup);
}

$this->fields['setup'] = $setup;
Expand Down Expand Up @@ -288,15 +288,15 @@ public function setRecurringInterval(SubscriptionPlanRecurringInterval|array $re
return $this;
}

public function getTrial(): TrialOnlyPlanTrial
public function getTrial(): PlanTrial
{
return $this->fields['trial'];
}

public function setTrial(TrialOnlyPlanTrial|array $trial): static
public function setTrial(PlanTrial|array $trial): static
{
if (!($trial instanceof TrialOnlyPlanTrial)) {
$trial = TrialOnlyPlanTrial::from($trial);
if (!($trial instanceof PlanTrial)) {
$trial = PlanTrial::from($trial);
}

$this->fields['trial'] = $trial;
Expand Down
Loading
Loading