diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a611be..199653f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ Check our main [developer changelog](https://developer.paddle.com/?utm_source=dx ### Added - Added `availablePaymentMethods` as an `include` Parameter to all transaction operations. +- Added `importMeta` to Subscription webhooks. ### Changed @@ -23,6 +24,10 @@ Check our main [developer changelog](https://developer.paddle.com/?utm_source=dx - Fixed `effective_from` enum in Resume subscription operations. +### Deprecated + +- Deprecated `storedPaymentMethodId` from transaction payments in favour of `paymentMethodId` field. + --- ## 0.3.0 - 2024-01-11 diff --git a/src/__tests__/mocks/notifications/subscription-activated.mock.ts b/src/__tests__/mocks/notifications/subscription-activated.mock.ts index 444ef2c..595b165 100644 --- a/src/__tests__/mocks/notifications/subscription-activated.mock.ts +++ b/src/__tests__/mocks/notifications/subscription-activated.mock.ts @@ -94,6 +94,7 @@ export const SubscriptionActivatedMockExpectation = { startsAt: '2023-08-11T08:07:35.449123Z', }, customData: null, + importMeta: null, customerId: 'ctm_01h7hswb86rtps5ggbq7ybydcw', discount: null, firstBilledAt: '2023-08-11T08:07:35.449123Z', diff --git a/src/__tests__/mocks/notifications/subscription-canceled.mock.ts b/src/__tests__/mocks/notifications/subscription-canceled.mock.ts index 9b9068a..e0038e9 100644 --- a/src/__tests__/mocks/notifications/subscription-canceled.mock.ts +++ b/src/__tests__/mocks/notifications/subscription-canceled.mock.ts @@ -109,6 +109,7 @@ export const SubscriptionCanceledMockExpectation = { currencyCode: 'USD', currentBillingPeriod: null, customData: null, + importMeta: null, customerId: 'ctm_01h7hswb86rtps5ggbq7ybydcw', discount: null, firstBilledAt: '2023-08-11T08:07:35.449123Z', diff --git a/src/__tests__/mocks/notifications/subscription-created.mock.ts b/src/__tests__/mocks/notifications/subscription-created.mock.ts index f3342fd..1c05edd 100644 --- a/src/__tests__/mocks/notifications/subscription-created.mock.ts +++ b/src/__tests__/mocks/notifications/subscription-created.mock.ts @@ -94,6 +94,7 @@ export const SubscriptionCreatedMockExpectation = { startsAt: '2023-08-11T08:07:35.449123Z', }, customData: null, + importMeta: null, customerId: 'ctm_01h7hswb86rtps5ggbq7ybydcw', discount: null, firstBilledAt: '2023-08-11T08:07:35.449123Z', diff --git a/src/__tests__/mocks/notifications/subscription-imported.mock.ts b/src/__tests__/mocks/notifications/subscription-imported.mock.ts index 30eee48..035b37d 100644 --- a/src/__tests__/mocks/notifications/subscription-imported.mock.ts +++ b/src/__tests__/mocks/notifications/subscription-imported.mock.ts @@ -109,6 +109,7 @@ export const SubscriptionImportedMockExpectation = { startsAt: '2023-04-13T09:07:04.730931Z', }, customData: null, + importMeta: null, customerId: 'ctm_01gxwxe6vzgz6hcsbwjs6zrszr', discount: null, firstBilledAt: '2023-04-13T09:07:04.730931Z', diff --git a/src/__tests__/mocks/notifications/subscription-past-due.mock.ts b/src/__tests__/mocks/notifications/subscription-past-due.mock.ts index de3c770..2211c90 100644 --- a/src/__tests__/mocks/notifications/subscription-past-due.mock.ts +++ b/src/__tests__/mocks/notifications/subscription-past-due.mock.ts @@ -94,6 +94,7 @@ export const SubscriptionPastDueMockExpectation = { startsAt: '2023-10-11T08:07:35.449123Z', }, customData: null, + importMeta: null, customerId: 'ctm_01h7hswb86rtps5ggbq7ybydcw', discount: null, firstBilledAt: '2023-08-11T08:07:35.449123Z', diff --git a/src/__tests__/mocks/notifications/subscription-paused.mock.ts b/src/__tests__/mocks/notifications/subscription-paused.mock.ts index 11d1f27..173c928 100644 --- a/src/__tests__/mocks/notifications/subscription-paused.mock.ts +++ b/src/__tests__/mocks/notifications/subscription-paused.mock.ts @@ -91,6 +91,7 @@ export const SubscriptionPausedMockExpectation = { currencyCode: 'USD', currentBillingPeriod: null, customData: null, + importMeta: null, customerId: 'ctm_01h7hswb86rtps5ggbq7ybydcw', discount: null, firstBilledAt: '2023-08-11T08:07:35.449123Z', diff --git a/src/__tests__/mocks/notifications/subscription-resumed.mock.ts b/src/__tests__/mocks/notifications/subscription-resumed.mock.ts index af37f51..1972177 100644 --- a/src/__tests__/mocks/notifications/subscription-resumed.mock.ts +++ b/src/__tests__/mocks/notifications/subscription-resumed.mock.ts @@ -94,6 +94,7 @@ export const SubscriptionResumedMockExpectation = { startsAt: '2023-11-11T08:33:04.443903Z', }, customData: null, + importMeta: null, customerId: 'ctm_01h7hswb86rtps5ggbq7ybydcw', discount: null, firstBilledAt: '2023-08-11T08:07:35.449123Z', diff --git a/src/__tests__/mocks/notifications/subscription-trialing.mock.ts b/src/__tests__/mocks/notifications/subscription-trialing.mock.ts index cea8a31..05f556b 100644 --- a/src/__tests__/mocks/notifications/subscription-trialing.mock.ts +++ b/src/__tests__/mocks/notifications/subscription-trialing.mock.ts @@ -75,6 +75,7 @@ export const SubscriptionTrialingMockExpectation = { startsAt: '2023-08-18T13:15:46.864158Z', }, customData: null, + importMeta: null, customerId: 'ctm_01h84cjfwmdph1k8kgsyjt3k7g', discount: null, firstBilledAt: null, diff --git a/src/__tests__/mocks/notifications/subscription-updated.mock.ts b/src/__tests__/mocks/notifications/subscription-updated.mock.ts index c6e6f6e..44fc216 100644 --- a/src/__tests__/mocks/notifications/subscription-updated.mock.ts +++ b/src/__tests__/mocks/notifications/subscription-updated.mock.ts @@ -94,6 +94,7 @@ export const SubscriptionUpdatedMockExpectation = { startsAt: '2023-09-11T08:07:35.449123Z', }, customData: null, + importMeta: null, customerId: 'ctm_01h7hswb86rtps5ggbq7ybydcw', discount: null, firstBilledAt: '2023-08-11T08:07:35.449123Z', diff --git a/src/entities/subscription/subscription-notification.ts b/src/entities/subscription/subscription-notification.ts index cef8d54..c74c88d 100644 --- a/src/entities/subscription/subscription-notification.ts +++ b/src/entities/subscription/subscription-notification.ts @@ -7,6 +7,7 @@ import { BillingDetails, type CustomData, + ImportMeta, SubscriptionDiscount, SubscriptionItem, SubscriptionScheduledChange, @@ -39,6 +40,7 @@ export class SubscriptionNotification { public readonly scheduledChange: SubscriptionScheduledChange | null; public readonly items: SubscriptionItem[]; public readonly customData: CustomData | null; + public readonly importMeta: ImportMeta | null; constructor(subscription: ISubscriptionNotificationResponse) { this.id = subscription.id; @@ -67,5 +69,6 @@ export class SubscriptionNotification { : null; this.items = subscription.items.map((item) => new SubscriptionItem(item)); this.customData = subscription.custom_data ? subscription.custom_data : null; + this.importMeta = subscription.import_meta ? new ImportMeta(subscription.import_meta) : null; } } diff --git a/src/types/subscription/subscription-notification-response.ts b/src/types/subscription/subscription-notification-response.ts index 6293274..efa2fa2 100644 --- a/src/types/subscription/subscription-notification-response.ts +++ b/src/types/subscription/subscription-notification-response.ts @@ -7,6 +7,7 @@ import { type IBillingDetailsResponse, type ICustomData, + type IImportMetaResponse, type INextTransactionResponse, type ISubscriptionDiscountResponse, type ISubscriptionItemResponse, @@ -40,6 +41,7 @@ export interface ISubscriptionNotificationResponse { scheduled_change?: ISubscriptionScheduledChangeResponse | null; items: ISubscriptionItemResponse[]; custom_data?: ICustomData | null; + import_meta?: IImportMetaResponse | null; next_transaction?: INextTransactionResponse | null; recurring_transaction_details?: ITransactionDetailsPreviewResponse | null; }