@paddle/paddle-node-sdk 0.5.0 → 0.6.0

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 (44) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/entities/price/index.d.ts +0 -1
  3. package/dist/entities/price/index.js +0 -1
  4. package/dist/entities/price/price-collection.d.ts +3 -3
  5. package/dist/entities/price/price-collection.js +2 -2
  6. package/dist/entities/price/price.d.ts +2 -1
  7. package/dist/entities/price/price.js +1 -0
  8. package/dist/entities/product/index.d.ts +0 -1
  9. package/dist/entities/product/index.js +0 -1
  10. package/dist/entities/product/product-collection.d.ts +3 -3
  11. package/dist/entities/product/product-collection.js +2 -2
  12. package/dist/entities/product/product.d.ts +5 -4
  13. package/dist/entities/product/product.js +1 -0
  14. package/dist/entities/subscription/index.d.ts +0 -1
  15. package/dist/entities/subscription/index.js +0 -1
  16. package/dist/entities/subscription/subscription.d.ts +3 -1
  17. package/dist/entities/subscription/subscription.js +4 -0
  18. package/dist/entities/transaction/index.d.ts +0 -1
  19. package/dist/entities/transaction/index.js +0 -1
  20. package/dist/entities/transaction/transaction-collection.d.ts +3 -3
  21. package/dist/entities/transaction/transaction-collection.js +2 -2
  22. package/dist/entities/transaction/transaction-item-preview.d.ts +2 -2
  23. package/dist/entities/transaction/transaction-item-preview.js +1 -1
  24. package/dist/entities/transaction/transaction.d.ts +9 -2
  25. package/dist/entities/transaction/transaction.js +12 -0
  26. package/dist/resources/prices/index.d.ts +2 -2
  27. package/dist/resources/prices/index.js +1 -1
  28. package/dist/resources/products/index.d.ts +2 -2
  29. package/dist/resources/products/index.js +1 -1
  30. package/dist/resources/subscriptions/index.d.ts +3 -3
  31. package/dist/resources/subscriptions/index.js +2 -2
  32. package/dist/resources/transactions/index.d.ts +5 -5
  33. package/dist/resources/transactions/index.js +3 -3
  34. package/dist/version.d.ts +1 -1
  35. package/dist/version.js +1 -1
  36. package/package.json +1 -1
  37. package/dist/entities/price/price-with-includes.d.ts +0 -21
  38. package/dist/entities/price/price-with-includes.js +0 -25
  39. package/dist/entities/product/product-with-includes.d.ts +0 -17
  40. package/dist/entities/product/product-with-includes.js +0 -21
  41. package/dist/entities/subscription/subscription-includes.d.ts +0 -31
  42. package/dist/entities/subscription/subscription-includes.js +0 -42
  43. package/dist/entities/transaction/transaction-includes.d.ts +0 -35
  44. package/dist/entities/transaction/transaction-includes.js +0 -43
package/CHANGELOG.md CHANGED
@@ -8,6 +8,21 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
8
8
 
9
9
  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.
10
10
 
11
+ ## 0.6.0 - 2024-02-20
12
+
13
+ > **Breaking changes:** This version includes major improvements that introduce breaking changes. These are called out below.
14
+
15
+ ### Removed
16
+
17
+ - **Breaking change:** Removed `*Includes` entity in favour of standard entities.
18
+
19
+ - Use `Price` instead of `PriceWithIncludes`
20
+ - Use `Product` instead of `ProductWithIncludes`
21
+ - Use `Subscription` instead of `SubscriptionIncludes`
22
+ - Use `Transaction` instead of `TransactionIncludes`
23
+
24
+ ---
25
+
11
26
  ## 0.5.0 - 2024-02-16
12
27
 
13
28
  > **Breaking changes:** This version includes major improvements that introduce breaking changes. These are called out below.
@@ -16,6 +31,8 @@ Check our main [developer changelog](https://developer.paddle.com/?utm_source=dx
16
31
 
17
32
  - We removed the shared entities between API and Notification as we foresee them diverging. No Action required for this change
18
33
 
34
+ ---
35
+
19
36
  ## 0.4.0 - 2024-02-14
20
37
 
21
38
  ### Added
@@ -1,4 +1,3 @@
1
- export * from './price-with-includes';
2
1
  export * from './price-collection';
3
2
  export * from './price-quantity';
4
3
  export * from './price';
@@ -14,7 +14,6 @@ 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("./price-with-includes"), exports);
18
17
  __exportStar(require("./price-collection"), exports);
19
18
  __exportStar(require("./price-quantity"), exports);
20
19
  __exportStar(require("./price"), exports);
@@ -1,6 +1,6 @@
1
- import { PriceWithIncludes } from './price-with-includes';
2
1
  import { type IPriceResponse } from '../../types';
3
2
  import { Collection } from '../../internal/base';
