@paddle/paddle-node-sdk 0.2.0 → 0.2.2

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 (201) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +90 -11
  3. package/dist/entities/discount/discount.d.ts +1 -1
  4. package/dist/entities/discount/discount.js +2 -1
  5. package/dist/entities/events/event-collection.d.ts +6 -0
  6. package/dist/entities/events/event-collection.js +11 -0
  7. package/dist/entities/events/event.d.ts +9 -0
  8. package/dist/entities/events/event.js +14 -0
  9. package/dist/entities/events/index.d.ts +1 -0
  10. package/dist/entities/events/index.js +17 -0
  11. package/dist/entities/index.d.ts +2 -0
  12. package/dist/entities/index.js +2 -0
  13. package/dist/entities/payout/index.d.ts +1 -0
  14. package/dist/entities/payout/index.js +17 -0
  15. package/dist/entities/payout/payout.d.ts +9 -0
  16. package/dist/entities/payout/payout.js +12 -0
  17. package/dist/entities/pricing-preview/index.d.ts +4 -0
  18. package/dist/entities/pricing-preview/index.js +20 -0
  19. package/dist/entities/pricing-preview/pricing-preview-details.d.ts +6 -0
  20. package/dist/entities/pricing-preview/pricing-preview-details.js +10 -0
  21. package/dist/entities/pricing-preview/pricing-preview-discounts.d.ts +8 -0
  22. package/dist/entities/pricing-preview/pricing-preview-discounts.js +12 -0
  23. package/dist/entities/pricing-preview/pricing-preview-line-item.d.ts +17 -0
  24. package/dist/entities/pricing-preview/pricing-preview-line-item.js +21 -0
  25. package/dist/entities/pricing-preview/pricing-preview.d.ts +15 -0
  26. package/dist/entities/pricing-preview/pricing-preview.js +19 -0
  27. package/dist/entities/subscription/index.d.ts +1 -0
  28. package/dist/entities/subscription/index.js +1 -0
  29. package/dist/entities/subscription/subscription-notification.d.ts +28 -0
  30. package/dist/entities/subscription/subscription-notification.js +35 -0
  31. package/dist/enums/index.d.ts +1 -0
  32. package/dist/enums/index.js +1 -0
  33. package/dist/enums/payout/index.d.ts +1 -0
  34. package/dist/enums/payout/index.js +17 -0
  35. package/dist/enums/payout/payout-status.d.ts +1 -0
  36. package/dist/enums/payout/payout-status.js +2 -0
  37. package/dist/notifications/events/address/address-created-event.d.ts +9 -0
  38. package/dist/notifications/events/address/address-created-event.js +14 -0
  39. package/dist/notifications/events/address/address-updated-event.d.ts +9 -0
  40. package/dist/notifications/events/address/address-updated-event.js +14 -0
  41. package/dist/notifications/events/address/index.d.ts +2 -0
  42. package/dist/notifications/events/address/index.js +18 -0
  43. package/dist/notifications/events/adjustment/adjustment-created-event.d.ts +9 -0
  44. package/dist/notifications/events/adjustment/adjustment-created-event.js +14 -0
  45. package/dist/notifications/events/adjustment/adjustment-updated-event.d.ts +9 -0
  46. package/dist/notifications/events/adjustment/adjustment-updated-event.js +14 -0
  47. package/dist/notifications/events/adjustment/index.d.ts +2 -0
  48. package/dist/notifications/events/adjustment/index.js +18 -0
  49. package/dist/notifications/events/business/business-created-event.d.ts +9 -0
  50. package/dist/notifications/events/business/business-created-event.js +14 -0
  51. package/dist/notifications/events/business/business-updated-event.d.ts +9 -0
  52. package/dist/notifications/events/business/business-updated-event.js +14 -0
  53. package/dist/notifications/events/business/index.d.ts +2 -0
  54. package/dist/notifications/events/business/index.js +18 -0
  55. package/dist/notifications/events/customer/customer-created-event.d.ts +9 -0
  56. package/dist/notifications/events/customer/customer-created-event.js +14 -0
  57. package/dist/notifications/events/customer/customer-updated-event.d.ts +9 -0
  58. package/dist/notifications/events/customer/customer-updated-event.js +14 -0
  59. package/dist/notifications/events/customer/index.d.ts +2 -0
  60. package/dist/notifications/events/customer/index.js +18 -0
  61. package/dist/notifications/events/discount/discount-created-event.d.ts +9 -0
  62. package/dist/notifications/events/discount/discount-created-event.js +14 -0
  63. package/dist/notifications/events/discount/discount-imported-event.d.ts +9 -0
  64. package/dist/notifications/events/discount/discount-imported-event.js +14 -0
  65. package/dist/notifications/events/discount/discount-updated-event.d.ts +9 -0
  66. package/dist/notifications/events/discount/discount-updated-event.js +14 -0
  67. package/dist/notifications/events/discount/index.d.ts +3 -0
  68. package/dist/notifications/events/discount/index.js +19 -0
  69. package/dist/notifications/events/index.d.ts +10 -0
  70. package/dist/notifications/events/index.js +26 -0
  71. package/dist/notifications/events/payout/index.d.ts +2 -0
  72. package/dist/notifications/events/payout/index.js +18 -0
  73. package/dist/notifications/events/payout/payout-created-event.d.ts +9 -0
  74. package/dist/notifications/events/payout/payout-created-event.js +14 -0
  75. package/dist/notifications/events/payout/payout-paid-event.d.ts +9 -0
  76. package/dist/notifications/events/payout/payout-paid-event.js +14 -0
  77. package/dist/notifications/events/price/index.d.ts +2 -0
  78. package/dist/notifications/events/price/index.js +18 -0
  79. package/dist/notifications/events/price/price-created-event.d.ts +9 -0
  80. package/dist/notifications/events/price/price-created-event.js +14 -0
  81. package/dist/notifications/events/price/price-updated-event.d.ts +9 -0
  82. package/dist/notifications/events/price/price-updated-event.js +14 -0
  83. package/dist/notifications/events/product/index.d.ts +2 -0
  84. package/dist/notifications/events/product/index.js +18 -0
  85. package/dist/notifications/events/product/product-created-event.d.ts +9 -0
  86. package/dist/notifications/events/product/product-created-event.js +14 -0
  87. package/dist/notifications/events/product/product-updated-event.d.ts +9 -0
  88. package/dist/notifications/events/product/product-updated-event.js +14 -0
  89. package/dist/notifications/events/subscription/index.d.ts +9 -0
  90. package/dist/notifications/events/subscription/index.js +25 -0
  91. package/dist/notifications/events/subscription/subscription-activated-event.d.ts +9 -0
  92. package/dist/notifications/events/subscription/subscription-activated-event.js +14 -0
  93. package/dist/notifications/events/subscription/subscription-canceled-event.d.ts +9 -0
  94. package/dist/notifications/events/subscription/subscription-canceled-event.js +14 -0
  95. package/dist/notifications/events/subscription/subscription-created-event.d.ts +9 -0
  96. package/dist/notifications/events/subscription/subscription-created-event.js +14 -0
  97. package/dist/notifications/events/subscription/subscription-imported-event.d.ts +9 -0
  98. package/dist/notifications/events/subscription/subscription-imported-event.js +14 -0
  99. package/dist/notifications/events/subscription/subscription-past-due-event.d.ts +9 -0
  100. package/dist/notifications/events/subscription/subscription-past-due-event.js +14 -0
  101. package/dist/notifications/events/subscription/subscription-paused-event.d.ts +9 -0
  102. package/dist/notifications/events/subscription/subscription-paused-event.js +14 -0
  103. package/dist/notifications/events/subscription/subscription-resumed-event.d.ts +9 -0
  104. package/dist/notifications/events/subscription/subscription-resumed-event.js +14 -0
  105. package/dist/notifications/events/subscription/subscription-trialing-event.d.ts +9 -0
  106. package/dist/notifications/events/subscription/subscription-trialing-event.js +14 -0
  107. package/dist/notifications/events/subscription/subscription-updated-event.d.ts +9 -0
  108. package/dist/notifications/events/subscription/subscription-updated-event.js +14 -0
  109. package/dist/notifications/events/transaction/index.d.ts +9 -0
  110. package/dist/notifications/events/transaction/index.js +25 -0
  111. package/dist/notifications/events/transaction/transaction-billed-event.d.ts +9 -0
  112. package/dist/notifications/events/transaction/transaction-billed-event.js +14 -0
  113. package/dist/notifications/events/transaction/transaction-canceled-event.d.ts +9 -0
  114. package/dist/notifications/events/transaction/transaction-canceled-event.js +14 -0
  115. package/dist/notifications/events/transaction/transaction-completed-event.d.ts +9 -0
  116. package/dist/notifications/events/transaction/transaction-completed-event.js +14 -0
  117. package/dist/notifications/events/transaction/transaction-created-event.d.ts +9 -0
  118. package/dist/notifications/events/transaction/transaction-created-event.js +14 -0
  119. package/dist/notifications/events/transaction/transaction-paid-event.d.ts +9 -0
  120. package/dist/notifications/events/transaction/transaction-paid-event.js +14 -0
  121. package/dist/notifications/events/transaction/transaction-past-due-event.d.ts +9 -0
  122. package/dist/notifications/events/transaction/transaction-past-due-event.js +14 -0
  123. package/dist/notifications/events/transaction/transaction-payment-failed-event.d.ts +9 -0
  124. package/dist/notifications/events/transaction/transaction-payment-failed-event.js +14 -0
  125. package/dist/notifications/events/transaction/transaction-ready-event.d.ts +9 -0
  126. package/dist/notifications/events/transaction/transaction-ready-event.js +14 -0
  127. package/dist/notifications/events/transaction/transaction-updated-event.d.ts +9 -0
  128. package/dist/notifications/events/transaction/transaction-updated-event.js +14 -0
  129. package/dist/notifications/helpers/index.d.ts +3 -0
  130. package/dist/notifications/helpers/index.js +19 -0
  131. package/dist/notifications/helpers/types.d.ts +40 -0
  132. package/dist/notifications/helpers/types.js +41 -0
  133. package/dist/notifications/{validator/notifications-validator.d.ts → helpers/webhooks-validator.d.ts} +1 -1
  134. package/dist/notifications/{validator/notifications-validator.js → helpers/webhooks-validator.js} +6 -6
  135. package/dist/notifications/helpers/webhooks.d.ts +7 -0
  136. package/dist/notifications/helpers/webhooks.js +98 -0
  137. package/dist/notifications/index.d.ts +2 -1
  138. package/dist/notifications/index.js +2 -1
  139. package/dist/paddle.d.ts +7 -2
  140. package/dist/paddle.js +6 -1
  141. package/dist/resources/addresses/index.d.ts +2 -1
  142. package/dist/resources/addresses/index.js +10 -7
  143. package/dist/resources/adjustments/index.d.ts +1 -1
  144. package/dist/resources/adjustments/index.js +2 -4
  145. package/dist/resources/businesses/index.d.ts +2 -1
  146. package/dist/resources/businesses/index.js +10 -7
  147. package/dist/resources/customers/index.d.ts +2 -1
  148. package/dist/resources/customers/index.js +7 -4
  149. package/dist/resources/discounts/index.d.ts +2 -1
  150. package/dist/resources/discounts/index.js +7 -4
  151. package/dist/resources/events/index.d.ts +7 -0
  152. package/dist/resources/events/index.js +30 -0
  153. package/dist/resources/events/operations/index.d.ts +1 -0
  154. package/dist/resources/events/operations/index.js +17 -0
  155. package/dist/resources/events/operations/list-events-query-parameters.d.ts +5 -0
  156. package/dist/resources/events/operations/list-events-query-parameters.js +2 -0
  157. package/dist/resources/index.d.ts +1 -0
  158. package/dist/resources/index.js +1 -0
  159. package/dist/resources/prices/index.d.ts +2 -1
  160. package/dist/resources/prices/index.js +7 -4
  161. package/dist/resources/pricing-preview/index.d.ts +7 -0
  162. package/dist/resources/pricing-preview/index.js +42 -0
  163. package/dist/resources/pricing-preview/operations/index.d.ts +1 -0
  164. package/dist/resources/pricing-preview/operations/index.js +17 -0
  165. package/dist/resources/pricing-preview/operations/pricing-preview-request-body.d.ts +17 -0
  166. package/dist/resources/pricing-preview/operations/pricing-preview-request-body.js +2 -0
  167. package/dist/resources/products/index.d.ts +2 -1
  168. package/dist/resources/products/index.js +7 -4
  169. package/dist/resources/subscriptions/index.d.ts +1 -1
  170. package/dist/resources/subscriptions/index.js +2 -4
  171. package/dist/resources/transactions/index.d.ts +1 -1
  172. package/dist/resources/transactions/index.js +2 -4
  173. package/dist/types/events/events-response.d.ts +125 -0
  174. package/dist/types/events/events-response.js +2 -0
  175. package/dist/types/events/index.d.ts +1 -0
  176. package/dist/types/events/index.js +17 -0
  177. package/dist/types/index.d.ts +3 -0
  178. package/dist/types/index.js +3 -0
  179. package/dist/types/payout/index.d.ts +1 -0
  180. package/dist/types/payout/index.js +17 -0
  181. package/dist/types/payout/payout-response.d.ts +7 -0
  182. package/dist/types/payout/payout-response.js +2 -0
  183. package/dist/types/pricing-preview/index.d.ts +5 -0
  184. package/dist/types/pricing-preview/index.js +21 -0
  185. package/dist/types/pricing-preview/pricing-preview-details-response.d.ts +4 -0
  186. package/dist/types/pricing-preview/pricing-preview-details-response.js +2 -0
  187. package/dist/types/pricing-preview/pricing-preview-discounts-response.d.ts +6 -0
  188. package/dist/types/pricing-preview/pricing-preview-discounts-response.js +2 -0
  189. package/dist/types/pricing-preview/pricing-preview-item-response.d.ts +4 -0
  190. package/dist/types/pricing-preview/pricing-preview-item-response.js +2 -0
  191. package/dist/types/pricing-preview/pricing-preview-line-item-response.d.ts +15 -0
  192. package/dist/types/pricing-preview/pricing-preview-line-item-response.js +2 -0
  193. package/dist/types/pricing-preview/pricing-preview-response.d.ts +15 -0
  194. package/dist/types/pricing-preview/pricing-preview-response.js +2 -0
  195. package/dist/types/subscription/index.d.ts +1 -0
  196. package/dist/types/subscription/index.js +1 -0
  197. package/dist/types/subscription/subscription-notification-response.d.ts +28 -0
  198. package/dist/types/subscription/subscription-notification-response.js +2 -0
  199. package/dist/version.d.ts +1 -1
  200. package/dist/version.js +1 -1
  201. package/package.json +1 -1
