@paddle/paddle-node-sdk 0.2.1 → 0.2.3

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 (223) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +57 -18
  3. package/dist/entities/discount/discount.d.ts +1 -1
  4. package/dist/entities/discount/discount.js +2 -1
  5. package/dist/entities/event-types/event-type.d.ts +9 -0
  6. package/dist/entities/event-types/event-type.js +12 -0
  7. package/dist/entities/event-types/index.d.ts +1 -0
  8. package/dist/entities/event-types/index.js +17 -0
  9. package/dist/entities/events/event-collection.d.ts +6 -0
  10. package/dist/entities/events/event-collection.js +11 -0
  11. package/dist/entities/events/event.d.ts +9 -0
  12. package/dist/entities/events/event.js +14 -0
  13. package/dist/entities/events/index.d.ts +1 -0
  14. package/dist/entities/events/index.js +17 -0
  15. package/dist/entities/index.d.ts +5 -0
  16. package/dist/entities/index.js +5 -0
  17. package/dist/entities/notification-settings/index.d.ts +1 -0
  18. package/dist/entities/notification-settings/index.js +17 -0
  19. package/dist/entities/notification-settings/notification-settings.d.ts +15 -0
  20. package/dist/entities/notification-settings/notification-settings.js +18 -0
  21. package/dist/entities/notifications/index.d.ts +5 -0
  22. package/dist/entities/notifications/index.js +21 -0
  23. package/dist/entities/notifications/notification-collection.d.ts +6 -0
  24. package/dist/entities/notifications/notification-collection.js +11 -0
  25. package/dist/entities/notifications/notification-log-collection.d.ts +6 -0
  26. package/dist/entities/notifications/notification-log-collection.js +11 -0
  27. package/dist/entities/notifications/notification-log.d.ts +8 -0
  28. package/dist/entities/notifications/notification-log.js +14 -0
  29. package/dist/entities/notifications/notification.d.ts +18 -0
  30. package/dist/entities/notifications/notification.js +22 -0
  31. package/dist/entities/notifications/replay-notification.d.ts +5 -0
  32. package/dist/entities/notifications/replay-notification.js +9 -0
  33. package/dist/entities/payout/index.d.ts +1 -0
  34. package/dist/entities/payout/index.js +17 -0
  35. package/dist/entities/payout/payout.d.ts +9 -0
  36. package/dist/entities/payout/payout.js +12 -0
  37. package/dist/entities/subscription/index.d.ts +1 -0
  38. package/dist/entities/subscription/index.js +1 -0
  39. package/dist/entities/subscription/subscription-notification.d.ts +28 -0
  40. package/dist/entities/subscription/subscription-notification.js +35 -0
  41. package/dist/entities/subscription/subscription-scheduled-change.d.ts +2 -2
  42. package/dist/enums/index.d.ts +3 -0
  43. package/dist/enums/index.js +3 -0
  44. package/dist/enums/notification/index.d.ts +2 -0
  45. package/dist/enums/notification/index.js +18 -0
  46. package/dist/enums/notification/notification-status.d.ts +1 -0
  47. package/dist/enums/notification/notification-status.js +2 -0
  48. package/dist/enums/notification/origin.d.ts +1 -0
  49. package/dist/enums/notification/origin.js +2 -0
  50. package/dist/enums/notification-settings/index.d.ts +1 -0
  51. package/dist/enums/notification-settings/index.js +17 -0
  52. package/dist/enums/notification-settings/notification-settings-type.d.ts +1 -0
  53. package/dist/enums/notification-settings/notification-settings-type.js +2 -0
  54. package/dist/enums/payout/index.d.ts +1 -0
  55. package/dist/enums/payout/index.js +17 -0
  56. package/dist/enums/payout/payout-status.d.ts +1 -0
  57. package/dist/enums/payout/payout-status.js +2 -0
  58. package/dist/internal/api/client.d.ts +2 -0
  59. package/dist/internal/api/client.js +14 -0
  60. package/dist/notifications/events/address/address-created-event.d.ts +9 -0
  61. package/dist/notifications/events/address/address-created-event.js +14 -0
  62. package/dist/notifications/events/address/address-updated-event.d.ts +9 -0
  63. package/dist/notifications/events/address/address-updated-event.js +14 -0
  64. package/dist/notifications/events/address/index.d.ts +2 -0
  65. package/dist/notifications/events/address/index.js +18 -0
  66. package/dist/notifications/events/adjustment/adjustment-created-event.d.ts +9 -0
  67. package/dist/notifications/events/adjustment/adjustment-created-event.js +14 -0
  68. package/dist/notifications/events/adjustment/adjustment-updated-event.d.ts +9 -0
  69. package/dist/notifications/events/adjustment/adjustment-updated-event.js +14 -0
  70. package/dist/notifications/events/adjustment/index.d.ts +2 -0
  71. package/dist/notifications/events/adjustment/index.js +18 -0
  72. package/dist/notifications/events/business/business-created-event.d.ts +9 -0
  73. package/dist/notifications/events/business/business-created-event.js +14 -0
  74. package/dist/notifications/events/business/business-updated-event.d.ts +9 -0
  75. package/dist/notifications/events/business/business-updated-event.js +14 -0
  76. package/dist/notifications/events/business/index.d.ts +2 -0
  77. package/dist/notifications/events/business/index.js +18 -0
  78. package/dist/notifications/events/customer/customer-created-event.d.ts +9 -0
  79. package/dist/notifications/events/customer/customer-created-event.js +14 -0
  80. package/dist/notifications/events/customer/customer-updated-event.d.ts +9 -0
  81. package/dist/notifications/events/customer/customer-updated-event.js +14 -0
  82. package/dist/notifications/events/customer/index.d.ts +2 -0
  83. package/dist/notifications/events/customer/index.js +18 -0
  84. package/dist/notifications/events/discount/discount-created-event.d.ts +9 -0
  85. package/dist/notifications/events/discount/discount-created-event.js +14 -0
  86. package/dist/notifications/events/discount/discount-imported-event.d.ts +9 -0
  87. package/dist/notifications/events/discount/discount-imported-event.js +14 -0
  88. package/dist/notifications/events/discount/discount-updated-event.d.ts +9 -0
  89. package/dist/notifications/events/discount/discount-updated-event.js +14 -0
  90. package/dist/notifications/events/discount/index.d.ts +3 -0
  91. package/dist/notifications/events/discount/index.js +19 -0
  92. package/dist/notifications/events/index.d.ts +10 -0
  93. package/dist/notifications/events/index.js +26 -0
  94. package/dist/notifications/events/payout/index.d.ts +2 -0
  95. package/dist/notifications/events/payout/index.js +18 -0
  96. package/dist/notifications/events/payout/payout-created-event.d.ts +9 -0
  97. package/dist/notifications/events/payout/payout-created-event.js +14 -0
  98. package/dist/notifications/events/payout/payout-paid-event.d.ts +9 -0
  99. package/dist/notifications/events/payout/payout-paid-event.js +14 -0
  100. package/dist/notifications/events/price/index.d.ts +2 -0
  101. package/dist/notifications/events/price/index.js +18 -0
  102. package/dist/notifications/events/price/price-created-event.d.ts +9 -0
  103. package/dist/notifications/events/price/price-created-event.js +14 -0
  104. package/dist/notifications/events/price/price-updated-event.d.ts +9 -0
  105. package/dist/notifications/events/price/price-updated-event.js +14 -0
  106. package/dist/notifications/events/product/index.d.ts +2 -0
  107. package/dist/notifications/events/product/index.js +18 -0
  108. package/dist/notifications/events/product/product-created-event.d.ts +9 -0
  109. package/dist/notifications/events/product/product-created-event.js +14 -0
  110. package/dist/notifications/events/product/product-updated-event.d.ts +9 -0
  111. package/dist/notifications/events/product/product-updated-event.js +14 -0
  112. package/dist/notifications/events/subscription/index.d.ts +9 -0
  113. package/dist/notifications/events/subscription/index.js +25 -0
  114. package/dist/notifications/events/subscription/subscription-activated-event.d.ts +9 -0
  115. package/dist/notifications/events/subscription/subscription-activated-event.js +14 -0
  116. package/dist/notifications/events/subscription/subscription-canceled-event.d.ts +9 -0
  117. package/dist/notifications/events/subscription/subscription-canceled-event.js +14 -0
  118. package/dist/notifications/events/subscription/subscription-created-event.d.ts +9 -0
  119. package/dist/notifications/events/subscription/subscription-created-event.js +14 -0
  120. package/dist/notifications/events/subscription/subscription-imported-event.d.ts +9 -0
  121. package/dist/notifications/events/subscription/subscription-imported-event.js +14 -0
  122. package/dist/notifications/events/subscription/subscription-past-due-event.d.ts +9 -0
  123. package/dist/notifications/events/subscription/subscription-past-due-event.js +14 -0
  124. package/dist/notifications/events/subscription/subscription-paused-event.d.ts +9 -0
  125. package/dist/notifications/events/subscription/subscription-paused-event.js +14 -0
  126. package/dist/notifications/events/subscription/subscription-resumed-event.d.ts +9 -0
  127. package/dist/notifications/events/subscription/subscription-resumed-event.js +14 -0
  128. package/dist/notifications/events/subscription/subscription-trialing-event.d.ts +9 -0
  129. package/dist/notifications/events/subscription/subscription-trialing-event.js +14 -0
  130. package/dist/notifications/events/subscription/subscription-updated-event.d.ts +9 -0
  131. package/dist/notifications/events/subscription/subscription-updated-event.js +14 -0
  132. package/dist/notifications/events/transaction/index.d.ts +9 -0
  133. package/dist/notifications/events/transaction/index.js +25 -0
  134. package/dist/notifications/events/transaction/transaction-billed-event.d.ts +9 -0
  135. package/dist/notifications/events/transaction/transaction-billed-event.js +14 -0
  136. package/dist/notifications/events/transaction/transaction-canceled-event.d.ts +9 -0
  137. package/dist/notifications/events/transaction/transaction-canceled-event.js +14 -0
  138. package/dist/notifications/events/transaction/transaction-completed-event.d.ts +9 -0
  139. package/dist/notifications/events/transaction/transaction-completed-event.js +14 -0
  140. package/dist/notifications/events/transaction/transaction-created-event.d.ts +9 -0
  141. package/dist/notifications/events/transaction/transaction-created-event.js +14 -0
  142. package/dist/notifications/events/transaction/transaction-paid-event.d.ts +9 -0
  143. package/dist/notifications/events/transaction/transaction-paid-event.js +14 -0
  144. package/dist/notifications/events/transaction/transaction-past-due-event.d.ts +9 -0
  145. package/dist/notifications/events/transaction/transaction-past-due-event.js +14 -0
  146. package/dist/notifications/events/transaction/transaction-payment-failed-event.d.ts +9 -0
  147. package/dist/notifications/events/transaction/transaction-payment-failed-event.js +14 -0
  148. package/dist/notifications/events/transaction/transaction-ready-event.d.ts +9 -0
  149. package/dist/notifications/events/transaction/transaction-ready-event.js +14 -0
  150. package/dist/notifications/events/transaction/transaction-updated-event.d.ts +9 -0
  151. package/dist/notifications/events/transaction/transaction-updated-event.js +14 -0
  152. package/dist/notifications/helpers/index.d.ts +3 -0
  153. package/dist/notifications/helpers/index.js +19 -0
  154. package/dist/notifications/helpers/types.d.ts +40 -0
  155. package/dist/notifications/helpers/types.js +41 -0
  156. package/dist/notifications/{validator/notifications-validator.d.ts → helpers/webhooks-validator.d.ts} +1 -1
  157. package/dist/notifications/{validator/notifications-validator.js → helpers/webhooks-validator.js} +6 -6
  158. package/dist/notifications/helpers/webhooks.d.ts +7 -0
  159. package/dist/notifications/helpers/webhooks.js +100 -0
  160. package/dist/notifications/index.d.ts +2 -1
  161. package/dist/notifications/index.js +2 -1
  162. package/dist/paddle.d.ts +9 -2
  163. package/dist/paddle.js +8 -1
  164. package/dist/resources/event-types/index.d.ts +5 -0
  165. package/dist/resources/event-types/index.js +27 -0
  166. package/dist/resources/events/index.d.ts +7 -0
  167. package/dist/resources/events/index.js +30 -0
  168. package/dist/resources/events/operations/index.d.ts +1 -0
  169. package/dist/resources/events/operations/index.js +17 -0
  170. package/dist/resources/events/operations/list-events-query-parameters.d.ts +5 -0
  171. package/dist/resources/events/operations/list-events-query-parameters.js +2 -0
  172. package/dist/resources/index.d.ts +3 -0
  173. package/dist/resources/index.js +3 -0
  174. package/dist/resources/notification-settings/index.d.ts +11 -0
  175. package/dist/resources/notification-settings/index.js +84 -0
  176. package/dist/resources/notification-settings/operations/create-notification-settings-request-body.d.ts +10 -0
  177. package/dist/resources/notification-settings/operations/create-notification-settings-request-body.js +2 -0
  178. package/dist/resources/notification-settings/operations/index.d.ts +2 -0
  179. package/dist/resources/notification-settings/operations/index.js +18 -0
  180. package/dist/resources/notification-settings/operations/update-notification-settings-request-body.d.ts +9 -0
  181. package/dist/resources/notification-settings/operations/update-notification-settings-request-body.js +2 -0
  182. package/dist/resources/notifications/index.d.ts +10 -0
  183. package/dist/resources/notifications/index.js +69 -0
  184. package/dist/resources/notifications/operations/index.d.ts +2 -0
  185. package/dist/resources/notifications/operations/index.js +18 -0
  186. package/dist/resources/notifications/operations/list-notification-log-query-parameters.d.ts +4 -0
  187. package/dist/resources/notifications/operations/list-notification-log-query-parameters.js +2 -0
  188. package/dist/resources/notifications/operations/list-notification-query-parameters.d.ts +12 -0
  189. package/dist/resources/notifications/operations/list-notification-query-parameters.js +2 -0
  190. package/dist/types/event-types/event-type-response.d.ts +7 -0
  191. package/dist/types/event-types/event-type-response.js +2 -0
  192. package/dist/types/event-types/index.d.ts +1 -0
  193. package/dist/types/event-types/index.js +17 -0
  194. package/dist/types/events/events-response.d.ts +125 -0
  195. package/dist/types/events/events-response.js +2 -0
  196. package/dist/types/events/index.d.ts +1 -0
  197. package/dist/types/events/index.js +17 -0
  198. package/dist/types/index.d.ts +5 -0
  199. package/dist/types/index.js +5 -0
  200. package/dist/types/notification-settings/index.d.ts +1 -0
  201. package/dist/types/notification-settings/index.js +17 -0
  202. package/dist/types/notification-settings/notification-settings-response.d.ts +13 -0
  203. package/dist/types/notification-settings/notification-settings-response.js +2 -0
  204. package/dist/types/notifications/index.d.ts +3 -0
  205. package/dist/types/notifications/index.js +19 -0
  206. package/dist/types/notifications/notification-log.d.ts +7 -0
  207. package/dist/types/notifications/notification-log.js +2 -0
  208. package/dist/types/notifications/notification.d.ts +17 -0
  209. package/dist/types/notifications/notification.js +2 -0
  210. package/dist/types/notifications/replay-notification.d.ts +3 -0
  211. package/dist/types/notifications/replay-notification.js +2 -0
  212. package/dist/types/payout/index.d.ts +1 -0
  213. package/dist/types/payout/index.js +17 -0
  214. package/dist/types/payout/payout-response.d.ts +7 -0
  215. package/dist/types/payout/payout-response.js +2 -0
  216. package/dist/types/subscription/index.d.ts +1 -0
  217. package/dist/types/subscription/index.js +1 -0
  218. package/dist/types/subscription/subscription-notification-response.d.ts +28 -0
  219. package/dist/types/subscription/subscription-notification-response.js +2 -0
  220. package/dist/types/subscription/subscription-scheduled-change-response.d.ts +2 -2
  221. package/dist/version.d.ts +1 -1
  222. package/dist/version.js +1 -1
  223. package/package.json +1 -1
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SubscriptionNotification = void 0;
4
+ const index_1 = require("../index");
5
+ class SubscriptionNotification {
6
+ constructor(subscription) {
7
+ this.id = subscription.id;
8
+ this.status = subscription.status;
9
+ this.transactionId = subscription.transaction_id ? subscription.transaction_id : null;
10
+ this.customerId = subscription.customer_id;
11
+ this.addressId = subscription.address_id;
12
+ this.businessId = subscription.business_id ? subscription.business_id : null;
13
+ this.currencyCode = subscription.currency_code;
14
+ this.createdAt = subscription.created_at;
15
+ this.updatedAt = subscription.updated_at;
16
+ this.startedAt = subscription.started_at ? subscription.started_at : null;
17
+ this.firstBilledAt = subscription.first_billed_at ? subscription.first_billed_at : null;
18
+ this.nextBilledAt = subscription.next_billed_at ? subscription.next_billed_at : null;
19
+ this.pausedAt = subscription.paused_at ? subscription.paused_at : null;
20
+ this.canceledAt = subscription.canceled_at ? subscription.canceled_at : null;
21
+ this.discount = subscription.discount ? new index_1.SubscriptionDiscount(subscription.discount) : null;
22
+ this.collectionMode = subscription.collection_mode;
23
+ this.billingDetails = subscription.billing_details ? new index_1.BillingDetails(subscription.billing_details) : null;
24
+ this.currentBillingPeriod = subscription.current_billing_period
25
+ ? new index_1.SubscriptionTimePeriod(subscription.current_billing_period)
26
+ : null;
27
+ this.billingCycle = new index_1.TimePeriod(subscription.billing_cycle);
28
+ this.scheduledChange = subscription.scheduled_change
29
+ ? new index_1.SubscriptionScheduledChange(subscription.scheduled_change)
30
+ : null;
31
+ this.items = subscription.items.map((item) => new index_1.SubscriptionItem(item));
32
+ this.customData = subscription.custom_data ? subscription.custom_data : null;
33
+ }
34
+ }
35
+ exports.SubscriptionNotification = SubscriptionNotification;
@@ -1,7 +1,7 @@
1
1
  import { type ISubscriptionScheduledChangeResponse } from '../../types';
