@paddle/paddle-node-sdk 2.0.0-rc.1 → 2.0.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 (167) hide show
  1. package/CHANGELOG.md +8 -11
  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/internal/api/case-helpers.js +19 -32
  19. package/dist/cjs/notifications/entities/index.js +1 -0
  20. package/dist/cjs/notifications/entities/payment-method/index.js +18 -0
  21. package/dist/cjs/notifications/entities/payment-method/payment-method-deleted-notification.js +16 -0
  22. package/dist/cjs/notifications/entities/payment-method/payment-method-notification.js +15 -0
  23. package/dist/cjs/notifications/entities/subscription/index.js +1 -0
  24. package/dist/cjs/notifications/entities/subscription/subscription-created-notification.js +42 -0
  25. package/dist/cjs/notifications/entities/subscription/subscription-notification.js +0 -1
  26. package/dist/cjs/notifications/events/index.js +1 -0
  27. package/dist/cjs/notifications/events/payment-method/index.js +18 -0
  28. package/dist/cjs/notifications/events/payment-method/payment-method-deleted-event.js +14 -0
  29. package/dist/cjs/notifications/events/payment-method/payment-method-saved-event.js +14 -0
  30. package/dist/cjs/notifications/events/subscription/subscription-created-event.js +1 -1
  31. package/dist/cjs/notifications/helpers/types.js +2 -0
  32. package/dist/cjs/notifications/helpers/webhooks.js +4 -0
  33. package/dist/cjs/notifications/types/index.js +1 -0
  34. package/dist/cjs/notifications/types/payment-method/index.js +18 -0
  35. package/dist/cjs/notifications/types/payment-method/payment-method-deleted-notification-response.js +2 -0
  36. package/dist/cjs/notifications/types/payment-method/payment-method-notification-response.js +2 -0
  37. package/dist/cjs/notifications/types/subscription/index.js +1 -0
  38. package/dist/cjs/notifications/types/subscription/subscription-created-notification-response.js +2 -0
  39. package/dist/cjs/paddle.js +1 -0
  40. package/dist/cjs/resources/customers/index.js +11 -0
  41. package/dist/cjs/resources/index.js +1 -0
  42. package/dist/cjs/resources/payment-methods/index.js +67 -0
  43. package/dist/cjs/resources/payment-methods/operations/index.js +17 -0
  44. package/dist/cjs/resources/payment-methods/operations/list-customer-payment-method-query-parameters.js +2 -0
  45. package/dist/cjs/types/customer/auth-token-response.js +2 -0
  46. package/dist/cjs/types/customer/index.js +1 -0
  47. package/dist/cjs/types/index.js +1 -0
  48. package/dist/cjs/types/payment-method/index.js +17 -0
  49. package/dist/cjs/types/payment-method/payment-method.js +2 -0
  50. package/dist/cjs/types/shared/index.js +1 -0
  51. package/dist/cjs/types/shared/paypal.js +2 -0
  52. package/dist/cjs/version.js +1 -1
  53. package/dist/esm/entities/customer/auth-token.js +6 -0
  54. package/dist/esm/entities/customer/index.js +1 -0
  55. package/dist/esm/entities/index.js +1 -0
  56. package/dist/esm/entities/notification-settings/notification-settings.js +1 -0
  57. package/dist/esm/entities/payment-method/index.js +2 -0
  58. package/dist/esm/entities/payment-method/payment-method-collection.js +7 -0
  59. package/dist/esm/entities/payment-method/payment-method.js +14 -0
  60. package/dist/esm/entities/shared/index.js +1 -0
  61. package/dist/esm/entities/shared/paypal.js +6 -0
  62. package/dist/esm/enums/index.js +1 -0
  63. package/dist/esm/enums/notification-settings/index.js +1 -0
  64. package/dist/esm/enums/notification-settings/traffic-source.js +1 -0
  65. package/dist/esm/enums/payment-method/deletion-reason.js +1 -0
  66. package/dist/esm/enums/payment-method/index.js +3 -0
  67. package/dist/esm/enums/payment-method/origin.js +1 -0
  68. package/dist/esm/enums/payment-method/type.js +1 -0
  69. package/dist/esm/internal/api/case-helpers.js +19 -9
  70. package/dist/esm/notifications/entities/index.js +1 -0
  71. package/dist/esm/notifications/entities/payment-method/index.js +2 -0
  72. package/dist/esm/notifications/entities/payment-method/payment-method-deleted-notification.js +12 -0
  73. package/dist/esm/notifications/entities/payment-method/payment-method-notification.js +11 -0
  74. package/dist/esm/notifications/entities/subscription/index.js +1 -0
  75. package/dist/esm/notifications/entities/subscription/subscription-created-notification.js +38 -0
  76. package/dist/esm/notifications/entities/subscription/subscription-notification.js +0 -1
  77. package/dist/esm/notifications/events/index.js +1 -0
  78. package/dist/esm/notifications/events/payment-method/index.js +2 -0
  79. package/dist/esm/notifications/events/payment-method/payment-method-deleted-event.js +10 -0
  80. package/dist/esm/notifications/events/payment-method/payment-method-saved-event.js +10 -0
  81. package/dist/esm/notifications/events/subscription/subscription-created-event.js +2 -2
  82. package/dist/esm/notifications/helpers/types.js +2 -0
  83. package/dist/esm/notifications/helpers/webhooks.js +5 -1
  84. package/dist/esm/notifications/types/index.js +1 -0
  85. package/dist/esm/notifications/types/payment-method/index.js +2 -0
  86. package/dist/esm/notifications/types/payment-method/payment-method-deleted-notification-response.js +1 -0
  87. package/dist/esm/notifications/types/payment-method/payment-method-notification-response.js +1 -0
  88. package/dist/esm/notifications/types/subscription/index.js +1 -0
  89. package/dist/esm/notifications/types/subscription/subscription-created-notification-response.js +1 -0
  90. package/dist/esm/paddle.js +2 -1
  91. package/dist/esm/resources/customers/index.js +12 -1
  92. package/dist/esm/resources/index.js +1 -0
  93. package/dist/esm/resources/payment-methods/index.js +49 -0
  94. package/dist/esm/resources/payment-methods/operations/index.js +1 -0
  95. package/dist/esm/resources/payment-methods/operations/list-customer-payment-method-query-parameters.js +1 -0
  96. package/dist/esm/types/customer/auth-token-response.js +1 -0
  97. package/dist/esm/types/customer/index.js +1 -0
  98. package/dist/esm/types/index.js +1 -0
  99. package/dist/esm/types/payment-method/index.js +1 -0
  100. package/dist/esm/types/payment-method/payment-method.js +1 -0
  101. package/dist/esm/types/shared/index.js +1 -0
  102. package/dist/esm/types/shared/paypal.js +1 -0
  103. package/dist/esm/version.js +1 -1
  104. package/dist/types/entities/customer/auth-token.d.ts +6 -0
  105. package/dist/types/entities/customer/index.d.ts +1 -0
  106. package/dist/types/entities/index.d.ts +1 -0
  107. package/dist/types/entities/notification-settings/notification-settings.d.ts +2 -1
  108. package/dist/types/entities/payment-method/index.d.ts +2 -0
  109. package/dist/types/entities/payment-method/payment-method-collection.d.ts +6 -0
  110. package/dist/types/entities/payment-method/payment-method.d.ts +15 -0
  111. package/dist/types/entities/shared/index.d.ts +1 -0
  112. package/dist/types/entities/shared/paypal.d.ts +6 -0
  113. package/dist/types/enums/index.d.ts +1 -0
  114. package/dist/types/enums/notification-settings/index.d.ts +1 -0
  115. package/dist/types/enums/notification-settings/traffic-source.d.ts +1 -0
  116. package/dist/types/enums/payment-method/deletion-reason.d.ts +1 -0
  117. package/dist/types/enums/payment-method/index.d.ts +3 -0
  118. package/dist/types/enums/payment-method/origin.d.ts +1 -0
  119. package/dist/types/enums/payment-method/type.d.ts +1 -0
  120. package/dist/types/notifications/entities/index.d.ts +1 -0
  121. package/dist/types/notifications/entities/payment-method/index.d.ts +2 -0
  122. package/dist/types/notifications/entities/payment-method/payment-method-deleted-notification.d.ts +13 -0
  123. package/dist/types/notifications/entities/payment-method/payment-method-notification.d.ts +12 -0
  124. package/dist/types/notifications/entities/subscription/index.d.ts +1 -0
  125. package/dist/types/notifications/entities/subscription/subscription-created-notification.d.ts +34 -0
  126. package/dist/types/notifications/entities/subscription/subscription-notification.d.ts +0 -1
  127. package/dist/types/notifications/events/index.d.ts +1 -0
  128. package/dist/types/notifications/events/payment-method/index.d.ts +2 -0
  129. package/dist/types/notifications/events/payment-method/payment-method-deleted-event.d.ts +10 -0
  130. package/dist/types/notifications/events/payment-method/payment-method-saved-event.d.ts +10 -0
  131. package/dist/types/notifications/events/subscription/subscription-activated-event.d.ts +1 -1
  132. package/dist/types/notifications/events/subscription/subscription-canceled-event.d.ts +1 -1
  133. package/dist/types/notifications/events/subscription/subscription-created-event.d.ts +4 -4
  134. package/dist/types/notifications/events/subscription/subscription-imported-event.d.ts +1 -1
  135. package/dist/types/notifications/events/subscription/subscription-past-due-event.d.ts +1 -1
  136. package/dist/types/notifications/events/subscription/subscription-paused-event.d.ts +1 -1
  137. package/dist/types/notifications/events/subscription/subscription-resumed-event.d.ts +1 -1
  138. package/dist/types/notifications/events/subscription/subscription-trialing-event.d.ts +1 -1
  139. package/dist/types/notifications/events/subscription/subscription-updated-event.d.ts +1 -1
  140. package/dist/types/notifications/helpers/types.d.ts +5 -3
  141. package/dist/types/notifications/types/index.d.ts +1 -0
  142. package/dist/types/notifications/types/payment-method/index.d.ts +2 -0
  143. package/dist/types/notifications/types/payment-method/payment-method-deleted-notification-response.d.ts +11 -0
  144. package/dist/types/notifications/types/payment-method/payment-method-notification-response.d.ts +10 -0
  145. package/dist/types/notifications/types/subscription/index.d.ts +1 -0
  146. package/dist/types/notifications/types/subscription/subscription-created-notification-response.d.ts +28 -0
  147. package/dist/types/notifications/types/subscription/subscription-notification-response.d.ts +0 -1
  148. package/dist/types/paddle.d.ts +2 -1
  149. package/dist/types/resources/customers/index.d.ts +2 -1
  150. package/dist/types/resources/index.d.ts +1 -0
  151. package/dist/types/resources/notification-settings/operations/create-notification-settings-request-body.d.ts +2 -1
  152. package/dist/types/resources/notification-settings/operations/list-notification-settings-query-parameters.d.ts +2 -0
  153. package/dist/types/resources/notification-settings/operations/update-notification-settings-request-body.d.ts +2 -0
  154. package/dist/types/resources/payment-methods/index.d.ts +9 -0
  155. package/dist/types/resources/payment-methods/operations/index.d.ts +1 -0
  156. package/dist/types/resources/payment-methods/operations/list-customer-payment-method-query-parameters.d.ts +7 -0
  157. package/dist/types/types/customer/auth-token-response.d.ts +4 -0
  158. package/dist/types/types/customer/index.d.ts +1 -0
  159. package/dist/types/types/events/events-response.d.ts +9 -3
  160. package/dist/types/types/index.d.ts +1 -0
  161. package/dist/types/types/notification-settings/notification-settings-response.d.ts +2 -1
  162. package/dist/types/types/payment-method/index.d.ts +1 -0
  163. package/dist/types/types/payment-method/payment-method.d.ts +13 -0
  164. package/dist/types/types/shared/index.d.ts +1 -0
  165. package/dist/types/types/shared/paypal.d.ts +4 -0
  166. package/dist/types/version.d.ts +1 -1
  167. package/package.json +1 -4