4
- export declare class PriceCollection extends Collection<IPriceResponse, PriceWithIncludes> {
5
- fromJson(data: IPriceResponse): PriceWithIncludes;
3
+ import { Price } from './price';
4
+ export declare class PriceCollection extends Collection<IPriceResponse, Price> {
5
+ fromJson(data: IPriceResponse): Price;
6
6
  }
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PriceCollection = void 0;
4
- const price_with_includes_1 = require("./price-with-includes");
5
4
  const base_1 = require("../../internal/base");
5
+ const price_1 = require("./price");
6
6
  class PriceCollection extends base_1.Collection {
7
7
  fromJson(data) {
8
- return new price_with_includes_1.PriceWithIncludes(data);
8
+ return new price_1.Price(data);
9
9
  }
10
10
  }
11
11
  exports.PriceCollection = PriceCollection;
@@ -1,5 +1,5 @@
1
1
  import { type ICustomData, type IPriceResponse } from '../../types';
2
- import { ImportMeta, Money, PriceQuantity, TimePeriod, UnitPriceOverride } from '../index';
2
+ import { ImportMeta, Money, PriceQuantity, Product, TimePeriod, UnitPriceOverride } from '../index';
3
3
  import { type CatalogType, type Status, type TaxMode } from '../../enums';
4
4
  export declare class Price {
5
5
  readonly id: string;
@@ -16,5 +16,6 @@ export declare class Price {
16
16
  readonly status: Status;
17
17
  readonly customData: ICustomData | null;
18
18
  readonly importMeta: ImportMeta | null;
19
+ readonly product: Product | null;
19
20
  constructor(price: IPriceResponse);
20
21
  }
@@ -18,6 +18,7 @@ class Price {
18
18
  this.status = price.status;
19
19
  this.customData = price.custom_data ? price.custom_data : null;
20
20
  this.importMeta = price.import_meta ? new index_1.ImportMeta(price.import_meta) : null;
21
+ this.product = price.product ? new index_1.Product(price.product) : null;
21
22
  }
22
23
  }
23
24
  exports.Price = Price;
@@ -1,3 +1,2 @@
1
- export * from './product-with-includes';
2
1
  export * from './product-collection';
3
2
  export * from './product';
@@ -14,6 +14,5 @@ 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("./product-with-includes"), exports);
18
17
  __exportStar(require("./product-collection"), exports);
19
18
  __exportStar(require("./product"), exports);
@@ -1,6 +1,6 @@
1
- import { ProductWithIncludes } from './product-with-includes';
2
1
  import { type IProductResponse } from '../../types';
3
2
  import { Collection } from '../../internal/base';
