@paddle/paddle-node-sdk 2.0.0-rc.1 → 2.0.0-rc.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 (165) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/cjs/entities/customer/auth-token.js +10 -0
  3. package/dist/cjs/entities/customer/index.js +1 -0
  4. package/dist/cjs/entities/index.js +1 -0
  5. package/dist/cjs/entities/notification-settings/notification-settings.js +1 -0
  6. package/dist/cjs/entities/payment-method/index.js +18 -0
  7. package/dist/cjs/entities/payment-method/payment-method-collection.js +11 -0
  8. package/dist/cjs/entities/payment-method/payment-method.js +18 -0
  9. package/dist/cjs/entities/shared/index.js +1 -0
  10. package/dist/cjs/entities/shared/paypal.js +10 -0
  11. package/dist/cjs/enums/index.js +1 -0
  12. package/dist/cjs/enums/notification-settings/index.js +1 -0
  13. package/dist/cjs/enums/notification-settings/traffic-source.js +2 -0
  14. package/dist/cjs/enums/payment-method/deletion-reason.js +2 -0
  15. package/dist/cjs/enums/payment-method/index.js +19 -0
  16. package/dist/cjs/enums/payment-method/origin.js +2 -0
  17. package/dist/cjs/enums/payment-method/type.js +2 -0
  18. package/dist/cjs/notifications/entities/index.js +1 -0
  19. package/dist/cjs/notifications/entities/payment-method/index.js +18 -0
  20. package/dist/cjs/notifications/entities/payment-method/payment-method-deleted-notification.js +16 -0
  21. package/dist/cjs/notifications/entities/payment-method/payment-method-notification.js +15 -0
  22. package/dist/cjs/notifications/entities/subscription/index.js +1 -0
  23. package/dist/cjs/notifications/entities/subscription/subscription-created-notification.js +42 -0
  24. package/dist/cjs/notifications/entities/subscription/subscription-notification.js +0 -1
  25. package/dist/cjs/notifications/events/index.js +1 -0
  26. package/dist/cjs/notifications/events/payment-method/index.js +18 -0
  27. package/dist/cjs/notifications/events/payment-method/payment-method-deleted-event.js +14 -0
  28. package/dist/cjs/notifications/events/payment-method/payment-method-saved-event.js +14 -0
  29. package/dist/cjs/notifications/events/subscription/subscription-created-event.js +1 -1
  30. package/dist/cjs/notifications/helpers/types.js +2 -0
  31. package/dist/cjs/notifications/helpers/webhooks.js +4 -0
  32. package/dist/cjs/notifications/types/index.js +1 -0
  33. package/dist/cjs/notifications/types/payment-method/index.js +18 -0
  34. package/dist/cjs/notifications/types/payment-method/payment-method-deleted-notification-response.js +2 -0
  35. package/dist/cjs/notifications/types/payment-method/payment-method-notification-response.js +2 -0
  36. package/dist/cjs/notifications/types/subscription/index.js +1 -0
  37. package/dist/cjs/notifications/types/subscription/subscription-created-notification-response.js +2 -0
  38. package/dist/cjs/paddle.js +1 -0
  39. package/dist/cjs/resources/customers/index.js +11 -0
  40. package/dist/cjs/resources/index.js +1 -0
  41. package/dist/cjs/resources/payment-methods/index.js +67 -0
  42. package/dist/cjs/resources/payment-methods/operations/index.js +17 -0
  43. package/dist/cjs/resources/payment-methods/operations/list-customer-payment-method-query-parameters.js +2 -0
  44. package/dist/cjs/types/customer/auth-token-response.js +2 -0
  45. package/dist/cjs/types/customer/index.js +1 -0
  46. package/dist/cjs/types/index.js +1 -0
  47. package/dist/cjs/types/payment-method/index.js +17 -0
  48. package/dist/cjs/types/payment-method/payment-method.js +2 -0
  49. package/dist/cjs/types/shared/index.js +1 -0
  50. package/dist/cjs/types/shared/paypal.js +2 -0
  51. package/dist/cjs/version.js +1 -1
  52. package/dist/esm/entities/customer/auth-token.js +6 -0
  53. package/dist/esm/entities/customer/index.js +1 -0
  54. package/dist/esm/entities/index.js +1 -0
  55. package/dist/esm/entities/notification-settings/notification-settings.js +1 -0
  56. package/dist/esm/entities/payment-method/index.js +2 -0
  57. package/dist/esm/entities/payment-method/payment-method-collection.js +7 -0
  58. package/dist/esm/entities/payment-method/payment-method.js +14 -0
  59. package/dist/esm/entities/shared/index.js +1 -0
  60. package/dist/esm/entities/shared/paypal.js +6 -0
  61. package/dist/esm/enums/index.js +1 -0
  62. package/dist/esm/enums/notification-settings/index.js +1 -0
  63. package/dist/esm/enums/notification-settings/traffic-source.js +1 -0
  64. package/dist/esm/enums/payment-method/deletion-reason.js +1 -0
  65. package/dist/esm/enums/payment-method/index.js +3 -0
  66. package/dist/esm/enums/payment-method/origin.js +1 -0
  67. package/dist/esm/enums/payment-method/type.js +1 -0
  68. package/dist/esm/notifications/entities/index.js +1 -0
  69. package/dist/esm/notifications/entities/payment-method/index.js +2 -0
  70. package/dist/esm/notifications/entities/payment-method/payment-method-deleted-notification.js +12 -0
  71. package/dist/esm/notifications/entities/payment-method/payment-method-notification.js +11 -0
  72. package/dist/esm/notifications/entities/subscription/index.js +1 -0
  73. package/dist/esm/notifications/entities/subscription/subscription-created-notification.js +38 -0
  74. package/dist/esm/notifications/entities/subscription/subscription-notification.js +0 -1
  75. package/dist/esm/notifications/events/index.js +1 -0
  76. package/dist/esm/notifications/events/payment-method/index.js +2 -0
  77. package/dist/esm/notifications/events/payment-method/payment-method-deleted-event.js +10 -0
  78. package/dist/esm/notifications/events/payment-method/payment-method-saved-event.js +10 -0
  79. package/dist/esm/notifications/events/subscription/subscription-created-event.js +2 -2
  80. package/dist/esm/notifications/helpers/types.js +2 -0
  81. package/dist/esm/notifications/helpers/webhooks.js +5 -1
  82. package/dist/esm/notifications/types/index.js +1 -0
  83. package/dist/esm/notifications/types/payment-method/index.js +2 -0
  84. package/dist/esm/notifications/types/payment-method/payment-method-deleted-notification-response.js +1 -0
  85. package/dist/esm/notifications/types/payment-method/payment-method-notification-response.js +1 -0
  86. package/dist/esm/notifications/types/subscription/index.js +1 -0
  87. package/dist/esm/notifications/types/subscription/subscription-created-notification-response.js +1 -0
  88. package/dist/esm/paddle.js +2 -1
  89. package/dist/esm/resources/customers/index.js +12 -1
  90. package/dist/esm/resources/index.js +1 -0
  91. package/dist/esm/resources/payment-methods/index.js +49 -0
  92. package/dist/esm/resources/payment-methods/operations/index.js +1 -0
  93. package/dist/esm/resources/payment-methods/operations/list-customer-payment-method-query-parameters.js +1 -0
  94. package/dist/esm/types/customer/auth-token-response.js +1 -0
  95. package/dist/esm/types/customer/index.js +1 -0
  96. package/dist/esm/types/index.js +1 -0
  97. package/dist/esm/types/payment-method/index.js +1 -0
  98. package/dist/esm/types/payment-method/payment-method.js +1 -0
  99. package/dist/esm/types/shared/index.js +1 -0
  100. package/dist/esm/types/shared/paypal.js +1 -0
  101. package/dist/esm/version.js +1 -1
  102. package/dist/types/entities/customer/auth-token.d.ts +6 -0
  103. package/dist/types/entities/customer/index.d.ts +1 -0
  104. package/dist/types/entities/index.d.ts +1 -0
  105. package/dist/types/entities/notification-settings/notification-settings.d.ts +2 -1
  106. package/dist/types/entities/payment-method/index.d.ts +2 -0
  107. package/dist/types/entities/payment-method/payment-method-collection.d.ts +6 -0
  108. package/dist/types/entities/payment-method/payment-method.d.ts +15 -0
  109. package/dist/types/entities/shared/index.d.ts +1 -0
  110. package/dist/types/entities/shared/paypal.d.ts +6 -0
  111. package/dist/types/enums/index.d.ts +1 -0
  112. package/dist/types/enums/notification-settings/index.d.ts +1 -0
  113. package/dist/types/enums/notification-settings/traffic-source.d.ts +1 -0
  114. package/dist/types/enums/payment-method/deletion-reason.d.ts +1 -0
  115. package/dist/types/enums/payment-method/index.d.ts +3 -0
  116. package/dist/types/enums/payment-method/origin.d.ts +1 -0
  117. package/dist/types/enums/payment-method/type.d.ts +1 -0
  118. package/dist/types/notifications/entities/index.d.ts +1 -0
  119. package/dist/types/notifications/entities/payment-method/index.d.ts +2 -0
  120. package/dist/types/notifications/entities/payment-method/payment-method-deleted-notification.d.ts +13 -0
  121. package/dist/types/notifications/entities/payment-method/payment-method-notification.d.ts +12 -0
  122. package/dist/types/notifications/entities/subscription/index.d.ts +1 -0
  123. package/dist/types/notifications/entities/subscription/subscription-created-notification.d.ts +34 -0
  124. package/dist/types/notifications/entities/subscription/subscription-notification.d.ts +0 -1
  125. package/dist/types/notifications/events/index.d.ts +1 -0
  126. package/dist/types/notifications/events/payment-method/index.d.ts +2 -0
  127. package/dist/types/notifications/events/payment-method/payment-method-deleted-event.d.ts +10 -0
  128. package/dist/types/notifications/events/payment-method/payment-method-saved-event.d.ts +10 -0
  129. package/dist/types/notifications/events/subscription/subscription-activated-event.d.ts +1 -1
  130. package/dist/types/notifications/events/subscription/subscription-canceled-event.d.ts +1 -1
  131. package/dist/types/notifications/events/subscription/subscription-created-event.d.ts +4 -4
  132. package/dist/types/notifications/events/subscription/subscription-imported-event.d.ts +1 -1
  133. package/dist/types/notifications/events/subscription/subscription-past-due-event.d.ts +1 -1
  134. package/dist/types/notifications/events/subscription/subscription-paused-event.d.ts +1 -1
  135. package/dist/types/notifications/events/subscription/subscription-resumed-event.d.ts +1 -1
  136. package/dist/types/notifications/events/subscription/subscription-trialing-event.d.ts +1 -1
  137. package/dist/types/notifications/events/subscription/subscription-updated-event.d.ts +1 -1
  138. package/dist/types/notifications/helpers/types.d.ts +5 -3
  139. package/dist/types/notifications/types/index.d.ts +1 -0
  140. package/dist/types/notifications/types/payment-method/index.d.ts +2 -0
  141. package/dist/types/notifications/types/payment-method/payment-method-deleted-notification-response.d.ts +11 -0
  142. package/dist/types/notifications/types/payment-method/payment-method-notification-response.d.ts +10 -0
  143. package/dist/types/notifications/types/subscription/index.d.ts +1 -0
  144. package/dist/types/notifications/types/subscription/subscription-created-notification-response.d.ts +28 -0
  145. package/dist/types/notifications/types/subscription/subscription-notification-response.d.ts +0 -1
  146. package/dist/types/paddle.d.ts +2 -1
  147. package/dist/types/resources/customers/index.d.ts +2 -1
  148. package/dist/types/resources/index.d.ts +1 -0
  149. package/dist/types/resources/notification-settings/operations/create-notification-settings-request-body.d.ts +2 -1
  150. package/dist/types/resources/notification-settings/operations/list-notification-settings-query-parameters.d.ts +2 -0
  151. package/dist/types/resources/notification-settings/operations/update-notification-settings-request-body.d.ts +2 -0
  152. package/dist/types/resources/payment-methods/index.d.ts +9 -0
  153. package/dist/types/resources/payment-methods/operations/index.d.ts +1 -0
  154. package/dist/types/resources/payment-methods/operations/list-customer-payment-method-query-parameters.d.ts +7 -0
  155. package/dist/types/types/customer/auth-token-response.d.ts +4 -0
  156. package/dist/types/types/customer/index.d.ts +1 -0
  157. package/dist/types/types/events/events-response.d.ts +9 -3
  158. package/dist/types/types/index.d.ts +1 -0
  159. package/dist/types/types/notification-settings/notification-settings-response.d.ts +2 -1
  160. package/dist/types/types/payment-method/index.d.ts +1 -0
  161. package/dist/types/types/payment-method/payment-method.d.ts +13 -0
  162. package/dist/types/types/shared/index.d.ts +1 -0
  163. package/dist/types/types/shared/paypal.d.ts +4 -0
  164. package/dist/types/version.d.ts +1 -1
  165. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -12,6 +12,15 @@ When we make [non-breaking changes](https://developer.paddle.com/api-reference/a
12
12
 
13
13
  This means when upgrading minor versions of the SDK, you may notice type errors. You can safely ignore these or fix by adding additional type guards.
14
14
 
15
+ ## 2.0.0-rc.2 - 2024-11-19
16
+
17
+ ### Added
18
+
19
+ - Added the `trafficSource` filter on notification settings
20
+ - Omitted the `transactionId` completely from `SubscriptionNotification` and created a separate `SubscriptionCreatedNotification` with the non-null `transactionId`
21
+ - Added `paymentMethods` resources
22
+ - Added `generateAuthToken` for customer
23
+
15
24
  ## 2.0.0-rc.1 - 2024-10-08
16
25
 
17
26
  ### Added
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AuthToken = void 0;
4
+ class AuthToken {
5
+ constructor(authToken) {
6
+ this.customerAuthToken = authToken.customer_auth_token;
7
+ this.expiresAt = authToken.expires_at;
8
+ }
9
+ }
10
+ exports.AuthToken = AuthToken;
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./auth-token.js"), exports);
17
18
  __exportStar(require("./customer-collection.js"), exports);
18
19
  __exportStar(require("./customer.js"), exports);
19
20
  __exportStar(require("./credit-balance.js"), exports);
@@ -25,6 +25,7 @@ __exportStar(require("./subscription/index.js"), exports);
25
25
  __exportStar(require("./address/index.js"), exports);
26
26
  __exportStar(require("./discount/index.js"), exports);
27
27
  __exportStar(require("./events/index.js"), exports);
28
+ __exportStar(require("./payment-method/index.js"), exports);
28
29
  __exportStar(require("./payout/index.js"), exports);
29
30
  __exportStar(require("./event-types/index.js"), exports);
30
31
  __exportStar(require("./notification-settings/index.js"), exports);
@@ -11,6 +11,7 @@ class NotificationSettings {
11
11
  this.active = notificationSettings.active;
12
12
  this.apiVersion = notificationSettings.api_version;
13
13
  this.includeSensitiveFields = notificationSettings.include_sensitive_fields;
14
+ this.trafficSource = notificationSettings.traffic_source;
14
15
  this.subscribedEvents = notificationSettings.subscribed_events.map((subscribed_event) => new index_js_1.EventType(subscribed_event));
15
16
  this.endpointSecretKey = notificationSettings.endpoint_secret_key;
16
17
  }
@@ -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("./payment-method.js"), exports);
18
+ __exportStar(require("./payment-method-collection.js"), exports);
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PaymentMethodCollection = void 0;
4
+ const index_js_1 = require("../../entities/index.js");
5
+ const index_js_2 = require("../../internal/base/index.js");
6
+ class PaymentMethodCollection extends index_js_2.Collection {
7
+ fromJson(data) {
8
+ return new index_js_1.PaymentMethod(data);
9
+ }
10
+ }
11
+ exports.PaymentMethodCollection = PaymentMethodCollection;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PaymentMethod = void 0;
4
+ const index_js_1 = require("../shared/index.js");
5
+ class PaymentMethod {
6
+ constructor(paymentMethodResponse) {
7
+ this.id = paymentMethodResponse.id;
8
+ this.customerId = paymentMethodResponse.customer_id;
9
+ this.addressId = paymentMethodResponse.address_id;
10
+ this.type = paymentMethodResponse.type;
11
+ this.card = paymentMethodResponse.card ? new index_js_1.PaymentCard(paymentMethodResponse.card) : null;
12
+ this.paypal = paymentMethodResponse.paypal ? new index_js_1.PayPal(paymentMethodResponse.paypal) : null;
13
+ this.origin = paymentMethodResponse.origin;
14
+ this.savedAt = paymentMethodResponse.saved_at;
15
+ this.updatedAt = paymentMethodResponse.updated_at;
16
+ }
17
+ }
18
+ exports.PaymentMethod = PaymentMethod;
@@ -27,6 +27,7 @@ __exportStar(require("./adjustment-original-amount.js"), exports);
27
27
  __exportStar(require("./chargeback-fee.js"), exports);
