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 #652

Merged
merged 1 commit into from
Oct 31, 2023
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/forty-ties-think.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

Make Plan.id readOnly Rebilly/api-definitions#1651
5 changes: 5 additions & 0 deletions .changeset/great-waves-cheer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

Make cashier request fields nullable Rebilly/api-definitions#1654
5 changes: 5 additions & 0 deletions .changeset/hungry-goats-matter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

Add default values for cashier request Rebilly/api-definitions#1656
5 changes: 3 additions & 2 deletions src/Api/CashierRequestsApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use GuzzleHttp\Utils;
use Rebilly\Sdk\Collection;
use Rebilly\Sdk\Model\CashierRequest;
use Rebilly\Sdk\Model\PostCashierRequest;
use Rebilly\Sdk\Paginator;

class CashierRequestsApi
Expand All @@ -30,11 +31,11 @@ public function __construct(protected ?ClientInterface $client)
* @return CashierRequest
*/
public function create(
CashierRequest $cashierRequest,
PostCashierRequest $postCashierRequest,
): CashierRequest {
$uri = '/cashier-requests';

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

Expand Down
36 changes: 0 additions & 36 deletions src/Model/CashierRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ public function __construct(array $data = [])
if (array_key_exists('customerId', $data)) {
$this->setCustomerId($data['customerId']);
}
if (array_key_exists('strategyId', $data)) {
$this->setStrategyId($data['strategyId']);
}
if (array_key_exists('transactionId', $data)) {
$this->setTransactionId($data['transactionId']);
}
Expand All @@ -64,9 +61,6 @@ public function __construct(array $data = [])
if (array_key_exists('expirationTime', $data)) {
$this->setExpirationTime($data['expirationTime']);
}
if (array_key_exists('customPropertySetId', $data)) {
$this->setCustomPropertySetId($data['customPropertySetId']);
}
if (array_key_exists('propertiesSchema', $data)) {
$this->setPropertiesSchema($data['propertiesSchema']);
}
Expand Down Expand Up @@ -121,18 +115,6 @@ public function setCustomerId(string $customerId): static
return $this;
}

public function getStrategyId(): ?string
{
return $this->fields['strategyId'] ?? null;
}

public function setStrategyId(null|string $strategyId): static
{
$this->fields['strategyId'] = $strategyId;

return $this;
}

public function getTransactionId(): ?string
{
return $this->fields['transactionId'] ?? null;
Expand Down Expand Up @@ -222,18 +204,6 @@ public function setExpirationTime(null|DateTimeImmutable|string $expirationTime)
return $this;
}

public function getCustomPropertySetId(): ?string
{
return $this->fields['customPropertySetId'] ?? null;
}

public function setCustomPropertySetId(null|string $customPropertySetId): static
{
$this->fields['customPropertySetId'] = $customPropertySetId;

return $this;
}

public function getPropertiesSchema(): ?object
{
return $this->fields['propertiesSchema'] ?? null;
Expand Down Expand Up @@ -293,9 +263,6 @@ public function jsonSerialize(): array
if (array_key_exists('customerId', $this->fields)) {
$data['customerId'] = $this->fields['customerId'];
}
if (array_key_exists('strategyId', $this->fields)) {
$data['strategyId'] = $this->fields['strategyId'];
}
if (array_key_exists('transactionId', $this->fields)) {
$data['transactionId'] = $this->fields['transactionId'];
}
Expand All @@ -317,9 +284,6 @@ public function jsonSerialize(): array
if (array_key_exists('expirationTime', $this->fields)) {
$data['expirationTime'] = $this->fields['expirationTime']?->format(DateTimeInterface::RFC3339);
}
if (array_key_exists('customPropertySetId', $this->fields)) {
$data['customPropertySetId'] = $this->fields['customPropertySetId'];
}
if (array_key_exists('propertiesSchema', $this->fields)) {
$data['propertiesSchema'] = $this->fields['propertiesSchema'];
}
Expand Down
18 changes: 9 additions & 9 deletions src/Model/FlexiblePlan.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,14 +287,14 @@ public function setLinks(null|array $links): static
return $this;
}

