@paddle/paddle-node-sdk 1.9.0 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. package/CHANGELOG.md +19 -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/payment-method/index.js +18 -0
  6. package/dist/cjs/entities/payment-method/payment-method-collection.js +11 -0
  7. package/dist/cjs/entities/payment-method/payment-method.js +18 -0
  8. package/dist/cjs/entities/shared/index.js +1 -0
  9. package/dist/cjs/entities/shared/paypal.js +10 -0
  10. package/dist/cjs/enums/index.js +1 -0
  11. package/dist/cjs/enums/payment-method/deletion-reason.js +2 -0
  12. package/dist/cjs/enums/payment-method/index.js +19 -0
  13. package/dist/cjs/enums/payment-method/origin.js +2 -0
  14. package/dist/cjs/enums/payment-method/type.js +2 -0
  15. package/dist/cjs/notifications/entities/index.js +1 -0
  16. package/dist/cjs/notifications/entities/payment-method/index.js +18 -0
  17. package/dist/cjs/notifications/entities/payment-method/payment-method-deleted-notification.js +16 -0
  18. package/dist/cjs/notifications/entities/payment-method/payment-method-notification.js +15 -0
  19. package/dist/cjs/notifications/entities/subscription/index.js +1 -0
  20. package/dist/cjs/notifications/entities/subscription/subscription-created-notification.js +38 -0
  21. package/dist/cjs/notifications/entities/subscription/subscription-notification.js +0 -1
  22. package/dist/cjs/notifications/events/index.js +1 -0
  23. package/dist/cjs/notifications/events/payment-method/index.js +18 -0
  24. package/dist/cjs/notifications/events/payment-method/payment-method-deleted-event.js +14 -0
  25. package/dist/cjs/notifications/events/payment-method/payment-method-saved-event.js +14 -0
  26. package/dist/cjs/notifications/events/subscription/subscription-created-event.js +1 -1
  27. package/dist/cjs/notifications/helpers/types.js +2 -0
  28. package/dist/cjs/notifications/helpers/webhooks.js +4 -0
  29. package/dist/cjs/notifications/types/index.js +1 -0
  30. package/dist/cjs/notifications/types/payment-method/index.js +18 -0
  31. package/dist/cjs/notifications/types/payment-method/payment-method-deleted-notification-response.js +2 -0
  32. package/dist/cjs/notifications/types/payment-method/payment-method-notification-response.js +2 -0
  33. package/dist/cjs/notifications/types/subscription/index.js +1 -0
  34. package/dist/cjs/notifications/types/subscription/subscription-created-notification-response.js +2 -0
  35. package/dist/cjs/paddle.js +1 -0
  36. package/dist/cjs/resources/customers/index.js +11 -0
  37. package/dist/cjs/resources/index.js +1 -0
  38. package/dist/cjs/resources/payment-methods/index.js +67 -0
  39. package/dist/cjs/resources/payment-methods/operations/index.js +17 -0
  40. package/dist/cjs/resources/payment-methods/operations/list-customer-payment-method-query-parameters.js +2 -0
  41. package/dist/cjs/types/customer/auth-token-response.js +2 -0
  42. package/dist/cjs/types/customer/index.js +1 -0
  43. package/dist/cjs/types/index.js +1 -0
  44. package/dist/cjs/types/payment-method/index.js +17 -0
  45. package/dist/cjs/types/payment-method/payment-method.js +2 -0
  46. package/dist/cjs/types/shared/index.js +1 -0
  47. package/dist/cjs/types/shared/paypal.js +2 -0
  48. package/dist/cjs/version.js +1 -1
  49. package/dist/esm/entities/customer/auth-token.js +6 -0
  50. package/dist/esm/entities/customer/index.js +1 -0
  51. package/dist/esm/entities/index.js +1 -0
  52. package/dist/esm/entities/payment-method/index.js +2 -0
  53. package/dist/esm/entities/payment-method/payment-method-collection.js +7 -0
  54. package/dist/esm/entities/payment-method/payment-method.js +14 -0
  55. package/dist/esm/entities/shared/index.js +1 -0
  56. package/dist/esm/entities/shared/paypal.js +6 -0
  57. package/dist/esm/enums/index.js +1 -0
  58. package/dist/esm/enums/payment-method/deletion-reason.js +1 -0
  59. package/dist/esm/enums/payment-method/index.js +3 -0
  60. package/dist/esm/enums/payment-method/origin.js +1 -0
  61. package/dist/esm/enums/payment-method/type.js +1 -0
  62. package/dist/esm/notifications/entities/index.js +1 -0
  63. package/dist/esm/notifications/entities/payment-method/index.js +2 -0
  64. package/dist/esm/notifications/entities/payment-method/payment-method-deleted-notification.js +12 -0
  65. package/dist/esm/notifications/entities/payment-method/payment-method-notification.js +11 -0
  66. package/dist/esm/notifications/entities/subscription/index.js +1 -0
  67. package/dist/esm/notifications/entities/subscription/subscription-created-notification.js +34 -0
  68. package/dist/esm/notifications/entities/subscription/subscription-notification.js +0 -1
  69. package/dist/esm/notifications/events/index.js +1 -0
  70. package/dist/esm/notifications/events/payment-method/index.js +2 -0
  71. package/dist/esm/notifications/events/payment-method/payment-method-deleted-event.js +10 -0
  72. package/dist/esm/notifications/events/payment-method/payment-method-saved-event.js +10 -0
  73. package/dist/esm/notifications/events/subscription/subscription-created-event.js +2 -2
  74. package/dist/esm/notifications/helpers/types.js +2 -0
  75. package/dist/esm/notifications/helpers/webhooks.js +5 -1
  76. package/dist/esm/notifications/types/index.js +1 -0
  77. package/dist/esm/notifications/types/payment-method/index.js +2 -0
  78. package/dist/esm/notifications/types/payment-method/payment-method-deleted-notification-response.js +1 -0
  79. package/dist/esm/notifications/types/payment-method/payment-method-notification-response.js +1 -0
  80. package/dist/esm/notifications/types/subscription/index.js +1 -0
  81. package/dist/esm/notifications/types/subscription/subscription-created-notification-response.js +1 -0
  82. package/dist/esm/paddle.js +2 -1
  83. package/dist/esm/resources/customers/index.js +12 -1
  84. package/dist/esm/resources/index.js +1 -0
  85. package/dist/esm/resources/payment-methods/index.js +49 -0
  86. package/dist/esm/resources/payment-methods/operations/index.js +1 -0
  87. package/dist/esm/resources/payment-methods/operations/list-customer-payment-method-query-parameters.js +1 -0
  88. package/dist/esm/types/customer/auth-token-response.js +1 -0
  89. package/dist/esm/types/customer/index.js +1 -0
  90. package/dist/esm/types/index.js +1 -0
  91. package/dist/esm/types/payment-method/index.js +1 -0
  92. package/dist/esm/types/payment-method/payment-method.js +1 -0
  93. package/dist/esm/types/shared/index.js +1 -0
  94. package/dist/esm/types/shared/paypal.js +1 -0
  95. package/dist/esm/version.js +1 -1
  96. package/dist/types/entities/customer/auth-token.d.ts +6 -0
  97. package/dist/types/entities/customer/index.d.ts +1 -0
  98. package/dist/types/entities/index.d.ts +1 -0
  99. package/dist/types/entities/payment-method/index.d.ts +2 -0
  100. package/dist/types/entities/payment-method/payment-method-collection.d.ts +6 -0
  101. package/dist/types/entities/payment-method/payment-method.d.ts +15 -0
  102. package/dist/types/entities/shared/index.d.ts +1 -0
  103. package/dist/types/entities/shared/paypal.d.ts +6 -0
  104. package/dist/types/enums/index.d.ts +1 -0
  105. package/dist/types/enums/payment-method/deletion-reason.d.ts +1 -0
  106. package/dist/types/enums/payment-method/index.d.ts +3 -0
  107. package/dist/types/enums/payment-method/origin.d.ts +1 -0
  108. package/dist/types/enums/payment-method/type.d.ts +1 -0
  109. package/dist/types/notifications/entities/index.d.ts +1 -0
  110. package/dist/types/notifications/entities/payment-method/index.d.ts +2 -0
  111. package/dist/types/notifications/entities/payment-method/payment-method-deleted-notification.d.ts +13 -0
  112. package/dist/types/notifications/entities/payment-method/payment-method-notification.d.ts +12 -0
  113. package/dist/types/notifications/entities/subscription/index.d.ts +1 -0
  114. package/dist/types/notifications/entities/subscription/subscription-created-notification.d.ts +30 -0
  115. package/dist/types/notifications/entities/subscription/subscription-notification.d.ts +0 -1
  116. package/dist/types/notifications/events/index.d.ts +1 -0
  117. package/dist/types/notifications/events/payment-method/index.d.ts +2 -0
  118. package/dist/types/notifications/events/payment-method/payment-method-deleted-event.d.ts +10 -0
  119. package/dist/types/notifications/events/payment-method/payment-method-saved-event.d.ts +10 -0
  120. package/dist/types/notifications/events/subscription/subscription-activated-event.d.ts +1 -1
  121. package/dist/types/notifications/events/subscription/subscription-canceled-event.d.ts +1 -1
  122. package/dist/types/notifications/events/subscription/subscription-created-event.d.ts +4 -4
  123. package/dist/types/notifications/events/subscription/subscription-imported-event.d.ts +1 -1
  124. package/dist/types/notifications/events/subscription/subscription-past-due-event.d.ts +1 -1
  125. package/dist/types/notifications/events/subscription/subscription-paused-event.d.ts +1 -1
  126. package/dist/types/notifications/events/subscription/subscription-resumed-event.d.ts +1 -1
  127. package/dist/types/notifications/events/subscription/subscription-trialing-event.d.ts +1 -1
  128. package/dist/types/notifications/events/subscription/subscription-updated-event.d.ts +1 -1
  129. package/dist/types/notifications/helpers/types.d.ts +5 -3
  130. package/dist/types/notifications/types/index.d.ts +1 -0
  131. package/dist/types/notifications/types/payment-method/index.d.ts +2 -0
  132. package/dist/types/notifications/types/payment-method/payment-method-deleted-notification-response.d.ts +11 -0
  133. package/dist/types/notifications/types/payment-method/payment-method-notification-response.d.ts +10 -0
  134. package/dist/types/notifications/types/subscription/index.d.ts +1 -0
  135. package/dist/types/notifications/types/subscription/subscription-created-notification-response.d.ts +28 -0
  136. package/dist/types/notifications/types/subscription/subscription-notification-response.d.ts +0 -1
  137. package/dist/types/paddle.d.ts +2 -1
  138. package/dist/types/resources/customers/index.d.ts +2 -1
  139. package/dist/types/resources/index.d.ts +1 -0
  140. package/dist/types/resources/payment-methods/index.d.ts +9 -0
  141. package/dist/types/resources/payment-methods/operations/index.d.ts +1 -0
  142. package/dist/types/resources/payment-methods/operations/list-customer-payment-method-query-parameters.d.ts +7 -0
  143. package/dist/types/types/customer/auth-token-response.d.ts +4 -0
  144. package/dist/types/types/customer/index.d.ts +1 -0
  145. package/dist/types/types/events/events-response.d.ts +9 -3
  146. package/dist/types/types/index.d.ts +1 -0
  147. package/dist/types/types/payment-method/index.d.ts +1 -0
  148. package/dist/types/types/payment-method/payment-method.d.ts +13 -0
  149. package/dist/types/types/shared/index.d.ts +1 -0
  150. package/dist/types/types/shared/paypal.d.ts +4 -0
  151. package/dist/types/version.d.ts +1 -1
  152. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -12,12 +12,31 @@ 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
