-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
64b4ba5
commit 6651fa1
Showing
9 changed files
with
268 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,220 @@ | ||
<?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 DateTimeImmutable; | ||
use DateTimeInterface; | ||
use JsonSerializable; | ||
|
||
class CashierRequest2 implements JsonSerializable | ||
{ | ||
private array $fields = []; | ||
|
||
public function __construct(array $data = []) | ||
{ | ||
if (array_key_exists('websiteId', $data)) { | ||
$this->setWebsiteId($data['websiteId']); | ||
} | ||
if (array_key_exists('customerId', $data)) { | ||
$this->setCustomerId($data['customerId']); | ||
} | ||
if (array_key_exists('strategyId', $data)) { | ||
$this->setStrategyId($data['strategyId']); | ||
} | ||
if (array_key_exists('currency', $data)) { | ||
$this->setCurrency($data['currency']); | ||
} | ||
if (array_key_exists('amounts', $data)) { | ||
$this->setAmounts($data['amounts']); | ||
} | ||
if (array_key_exists('customAmount', $data)) { | ||
$this->setCustomAmount($data['customAmount']); | ||
} | ||
if (array_key_exists('redirectUrl', $data)) { | ||
$this->setRedirectUrl($data['redirectUrl']); | ||
} | ||
if (array_key_exists('expirationTime', $data)) { | ||
$this->setExpirationTime($data['expirationTime']); | ||
} | ||
if (array_key_exists('customPropertySetId', $data)) { | ||
$this->setCustomPropertySetId($data['customPropertySetId']); | ||
} | ||
} | ||
|
||
public static function from(array $data = []): self | ||
{ | ||
return new self($data); | ||
} | ||
|
||
public function getWebsiteId(): string | ||
{ | ||
return $this->fields['websiteId']; | ||
} | ||
|
||
public function setWebsiteId(string $websiteId): static | ||
{ | ||
$this->fields['websiteId'] = $websiteId; | ||
|
||
return $this; | ||
} | ||
|
||
public function getCustomerId(): string | ||
{ | ||
return $this->fields['customerId']; | ||
} | ||
|
||
public function setCustomerId(string $customerId): static | ||
{ | ||
$this->fields['customerId'] = $customerId; | ||
|
||
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 getCurrency(): string | ||
{ | ||
return $this->fields['currency']; | ||
} | ||
|
||
public function setCurrency(string $currency): static | ||
{ | ||
$this->fields['currency'] = $currency; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* @return null|float[] | ||
*/ | ||
public function getAmounts(): ?array | ||
{ | ||
return $this->fields['amounts'] ?? null; | ||
} | ||
|
||
/** | ||
* @param null|float[] $amounts | ||
*/ | ||
public function setAmounts(null|array $amounts): static | ||
{ | ||
$amounts = $amounts !== null ? array_map( | ||
fn ($value) => $value, | ||
$amounts, | ||
) : null; | ||
|
||
$this->fields['amounts'] = $amounts; | ||
|
||
return $this; | ||
} | ||
|
||
public function getCustomAmount(): ?CashierRequestCustomAmount | ||
{ | ||
return $this->fields['customAmount'] ?? null; | ||
} | ||
|
||
public function setCustomAmount(null|CashierRequestCustomAmount|array $customAmount): static | ||
{ | ||
if ($customAmount !== null && !($customAmount instanceof CashierRequestCustomAmount)) { | ||
$customAmount = CashierRequestCustomAmount::from($customAmount); | ||
} | ||
|
||
$this->fields['customAmount'] = $customAmount; | ||
|
||
return $this; | ||
} | ||
|
||
public function getRedirectUrl(): ?string | ||
{ | ||
return $this->fields['redirectUrl'] ?? null; | ||
} | ||
|
||
public function setRedirectUrl(null|string $redirectUrl): static | ||
{ | ||
$this->fields['redirectUrl'] = $redirectUrl; | ||
|
||
return $this; | ||
} | ||
|
||
public function getExpirationTime(): ?DateTimeImmutable | ||
{ | ||
return $this->fields['expirationTime'] ?? null; | ||
} | ||
|
||
public function setExpirationTime(null|DateTimeImmutable|string $expirationTime): static | ||
{ | ||
if ($expirationTime !== null && !($expirationTime instanceof DateTimeImmutable)) { | ||
$expirationTime = new DateTimeImmutable($expirationTime); | ||
} | ||
|
||
$this->fields['expirationTime'] = $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 jsonSerialize(): array | ||
{ | ||
$data = []; | ||
if (array_key_exists('websiteId', $this->fields)) { | ||
$data['websiteId'] = $this->fields['websiteId']; | ||
} | ||
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('currency', $this->fields)) { | ||
$data['currency'] = $this->fields['currency']; | ||
} | ||
if (array_key_exists('amounts', $this->fields)) { | ||
$data['amounts'] = $this->fields['amounts']; | ||
} | ||
if (array_key_exists('customAmount', $this->fields)) { | ||
$data['customAmount'] = $this->fields['customAmount']?->jsonSerialize(); | ||
} | ||
if (array_key_exists('redirectUrl', $this->fields)) { | ||
$data['redirectUrl'] = $this->fields['redirectUrl']; | ||
} | ||
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']; | ||
} | ||
|
||
return $data; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.