public function getRecurringInterval(): ?SubscriptionOrderPlanRecurringInterval
public function getRecurringInterval(): SubscriptionOrderPlanRecurringInterval
{
return $this->fields['recurringInterval'] ?? null;
return $this->fields['recurringInterval'];
}

public function setRecurringInterval(null|SubscriptionOrderPlanRecurringInterval|array $recurringInterval): static
public function setRecurringInterval(SubscriptionOrderPlanRecurringInterval|array $recurringInterval): static
{
if ($recurringInterval !== null && !($recurringInterval instanceof SubscriptionOrderPlanRecurringInterval)) {
if (!($recurringInterval instanceof SubscriptionOrderPlanRecurringInterval)) {
$recurringInterval = SubscriptionOrderPlanRecurringInterval::from($recurringInterval);
}

Expand All @@ -303,15 +303,15 @@ public function setRecurringInterval(null|SubscriptionOrderPlanRecurringInterval
return $this;
}

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

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

$this->fields['trial'] = $trial;
Expand Down
18 changes: 9 additions & 9 deletions src/Model/OrderItemPlan.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,14 +287,14 @@ public function setLinks(null|array $links): static
return $this;
}

public function getRecurringInterval(): ?SubscriptionOrderPlanRecurringInterval
public function getRecurringInterval(): SubscriptionOrderPlanRecurringInterval
{
return $this->fields['recurringInterval'] ?? null;
return $this->fields['recurringInterval'];
}

public function setRecurringInterval(null|SubscriptionOrderPlanRecurringInterval|array $recurringInterval): static
public function setRecurringInterval(SubscriptionOrderPlanRecurringInterval|array $recurringInterval): static
{
if ($recurringInterval !== null && !($recurringInterval instanceof SubscriptionOrderPlanRecurringInterval)) {
if (!($recurringInterval instanceof SubscriptionOrderPlanRecurringInterval)) {
$recurringInterval = SubscriptionOrderPlanRecurringInterval::from($recurringInterval);
}

Expand All @@ -303,15 +303,15 @@ public function setRecurringInterval(null|SubscriptionOrderPlanRecurringInterval
return $this;
}

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

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

$this->fields['trial'] = $trial;
Expand Down
32 changes: 16 additions & 16 deletions src/Model/Plan.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,6 @@ public function getId(): ?string
return $this->fields['id'] ?? null;
}

public function setId(null|string $id): static
{
$this->fields['id'] = $id;

return $this;
}

public function getName(): string
{
return $this->fields['name'];
Expand Down Expand Up @@ -287,14 +280,14 @@ public function setLinks(null|array $links): static
return $this;
}

public function getRecurringInterval(): ?SubscriptionOrderPlanRecurringInterval
public function getRecurringInterval(): SubscriptionOrderPlanRecurringInterval
{
return $this->fields['recurringInterval'] ?? null;
return $this->fields['recurringInterval'];
}

public function setRecurringInterval(null|SubscriptionOrderPlanRecurringInterval|array $recurringInterval): static
public function setRecurringInterval(SubscriptionOrderPlanRecurringInterval|array $recurringInterval): static
{
if ($recurringInterval !== null && !($recurringInterval instanceof SubscriptionOrderPlanRecurringInterval)) {
if (!($recurringInterval instanceof SubscriptionOrderPlanRecurringInterval)) {
$recurringInterval = SubscriptionOrderPlanRecurringInterval::from($recurringInterval);
}

Expand All @@ -303,15 +296,15 @@ public function setRecurringInterval(null|SubscriptionOrderPlanRecurringInterval
return $this;
}

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

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

$this->fields['trial'] = $trial;
Expand Down Expand Up @@ -421,6 +414,13 @@ public function jsonSerialize(): array
return $data;
}

private function setId(null|string $id): static
{
$this->fields['id'] = $id;

return $this;
}

private function setCurrencySign(null|string $currencySign): static
{
$this->fields['currencySign'] = $currencySign;
Expand Down
Loading