@@ -0,0 +1,42 @@
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
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
17
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
18
+ return new (P || (P = Promise))(function (resolve, reject) {
19
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
20
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
21
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
22
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
23
+ });
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.PricingPreviewResource = void 0;
27
+ const base_1 = require("../../internal/base");
28
+ const pricing_preview_1 = require("../../entities/pricing-preview");
29
+ const PricingPreviewPaths = {
30
+ preview: '/pricing-preview',
31
+ };
32
+ __exportStar(require("./operations"), exports);
33
+ class PricingPreviewResource extends base_1.BaseResource {
34
+ preview(pricePreviewParameter) {
35
+ return __awaiter(this, void 0, void 0, function* () {
36
+ const response = yield this.client.post(PricingPreviewPaths.preview, pricePreviewParameter);
37
+ const data = this.handleResponse(response);
38
+ return new pricing_preview_1.PricingPreview(data);
39
+ });
40
+ }
41
+ }
42
+ exports.PricingPreviewResource = PricingPreviewResource;
@@ -0,0 +1 @@
1
+ export * from './pricing-preview-request-body';
@@ -0,0 +1,17 @@
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("./pricing-preview-request-body"), exports);
@@ -0,0 +1,17 @@
1
+ import { type CurrencyCode } from '../../../enums';
2
+ import { type IAddressPreview } from '../../transactions';
3
+ interface IPricePreviewItem {
4
+ priceId: string;
5
+ quantity: number;
6
+ }
7
+ export interface PricingPreviewRequestBody {
8
+ items: IPricePreviewItem[];
9
+ customerId?: string | null;
10
+ addressId?: string | null;
11
+ businessId?: string | null;
12
+ currencyCode?: CurrencyCode;
13
+ discountId?: string | null;
14
+ address?: IAddressPreview | null;
15
+ customerIpAddress?: string | null;
16
+ }
17
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -3,8 +3,9 @@ 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
- list(queryParams?: ListProductQueryParameters): Promise<ProductCollection>;
6
+ list(queryParams?: ListProductQueryParameters): ProductCollection;
7
7
  create(createProductParameters: CreateProductRequestBody): Promise<Product>;