4
- export declare class ProductCollection extends Collection<IProductResponse, ProductWithIncludes> {
5
- fromJson(data: IProductResponse): ProductWithIncludes;
3
+ import { Product } from './product';
4
+ export declare class ProductCollection extends Collection<IProductResponse, Product> {
5
+ fromJson(data: IProductResponse): Product;
6
6
  }
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ProductCollection = void 0;
4
- const product_with_includes_1 = require("./product-with-includes");
5
4
  const base_1 = require("../../internal/base");
5
+ const product_1 = require("./product");
6
6
  class ProductCollection extends base_1.Collection {
7
7
  fromJson(data) {
8
- return new product_with_includes_1.ProductWithIncludes(data);
8
+ return new product_1.Product(data);
9
9
  }
10
10
  }
11
11
  exports.ProductCollection = ProductCollection;
@@ -1,6 +1,6 @@
1
- import { type ISharedProductResponse } from '../../types';
2
- import { type CustomData, ImportMeta } from '../index';
3
- import { type TaxCategory, type Status, type CatalogType } from '../../enums';
1
+ import { type IProductResponse } from '../../types';
2
+ import { type CustomData, ImportMeta, Price } from '../index';
3
+ import { type CatalogType, type Status, type TaxCategory } from '../../enums';
4
4
  export declare class Product {
5
5
  readonly id: string;
6
6
  readonly name: string;
@@ -12,5 +12,6 @@ export declare class Product {
12
12
  readonly status: Status;
13
13
  readonly createdAt: string;
14
14
  readonly importMeta: ImportMeta | null;
15
- constructor(product: ISharedProductResponse);
15
+ readonly prices: Price[] | null;
16
+ constructor(product: IProductResponse);
16
17
  }
@@ -15,6 +15,7 @@ class Product {
15
15
  this.status = product.status;
16
16
  this.createdAt = product.created_at;
17
17
  this.importMeta = product.import_meta ? new index_1.ImportMeta(product.import_meta) : null;
18
+ this.prices = product.prices ? product.prices.map((price) => new index_1.Price(price)) : null;
18
19
  }
19
20
  }
20
21
  exports.Product = Product;
@@ -5,7 +5,6 @@ export * from './subscription-management';
5
5
  export * from './subscription-item';
6
6
  export * from './subscription';
7
7
  export * from './subscription-collection';
8
- export * from './subscription-includes';
9
8
  export * from './next-transaction';
10
9
  export * from './transaction-details-preview';
11
10
  export * from './transaction-line-item-preview';
@@ -21,7 +21,6 @@ __exportStar(require("./subscription-management"), exports);
21
21
  __exportStar(require("./subscription-item"), exports);
22
22
  __exportStar(require("./subscription"), exports);
23
23
  __exportStar(require("./subscription-collection"), exports);
24
- __exportStar(require("./subscription-includes"), exports);
25
24
  __exportStar(require("./next-transaction"), exports);
26
25
  __exportStar(require("./transaction-details-preview"), exports);
27
26
  __exportStar(require("./transaction-line-item-preview"), exports);
@@ -1,4 +1,4 @@
1
- import { BillingDetails, type CustomData, ImportMeta, SubscriptionDiscount, SubscriptionItem, SubscriptionManagement, SubscriptionScheduledChange, SubscriptionTimePeriod, TimePeriod } from '../index';
1
+ import { BillingDetails, type CustomData, ImportMeta, NextTransaction, SubscriptionDiscount, SubscriptionItem, SubscriptionManagement, SubscriptionScheduledChange, SubscriptionTimePeriod, TimePeriod, TransactionDetailsPreview } from '../index';
2
2
  import { type CollectionMode, type CurrencyCode, type SubscriptionStatus } from '../../enums';
3
3
  import { type ISubscriptionResponse } from '../../types';
4
4
  export declare class Subscription {
@@ -25,5 +25,7 @@ export declare class Subscription {
25
25
  readonly items: SubscriptionItem[];
26
26
  readonly customData: CustomData | null;
27
27
  readonly importMeta: ImportMeta | null;
28
+ readonly nextTransaction: NextTransaction | null;
29
+ readonly recurringTransactionDetails: TransactionDetailsPreview | null;
28
30
  constructor(subscription: ISubscriptionResponse);
29
31
  }
@@ -33,6 +33,10 @@ class Subscription {
33
33
  this.items = subscription.items.map((item) => new index_1.SubscriptionItem(item));
34
34
  this.customData = subscription.custom_data ? subscription.custom_data : null;
35
35
  this.importMeta = subscription.import_meta ? new index_1.ImportMeta(subscription.import_meta) : null;
36
+ this.nextTransaction = subscription.next_transaction ? new index_1.NextTransaction(subscription.next_transaction) : null;
37
+ this.recurringTransactionDetails = subscription.recurring_transaction_details
38
+ ? new index_1.TransactionDetailsPreview(subscription.recurring_transaction_details)
39
+ : null;
36
40
  }
37
41
  }
38
42
  exports.Subscription = Subscription;
@@ -7,7 +7,6 @@ export * from './transaction-adjustment-item';
7
7
  export * from './transaction-adjustment';
8
8
  export * from './adjustment-totals-breakdown';
9
9
  export * from './adjustment-totals';
10
- export * from './transaction-includes';
11
10
  export * from './transaction';
12
11
  export * from './transaction-collection';
13
12
  export * from './transaction-invoice-pdf';
@@ -23,7 +23,6 @@ __exportStar(require("./transaction-adjustment-item"), exports);
23
23
  __exportStar(require("./transaction-adjustment"), exports);
24
24
  __exportStar(require("./adjustment-totals-breakdown"), exports);
25
25
  __exportStar(require("./adjustment-totals"), exports);
26
- __exportStar(require("./transaction-includes"), exports);
27
26
  __exportStar(require("./transaction"), exports);
28
27
  __exportStar(require("./transaction-collection"), exports);
29
28
  __exportStar(require("./transaction-invoice-pdf"), exports);
@@ -1,6 +1,6 @@
1
- import { TransactionIncludes } from './transaction-includes';
2
1
  import { type ITransactionResponse } from '../../types';
3
2
  import { Collection } from '../../internal/base';
4
- export declare class TransactionCollection extends Collection<ITransactionResponse, TransactionIncludes> {
5
- fromJson(data: ITransactionResponse): TransactionIncludes;
3
+ import { Transaction } from './transaction';
4
+ export declare class TransactionCollection extends Collection<ITransactionResponse, Transaction> {
5
+ fromJson(data: ITransactionResponse): Transaction;
6
6
  }
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TransactionCollection = void 0;
4
- const transaction_includes_1 = require("./transaction-includes");
5
4
  const base_1 = require("../../internal/base");
5
+ const transaction_1 = require("./transaction");
6
6
  class TransactionCollection extends base_1.Collection {
7
7
  fromJson(data) {
8
- return new transaction_includes_1.TransactionIncludes(data);
8
+ return new transaction_1.Transaction(data);
9
9
  }
10
10
  }
11
11
  exports.TransactionCollection = TransactionCollection;
@@ -1,7 +1,7 @@
1
- import { PriceWithIncludes, Proration } from '../index';
1
+ import { Price, Proration } from '../index';
2
2
  import { type ITransactionItemPreviewResponse } from '../../types';
3
3
  export declare class TransactionItemPreview {
4
- readonly price: PriceWithIncludes | null;
4
+ readonly price: Price | null;
5
5
  readonly quantity: number;
6
6
  readonly includeInTotals: boolean | null;
7
7
  readonly proration: Proration | null;
@@ -5,7 +5,7 @@ const index_1 = require("../index");
5
5
  class TransactionItemPreview {
6
6
  constructor(transactionItem) {
7
7
  var _a;
8
- this.price = transactionItem.price ? new index_1.PriceWithIncludes(transactionItem.price) : null;
8
+ this.price = transactionItem.price ? new index_1.Price(transactionItem.price) : null;
9
9
  this.quantity = transactionItem.quantity;
10
10
  this.includeInTotals = (_a = transactionItem.include_in_totals) !== null && _a !== void 0 ? _a : null;
11
11
  this.proration = transactionItem.proration ? new index_1.Proration(transactionItem.proration) : null;
@@ -1,5 +1,5 @@
1
- import { type CustomData, BillingDetails, TransactionsTimePeriod, TransactionItem, TransactionDetails, TransactionPaymentAttempt, TransactionCheckout } from '../index';
2
- import { type TransactionStatus, type CurrencyCode, type TransactionOrigin, type CollectionMode } from '../../enums';
1
+ import { type CustomData, BillingDetails, TransactionsTimePeriod, TransactionItem, TransactionDetails, TransactionPaymentAttempt, TransactionCheckout, Address, TransactionAdjustment, AdjustmentTotals, Business, Customer, Discount } from '../index';
2
+ import { type TransactionStatus, type CurrencyCode, type TransactionOrigin, type CollectionMode, type AvailablePaymentMethod } from '../../enums';
3
3
  import { type ITransactionResponse } from '../../types';
4
4
  export declare class Transaction {
5
5
  readonly id: string;
@@ -24,5 +24,12 @@ export declare class Transaction {
24
24
  readonly createdAt: string;
25
25
  readonly updatedAt: string;
26
26
  readonly billedAt: string | null;
27
+ readonly address: Address | null;
28
+ readonly adjustments: TransactionAdjustment[] | null;
29
+ readonly adjustmentsTotals: AdjustmentTotals | null;
30
+ readonly business: Business | null;
31
+ readonly customer: Customer | null;
32
+ readonly discount: Discount | null;
33
+ readonly availablePaymentMethods: AvailablePaymentMethod[] | null;
27
34
  constructor(transaction: ITransactionResponse);
28
35
  }
@@ -4,6 +4,7 @@ exports.Transaction = void 0;
4
4
  const index_1 = require("../index");
5
5
  class Transaction {
6
6
  constructor(transaction) {
7
+ var _a;
7
8
  this.id = transaction.id;
8
9
  this.status = transaction.status;
9
10
  this.customerId = transaction.customer_id ? transaction.customer_id : null;
@@ -26,6 +27,17 @@ class Transaction {
26
27
  this.createdAt = transaction.created_at;
27
28
  this.updatedAt = transaction.updated_at;
28
29
  this.billedAt = transaction.billed_at ? transaction.billed_at : null;
30
+ this.address = transaction.address ? new index_1.Address(transaction.address) : null;
31
+ this.adjustments = transaction.adjustments
32
+ ? (_a = transaction.adjustments) === null || _a === void 0 ? void 0 : _a.map((adjustment) => new index_1.TransactionAdjustment(adjustment))
33
+ : null;
34
+ this.adjustmentsTotals = transaction.adjustments_totals
35
+ ? new index_1.AdjustmentTotals(transaction.adjustments_totals)
36
+ : null;
37
+ this.business = transaction.business ? new index_1.Business(transaction.business) : null;
38
+ this.customer = transaction.customer ? new index_1.Customer(transaction.customer) : null;
39
+ this.discount = transaction.discount ? new index_1.Discount(transaction.discount) : null;
40
+ this.availablePaymentMethods = transaction.available_payment_methods ? transaction.available_payment_methods : null;
29
41
  }
30
42
  }
31
43
  exports.Transaction = Transaction;
@@ -1,11 +1,11 @@
1
- import { Price, PriceCollection, PriceWithIncludes } from '../../entities';
1
+ import { Price, PriceCollection } from '../../entities';
2
2
  import { BaseResource } from '../../internal/base';
3
3
  import { type CreatePriceRequestBody, type GetPriceQueryParameters, type ListPriceQueryParameters, type UpdatePriceRequestBody } from './operations';
4
4
  export * from './operations';
5
5
  export declare class PricesResource extends BaseResource {
6
6
  list(queryParams?: ListPriceQueryParameters): PriceCollection;
7
7
  create(createPriceParameters: CreatePriceRequestBody): Promise<Price>;
8
- get(priceId: string, queryParams?: GetPriceQueryParameters): Promise<PriceWithIncludes>;
8
+ get(priceId: string, queryParams?: GetPriceQueryParameters): Promise<Price>;
9
9
  update(priceId: string, updatePrice: UpdatePriceRequestBody): Promise<Price>;
10
10
  archive(priceId: string): Promise<Price>;
11
11
  }
@@ -53,7 +53,7 @@ class PricesResource extends base_1.BaseResource {
53
53
  }).deriveUrl();
54
54
  const response = yield this.client.get(urlWithPathParams, queryParameters);
55
55
  const data = this.handleResponse(response);
56
- return new entities_1.PriceWithIncludes(data);
56
+ return new entities_1.Price(data);
57
57
  });
58
58
  }
59
59
  update(priceId, updatePrice) {
@@ -1,11 +1,11 @@
1
- import { Product, ProductCollection, ProductWithIncludes } from '../../entities';
1
+ import { Product, ProductCollection } from '../../entities';
2
2
  import { BaseResource } from '../../internal/base';
3
3
  import { type CreateProductRequestBody, type GetProductQueryParameters, type ListProductQueryParameters, type UpdateProductRequestBody } from './operations';
4
4
  export * from './operations';
5
5
  export declare class ProductsResource extends BaseResource {
6
6
  list(queryParams?: ListProductQueryParameters): ProductCollection;
7
7
  create(createProductParameters: CreateProductRequestBody): Promise<Product>;
8
- get(productId: string, queryParams?: GetProductQueryParameters): Promise<ProductWithIncludes>;
8
+ get(productId: string, queryParams?: GetProductQueryParameters): Promise<Product>;
9
9
  update(productId: string, updateProduct: UpdateProductRequestBody): Promise<Product>;
10
10
  archive(productId: string): Promise<Product>;
11
11
  }
@@ -53,7 +53,7 @@ class ProductsResource extends base_1.BaseResource {
53
53
  }).deriveUrl();
54
54
  const response = yield this.client.get(urlWithPathParams, queryParameters);
55
55
  const data = this.handleResponse(response);
56
- return new entities_1.ProductWithIncludes(data);
56
+ return new entities_1.Product(data);
57
57
  });
58
58
  }
