From 4a90322fbd9cc43fc44eda6c6ba82fa5d1d97d06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Fern=C3=A1ndez=20Saborit?= Date: Tue, 6 Feb 2024 17:15:18 +0100 Subject: [PATCH 1/5] Sync api-spec (#27) --- src/Entities/Event/EventTypeName.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Entities/Event/EventTypeName.php b/src/Entities/Event/EventTypeName.php index f0e4dde..e6992b3 100644 --- a/src/Entities/Event/EventTypeName.php +++ b/src/Entities/Event/EventTypeName.php @@ -7,10 +7,12 @@ enum EventTypeName: string { case AddressCreated = 'address.created'; + case AddressImported = 'address.imported'; case AddressUpdated = 'address.updated'; case AdjustmentCreated = 'adjustment.created'; case AdjustmentUpdated = 'adjustment.updated'; case BusinessCreated = 'business.created'; + case BusinessImported = 'business.imported'; case BusinessUpdated = 'business.updated'; case CustomerCreated = 'customer.created'; case CustomerImported = 'customer.imported'; From dc2455b796e36dbf0164f6e6cc6be33c3d26a6d1 Mon Sep 17 00:00:00 2001 From: Corey Date: Tue, 6 Feb 2024 09:34:07 -0800 Subject: [PATCH 2/5] fix: make current_billing_period nullable for Subscription notifications Co-authored-by: Michael Woodward --- src/Entities/Notification/NotificationSubscription.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Entities/Notification/NotificationSubscription.php b/src/Entities/Notification/NotificationSubscription.php index 23d105d..63a3d7b 100644 --- a/src/Entities/Notification/NotificationSubscription.php +++ b/src/Entities/Notification/NotificationSubscription.php @@ -41,7 +41,7 @@ protected function __construct( public SubscriptionDiscount|null $discount, public CollectionMode $collectionMode, public BillingDetails|null $billingDetails, - public SubscriptionTimePeriod $currentBillingPeriod, + public SubscriptionTimePeriod|null $currentBillingPeriod, public TimePeriod $billingCycle, public SubscriptionScheduledChange|null $scheduledChange, public array $items, From bf685101206ce5699146d09284c6af459fee8e13 Mon Sep 17 00:00:00 2001 From: Corey Date: Tue, 6 Feb 2024 09:39:34 -0800 Subject: [PATCH 3/5] Add missing receipt_data Transaction property (#17) Co-authored-by: Michael Woodward --- src/Entities/Transaction.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Entities/Transaction.php b/src/Entities/Transaction.php index 18951eb..96ace47 100644 --- a/src/Entities/Transaction.php +++ b/src/Entities/Transaction.php @@ -59,6 +59,7 @@ protected function __construct( public \DateTimeInterface $createdAt, public \DateTimeInterface $updatedAt, public \DateTimeInterface|null $billedAt, + public string|null $receiptData, public Address|null $address, public array $adjustments, public TransactionAdjustmentsTotals|null $adjustmentsTotals, @@ -94,6 +95,7 @@ public static function from(array $data): self createdAt: DateTime::from($data['created_at']), updatedAt: DateTime::from($data['updated_at']), billedAt: isset($data['billed_at']) ? DateTime::from($data['billed_at']) : null, + receiptData: $data['receipt_data'] ?? null, address: isset($data['address']) ? Address::from($data['address']) : null, adjustments: array_map(fn (array $adjustment): TransactionAdjustment => TransactionAdjustment::from($adjustment), $data['adjustments'] ?? []), adjustmentsTotals: isset($data['adjustments_totals']) ? TransactionAdjustmentsTotals::from($data['adjustments_totals']) : null, From 1ea6936fb1e56a772c2af326b43c663111448748 Mon Sep 17 00:00:00 2001 From: Corey Date: Wed, 7 Feb 2024 01:25:39 -0800 Subject: [PATCH 4/5] feat: Add support for `import_meta` in Notification Subscription --- src/Entities/Notification/NotificationSubscription.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Entities/Notification/NotificationSubscription.php b/src/Entities/Notification/NotificationSubscription.php index 63a3d7b..4551822 100644 --- a/src/Entities/Notification/NotificationSubscription.php +++ b/src/Entities/Notification/NotificationSubscription.php @@ -10,6 +10,7 @@ use Paddle\SDK\Entities\Shared\CollectionMode; use Paddle\SDK\Entities\Shared\CurrencyCode; use Paddle\SDK\Entities\Shared\CustomData; +use Paddle\SDK\Entities\Shared\ImportMeta; use Paddle\SDK\Entities\Shared\TimePeriod; use Paddle\SDK\Entities\Subscription\SubscriptionDiscount; use Paddle\SDK\Entities\Subscription\SubscriptionItem; @@ -46,6 +47,7 @@ protected function __construct( public SubscriptionScheduledChange|null $scheduledChange, public array $items, public CustomData|null $customData, + public ImportMeta|null $importMeta, ) { } @@ -77,6 +79,7 @@ public static function from(array $data): self : null, items: array_map(fn (array $item): SubscriptionItem => SubscriptionItem::from($item), $data['items']), customData: isset($data['custom_data']) ? new CustomData($data['custom_data']) : null, + importMeta: isset($data['import_meta']) ? ImportMeta::from($data['import_meta']) : null, ); } } From 28675e487325753b48077fedf5ce64eaa155460f Mon Sep 17 00:00:00 2001 From: Corey Date: Wed, 7 Feb 2024 01:45:56 -0800 Subject: [PATCH 5/5] feat: Add support for `custom_data` and `import_meta` on Notification Discount --- src/Entities/Notification/NotificationDiscount.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Entities/Notification/NotificationDiscount.php b/src/Entities/Notification/NotificationDiscount.php index 7aab58f..3f58545 100644 --- a/src/Entities/Notification/NotificationDiscount.php +++ b/src/Entities/Notification/NotificationDiscount.php @@ -16,6 +16,8 @@ use Paddle\SDK\Entities\Discount\DiscountType; use Paddle\SDK\Entities\Entity; use Paddle\SDK\Entities\Shared\CurrencyCode; +use Paddle\SDK\Entities\Shared\CustomData; +use Paddle\SDK\Entities\Shared\ImportMeta; class NotificationDiscount implements Entity { @@ -35,6 +37,8 @@ protected function __construct( public int|null $maximumRecurringIntervals, public int|null $usageLimit, public array|null $restrictTo, + public CustomData|null $customData, + public ImportMeta|null $importMeta, public \DateTimeInterface|null $expiresAt, public \DateTimeInterface $createdAt, public \DateTimeInterface $updatedAt, @@ -56,6 +60,8 @@ public static function from(array $data): self maximumRecurringIntervals: $data['maximum_recurring_intervals'], usageLimit: $data['usage_limit'] ?? null, restrictTo: $data['restrict_to'] ?? null, + customData: isset($data['custom_data']) ? new CustomData($data['custom_data']) : null, + importMeta: isset($data['import_meta']) ? ImportMeta::from($data['import_meta']) : null, expiresAt: isset($data['expires_at']) ? DateTime::from($data['expires_at']) : null, createdAt: DateTime::from($data['created_at']), updatedAt: DateTime::from($data['updated_at']),