28
28
  __exportStar(require("./transaction-payout-totals-adjusted.js"), exports);
29
29
  __exportStar(require("./unit-totals.js"), exports);
30
+ __exportStar(require("./paypal.js"), exports);
30
31
  __exportStar(require("./payment-card.js"), exports);
31
32
  __exportStar(require("./payment-method-details.js"), exports);
32
33
  __exportStar(require("./transaction-payment-attempt.js"), exports);
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PayPal = void 0;
4
+ class PayPal {
5
+ constructor(payPalResponse) {
6
+ this.email = payPalResponse.email;
7
+ this.reference = payPalResponse.reference;
8
+ }
9
+ }
10
+ exports.PayPal = PayPal;
@@ -19,6 +19,7 @@ __exportStar(require("./subscription/index.js"), exports);
19
19
  __exportStar(require("./discount/index.js"), exports);
20
20
  __exportStar(require("./adjustment/index.js"), exports);
21
21
  __exportStar(require("./transaction/index.js"), exports);
22
+ __exportStar(require("./payment-method/index.js"), exports);
22
23
  __exportStar(require("./payout/index.js"), exports);
23
24
  __exportStar(require("./notification-settings/index.js"), exports);
24
25
  __exportStar(require("./notification/index.js"), exports);
@@ -15,3 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./notification-settings-type.js"), exports);
18
+ __exportStar(require("./traffic-source.js"), exports);
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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("./deletion-reason.js"), exports);
18
+ __exportStar(require("./type.js"), exports);
19
+ __exportStar(require("./origin.js"), exports);
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -23,6 +23,7 @@ __exportStar(require("./business/index.js"), exports);
23
23
  __exportStar(require("./subscription/index.js"), exports);
