@paddle/paddle-node-sdk 2.1.3 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/entities/adjustment/adjustment.js +1 -0
  3. package/dist/cjs/entities/subscription/transaction-line-item-preview.js +2 -0
  4. package/dist/cjs/enums/adjustment/adjustment-action-type.js +2 -0
  5. package/dist/cjs/enums/adjustment/index.js +3 -2
  6. package/dist/cjs/notifications/entities/adjustment/adjustment-notification.js +1 -0
  7. package/dist/cjs/version.js +1 -1
  8. package/dist/esm/entities/adjustment/adjustment.js +1 -0
  9. package/dist/esm/entities/subscription/transaction-line-item-preview.js +2 -0
  10. package/dist/esm/enums/adjustment/adjustment-action-type.js +1 -0
  11. package/dist/esm/enums/adjustment/index.js +3 -2
  12. package/dist/esm/notifications/entities/adjustment/adjustment-notification.js +1 -0
  13. package/dist/esm/version.js +1 -1
  14. package/dist/types/entities/adjustment/adjustment.d.ts +2 -1
  15. package/dist/types/entities/subscription/transaction-line-item-preview.d.ts +2 -0
  16. package/dist/types/enums/adjustment/adjustment-action-type.d.ts +1 -0
  17. package/dist/types/enums/adjustment/index.d.ts +3 -2
  18. package/dist/types/enums/shared/currency-code.d.ts +1 -1
  19. package/dist/types/notifications/entities/adjustment/adjustment-notification.d.ts +2 -1
  20. package/dist/types/notifications/types/adjustment/adjustment-notification-response.d.ts +2 -1
  21. package/dist/types/resources/adjustments/operations/create-adjustment-request-body.d.ts +10 -1
  22. package/dist/types/types/adjustment/adjustment-response.d.ts +2 -1
  23. package/dist/types/types/shared/transaction-line-item-preview-response.d.ts +2 -0
  24. package/dist/types/version.d.ts +1 -1
  25. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -12,6 +12,19 @@ When we make [non-breaking changes](https://developer.paddle.com/api-reference/a
12
12
 
13
13
  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.
14
14
 
15
+ ## 2.2.1 - 2024-12-16
16
+
17
+ ### Fixed
18
+
19
+ - Added `proration` to transaction line items
20
+
21
+ ## 2.2.0 - 2024-12-12
22
+
23
+ ### Added
24
+
25
+ - `VND` (Vietnamese dong) as new currency
26
+ - Added `adjustment.type` which is either `partial` which should include `items` or `full` where `items` are not required
27
+
15
28
  ## 2.1.3 - 2024-11-29
16
29
 
17
30
  ### Changed
@@ -7,6 +7,7 @@ class Adjustment {
7
7
  constructor(adjustment) {
8
8
  this.id = adjustment.id;
9
9
  this.action = adjustment.action;
10
+ this.type = adjustment.type;
10
11
  this.transactionId = adjustment.transaction_id;
11
12
  this.subscriptionId = adjustment.subscription_id ? adjustment.subscription_id : null;
12
13
  this.customerId = adjustment.customer_id;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TransactionLineItemPreview = void 0;
4
4
  const index_js_1 = require("../shared/index.js");
5
5
  const index_js_2 = require("../product/index.js");
6
+ const proration_js_1 = require("../transaction/proration.js");
6
7
  class TransactionLineItemPreview {
7
8
  constructor(transactionLineItemPreview) {
8
9
  this.priceId = transactionLineItemPreview.price_id;
@@ -11,6 +12,7 @@ class TransactionLineItemPreview {
11
12
  this.unitTotals = new index_js_1.UnitTotals(transactionLineItemPreview.unit_totals);
12
13
  this.totals = new index_js_1.Totals(transactionLineItemPreview.totals);
13
14
  this.product = new index_js_2.Product(transactionLineItemPreview.product);
15
+ this.proration = transactionLineItemPreview.proration ? new proration_js_1.Proration(transactionLineItemPreview.proration) : null;
14
16
  }
15
17
  }
16
18
  exports.TransactionLineItemPreview = TransactionLineItemPreview;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -14,7 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./adjustment-type.js"), exports);
18
- __exportStar(require("./adjustment-currency-code.js"), exports);
17
+ __exportStar(require("./adjustment-action-type.js"), exports);
19
18
  __exportStar(require("./adjustment-action.js"), exports);
19
+ __exportStar(require("./adjustment-currency-code.js"), exports);
20
20
  __exportStar(require("./adjustment-status.js"), exports);
21
+ __exportStar(require("./adjustment-type.js"), exports);
@@ -7,6 +7,7 @@ class AdjustmentNotification {
7
7
  constructor(adjustment) {
8
8
  this.id = adjustment.id;
9
9
  this.action = adjustment.action;
10
+ this.type = adjustment.type;
10
11
  this.transactionId = adjustment.transaction_id;
11
12
  this.subscriptionId = adjustment.subscription_id ? adjustment.subscription_id : null;
12
13
  this.customerId = adjustment.customer_id;
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = '2.1.3';
4
+ exports.SDK_VERSION = '2.2.1';
@@ -4,6 +4,7 @@ export class Adjustment {
4
4
  constructor(adjustment) {
5
5
  this.id = adjustment.id;
6
6
  this.action = adjustment.action;
7
+ this.type = adjustment.type;
7
8
  this.transactionId = adjustment.transaction_id;
8
9
  this.subscriptionId = adjustment.subscription_id ? adjustment.subscription_id : null;
9
10
  this.customerId = adjustment.customer_id;
@@ -1,5 +1,6 @@
1
1
  import { Totals, UnitTotals } from '../shared/index.js';
2
2
  import { Product } from '../product/index.js';
3
+ import { Proration } from '../transaction/proration.js';
3
4
  export class TransactionLineItemPreview {
4
5
  constructor(transactionLineItemPreview) {
5
6
  this.priceId = transactionLineItemPreview.price_id;
@@ -8,5 +9,6 @@ export class TransactionLineItemPreview {
8
9
  this.unitTotals = new UnitTotals(transactionLineItemPreview.unit_totals);
9
10
  this.totals = new Totals(transactionLineItemPreview.totals);
10
11
  this.product = new Product(transactionLineItemPreview.product);
12
+ this.proration = transactionLineItemPreview.proration ? new Proration(transactionLineItemPreview.proration) : null;
11
13
  }
12
14
  }
@@ -1,4 +1,5 @@
1
- export * from './adjustment-type.js';
2
- export * from './adjustment-currency-code.js';
1
+ export * from './adjustment-action-type.js';
3
2
  export * from './adjustment-action.js';
3
+ export * from './adjustment-currency-code.js';
4
4
  export * from './adjustment-status.js';
5
+ export * from './adjustment-type.js';
@@ -4,6 +4,7 @@ export class AdjustmentNotification {
4
4
  constructor(adjustment) {
5
5
  this.id = adjustment.id;
6
6
  this.action = adjustment.action;
7
+ this.type = adjustment.type;
7
8
  this.transactionId = adjustment.transaction_id;
8
9
  this.subscriptionId = adjustment.subscription_id ? adjustment.subscription_id : null;
9
10
  this.customerId = adjustment.customer_id;
@@ -1 +1 @@
1
- export const SDK_VERSION = '2.1.3';
1
+ export const SDK_VERSION = '2.2.1';
@@ -1,10 +1,11 @@
1
- import { type AdjustmentAction, type AdjustmentStatus, type CurrencyCode } from '../../enums/index.js';
1
+ import { type AdjustmentActionType, type AdjustmentAction, type AdjustmentStatus, type CurrencyCode } from '../../enums/index.js';
2
2
  import { AdjustmentItem } from './adjustment-item.js';
3
3
  import { PayoutTotalsAdjustment, TotalAdjustments } from '../shared/index.js';
4
4
  import { type IAdjustmentResponse } from '../../types/index.js';
5
5
  export declare class Adjustment {
6
6
  readonly id: string;
7
7
  readonly action: AdjustmentAction;
8
+ readonly type: AdjustmentActionType;
8
9
  readonly transactionId: string;
9
10
  readonly subscriptionId: string | null;
10
11
  readonly customerId: string;
@@ -1,6 +1,7 @@
1
1
  import { Totals, UnitTotals } from '../shared/index.js';
2
2
  import { Product } from '../product/index.js';
3
3
  import { type ITransactionLineItemPreviewResponse } from '../../types/index.js';
4
+ import { Proration } from '../transaction/proration.js';
4
5
  export declare class TransactionLineItemPreview {
5
6
  readonly priceId: string;
6
7
  readonly quantity: number;
@@ -8,5 +9,6 @@ export declare class TransactionLineItemPreview {
8
9
  readonly unitTotals: UnitTotals;
9
10
  readonly totals: Totals;
10
11
  readonly product: Product;
12
+ readonly proration: Proration | null;
11
13
  constructor(transactionLineItemPreview: ITransactionLineItemPreviewResponse);
12
14
  }
@@ -0,0 +1 @@
1
+ export type AdjustmentActionType = 'full' | 'partial';
@@ -1,4 +1,5 @@
1
- export * from './adjustment-type.js';
2
- export * from './adjustment-currency-code.js';
1
+ export * from './adjustment-action-type.js';
3
2
  export * from './adjustment-action.js';
3
+ export * from './adjustment-currency-code.js';
4
4
  export * from './adjustment-status.js';
5
+ export * from './adjustment-type.js';
@@ -1 +1 @@
1
- export type CurrencyCode = 'USD' | 'EUR' | 'GBP' | 'JPY' | 'AUD' | 'CAD' | 'CHF' | 'HKD' | 'SGD' | 'SEK' | 'ARS' | 'BRL' | 'CNY' | 'COP' | 'CZK' | 'DKK' | 'HUF' | 'ILS' | 'INR' | 'KRW' | 'MXN' | 'NOK' | 'NZD' | 'PLN' | 'RUB' | 'THB' | 'TRY' | 'TWD' | 'UAH' | 'ZAR';
1
+ export type CurrencyCode = 'USD' | 'EUR' | 'GBP' | 'JPY' | 'AUD' | 'CAD' | 'CHF' | 'HKD' | 'SGD' | 'SEK' | 'ARS' | 'BRL' | 'CNY' | 'COP' | 'CZK' | 'DKK' | 'HUF' | 'ILS' | 'INR' | 'KRW' | 'MXN' | 'NOK' | 'NZD' | 'PLN' | 'RUB' | 'THB' | 'TRY' | 'TWD' | 'UAH' | 'VND' | 'ZAR';
@@ -1,10 +1,11 @@
1
- import { type AdjustmentAction, type AdjustmentStatus, type CurrencyCode } from '../../../enums/index.js';
1
+ import { type AdjustmentActionType, type AdjustmentAction, type AdjustmentStatus, type CurrencyCode } from '../../../enums/index.js';
2
2
  import { AdjustmentItemNotification } from './adjustment-item-notification.js';
3
3
  import { PayoutTotalsAdjustmentNotification, TotalAdjustmentsNotification } from '../shared/index.js';
4
4
  import { type IAdjustmentNotificationResponse } from '../../types/index.js';
5
5
  export declare class AdjustmentNotification {
6
6
  readonly id: string;
7
7
  readonly action: AdjustmentAction;
8
+ readonly type: AdjustmentActionType;
8
9
  readonly transactionId: string;
9
10
  readonly subscriptionId: string | null;
10
11
  readonly customerId: string;
@@ -1,9 +1,10 @@
1
- import { type AdjustmentAction, type AdjustmentStatus, type CurrencyCode } from '../../../enums/index.js';
1
+ import { type AdjustmentActionType, type AdjustmentAction, type AdjustmentStatus, type CurrencyCode } from '../../../enums/index.js';
2
2
  import { type IAdjustmentItemNotificationResponse } from './adjustment-item-notification-response.js';
3
3
  import { type IPayoutTotalsAdjustmentNotificationResponse, type ITotalAdjustmentsNotificationResponse } from '../shared/index.js';
4
4
  export interface IAdjustmentNotificationResponse {
5
5
  id: string;
6
6
  action: AdjustmentAction;
7
+ type: AdjustmentActionType;
7
8
  transaction_id: string;
8
9
  subscription_id?: string | null;
9
10
  customer_id: string;
@@ -4,9 +4,18 @@ export interface CreateAdjustmentLineItem {
4
4
  itemId: string;
5
5
  type: AdjustmentType;
6
6
  }
7
- export interface CreateAdjustmentRequestBody {
7
+ interface CreatePartialAdjustmentRequestBody {
8
8
  action: AdjustmentAction;
9
9
  items: CreateAdjustmentLineItem[];
10
10
  reason: string;
11
11
  transactionId: string;
12
+ type?: 'partial';
12
13
  }
14
+ interface CreateFullAdjustmentRequestBody {
15
+ action: AdjustmentAction;
16
+ reason: string;
17
+ transactionId: string;
18
+ type?: 'full';
19
+ }
20
+ export type CreateAdjustmentRequestBody = CreatePartialAdjustmentRequestBody | CreateFullAdjustmentRequestBody;
21
+ export {};
@@ -1,9 +1,10 @@
1
- import { type AdjustmentAction, type AdjustmentStatus, type CurrencyCode } from '../../enums/index.js';
1
+ import { type AdjustmentActionType, type AdjustmentAction, type AdjustmentStatus, type CurrencyCode } from '../../enums/index.js';
2
2
  import { type IAdjustmentItemResponse } from './adjustment-item-response.js';
3
3
  import { type IPayoutTotalsAdjustmentResponse, type ITotalAdjustmentsResponse } from '../shared/index.js';
4
4
  export interface IAdjustmentResponse {
5
5
  id: string;
6
6
  action: AdjustmentAction;
7
+ type: AdjustmentActionType;
7
8
  transaction_id: string;
8
9
  subscription_id?: string | null;
9
10
  customer_id: string;
@@ -1,6 +1,7 @@
1
1
  import { type IUnitTotals } from './unit-totals.js';
2
2
  import { type ITotals } from './totals.js';
3
3
  import { type IProductResponse } from '../product/index.js';
4
+ import { type IProrationResponse } from '../index.js';
4
5
  export interface ITransactionLineItemPreviewResponse {
5
6
  price_id: string;
6
7
  quantity: number;
@@ -8,4 +9,5 @@ export interface ITransactionLineItemPreviewResponse {
8
9
  unit_totals: IUnitTotals;
9
10
  totals: ITotals;
10
11
  product: IProductResponse;
12
+ proration?: IProrationResponse | null;
11
13
  }
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "2.1.3";
1
+ export declare const SDK_VERSION = "2.2.1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paddle/paddle-node-sdk",
3
- "version": "2.1.3",
3
+ "version": "2.2.1",
4
4
  "description": "A Node.js SDK that you can use to integrate Paddle Billing with applications written in server-side JavaScript.",
5
5
  "main": "dist/cjs/index.cjs.node.js",
6
6
  "module": "dist/esm/index.esm.node.js",