@paddle/paddle-node-sdk 0.2.4 → 0.2.6

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 (130) hide show
  1. package/CHANGELOG.md +26 -1
  2. package/README.md +9 -6
  3. package/dist/entities/index.d.ts +1 -0
  4. package/dist/entities/index.js +1 -0
  5. package/dist/entities/price/price-with-includes.d.ts +2 -1
  6. package/dist/entities/price/price-with-includes.js +2 -0
  7. package/dist/entities/price/price.d.ts +2 -1
  8. package/dist/entities/price/price.js +2 -0
  9. package/dist/entities/pricing-preview/pricing-preview.d.ts +2 -0
  10. package/dist/entities/pricing-preview/pricing-preview.js +2 -1
  11. package/dist/entities/product/product-with-includes.d.ts +2 -1
  12. package/dist/entities/product/product-with-includes.js +2 -0
  13. package/dist/entities/product/product.d.ts +2 -1
  14. package/dist/entities/product/product.js +2 -0
  15. package/dist/entities/report/index.d.ts +4 -0
  16. package/dist/entities/report/index.js +20 -0
  17. package/dist/entities/report/report-collection.d.ts +6 -0
  18. package/dist/entities/report/report-collection.js +11 -0
  19. package/dist/entities/report/report-csv.d.ts +5 -0
  20. package/dist/entities/report/report-csv.js +9 -0
  21. package/dist/entities/report/report-filters.d.ts +8 -0
  22. package/dist/entities/report/report-filters.js +12 -0
  23. package/dist/entities/report/report.d.ts +13 -0
  24. package/dist/entities/report/report.js +17 -0
  25. package/dist/entities/transaction/transaction-preview.d.ts +2 -0
  26. package/dist/entities/transaction/transaction-preview.js +2 -0
  27. package/dist/enums/index.d.ts +1 -0
  28. package/dist/enums/index.js +1 -0
  29. package/dist/enums/report/index.d.ts +4 -0
  30. package/dist/enums/report/index.js +20 -0
  31. package/dist/enums/report/report-filter-name.d.ts +1 -0
  32. package/dist/enums/report/report-filter-name.js +2 -0
  33. package/dist/enums/report/report-filter-operator.d.ts +1 -0
  34. package/dist/enums/report/report-filter-operator.js +2 -0
  35. package/dist/enums/report/report-status.d.ts +1 -0
  36. package/dist/enums/report/report-status.js +2 -0
  37. package/dist/enums/report/report-type.d.ts +1 -0
  38. package/dist/enums/report/report-type.js +2 -0
  39. package/dist/enums/shared/available-payment-methods.d.ts +1 -0
  40. package/dist/enums/shared/available-payment-methods.js +2 -0
  41. package/dist/enums/shared/catalog-type.d.ts +1 -0
  42. package/dist/enums/shared/catalog-type.js +2 -0
  43. package/dist/enums/shared/index.d.ts +1 -0
  44. package/dist/enums/shared/index.js +1 -0
  45. package/dist/enums/subscription/index.d.ts +1 -0
  46. package/dist/enums/subscription/index.js +1 -0
  47. package/dist/enums/subscription/subscription-on-payment-failure.d.ts +1 -0
  48. package/dist/enums/subscription/subscription-on-payment-failure.js +2 -0
  49. package/dist/internal/api/client.js +2 -2
  50. package/dist/notifications/events/address/address-imported-event.d.ts +9 -0
  51. package/dist/notifications/events/address/address-imported-event.js +14 -0
  52. package/dist/notifications/events/address/index.d.ts +1 -0
  53. package/dist/notifications/events/address/index.js +1 -0
  54. package/dist/notifications/events/business/business-imported-event.d.ts +9 -0
  55. package/dist/notifications/events/business/business-imported-event.js +14 -0
  56. package/dist/notifications/events/business/index.d.ts +1 -0
  57. package/dist/notifications/events/business/index.js +1 -0
  58. package/dist/notifications/events/customer/customer-imported-event.d.ts +9 -0
  59. package/dist/notifications/events/customer/customer-imported-event.js +14 -0
  60. package/dist/notifications/events/customer/index.d.ts +1 -0
  61. package/dist/notifications/events/customer/index.js +1 -0
  62. package/dist/notifications/events/index.d.ts +1 -0
  63. package/dist/notifications/events/index.js +1 -0
  64. package/dist/notifications/events/price/index.d.ts +1 -0
  65. package/dist/notifications/events/price/index.js +1 -0
  66. package/dist/notifications/events/price/price-imported-event.d.ts +9 -0
  67. package/dist/notifications/events/price/price-imported-event.js +14 -0
  68. package/dist/notifications/events/product/index.d.ts +1 -0
  69. package/dist/notifications/events/product/index.js +1 -0
  70. package/dist/notifications/events/product/product-imported-event.d.ts +9 -0
  71. package/dist/notifications/events/product/product-imported-event.js +14 -0
  72. package/dist/notifications/events/report/index.d.ts +2 -0
  73. package/dist/notifications/events/report/index.js +18 -0
  74. package/dist/notifications/events/report/report-created-event.d.ts +9 -0
  75. package/dist/notifications/events/report/report-created-event.js +14 -0
  76. package/dist/notifications/events/report/report-updated-event.d.ts +9 -0
  77. package/dist/notifications/events/report/report-updated-event.js +14 -0
  78. package/dist/notifications/helpers/types.d.ts +11 -4
  79. package/dist/notifications/helpers/types.js +7 -0
  80. package/dist/notifications/helpers/webhooks.js +15 -1
  81. package/dist/paddle.d.ts +2 -1
  82. package/dist/paddle.js +1 -0
  83. package/dist/resources/index.d.ts +1 -0
  84. package/dist/resources/index.js +1 -0
  85. package/dist/resources/prices/operations/create-price-request-body.d.ts +2 -1
  86. package/dist/resources/prices/operations/list-price-query-parameters.d.ts +2 -1
  87. package/dist/resources/prices/operations/update-price-request-body.d.ts +2 -1
  88. package/dist/resources/products/operations/create-product-request-body.d.ts +2 -1
  89. package/dist/resources/products/operations/list-product-query-parameters.d.ts +2 -1
  90. package/dist/resources/products/operations/update-product-request-body.d.ts +2 -1
  91. package/dist/resources/reports/index.d.ts +10 -0
  92. package/dist/resources/reports/index.js +69 -0
  93. package/dist/resources/reports/operations/create-report-request-object.d.ts +6 -0
  94. package/dist/resources/reports/operations/create-report-request-object.js +2 -0
  95. package/dist/resources/reports/operations/index.d.ts +2 -0
  96. package/dist/resources/reports/operations/index.js +18 -0
  97. package/dist/resources/reports/operations/list-report-query-parameters.d.ts +7 -0
  98. package/dist/resources/reports/operations/list-report-query-parameters.js +2 -0
  99. package/dist/resources/subscriptions/operations/create-subscription-charge-request-object.d.ts +16 -2
  100. package/dist/resources/subscriptions/operations/update-subscription-request-body.d.ts +2 -1
  101. package/dist/resources/transactions/operations/create-transaction-request-body.d.ts +2 -2
  102. package/dist/resources/transactions/operations/update-transaction-request-body.d.ts +2 -2
  103. package/dist/types/events/events-response.d.ts +23 -1
  104. package/dist/types/index.d.ts +1 -0
  105. package/dist/types/index.js +1 -0
  106. package/dist/types/price/index.d.ts +2 -0
  107. package/dist/types/price/index.js +2 -0
  108. package/dist/types/price/non-catalog-price-request.d.ts +24 -0
  109. package/dist/types/price/non-catalog-price-request.js +2 -0
  110. package/dist/types/price/price-response.d.ts +2 -1
  111. package/dist/types/price/subscription-non-catalog-price-request.d.ts +22 -0
  112. package/dist/types/price/subscription-non-catalog-price-request.js +2 -0
  113. package/dist/types/pricing-preview/pricing-preview-response.d.ts +2 -0
  114. package/dist/types/product/product-response.d.ts +2 -1
  115. package/dist/types/report/index.d.ts +3 -0
  116. package/dist/types/report/index.js +19 -0
  117. package/dist/types/report/report-filters.d.ts +6 -0
  118. package/dist/types/report/report-filters.js +2 -0
  119. package/dist/types/report/report.d.ts +11 -0
  120. package/dist/types/report/report.js +2 -0
  121. package/dist/types/report/reports-csv.d.ts +3 -0
  122. package/dist/types/report/reports-csv.js +2 -0
  123. package/dist/types/shared/shared-price-response.d.ts +2 -1
  124. package/dist/types/shared/shared-product-response.d.ts +2 -1
  125. package/dist/types/transaction/transaction-item.d.ts +9 -1
  126. package/dist/types/transaction/transaction-preview-item.d.ts +12 -2
  127. package/dist/types/transaction/transaction-preview-response.d.ts +2 -0
  128. package/dist/version.d.ts +1 -1
  129. package/dist/version.js +1 -1
  130. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -8,6 +8,32 @@ 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.2.6 - 2023-12-22