24
24
  __exportStar(require("./address/index.js"), exports);
25
25
  __exportStar(require("./discount/index.js"), exports);
26
+ __exportStar(require("./payment-method/index.js"), exports);
26
27
  __exportStar(require("./payout/index.js"), exports);
27
28
  __exportStar(require("./report/index.js"), exports);
28
29
  __exportStar(require("./shared/index.js"), exports);
@@ -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("./payment-method-deleted-notification.js"), exports);
18
+ __exportStar(require("./payment-method-notification.js"), exports);
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PaymentMethodDeletedNotification = void 0;
4
+ class PaymentMethodDeletedNotification {
5
+ constructor(paymentMethod) {
6
+ this.id = paymentMethod.id;
7
+ this.customerId = paymentMethod.customer_id;
8
+ this.addressId = paymentMethod.address_id;
9
+ this.deletionReason = paymentMethod.deletion_reason;
10
+ this.type = paymentMethod.type;
11
+ this.origin = paymentMethod.origin;
12
+ this.savedAt = paymentMethod.saved_at;
13
+ this.updatedAt = paymentMethod.updated_at;
14
+ }
15
+ }
16
+ exports.PaymentMethodDeletedNotification = PaymentMethodDeletedNotification;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PaymentMethodNotification = void 0;
4
+ class PaymentMethodNotification {
5
+ constructor(paymentMethod) {
6
+ this.id = paymentMethod.id;
7
+ this.customerId = paymentMethod.customer_id;
8
+ this.addressId = paymentMethod.address_id;
9
+ this.type = paymentMethod.type;
10
+ this.origin = paymentMethod.origin;
11
+ this.savedAt = paymentMethod.saved_at;
12
+ this.updatedAt = paymentMethod.updated_at;
13
+ }
14
+ }
15
+ exports.PaymentMethodNotification = PaymentMethodNotification;
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./subscription-created-notification.js"), exports);
17
18
  __exportStar(require("./subscription-discount-notification.js"), exports);