2
- import { type AdjustmentAction } from '../../enums';
2
+ import { type ScheduledChangeAction } from '../../enums';
3
3
  export declare class SubscriptionScheduledChange {
4
- readonly action: AdjustmentAction;
4
+ readonly action: ScheduledChangeAction;
5
5
  readonly effectiveAt: string;
6
6
  readonly resumeAt: string | null;
7
7
  constructor(subscriptionScheduledChange: ISubscriptionScheduledChangeResponse);
@@ -3,3 +3,6 @@ export * from './subscription';
3
3
  export * from './discount';
4
4
  export * from './adjustment';
5
5
  export * from './transaction';
6
+ export * from './payout';
7
+ export * from './notification-settings';
8
+ export * from './notification';
@@ -19,3 +19,6 @@ __exportStar(require("./subscription"), exports);
19
19
  __exportStar(require("./discount"), exports);
20
20
  __exportStar(require("./adjustment"), exports);
21
21
  __exportStar(require("./transaction"), exports);
22
+ __exportStar(require("./payout"), exports);
23
+ __exportStar(require("./notification-settings"), exports);
24
+ __exportStar(require("./notification"), exports);
@@ -0,0 +1,2 @@
1
+ export * from './notification-status';
2
+ export * from './origin';
@@ -0,0 +1,18 @@
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("./notification-status"), exports);
18
+ __exportStar(require("./origin"), exports);
@@ -0,0 +1 @@
1
+ export type NotificationStatus = 'not_attempted' | 'needs_retry' | 'delivered' | 'failed';
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export type Origin = 'event' | 'replay';
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export * from './notification-settings-type';
@@ -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("./notification-settings-type"), exports);
@@ -0,0 +1 @@
1
+ export type NotificationSettingsType = 'email' | 'url';
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export * from './payout-status';
@@ -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-status"), exports);
@@ -0,0 +1 @@
1
+ export type PayoutStatus = 'paid' | 'unpaid';
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +1,6 @@
1
1
  import { type QueryParameters } from '../base';