8
8
  get(productId: string, queryParams?: GetProductQueryParameters): Promise<ProductWithIncludes>;
9
9
  update(productId: string, updateProduct: UpdateProductRequestBody): Promise<Product>;
10
+ archive(productId: string): Promise<Product>;
10
11
  }
@@ -35,10 +35,8 @@ const ProductPaths = {
35
35
  __exportStar(require("./operations"), exports);
36
36
  class ProductsResource extends base_1.BaseResource {
37
37
  list(queryParams) {
38
- return __awaiter(this, void 0, void 0, function* () {
39
- const queryParameters = new base_1.QueryParameters(queryParams);
40
- return new entities_1.ProductCollection(this.client, ProductPaths.list + queryParameters.toQueryString());
41
- });
38
+ const queryParameters = new base_1.QueryParameters(queryParams);
39
+ return new entities_1.ProductCollection(this.client, ProductPaths.list + queryParameters.toQueryString());
42
40
  }
43
41
  create(createProductParameters) {
44
42
  return __awaiter(this, void 0, void 0, function* () {
@@ -68,5 +66,10 @@ class ProductsResource extends base_1.BaseResource {
68
66
  return new entities_1.Product(data);
69
67
  });
70
68
  }
69
+ archive(productId) {
70
+ return __awaiter(this, void 0, void 0, function* () {
71
+ return yield this.update(productId, { status: 'archived' });
72
+ });
73
+ }
71
74
  }
72
75
  exports.ProductsResource = ProductsResource;
@@ -5,7 +5,7 @@ export * from './operations';
5
5
  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
- list(queryParams?: ListSubscriptionQueryParameters): Promise<SubscriptionCollection>;
8
+ list(queryParams?: ListSubscriptionQueryParameters): SubscriptionCollection;
9
9
  get(subscriptionId: string, queryParams?: GetSubscriptionQueryParameters): Promise<SubscriptionIncludes>;
10
10
  activate(subscriptionId: string): Promise<Subscription>;
11
11
  pause(subscriptionId: string, requestBody: PauseSubscription): Promise<Subscription>;
@@ -62,10 +62,8 @@ class SubscriptionsResource extends base_1.BaseResource {
62
62
  });
63
63
  }
