Skip to content

Commit

Permalink
chore: update SDK from api-definitions (#678)
Browse files Browse the repository at this point in the history
Co-authored-by: rebilly-machine-user <[email protected]>
  • Loading branch information
rebilly-machine-user and rebilly-machine-user authored Mar 27, 2024
1 parent fe3d930 commit d876527
Show file tree
Hide file tree
Showing 6 changed files with 216 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/late-ducks-exercise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

Add usage settings for ChangeQuote Rebilly/api-definitions#1840
29 changes: 29 additions & 0 deletions src/Model/QuoteChangeOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ public function __construct(array $data = [])
if (array_key_exists('interimOnly', $data)) {
$this->setInterimOnly($data['interimOnly']);
}
if (array_key_exists('usageSettings', $data)) {
$this->setUsageSettings($data['usageSettings']);
}
if (array_key_exists('invoicePreview', $data)) {
$this->setInvoicePreview($data['invoicePreview']);
}
Expand Down Expand Up @@ -330,6 +333,29 @@ public function setInterimOnly(null|bool $interimOnly): static
return $this;
}

/**
* @return null|QuoteChangeOrderUsageSettings[]
*/
public function getUsageSettings(): ?array
{
return $this->fields['usageSettings'] ?? null;
}

/**
* @param null|array[]|QuoteChangeOrderUsageSettings[] $usageSettings
*/
public function setUsageSettings(null|array $usageSettings): static
{
$usageSettings = $usageSettings !== null ? array_map(
fn ($value) => $value instanceof QuoteChangeOrderUsageSettings ? $value : QuoteChangeOrderUsageSettings::from($value),
$usageSettings,
) : null;

$this->fields['usageSettings'] = $usageSettings;

return $this;
}

public function getInvoicePreview(): ?QuoteCreateOrderInvoicePreview
{
return $this->fields['invoicePreview'] ?? null;
Expand Down Expand Up @@ -618,6 +644,9 @@ public function jsonSerialize(): array
if (array_key_exists('interimOnly', $this->fields)) {
$data['interimOnly'] = $this->fields['interimOnly'];
}
if (array_key_exists('usageSettings', $this->fields)) {
$data['usageSettings'] = $this->fields['usageSettings'];
}
if (array_key_exists('invoicePreview', $this->fields)) {
$data['invoicePreview'] = $this->fields['invoicePreview']?->jsonSerialize();
}
Expand Down
95 changes: 95 additions & 0 deletions src/Model/QuoteChangeOrderUsageSettings.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<?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\Model;

use JsonSerializable;

class QuoteChangeOrderUsageSettings implements JsonSerializable
{
public const POLICY_RESET = 'reset';

public const POLICY_TRANSFER = 'transfer';

private array $fields = [];

public function __construct(array $data = [])
{
if (array_key_exists('planId', $data)) {
$this->setPlanId($data['planId']);
}
if (array_key_exists('policy', $data)) {
$this->setPolicy($data['policy']);
}
if (array_key_exists('transferTo', $data)) {
$this->setTransferTo($data['transferTo']);
}
}

public static function from(array $data = []): self
{
return new self($data);
}

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

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

return $this;
}

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

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

return $this;
}

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

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

return $this;
}

public function jsonSerialize(): array
{
$data = [];
if (array_key_exists('planId', $this->fields)) {
$data['planId'] = $this->fields['planId'];
}
if (array_key_exists('policy', $this->fields)) {
$data['policy'] = $this->fields['policy'];
}
if (array_key_exists('transferTo', $this->fields)) {
$data['transferTo'] = $this->fields['transferTo'];
}

return $data;
}
}
29 changes: 29 additions & 0 deletions src/Model/QuoteCreateOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ public function __construct(array $data = [])
if (array_key_exists('prorated', $data)) {
$this->setProrated($data['prorated']);
}
if (array_key_exists('usageSettings', $data)) {
$this->setUsageSettings($data['usageSettings']);
}
if (array_key_exists('paymentInstrumentId', $data)) {
$this->setPaymentInstrumentId($data['paymentInstrumentId']);
}
Expand Down Expand Up @@ -537,6 +540,29 @@ public function setProrated(null|bool $prorated): static
return $this;
}

/**
* @return null|QuoteChangeOrderUsageSettings[]
*/
public function getUsageSettings(): ?array
{
return $this->fields['usageSettings'] ?? null;
}