2
2
  import { type PaddleOptions } from '../types/config';
3
+ import { type ErrorResponse } from '../types/response';
3
4
  export declare class Client {
4
5
  private readonly apiKey;
5
6
  private readonly options;
@@ -10,4 +11,5 @@ export declare class Client {
10
11
  get<Q, R>(url: string, queryParams?: QueryParameters<Q>): Promise<R>;
11
12
  post<B, R>(url: string, requestBody: B): Promise<R>;
12
13
  patch<B, R>(url: string, requestBody: B): Promise<R>;
14
+ delete(url: string): Promise<ErrorResponse | undefined>;
13
15
  }
@@ -34,6 +34,7 @@ class Client {
34
34
  const uuid = (0, crypto_1.randomUUID)();
35
35
  return {
36
36
  Authorization: `bearer ${this.apiKey}`,
37
+ 'Content-Type': 'application/json',
37
38
  'user-agent': `PaddleSDK/node ${version_1.SDK_VERSION}`,
38
39
  'X-Transaction-ID': uuid,
39
40
  };
@@ -82,5 +83,18 @@ class Client {
82
83
  return rawResponse.json();
83
84
  });
84
85
  }
86
+ delete(url) {
87
+ return __awaiter(this, void 0, void 0, function* () {
88
+ const logUrl = url.split('?')[0];
89
+ const headers = this.getHeaders();
90
+ logger_1.Logger.logRequest('DELETE', logUrl, headers);
91
+ const rawResponse = yield (0, node_fetch_1.default)(`${this.baseUrl}${url}`, {
92
+ method: 'DELETE',
93
+ headers,
94
+ });
95
+ logger_1.Logger.logResponse('DELETE', logUrl, headers, rawResponse);
96
+ return rawResponse;
97
+ });
98
+ }
85
99
  }
