Skip to content
Open
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/fluffy-insects-warn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

fix(be,api-definitions,recomm): Add missing Discover dispute reason codes Rebilly/rebilly#18032
5 changes: 5 additions & 0 deletions .changeset/gentle-numbers-compete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

feat(be, api-definitions): preview orders enhancements Rebilly/rebilly#17844
5 changes: 5 additions & 0 deletions .changeset/selfish-dolls-punch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

feat(be, api-definitions): Add startTime to creation quotes Rebilly/rebilly#18022
5 changes: 5 additions & 0 deletions .changeset/strong-penguins-draw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

revert(backend): Permanently block above and Temporary block above use the independent pool of attributes - remove backward compatibility Rebilly/rebilly#17885
5 changes: 5 additions & 0 deletions .changeset/violet-years-cross.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

fix(backend): Permanently block above and Temporary block above use the independent pool of attributes - remove backward compatibility Rebilly/rebilly#17885
24 changes: 24 additions & 0 deletions src/Model/CreationQuoteOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

namespace Rebilly\Sdk\Model;

use DateTimeImmutable;
use DateTimeInterface;
use JsonSerializable;

class CreationQuoteOrder implements JsonSerializable
Expand All @@ -40,6 +42,9 @@ public function __construct(array $data = [])
if (array_key_exists('billingAddress', $data)) {
$this->setBillingAddress($data['billingAddress']);
}
if (array_key_exists('startTime', $data)) {
$this->setStartTime($data['startTime']);
}
}

public static function from(array $data = []): self
Expand Down Expand Up @@ -135,6 +140,22 @@ public function setBillingAddress(null|ContactObject|array $billingAddress): sta
return $this;
}

public function getStartTime(): ?DateTimeImmutable
{
return $this->fields['startTime'] ?? null;
}

public function setStartTime(null|DateTimeImmutable|string $startTime): static
{
if ($startTime !== null && !($startTime instanceof DateTimeImmutable)) {
$startTime = new DateTimeImmutable($startTime);
}

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

return $this;
}

public function jsonSerialize(): array
{
$data = [];
Expand All @@ -159,6 +180,9 @@ public function jsonSerialize(): array
if (array_key_exists('billingAddress', $this->fields)) {
$data['billingAddress'] = $this->fields['billingAddress']?->jsonSerialize();
}
if (array_key_exists('startTime', $this->fields)) {
$data['startTime'] = $this->fields['startTime']?->format(DateTimeInterface::RFC3339);
}

return $data;
}
Expand Down
44 changes: 44 additions & 0 deletions src/Model/OrderPreview.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ public function __construct(array $data = [])
if (array_key_exists('total', $data)) {
$this->setTotal($data['total']);
}
if (array_key_exists('initialAmounts', $data)) {
$this->setInitialAmounts($data['initialAmounts']);
}
if (array_key_exists('recurringAmounts', $data)) {
$this->setRecurringAmounts($data['recurringAmounts']);
}
if (array_key_exists('shipping', $data)) {
$this->setShipping($data['shipping']);
}
Expand Down Expand Up @@ -224,6 +230,38 @@ public function getTotal(): ?float
return $this->fields['total'] ?? null;
}

public function getInitialAmounts(): ?OrderPreviewInitialAmounts
{
return $this->fields['initialAmounts'] ?? null;
}

public function setInitialAmounts(null|OrderPreviewInitialAmounts|array $initialAmounts): static
{
if ($initialAmounts !== null && !($initialAmounts instanceof OrderPreviewInitialAmounts)) {
$initialAmounts = OrderPreviewInitialAmounts::from($initialAmounts);
}

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

return $this;
}

public function getRecurringAmounts(): ?OrderPreviewRecurringAmounts
{
return $this->fields['recurringAmounts'] ?? null;
}

public function setRecurringAmounts(null|OrderPreviewRecurringAmounts|array $recurringAmounts): static
{
if ($recurringAmounts !== null && !($recurringAmounts instanceof OrderPreviewRecurringAmounts)) {
$recurringAmounts = OrderPreviewRecurringAmounts::from($recurringAmounts);
}

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

return $this;
}

public function getShipping(): ?Shipping
{
return $this->fields['shipping'] ?? null;
Expand Down Expand Up @@ -311,6 +349,12 @@ public function jsonSerialize(): array
if (array_key_exists('total', $this->fields)) {
$data['total'] = $this->fields['total'];
}
if (array_key_exists('initialAmounts', $this->fields)) {
$data['initialAmounts'] = $this->fields['initialAmounts']?->jsonSerialize();
}
if (array_key_exists('recurringAmounts', $this->fields)) {
$data['recurringAmounts'] = $this->fields['recurringAmounts']?->jsonSerialize();
}
if (array_key_exists('shipping', $this->fields)) {
$data['shipping'] = $this->fields['shipping']?->jsonSerialize();
}
Expand Down
148 changes: 148 additions & 0 deletions src/Model/OrderPreviewInitialAmounts.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
<?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 OrderPreviewInitialAmounts implements JsonSerializable
{
private array $fields = [];

public function __construct(array $data = [])
{
if (array_key_exists('amount', $data)) {
$this->setAmount($data['amount']);
}
if (array_key_exists('subtotalAmount', $data)) {
$this->setSubtotalAmount($data['subtotalAmount']);
}
if (array_key_exists('discountAmount', $data)) {
$this->setDiscountAmount($data['discountAmount']);
}
if (array_key_exists('shippingAmount', $data)) {
$this->setShippingAmount($data['shippingAmount']);
}
if (array_key_exists('taxAmount', $data)) {
$this->setTaxAmount($data['taxAmount']);
}
}

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

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

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

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

return $this;
}

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

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

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

return $this;
}

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

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

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

return $this;
}

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

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

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

return $this;
}

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

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

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

return $this;
}

public function jsonSerialize(): array
{
$data = [];
if (array_key_exists('amount', $this->fields)) {
$data['amount'] = $this->fields['amount'];
}
if (array_key_exists('subtotalAmount', $this->fields)) {
$data['subtotalAmount'] = $this->fields['subtotalAmount'];
}
if (array_key_exists('discountAmount', $this->fields)) {
$data['discountAmount'] = $this->fields['discountAmount'];
}
if (array_key_exists('shippingAmount', $this->fields)) {
$data['shippingAmount'] = $this->fields['shippingAmount'];
}
if (array_key_exists('taxAmount', $this->fields)) {
$data['taxAmount'] = $this->fields['taxAmount'];
}

return $data;
}
}
Loading