+ ## 1.10.0 - 2024-11-13
16
+
17
+ ### Added
18
+
19
+ - Added `paymentMethods` resources
20
+ - Added `generateAuthToken` for customer
21
+
22
+ ---
23
+
24
+ ## 1.9.1 - 2024-10-16
25
+
26
+ ### Fixed
27
+
28
+ - Omitted the `transactionId` completely from `SubscriptionNotification` and created a separate `SubscriptionCreatedNotification` with the non-null `transactionId`
29
+
30
+ ---
31
+
15
32
  ## 1.9.0 - 2024-10-15
16
33
 
17
34
  ### Added
18
35
 
19
36
  - Added the `trafficSource` filter on notification settings
20
37
 
38
+ ---
39
+
21
40
  ## 1.8.0 - 2024-10-08
22
41
 
23
42
  ### 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"), exports);
17
18
  __exportStar(require("./customer-collection"), exports);
18
19
  __exportStar(require("./customer"), exports);
19
20
  __exportStar(require("./credit-balance"), exports);
@@ -25,6 +25,7 @@ __exportStar(require("./subscription"), exports);
25
25
  __exportStar(require("./address"), exports);
26
26
  __exportStar(require("./discount"), exports);
27
27
  __exportStar(require("./events"), exports);
28
+ __exportStar(require("./payment-method"), exports);
28
29
  __exportStar(require("./payout"), exports);
