Skip to content

Commit f7c657a

Browse files
feat(Subscription): Updated subscription item model to include product (#38)
1 parent 6f85c77 commit f7c657a

16 files changed

+544
-7
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ When we make [non-breaking changes](https://developer.paddle.com/api-reference/a
1212

1313
This means when upgrading minor versions of the SDK, you may notice type errors. You can safely ignore these or fix by adding additional type guards.
1414

15+
## 1.5.0 - 2024-08-16
16+
17+
### Added
18+
19+
- Updated subscription items model to include `product`. See [related changelog](https://developer.paddle.com/changelog/2024/subscription-items-product?utm_source=dx&utm_medium=paddle-node-sdk).
20+
21+
---
22+
1523
## 1.4.1 - 2024-06-21
1624

1725
### Fixed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@paddle/paddle-node-sdk",
3-
"version": "1.4.1",
3+
"version": "1.5.0",
44
"description": "A Node.js SDK that you can use to integrate Paddle Billing with applications written in server-side JavaScript.",
55
"main": "./dist/cjs/index.js",
66
"module": "./dist/esm/index.js",

src/__tests__/mocks/notifications/subscription-activated.mock.ts

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,18 @@ export const SubscriptionActivatedMock: IEventsResponse<ISubscriptionNotificatio
2626
trial_period: null,
2727
billing_cycle: { interval: 'month', frequency: 1 },
2828
},
29+
product: {
30+
id: 'pro_01gsz4t5hdjse780zja8vvr7jg',
31+
name: 'ChatApp Pro',
32+
status: 'active',
33+
image_url: 'https://paddle-sandbox.s3.amazonaws.com/user/10889/2nmP8MQSret0aWeDemRw_icon1.png',
34+
description:
35+
"Everything in basic, plus access to a suite of powerful tools and features designed to take your team's productivity to the next level.",
36+
tax_category: 'standard',
37+
type: 'standard',
38+
custom_data: null,
39+
created_at: '2023-08-22T07:59:39.771451Z',
40+
},
2941
status: 'active',
3042
quantity: 10,
3143
recurring: true,
@@ -45,6 +57,18 @@ export const SubscriptionActivatedMock: IEventsResponse<ISubscriptionNotificatio
4557
trial_period: null,
4658
billing_cycle: { interval: 'month', frequency: 1 },
4759
},
60+
product: {
61+
id: 'pro_01h1vjes1y163xfj1rh1tkfb65',
62+
name: 'Voice rooms addon',
63+
status: 'active',
64+
image_url: 'https://paddle-sandbox.s3.amazonaws.com/user/10889/GcZzBjXRfiraensppgtQ_icon2.png',
65+
description:
66+
'Create voice rooms in your chats to work in real time alongside your colleagues. Includes unlimited voice rooms and recording backup for compliance.',
67+
tax_category: 'standard',
68+
type: 'standard',
69+
custom_data: null,
70+
created_at: '2023-08-22T07:59:39.771451Z',
71+
},
4872
status: 'active',
4973
quantity: 1,
5074
recurring: true,
@@ -127,6 +151,20 @@ export const SubscriptionActivatedMockExpectation = {
127151
},
128152
unitPriceOverrides: [],
129153
},
154+
product: {
155+
id: 'pro_01gsz4t5hdjse780zja8vvr7jg',
156+
name: 'ChatApp Pro',
157+
status: 'active',
158+
imageUrl: 'https://paddle-sandbox.s3.amazonaws.com/user/10889/2nmP8MQSret0aWeDemRw_icon1.png',
159+
description:
160+
"Everything in basic, plus access to a suite of powerful tools and features designed to take your team's productivity to the next level.",
161+
taxCategory: 'standard',
162+
type: 'standard',
163+
customData: null,
164+
importMeta: null,
165+
createdAt: '2023-08-22T07:59:39.771451Z',
166+
updatedAt: null,
167+
},
130168
quantity: 10,
131169
recurring: true,
132170
status: 'active',
@@ -159,6 +197,20 @@ export const SubscriptionActivatedMockExpectation = {
159197
},
160198
unitPriceOverrides: [],
161199
},
200+
product: {
201+
id: 'pro_01h1vjes1y163xfj1rh1tkfb65',
202+
name: 'Voice rooms addon',
203+
status: 'active',
204+
imageUrl: 'https://paddle-sandbox.s3.amazonaws.com/user/10889/GcZzBjXRfiraensppgtQ_icon2.png',
205+
description:
206+
'Create voice rooms in your chats to work in real time alongside your colleagues. Includes unlimited voice rooms and recording backup for compliance.',
207+
taxCategory: 'standard',
208+
type: 'standard',
209+
customData: null,
210+
importMeta: null,
211+
createdAt: '2023-08-22T07:59:39.771451Z',
212+
updatedAt: null,
213+
},
162214
quantity: 1,
163215
recurring: true,
164216
status: 'active',