59
59
  update(productId, updateProduct) {
@@ -1,4 +1,4 @@
1
- import { Subscription, SubscriptionCollection, SubscriptionIncludes, SubscriptionPreview, TransactionIncludes } from '../../entities';
1
+ import { Subscription, SubscriptionCollection, SubscriptionPreview, Transaction } from '../../entities';
2
2
  import { BaseResource } from '../../internal/base';
3
3
  import { type CancelSubscription, type CreateSubscriptionCharge, type GetSubscriptionQueryParameters, type ListSubscriptionQueryParameters, type PauseSubscription, type ResumeSubscription, type UpdateSubscriptionRequestBody } from './operations';
4
4
  export * from './operations';
@@ -6,12 +6,12 @@ export declare class SubscriptionsResource extends BaseResource {
6
6
  previewUpdate(subscriptionId: string, updateSubscription: UpdateSubscriptionRequestBody): Promise<SubscriptionPreview>;
7
7
  update(subscriptionId: string, updateSubscription: UpdateSubscriptionRequestBody): Promise<Subscription>;
8
8
  list(queryParams?: ListSubscriptionQueryParameters): SubscriptionCollection;
9
- get(subscriptionId: string, queryParams?: GetSubscriptionQueryParameters): Promise<SubscriptionIncludes>;
9
+ get(subscriptionId: string, queryParams?: GetSubscriptionQueryParameters): Promise<Subscription>;
10
10
  activate(subscriptionId: string): Promise<Subscription>;
11
11
  pause(subscriptionId: string, requestBody: PauseSubscription): Promise<Subscription>;
12
12
  resume(subscriptionId: string, requestBody: ResumeSubscription): Promise<Subscription>;
13
13
  cancel(subscriptionId: string, requestBody: CancelSubscription): Promise<Subscription>;
14
14
  createOneTimeCharge(subscriptionId: string, requestBody: CreateSubscriptionCharge): Promise<Subscription>;
15
15
  previewOneTimeCharge(subscriptionId: string, requestBody: CreateSubscriptionCharge): Promise<SubscriptionPreview>;
16
- getPaymentMethodChangeTransaction(subscriptionId: string): Promise<TransactionIncludes>;
16
+ getPaymentMethodChangeTransaction(subscriptionId: string): Promise<Transaction>;
17
17
  }
@@ -73,7 +73,7 @@ class SubscriptionsResource extends base_1.BaseResource {
73
73
  }).deriveUrl();
