Skip to content

Commit

Permalink
chore: update SDK from api-definitions (#657)
Browse files Browse the repository at this point in the history
Co-authored-by: rebilly-machine-user <[email protected]>
Co-authored-by: Arif Kurkchi <[email protected]>
  • Loading branch information
3 people authored Nov 5, 2023
1 parent 4c63a66 commit bbe2bc6
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/gorgeous-bobcats-roll.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

Add amount limits to deposit request Rebilly/api-definitions#1666
22 changes: 22 additions & 0 deletions src/Model/PostDepositRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ public function __construct(array $data = [])
if (array_key_exists('amounts', $data)) {
$this->setAmounts($data['amounts']);
}
if (array_key_exists('amountLimits', $data)) {
$this->setAmountLimits($data['amountLimits']);
}
if (array_key_exists('customAmount', $data)) {
$this->setCustomAmount($data['customAmount']);
}
Expand Down Expand Up @@ -128,6 +131,22 @@ public function setAmounts(null|array $amounts): static
return $this;
}

public function getAmountLimits(): ?PostDepositRequestAmountLimits
{
return $this->fields['amountLimits'] ?? null;
}

public function setAmountLimits(null|PostDepositRequestAmountLimits|array $amountLimits): static
{
if ($amountLimits !== null && !($amountLimits instanceof PostDepositRequestAmountLimits)) {
$amountLimits = PostDepositRequestAmountLimits::from($amountLimits);
}

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

return $this;
}

public function getCustomAmount(): ?DepositRequestCustomAmount
{
return $this->fields['customAmount'] ?? null;
Expand Down Expand Up @@ -202,6 +221,9 @@ public function jsonSerialize(): array
if (array_key_exists('amounts', $this->fields)) {
$data['amounts'] = $this->fields['amounts'];
}
if (array_key_exists('amountLimits', $this->fields)) {
$data['amountLimits'] = $this->fields['amountLimits']?->jsonSerialize();
}
if (array_key_exists('customAmount', $this->fields)) {
$data['customAmount'] = $this->fields['customAmount']?->jsonSerialize();
}
Expand Down
81 changes: 81 additions & 0 deletions src/Model/PostDepositRequestAmountLimits.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?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 PostDepositRequestAmountLimits implements JsonSerializable
{
private array $fields = [];

public function __construct(array $data = [])
{
if (array_key_exists('minimum', $data)) {
$this->setMinimum($data['minimum']);
}
if (array_key_exists('maximum', $data)) {
$this->setMaximum($data['maximum']);
}
}

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

public function getMinimum(): ?float
{
return $this->fields['minimum'] ?? null;
}

public function setMinimum(null|float|string $minimum): static
{
if (is_string($minimum)) {
$minimum = (float) $minimum;
}

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

return $this;
}

public function getMaximum(): ?float
{
return $this->fields['maximum'] ?? null;
}

public function setMaximum(null|float|string $maximum): static
{
if (is_string($maximum)) {
$maximum = (float) $maximum;
}

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

return $this;
}

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

return $data;
}
}

0 comments on commit bbe2bc6

Please sign in to comment.