diff --git a/CHANGELOG.md b/CHANGELOG.md index 54334c3..e652497 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,28 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), Check our main [developer changelog](https://developer.paddle.com/?utm_source=dx&utm_medium=paddle-node-sdk) for information about changes to the Paddle Billing platform, the Paddle API, and other developer tools. +### Versioning + +When we make [non-breaking changes](https://developer.paddle.com/api-reference/about/versioning?utm_source=dx&utm_medium=paddle-node-sdk#non-breaking-change) to the Paddle API, we'll only release a new major version of the Node.js SDK when it causes problems at runtime. We won't release a new version of the SDK when we weaken TypeScript types in a way that doesn't cause existing implementations to break or malfunction. For example, if we add a new field to a request or an allowed value for a field in a response, this weakens the Typescript type but does not cause existing usages to stop working. + +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. + + +## 1.1.0 - 2024-03-13 + +### Added + +- Added `createdAt` and `updatedAt` to product and price entities, see [related changelog](https://developer.paddle.com/changelog/2024/product-price-dates?utm_source=dx&utm_medium=paddle-node-sdk). + +### Changed + +- Updated [report API](https://developer.paddle.com/api-reference/reports/create-report?utm_source=dx&utm_medium=paddle-node-sdk) to support `discounts` and `product_prices` report, see [related changelog](https://developer.paddle.com/changelog/2024/product-prices-discounts-reports?utm_source=dx&utm_medium=paddle-node-sdk). + +### Removed + +- Removed `ISharedProductResponse` and `ISharedPriceResponse` interfaces as they were redundant. Please use `IProductResponse` and `IPriceResponse` instead. + +--- ## 1.0.2 - 2024-03-12 diff --git a/README.md b/README.md index 28e4349..a946a2a 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,12 @@ Keep in mind that API keys are separate for your sandbox and live accounts, so y This SDK comes with TypeScript definitions for the Paddle API. We recommend that you update frequently to keep the TypeScript definitions up-to-date with the API. Use `// @ts-ignore` to prevent any type error if you don't want to update. +### Versioning + +When we make [non-breaking changes](https://developer.paddle.com/api-reference/about/versioning?utm_source=dx&utm_medium=paddle-node-sdk#non-breaking-change) to the Paddle API, we'll only release a new major version of the Node.js SDK when it causes problems at runtime. We won't release a new version of the SDK when we weaken TypeScript types in a way that doesn't cause existing implementations to break or malfunction. For example, if we add a new field to a request or an allowed value for a field in a response, this weakens the Typescript type but does not cause existing usages to stop working. + +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. + ## Naming conventions Properties in the Paddle API use `snake_case`. To follow JavaScript conventions, properties in this SDK use `camelCase`. This means: diff --git a/package.json b/package.json index 887f961..76488ea 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@paddle/paddle-node-sdk", - "version": "1.0.2", + "version": "1.1.0", "description": "A Node.js SDK that you can use to integrate Paddle Billing with applications written in server-side JavaScript.", "main": "./dist/index.js", "types": "./dist/index.d.ts", diff --git a/src/__tests__/mocks/notifications/price-created.mock.ts b/src/__tests__/mocks/notifications/price-created.mock.ts index cc1d970..3855218 100644 --- a/src/__tests__/mocks/notifications/price-created.mock.ts +++ b/src/__tests__/mocks/notifications/price-created.mock.ts @@ -4,9 +4,10 @@ * Changes may be overwritten as part of auto-generation. */ -import { type IEventsResponse, type IPriceResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { IPriceNotificationResponse } from '../../../notifications'; -export const PriceCreatedMock: IEventsResponse = { +export const PriceCreatedMock: IEventsResponse = { event_id: 'evt_01h7zd9n8vch227m3dgwqcvf6t', event_type: 'price.created', occurred_at: '2023-08-16T14:51:48.380054Z', @@ -46,6 +47,8 @@ export const PriceCreatedMockExpectation = { minimum: 1, }, status: 'active', + createdAt: null, + updatedAt: null, taxMode: 'account_setting', trialPeriod: { frequency: 3, diff --git a/src/__tests__/mocks/notifications/price-imported.mock.ts b/src/__tests__/mocks/notifications/price-imported.mock.ts index e66eced..68801f7 100644 --- a/src/__tests__/mocks/notifications/price-imported.mock.ts +++ b/src/__tests__/mocks/notifications/price-imported.mock.ts @@ -4,9 +4,10 @@ * Changes may be overwritten as part of auto-generation. */ -import { type IEventsResponse, type IPriceResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { IPriceNotificationResponse } from '../../../notifications'; -export const PriceImportedMock: IEventsResponse = { +export const PriceImportedMock: IEventsResponse = { event_id: 'evt_01hgarz844zdfws6djn9rz6qm7', event_type: 'price.imported', occurred_at: '2023-11-28T10:53:03.492854Z', @@ -49,6 +50,8 @@ export const PriceImportedMockExpectation = { minimum: 1, }, status: 'active', + createdAt: null, + updatedAt: null, taxMode: 'account_setting', trialPeriod: null, type: 'standard', diff --git a/src/__tests__/mocks/notifications/price-updated.mock.ts b/src/__tests__/mocks/notifications/price-updated.mock.ts index b6300b1..41c27d6 100644 --- a/src/__tests__/mocks/notifications/price-updated.mock.ts +++ b/src/__tests__/mocks/notifications/price-updated.mock.ts @@ -4,9 +4,10 @@ * Changes may be overwritten as part of auto-generation. */ -import { type IEventsResponse, type IPriceResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { IPriceNotificationResponse } from '../../../notifications'; -export const PriceUpdatedMock: IEventsResponse = { +export const PriceUpdatedMock: IEventsResponse = { event_id: 'evt_01h83wg1aqxmf897qqb47tre5s', event_type: 'price.updated', occurred_at: '2023-08-18T08:34:23.703674Z', @@ -46,6 +47,8 @@ export const PriceUpdatedMockExpectation = { minimum: 1, }, status: 'active', + createdAt: null, + updatedAt: null, taxMode: 'account_setting', trialPeriod: { frequency: 30, diff --git a/src/__tests__/mocks/notifications/product-created.mock.ts b/src/__tests__/mocks/notifications/product-created.mock.ts index e7afe17..6835ad2 100644 --- a/src/__tests__/mocks/notifications/product-created.mock.ts +++ b/src/__tests__/mocks/notifications/product-created.mock.ts @@ -4,9 +4,10 @@ * Changes may be overwritten as part of auto-generation. */ -import { type IEventsResponse, type IProductResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { IProductNotificationResponse } from '../../../notifications'; -export const ProductCreatedMock: IEventsResponse = { +export const ProductCreatedMock: IEventsResponse = { event_id: 'evt_01h7zcgmnv3ee9cqrj9fpww3mg', event_type: 'product.created', occurred_at: '2023-08-16T14:38:08.571366Z', @@ -45,6 +46,7 @@ export const ProductCreatedMockExpectation = { status: 'active', taxCategory: 'standard', type: 'standard', + updatedAt: null, }, eventId: 'evt_01h7zcgmnv3ee9cqrj9fpww3mg', eventType: 'product.created', diff --git a/src/__tests__/mocks/notifications/product-imported.mock.ts b/src/__tests__/mocks/notifications/product-imported.mock.ts index bb665c4..2559a5b 100644 --- a/src/__tests__/mocks/notifications/product-imported.mock.ts +++ b/src/__tests__/mocks/notifications/product-imported.mock.ts @@ -4,9 +4,10 @@ * Changes may be overwritten as part of auto-generation. */ -import { type IEventsResponse, type IProductResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { IProductNotificationResponse } from '../../../notifications'; -export const ProductImportedMock: IEventsResponse = { +export const ProductImportedMock: IEventsResponse = { event_id: 'evt_01hgas2cm8r02nxryp83jqvg6k', event_type: 'product.imported', occurred_at: '2023-11-28T10:54:46.408439Z', @@ -42,6 +43,7 @@ export const ProductImportedMockExpectation = { status: 'active', taxCategory: 'standard', type: 'standard', + updatedAt: null, }, eventId: 'evt_01hgas2cm8r02nxryp83jqvg6k', eventType: 'product.imported', diff --git a/src/__tests__/mocks/notifications/product-updated.mock.ts b/src/__tests__/mocks/notifications/product-updated.mock.ts index 24bf77b..4ff2395 100644 --- a/src/__tests__/mocks/notifications/product-updated.mock.ts +++ b/src/__tests__/mocks/notifications/product-updated.mock.ts @@ -4,9 +4,10 @@ * Changes may be overwritten as part of auto-generation. */ -import { type IEventsResponse, type IProductResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { IProductNotificationResponse } from '../../../notifications'; -export const ProductUpdatedMock: IEventsResponse = { +export const ProductUpdatedMock: IEventsResponse = { event_id: 'evt_01h7zcr13xte50ncas1jkgpbfk', event_type: 'product.updated', occurred_at: '2023-08-16T14:42:10.685247Z', @@ -45,6 +46,7 @@ export const ProductUpdatedMockExpectation = { status: 'active', taxCategory: 'standard', type: 'standard', + updatedAt: null, }, eventId: 'evt_01h7zcr13xte50ncas1jkgpbfk', eventType: 'product.updated', diff --git a/src/__tests__/mocks/notifications/transaction-billed.mock.ts b/src/__tests__/mocks/notifications/transaction-billed.mock.ts index aa110ef..7757448 100644 --- a/src/__tests__/mocks/notifications/transaction-billed.mock.ts +++ b/src/__tests__/mocks/notifications/transaction-billed.mock.ts @@ -4,9 +4,10 @@ * Changes may be overwritten as part of auto-generation. */ -import { type IEventsResponse, type ITransactionResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { ITransactionNotificationResponse } from '../../../notifications'; -export const TransactionBilledMock: IEventsResponse = { +export const TransactionBilledMock: IEventsResponse = { event_id: 'evt_01h8e3a5029s6xrd5qj89beawp', event_type: 'transaction.billed', occurred_at: '2023-08-22T07:45:55.202630Z', @@ -240,6 +241,7 @@ export const TransactionBilledMockExpectation = { status: 'active', taxCategory: 'standard', type: 'standard', + updatedAt: null, }, proration: null, quantity: 20, @@ -272,6 +274,7 @@ export const TransactionBilledMockExpectation = { status: 'active', taxCategory: 'standard', type: 'standard', + updatedAt: null, }, proration: null, quantity: 1, @@ -304,6 +307,7 @@ export const TransactionBilledMockExpectation = { status: 'active', taxCategory: 'standard', type: 'standard', + updatedAt: null, }, proration: null, quantity: 1, @@ -359,6 +363,7 @@ export const TransactionBilledMockExpectation = { frequency: 1, interval: 'year', }, + createdAt: null, customData: null, description: 'Annual (per seat)', id: 'pri_01gsz91wy9k1yn7kx82aafwvea', @@ -378,6 +383,7 @@ export const TransactionBilledMockExpectation = { currencyCode: 'USD', }, unitPriceOverrides: [], + updatedAt: null, }, proration: null, quantity: 20, @@ -388,6 +394,7 @@ export const TransactionBilledMockExpectation = { frequency: 1, interval: 'year', }, + createdAt: null, customData: null, description: 'Annual (recurring addon)', id: 'pri_01gsz96z29d88jrmsf2ztbfgjg', @@ -407,6 +414,7 @@ export const TransactionBilledMockExpectation = { currencyCode: 'USD', }, unitPriceOverrides: [], + updatedAt: null, }, proration: null, quantity: 1, @@ -414,6 +422,7 @@ export const TransactionBilledMockExpectation = { { price: { billingCycle: null, + createdAt: null, customData: null, description: 'One-time charge', id: 'pri_01gsz98e27ak2tyhexptwc58yk', @@ -441,6 +450,7 @@ export const TransactionBilledMockExpectation = { }, }, ], + updatedAt: null, }, proration: null, quantity: 1, diff --git a/src/__tests__/mocks/notifications/transaction-canceled.mock.ts b/src/__tests__/mocks/notifications/transaction-canceled.mock.ts index d975ea7..5adb309 100644 --- a/src/__tests__/mocks/notifications/transaction-canceled.mock.ts +++ b/src/__tests__/mocks/notifications/transaction-canceled.mock.ts @@ -4,9 +4,10 @@ * Changes may be overwritten as part of auto-generation. */ -import { type IEventsResponse, type ITransactionResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { ITransactionNotificationResponse } from '../../../notifications'; -export const TransactionCanceledMock: IEventsResponse = { +export const TransactionCanceledMock: IEventsResponse = { event_id: 'evt_01h8e3dvbz4y98ge4q3raptg16', event_type: 'transaction.canceled', occurred_at: '2023-08-22T07:47:56.415447Z', @@ -240,6 +241,7 @@ export const TransactionCanceledMockExpectation = { status: 'active', taxCategory: 'standard', type: 'standard', + updatedAt: null, }, proration: null, quantity: 20, @@ -272,6 +274,7 @@ export const TransactionCanceledMockExpectation = { status: 'active', taxCategory: 'standard', type: 'standard', + updatedAt: null, }, proration: null, quantity: 1, @@ -304,6 +307,7 @@ export const TransactionCanceledMockExpectation = { status: 'active', taxCategory: 'standard', type: 'standard', + updatedAt: null, }, proration: null, quantity: 1, @@ -359,6 +363,7 @@ export const TransactionCanceledMockExpectation = { frequency: 1, interval: 'year', }, + createdAt: null, customData: null, description: 'Annual (per seat)', id: 'pri_01gsz91wy9k1yn7kx82aafwvea', @@ -378,6 +383,7 @@ export const TransactionCanceledMockExpectation = { currencyCode: 'USD', }, unitPriceOverrides: [], + updatedAt: null, }, proration: null, quantity: 20, @@ -388,6 +394,7 @@ export const TransactionCanceledMockExpectation = { frequency: 1, interval: 'year', }, + createdAt: null, customData: null, description: 'Annual (recurring addon)', id: 'pri_01gsz96z29d88jrmsf2ztbfgjg', @@ -407,6 +414,7 @@ export const TransactionCanceledMockExpectation = { currencyCode: 'USD', }, unitPriceOverrides: [], + updatedAt: null, }, proration: null, quantity: 1, @@ -414,6 +422,7 @@ export const TransactionCanceledMockExpectation = { { price: { billingCycle: null, + createdAt: null, customData: null, description: 'One-time charge', id: 'pri_01gsz98e27ak2tyhexptwc58yk', @@ -441,6 +450,7 @@ export const TransactionCanceledMockExpectation = { }, }, ], + updatedAt: null, }, proration: null, quantity: 1, diff --git a/src/__tests__/mocks/notifications/transaction-completed.mock.ts b/src/__tests__/mocks/notifications/transaction-completed.mock.ts index 1adce4b..cef7ced 100644 --- a/src/__tests__/mocks/notifications/transaction-completed.mock.ts +++ b/src/__tests__/mocks/notifications/transaction-completed.mock.ts @@ -284,6 +284,7 @@ export const TransactionCompletedMockExpectation = { status: 'active', taxCategory: 'standard', type: 'standard', + updatedAt: null, }, proration: null, quantity: 10, @@ -316,6 +317,7 @@ export const TransactionCompletedMockExpectation = { status: 'active', taxCategory: 'standard', type: 'standard', + updatedAt: null, }, proration: null, quantity: 1, @@ -348,6 +350,7 @@ export const TransactionCompletedMockExpectation = { status: 'active', taxCategory: 'standard', type: 'standard', + updatedAt: null, }, proration: null, quantity: 1, @@ -415,6 +418,7 @@ export const TransactionCompletedMockExpectation = { frequency: 1, interval: 'month', }, + createdAt: null, customData: null, description: 'Monthly (per seat)', id: 'pri_01gsz8x8sawmvhz1pv30nge1ke', @@ -442,6 +446,7 @@ export const TransactionCompletedMockExpectation = { }, }, ], + updatedAt: null, }, proration: null, quantity: 10, @@ -452,6 +457,7 @@ export const TransactionCompletedMockExpectation = { frequency: 1, interval: 'month', }, + createdAt: null, customData: null, description: 'Monthly (recurring addon)', id: 'pri_01h1vjfevh5etwq3rb416a23h2', @@ -479,6 +485,7 @@ export const TransactionCompletedMockExpectation = { }, }, ], + updatedAt: null, }, proration: null, quantity: 1, @@ -486,6 +493,7 @@ export const TransactionCompletedMockExpectation = { { price: { billingCycle: null, + createdAt: null, customData: null, description: 'One-time charge', id: 'pri_01gsz98e27ak2tyhexptwc58yk', @@ -513,6 +521,7 @@ export const TransactionCompletedMockExpectation = { }, }, ], + updatedAt: null, }, proration: null, quantity: 1, diff --git a/src/__tests__/mocks/notifications/transaction-created.mock.ts b/src/__tests__/mocks/notifications/transaction-created.mock.ts index 7388402..fd208c5 100644 --- a/src/__tests__/mocks/notifications/transaction-created.mock.ts +++ b/src/__tests__/mocks/notifications/transaction-created.mock.ts @@ -4,9 +4,10 @@ * Changes may be overwritten as part of auto-generation. */ -import { type IEventsResponse, type ITransactionResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { ITransactionNotificationResponse } from '../../../notifications'; -export const TransactionCreatedMock: IEventsResponse = { +export const TransactionCreatedMock: IEventsResponse = { event_id: 'evt_01h8dzxgzb5af0yzd0mv5v11e2', event_type: 'transaction.created', occurred_at: '2023-08-22T06:46:35.755631Z', @@ -212,6 +213,7 @@ export const TransactionCreatedMockExpectation = { status: 'active', taxCategory: 'standard', type: 'standard', + updatedAt: null, }, proration: null, quantity: 10, @@ -244,6 +246,7 @@ export const TransactionCreatedMockExpectation = { status: 'active', taxCategory: 'standard', type: 'standard', + updatedAt: null, }, proration: null, quantity: 1, @@ -276,6 +279,7 @@ export const TransactionCreatedMockExpectation = { status: 'active', taxCategory: 'standard', type: 'standard', + updatedAt: null, }, proration: null, quantity: 1, @@ -331,6 +335,7 @@ export const TransactionCreatedMockExpectation = { frequency: 1, interval: 'month', }, + createdAt: null, customData: null, description: 'Monthly (per seat)', id: 'pri_01gsz8x8sawmvhz1pv30nge1ke', @@ -358,6 +363,7 @@ export const TransactionCreatedMockExpectation = { }, }, ], + updatedAt: null, }, proration: null, quantity: 10, @@ -368,6 +374,7 @@ export const TransactionCreatedMockExpectation = { frequency: 1, interval: 'month', }, + createdAt: null, customData: null, description: 'Monthly (recurring addon)', id: 'pri_01h1vjfevh5etwq3rb416a23h2', @@ -395,6 +402,7 @@ export const TransactionCreatedMockExpectation = { }, }, ], + updatedAt: null, }, proration: null, quantity: 1, @@ -402,6 +410,7 @@ export const TransactionCreatedMockExpectation = { { price: { billingCycle: null, + createdAt: null, customData: null, description: 'One-time charge', id: 'pri_01gsz98e27ak2tyhexptwc58yk', @@ -429,6 +438,7 @@ export const TransactionCreatedMockExpectation = { }, }, ], + updatedAt: null, }, proration: null, quantity: 1, diff --git a/src/__tests__/mocks/notifications/transaction-paid.mock.ts b/src/__tests__/mocks/notifications/transaction-paid.mock.ts index a93014c..37fd34d 100644 --- a/src/__tests__/mocks/notifications/transaction-paid.mock.ts +++ b/src/__tests__/mocks/notifications/transaction-paid.mock.ts @@ -235,6 +235,7 @@ export const TransactionPaidMockExpectation = { status: 'active', taxCategory: 'standard', type: 'standard', + updatedAt: null, }, proration: null, quantity: 10, @@ -267,6 +268,7 @@ export const TransactionPaidMockExpectation = { status: 'active', taxCategory: 'standard', type: 'standard', + updatedAt: null, }, proration: null, quantity: 1, @@ -299,6 +301,7 @@ export const TransactionPaidMockExpectation = { status: 'active', taxCategory: 'standard', type: 'standard', + updatedAt: null, }, proration: null, quantity: 1, @@ -354,6 +357,7 @@ export const TransactionPaidMockExpectation = { frequency: 1, interval: 'month', }, + createdAt: null, customData: null, description: 'Monthly (per seat)', id: 'pri_01gsz8x8sawmvhz1pv30nge1ke', @@ -373,6 +377,7 @@ export const TransactionPaidMockExpectation = { currencyCode: 'GBP', }, unitPriceOverrides: [], + updatedAt: null, }, proration: null, quantity: 10, @@ -383,6 +388,7 @@ export const TransactionPaidMockExpectation = { frequency: 1, interval: 'month', }, + createdAt: null, customData: null, description: 'Monthly (recurring addon)', id: 'pri_01gsz95g2zrkagg294kpstx54r', @@ -402,6 +408,7 @@ export const TransactionPaidMockExpectation = { currencyCode: 'GBP', }, unitPriceOverrides: [], + updatedAt: null, }, proration: null, quantity: 1, @@ -409,6 +416,7 @@ export const TransactionPaidMockExpectation = { { price: { billingCycle: null, + createdAt: null, customData: null, description: 'One-time charge', id: 'pri_01gsz98e27ak2tyhexptwc58yk', @@ -428,6 +436,7 @@ export const TransactionPaidMockExpectation = { currencyCode: 'GBP', }, unitPriceOverrides: [], + updatedAt: null, }, proration: null, quantity: 1, diff --git a/src/__tests__/mocks/notifications/transaction-past-due.mock.ts b/src/__tests__/mocks/notifications/transaction-past-due.mock.ts index 15b2cec..a6cc5d8 100644 --- a/src/__tests__/mocks/notifications/transaction-past-due.mock.ts +++ b/src/__tests__/mocks/notifications/transaction-past-due.mock.ts @@ -206,6 +206,7 @@ export const TransactionPastDueMockExpectation = { status: 'active', taxCategory: 'standard', type: 'standard', + updatedAt: null, }, proration: null, quantity: 10, @@ -238,6 +239,7 @@ export const TransactionPastDueMockExpectation = { status: 'active', taxCategory: 'standard', type: 'standard', + updatedAt: null, }, proration: null, quantity: 1, @@ -293,6 +295,7 @@ export const TransactionPastDueMockExpectation = { frequency: 1, interval: 'month', }, + createdAt: null, customData: null, description: 'Monthly (per seat)', id: 'pri_01gsz8x8sawmvhz1pv30nge1ke', @@ -320,6 +323,7 @@ export const TransactionPastDueMockExpectation = { }, }, ], + updatedAt: null, }, proration: null, quantity: 10, @@ -330,6 +334,7 @@ export const TransactionPastDueMockExpectation = { frequency: 1, interval: 'month', }, + createdAt: null, customData: null, description: 'Monthly (recurring addon)', id: 'pri_01h1vjfevh5etwq3rb416a23h2', @@ -357,6 +362,7 @@ export const TransactionPastDueMockExpectation = { }, }, ], + updatedAt: null, }, proration: null, quantity: 1, diff --git a/src/__tests__/mocks/notifications/transaction-payment-failed.mock.ts b/src/__tests__/mocks/notifications/transaction-payment-failed.mock.ts index 51fe703..22c5efb 100644 --- a/src/__tests__/mocks/notifications/transaction-payment-failed.mock.ts +++ b/src/__tests__/mocks/notifications/transaction-payment-failed.mock.ts @@ -241,6 +241,7 @@ export const TransactionPaymentFailedMockExpectation = { status: 'active', taxCategory: 'standard', type: 'standard', + updatedAt: null, }, proration: null, quantity: 10, @@ -273,6 +274,7 @@ export const TransactionPaymentFailedMockExpectation = { status: 'active', taxCategory: 'standard', type: 'standard', + updatedAt: null, }, proration: null, quantity: 1, @@ -305,6 +307,7 @@ export const TransactionPaymentFailedMockExpectation = { status: 'active', taxCategory: 'standard', type: 'standard', + updatedAt: null, }, proration: null, quantity: 1, @@ -360,6 +363,7 @@ export const TransactionPaymentFailedMockExpectation = { frequency: 1, interval: 'month', }, + createdAt: null, customData: null, description: 'Monthly (per seat)', id: 'pri_01gsz8x8sawmvhz1pv30nge1ke', @@ -387,6 +391,7 @@ export const TransactionPaymentFailedMockExpectation = { }, }, ], + updatedAt: null, }, proration: null, quantity: 10, @@ -397,6 +402,7 @@ export const TransactionPaymentFailedMockExpectation = { frequency: 1, interval: 'month', }, + createdAt: null, customData: null, description: 'Monthly (recurring addon)', id: 'pri_01h1vjfevh5etwq3rb416a23h2', @@ -424,6 +430,7 @@ export const TransactionPaymentFailedMockExpectation = { }, }, ], + updatedAt: null, }, proration: null, quantity: 1, @@ -431,6 +438,7 @@ export const TransactionPaymentFailedMockExpectation = { { price: { billingCycle: null, + createdAt: null, customData: null, description: 'One-time charge', id: 'pri_01gsz98e27ak2tyhexptwc58yk', @@ -458,6 +466,7 @@ export const TransactionPaymentFailedMockExpectation = { }, }, ], + updatedAt: null, }, proration: null, quantity: 1, diff --git a/src/__tests__/mocks/notifications/transaction-ready.mock.ts b/src/__tests__/mocks/notifications/transaction-ready.mock.ts index f3ab6f9..cb7ac75 100644 --- a/src/__tests__/mocks/notifications/transaction-ready.mock.ts +++ b/src/__tests__/mocks/notifications/transaction-ready.mock.ts @@ -226,6 +226,7 @@ export const TransactionReadyMockExpectation = { status: 'active', taxCategory: 'standard', type: 'standard', + updatedAt: null, }, proration: null, quantity: 10, @@ -258,6 +259,7 @@ export const TransactionReadyMockExpectation = { status: 'active', taxCategory: 'standard', type: 'standard', + updatedAt: null, }, proration: null, quantity: 1, @@ -290,6 +292,7 @@ export const TransactionReadyMockExpectation = { status: 'active', taxCategory: 'standard', type: 'standard', + updatedAt: null, }, proration: null, quantity: 1, @@ -345,6 +348,7 @@ export const TransactionReadyMockExpectation = { frequency: 1, interval: 'month', }, + createdAt: null, customData: null, description: 'Monthly (per seat)', id: 'pri_01gsz8x8sawmvhz1pv30nge1ke', @@ -372,6 +376,7 @@ export const TransactionReadyMockExpectation = { }, }, ], + updatedAt: null, }, proration: null, quantity: 10, @@ -382,6 +387,7 @@ export const TransactionReadyMockExpectation = { frequency: 1, interval: 'month', }, + createdAt: null, customData: null, description: 'Monthly (recurring addon)', id: 'pri_01h1vjfevh5etwq3rb416a23h2', @@ -409,6 +415,7 @@ export const TransactionReadyMockExpectation = { }, }, ], + updatedAt: null, }, proration: null, quantity: 1, @@ -416,6 +423,7 @@ export const TransactionReadyMockExpectation = { { price: { billingCycle: null, + createdAt: null, customData: null, description: 'One-time charge', id: 'pri_01gsz98e27ak2tyhexptwc58yk', @@ -443,6 +451,7 @@ export const TransactionReadyMockExpectation = { }, }, ], + updatedAt: null, }, proration: null, quantity: 1, diff --git a/src/__tests__/mocks/notifications/transaction-updated.mock.ts b/src/__tests__/mocks/notifications/transaction-updated.mock.ts index 3d382b6..f97363b 100644 --- a/src/__tests__/mocks/notifications/transaction-updated.mock.ts +++ b/src/__tests__/mocks/notifications/transaction-updated.mock.ts @@ -240,6 +240,7 @@ export const TransactionUpdatedMockExpectation = { status: 'active', taxCategory: 'standard', type: 'standard', + updatedAt: null, }, proration: null, quantity: 50, @@ -272,6 +273,7 @@ export const TransactionUpdatedMockExpectation = { status: 'active', taxCategory: 'standard', type: 'standard', + updatedAt: null, }, proration: null, quantity: 1, @@ -304,6 +306,7 @@ export const TransactionUpdatedMockExpectation = { status: 'active', taxCategory: 'standard', type: 'standard', + updatedAt: null, }, proration: null, quantity: 1, @@ -359,6 +362,7 @@ export const TransactionUpdatedMockExpectation = { frequency: 1, interval: 'year', }, + createdAt: null, customData: null, description: 'Annual (per seat)', id: 'pri_01gsz91wy9k1yn7kx82aafwvea', @@ -378,6 +382,7 @@ export const TransactionUpdatedMockExpectation = { currencyCode: 'USD', }, unitPriceOverrides: [], + updatedAt: null, }, proration: null, quantity: 50, @@ -388,6 +393,7 @@ export const TransactionUpdatedMockExpectation = { frequency: 1, interval: 'year', }, + createdAt: null, customData: null, description: 'Annual (recurring addon)', id: 'pri_01gsz96z29d88jrmsf2ztbfgjg', @@ -407,6 +413,7 @@ export const TransactionUpdatedMockExpectation = { currencyCode: 'USD', }, unitPriceOverrides: [], + updatedAt: null, }, proration: null, quantity: 1, @@ -414,6 +421,7 @@ export const TransactionUpdatedMockExpectation = { { price: { billingCycle: null, + createdAt: null, customData: null, description: 'One-time charge', id: 'pri_01gsz98e27ak2tyhexptwc58yk', @@ -441,6 +449,7 @@ export const TransactionUpdatedMockExpectation = { }, }, ], + updatedAt: null, }, proration: null, quantity: 1, diff --git a/src/__tests__/mocks/resources/prices.mock.ts b/src/__tests__/mocks/resources/prices.mock.ts index c70f28f..7ea9008 100644 --- a/src/__tests__/mocks/resources/prices.mock.ts +++ b/src/__tests__/mocks/resources/prices.mock.ts @@ -78,6 +78,8 @@ export const PriceMock: IPriceResponse = { status: 'active', custom_data: { customer_reference_id: 'abcd1234' }, import_meta: { external_id: '9b95b0b8-e10f-441a-862e-1936a6d818ab', imported_from: 'billing_platform' }, + created_at: '2024-10-12T07:20:50.52Z', + updated_at: '2024-10-12T07:20:50.52Z', }; export const PriceMockResponse: Response = { diff --git a/src/__tests__/mocks/resources/pricing-preview.mock.ts b/src/__tests__/mocks/resources/pricing-preview.mock.ts index 1350a61..3650cec 100644 --- a/src/__tests__/mocks/resources/pricing-preview.mock.ts +++ b/src/__tests__/mocks/resources/pricing-preview.mock.ts @@ -73,6 +73,8 @@ export const PricingPreviewMock: IPricingPreviewResponse = { status: 'active', custom_data: { customer_reference_id: 'abcd1234' }, import_meta: { external_id: '9b95b0b8-e10f-441a-862e-1936a6d818ab', imported_from: 'billing_platform' }, + created_at: '2024-10-12T07:20:50.52Z', + updated_at: '2024-10-12T07:20:50.52Z', }, formatted_totals: { discount: '£0', @@ -96,6 +98,7 @@ export const PricingPreviewMock: IPricingPreviewResponse = { custom_data: { customer_reference_id: 'abcd1234' }, status: 'active', created_at: '2024-10-12T07:20:50.52Z', + updated_at: '2024-10-12T07:20:50.52Z', }, quantity: 10, tax_rate: '10', diff --git a/src/__tests__/mocks/resources/products.mock.ts b/src/__tests__/mocks/resources/products.mock.ts index 9d217d0..0eaf956 100644 --- a/src/__tests__/mocks/resources/products.mock.ts +++ b/src/__tests__/mocks/resources/products.mock.ts @@ -49,6 +49,7 @@ export const ProductMock: IProductResponse = { status: 'active', created_at: '2024-10-12T07:20:50.52Z', import_meta: { external_id: '9b95b0b8-e10f-441a-862e-1936a6d818ab', imported_from: 'billing_platform' }, + updated_at: '2024-10-12T07:20:50.52Z', }; export const ProductMockResponse: Response = { diff --git a/src/__tests__/mocks/resources/subscriptions.mock.ts b/src/__tests__/mocks/resources/subscriptions.mock.ts index c7bd0d0..7ae2141 100644 --- a/src/__tests__/mocks/resources/subscriptions.mock.ts +++ b/src/__tests__/mocks/resources/subscriptions.mock.ts @@ -153,6 +153,8 @@ export const SubscriptionMock: ISubscriptionResponse = { maximum: 999, }, import_meta: null, + created_at: '2024-10-12T07:20:50.52Z', + updated_at: '2024-10-12T07:20:50.52Z', }, }, ], @@ -248,6 +250,7 @@ export const SubscriptionMock: ISubscriptionResponse = { custom_data: { customer_reference_id: 'abcd1234' }, status: 'active', created_at: '2024-10-12T07:20:50.52Z', + updated_at: '2024-10-12T07:20:50.52Z', }, }, ], @@ -305,6 +308,7 @@ export const SubscriptionMock: ISubscriptionResponse = { custom_data: { customer_reference_id: 'abcd1234' }, status: 'active', created_at: '2024-10-12T07:20:50.52Z', + updated_at: '2024-10-12T07:20:50.52Z', }, }, ], @@ -387,6 +391,8 @@ export const SubscriptionPreviewMock: ISubscriptionPreviewResponse = { maximum: 999, }, import_meta: null, + created_at: '2024-10-12T07:20:50.52Z', + updated_at: '2024-10-12T07:20:50.52Z', }, }, ], @@ -482,6 +488,7 @@ export const SubscriptionPreviewMock: ISubscriptionPreviewResponse = { custom_data: { customer_reference_id: 'abcd1234' }, status: 'active', created_at: '2024-10-12T07:20:50.52Z', + updated_at: '2024-10-12T07:20:50.52Z', }, }, ], diff --git a/src/__tests__/mocks/resources/transactions.mock.ts b/src/__tests__/mocks/resources/transactions.mock.ts index fe47d85..4b063c2 100644 --- a/src/__tests__/mocks/resources/transactions.mock.ts +++ b/src/__tests__/mocks/resources/transactions.mock.ts @@ -231,6 +231,7 @@ export const TransactionMock: ITransactionResponse = { status: 'active', created_at: '2024-10-12T07:20:50.52Z', import_meta: { external_id: '9b95b0b8-e10f-441a-862e-1936a6d818ab', imported_from: 'billing_platform' }, + updated_at: '2024-10-12T07:20:50.52Z', }, }, ], @@ -395,6 +396,7 @@ export const TransactionPreviewMock: ITransactionPreviewResponse = { custom_data: { customer_reference_id: 'abcd1234' }, status: 'active', created_at: '2024-10-12T07:20:50.52Z', + updated_at: '2024-10-12T07:20:50.52Z', import_meta: { external_id: '9b95b0b8-e10f-441a-862e-1936a6d818ab', imported_from: 'billing_platform' }, }, }, diff --git a/src/entities/price/price.ts b/src/entities/price/price.ts index b0985de..0613248 100644 --- a/src/entities/price/price.ts +++ b/src/entities/price/price.ts @@ -21,6 +21,8 @@ export class Price { public readonly unitPriceOverrides: UnitPriceOverride[]; public readonly quantity: PriceQuantity; public readonly status: Status; + public readonly createdAt: string; + public readonly updatedAt: string; public readonly customData: ICustomData | null; public readonly importMeta: ImportMeta | null; public readonly product: Product | null; @@ -40,6 +42,8 @@ export class Price { ); this.quantity = new PriceQuantity(price.quantity); this.status = price.status; + this.createdAt = price.created_at; + this.updatedAt = price.updated_at; this.customData = price.custom_data ? price.custom_data : null; this.importMeta = price.import_meta ? new ImportMeta(price.import_meta) : null; this.product = price.product ? new Product(price.product) : null; diff --git a/src/entities/product/product.ts b/src/entities/product/product.ts index ba61a8d..895e5f2 100644 --- a/src/entities/product/product.ts +++ b/src/entities/product/product.ts @@ -18,6 +18,7 @@ export class Product { public readonly customData: CustomData | null; public readonly status: Status; public readonly createdAt: string; + public readonly updatedAt: string; public readonly importMeta: ImportMeta | null; public readonly prices: Price[] | null; @@ -31,6 +32,7 @@ export class Product { this.customData = product.custom_data ? product.custom_data : null; this.status = product.status; this.createdAt = product.created_at; + this.updatedAt = product.updated_at; this.importMeta = product.import_meta ? new ImportMeta(product.import_meta) : null; this.prices = product.prices ? product.prices.map((price) => new Price(price)) : null; } diff --git a/src/enums/report/report-filter-name.ts b/src/enums/report/report-filter-name.ts index fac20c3..8a0d4cd 100644 --- a/src/enums/report/report-filter-name.ts +++ b/src/enums/report/report-filter-name.ts @@ -4,4 +4,17 @@ * Changes may be overwritten as part of auto-generation. */ -export type ReportFilterName = 'action' | 'collection_mode' | 'currency_code' | 'origin' | 'status' | 'updated_at'; +export type ReportFilterName = + | 'action' + | 'collection_mode' + | 'currency_code' + | 'origin' + | 'status' + | 'updated_at' + | 'type' + | 'product_status' + | 'price_status' + | 'product_type' + | 'price_type' + | 'product_updated_at' + | 'price_updated_at'; diff --git a/src/enums/report/report-type.ts b/src/enums/report/report-type.ts index 2c8cbed..4fe2523 100644 --- a/src/enums/report/report-type.ts +++ b/src/enums/report/report-type.ts @@ -4,4 +4,10 @@ * Changes may be overwritten as part of auto-generation. */ -export type ReportType = 'adjustments' | 'adjustment_line_items' | 'transactions' | 'transaction_line_items'; +export type ReportType = + | 'adjustments' + | 'adjustment_line_items' + | 'transactions' + | 'transaction_line_items' + | 'discounts' + | 'products_prices'; diff --git a/src/notifications/entities/price/price-notification.ts b/src/notifications/entities/price/price-notification.ts index d931fda..70c1e32 100644 --- a/src/notifications/entities/price/price-notification.ts +++ b/src/notifications/entities/price/price-notification.ts @@ -28,6 +28,8 @@ export class PriceNotification { public readonly unitPriceOverrides: UnitPriceOverrideNotification[]; public readonly quantity: PriceQuantityNotification; public readonly status: Status; + public readonly createdAt: string | null; + public readonly updatedAt: string | null; public readonly customData: ICustomData | null; public readonly importMeta: ImportMetaNotification | null; @@ -46,6 +48,8 @@ export class PriceNotification { ); this.quantity = new PriceQuantityNotification(price.quantity); this.status = price.status; + this.createdAt = price.created_at ?? null; + this.updatedAt = price.updated_at ?? null; this.customData = price.custom_data ? price.custom_data : null; this.importMeta = price.import_meta ? new ImportMetaNotification(price.import_meta) : null; } diff --git a/src/notifications/entities/product/product-notification.ts b/src/notifications/entities/product/product-notification.ts index e14880d..6b34613 100644 --- a/src/notifications/entities/product/product-notification.ts +++ b/src/notifications/entities/product/product-notification.ts @@ -19,6 +19,7 @@ export class ProductNotification { public readonly customData: CustomData | null; public readonly status: Status; public readonly createdAt: string; + public readonly updatedAt: string | null; public readonly importMeta: ImportMetaNotification | null; constructor(product: ISharedProductNotificationResponse) { @@ -31,6 +32,7 @@ export class ProductNotification { this.customData = product.custom_data ? product.custom_data : null; this.status = product.status; this.createdAt = product.created_at; + this.updatedAt = product.updated_at ?? null; this.importMeta = product.import_meta ? new ImportMetaNotification(product.import_meta) : null; } } diff --git a/src/notifications/types/price/price-notification-response.ts b/src/notifications/types/price/price-notification-response.ts index b20685b..25d1118 100644 --- a/src/notifications/types/price/price-notification-response.ts +++ b/src/notifications/types/price/price-notification-response.ts @@ -28,6 +28,8 @@ export interface IPriceNotificationResponse { unit_price_overrides: IUnitPriceOverrideNotificationResponse[]; quantity: IPriceQuantityNotification; status: Status; + created_at?: string | null; + updated_at?: string | null; custom_data?: ICustomData | null; import_meta?: IImportMetaNotificationResponse | null; product?: ISharedProductNotificationResponse | null; diff --git a/src/notifications/types/shared/shared-product-notification-response.ts b/src/notifications/types/shared/shared-product-notification-response.ts index d110daf..1b38e07 100644 --- a/src/notifications/types/shared/shared-product-notification-response.ts +++ b/src/notifications/types/shared/shared-product-notification-response.ts @@ -18,5 +18,6 @@ export interface ISharedProductNotificationResponse { custom_data?: ICustomData | null; status: Status; created_at: string; + updated_at?: string | null; import_meta?: IImportMetaNotificationResponse | null; } diff --git a/src/types/price/price-response.ts b/src/types/price/price-response.ts index e2abef0..2e2487b 100644 --- a/src/types/price/price-response.ts +++ b/src/types/price/price-response.ts @@ -5,15 +5,15 @@ */ import { - type ITimePeriod, - type IMoneyResponse, - type IUnitPriceOverrideResponse, - type IPriceQuantity, type ICustomData, - type ISharedProductResponse, type IImportMetaResponse, + type IMoneyResponse, + type IPriceQuantity, + type IProductResponse, + type ITimePeriod, + type IUnitPriceOverrideResponse, } from '../index'; -import { type TaxMode, type Status, type CatalogType } from '../../enums'; +import { type CatalogType, type Status, type TaxMode } from '../../enums'; export interface IPriceResponse { id: string; @@ -28,7 +28,9 @@ export interface IPriceResponse { unit_price_overrides: IUnitPriceOverrideResponse[]; quantity: IPriceQuantity; status: Status; + created_at: string; + updated_at: string; custom_data?: ICustomData | null; import_meta?: IImportMetaResponse | null; - product?: ISharedProductResponse | null; + product?: IProductResponse | null; } diff --git a/src/types/product/product-response.ts b/src/types/product/product-response.ts index 17f61b7..2240516 100644 --- a/src/types/product/product-response.ts +++ b/src/types/product/product-response.ts @@ -4,8 +4,8 @@ * Changes may be overwritten as part of auto-generation. */ -import { type ICustomData, type IImportMetaResponse, type ISharedPriceResponse } from '../index'; -import { type TaxCategory, type Status, type CatalogType } from '../../enums'; +import { type ICustomData, type IImportMetaResponse, type IPriceResponse } from '../index'; +import { type CatalogType, type Status, type TaxCategory } from '../../enums'; export interface IProductResponse { id: string; @@ -17,6 +17,7 @@ export interface IProductResponse { custom_data?: ICustomData | null; status: Status; created_at: string; + updated_at: string; import_meta?: IImportMetaResponse | null; - prices?: ISharedPriceResponse[] | null; + prices?: IPriceResponse[] | null; } diff --git a/src/types/shared/index.ts b/src/types/shared/index.ts index 37808f2..0b322fe 100644 --- a/src/types/shared/index.ts +++ b/src/types/shared/index.ts @@ -10,8 +10,6 @@ export * from './money-response'; export * from './unit-price-override'; export * from './unit-price-override-response'; export * from './price-quantity'; -export * from './shared-price-response'; -export * from './shared-product-response'; export * from './billing-details-response'; export * from './totals'; export * from './tax-rates-used-response'; diff --git a/src/types/shared/shared-price-response.ts b/src/types/shared/shared-price-response.ts deleted file mode 100644 index c79afc2..0000000 --- a/src/types/shared/shared-price-response.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * ! Autogenerated code ! - * Do not make changes to this file. - * Changes may be overwritten as part of auto-generation. - */ - -import { - type ITimePeriod, - type IMoneyResponse, - type IUnitPriceOverrideResponse, - type IPriceQuantity, - type ICustomData, - type IImportMetaResponse, -} from '../index'; -import { type TaxMode, type Status, type CatalogType } from '../../enums'; - -export interface ISharedPriceResponse { - id: string; - product_id: string; - description: string; - type: CatalogType; - name?: string | null; - billing_cycle?: ITimePeriod | null; - trial_period?: ITimePeriod | null; - tax_mode: TaxMode; - unit_price: IMoneyResponse; - unit_price_overrides: IUnitPriceOverrideResponse[]; - quantity: IPriceQuantity; - status: Status; - custom_data?: ICustomData | null; - import_meta?: IImportMetaResponse | null; -} diff --git a/src/types/shared/shared-product-response.ts b/src/types/shared/shared-product-response.ts deleted file mode 100644 index ddce81f..0000000 --- a/src/types/shared/shared-product-response.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * ! Autogenerated code ! - * Do not make changes to this file. - * Changes may be overwritten as part of auto-generation. - */ - -import { type ICustomData, type IImportMetaResponse } from '../index'; -import { type TaxCategory, type Status, type CatalogType } from '../../enums'; - -export interface ISharedProductResponse { - id: string; - name: string; - type?: CatalogType | null; - description?: string | null; - tax_category: TaxCategory; - image_url?: string | null; - custom_data?: ICustomData | null; - status: Status; - created_at: string; - import_meta?: IImportMetaResponse | null; -} diff --git a/src/types/shared/transaction-line-item-preview-response.ts b/src/types/shared/transaction-line-item-preview-response.ts index d041dd7..123fbe6 100644 --- a/src/types/shared/transaction-line-item-preview-response.ts +++ b/src/types/shared/transaction-line-item-preview-response.ts @@ -4,7 +4,7 @@ * Changes may be overwritten as part of auto-generation. */ -import { type IUnitTotals, type ITotals, type ISharedProductResponse } from '../index'; +import { type IProductResponse, type ITotals, type IUnitTotals } from '../index'; export interface ITransactionLineItemPreviewResponse { price_id: string; @@ -12,5 +12,5 @@ export interface ITransactionLineItemPreviewResponse { tax_rate: string; unit_totals: IUnitTotals; totals: ITotals; - product: ISharedProductResponse; + product: IProductResponse; } diff --git a/src/types/transaction/transaction-item-response.ts b/src/types/transaction/transaction-item-response.ts index 58b0ca1..2f0f029 100644 --- a/src/types/transaction/transaction-item-response.ts +++ b/src/types/transaction/transaction-item-response.ts @@ -4,11 +4,11 @@ * Changes may be overwritten as part of auto-generation. */ -import { type ISharedPriceResponse, type ITransactionProrationResponse } from '../index'; +import { type IPriceResponse, type ITransactionProrationResponse } from '../index'; export interface ITransactionItemResponse { price_id?: string | null; - price?: ISharedPriceResponse | null; + price?: IPriceResponse | null; quantity: number; proration?: ITransactionProrationResponse | null; } diff --git a/src/types/transaction/transaction-line-item-response.ts b/src/types/transaction/transaction-line-item-response.ts index 2c78b7e..9fa8152 100644 --- a/src/types/transaction/transaction-line-item-response.ts +++ b/src/types/transaction/transaction-line-item-response.ts @@ -4,12 +4,7 @@ * Changes may be overwritten as part of auto-generation. */ -import { - type ITransactionProrationResponse, - type IUnitTotals, - type ITotals, - type ISharedProductResponse, -} from '../index'; +import { type IProductResponse, type ITotals, type ITransactionProrationResponse, type IUnitTotals } from '../index'; export interface ITransactionLineItemResponse { id: string; @@ -19,5 +14,5 @@ export interface ITransactionLineItemResponse { tax_rate: string; unit_totals?: IUnitTotals | null; totals?: ITotals | null; - product?: ISharedProductResponse | null; + product?: IProductResponse | null; }