12
+
13
+ ### Added
14
+
15
+ - Added support for `address.imported`, `business.imported`, `customer.imported`, `price.imported` and `product.imported` notifications.
16
+
17
+ ### Changed
18
+
19
+ - Added support to get available payment methods when previewing prices or transactions, see [related changelog](https://developer.paddle.com/changelog/2023/available-payment-methods?utm_source=dx&utm_medium=paddle-node-sdk).
20
+ - Added support to bill a one time non-catalog products and prices to subscription, see [related changelog](https://developer.paddle.com/changelog/2023/bill-custom-items-one-time-subscription-charge?utm_source=dx&utm_medium=paddle-node-sdk).
21
+ - Added support for non-catalog products and prices to transaction, see [related changelog](https://developer.paddle.com/changelog/2023/add-custom-items-transaction?utm_source=dx&utm_medium=paddle-node-sdk).
22
+ - Added `subscription.onPaymentFailure` to update subscriptions and preview update subscription operations, see [related changelog](https://developer.paddle.com/changelog/2023/payment-failure-behavior-update-subscription?utm_source=dx&utm_medium=paddle-node-sdk).
23
+
24
+ ---
25
+
26
+ ## 0.2.5 - 2023-12-15
27
+
28
+ ### Added
29
+
30
+ - Added `reports.list()` to [list reports](https://developer.paddle.com/api-reference/reports/list-reports?utm_source=dx&utm_medium=paddle-node-sdk)
31
+ - Added `reports.create()` to [create a new report](https://developer.paddle.com/api-reference/reports/create-report?utm_source=dx&utm_medium=paddle-node-sdk)
32
+ - Added `reports.get()` to [get a report](https://developer.paddle.com/api-reference/reports/get-report?utm_source=dx&utm_medium=paddle-node-sdk)
33
+ - Added `reports.getReportCsv()` to [get a CSV file for a report](https://developer.paddle.com/api-reference/reports/get-report-csv?utm_source=dx&utm_medium=paddle-node-sdk)
34
+
35
+ ---
36
+
11
37
  ## 0.2.4 - 2023-12-14
12
38
 
13
39
  ### Changed
@@ -33,7 +59,6 @@ Check our main [developer changelog](https://developer.paddle.com/?utm_source=dx
33
59
  - Added `notifications.replay()` to [replay a notification](https://developer.paddle.com/api-reference/notifications/replay-notification?utm_source=dx&utm_medium=paddle-node-sdk)
34
60
  - Added `notifications.getLogs()` to [get all logs for a notification](https://developer.paddle.com/api-reference/notification-logs/list-notification-logs?utm_source=dx&utm_medium=paddle-node-sdk)
35
61
 
36
-
37
62
  ### Fixed
38
63
 
39
64
  - Fixed incorrect type of `action` in `subscriptions.scheduled_change`
package/README.md CHANGED
@@ -235,13 +235,13 @@ app.post('/webhooks', express.raw({ type: 'application/json' }), (req: Request,
235
235
  // req.body should be of type `buffer`, convert to string before passing it to `unmarshal`.
236
236
  // If express returned a JSON, remove any other middleware that might have processed raw request to object
237
237
  const rawRequestBody = req.body.toString();
238
- // Replace with `PRIVATE_KEY` from vendor dashboard
239
- const privateKey = process.env['PRIVATE_KEY'] || '';
238
+ // Replace `WEBHOOK_SECRET_KEY` with the secret key in notifications from vendor dashboard
239
+ const secretKey = process.env['WEBHOOK_SECRET_KEY'] || '';
240
240
 
241
241
  try {
242
242
  if (signature && rawRequestBody) {
243
243
  // The `unmarshal` function will validate the integrity of the webhook and return an entity
244
- const eventData = paddle.webhooks.unmarshal(rawRequestBody, privateKey, signature);
244
+ const eventData = paddle.webhooks.unmarshal(rawRequestBody, secretKey, signature);
245
245
  switch (eventData.eventType) {
246
246
  case EventName.ProductUpdated:
247
247
  console.log(`Product ${eventData.data.id} was updated`);
@@ -269,9 +269,7 @@ app.listen(3000)
269
269
 
270
270
  ## Feature parity
271
271
 
272
- While in early access, not all operations in the Paddle API are available in our Node.js SDK. We're working on complete feature parity for our final release.
273
-
274
- This table shows which operations are available as of the latest release.
272
+ The Node.js SDK has complete feature parity with the Paddle API. All operations in the Paddle API are supported.
275
273
 
276
274
  | Paddle API operation | Support |
277
275
  |----------------------------------------------|:--------:|
@@ -330,6 +328,11 @@ This table shows which operations are available as of the latest release.
330
328
  | Create an adjustment | ✅ |
331
329
  | **Pricing preview** | **Full** |
332
330
  | Preview prices | ✅ |
331
+ | **Reports** | **Full** |
332
+ | List reports | ✅ |
333
+ | Create a report | ✅ |
334
+ | Get a report | ✅ |
335
+ | Get a CSV file for a report | ✅ |
333
336
  | **Event types** | **Full** |
334
337
  | List event types | ✅ |
335
338
  | **Events** | **Full** |
@@ -13,4 +13,5 @@ export * from './payout';
13
13
  export * from './event-types';
14
14
  export * from './notification-settings';
15
15
  export * from './notifications';
16
+ export * from './report';
16
17
  export type CustomData = object;
@@ -29,3 +29,4 @@ __exportStar(require("./payout"), exports);
29
29
  __exportStar(require("./event-types"), exports);
30
30
  __exportStar(require("./notification-settings"), exports);
31
31
  __exportStar(require("./notifications"), exports);
32
+ __exportStar(require("./report"), exports);
@@ -1,11 +1,12 @@
1
1
  import { type IPriceResponse } from '../../types';
2
2
  import { type CustomData, ImportMeta, Money, PriceQuantity, Product, TimePeriod, UnitPriceOverride } from '../index';
3
- import { type Status, type TaxMode } from '../../enums';
3
+ import { type CatalogType, type Status, type TaxMode } from '../../enums';
4
4
  export declare class PriceWithIncludes {
5
5
  readonly id: string;
6
6
  readonly productId: string;
7
7
  readonly description: string;
8
8
  readonly name: string | null;
9
+ readonly type: CatalogType | null;
9
10
  readonly billingCycle: TimePeriod | null;
10
11
  readonly trialPeriod: TimePeriod | null;
11
12
  readonly taxMode: TaxMode;
@@ -4,9 +4,11 @@ exports.PriceWithIncludes = void 0;
4
4
  const index_1 = require("../index");
5
5
  class PriceWithIncludes {
6
6
  constructor(price) {
7
+ var _a;
7
8
  this.id = price.id;
8
9
  this.productId = price.product_id;
9
10
  this.description = price.description;
11
+ this.type = (_a = price.type) !== null && _a !== void 0 ? _a : null;
10
12
  this.name = price.name ? price.name : null;
11
13
  this.billingCycle = price.billing_cycle ? new index_1.TimePeriod(price.billing_cycle) : null;
12
14
  this.trialPeriod = price.trial_period ? new index_1.TimePeriod(price.trial_period) : null;
@@ -1,11 +1,12 @@
1
1
  import { type ICustomData, type ISharedPriceResponse } from '../../types';
2
2
  import { TimePeriod, Money, UnitPriceOverride, PriceQuantity, ImportMeta } from '../index';
3
- import { type TaxMode, type Status } from '../../enums';
3
+ import { type TaxMode, type Status, type CatalogType } from '../../enums';
4
4
  export declare class Price {
5
5
  readonly id: string;
6
6
  readonly productId: string;
7
7
  readonly description: string;
8
8
  readonly name: string | null;
9
+ readonly type: CatalogType | null;
9
10
  readonly billingCycle: TimePeriod | null;
10
11
  readonly trialPeriod: TimePeriod | null;
11
12
  readonly taxMode: TaxMode;
@@ -4,9 +4,11 @@ exports.Price = void 0;
4
4
  const index_1 = require("../index");
5
5
  class Price {
6
6
  constructor(price) {
7
+ var _a;
7
8
  this.id = price.id;
8
9
  this.productId = price.product_id;
9
10
  this.description = price.description;
11
+ this.type = (_a = price.type) !== null && _a !== void 0 ? _a : null;
10
12
  this.name = price.name ? price.name : null;
11
13
  this.billingCycle = price.billing_cycle ? new index_1.TimePeriod(price.billing_cycle) : null;
12
14
  this.trialPeriod = price.trial_period ? new index_1.TimePeriod(price.trial_period) : null;
@@ -2,6 +2,7 @@ import { type CurrencyCode } from '../../enums';
2
2
  import { type IPricingPreviewResponse } from '../../types';
3
3
  import { AddressPreview } from '../transaction';
4
4
  import { PricingPreviewDetails } from './pricing-preview-details';
5
+ import { type AvailablePaymentMethod } from '../../enums/shared/available-payment-methods';
5
6
  export declare class PricingPreview {
6
7
  readonly customerId: string | null;
7
8
  readonly addressId: string | null;
@@ -11,5 +12,6 @@ export declare class PricingPreview {
11
12
  readonly address: AddressPreview | null;
12
13
  readonly customerIpAddress: string | null;
13
14
  readonly details: PricingPreviewDetails | null;
15
+ readonly availablePaymentMethods: AvailablePaymentMethod | null;
14
16
  constructor(pricePreview: IPricingPreviewResponse);
15
17
  }
@@ -5,7 +5,7 @@ const transaction_1 = require("../transaction");
5
5
  const pricing_preview_details_1 = require("./pricing-preview-details");
6
6
  class PricingPreview {
7
7
  constructor(pricePreview) {
8
- var _a, _b, _c, _d, _e, _f;
8
+ var _a, _b, _c, _d, _e, _f, _g;
9
9
  this.customerId = (_a = pricePreview.customer_id) !== null && _a !== void 0 ? _a : null;
10
10
  this.addressId = (_b = pricePreview.address_id) !== null && _b !== void 0 ? _b : null;
11
11
  this.businessId = (_c = pricePreview.business_id) !== null && _c !== void 0 ? _c : null;
@@ -14,6 +14,7 @@ class PricingPreview {
14
14
  this.address = pricePreview.address ? new transaction_1.AddressPreview(pricePreview.address) : null;
15
15
  this.customerIpAddress = (_f = pricePreview.customer_ip_address) !== null && _f !== void 0 ? _f : null;
16
16
  this.details = pricePreview.details ? new pricing_preview_details_1.PricingPreviewDetails(pricePreview.details) : null;
17
+ this.availablePaymentMethods = (_g = pricePreview.available_payment_method) !== null && _g !== void 0 ? _g : null;
17
18
  }
18
19
  }
19
20
  exports.PricingPreview = PricingPreview;
@@ -1,9 +1,10 @@
1
1
  import { type IProductResponse } from '../../types';
2
2
  import { type CustomData, ImportMeta, Price } from '../index';
3
- import { type Status, type TaxCategory } from '../../enums';
3
+ import { type CatalogType, type Status, type TaxCategory } from '../../enums';
4
4
  export declare class ProductWithIncludes {
5
5
  readonly id: string;
6
6
  readonly name: string;
7
+ readonly type: CatalogType | null;
7
8
  readonly description: string | null;
8
9
  readonly taxCategory: TaxCategory;
9
10
  readonly imageUrl: string | null;
@@ -4,8 +4,10 @@ exports.ProductWithIncludes = void 0;
4
4
  const index_1 = require("../index");
5
5
  class ProductWithIncludes {
6
6
  constructor(product) {
7
+ var _a;
7
8
  this.id = product.id;
8
9
  this.name = product.name;
10
+ this.type = (_a = product.type) !== null && _a !== void 0 ? _a : null;
9
11
  this.description = product.description ? product.description : null;
10
12
  this.taxCategory = product.tax_category;
11
13
  this.imageUrl = product.image_url ? product.image_url : null;
@@ -1,9 +1,10 @@
1
1
  import { type ISharedProductResponse } from '../../types';
2
2
  import { type CustomData, ImportMeta } from '../index';
3
- import { type TaxCategory, type Status } from '../../enums';
3
+ import { type TaxCategory, type Status, type CatalogType } from '../../enums';
4
4
  export declare class Product {
5
5
  readonly id: string;
6
6
  readonly name: string;
7
+ readonly type: CatalogType | null;
7
8
  readonly description: string | null;
8
9
  readonly taxCategory: TaxCategory;
9
10
  readonly imageUrl: string | null;
@@ -4,8 +4,10 @@ exports.Product = void 0;
4
4
  const index_1 = require("../index");
5
5
  class Product {
6
6
  constructor(product) {
7
+ var _a;
7
8
  this.id = product.id;
8
9
  this.name = product.name;
10
+ this.type = (_a = product.type) !== null && _a !== void 0 ? _a : null;
9
11
  this.description = product.description ? product.description : null;
10
12
  this.taxCategory = product.tax_category;
11
13
  this.imageUrl = product.image_url ? product.image_url : null;
@@ -0,0 +1,4 @@
1
+ export * from './report-filters';
2
+ export * from './report';
3
+ export * from './report-csv';
4
+ export * from './report-collection';
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./report-filters"), exports);
18
+ __exportStar(require("./report"), exports);
19
+ __exportStar(require("./report-csv"), exports);
20
+ __exportStar(require("./report-collection"), exports);
@@ -0,0 +1,6 @@
1
+ import { Report } from '../../entities';
2
+ import { type IReportResponse } from '../../types';
3
+ import { Collection } from '../../internal/base';
4
+ export declare class ReportCollection extends Collection<IReportResponse, Report> {
5
+ fromJson(data: IReportResponse): Report;
6
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReportCollection = void 0;
4
+ const entities_1 = require("../../entities");
5
+ const base_1 = require("../../internal/base");
6
+ class ReportCollection extends base_1.Collection {
7
+ fromJson(data) {
8
+ return new entities_1.Report(data);
9
+ }
10
+ }
11
+ exports.ReportCollection = ReportCollection;
@@ -0,0 +1,5 @@
1
+ import { type IReportCsvResponse } from '../../types';
2
+ export declare class ReportCsv {
3
+ readonly url: string;
4
+ constructor(response: IReportCsvResponse);
5
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReportCsv = void 0;
4
+ class ReportCsv {
5
+ constructor(response) {
6
+ this.url = response.url;
7
+ }
8
+ }
9
+ exports.ReportCsv = ReportCsv;
@@ -0,0 +1,8 @@
1
+ import { type IReportFilters } from '../../types';
2
+ import { type ReportFilterName, type ReportFilterOperator } from '../../enums';
3
+ export declare class ReportFilters {
4
+ readonly name: ReportFilterName;
5
+ readonly operator: null | ReportFilterOperator;
6
+ readonly value: string[] | string;
7
+ constructor(reportFiltersResponse: IReportFilters);
8
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReportFilters = void 0;
4
+ class ReportFilters {
5
+ constructor(reportFiltersResponse) {
6
+ var _a;
7
+ this.name = reportFiltersResponse.name;
8
+ this.operator = (_a = reportFiltersResponse.operator) !== null && _a !== void 0 ? _a : null;
9
+ this.value = reportFiltersResponse.value;
10
+ }
11
+ }
12
+ exports.ReportFilters = ReportFilters;
@@ -0,0 +1,13 @@
1
+ import { type IReportResponse } from '../../types';
2
+ import { ReportFilters } from '../index';
3
+ import { type ReportStatus, type ReportType } from '../../enums';
4
+ export declare class Report {
5
+ readonly id: string;
6
+ readonly status: ReportStatus;
7
+ readonly rows: number | null;
8
+ readonly type: ReportType;
9
+ readonly filters: ReportFilters[];
10
+ readonly expiresAt: string | null;
11
+ readonly createdAt: string;
12
+ constructor(reportResponse: IReportResponse);
13
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Report = void 0;
4
+ const index_1 = require("../index");
5
+ class Report {
6
+ constructor(reportResponse) {
7
+ var _a, _b, _c;
8
+ this.id = reportResponse.id;
9
+ this.status = reportResponse.status;
10
+ this.rows = (_a = reportResponse.rows) !== null && _a !== void 0 ? _a : null;
11
+ this.type = reportResponse.type;
12
+ this.filters = (_b = reportResponse.filters) === null || _b === void 0 ? void 0 : _b.map((filter) => new index_1.ReportFilters(filter));
13
+ this.expiresAt = (_c = reportResponse.expires_at) !== null && _c !== void 0 ? _c : null;
14
+ this.createdAt = reportResponse.created_at;
15
+ }
16
+ }
17
+ exports.Report = Report;
@@ -1,6 +1,7 @@
1
1
  import { type ITransactionPreviewResponse } from '../../types';
2
2
  import { AddressPreview, TransactionDetailsPreview, TransactionItemPreview } from '../index';
3
3
  import { type CurrencyCode } from '../../enums';
4
+ import { type AvailablePaymentMethod } from '../../enums/shared/available-payment-methods';
4
5
  export declare class TransactionPreview {
5
6
  readonly customerId: string | null;
6
7
  readonly addressId: string | null;
@@ -12,5 +13,6 @@ export declare class TransactionPreview {
12
13
  readonly ignoreTrials: boolean | null;
13
14
  readonly items: TransactionItemPreview[];
14
15
  readonly details: TransactionDetailsPreview;
16
+ readonly availablePaymentMethods: AvailablePaymentMethod | null;
15
17
  constructor(transactionPreview: ITransactionPreviewResponse);
16
18
  }
@@ -4,6 +4,7 @@ exports.TransactionPreview = void 0;
4
4
  const index_1 = require("../index");
5
5
  class TransactionPreview {
6
6
  constructor(transactionPreview) {
7
+ var _a;
7
8
  this.customerId = transactionPreview.customer_id ? transactionPreview.customer_id : null;
8
9
  this.addressId = transactionPreview.address_id ? transactionPreview.address_id : null;
9
10
  this.businessId = transactionPreview.business_id ? transactionPreview.business_id : null;
@@ -14,6 +15,7 @@ class TransactionPreview {
14
15
  this.ignoreTrials = transactionPreview.ignore_trials ? transactionPreview.ignore_trials : null;
15
16
  this.items = transactionPreview.items.map((item) => new index_1.TransactionItemPreview(item));
16
17
  this.details = new index_1.TransactionDetailsPreview(transactionPreview.details);
18
+ this.availablePaymentMethods = (_a = transactionPreview.available_payment_method) !== null && _a !== void 0 ? _a : null;
17
19
  }
18
20
  }
19
21
  exports.TransactionPreview = TransactionPreview;
@@ -6,3 +6,4 @@ export * from './transaction';
6
6
  export * from './payout';
7
7
  export * from './notification-settings';
8
8
  export * from './notification';
9
+ export * from './report';
@@ -22,3 +22,4 @@ __exportStar(require("./transaction"), exports);
22
22
  __exportStar(require("./payout"), exports);
23
23
  __exportStar(require("./notification-settings"), exports);
24
24
  __exportStar(require("./notification"), exports);
25
+ __exportStar(require("./report"), exports);
@@ -0,0 +1,4 @@
1
+ export * from './report-status';
2
+ export * from './report-type';
3
+ export * from './report-filter-name';
4
+ export * from './report-filter-operator';
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./report-status"), exports);
18
+ __exportStar(require("./report-type"), exports);
19
+ __exportStar(require("./report-filter-name"), exports);
20
+ __exportStar(require("./report-filter-operator"), exports);
@@ -0,0 +1 @@
1
+ export type ReportFilterName = 'action' | 'collection_mode' | 'currency_code' | 'origin' | 'status' | 'updated_at';
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export type ReportFilterOperator = 'lt' | 'gte';
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export type ReportStatus = 'pending' | 'ready' | 'failed' | 'expired';
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export type ReportType = 'adjustments' | 'adjustment_line_items' | 'transactions' | 'transaction_line_items';
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export type AvailablePaymentMethod = 'alipay' | 'apple_pay' | 'bancontact' | 'card' | 'google_pay' | 'ideal' | 'paypal';
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export type CatalogType = 'standard' | 'custom';
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -11,3 +11,4 @@ export * from './payout-currency-code';
11
11
  export * from './payment-attempt-status';
12
12
  export * from './error-code';
13
13
  export * from './payment-type';
14
+ export * from './catalog-type';
@@ -27,3 +27,4 @@ __exportStar(require("./payout-currency-code"), exports);
27
27
  __exportStar(require("./payment-attempt-status"), exports);
28
28
  __exportStar(require("./error-code"), exports);
29
29
  __exportStar(require("./payment-type"), exports);
30
+ __exportStar(require("./catalog-type"), exports);
@@ -3,3 +3,4 @@ export * from './proration-billing-mode';
3
3
  export * from './scheduled-change-action';
4
4
  export * from './subscription-status';
5
5
  export * from './subscription-item-status';
6
+ export * from './subscription-on-payment-failure';
@@ -19,3 +19,4 @@ __exportStar(require("./proration-billing-mode"), exports);
19
19
  __exportStar(require("./scheduled-change-action"), exports);
20
20
  __exportStar(require("./subscription-status"), exports);
21
21
  __exportStar(require("./subscription-item-status"), exports);
22
+ __exportStar(require("./subscription-on-payment-failure"), exports);
@@ -0,0 +1 @@
1
+ export type SubscriptionOnPaymentFailure = 'prevent_change' | 'apply_change';
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -28,7 +28,7 @@ class Client {
28
28
  }
29
29
  getBaseUrl(environment) {
30
30
  const urlBasedOnEnv = constants_1.API_ENVIRONMENT_TO_BASE_URL_MAP[environment !== null && environment !== void 0 ? environment : environment_1.Environment.production];
31
- return urlBasedOnEnv || '';
31
+ return urlBasedOnEnv || environment;
32
32
  }
33
33
  getHeaders() {
34
34
  const uuid = (0, crypto_1.randomUUID)();
@@ -45,7 +45,7 @@ class Client {
45
45
  if (!finalUrl.includes('?') && queryParams) {
46
46
  finalUrl += queryParams.toQueryString();
47
47
  }
48
- const logUrl = url.split('?')[0];
48
+ const logUrl = finalUrl.split('?')[0];
49
49
  const headers = this.getHeaders();
50
50
  logger_1.Logger.logRequest('GET', logUrl, headers);
51
51
  const rawResponse = yield (0, node_fetch_1.default)(finalUrl, {
@@ -0,0 +1,9 @@
1
+ import { Event } from '../../../entities/events/event';
2
+ import { Address } from '../../../entities';
3
+ import { type IAddressResponse, type IEventsResponse } from '../../../types';
4
+ import { EventName } from '../../helpers';
5
+ export declare class AddressImportedEvent extends Event {
6
+ readonly eventType = EventName.AddressImported;
7
+ readonly data: Address;
8
+ constructor(response: IEventsResponse<IAddressResponse>);
9
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AddressImportedEvent = void 0;
4
+ const event_1 = require("../../../entities/events/event");
5
+ const entities_1 = require("../../../entities");
6
+ const helpers_1 = require("../../helpers");
7
+ class AddressImportedEvent extends event_1.Event {
8
+ constructor(response) {
9
+ super(response);
10
+ this.eventType = helpers_1.EventName.AddressImported;
11
+ this.data = new entities_1.Address(response.data);
12
+ }
13
+ }
14
+ exports.AddressImportedEvent = AddressImportedEvent;
@@ -1,2 +1,3 @@
1
1
  export * from './address-created-event';
2
2
  export * from './address-updated-event';
3
+ export * from './address-imported-event';
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./address-created-event"), exports);
18
18
  __exportStar(require("./address-updated-event"), exports);
19
+ __exportStar(require("./address-imported-event"), exports);
@@ -0,0 +1,9 @@
1
+ import { Event } from '../../../entities/events/event';
2
+ import { Business } from '../../../entities';
3
+ import { type IBusinessResponse, type IEventsResponse } from '../../../types';
4
+ import { EventName } from '../../helpers';
5
+ export declare class BusinessImportedEvent extends Event {
6
+ readonly eventType = EventName.BusinessImported;
7
+ readonly data: Business;
8
+ constructor(response: IEventsResponse<IBusinessResponse>);
9
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BusinessImportedEvent = void 0;
4
+ const event_1 = require("../../../entities/events/event");
5
+ const entities_1 = require("../../../entities");
6
+ const helpers_1 = require("../../helpers");
7
+ class BusinessImportedEvent extends event_1.Event {
8
+ constructor(response) {
9
+ super(response);
10
+ this.eventType = helpers_1.EventName.BusinessImported;
11
+ this.data = new entities_1.Business(response.data);
12
+ }
13
+ }
14
+ exports.BusinessImportedEvent = BusinessImportedEvent;
@@ -1,2 +1,3 @@
1
1
  export * from './business-created-event';
2
2
  export * from './business-updated-event';
3
+ export * from './business-imported-event';
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./business-created-event"), exports);
18
18
  __exportStar(require("./business-updated-event"), exports);
19
+ __exportStar(require("./business-imported-event"), exports);
@@ -0,0 +1,9 @@
1
+ import { Event } from '../../../entities/events/event';
2
+ import { Customer } from '../../../entities';
3
+ import { type ICustomerResponse, type IEventsResponse } from '../../../types';
4
+ import { EventName } from '../../helpers';
5
+ export declare class CustomerImportedEvent extends Event {
6
+ readonly eventType = EventName.CustomerImported;
7
+ readonly data: Customer;
8
+ constructor(response: IEventsResponse<ICustomerResponse>);
9
+ }