/**
* @param null|array[]|QuoteChangeOrderUsageSettings[] $usageSettings
*/
public function setUsageSettings(null|array $usageSettings): static
{
$usageSettings = $usageSettings !== null ? array_map(
fn ($value) => $value instanceof QuoteChangeOrderUsageSettings ? $value : QuoteChangeOrderUsageSettings::from($value),
$usageSettings,
) : null;

$this->fields['usageSettings'] = $usageSettings;

return $this;
}

public function getPaymentInstrumentId(): ?string
{
return $this->fields['paymentInstrumentId'] ?? null;
Expand Down Expand Up @@ -662,6 +688,9 @@ public function jsonSerialize(): array
if (array_key_exists('prorated', $this->fields)) {
$data['prorated'] = $this->fields['prorated'];
}
if (array_key_exists('usageSettings', $this->fields)) {
$data['usageSettings'] = $this->fields['usageSettings'];
}
if (array_key_exists('paymentInstrumentId', $this->fields)) {
$data['paymentInstrumentId'] = $this->fields['paymentInstrumentId'];
}
Expand Down
29 changes: 29 additions & 0 deletions src/Model/QuoteReactivateOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ public function __construct(array $data = [])
if (array_key_exists('prorated', $data)) {
$this->setProrated($data['prorated']);
}
if (array_key_exists('usageSettings', $data)) {
$this->setUsageSettings($data['usageSettings']);
}
if (array_key_exists('keepTrial', $data)) {
$this->setKeepTrial($data['keepTrial']);
}
Expand Down Expand Up @@ -540,6 +543,29 @@ public function setProrated(null|bool $prorated): static
return $this;
}

/**
* @return null|QuoteChangeOrderUsageSettings[]
*/
public function getUsageSettings(): ?array
{
return $this->fields['usageSettings'] ?? null;
}

/**
* @param null|array[]|QuoteChangeOrderUsageSettings[] $usageSettings
*/
public function setUsageSettings(null|array $usageSettings): static
{
$usageSettings = $usageSettings !== null ? array_map(
fn ($value) => $value instanceof QuoteChangeOrderUsageSettings ? $value : QuoteChangeOrderUsageSettings::from($value),
$usageSettings,
) : null;

$this->fields['usageSettings'] = $usageSettings;

return $this;
}

public function getKeepTrial(): ?bool
{
return $this->fields['keepTrial'] ?? null;
Expand Down Expand Up @@ -669,6 +695,9 @@ public function jsonSerialize(): array
if (array_key_exists('prorated', $this->fields)) {
$data['prorated'] = $this->fields['prorated'];
}
if (array_key_exists('usageSettings', $this->fields)) {
$data['usageSettings'] = $this->fields['usageSettings'];
}
if (array_key_exists('keepTrial', $this->fields)) {
$data['keepTrial'] = $this->fields['keepTrial'];
}
Expand Down
29 changes: 29 additions & 0 deletions src/Model/QuoteTrialConversionOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ public function __construct(array $data = [])
if (array_key_exists('prorated', $data)) {
$this->setProrated($data['prorated']);
}
if (array_key_exists('usageSettings', $data)) {
$this->setUsageSettings($data['usageSettings']);
}
if (array_key_exists('paymentInstrumentId', $data)) {
$this->setPaymentInstrumentId($data['paymentInstrumentId']);
}
Expand Down Expand Up @@ -528,6 +531,29 @@ public function setProrated(null|bool $prorated): static
return $this;
}

/**
* @return null|QuoteChangeOrderUsageSettings[]
*/
public function getUsageSettings(): ?array
{
return $this->fields['usageSettings'] ?? null;
}

/**
* @param null|array[]|QuoteChangeOrderUsageSettings[] $usageSettings
*/
public function setUsageSettings(null|array $usageSettings): static
{
$usageSettings = $usageSettings !== null ? array_map(
fn ($value) => $value instanceof QuoteChangeOrderUsageSettings ? $value : QuoteChangeOrderUsageSettings::from($value),
$usageSettings,
) : null;

$this->fields['usageSettings'] = $usageSettings;

return $this;
}

public function getPaymentInstrumentId(): ?string
{
return $this->fields['paymentInstrumentId'] ?? null;
Expand Down Expand Up @@ -666,6 +692,9 @@ public function jsonSerialize(): array
if (array_key_exists('prorated', $this->fields)) {
$data['prorated'] = $this->fields['prorated'];
}
if (array_key_exists('usageSettings', $this->fields)) {
$data['usageSettings'] = $this->fields['usageSettings'];
}
if (array_key_exists('paymentInstrumentId', $this->fields)) {
$data['paymentInstrumentId'] = $this->fields['paymentInstrumentId'];
}
Expand Down

0 comments on commit d876527

Please sign in to comment.