diff --git a/CHANGELOG.md b/CHANGELOG.md index 919d35e..22d1ac0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/package.json b/package.json index 2de7006..b5c761c 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/__tests__/mocks/resources/subscriptions.mock.ts b/src/__tests__/mocks/resources/subscriptions.mock.ts index 77abe28..7df2696 100644 --- a/src/__tests__/mocks/resources/subscriptions.mock.ts +++ b/src/__tests__/mocks/resources/subscriptions.mock.ts @@ -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: { diff --git a/src/entities/subscription/subscription-discount.ts b/src/entities/subscription/subscription-discount.ts index 561ad21..af18cd4 100644 --- a/src/entities/subscription/subscription-discount.ts +++ b/src/entities/subscription/subscription-discount.ts @@ -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; } } diff --git a/src/types/subscription/subscription-discount-response.ts b/src/types/subscription/subscription-discount-response.ts index 7bf27b6..ebfeb66 100644 --- a/src/types/subscription/subscription-discount-response.ts +++ b/src/types/subscription/subscription-discount-response.ts @@ -6,6 +6,6 @@ export interface ISubscriptionDiscountResponse { id: string; - starts_at: string; + starts_at: string | null; ends_at?: string | null; }