18
19
  __exportStar(require("./subscription-time-period-notification.js"), exports);
19
20
  __exportStar(require("./subscription-scheduled-change-notification.js"), exports);
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SubscriptionCreatedNotification = void 0;
4
+ const index_js_1 = require("../shared/index.js");
5
+ const subscription_discount_notification_js_1 = require("./subscription-discount-notification.js");
6
+ const subscription_item_notification_js_1 = require("./subscription-item-notification.js");
7
+ const subscription_scheduled_change_notification_js_1 = require("./subscription-scheduled-change-notification.js");
8
+ const subscription_time_period_notification_js_1 = require("./subscription-time-period-notification.js");
9
+ class SubscriptionCreatedNotification {
10
+ constructor(subscription) {
11
+ this.id = subscription.id;
12
+ this.status = subscription.status;
13
+ this.transactionId = subscription.transaction_id;
14
+ this.customerId = subscription.customer_id;
15
+ this.addressId = subscription.address_id;
16
+ this.businessId = subscription.business_id ? subscription.business_id : null;
17
+ this.currencyCode = subscription.currency_code;
18
+ this.createdAt = subscription.created_at;
19
+ this.updatedAt = subscription.updated_at;
20
+ this.startedAt = subscription.started_at ? subscription.started_at : null;
21
+ this.firstBilledAt = subscription.first_billed_at ? subscription.first_billed_at : null;
22
+ this.nextBilledAt = subscription.next_billed_at ? subscription.next_billed_at : null;
23
+ this.pausedAt = subscription.paused_at ? subscription.paused_at : null;
24
+ this.canceledAt = subscription.canceled_at ? subscription.canceled_at : null;
25
+ this.discount = subscription.discount ? new subscription_discount_notification_js_1.SubscriptionDiscountNotification(subscription.discount) : null;
26
+ this.collectionMode = subscription.collection_mode;
27
+ this.billingDetails = subscription.billing_details
28
+ ? new index_js_1.BillingDetailsNotification(subscription.billing_details)
29
+ : null;
30
+ this.currentBillingPeriod = subscription.current_billing_period
31
+ ? new subscription_time_period_notification_js_1.SubscriptionTimePeriodNotification(subscription.current_billing_period)
32
+ : null;
33
+ this.billingCycle = new index_js_1.TimePeriodNotification(subscription.billing_cycle);
34
+ this.scheduledChange = subscription.scheduled_change
35
+ ? new subscription_scheduled_change_notification_js_1.SubscriptionScheduledChangeNotification(subscription.scheduled_change)
36
+ : null;
37
+ this.items = subscription.items.map((item) => new subscription_item_notification_js_1.SubscriptionItemNotification(item));
38
+ this.customData = subscription.custom_data ? subscription.custom_data : null;
39
+ this.importMeta = subscription.import_meta ? new index_js_1.ImportMetaNotification(subscription.import_meta) : null;
40
+ }
41
+ }
42
+ exports.SubscriptionCreatedNotification = SubscriptionCreatedNotification;
@@ -10,7 +10,6 @@ class SubscriptionNotification {
10
10
  constructor(subscription) {
11
11
  this.id = subscription.id;
12
12
  this.status = subscription.status;
13
- this.transactionId = subscription.transaction_id ? subscription.transaction_id : null;
14
13
  this.customerId = subscription.customer_id;
15
14
  this.addressId = subscription.address_id;
16
15
  this.businessId = subscription.business_id ? subscription.business_id : null;
@@ -19,6 +19,7 @@ __exportStar(require("./adjustment/index.js"), exports);
19
19
  __exportStar(require("./business/index.js"), exports);
20
20
  __exportStar(require("./customer/index.js"), exports);
21
21
  __exportStar(require("./discount/index.js"), exports);
22
+ __exportStar(require("./payment-method/index.js"), exports);
22
23
  __exportStar(require("./payout/index.js"), exports);
23
24
  __exportStar(require("./price/index.js"), exports);
24
25
  __exportStar(require("./product/index.js"), exports);
@@ -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("./payment-method-deleted-event.js"), exports);
18
+ __exportStar(require("./payment-method-saved-event.js"), exports);
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PaymentMethodDeletedEvent = void 0;
4
+ const event_js_1 = require("../../../entities/events/event.js");
5
+ const index_js_1 = require("../../entities/index.js");
6
+ const index_js_2 = require("../../helpers/index.js");
7
+ class PaymentMethodDeletedEvent extends event_js_1.Event {
8
+ constructor(response) {
9
+ super(response);
10
+ this.eventType = index_js_2.EventName.PaymentMethodDeleted;
11
+ this.data = new index_js_1.PaymentMethodDeletedNotification(response.data);
12
+ }
13
+ }
14
+ exports.PaymentMethodDeletedEvent = PaymentMethodDeletedEvent;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PaymentMethodSavedEvent = void 0;
4
+ const event_js_1 = require("../../../entities/events/event.js");
5
+ const index_js_1 = require("../../entities/index.js");
6
+ const index_js_2 = require("../../helpers/index.js");
7
+ class PaymentMethodSavedEvent extends event_js_1.Event {
8
+ constructor(response) {
9
+ super(response);
10
+ this.eventType = index_js_2.EventName.PaymentMethodSaved;
11
+ this.data = new index_js_1.PaymentMethodNotification(response.data);
12
+ }
13
+ }
14
+ exports.PaymentMethodSavedEvent = PaymentMethodSavedEvent;
@@ -8,7 +8,7 @@ class SubscriptionCreatedEvent extends event_js_1.Event {
8
8
  constructor(response) {
9
9
  super(response);
10
10
  this.eventType = index_js_1.EventName.SubscriptionCreated;
11
- this.data = new index_js_2.SubscriptionNotification(response.data);
11
+ this.data = new index_js_2.SubscriptionCreatedNotification(response.data);
12
12
  }
13
13
  }
14
14
  exports.SubscriptionCreatedEvent = SubscriptionCreatedEvent;
@@ -17,6 +17,8 @@ var EventName;
17
17
  EventName["DiscountCreated"] = "discount.created";
18
18
  EventName["DiscountUpdated"] = "discount.updated";
19
19
  EventName["DiscountImported"] = "discount.imported";
20
+ EventName["PaymentMethodDeleted"] = "payment_method.deleted";
21
+ EventName["PaymentMethodSaved"] = "payment_method.saved";
20
22
  EventName["PayoutCreated"] = "payout.created";
21
23
  EventName["PayoutPaid"] = "payout.paid";
22
24
  EventName["PriceCreated"] = "price.created";
@@ -62,6 +62,10 @@ class Webhooks {
62
62
  return new index_js_1.DiscountImportedEvent(data);
63
63
  case types_js_1.EventName.DiscountUpdated:
64
64
  return new index_js_1.DiscountUpdatedEvent(data);
65
+ case types_js_1.EventName.PaymentMethodDeleted:
66
+ return new index_js_1.PaymentMethodDeletedEvent(data);
67
+ case types_js_1.EventName.PaymentMethodSaved:
68
+ return new index_js_1.PaymentMethodSavedEvent(data);
65
69
  case types_js_1.EventName.PayoutCreated:
66
70
  return new index_js_1.PayoutCreatedEvent(data);
67
71
  case types_js_1.EventName.PayoutPaid:
@@ -23,6 +23,7 @@ __exportStar(require("./business/index.js"), exports);
23
23
  __exportStar(require("./subscription/index.js"), exports);
24
24
  __exportStar(require("./address/index.js"), exports);
25
25
  __exportStar(require("./discount/index.js"), exports);
26
+ __exportStar(require("./payment-method/index.js"), exports);
26
27
  __exportStar(require("./payout/index.js"), exports);
27
28
  __exportStar(require("./report/index.js"), exports);
28
29
  __exportStar(require("./shared/index.js"), exports);
@@ -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("./payment-method-deleted-notification-response.js"), exports);
18
+ __exportStar(require("./payment-method-notification-response.js"), exports);
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./subscription-created-notification-response.js"), exports);
17
18
  __exportStar(require("./subscription-discount-notification-response.js"), exports);
18
19
  __exportStar(require("./subscription-time-period-notification-response.js"), exports);
19
20
  __exportStar(require("./subscription-scheduled-change-notification-response.js"), exports);
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -22,6 +22,7 @@ class Paddle {
22
22
  this.businesses = new index_js_2.BusinessesResource(this.client);
23
23
  this.discounts = new index_js_2.DiscountsResource(this.client);
24
24
  this.subscriptions = new index_js_2.SubscriptionsResource(this.client);
25
+ this.paymentMethods = new index_js_2.PaymentMethodsResource(this.client);
25
26
  this.pricingPreview = new index_js_2.PricingPreviewResource(this.client);
26
27
  this.events = new index_js_3.EventsResource(this.client);
27
28
  this.webhooks = new index_js_4.Webhooks();
@@ -32,6 +32,7 @@ const CustomerPaths = {
32
32
  get: '/customers/{customer_id}',
33
33
  update: '/customers/{customer_id}',
34
34
  getCustomerBalance: '/customers/{customer_id}/credit-balances',
35
+ generate: '/customers/{customer_id}/auth-token',
35
36
  };
36
37
  __exportStar(require("./operations/index.js"), exports);
37
38
  class CustomersResource extends index_js_1.BaseResource {
@@ -82,5 +83,15 @@ class CustomersResource extends index_js_1.BaseResource {
82
83
  return yield this.update(customerId, { status: 'archived' });
83
84
  });
84
85
  }
86
+ generateAuthToken(customerId) {
87
+ return __awaiter(this, void 0, void 0, function* () {
88
+ const urlWithPathParams = new index_js_1.PathParameters(CustomerPaths.generate, {
89
+ customer_id: customerId,
90
+ }).deriveUrl();
91
+ const response = yield this.client.post(urlWithPathParams, undefined);
92
+ const data = this.handleResponse(response);
93
+ return new index_js_2.AuthToken(data);
94
+ });
95
+ }
85
96
  }