74
74
  const response = yield this.client.get(urlWithPathParams, queryParameters);
75
75
  const data = this.handleResponse(response);
76
- return new entities_1.SubscriptionIncludes(data);
76
+ return new entities_1.Subscription(data);
77
77
  });
78
78
  }
79
79
  activate(subscriptionId) {
@@ -143,7 +143,7 @@ class SubscriptionsResource extends base_1.BaseResource {
143
143
  }).deriveUrl();
144
144
  const response = yield this.client.get(urlWithPathParams);
145
145
  const data = this.handleResponse(response);
146
- return new entities_1.TransactionIncludes(data);
146
+ return new entities_1.Transaction(data);
147
147
  });
148
148
  }
149
149
  }
@@ -1,12 +1,12 @@
1
- import { TransactionCollection, TransactionIncludes, TransactionInvoicePDF, TransactionPreview } from '../../entities';
1
+ import { Transaction, TransactionCollection, TransactionInvoicePDF, TransactionPreview } from '../../entities';
2
2
  import { BaseResource } from '../../internal/base';
3
- import { type CreateTransactionQueryParameters, type CreateTransactionRequestBody, type GetTransactionQueryParameters, type ListTransactionQueryParameters, type UpdateTransactionRequestBody, type TransactionPreviewRequestBody, type UpdateTransactionQueryParameters } from './operations';
3
+ import { type CreateTransactionQueryParameters, type CreateTransactionRequestBody, type GetTransactionQueryParameters, type ListTransactionQueryParameters, type TransactionPreviewRequestBody, type UpdateTransactionQueryParameters, type UpdateTransactionRequestBody } from './operations';
4
4
  export * from './operations';