64
64
  list(queryParams) {
65
- return __awaiter(this, void 0, void 0, function* () {
66
- const queryParameters = new base_1.QueryParameters(queryParams);
67
- return new entities_1.SubscriptionCollection(this.client, SubscriptionPaths.list + queryParameters.toQueryString());
68
- });
65
+ const queryParameters = new base_1.QueryParameters(queryParams);
66
+ return new entities_1.SubscriptionCollection(this.client, SubscriptionPaths.list + queryParameters.toQueryString());
69
67
  }
70
68
  get(subscriptionId, queryParams) {
71
69
  return __awaiter(this, void 0, void 0, function* () {
@@ -3,7 +3,7 @@ import { BaseResource } from '../../internal/base';
3
3
  import { type CreateTransactionQueryParameters, type CreateTransactionRequestBody, type GetTransactionQueryParameters, type ListTransactionQueryParameters, type UpdateTransactionRequestBody, type TransactionPreviewRequestBody } from './operations';
4
4
  export * from './operations';
5
5
  export declare class TransactionsResource extends BaseResource {
6
- list(queryParams?: ListTransactionQueryParameters): Promise<TransactionCollection>;
6
+ list(queryParams?: ListTransactionQueryParameters): TransactionCollection;
7
7
  create(createTransactionParameters: CreateTransactionRequestBody, queryParams?: CreateTransactionQueryParameters): Promise<TransactionIncludes>;
8
8
  update(transactionId: string, updateTransaction: UpdateTransactionRequestBody): Promise<Transaction>;
9
9
  get(transactionId: string, queryParams?: GetTransactionQueryParameters): Promise<TransactionIncludes>;
@@ -37,10 +37,8 @@ const TransactionPaths = {
37
37
  __exportStar(require("./operations"), exports);
38
38
  class TransactionsResource extends base_1.BaseResource {
39
39
  list(queryParams) {
40
- return __awaiter(this, void 0, void 0, function* () {
41
- const queryParameters = new base_1.QueryParameters(queryParams);
42
- return new entities_1.TransactionCollection(this.client, TransactionPaths.list + queryParameters.toQueryString());
43
- });
40
+ const queryParameters = new base_1.QueryParameters(queryParams);
41
+ return new entities_1.TransactionCollection(this.client, TransactionPaths.list + queryParameters.toQueryString());
44
42
  }
45
43
  create(createTransactionParameters, queryParams) {
46
44
  return __awaiter(this, void 0, void 0, function* () {
@@ -0,0 +1,125 @@
1
+ import { type IAddressResponse } from '../address';
2
+ import { type IBusinessResponse } from '../business';
3
+ import { type EventName } from '../../notifications';
4
+ import { type IAdjustmentResponse } from '../adjustment';
5
+ import { type ICustomerResponse } from '../customer';
6
+ import { type IDiscountResponse } from '../discount';
7
+ import { type IPriceResponse } from '../price';
8
+ import { type IProductResponse } from '../product';
9
+ import { type ISubscriptionNotificationResponse } from '../subscription';
10
+ import { type ITransactionResponse } from '../transaction';
11
+ import { type IPayoutResponse } from '../payout';
12
+ export interface IEventsResponse<T = object> {
13
+ event_id: string;
14
+ notification_id: string;
15
+ event_type: string;
16
+ occurred_at: string;
17
+ data: T;
18
+ }
19
+ interface IAddressCreated extends IEventsResponse<IAddressResponse> {
20
+ event_type: EventName.AddressCreated;
21
+ }
22
+ interface IAddressUpdated extends IEventsResponse<IAddressResponse> {
23
+ event_type: EventName.AddressUpdated;
24
+ }
25
+ interface IAdjustmentCreated extends IEventsResponse<IAdjustmentResponse> {
26
+ event_type: EventName.AdjustmentCreated;
27
+ }
28
+ interface IAdjustmentUpdated extends IEventsResponse<IAdjustmentResponse> {
29
+ event_type: EventName.AdjustmentUpdated;
30
+ }
31
+ interface IBusinessCreated extends IEventsResponse<IBusinessResponse> {
32
+ event_type: EventName.BusinessCreated;
33
+ }
34
+ interface IBusinessUpdated extends IEventsResponse<IBusinessResponse> {
35
+ event_type: EventName.BusinessUpdated;
36
+ }
37
+ interface ICustomerCreated extends IEventsResponse<ICustomerResponse> {
38
+ event_type: EventName.CustomerCreated;
39
+ }
40
+ interface ICustomerUpdated extends IEventsResponse<ICustomerResponse> {
41
+ event_type: EventName.CustomerUpdated;
42
+ }
43
+ interface IDiscountCreated extends IEventsResponse<IDiscountResponse> {
44
+ event_type: EventName.DiscountCreated;
45
+ }
46
+ interface IDiscountUpdated extends IEventsResponse<IDiscountResponse> {
47
+ event_type: EventName.DiscountUpdated;
48
+ }
49
+ interface IDiscountImported extends IEventsResponse<IDiscountResponse> {
50
+ event_type: EventName.DiscountImported;
51
+ }
52
+ interface IPayoutCreated extends IEventsResponse<IPayoutResponse> {
53
+ event_type: EventName.PayoutCreated;
54
+ }
55
+ interface IPayoutPaid extends IEventsResponse<IPayoutResponse> {
56
+ event_type: EventName.PayoutPaid;
57
+ }
58
+ interface IPriceCreated extends IEventsResponse<IPriceResponse> {
59
+ event_type: EventName.PriceCreated;
60
+ }
61
+ interface IPriceUpdated extends IEventsResponse<IPriceResponse> {
62
+ event_type: EventName.PriceUpdated;
63
+ }
64
+ interface IProductCreated extends IEventsResponse<IProductResponse> {
65
+ event_type: EventName.ProductCreated;
66
+ }
67
+ interface IProductUpdated extends IEventsResponse<IProductResponse> {
68
+ event_type: EventName.ProductUpdated;
69
+ }
70
+ interface ISubscriptionActivated extends IEventsResponse<ISubscriptionNotificationResponse> {
71
+ event_type: EventName.SubscriptionActivated;
72
+ }
73
+ interface ISubscriptionCanceled extends IEventsResponse<ISubscriptionNotificationResponse> {
74
+ event_type: EventName.SubscriptionCanceled;
75
+ }
76
+ interface ISubscriptionCreated extends IEventsResponse<ISubscriptionNotificationResponse> {
77
+ event_type: EventName.SubscriptionCreated;
78
+ }
79
+ interface ISubscriptionImported extends IEventsResponse<ISubscriptionNotificationResponse> {
80
+ event_type: EventName.SubscriptionImported;
81
+ }
82
+ interface ISubscriptionPastDue extends IEventsResponse<ISubscriptionNotificationResponse> {
83
+ event_type: EventName.SubscriptionPastDue;
84
+ }
85
+ interface ISubscriptionPaused extends IEventsResponse<ISubscriptionNotificationResponse> {
86
+ event_type: EventName.SubscriptionPaused;
87
+ }
88
+ interface ISubscriptionResumed extends IEventsResponse<ISubscriptionNotificationResponse> {
89
+ event_type: EventName.SubscriptionResumed;
90
+ }
91
+ interface ISubscriptionTrialing extends IEventsResponse<ISubscriptionNotificationResponse> {
92
+ event_type: EventName.SubscriptionTrialing;
93
+ }
94
+ interface ISubscriptionUpdated extends IEventsResponse<ISubscriptionNotificationResponse> {
95
+ event_type: EventName.SubscriptionUpdated;
96
+ }
97
+ interface ITransactionBilled extends IEventsResponse<ITransactionResponse> {
98
+ event_type: EventName.TransactionBilled;
99
+ }
100
+ interface ITransactionCanceled extends IEventsResponse<ITransactionResponse> {
101
+ event_type: EventName.TransactionCanceled;
102
+ }
103
+ interface ITransactionCompleted extends IEventsResponse<ITransactionResponse> {
104
+ event_type: EventName.TransactionCompleted;
105
+ }
106
+ interface ITransactionCreated extends IEventsResponse<ITransactionResponse> {
107
+ event_type: EventName.TransactionCreated;
108
+ }
109
+ interface ITransactionPaid extends IEventsResponse<ITransactionResponse> {
110
+ event_type: EventName.TransactionPaid;
111
+ }
112
+ interface ITransactionPastDue extends IEventsResponse<ITransactionResponse> {
113
+ event_type: EventName.TransactionPastDue;
114
+ }
115
+ interface ITransactionPaymentFailed extends IEventsResponse<ITransactionResponse> {
116
+ event_type: EventName.TransactionPaymentFailed;
117
+ }
118
+ interface ITransactionReady extends IEventsResponse<ITransactionResponse> {
119
+ event_type: EventName.TransactionReady;
120
+ }
121
+ interface ITransactionUpdated extends IEventsResponse<ITransactionResponse> {
122
+ event_type: EventName.TransactionUpdated;
123
+ }
124
+ export type IEvents = IAddressCreated | IAddressUpdated | IAdjustmentCreated | IAdjustmentUpdated | IBusinessCreated | IBusinessUpdated | ICustomerCreated | ICustomerUpdated | IDiscountCreated | IDiscountUpdated | IDiscountImported | IPayoutCreated | IPayoutPaid | IPriceCreated | IPriceUpdated | IProductCreated | IProductUpdated | ISubscriptionActivated | ISubscriptionCanceled | ISubscriptionCreated | ISubscriptionImported | ISubscriptionPastDue | ISubscriptionPaused | ISubscriptionResumed | ISubscriptionTrialing | ISubscriptionUpdated | ITransactionBilled | ITransactionCanceled | ITransactionCompleted | ITransactionCreated | ITransactionPaid | ITransactionPastDue | ITransactionPaymentFailed | ITransactionReady | ITransactionUpdated;
125
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export * from './events-response';
@@ -0,0 +1,17 @@
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("./events-response"), exports);
@@ -8,3 +8,6 @@ export * from './business';
8
8
  export * from './subscription';
9
9
  export * from './address';
10
10
  export * from './discount';
11
+ export * from './pricing-preview';
12
+ export * from './events';
13
+ export * from './payout';
@@ -24,3 +24,6 @@ __exportStar(require("./business"), exports);
24
24
  __exportStar(require("./subscription"), exports);
25
25
  __exportStar(require("./address"), exports);
26
26
  __exportStar(require("./discount"), exports);
27
+ __exportStar(require("./pricing-preview"), exports);
28
+ __exportStar(require("./events"), exports);
29
+ __exportStar(require("./payout"), exports);
@@ -0,0 +1 @@
1
+ export * from './payout-response';
@@ -0,0 +1,17 @@
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("./payout-response"), exports);
@@ -0,0 +1,7 @@
1
+ import { type CurrencyCode, type PayoutStatus } from '../../enums';
2
+ export interface IPayoutResponse {
3
+ id: string;
4
+ status: PayoutStatus;
5
+ amount: string;
6
+ currency_code: CurrencyCode;
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ export * from './pricing-preview-response';
2
+ export * from './pricing-preview-details-response';
3
+ export * from './pricing-preview-discounts-response';
4
+ export * from './pricing-preview-item-response';
5
+ export * from './pricing-preview-line-item-response';
@@ -0,0 +1,21 @@
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("./pricing-preview-response"), exports);
18
+ __exportStar(require("./pricing-preview-details-response"), exports);
19
+ __exportStar(require("./pricing-preview-discounts-response"), exports);
20
+ __exportStar(require("./pricing-preview-item-response"), exports);
21
+ __exportStar(require("./pricing-preview-line-item-response"), exports);
@@ -0,0 +1,4 @@
1
+ import { type IPricingPreviewLineItemResponse } from './pricing-preview-line-item-response';
2
+ export interface IPricingPreviewDetailsResponse {
3
+ line_items: IPricingPreviewLineItemResponse[];
4
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ import { type IDiscountResponse } from '../discount';
2
+ export interface IPricingPreviewDiscountsResponse {
3
+ discount: IDiscountResponse;
4
+ total: string;
5
+ formatted_total: string;
6
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ export interface IPricingPreviewItemResponse {
2
+ price_id?: string | null;
3
+ quantity: number;
4
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,15 @@
1
+ import { type IPriceResponse } from '../price';
2
+ import { type ITotals, type IUnitTotals } from '../shared';
3
+ import { type IProductResponse } from '../product';
4
+ import { type IPricingPreviewDiscountsResponse } from './pricing-preview-discounts-response';
5
+ export interface IPricingPreviewLineItemResponse {
6
+ price: IPriceResponse;
7
+ quantity: number;
8
+ tax_rate: string;
9
+ unit_totals: IUnitTotals;
10
+ formatted_unit_totals: IUnitTotals;
11
+ totals: ITotals;
12
+ formatted_totals: ITotals;
13
+ product: IProductResponse;
14
+ discounts: IPricingPreviewDiscountsResponse[];
15
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,15 @@
1
+ import { type CurrencyCode } from '../../enums';
2
+ import { type IAddressPreviewResponse } from '../../resources';
3
+ import { type IPricingPreviewItemResponse } from './pricing-preview-item-response';
4
+ import { type IPricingPreviewDetailsResponse } from './pricing-preview-details-response';
5
+ export interface IPricingPreviewResponse {
6
+ customer_id?: string | null;
7
+ address_id?: string | null;
8
+ business_id?: string | null;
9
+ currency_code?: CurrencyCode | null;
10
+ discount_id?: string | null;
11
+ address?: IAddressPreviewResponse | null;
12
+ customer_ip_address?: string | null;
13
+ items: IPricingPreviewItemResponse[];
14
+ details?: IPricingPreviewDetailsResponse | null;
15
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -11,3 +11,4 @@ export * from './subscription-response';
11
11
  export * from './subscription-preview-response';
12
12
  export * from './subscription-preview-update-summary';
13
13
  export * from './subscription-result-response';
14
+ export * from './subscription-notification-response';
@@ -27,3 +27,4 @@ __exportStar(require("./subscription-response"), exports);
27
27
  __exportStar(require("./subscription-preview-response"), exports);
28
28
  __exportStar(require("./subscription-preview-update-summary"), exports);
29
29
  __exportStar(require("./subscription-result-response"), exports);
30
+ __exportStar(require("./subscription-notification-response"), exports);
@@ -0,0 +1,28 @@
1
+ import { type IBillingDetailsResponse, type ICustomData, type INextTransactionResponse, type ISubscriptionDiscountResponse, type ISubscriptionItemResponse, type ISubscriptionScheduledChangeResponse, type ISubscriptionTimePeriodResponse, type ITimePeriod, type ITransactionDetailsPreviewResponse } from '../index';
2
+ import { type CollectionMode, type CurrencyCode, type SubscriptionStatus } from '../../enums';
3
+ export interface ISubscriptionNotificationResponse {
4
+ id: string;
5
+ status: SubscriptionStatus;
6
+ transaction_id: string;
7
+ customer_id: string;
8
+ address_id: string;
9
+ business_id?: string | null;
10
+ currency_code: CurrencyCode;
11
+ created_at: string;
12
+ updated_at: string;
13
+ started_at?: string | null;
14
+ first_billed_at?: string | null;
15
+ next_billed_at?: string | null;
16
+ paused_at?: string | null;
17
+ canceled_at?: string | null;
18
+ discount?: ISubscriptionDiscountResponse | null;
19
+ collection_mode: CollectionMode;
20
+ billing_details?: IBillingDetailsResponse | null;
21
+ current_billing_period?: ISubscriptionTimePeriodResponse | null;
22
+ billing_cycle: ITimePeriod;
23
+ scheduled_change?: ISubscriptionScheduledChangeResponse | null;
24
+ items: ISubscriptionItemResponse[];
25
+ custom_data?: ICustomData | null;
26
+ next_transaction?: INextTransactionResponse | null;
27
+ recurring_transaction_details?: ITransactionDetailsPreviewResponse | null;
28
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.2.0";
1
+ export declare const SDK_VERSION = "0.2.2";
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.2.0';
4
+ exports.SDK_VERSION = '0.2.2';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paddle/paddle-node-sdk",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "A NodeJS SDK for Paddle Billing API",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",