29
30
  __exportStar(require("./event-types"), exports);
30
31
  __exportStar(require("./notification-settings"), 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"), exports);
18
+ __exportStar(require("./payment-method-collection"), exports);
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PaymentMethodCollection = void 0;
4
+ const entities_1 = require("../../entities");
5
+ const base_1 = require("../../internal/base");
6
+ class PaymentMethodCollection extends base_1.Collection {
7
+ fromJson(data) {
8
+ return new entities_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 shared_1 = require("../shared");
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 shared_1.PaymentCard(paymentMethodResponse.card) : null;
12
+ this.paypal = paymentMethodResponse.paypal ? new shared_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"), exports);
27
27
  __exportStar(require("./chargeback-fee"), exports);
28
28
  __exportStar(require("./transaction-payout-totals-adjusted"), exports);
29
29
  __exportStar(require("./unit-totals"), exports);
30
+ __exportStar(require("./paypal"), exports);
30
31
  __exportStar(require("./payment-card"), exports);
31
32
  __exportStar(require("./payment-method-details"), exports);
32
33
  __exportStar(require("./transaction-payment-attempt"), 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"), exports);
19
19
  __exportStar(require("./discount"), exports);
20
20
  __exportStar(require("./adjustment"), exports);
21
21
  __exportStar(require("./transaction"), exports);
22
+ __exportStar(require("./payment-method"), exports);
22
23
  __exportStar(require("./payout"), exports);
23
24
  __exportStar(require("./notification-settings"), exports);
24
25
  __exportStar(require("./notification"), exports);
@@ -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"), exports);
18
+ __exportStar(require("./type"), exports);
19
+ __exportStar(require("./origin"), 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"), exports);
23
23
  __exportStar(require("./subscription"), exports);
24
24
  __exportStar(require("./address"), exports);
25
25
  __exportStar(require("./discount"), exports);
26
+ __exportStar(require("./payment-method"), exports);
26
27
  __exportStar(require("./payout"), exports);
27
28
  __exportStar(require("./report"), exports);
28
29
  __exportStar(require("./shared"), 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"), exports);
18
+ __exportStar(require("./payment-method-notification"), 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"), exports);
17
18
  __exportStar(require("./subscription-discount-notification"), exports);
18
19
  __exportStar(require("./subscription-time-period-notification"), exports);
19
20
  __exportStar(require("./subscription-scheduled-change-notification"), exports);
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SubscriptionCreatedNotification = void 0;
4
+ const index_1 = require("../index");
5
+ class SubscriptionCreatedNotification {
6
+ constructor(subscription) {
7
+ this.id = subscription.id;
8
+ this.status = subscription.status;
9
+ this.transactionId = subscription.transaction_id;
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.SubscriptionDiscountNotification(subscription.discount) : null;
22
+ this.collectionMode = subscription.collection_mode;
23
+ this.billingDetails = subscription.billing_details
24
+ ? new index_1.BillingDetailsNotification(subscription.billing_details)
25
+ : null;
26
+ this.currentBillingPeriod = subscription.current_billing_period
27
+ ? new index_1.SubscriptionTimePeriodNotification(subscription.current_billing_period)
28
+ : null;
29
+ this.billingCycle = new index_1.TimePeriodNotification(subscription.billing_cycle);
30
+ this.scheduledChange = subscription.scheduled_change
31
+ ? new index_1.SubscriptionScheduledChangeNotification(subscription.scheduled_change)
32
+ : null;
33
+ this.items = subscription.items.map((item) => new index_1.SubscriptionItemNotification(item));
34
+ this.customData = subscription.custom_data ? subscription.custom_data : null;
35
+ this.importMeta = subscription.import_meta ? new index_1.ImportMetaNotification(subscription.import_meta) : null;
36
+ }
37
+ }
38
+ exports.SubscriptionCreatedNotification = SubscriptionCreatedNotification;
@@ -6,7 +6,6 @@ class SubscriptionNotification {
6
6
  constructor(subscription) {
7
7
  this.id = subscription.id;
8
8
  this.status = subscription.status;
9
- this.transactionId = subscription.transaction_id ? subscription.transaction_id : null;
10
9
  this.customerId = subscription.customer_id;
11
10
  this.addressId = subscription.address_id;
12
11
  this.businessId = subscription.business_id ? subscription.business_id : null;
@@ -19,6 +19,7 @@ __exportStar(require("./adjustment"), exports);
19
19
  __exportStar(require("./business"), exports);
20
20
  __exportStar(require("./customer"), exports);
21
21
  __exportStar(require("./discount"), exports);
22
+ __exportStar(require("./payment-method"), exports);
22
23
  __exportStar(require("./payout"), exports);
23
24
  __exportStar(require("./price"), exports);
24
25
  __exportStar(require("./product"), 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"), exports);
18
+ __exportStar(require("./payment-method-saved-event"), exports);
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PaymentMethodDeletedEvent = void 0;
4
+ const event_1 = require("../../../entities/events/event");
5
+ const entities_1 = require("../../entities");
6
+ const helpers_1 = require("../../helpers");
7
+ class PaymentMethodDeletedEvent extends event_1.Event {
8
+ constructor(response) {
9
+ super(response);
10
+ this.eventType = helpers_1.EventName.PaymentMethodDeleted;
11
+ this.data = new entities_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_1 = require("../../../entities/events/event");
5
+ const entities_1 = require("../../entities");
6
+ const helpers_1 = require("../../helpers");
7
+ class PaymentMethodSavedEvent extends event_1.Event {
8
+ constructor(response) {
9
+ super(response);
10
+ this.eventType = helpers_1.EventName.PaymentMethodSaved;
11
+ this.data = new entities_1.PaymentMethodNotification(response.data);
12
+ }
13
+ }
14
+ exports.PaymentMethodSavedEvent = PaymentMethodSavedEvent;
@@ -8,7 +8,7 @@ class SubscriptionCreatedEvent extends event_1.Event {
8
8
  constructor(response) {
9
9
  super(response);
10
10
  this.eventType = helpers_1.EventName.SubscriptionCreated;
11
- this.data = new entities_1.SubscriptionNotification(response.data);
11
+ this.data = new entities_1.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";
@@ -49,6 +49,10 @@ class Webhooks {
49
49
  return new events_1.DiscountImportedEvent(data);
50
50
  case types_1.EventName.DiscountUpdated:
51
51
  return new events_1.DiscountUpdatedEvent(data);
52
+ case types_1.EventName.PaymentMethodDeleted:
53
+ return new events_1.PaymentMethodDeletedEvent(data);
54
+ case types_1.EventName.PaymentMethodSaved:
55
+ return new events_1.PaymentMethodSavedEvent(data);
52
56
  case types_1.EventName.PayoutCreated:
53
57
  return new events_1.PayoutCreatedEvent(data);
54
58
  case types_1.EventName.PayoutPaid:
@@ -23,6 +23,7 @@ __exportStar(require("./business"), exports);
23
23
  __exportStar(require("./subscription"), exports);
24
24
  __exportStar(require("./address"), exports);
25
25
  __exportStar(require("./discount"), exports);
26
+ __exportStar(require("./payment-method"), exports);
26
27
  __exportStar(require("./payout"), exports);
27
28
  __exportStar(require("./report"), exports);
28
29
  __exportStar(require("./shared"), 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"), exports);
18
+ __exportStar(require("./payment-method-notification-response"), 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"), exports);
17
18
  __exportStar(require("./subscription-discount-notification-response"), exports);
18
19
  __exportStar(require("./subscription-time-period-notification-response"), exports);
19
20
  __exportStar(require("./subscription-scheduled-change-notification-response"), 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 resources_1.BusinessesResource(this.client);
23
23
  this.discounts = new resources_1.DiscountsResource(this.client);
24
24
  this.subscriptions = new resources_1.SubscriptionsResource(this.client);
25
+ this.paymentMethods = new resources_1.PaymentMethodsResource(this.client);
25
26
  this.pricingPreview = new resources_1.PricingPreviewResource(this.client);
26
27
  this.events = new events_1.EventsResource(this.client);
27
28
  this.webhooks = new notifications_1.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"), exports);
37
38
  class CustomersResource extends base_1.BaseResource {
@@ -82,5 +83,15 @@ class CustomersResource extends base_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 base_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 entities_1.AuthToken(data);
94
+ });
95
+ }
85
96
  }
86
97
  exports.CustomersResource = CustomersResource;
@@ -23,6 +23,7 @@ __exportStar(require("./prices"), exports);
23
23
  __exportStar(require("./products"), exports);
24
24
  __exportStar(require("./subscriptions"), exports);
25
25
  __exportStar(require("./transactions"), exports);
26
+ __exportStar(require("./payment-methods"), exports);
26
27
  __exportStar(require("./pricing-preview"), exports);
27
28
  __exportStar(require("./event-types"), exports);
28
29
  __exportStar(require("./notification-settings"), 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 entities_1 = require("../../entities");
28
+ const base_1 = require("../../internal/base");
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 base_1.BaseResource {
36
+ list(customerId, queryParams) {
37
+ const queryParameters = new base_1.QueryParameters(queryParams);
38
+ const urlWithPathParams = new base_1.PathParameters(PaymentMethodPaths.list, {
39
+ customer_id: customerId,
40
+ }).deriveUrl();
41
+ return new entities_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 base_1.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 entities_1.PaymentMethod(data);
52
+ });
53
+ }
54
+ delete(customerId, paymentMethodId) {
55
+ return __awaiter(this, void 0, void 0, function* () {
56
+ const urlWithPathParams = new base_1.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"), 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"), exports);
17
18
  __exportStar(require("./customer-response"), exports);
18
19
  __exportStar(require("./credit-balance-response"), exports);
19
20
  __exportStar(require("./customer-balance"), exports);
@@ -24,6 +24,7 @@ __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("./payment-method"), exports);
27
28
  __exportStar(require("./pricing-preview"), exports);
28
29
  __exportStar(require("./events"), exports);
29
30
  __exportStar(require("./payout"), 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"), exports);
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -30,6 +30,7 @@ __exportStar(require("./adjustment-original-amount-response"), exports);
30
30
  __exportStar(require("./chargeback-fee"), exports);
31
31
  __exportStar(require("./transaction-payout-totals-adjusted-response"), exports);
32
32
  __exportStar(require("./unit-totals"), exports);
33
+ __exportStar(require("./paypal"), exports);
33
34
  __exportStar(require("./payment-card-response"), exports);
34
35
  __exportStar(require("./payment-method-details"), exports);
35
36
  __exportStar(require("./transaction-payment-attempt-response"), exports);