src/__tests__/mocks/notifications/subscription-canceled.mock.ts

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,18 @@ export const SubscriptionCanceledMock: IEventsResponse<ISubscriptionNotification
2626
trial_period: null,
2727
billing_cycle: { interval: 'month', frequency: 1 },
2828
},
29+
product: {
30+
id: 'pro_01gsz4t5hdjse780zja8vvr7jg',
31+
name: 'ChatApp Pro',
32+
status: 'active',
33+
image_url: 'https://paddle-sandbox.s3.amazonaws.com/user/10889/2nmP8MQSret0aWeDemRw_icon1.png',
34+
description:
35+
"Everything in basic, plus access to a suite of powerful tools and features designed to take your team's productivity to the next level.",
36+
tax_category: 'standard',
37+
type: 'standard',
38+
custom_data: null,
39+
created_at: '2023-08-22T07:59:39.771451Z',
40+
},
2941
status: 'active',
3042
quantity: 10,
3143
recurring: true,
@@ -44,6 +56,18 @@ export const SubscriptionCanceledMock: IEventsResponse<ISubscriptionNotification
4456
trial_period: null,
4557
billing_cycle: { interval: 'month', frequency: 1 },
4658
},
59+
product: {
60+
id: 'pro_01h1vjes1y163xfj1rh1tkfb65',
61+
name: 'Voice rooms addon',
62+
status: 'active',
63+
image_url: 'https://paddle-sandbox.s3.amazonaws.com/user/10889/GcZzBjXRfiraensppgtQ_icon2.png',
64+
description:
65+
'Create voice rooms in your chats to work in real time alongside your colleagues. Includes unlimited voice rooms and recording backup for compliance.',
66+
tax_category: 'standard',
67+
type: 'standard',
68+
custom_data: null,
69+
created_at: '2023-08-22T07:59:39.771451Z',
70+
},
4771
status: 'active',
4872
quantity: 1,
4973
recurring: true,
@@ -63,6 +87,18 @@ export const SubscriptionCanceledMock: IEventsResponse<ISubscriptionNotification
6387
trial_period: null,
6488
billing_cycle: { interval: 'month', frequency: 1 },
6589
},
90+
product: {
91+
id: 'pro_01gsz92krfzy3hcx5h5rtgnfwz',
92+
name: 'VIP support',
93+
status: 'active',
94+
image_url: 'https://paddle-sandbox.s3.amazonaws.com/user/10889/SW3OevDQ92dUHSkN5a2x_icon3.png',
95+
description:
96+
'Get exclusive access to our expert team of product specialists, available to help you make the most of your ChatApp subscription.',
97+
tax_category: 'standard',
98+
type: 'standard',
99+
custom_data: null,
100+
created_at: '2023-08-22T07:59:39.771451Z',
101+
},
66102
status: 'active',
67103
quantity: 1,
68104
recurring: true,
@@ -142,6 +178,20 @@ export const SubscriptionCanceledMockExpectation = {
142178
},
143179
unitPriceOverrides: [],
144180
},
181+
product: {
182+
id: 'pro_01gsz4t5hdjse780zja8vvr7jg',
183+
name: 'ChatApp Pro',
184+
status: 'active',
185+
imageUrl: 'https://paddle-sandbox.s3.amazonaws.com/user/10889/2nmP8MQSret0aWeDemRw_icon1.png',
186+
description:
187+
"Everything in basic, plus access to a suite of powerful tools and features designed to take your team's productivity to the next level.",
188+
taxCategory: 'standard',
189+
type: 'standard',
190+
customData: null,
191+
importMeta: null,
192+
createdAt: '2023-08-22T07:59:39.771451Z',
193+
updatedAt: null,
194+
},
145195
quantity: 10,
146196
recurring: true,
147197
status: 'active',
@@ -174,6 +224,20 @@ export const SubscriptionCanceledMockExpectation = {
174224
},
175225
unitPriceOverrides: [],
176226
},
227+
product: {
228+
id: 'pro_01h1vjes1y163xfj1rh1tkfb65',
229+
name: 'Voice rooms addon',
230+
status: 'active',
231+
imageUrl: 'https://paddle-sandbox.s3.amazonaws.com/user/10889/GcZzBjXRfiraensppgtQ_icon2.png',
232+
description:
233+
'Create voice rooms in your chats to work in real time alongside your colleagues. Includes unlimited voice rooms and recording backup for compliance.',
234+
taxCategory: 'standard',
235+
type: 'standard',
236+
customData: null,
237+
importMeta: null,
238+
createdAt: '2023-08-22T07:59:39.771451Z',
239+
updatedAt: null,
240+
},
177241
quantity: 1,
178242
recurring: true,
179243
status: 'active',
@@ -206,6 +270,20 @@ export const SubscriptionCanceledMockExpectation = {
206270
},
207271
unitPriceOverrides: [],
208272
},
273+
product: {
274+
createdAt: '2023-08-22T07:59:39.771451Z',
275+
customData: null,
276+
description:
277+
'Get exclusive access to our expert team of product specialists, available to help you make the most of your ChatApp subscription.',
278+
id: 'pro_01gsz92krfzy3hcx5h5rtgnfwz',
279+
imageUrl: 'https://paddle-sandbox.s3.amazonaws.com/user/10889/SW3OevDQ92dUHSkN5a2x_icon3.png',
280+
importMeta: null,
281+
name: 'VIP support',
282+
status: 'active',
283+
taxCategory: 'standard',
284+
type: 'standard',
285+
updatedAt: null,
286+
},
209287
quantity: 1,
210288
recurring: true,
211289
status: 'active',

