Skip to content

Commit

Permalink
Subscription discount can now be null (#90)
Browse files Browse the repository at this point in the history
* fix: subscription default can now be null

* chore: update changlog entry
  • Loading branch information
danbillson authored Dec 16, 2024
1 parent 9e64617 commit c7cb61a
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 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.2.2 - 2024-12-16

### Fixed

- `discount.startsAt` for Subscriptions can now be `null`

## 2.2.1 - 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.1",
"version": "2.2.2",
"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
4 changes: 2 additions & 2 deletions src/__tests__/mocks/resources/subscriptions.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,8 @@ export const SubscriptionPreviewMock: ISubscriptionPreviewResponse = {
canceled_at: '2024-10-12T07:20:50.52Z',
discount: {
id: 'dsc_01gv5kpg05xp104ek2fmgjwttf',
starts_at: '2024-10-12T07:20:50.52Z',
ends_at: '2024-10-12T07:20:50.52Z',
starts_at: null,
ends_at: null,
},
collection_mode: 'automatic',
billing_details: {
Expand Down
4 changes: 2 additions & 2 deletions src/entities/subscription/subscription-discount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import { type ISubscriptionDiscountResponse } from '../../types/index.js';

export class SubscriptionDiscount {
public readonly id: string;
public readonly startsAt: string;
public readonly startsAt: string | null;
public readonly endsAt: string | null;

constructor(subscriptionDiscount: ISubscriptionDiscountResponse) {
this.id = subscriptionDiscount.id;
this.startsAt = subscriptionDiscount.starts_at;
this.startsAt = subscriptionDiscount.starts_at ?? null;
this.endsAt = subscriptionDiscount.ends_at ?? null;
}
}
2 changes: 1 addition & 1 deletion src/types/subscription/subscription-discount-response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@

export interface ISubscriptionDiscountResponse {
id: string;
starts_at: string;
starts_at: string | null;
ends_at?: string | null;
}

0 comments on commit c7cb61a

Please sign in to comment.