5
5
  export declare class TransactionsResource extends BaseResource {
6
6
  list(queryParams?: ListTransactionQueryParameters): TransactionCollection;
7
- create(createTransactionParameters: CreateTransactionRequestBody, queryParams?: CreateTransactionQueryParameters): Promise<TransactionIncludes>;
8
- update(transactionId: string, updateTransaction: UpdateTransactionRequestBody, queryParams?: UpdateTransactionQueryParameters): Promise<TransactionIncludes>;
9
- get(transactionId: string, queryParams?: GetTransactionQueryParameters): Promise<TransactionIncludes>;
7
+ create(createTransactionParameters: CreateTransactionRequestBody, queryParams?: CreateTransactionQueryParameters): Promise<Transaction>;
8
+ update(transactionId: string, updateTransaction: UpdateTransactionRequestBody, queryParams?: UpdateTransactionQueryParameters): Promise<Transaction>;
9
+ get(transactionId: string, queryParams?: GetTransactionQueryParameters): Promise<Transaction>;
10
10
  getInvoicePDF(transactionId: string): Promise<TransactionInvoicePDF>;
11
11
  preview(previewTransactionParameters: TransactionPreviewRequestBody): Promise<TransactionPreview>;
12
12
  }
@@ -45,7 +45,7 @@ class TransactionsResource extends base_1.BaseResource {
45
45
  const queryParameters = new base_1.QueryParameters(queryParams);
46
46
  const response = yield this.client.post(TransactionPaths.create + queryParameters.toQueryString(), createTransactionParameters);
47
47
  const data = this.handleResponse(response);
48
- return new entities_1.TransactionIncludes(data);
48
+ return new entities_1.Transaction(data);
49
49
  });
50
50
  }
51
51
  update(transactionId, updateTransaction, queryParams) {
@@ -56,7 +56,7 @@ class TransactionsResource extends base_1.BaseResource {
56
56
  }).deriveUrl();
57
57
  const response = yield this.client.patch(urlWithPathParams + queryParameters.toQueryString(), updateTransaction);
58
58
  const data = this.handleResponse(response);
59
- return new entities_1.TransactionIncludes(data);
59
+ return new entities_1.Transaction(data);
60
60
  });
61
61
  }
62
62
  get(transactionId, queryParams) {
@@ -67,7 +67,7 @@ class TransactionsResource extends base_1.BaseResource {
67
67
  }).deriveUrl();
68
68
  const response = yield this.client.get(urlWithPathParams, queryParameters);
69
69
  const data = this.handleResponse(response);
70
- return new entities_1.TransactionIncludes(data);
70
+ return new entities_1.Transaction(data);
71
71
  });
72
72
  }