86
97
  exports.CustomersResource = CustomersResource;
@@ -23,6 +23,7 @@ __exportStar(require("./prices/index.js"), exports);
23
23
  __exportStar(require("./products/index.js"), exports);
24
24
  __exportStar(require("./subscriptions/index.js"), exports);
25
25
  __exportStar(require("./transactions/index.js"), exports);
26
+ __exportStar(require("./payment-methods/index.js"), exports);
26
27
  __exportStar(require("./pricing-preview/index.js"), exports);
27
28
  __exportStar(require("./event-types/index.js"), exports);
28
29
  __exportStar(require("./notification-settings/index.js"), exports);
@@ -0,0 +1,67 @@
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.PaymentMethodsResource = void 0;
27
+ const index_js_1 = require("../../entities/index.js");
28
+ const index_js_2 = require("../../internal/base/index.js");
29
+ __exportStar(require("./operations"), exports);
30
+ const PaymentMethodPaths = {
31
+ list: '/customers/{customer_id}/payment-methods',
32
+ get: '/customers/{customer_id}/payment-methods/{payment_method_id}',
33
+ delete: '/customers/{customer_id}/payment-methods/{payment_method_id}',
34
+ };
35
+ class PaymentMethodsResource extends index_js_2.BaseResource {
36
+ list(customerId, queryParams) {
37
+ const queryParameters = new index_js_2.QueryParameters(queryParams);
38
+ const urlWithPathParams = new index_js_2.PathParameters(PaymentMethodPaths.list, {
39
+ customer_id: customerId,
40
+ }).deriveUrl();
41
+ return new index_js_1.PaymentMethodCollection(this.client, urlWithPathParams + queryParameters.toQueryString());
42
+ }
43
+ get(customerId, paymentMethodId) {
44
+ return __awaiter(this, void 0, void 0, function* () {
45
+ const urlWithPathParams = new index_js_2.PathParameters(PaymentMethodPaths.get, {
46
+ customer_id: customerId,
47
+ payment_method_id: paymentMethodId,
48
+ }).deriveUrl();
49
+ const response = yield this.client.get(urlWithPathParams);
50
+ const data = this.handleResponse(response);
51
+ return new index_js_1.PaymentMethod(data);
52
+ });
53
+ }
54
+ delete(customerId, paymentMethodId) {
55
+ return __awaiter(this, void 0, void 0, function* () {
56
+ const urlWithPathParams = new index_js_2.PathParameters(PaymentMethodPaths.delete, {
57
+ customer_id: customerId,
58
+ payment_method_id: paymentMethodId,
59
+ }).deriveUrl();
60
+ const response = yield this.client.delete(urlWithPathParams);
61
+ if (response) {
62
+ this.handleResponse(response);
63
+ }
64
+ });
65
+ }
66
+ }
67
+ exports.PaymentMethodsResource = PaymentMethodsResource;
@@ -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("./list-customer-payment-method-query-parameters.js"), exports);
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./auth-token-response.js"), exports);
17
18
  __exportStar(require("./customer-response.js"), exports);
18
19
  __exportStar(require("./credit-balance-response.js"), exports);
19
20
  __exportStar(require("./customer-balance.js"), exports);
@@ -24,6 +24,7 @@ __exportStar(require("./business/index.js"), exports);
24
24
  __exportStar(require("./subscription/index.js"), exports);
25
25
  __exportStar(require("./address/index.js"), exports);
26
26
  __exportStar(require("./discount/index.js"), exports);
27
+ __exportStar(require("./payment-method/index.js"), exports);
27
28
  __exportStar(require("./pricing-preview/index.js"), exports);
28
29
  __exportStar(require("./events/index.js"), exports);
29
30
  __exportStar(require("./payout/index.js"), exports);
@@ -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("./payment-method.js"), exports);