Skip to content

Commit

Permalink
feat: add onResume to subscription resume and pause (#96)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
danbillson authored Jan 6, 2025
1 parent 05abadc commit 4f7d37e
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ When we make [non-breaking changes](https://developer.paddle.com/api-reference/a

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.

## 2.3.0 - 2025-01-06

### Added

- 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)

## 2.2.2 - 2024-12-16

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@paddle/paddle-node-sdk",
"version": "2.2.2",
"version": "2.3.0",
"description": "A Node.js SDK that you can use to integrate Paddle Billing with applications written in server-side JavaScript.",
"main": "dist/cjs/index.cjs.node.js",
"module": "dist/esm/index.esm.node.js",
Expand Down
5 changes: 4 additions & 1 deletion src/__tests__/resources/subscriptions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,10 @@ describe('SubscriptionsResource', () => {

test('should resume an existing subscription', async () => {
const subscriptionId = SubscriptionMock.id;
const subscriptionToBeUpdated: ResumeSubscription = { effectiveFrom: 'next_billing_period' };
const subscriptionToBeUpdated: ResumeSubscription = {
effectiveFrom: 'next_billing_period',
onResume: 'continue_existing_billing_period',
};

const paddleInstance = getPaddleTestClient();
paddleInstance.post = jest.fn().mockResolvedValue(SubscriptionMockResponse);
Expand Down
1 change: 1 addition & 0 deletions src/enums/subscription/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ export * from './scheduled-change-action.js';
export * from './subscription-status.js';
export * from './subscription-item-status.js';
export * from './subscription-on-payment-failure.js';
export * from './subscription-on-resume.js';
7 changes: 7 additions & 0 deletions src/enums/subscription/subscription-on-resume.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* ! Autogenerated code !
* Do not make changes to this file.
* Changes may be overwritten as part of auto-generation.
*/

export type SubscriptionOnResume = 'continue_existing_billing_period' | 'start_new_billing_period';
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
* Changes may be overwritten as part of auto-generation.
*/

import { type SubscriptionEffectiveFrom } from '../../../enums/index.js';
import { type SubscriptionOnResume, type SubscriptionEffectiveFrom } from '../../../enums/index.js';

export interface PauseSubscription {
effectiveFrom?: SubscriptionEffectiveFrom | null;
resumeAt?: null | string;
onResume?: SubscriptionOnResume;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
* Changes may be overwritten as part of auto-generation.
*/

import { type SubscriptionOnResume } from '../../../enums/index.js';

export interface ResumeSubscription {
effectiveFrom: 'immediately' | string;
onResume?: SubscriptionOnResume;
}

0 comments on commit 4f7d37e

Please sign in to comment.