@@ -1,6 +1,8 @@
1
+ import { type TrafficSource } from '../../../enums/index.js';
1
2
  export interface ListNotificationSettingsQueryParameters {
2
3
  after?: string;
3
4
  perPage?: number;
4
5
  orderBy?: string;
5
6
  active?: boolean;
7
+ trafficSource?: TrafficSource;
6
8
  }
@@ -1,3 +1,4 @@
1
+ import { type TrafficSource } from '../../../enums/index.js';
1
2
  import { type IEventName } from '../../../notifications/index.js';
2
3
  export interface UpdateNotificationSettingsRequestBody {
3
4
  description?: string;
@@ -6,4 +7,5 @@ export interface UpdateNotificationSettingsRequestBody {
6
7
  apiVersion?: number;
7
8
  includeSensitiveFields?: boolean;
8
9
  subscribedEvents?: IEventName[];
10
+ trafficSource?: TrafficSource;
9
11
  }
@@ -0,0 +1,9 @@
1
+ import { PaymentMethod, PaymentMethodCollection } from '../../entities/index.js';
2
+ import { BaseResource } from '../../internal/base/index.js';
3
+ import { type ListCustomerPaymentMethodQueryParameters } from './operations/index.js';
4
+ export * from './operations';
5
+ export declare class PaymentMethodsResource extends BaseResource {
6
+ list(customerId: string, queryParams?: ListCustomerPaymentMethodQueryParameters): PaymentMethodCollection;
7
+ get(customerId: string, paymentMethodId: string): Promise<PaymentMethod>;
8
+ delete(customerId: string, paymentMethodId: string): Promise<undefined>;
9
+ }
@@ -0,0 +1 @@
1
+ export * from './list-customer-payment-method-query-parameters.js';
@@ -0,0 +1,7 @@
1
+ export interface ListCustomerPaymentMethodQueryParameters {
2
+ addressId?: any[];
3
+ after?: string;
4
+ orderBy?: string;
5
+ perPage?: number;
6
+ supportsCheckout?: boolean;
7
+ }
@@ -0,0 +1,4 @@
1
+ export interface IAuthTokenResponse {
2
+ customer_auth_token: string;
3
+ expires_at: string;
4
+ }
@@ -1,3 +1,4 @@
1
+ export * from './auth-token-response.js';
1
2
  export * from './customer-response.js';
2
3
  export * from './credit-balance-response.js';
3
4
  export * from './customer-balance.js';
@@ -1,4 +1,4 @@
1
- import { type EventName, type IAddressNotificationResponse, type IAdjustmentNotificationResponse, type IBusinessNotificationResponse, type ICustomerNotificationResponse, type IDiscountNotificationResponse, type IPayoutNotificationResponse, type IPriceNotificationResponse, type IProductNotificationResponse, type IReportNotificationResponse, type ISubscriptionNotificationResponse, type ITransactionNotificationResponse } from '../../notifications/index.js';
1
+ import { type EventName, type IAddressNotificationResponse, type IAdjustmentNotificationResponse, type IBusinessNotificationResponse, type ICustomerNotificationResponse, type IDiscountNotificationResponse, type IPaymentMethodNotificationResponse, type IPaymentMethodDeletedNotificationResponse, type IPayoutNotificationResponse, type IPriceNotificationResponse, type IProductNotificationResponse, type IReportNotificationResponse, type ISubscriptionCreatedNotificationResponse, type ISubscriptionNotificationResponse, type ITransactionNotificationResponse } from '../../notifications/index.js';
2
2
  export interface IEventsResponse<T = object> {
3
3
  event_id: string;
4
4
  notification_id: string | null;
@@ -48,6 +48,12 @@ interface IDiscountUpdated extends IEventsResponse<IDiscountNotificationResponse
48
48
  interface IDiscountImported extends IEventsResponse<IDiscountNotificationResponse> {
49
49
  event_type: EventName.DiscountImported;
50
50
  }
51
+ interface IPaymentMethodDeleted extends IEventsResponse<IPaymentMethodDeletedNotificationResponse> {
52
+ event_type: EventName.PaymentMethodDeleted;
53
+ }
54
+ interface IPaymentMethodSaved extends IEventsResponse<IPaymentMethodNotificationResponse> {
55
+ event_type: EventName.PaymentMethodSaved;
56
+ }
51
57
  interface IPayoutCreated extends IEventsResponse<IPayoutNotificationResponse> {
52
58
  event_type: EventName.PayoutCreated;
53
59
  }
@@ -78,7 +84,7 @@ interface ISubscriptionActivated extends IEventsResponse<ISubscriptionNotificati
78
84
  interface ISubscriptionCanceled extends IEventsResponse<ISubscriptionNotificationResponse> {
79
85
  event_type: EventName.SubscriptionCanceled;
80
86
  }
81
- interface ISubscriptionCreated extends IEventsResponse<ISubscriptionNotificationResponse> {
87
+ interface ISubscriptionCreated extends IEventsResponse<ISubscriptionCreatedNotificationResponse> {
82
88
  event_type: EventName.SubscriptionCreated;
83
89
  }
84
90
  interface ISubscriptionImported extends IEventsResponse<ISubscriptionNotificationResponse> {
@@ -132,5 +138,5 @@ interface IReportCreated extends IEventsResponse<IReportNotificationResponse> {
132
138
  interface IReportUpdated extends IEventsResponse<IReportNotificationResponse> {
133
139
  event_type: EventName.ReportUpdated;
134
140
  }
135
- export type IEvents = IAddressCreated | IAddressUpdated | IAddressImported | IAdjustmentCreated | IAdjustmentUpdated | IBusinessCreated | IBusinessUpdated | IBusinessImported | ICustomerCreated | ICustomerUpdated | ICustomerImported | IDiscountCreated | IDiscountUpdated | IDiscountImported | IPayoutCreated | IPayoutPaid | IPriceCreated | IPriceUpdated | IPriceImported | IProductCreated | IProductUpdated | IProductImported | ISubscriptionActivated | ISubscriptionCanceled | ISubscriptionCreated | ISubscriptionImported | ISubscriptionPastDue | ISubscriptionPaused | ISubscriptionResumed | ISubscriptionTrialing | ISubscriptionUpdated | ITransactionBilled | ITransactionCanceled | ITransactionCompleted | ITransactionCreated | ITransactionPaid | ITransactionPastDue | ITransactionPaymentFailed | ITransactionReady | ITransactionUpdated | IReportCreated | IReportUpdated;
141
+ export type IEvents = IAddressCreated | IAddressUpdated | IAddressImported | IAdjustmentCreated | IAdjustmentUpdated | IBusinessCreated | IBusinessUpdated | IBusinessImported | ICustomerCreated | ICustomerUpdated | ICustomerImported | IDiscountCreated | IDiscountUpdated | IDiscountImported | IPaymentMethodDeleted | IPaymentMethodSaved | IPayoutCreated | IPayoutPaid | IPriceCreated | IPriceUpdated | IPriceImported | IProductCreated | IProductUpdated | IProductImported | ISubscriptionActivated | ISubscriptionCanceled | ISubscriptionCreated | ISubscriptionImported | ISubscriptionPastDue | ISubscriptionPaused | ISubscriptionResumed | ISubscriptionTrialing | ISubscriptionUpdated | ITransactionBilled | ITransactionCanceled | ITransactionCompleted | ITransactionCreated | ITransactionPaid | ITransactionPastDue | ITransactionPaymentFailed | ITransactionReady | ITransactionUpdated | IReportCreated | IReportUpdated;
136
142
  export {};
@@ -8,6 +8,7 @@ export * from './business/index.js';
8
8
  export * from './subscription/index.js';
9
9
  export * from './address/index.js';
10
10
  export * from './discount/index.js';
11
+ export * from './payment-method/index.js';
11
12
  export * from './pricing-preview/index.js';
12
13
  export * from './events/index.js';
13
14
  export * from './payout/index.js';
@@ -1,4 +1,4 @@
1
- import { type NotificationSettingsType } from '../../enums/index.js';
1
+ import { type TrafficSource, type NotificationSettingsType } from '../../enums/index.js';
2
2
  import { type IEventTypeResponse } from '../event-types/index.js';
3
3
  export interface INotificationSettingsResponse {
4
4
  id: string;
@@ -8,6 +8,7 @@ export interface INotificationSettingsResponse {
8
8
  active: boolean;
9
9
  api_version: number;
10
10
  include_sensitive_fields: boolean;
11
+ traffic_source: TrafficSource;
11
12
  subscribed_events: IEventTypeResponse[];
12
13
  endpoint_secret_key: string;
13
14
  }
@@ -0,0 +1 @@
1
+ export * from './payment-method.js';
@@ -0,0 +1,13 @@
1
+ import { type IPaymentCardResponse, type IPayPalResponse } from '../index.js';
2
+ import { type SavedPaymentMethodType, type SavedPaymentOrigin } from '../../enums/index.js';
3
+ export interface IPaymentMethodResponse {
4
+ id: string;
5
+ customer_id: string;
6
+ address_id: string;
7
+ type: SavedPaymentMethodType;
8
+ card?: IPaymentCardResponse | null;
9
+ paypal?: IPayPalResponse | null;
10
+ origin: SavedPaymentOrigin;
11
+ saved_at: string;
12
+ updated_at: string;
13
+ }
@@ -14,6 +14,7 @@ export * from './adjustment-original-amount-response.js';
14
14
  export * from './chargeback-fee.js';
15
15
  export * from './transaction-payout-totals-adjusted-response.js';
16
16
  export * from './unit-totals.js';
17
+ export * from './paypal.js';
17
18
  export * from './payment-card-response.js';
18
19
  export * from './payment-method-details.js';
19
20
  export * from './transaction-payment-attempt-response.js';
@@ -0,0 +1,4 @@
1
+ export interface IPayPalResponse {
2
+ email: string;
3
+ reference: string;
4
+ }
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "2.0.0-rc.1";
1
+ export declare const SDK_VERSION = "2.0.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paddle/paddle-node-sdk",
3
- "version": "2.0.0-rc.1",
3
+ "version": "2.0.0",
4
4
  "description": "A Node.js SDK that you can use to integrate Paddle Billing with applications written in server-side JavaScript.",
5
5
  "main": "dist/cjs/index.cjs.node.js",
6
6
  "module": "dist/esm/index.esm.node.js",
@@ -58,9 +58,6 @@
58
58
  "prettier": "^3.0.3",
59
59
  "typescript": "^5.2.2"
60
60
  },
61
- "dependencies": {
62
- "lodash": "^4.17.21"
63
- },
64
61
  "exports": {
65
62
  "types": "./dist/types/index.cjs.node.d.ts",
66
63
  "worker": {