86
100
  exports.Client = Client;
@@ -0,0 +1,9 @@
1
+ import { Address } from '../../../entities';
2
+ import { type IAddressResponse, type IEventsResponse } from '../../../types';
3
+ import { EventName } from '../../helpers';
4
+ import { Event } from '../../../entities/events/event';
5
+ export declare class AddressCreatedEvent extends Event {
6
+ readonly eventType = EventName.AddressCreated;
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.AddressCreatedEvent = void 0;
4
+ const entities_1 = require("../../../entities");
5
+ const helpers_1 = require("../../helpers");
6
+ const event_1 = require("../../../entities/events/event");
7
+ class AddressCreatedEvent extends event_1.Event {
8
+ constructor(response) {
9
+ super(response);
10
+ this.eventType = helpers_1.EventName.AddressCreated;
11
+ this.data = new entities_1.Address(response.data);
12
+ }
13
+ }
14
+ exports.AddressCreatedEvent = AddressCreatedEvent;
@@ -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 AddressUpdatedEvent extends Event {
6
+ readonly eventType = EventName.AddressUpdated;
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.AddressUpdatedEvent = void 0;
4
+ const event_1 = require("../../../entities/events/event");
5
+ const entities_1 = require("../../../entities");
6
+ const helpers_1 = require("../../helpers");
7
+ class AddressUpdatedEvent extends event_1.Event {
8
+ constructor(response) {
9
+ super(response);
10
+ this.eventType = helpers_1.EventName.AddressUpdated;
11
+ this.data = new entities_1.Address(response.data);
12
+ }
13
+ }
14
+ exports.AddressUpdatedEvent = AddressUpdatedEvent;
@@ -0,0 +1,2 @@
1
+ export * from './address-created-event';
2
+ export * from './address-updated-event';
@@ -0,0 +1,18 @@
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("./address-created-event"), exports);
18
+ __exportStar(require("./address-updated-event"), exports);
@@ -0,0 +1,9 @@
1
+ import { Event } from '../../../entities/events/event';
2
+ import { Adjustment } from '../../../entities';
3
+ import { type IAdjustmentResponse, type IEventsResponse } from '../../../types';
4
+ import { EventName } from '../../helpers';
5
+ export declare class AdjustmentCreatedEvent extends Event {
6
+ readonly eventType = EventName.AdjustmentCreated;
7
+ readonly data: Adjustment;
8
+ constructor(response: IEventsResponse<IAdjustmentResponse>);
9
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AdjustmentCreatedEvent = void 0;
4
+ const event_1 = require("../../../entities/events/event");
5
+ const entities_1 = require("../../../entities");
6
+ const helpers_1 = require("../../helpers");
7
+ class AdjustmentCreatedEvent extends event_1.Event {
8
+ constructor(response) {
9
+ super(response);
10
+ this.eventType = helpers_1.EventName.AdjustmentCreated;
11
+ this.data = new entities_1.Adjustment(response.data);
12
+ }
13
+ }
14
+ exports.AdjustmentCreatedEvent = AdjustmentCreatedEvent;
@@ -0,0 +1,9 @@
1
+ import { Event } from '../../../entities/events/event';
2
+ import { Adjustment } from '../../../entities';
3
+ import { type IAdjustmentResponse, type IEventsResponse } from '../../../types';
4
+ import { EventName } from '../../helpers';
5
+ export declare class AdjustmentUpdatedEvent extends Event {
6
+ readonly eventType = EventName.AdjustmentUpdated;
7
+ readonly data: Adjustment;
8
+ constructor(response: IEventsResponse<IAdjustmentResponse>);
9
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AdjustmentUpdatedEvent = void 0;
4
+ const event_1 = require("../../../entities/events/event");
5
+ const entities_1 = require("../../../entities");
6
+ const helpers_1 = require("../../helpers");
7
+ class AdjustmentUpdatedEvent extends event_1.Event {
8
+ constructor(response) {
9
+ super(response);
10
+ this.eventType = helpers_1.EventName.AdjustmentUpdated;
11
+ this.data = new entities_1.Adjustment(response.data);
12
+ }
13
+ }
14
+ exports.AdjustmentUpdatedEvent = AdjustmentUpdatedEvent;
@@ -0,0 +1,2 @@
1
+ export * from './adjustment-created-event';
2
+ export * from './adjustment-updated-event';
@@ -0,0 +1,18 @@
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("./adjustment-created-event"), exports);
18
+ __exportStar(require("./adjustment-updated-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 BusinessCreatedEvent extends Event {
6
+ readonly eventType = EventName.BusinessCreated;
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.BusinessCreatedEvent = void 0;
4
+ const event_1 = require("../../../entities/events/event");
5
+ const entities_1 = require("../../../entities");
6
+ const helpers_1 = require("../../helpers");
7
+ class BusinessCreatedEvent extends event_1.Event {
8
+ constructor(response) {
9
+ super(response);
10
+ this.eventType = helpers_1.EventName.BusinessCreated;
11
+ this.data = new entities_1.Business(response.data);
12
+ }
13
+ }
14
+ exports.BusinessCreatedEvent = BusinessCreatedEvent;
@@ -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 BusinessUpdatedEvent extends Event {
6
+ readonly eventType = EventName.BusinessUpdated;
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.BusinessUpdatedEvent = void 0;
4
+ const event_1 = require("../../../entities/events/event");
5
+ const entities_1 = require("../../../entities");
6
+ const helpers_1 = require("../../helpers");
7
+ class BusinessUpdatedEvent extends event_1.Event {
8
+ constructor(response) {
9
+ super(response);
10
+ this.eventType = helpers_1.EventName.BusinessUpdated;
11
+ this.data = new entities_1.Business(response.data);
12
+ }
13
+ }
14
+ exports.BusinessUpdatedEvent = BusinessUpdatedEvent;
@@ -0,0 +1,2 @@
1
+ export * from './business-created-event';
2
+ export * from './business-updated-event';
@@ -0,0 +1,18 @@
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("./business-created-event"), exports);
18
+ __exportStar(require("./business-updated-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 CustomerCreatedEvent extends Event {
6
+ readonly eventType = EventName.CustomerCreated;
7
+ readonly data: Customer;
8
+ constructor(response: IEventsResponse<ICustomerResponse>);
9
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CustomerCreatedEvent = void 0;
4
+ const event_1 = require("../../../entities/events/event");
5
+ const entities_1 = require("../../../entities");
6
+ const helpers_1 = require("../../helpers");
7
+ class CustomerCreatedEvent extends event_1.Event {
8
+ constructor(response) {
9
+ super(response);
10
+ this.eventType = helpers_1.EventName.CustomerCreated;
11
+ this.data = new entities_1.Customer(response.data);
12
+ }
13
+ }
14
+ exports.CustomerCreatedEvent = CustomerCreatedEvent;
@@ -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 CustomerUpdatedEvent extends Event {
6
+ readonly eventType = EventName.CustomerUpdated;
7
+ readonly data: Customer;
8
+ constructor(response: IEventsResponse<ICustomerResponse>);
9
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CustomerUpdatedEvent = void 0;
4
+ const event_1 = require("../../../entities/events/event");
5
+ const entities_1 = require("../../../entities");
6
+ const helpers_1 = require("../../helpers");
7
+ class CustomerUpdatedEvent extends event_1.Event {
8
+ constructor(response) {
9
+ super(response);
10
+ this.eventType = helpers_1.EventName.CustomerUpdated;
11
+ this.data = new entities_1.Customer(response.data);
12
+ }
13
+ }
14
+ exports.CustomerUpdatedEvent = CustomerUpdatedEvent;
@@ -0,0 +1,2 @@
1
+ export * from './customer-created-event';
2
+ export * from './customer-updated-event';
@@ -0,0 +1,18 @@
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("./customer-created-event"), exports);
18
+ __exportStar(require("./customer-updated-event"), exports);
@@ -0,0 +1,9 @@
1
+ import { Event } from '../../../entities/events/event';
2
+ import { Discount } from '../../../entities';
3
+ import { type IDiscountResponse, type IEventsResponse } from '../../../types';
4
+ import { EventName } from '../../helpers';
5
+ export declare class DiscountCreatedEvent extends Event {
6
+ readonly eventType = EventName.DiscountCreated;
7
+ readonly data: Discount;
8
+ constructor(response: IEventsResponse<IDiscountResponse>);
9
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DiscountCreatedEvent = void 0;
4
+ const event_1 = require("../../../entities/events/event");
5
+ const entities_1 = require("../../../entities");
6
+ const helpers_1 = require("../../helpers");
7
+ class DiscountCreatedEvent extends event_1.Event {
8
+ constructor(response) {
9
+ super(response);
10
+ this.eventType = helpers_1.EventName.DiscountCreated;
11
+ this.data = new entities_1.Discount(response.data);
12
+ }
13
+ }
14
+ exports.DiscountCreatedEvent = DiscountCreatedEvent;
@@ -0,0 +1,9 @@
1
+ import { Event } from '../../../entities/events/event';
2
+ import { Discount } from '../../../entities';
3
+ import { type IDiscountResponse, type IEventsResponse } from '../../../types';
4
+ import { EventName } from '../../helpers';
5
+ export declare class DiscountImportedEvent extends Event {
6
+ readonly eventType = EventName.DiscountImported;
7
+ readonly data: Discount;
8
+ constructor(response: IEventsResponse<IDiscountResponse>);
9
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DiscountImportedEvent = void 0;
4
+ const event_1 = require("../../../entities/events/event");
5
+ const entities_1 = require("../../../entities");
6
+ const helpers_1 = require("../../helpers");
7
+ class DiscountImportedEvent extends event_1.Event {
8
+ constructor(response) {
9
+ super(response);
10
+ this.eventType = helpers_1.EventName.DiscountImported;
11
+ this.data = new entities_1.Discount(response.data);
12
+ }
13
+ }
14
+ exports.DiscountImportedEvent = DiscountImportedEvent;
@@ -0,0 +1,9 @@
1
+ import { Event } from '../../../entities/events/event';
2
+ import { Discount } from '../../../entities';
3
+ import { type IDiscountResponse, type IEventsResponse } from '../../../types';
4
+ import { EventName } from '../../helpers';
5
+ export declare class DiscountUpdatedEvent extends Event {
6
+ readonly eventType = EventName.DiscountUpdated;
7
+ readonly data: Discount;
8
+ constructor(response: IEventsResponse<IDiscountResponse>);
9
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DiscountUpdatedEvent = void 0;
4
+ const event_1 = require("../../../entities/events/event");
5
+ const entities_1 = require("../../../entities");
6
+ const helpers_1 = require("../../helpers");
7
+ class DiscountUpdatedEvent extends event_1.Event {
8
+ constructor(response) {
9
+ super(response);
10
+ this.eventType = helpers_1.EventName.DiscountUpdated;
11
+ this.data = new entities_1.Discount(response.data);
12
+ }
13
+ }
14
+ exports.DiscountUpdatedEvent = DiscountUpdatedEvent;
@@ -0,0 +1,3 @@
1
+ export * from './discount-created-event';
2
+ export * from './discount-updated-event';
3
+ export * from './discount-imported-event';
@@ -0,0 +1,19 @@
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("./discount-created-event"), exports);
18
+ __exportStar(require("./discount-updated-event"), exports);
19
+ __exportStar(require("./discount-imported-event"), exports);
@@ -0,0 +1,10 @@
1
+ export * from './address';
2
+ export * from './adjustment';
3
+ export * from './business';
4
+ export * from './customer';
5
+ export * from './discount';
6
+ export * from './payout';
7
+ export * from './price';
8
+ export * from './product';
9
+ export * from './subscription';
10
+ export * from './transaction';