Skip to content

Commit 0261c83

Browse files
update SDK from api-definitions
1 parent 5779ce3 commit 0261c83

6 files changed

Lines changed: 380 additions & 0 deletions

File tree

.changeset/fluffy-insects-warn.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@rebilly/client-php": patch
3+
---
4+
5+
fix(be,api-definitions,recomm): Add missing Discover dispute reason codes Rebilly/rebilly#18032
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@rebilly/client-php": patch
3+
---
4+
5+
feat(be, api-definitions): preview orders enhancements Rebilly/rebilly#17844

src/Model/OrderPreview.php

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ public function __construct(array $data = [])
6767
if (array_key_exists('total', $data)) {
6868
$this->setTotal($data['total']);
6969
}
70+
if (array_key_exists('initialAmounts', $data)) {
71+
$this->setInitialAmounts($data['initialAmounts']);
72+
}
73+
if (array_key_exists('recurringAmounts', $data)) {
74+
$this->setRecurringAmounts($data['recurringAmounts']);
75+
}
7076
if (array_key_exists('shipping', $data)) {
7177
$this->setShipping($data['shipping']);
7278
}
@@ -224,6 +230,38 @@ public function getTotal(): ?float
224230
return $this->fields['total'] ?? null;
225231
}
226232

233+
public function getInitialAmounts(): ?OrderPreviewInitialAmounts
234+
{
235+
return $this->fields['initialAmounts'] ?? null;
236+
}
237+
238+
public function setInitialAmounts(null|OrderPreviewInitialAmounts|array $initialAmounts): static
239+
{
240+
if ($initialAmounts !== null && !($initialAmounts instanceof OrderPreviewInitialAmounts)) {
241+
$initialAmounts = OrderPreviewInitialAmounts::from($initialAmounts);
242+
}
243+
244+
$this->fields['initialAmounts'] = $initialAmounts;
245+
246+
return $this;
247+
}
248+
249+
public function getRecurringAmounts(): ?OrderPreviewRecurringAmounts
250+
{
251+
return $this->fields['recurringAmounts'] ?? null;
252+
}
253+
254+
public function setRecurringAmounts(null|OrderPreviewRecurringAmounts|array $recurringAmounts): static
255+
{
256+
if ($recurringAmounts !== null && !($recurringAmounts instanceof OrderPreviewRecurringAmounts)) {
257+
$recurringAmounts = OrderPreviewRecurringAmounts::from($recurringAmounts);
258+
}
259+
260+
$this->fields['recurringAmounts'] = $recurringAmounts;
261+
262+
return $this;
263+
}
264+
227265
public function getShipping(): ?Shipping
228266
{
229267
return $this->fields['shipping'] ?? null;
@@ -311,6 +349,12 @@ public function jsonSerialize(): array
311349
if (array_key_exists('total', $this->fields)) {
312350
$data['total'] = $this->fields['total'];
313351
}
352+
if (array_key_exists('initialAmounts', $this->fields)) {
353+
$data['initialAmounts'] = $this->fields['initialAmounts']?->jsonSerialize();
354+
}
355+
if (array_key_exists('recurringAmounts', $this->fields)) {
356+
$data['recurringAmounts'] = $this->fields['recurringAmounts']?->jsonSerialize();
357+
}
314358
if (array_key_exists('shipping', $this->fields)) {
315359
$data['shipping'] = $this->fields['shipping']?->jsonSerialize();
316360
}
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
<?php
2+
3+
/**
4+
* This source file is proprietary and part of Rebilly.
5+
*
6+
* (c) Rebilly SRL
7+
* Rebilly Ltd.
8+
* Rebilly Inc.
9+
*
10+
* @see https://www.rebilly.com
11+
*/
12+
13+
declare(strict_types=1);
14+
15+
namespace Rebilly\Sdk\Model;
16+
17+
use JsonSerializable;
18+
19+
class OrderPreviewInitialAmounts implements JsonSerializable
20+
{
21+
private array $fields = [];
22+
23+
public function __construct(array $data = [])
24+
{
25+
if (array_key_exists('amount', $data)) {
26+
$this->setAmount($data['amount']);
27+
}
28+
if (array_key_exists('subtotalAmount', $data)) {
29+
$this->setSubtotalAmount($data['subtotalAmount']);
30+
}
31+
if (array_key_exists('discountAmount', $data)) {
32+
$this->setDiscountAmount($data['discountAmount']);
33+
}
34+
if (array_key_exists('shippingAmount', $data)) {
35+
$this->setShippingAmount($data['shippingAmount']);
36+
}
37+
if (array_key_exists('taxAmount', $data)) {
38+
$this->setTaxAmount($data['taxAmount']);
39+
}
40+
}
41+
42+
public static function from(array $data = []): self
43+
{
44+
return new self($data);
45+
}
46+
47+
public function getAmount(): ?float
48+
{
49+
return $this->fields['amount'] ?? null;
50+
}
51+
52+
public function setAmount(null|float|string $amount): static
53+
{
54+
if (is_string($amount)) {
55+
$amount = (float) $amount;
56+
}
57+
58+
$this->fields['amount'] = $amount;
59+
60+
return $this;
61+
}
62+
63+
public function getSubtotalAmount(): ?float
64+
{
65+
return $this->fields['subtotalAmount'] ?? null;
66+
}
67+
68+
public function setSubtotalAmount(null|float|string $subtotalAmount): static
69+
{
70+
if (is_string($subtotalAmount)) {
71+
$subtotalAmount = (float) $subtotalAmount;
72+
}
73+
74+
$this->fields['subtotalAmount'] = $subtotalAmount;
75+
76+
return $this;
77+
}
78+
79+
public function getDiscountAmount(): ?float
80+
{
81+
return $this->fields['discountAmount'] ?? null;
82+
}
83+
84+
public function setDiscountAmount(null|float|string $discountAmount): static
85+
{
86+
if (is_string($discountAmount)) {
87+
$discountAmount = (float) $discountAmount;
88+
}
89+
90+
$this->fields['discountAmount'] = $discountAmount;
91+
92+
return $this;
93+
}
94+
95+
public function getShippingAmount(): ?float
96+
{
97+
return $this->fields['shippingAmount'] ?? null;
98+
}
99+
100+
public function setShippingAmount(null|float|string $shippingAmount): static
101+
{
102+
if (is_string($shippingAmount)) {
103+
$shippingAmount = (float) $shippingAmount;
104+
}
105+
106+
$this->fields['shippingAmount'] = $shippingAmount;
107+
108+
return $this;
109+
}
110+
111+
public function getTaxAmount(): ?float
112+
{
113+
return $this->fields['taxAmount'] ?? null;
114+
}
115+
116+
public function setTaxAmount(null|float|string $taxAmount): static
117+
{
118+
if (is_string($taxAmount)) {
119+
$taxAmount = (float) $taxAmount;
120+
}
121+
122+
$this->fields['taxAmount'] = $taxAmount;
123+
124+
return $this;
125+
}
126+
127+
public function jsonSerialize(): array
128+
{
129+
$data = [];
130+
if (array_key_exists('amount', $this->fields)) {
131+
$data['amount'] = $this->fields['amount'];
132+
}
133+
if (array_key_exists('subtotalAmount', $this->fields)) {
134+
$data['subtotalAmount'] = $this->fields['subtotalAmount'];
135+
}
136+
if (array_key_exists('discountAmount', $this->fields)) {
137+
$data['discountAmount'] = $this->fields['discountAmount'];
138+
}
139+
if (array_key_exists('shippingAmount', $this->fields)) {
140+
$data['shippingAmount'] = $this->fields['shippingAmount'];
141+
}
142+
if (array_key_exists('taxAmount', $this->fields)) {
143+
$data['taxAmount'] = $this->fields['taxAmount'];
144+
}
145+
146+
return $data;
147+
}
148+
}
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
<?php
2+
3+
/**
4+
* This source file is proprietary and part of Rebilly.
5+
*
6+
* (c) Rebilly SRL
7+
* Rebilly Ltd.
8+
* Rebilly Inc.
9+
*
10+
* @see https://www.rebilly.com
11+
*/
12+
13+
declare(strict_types=1);
14+
15+
namespace Rebilly\Sdk\Model;
16+
17+
use JsonSerializable;
18+
19+
class OrderPreviewRecurringAmounts implements JsonSerializable
20+
{
21+
private array $fields = [];
22+
23+
public function __construct(array $data = [])
24+
{
25+
if (array_key_exists('amount', $data)) {
26+
$this->setAmount($data['amount']);
27+
}
28+
if (array_key_exists('subtotalAmount', $data)) {
29+
$this->setSubtotalAmount($data['subtotalAmount']);
30+
}
31+
if (array_key_exists('discountAmount', $data)) {
32+
$this->setDiscountAmount($data['discountAmount']);
33+
}
34+
if (array_key_exists('shippingAmount', $data)) {
35+
$this->setShippingAmount($data['shippingAmount']);
36+
}
37+
if (array_key_exists('taxAmount', $data)) {
38+
$this->setTaxAmount($data['taxAmount']);
39+
}
40+
}
41+
42+
public static function from(array $data = []): self
43+
{
44+
return new self($data);
45+
}
46+
47+
public function getAmount(): ?float
48+
{
49+
return $this->fields['amount'] ?? null;
50+
}
51+
52+
public function setAmount(null|float|string $amount): static
53+
{
54+
if (is_string($amount)) {
55+
$amount = (float) $amount;
56+
}
57+
58+
$this->fields['amount'] = $amount;
59+
60+
return $this;
61+
}
62+
63+
public function getSubtotalAmount(): ?float
64+
{
65+
return $this->fields['subtotalAmount'] ?? null;
66+
}
67+
68+
public function setSubtotalAmount(null|float|string $subtotalAmount): static
69+
{
70+
if (is_string($subtotalAmount)) {
71+
$subtotalAmount = (float) $subtotalAmount;
72+
}
73+
74+
$this->fields['subtotalAmount'] = $subtotalAmount;
75+
76+
return $this;
77+
}
78+
79+
public function getDiscountAmount(): ?float
80+
{
81+
return $this->fields['discountAmount'] ?? null;
82+
}
83+
84+
public function setDiscountAmount(null|float|string $discountAmount): static
85+
{
86+
if (is_string($discountAmount)) {
87+
$discountAmount = (float) $discountAmount;
88+
}
89+
90+
$this->fields['discountAmount'] = $discountAmount;
91+
92+
return $this;
93+
}
94+
95+
public function getShippingAmount(): ?float
96+
{
97+
return $this->fields['shippingAmount'] ?? null;
98+
}
99+
100+
public function setShippingAmount(null|float|string $shippingAmount): static
101+
{
102+
if (is_string($shippingAmount)) {
103+
$shippingAmount = (float) $shippingAmount;
104+
}
105+
106+
$this->fields['shippingAmount'] = $shippingAmount;
107+
108+
return $this;
109+
}
110+
111+
public function getTaxAmount(): ?float
112+
{
113+
return $this->fields['taxAmount'] ?? null;
114+
}
115+
116+
public function setTaxAmount(null|float|string $taxAmount): static
117+
{
118+
if (is_string($taxAmount)) {
119+
$taxAmount = (float) $taxAmount;
120+
}
121+
122+
$this->fields['taxAmount'] = $taxAmount;
123+
124+
return $this;
125+
}
126+
127+
public function jsonSerialize(): array
128+
{
129+
$data = [];
130+
if (array_key_exists('amount', $this->fields)) {
131+
$data['amount'] = $this->fields['amount'];
132+
}
133+
if (array_key_exists('subtotalAmount', $this->fields)) {
134+
$data['subtotalAmount'] = $this->fields['subtotalAmount'];
135+
}
136+
if (array_key_exists('discountAmount', $this->fields)) {
137+
$data['discountAmount'] = $this->fields['discountAmount'];
138+
}
139+
if (array_key_exists('shippingAmount', $this->fields)) {
140+
$data['shippingAmount'] = $this->fields['shippingAmount'];
141+
}
142+
if (array_key_exists('taxAmount', $this->fields)) {
143+
$data['taxAmount'] = $this->fields['taxAmount'];
144+
}
145+
146+
return $data;
147+
}
148+
}

0 commit comments

Comments
 (0)