Skip to content

Commit 4f7d37e

Browse files
author
Dan Billson
authored
feat: add onResume to subscription resume and pause (#96)
* feat: add onResume to subscription resume and pause * test: add simulation partial payload test * chore: bump version to 2.3.0 * docs: update changelog * revert: remove partial simulation tests
1 parent 05abadc commit 4f7d37e

File tree

7 files changed

+24
-3
lines changed

7 files changed

+24
-3
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ 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+
## 2.3.0 - 2025-01-06
16+
17+
### Added
18+
19+
- Added `onResume` property to subscription resume and pause operations to [control billing for subscriptions when resuming](https://developer.paddle.com/changelog/2024/resume-subscription-billing-period-options)
20+
1521
## 2.2.2 - 2024-12-16
1622

1723
### 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": "2.2.2",
3+
"version": "2.3.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.cjs.node.js",
66
"module": "dist/esm/index.esm.node.js",

src/__tests__/resources/subscriptions.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,10 @@ describe('SubscriptionsResource', () => {
165165

166166
test('should resume an existing subscription', async () => {
167167
const subscriptionId = SubscriptionMock.id;
168-
const subscriptionToBeUpdated: ResumeSubscription = { effectiveFrom: 'next_billing_period' };
168+
const subscriptionToBeUpdated: ResumeSubscription = {
169+
effectiveFrom: 'next_billing_period',
170+
onResume: 'continue_existing_billing_period',
171+
};
169172

170173
const paddleInstance = getPaddleTestClient();
171174
paddleInstance.post = jest.fn().mockResolvedValue(SubscriptionMockResponse);

src/enums/subscription/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ export * from './scheduled-change-action.js';
1010
export * from './subscription-status.js';
1111
export * from './subscription-item-status.js';
1212
export * from './subscription-on-payment-failure.js';
13+
export * from './subscription-on-resume.js';
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/**
2+
* ! Autogenerated code !
3+
* Do not make changes to this file.
4+
* Changes may be overwritten as part of auto-generation.
5+
*/
6+
7+
export type SubscriptionOnResume = 'continue_existing_billing_period' | 'start_new_billing_period';

src/resources/subscriptions/operations/pause-subscription-request-object.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
* Changes may be overwritten as part of auto-generation.
55
*/
66

7-
import { type SubscriptionEffectiveFrom } from '../../../enums/index.js';
7+
import { type SubscriptionOnResume, type SubscriptionEffectiveFrom } from '../../../enums/index.js';
88

99
export interface PauseSubscription {
1010
effectiveFrom?: SubscriptionEffectiveFrom | null;
1111
resumeAt?: null | string;
12+
onResume?: SubscriptionOnResume;
1213
}

src/resources/subscriptions/operations/resume-subscription-request-object.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
* Changes may be overwritten as part of auto-generation.
55
*/
66

7+
import { type SubscriptionOnResume } from '../../../enums/index.js';
8+
79
export interface ResumeSubscription {
810
effectiveFrom: 'immediately' | string;
11+
onResume?: SubscriptionOnResume;
912
}

0 commit comments

Comments
 (0)