src/__tests__/mocks/notifications/subscription-created.mock.ts

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,18 @@ export const SubscriptionCreatedMock: IEventsResponse<ISubscriptionNotificationR
2525
trial_period: null,
2626
billing_cycle: { interval: 'month', frequency: 1 },
2727
},
28+
product: {
29+
id: 'pro_01gsz4t5hdjse780zja8vvr7jg',
30+
name: 'ChatApp Pro',
31+
status: 'active',
32+
image_url: 'https://paddle-sandbox.s3.amazonaws.com/user/10889/2nmP8MQSret0aWeDemRw_icon1.png',
33+
description:
34+
"Everything in basic, plus access to a suite of powerful tools and features designed to take your team's productivity to the next level.",
35+
tax_category: 'standard',
36+
type: 'standard',
37+
custom_data: null,
38+
created_at: '2023-08-22T07:59:39.771451Z',
39+
},
2840
status: 'active',
2941
quantity: 10,
3042
recurring: true,
@@ -44,6 +56,18 @@ export const SubscriptionCreatedMock: IEventsResponse<ISubscriptionNotificationR
4456
trial_period: null,
4557
billing_cycle: { interval: 'month', frequency: 1 },
4658
},
59+
product: {
60+
id: 'pro_01h1vjes1y163xfj1rh1tkfb65',
61+
name: 'Voice rooms addon',
62+
status: 'active',
63+
image_url: 'https://paddle-sandbox.s3.amazonaws.com/user/10889/GcZzBjXRfiraensppgtQ_icon2.png',
64+
description:
65+
'Create voice rooms in your chats to work in real time alongside your colleagues. Includes unlimited voice rooms and recording backup for compliance.',
66+
tax_category: 'standard',
67+
type: 'standard',
68+
custom_data: null,
69+
created_at: '2023-08-22T07:59:39.771451Z',
70+
},
4771
status: 'active',
4872
quantity: 1,
4973
recurring: true,
@@ -127,6 +151,20 @@ export const SubscriptionCreatedMockExpectation = {
127151
},
128152
unitPriceOverrides: [],
129153
},
154+
product: {
155+
id: 'pro_01gsz4t5hdjse780zja8vvr7jg',
156+
name: 'ChatApp Pro',
157+
status: 'active',
158+
imageUrl: 'https://paddle-sandbox.s3.amazonaws.com/user/10889/2nmP8MQSret0aWeDemRw_icon1.png',
159+
description:
160+
"Everything in basic, plus access to a suite of powerful tools and features designed to take your team's productivity to the next level.",
161+
taxCategory: 'standard',
162+
type: 'standard',
163+
customData: null,
164+
importMeta: null,
165+
createdAt: '2023-08-22T07:59:39.771451Z',
166+
updatedAt: null,
167+
},
130168
quantity: 10,
131169
recurring: true,
132170
status: 'active',
@@ -159,6 +197,20 @@ export const SubscriptionCreatedMockExpectation = {
159197
},
160198
unitPriceOverrides: [],
161199
},
200+
product: {
201+
id: 'pro_01h1vjes1y163xfj1rh1tkfb65',
202+
name: 'Voice rooms addon',
203+
status: 'active',
204+
imageUrl: 'https://paddle-sandbox.s3.amazonaws.com/user/10889/GcZzBjXRfiraensppgtQ_icon2.png',
205+
description:
206+
'Create voice rooms in your chats to work in real time alongside your colleagues. Includes unlimited voice rooms and recording backup for compliance.',
207+
taxCategory: 'standard',
208+
type: 'standard',
209+
customData: null,
210+
importMeta: null,
211+
createdAt: '2023-08-22T07:59:39.771451Z',
212+
updatedAt: null,
213+
},
162214
quantity: 1,
163215
recurring: true,
164216
status: 'active',

0 commit comments

Comments
 (0)