73
73
  getInvoicePDF(transactionId) {
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.5.0";
1
+ export declare const SDK_VERSION = "0.6.0";
package/dist/version.js CHANGED
@@ -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 = '0.5.0';
4
+ exports.SDK_VERSION = '0.6.0';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paddle/paddle-node-sdk",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
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/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -1,21 +0,0 @@
1
- import { type IPriceResponse } from '../../types';
2
- import { type CustomData, ImportMeta, Money, PriceQuantity, Product, TimePeriod, UnitPriceOverride } from '../index';
3
- import { type CatalogType, type Status, type TaxMode } from '../../enums';
4
- export declare class PriceWithIncludes {
5
- readonly id: string;
6
- readonly productId: string;
7
- readonly description: string;
8
- readonly name: string | null;
9
- readonly type: CatalogType | null;
10
- readonly billingCycle: TimePeriod | null;
11
- readonly trialPeriod: TimePeriod | null;
12
- readonly taxMode: TaxMode;
13
- readonly unitPrice: Money;
14
- readonly unitPriceOverrides: UnitPriceOverride[];
15
- readonly quantity: PriceQuantity;
16
- readonly status: Status;
17
- readonly customData: CustomData | null;
18
- readonly importMeta: ImportMeta | null;
19
- readonly product: Product | null;
20
- constructor(price: IPriceResponse);
21
- }
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PriceWithIncludes = void 0;
4
- const index_1 = require("../index");
5
- class PriceWithIncludes {
6
- constructor(price) {
7
- var _a;
8
- this.id = price.id;
9
- this.productId = price.product_id;
10
- this.description = price.description;
11
- this.type = (_a = price.type) !== null && _a !== void 0 ? _a : null;
12
- this.name = price.name ? price.name : null;
13
- this.billingCycle = price.billing_cycle ? new index_1.TimePeriod(price.billing_cycle) : null;
14
- this.trialPeriod = price.trial_period ? new index_1.TimePeriod(price.trial_period) : null;
15
- this.taxMode = price.tax_mode;
16
- this.unitPrice = new index_1.Money(price.unit_price);
17
- this.unitPriceOverrides = price.unit_price_overrides.map((unit_price_override) => new index_1.UnitPriceOverride(unit_price_override));
18
- this.quantity = new index_1.PriceQuantity(price.quantity);
19
- this.status = price.status;
20
- this.customData = price.custom_data ? price.custom_data : null;
21
- this.importMeta = price.import_meta ? new index_1.ImportMeta(price.import_meta) : null;
22
- this.product = price.product ? new index_1.Product(price.product) : null;
23
- }
24
- }
25
- exports.PriceWithIncludes = PriceWithIncludes;
@@ -1,17 +0,0 @@
1
- import { type IProductResponse } from '../../types';
2
- import { type CustomData, ImportMeta, Price } from '../index';
3
- import { type CatalogType, type Status, type TaxCategory } from '../../enums';
4
- export declare class ProductWithIncludes {
5
- readonly id: string;
6
- readonly name: string;
7
- readonly type: CatalogType | null;
8
- readonly description: string | null;
9
- readonly taxCategory: TaxCategory;
10
- readonly imageUrl: string | null;
11
- readonly customData: CustomData | null;
12
- readonly status: Status;
13
- readonly createdAt: string;
14
- readonly importMeta: ImportMeta | null;
15
- readonly prices: Price[] | null;
16
- constructor(product: IProductResponse);
17
- }
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ProductWithIncludes = void 0;
4
- const index_1 = require("../index");
5
- class ProductWithIncludes {
6
- constructor(product) {
7
- var _a;
8
- this.id = product.id;
9
- this.name = product.name;
10
- this.type = (_a = product.type) !== null && _a !== void 0 ? _a : null;
11
- this.description = product.description ? product.description : null;
12
- this.taxCategory = product.tax_category;
13
- this.imageUrl = product.image_url ? product.image_url : null;
14
- this.customData = product.custom_data ? product.custom_data : null;
15
- this.status = product.status;
16
- this.createdAt = product.created_at;
17
- this.importMeta = product.import_meta ? new index_1.ImportMeta(product.import_meta) : null;
18
- this.prices = product.prices ? product.prices.map((price) => new index_1.Price(price)) : null;
19
- }
20
- }
21
- exports.ProductWithIncludes = ProductWithIncludes;
@@ -1,31 +0,0 @@
1
- import { BillingDetails, type CustomData, ImportMeta, NextTransaction, SubscriptionDiscount, SubscriptionItem, SubscriptionManagement, SubscriptionScheduledChange, SubscriptionTimePeriod, TimePeriod, TransactionDetailsPreview } from '../index';
2
- import { type CollectionMode, type CurrencyCode, type SubscriptionStatus } from '../../enums';
3
- import { type ISubscriptionResponse } from '../../types';
4
- export declare class SubscriptionIncludes {
5
- readonly id: string;
6
- readonly status: SubscriptionStatus;
7
- readonly customerId: string;
8
- readonly addressId: string;
9
- readonly businessId: string | null;
10
- readonly currencyCode: CurrencyCode;
11
- readonly createdAt: string;
12
- readonly updatedAt: string;
13
- readonly startedAt: string | null;
14
- readonly firstBilledAt: string | null;
15
- readonly nextBilledAt: string | null;
16
- readonly pausedAt: string | null;
17
- readonly canceledAt: string | null;
18
- readonly discount: SubscriptionDiscount | null;
19
- readonly collectionMode: CollectionMode;
20
- readonly billingDetails: BillingDetails | null;
21
- readonly currentBillingPeriod: SubscriptionTimePeriod | null;
22
- readonly billingCycle: TimePeriod;
23
- readonly scheduledChange: SubscriptionScheduledChange | null;
24
- readonly managementUrls: SubscriptionManagement | null;
25
- readonly items: SubscriptionItem[];
26
- readonly customData: CustomData | null;
27
- readonly importMeta: ImportMeta | null;
28
- readonly nextTransaction: NextTransaction | null;
29
- readonly recurringTransactionDetails: TransactionDetailsPreview | null;
30
- constructor(subscription: ISubscriptionResponse);
31
- }
@@ -1,42 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SubscriptionIncludes = void 0;
4
- const index_1 = require("../index");
5
- class SubscriptionIncludes {
6
- constructor(subscription) {
7
- this.id = subscription.id;
8
- this.status = subscription.status;
9
- this.customerId = subscription.customer_id;
10
- this.addressId = subscription.address_id;
11
- this.businessId = subscription.business_id ? subscription.business_id : null;
12
- this.currencyCode = subscription.currency_code;
13
- this.createdAt = subscription.created_at;
14
- this.updatedAt = subscription.updated_at;
15
- this.startedAt = subscription.started_at ? subscription.started_at : null;
16
- this.firstBilledAt = subscription.first_billed_at ? subscription.first_billed_at : null;
17
- this.nextBilledAt = subscription.next_billed_at ? subscription.next_billed_at : null;
18
- this.pausedAt = subscription.paused_at ? subscription.paused_at : null;
19
- this.canceledAt = subscription.canceled_at ? subscription.canceled_at : null;
20
- this.discount = subscription.discount ? new index_1.SubscriptionDiscount(subscription.discount) : null;
21
- this.collectionMode = subscription.collection_mode;
22
- this.billingDetails = subscription.billing_details ? new index_1.BillingDetails(subscription.billing_details) : null;
23
- this.currentBillingPeriod = subscription.current_billing_period
24
- ? new index_1.SubscriptionTimePeriod(subscription.current_billing_period)
25
- : null;
26
- this.billingCycle = new index_1.TimePeriod(subscription.billing_cycle);
27
- this.scheduledChange = subscription.scheduled_change
28
- ? new index_1.SubscriptionScheduledChange(subscription.scheduled_change)
29
- : null;
30
- this.managementUrls = subscription.management_urls
31
- ? new index_1.SubscriptionManagement(subscription.management_urls)
32
- : null;
33
- this.items = subscription.items.map((item) => new index_1.SubscriptionItem(item));
34
- this.customData = subscription.custom_data ? subscription.custom_data : null;
35
- this.importMeta = subscription.import_meta ? new index_1.ImportMeta(subscription.import_meta) : null;
36
- this.nextTransaction = subscription.next_transaction ? new index_1.NextTransaction(subscription.next_transaction) : null;
37
- this.recurringTransactionDetails = subscription.recurring_transaction_details
38
- ? new index_1.TransactionDetailsPreview(subscription.recurring_transaction_details)
39
- : null;
40
- }
41
- }
42
- exports.SubscriptionIncludes = SubscriptionIncludes;
@@ -1,35 +0,0 @@
1
- import { type ITransactionResponse } from '../../types';
2
- import { Address, TransactionAdjustment, AdjustmentTotals, BillingDetails, Business, TransactionCheckout, type CustomData, Customer, TransactionDetails, Discount, TransactionItem, TransactionPaymentAttempt, TransactionsTimePeriod } from '../index';
3
- import { type CollectionMode, type CurrencyCode, type TransactionStatus, type TransactionOrigin, type AvailablePaymentMethod } from '../../enums';
4
- export declare class TransactionIncludes {
5
- readonly id: string;
6
- readonly status: TransactionStatus;
7
- readonly customerId: string | null;
8
- readonly addressId: string | null;
9
- readonly businessId: string | null;
10
- readonly customData: CustomData | null;
11
- readonly currencyCode: CurrencyCode;
12
- readonly origin: TransactionOrigin;
13
- readonly subscriptionId: string | null;
14
- readonly invoiceId: string | null;
15
- readonly invoiceNumber: string | null;
16
- readonly collectionMode: CollectionMode;
17
- readonly discountId: string | null;
18
- readonly billingDetails: BillingDetails | null;
19
- readonly billingPeriod: TransactionsTimePeriod | null;
20
- readonly items: TransactionItem[];
21
- readonly details: TransactionDetails | null;
22
- readonly payments: TransactionPaymentAttempt[];
23
- readonly checkout: TransactionCheckout | null;
24
- readonly createdAt: string;
25
- readonly updatedAt: string;
26
- readonly billedAt: string | null;
27
- readonly address: Address | null;
28
- readonly adjustments: TransactionAdjustment[] | null;
29
- readonly adjustmentsTotals: AdjustmentTotals | null;
30
- readonly business: Business | null;
31
- readonly customer: Customer | null;
32
- readonly discount: Discount | null;
33
- readonly availablePaymentMethods: AvailablePaymentMethod[] | null;
34
- constructor(transaction: ITransactionResponse);
35
- }
@@ -1,43 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TransactionIncludes = void 0;
4
- const index_1 = require("../index");
5
- class TransactionIncludes {
6
- constructor(transaction) {
7
- var _a;
8
- this.id = transaction.id;
9
- this.status = transaction.status;
10
- this.customerId = transaction.customer_id ? transaction.customer_id : null;
11
- this.addressId = transaction.address_id ? transaction.address_id : null;
12
- this.businessId = transaction.business_id ? transaction.business_id : null;
13
- this.customData = transaction.custom_data ? transaction.custom_data : null;
14
- this.currencyCode = transaction.currency_code;
15
- this.origin = transaction.origin;
16
- this.subscriptionId = transaction.subscription_id ? transaction.subscription_id : null;
17
- this.invoiceId = transaction.invoice_id ? transaction.invoice_id : null;
18
- this.invoiceNumber = transaction.invoice_number ? transaction.invoice_number : null;
19
- this.collectionMode = transaction.collection_mode;
20
- this.discountId = transaction.discount_id ? transaction.discount_id : null;
21
- this.billingDetails = transaction.billing_details ? new index_1.BillingDetails(transaction.billing_details) : null;
22
- this.billingPeriod = transaction.billing_period ? new index_1.TransactionsTimePeriod(transaction.billing_period) : null;
23
- this.items = transaction.items.map((item) => new index_1.TransactionItem(item));
24
- this.details = transaction.details ? new index_1.TransactionDetails(transaction.details) : null;
25
- this.payments = transaction.payments.map((payment) => new index_1.TransactionPaymentAttempt(payment));
26
- this.checkout = transaction.checkout ? new index_1.TransactionCheckout(transaction.checkout) : null;
27
- this.createdAt = transaction.created_at;
28
- this.updatedAt = transaction.updated_at;
29
- this.billedAt = transaction.billed_at ? transaction.billed_at : null;
30
- this.address = transaction.address ? new index_1.Address(transaction.address) : null;
31
- this.adjustments = transaction.adjustments
32
- ? (_a = transaction.adjustments) === null || _a === void 0 ? void 0 : _a.map((adjustment) => new index_1.TransactionAdjustment(adjustment))
33
- : null;
34
- this.adjustmentsTotals = transaction.adjustments_totals
35
- ? new index_1.AdjustmentTotals(transaction.adjustments_totals)
36
- : null;
37
- this.business = transaction.business ? new index_1.Business(transaction.business) : null;
38
- this.customer = transaction.customer ? new index_1.Customer(transaction.customer) : null;
39
- this.discount = transaction.discount ? new index_1.Discount(transaction.discount) : null;
40
- this.availablePaymentMethods = transaction.available_payment_methods ? transaction.available_payment_methods : null;
41
- }
42
- }
43
- exports.TransactionIncludes = TransactionIncludes;