@paddle/paddle-node-sdk 1.9.1 → 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.
- package/CHANGELOG.md +9 -0
- package/dist/cjs/entities/customer/auth-token.js +10 -0
- package/dist/cjs/entities/customer/index.js +1 -0
- package/dist/cjs/entities/index.js +1 -0
- package/dist/cjs/entities/payment-method/index.js +18 -0
- package/dist/cjs/entities/payment-method/payment-method-collection.js +11 -0
- package/dist/cjs/entities/payment-method/payment-method.js +18 -0
- package/dist/cjs/entities/shared/index.js +1 -0
- package/dist/cjs/entities/shared/paypal.js +10 -0
- package/dist/cjs/enums/index.js +1 -0
- package/dist/cjs/enums/payment-method/deletion-reason.js +2 -0
- package/dist/cjs/enums/payment-method/index.js +19 -0
- package/dist/cjs/enums/payment-method/origin.js +2 -0
- package/dist/cjs/enums/payment-method/type.js +2 -0
- package/dist/cjs/notifications/entities/index.js +1 -0
- package/dist/cjs/notifications/entities/payment-method/index.js +18 -0
- package/dist/cjs/notifications/entities/payment-method/payment-method-deleted-notification.js +16 -0
- package/dist/cjs/notifications/entities/payment-method/payment-method-notification.js +15 -0
- package/dist/cjs/notifications/events/index.js +1 -0
- package/dist/cjs/notifications/events/payment-method/index.js +18 -0
- package/dist/cjs/notifications/events/payment-method/payment-method-deleted-event.js +14 -0
- package/dist/cjs/notifications/events/payment-method/payment-method-saved-event.js +14 -0
- package/dist/cjs/notifications/helpers/types.js +2 -0
- package/dist/cjs/notifications/helpers/webhooks.js +4 -0
- package/dist/cjs/notifications/types/index.js +1 -0
- package/dist/cjs/notifications/types/payment-method/index.js +18 -0
- package/dist/cjs/notifications/types/payment-method/payment-method-deleted-notification-response.js +2 -0
- package/dist/cjs/notifications/types/payment-method/payment-method-notification-response.js +2 -0
- package/dist/cjs/paddle.js +1 -0
- package/dist/cjs/resources/customers/index.js +11 -0
- package/dist/cjs/resources/index.js +1 -0
- package/dist/cjs/resources/payment-methods/index.js +67 -0
- package/dist/cjs/resources/payment-methods/operations/index.js +17 -0
- package/dist/cjs/resources/payment-methods/operations/list-customer-payment-method-query-parameters.js +2 -0
- package/dist/cjs/types/customer/auth-token-response.js +2 -0
- package/dist/cjs/types/customer/index.js +1 -0
- package/dist/cjs/types/index.js +1 -0
- package/dist/cjs/types/payment-method/index.js +17 -0
- package/dist/cjs/types/payment-method/payment-method.js +2 -0
- package/dist/cjs/types/shared/index.js +1 -0
- package/dist/cjs/types/shared/paypal.js +2 -0
- package/dist/cjs/version.js +1 -1
- package/dist/esm/entities/customer/auth-token.js +6 -0
- package/dist/esm/entities/customer/index.js +1 -0
- package/dist/esm/entities/index.js +1 -0
- package/dist/esm/entities/payment-method/index.js +2 -0
- package/dist/esm/entities/payment-method/payment-method-collection.js +7 -0
- package/dist/esm/entities/payment-method/payment-method.js +14 -0
- package/dist/esm/entities/shared/index.js +1 -0
- package/dist/esm/entities/shared/paypal.js +6 -0
- package/dist/esm/enums/index.js +1 -0
- package/dist/esm/enums/payment-method/deletion-reason.js +1 -0
- package/dist/esm/enums/payment-method/index.js +3 -0
- package/dist/esm/enums/payment-method/origin.js +1 -0
- package/dist/esm/enums/payment-method/type.js +1 -0
- package/dist/esm/notifications/entities/index.js +1 -0
- package/dist/esm/notifications/entities/payment-method/index.js +2 -0
- package/dist/esm/notifications/entities/payment-method/payment-method-deleted-notification.js +12 -0
- package/dist/esm/notifications/entities/payment-method/payment-method-notification.js +11 -0
- package/dist/esm/notifications/events/index.js +1 -0
- package/dist/esm/notifications/events/payment-method/index.js +2 -0
- package/dist/esm/notifications/events/payment-method/payment-method-deleted-event.js +10 -0
- package/dist/esm/notifications/events/payment-method/payment-method-saved-event.js +10 -0
- package/dist/esm/notifications/helpers/types.js +2 -0
- package/dist/esm/notifications/helpers/webhooks.js +5 -1
- package/dist/esm/notifications/types/index.js +1 -0
- package/dist/esm/notifications/types/payment-method/index.js +2 -0
- package/dist/esm/notifications/types/payment-method/payment-method-deleted-notification-response.js +1 -0
- package/dist/esm/notifications/types/payment-method/payment-method-notification-response.js +1 -0
- package/dist/esm/paddle.js +2 -1
- package/dist/esm/resources/customers/index.js +12 -1
- package/dist/esm/resources/index.js +1 -0
- package/dist/esm/resources/payment-methods/index.js +49 -0
- package/dist/esm/resources/payment-methods/operations/index.js +1 -0
- package/dist/esm/resources/payment-methods/operations/list-customer-payment-method-query-parameters.js +1 -0
- package/dist/esm/types/customer/auth-token-response.js +1 -0
- package/dist/esm/types/customer/index.js +1 -0
- package/dist/esm/types/index.js +1 -0
- package/dist/esm/types/payment-method/index.js +1 -0
- package/dist/esm/types/payment-method/payment-method.js +1 -0
- package/dist/esm/types/shared/index.js +1 -0
- package/dist/esm/types/shared/paypal.js +1 -0
- package/dist/esm/version.js +1 -1
- package/dist/types/entities/customer/auth-token.d.ts +6 -0
- package/dist/types/entities/customer/index.d.ts +1 -0
- package/dist/types/entities/index.d.ts +1 -0
- package/dist/types/entities/payment-method/index.d.ts +2 -0
- package/dist/types/entities/payment-method/payment-method-collection.d.ts +6 -0
- package/dist/types/entities/payment-method/payment-method.d.ts +15 -0
- package/dist/types/entities/shared/index.d.ts +1 -0
- package/dist/types/entities/shared/paypal.d.ts +6 -0
- package/dist/types/enums/index.d.ts +1 -0
- package/dist/types/enums/payment-method/deletion-reason.d.ts +1 -0
- package/dist/types/enums/payment-method/index.d.ts +3 -0
- package/dist/types/enums/payment-method/origin.d.ts +1 -0
- package/dist/types/enums/payment-method/type.d.ts +1 -0
- package/dist/types/notifications/entities/index.d.ts +1 -0
- package/dist/types/notifications/entities/payment-method/index.d.ts +2 -0
- package/dist/types/notifications/entities/payment-method/payment-method-deleted-notification.d.ts +13 -0
- package/dist/types/notifications/entities/payment-method/payment-method-notification.d.ts +12 -0
- package/dist/types/notifications/events/index.d.ts +1 -0
- package/dist/types/notifications/events/payment-method/index.d.ts +2 -0
- package/dist/types/notifications/events/payment-method/payment-method-deleted-event.d.ts +10 -0
- package/dist/types/notifications/events/payment-method/payment-method-saved-event.d.ts +10 -0
- package/dist/types/notifications/helpers/types.d.ts +5 -3
- package/dist/types/notifications/types/index.d.ts +1 -0
- package/dist/types/notifications/types/payment-method/index.d.ts +2 -0
- package/dist/types/notifications/types/payment-method/payment-method-deleted-notification-response.d.ts +11 -0
- package/dist/types/notifications/types/payment-method/payment-method-notification-response.d.ts +10 -0
- package/dist/types/paddle.d.ts +2 -1
- package/dist/types/resources/customers/index.d.ts +2 -1
- package/dist/types/resources/index.d.ts +1 -0
- package/dist/types/resources/payment-methods/index.d.ts +9 -0
- package/dist/types/resources/payment-methods/operations/index.d.ts +1 -0
- package/dist/types/resources/payment-methods/operations/list-customer-payment-method-query-parameters.d.ts +7 -0
- package/dist/types/types/customer/auth-token-response.d.ts +4 -0
- package/dist/types/types/customer/index.d.ts +1 -0
- package/dist/types/types/events/events-response.d.ts +8 -2
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/types/payment-method/index.d.ts +1 -0
- package/dist/types/types/payment-method/payment-method.d.ts +13 -0
- package/dist/types/types/shared/index.d.ts +1 -0
- package/dist/types/types/shared/paypal.d.ts +4 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export class PaymentMethodDeletedNotification {
|
|
2
|
+
constructor(paymentMethod) {
|
|
3
|
+
this.id = paymentMethod.id;
|
|
4
|
+
this.customerId = paymentMethod.customer_id;
|
|
5
|
+
this.addressId = paymentMethod.address_id;
|
|
6
|
+
this.deletionReason = paymentMethod.deletion_reason;
|
|
7
|
+
this.type = paymentMethod.type;
|
|
8
|
+
this.origin = paymentMethod.origin;
|
|
9
|
+
this.savedAt = paymentMethod.saved_at;
|
|
10
|
+
this.updatedAt = paymentMethod.updated_at;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export class PaymentMethodNotification {
|
|
2
|
+
constructor(paymentMethod) {
|
|
3
|
+
this.id = paymentMethod.id;
|
|
4
|
+
this.customerId = paymentMethod.customer_id;
|
|
5
|
+
this.addressId = paymentMethod.address_id;
|
|
6
|
+
this.type = paymentMethod.type;
|
|
7
|
+
this.origin = paymentMethod.origin;
|
|
8
|
+
this.savedAt = paymentMethod.saved_at;
|
|
9
|
+
this.updatedAt = paymentMethod.updated_at;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Event } from '../../../entities/events/event';
|
|
2
|
+
import { PaymentMethodDeletedNotification } from '../../entities';
|
|
3
|
+
import { EventName } from '../../helpers';
|
|
4
|
+
export class PaymentMethodDeletedEvent extends Event {
|
|
5
|
+
constructor(response) {
|
|
6
|
+
super(response);
|
|
7
|
+
this.eventType = EventName.PaymentMethodDeleted;
|
|
8
|
+
this.data = new PaymentMethodDeletedNotification(response.data);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Event } from '../../../entities/events/event';
|
|
2
|
+
import { PaymentMethodNotification } from '../../entities';
|
|
3
|
+
import { EventName } from '../../helpers';
|
|
4
|
+
export class PaymentMethodSavedEvent extends Event {
|
|
5
|
+
constructor(response) {
|
|
6
|
+
super(response);
|
|
7
|
+
this.eventType = EventName.PaymentMethodSaved;
|
|
8
|
+
this.data = new PaymentMethodNotification(response.data);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -14,6 +14,8 @@ export var EventName;
|
|
|
14
14
|
EventName["DiscountCreated"] = "discount.created";
|
|
15
15
|
EventName["DiscountUpdated"] = "discount.updated";
|
|
16
16
|
EventName["DiscountImported"] = "discount.imported";
|
|
17
|
+
EventName["PaymentMethodDeleted"] = "payment_method.deleted";
|
|
18
|
+
EventName["PaymentMethodSaved"] = "payment_method.saved";
|
|
17
19
|
EventName["PayoutCreated"] = "payout.created";
|
|
18
20
|
EventName["PayoutPaid"] = "payout.paid";
|
|
19
21
|
EventName["PriceCreated"] = "price.created";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AddressCreatedEvent, AddressImportedEvent, AddressUpdatedEvent, AdjustmentCreatedEvent, AdjustmentUpdatedEvent, BusinessCreatedEvent, BusinessImportedEvent, BusinessUpdatedEvent, CustomerCreatedEvent, CustomerImportedEvent, CustomerUpdatedEvent, DiscountCreatedEvent, DiscountImportedEvent, DiscountUpdatedEvent, PayoutCreatedEvent, PayoutPaidEvent, PriceCreatedEvent, PriceImportedEvent, PriceUpdatedEvent, ProductCreatedEvent, ProductImportedEvent, ProductUpdatedEvent, ReportCreatedEvent, ReportUpdatedEvent, SubscriptionActivatedEvent, SubscriptionCanceledEvent, SubscriptionCreatedEvent, SubscriptionImportedEvent, SubscriptionPastDueEvent, SubscriptionPausedEvent, SubscriptionResumedEvent, SubscriptionTrialingEvent, SubscriptionUpdatedEvent, TransactionBilledEvent, TransactionCanceledEvent, TransactionCompletedEvent, TransactionCreatedEvent, TransactionPaidEvent, TransactionPastDueEvent, TransactionPaymentFailedEvent, TransactionReadyEvent, TransactionUpdatedEvent, } from '../events';
|
|
1
|
+
import { AddressCreatedEvent, AddressImportedEvent, AddressUpdatedEvent, AdjustmentCreatedEvent, AdjustmentUpdatedEvent, BusinessCreatedEvent, BusinessImportedEvent, BusinessUpdatedEvent, CustomerCreatedEvent, CustomerImportedEvent, CustomerUpdatedEvent, DiscountCreatedEvent, DiscountImportedEvent, DiscountUpdatedEvent, PaymentMethodDeletedEvent, PaymentMethodSavedEvent, PayoutCreatedEvent, PayoutPaidEvent, PriceCreatedEvent, PriceImportedEvent, PriceUpdatedEvent, ProductCreatedEvent, ProductImportedEvent, ProductUpdatedEvent, ReportCreatedEvent, ReportUpdatedEvent, SubscriptionActivatedEvent, SubscriptionCanceledEvent, SubscriptionCreatedEvent, SubscriptionImportedEvent, SubscriptionPastDueEvent, SubscriptionPausedEvent, SubscriptionResumedEvent, SubscriptionTrialingEvent, SubscriptionUpdatedEvent, TransactionBilledEvent, TransactionCanceledEvent, TransactionCompletedEvent, TransactionCreatedEvent, TransactionPaidEvent, TransactionPastDueEvent, TransactionPaymentFailedEvent, TransactionReadyEvent, TransactionUpdatedEvent, } from '../events';
|
|
2
2
|
import { EventName } from './types';
|
|
3
3
|
import { WebhooksValidator } from './webhooks-validator';
|
|
4
4
|
import { Logger } from '../../internal/base/logger';
|
|
@@ -46,6 +46,10 @@ export class Webhooks {
|
|
|
46
46
|
return new DiscountImportedEvent(data);
|
|
47
47
|
case EventName.DiscountUpdated:
|
|
48
48
|
return new DiscountUpdatedEvent(data);
|
|
49
|
+
case EventName.PaymentMethodDeleted:
|
|
50
|
+
return new PaymentMethodDeletedEvent(data);
|
|
51
|
+
case EventName.PaymentMethodSaved:
|
|
52
|
+
return new PaymentMethodSavedEvent(data);
|
|
49
53
|
case EventName.PayoutCreated:
|
|
50
54
|
return new PayoutCreatedEvent(data);
|
|
51
55
|
case EventName.PayoutPaid:
|
package/dist/esm/notifications/types/payment-method/payment-method-deleted-notification-response.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/esm/paddle.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Client } from './internal/api/client';
|
|
2
|
-
import { AddressesResource, AdjustmentsResource, BusinessesResource, CustomersResource, DiscountsResource, EventTypesResource, NotificationSettingsResource, NotificationsResource, PricesResource, PricingPreviewResource, ProductsResource, ReportsResource, SimulationTypesResource, SimulationsResource, SimulationRunsResource, SimulationRunEventsResource, SubscriptionsResource, TransactionsResource, } from './resources';
|
|
2
|
+
import { AddressesResource, AdjustmentsResource, BusinessesResource, CustomersResource, DiscountsResource, EventTypesResource, NotificationSettingsResource, NotificationsResource, PaymentMethodsResource, PricesResource, PricingPreviewResource, ProductsResource, ReportsResource, SimulationTypesResource, SimulationsResource, SimulationRunsResource, SimulationRunEventsResource, SubscriptionsResource, TransactionsResource, } from './resources';
|
|
3
3
|
import { Environment, LogLevel } from './internal';
|
|
4
4
|
import { EventsResource } from './resources/events';
|
|
5
5
|
import { Webhooks } from './notifications';
|
|
@@ -19,6 +19,7 @@ export class Paddle {
|
|
|
19
19
|
this.businesses = new BusinessesResource(this.client);
|
|
20
20
|
this.discounts = new DiscountsResource(this.client);
|
|
21
21
|
this.subscriptions = new SubscriptionsResource(this.client);
|
|
22
|
+
this.paymentMethods = new PaymentMethodsResource(this.client);
|
|
22
23
|
this.pricingPreview = new PricingPreviewResource(this.client);
|
|
23
24
|
this.events = new EventsResource(this.client);
|
|
24
25
|
this.webhooks = new Webhooks();
|
|
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { CreditBalance, Customer, CustomerCollection } from '../../entities';
|
|
10
|
+
import { CreditBalance, Customer, CustomerCollection, AuthToken } from '../../entities';
|
|
11
11
|
import { BaseResource, PathParameters, QueryParameters } from '../../internal/base';
|
|
12
12
|
const CustomerPaths = {
|
|
13
13
|
list: '/customers',
|
|
@@ -15,6 +15,7 @@ const CustomerPaths = {
|
|
|
15
15
|
get: '/customers/{customer_id}',
|
|
16
16
|
update: '/customers/{customer_id}',
|
|
17
17
|
getCustomerBalance: '/customers/{customer_id}/credit-balances',
|
|
18
|
+
generate: '/customers/{customer_id}/auth-token',
|
|
18
19
|
};
|
|
19
20
|
export * from './operations';
|
|
20
21
|
export class CustomersResource extends BaseResource {
|
|
@@ -65,4 +66,14 @@ export class CustomersResource extends BaseResource {
|
|
|
65
66
|
return yield this.update(customerId, { status: 'archived' });
|
|
66
67
|
});
|
|
67
68
|
}
|
|
69
|
+
generateAuthToken(customerId) {
|
|
70
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
const urlWithPathParams = new PathParameters(CustomerPaths.generate, {
|
|
72
|
+
customer_id: customerId,
|
|
73
|
+
}).deriveUrl();
|
|
74
|
+
const response = yield this.client.post(urlWithPathParams, undefined);
|
|
75
|
+
const data = this.handleResponse(response);
|
|
76
|
+
return new AuthToken(data);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
68
79
|
}
|
|
@@ -7,6 +7,7 @@ export * from './prices';
|
|
|
7
7
|
export * from './products';
|
|
8
8
|
export * from './subscriptions';
|
|
9
9
|
export * from './transactions';
|
|
10
|
+
export * from './payment-methods';
|
|
10
11
|
export * from './pricing-preview';
|
|
11
12
|
export * from './event-types';
|
|
12
13
|
export * from './notification-settings';
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { PaymentMethod, PaymentMethodCollection } from '../../entities';
|
|
11
|
+
import { BaseResource, PathParameters, QueryParameters } from '../../internal/base';
|
|
12
|
+
export * from './operations';
|
|
13
|
+
const PaymentMethodPaths = {
|
|
14
|
+
list: '/customers/{customer_id}/payment-methods',
|
|
15
|
+
get: '/customers/{customer_id}/payment-methods/{payment_method_id}',
|
|
16
|
+
delete: '/customers/{customer_id}/payment-methods/{payment_method_id}',
|
|
17
|
+
};
|
|
18
|
+
export class PaymentMethodsResource extends BaseResource {
|
|
19
|
+
list(customerId, queryParams) {
|
|
20
|
+
const queryParameters = new QueryParameters(queryParams);
|
|
21
|
+
const urlWithPathParams = new PathParameters(PaymentMethodPaths.list, {
|
|
22
|
+
customer_id: customerId,
|
|
23
|
+
}).deriveUrl();
|
|
24
|
+
return new PaymentMethodCollection(this.client, urlWithPathParams + queryParameters.toQueryString());
|
|
25
|
+
}
|
|
26
|
+
get(customerId, paymentMethodId) {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
const urlWithPathParams = new PathParameters(PaymentMethodPaths.get, {
|
|
29
|
+
customer_id: customerId,
|
|
30
|
+
payment_method_id: paymentMethodId,
|
|
31
|
+
}).deriveUrl();
|
|
32
|
+
const response = yield this.client.get(urlWithPathParams);
|
|
33
|
+
const data = this.handleResponse(response);
|
|
34
|
+
return new PaymentMethod(data);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
delete(customerId, paymentMethodId) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
const urlWithPathParams = new PathParameters(PaymentMethodPaths.delete, {
|
|
40
|
+
customer_id: customerId,
|
|
41
|
+
payment_method_id: paymentMethodId,
|
|
42
|
+
}).deriveUrl();
|
|
43
|
+
const response = yield this.client.delete(urlWithPathParams);
|
|
44
|
+
if (response) {
|
|
45
|
+
this.handleResponse(response);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './list-customer-payment-method-query-parameters';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/esm/types/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './payment-method';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -14,6 +14,7 @@ export * from './adjustment-original-amount-response';
|
|
|
14
14
|
export * from './chargeback-fee';
|
|
15
15
|
export * from './transaction-payout-totals-adjusted-response';
|
|
16
16
|
export * from './unit-totals';
|
|
17
|
+
export * from './paypal';
|
|
17
18
|
export * from './payment-card-response';
|
|
18
19
|
export * from './payment-method-details';
|
|
19
20
|
export * from './transaction-payment-attempt-response';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/esm/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = '1.
|
|
1
|
+
export const SDK_VERSION = '1.10.0';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PaymentMethod } from '../../entities';
|
|
2
|
+
import { type IPaymentMethodResponse } from '../../types';
|
|
3
|
+
import { Collection } from '../../internal/base';
|
|
4
|
+
export declare class PaymentMethodCollection extends Collection<IPaymentMethodResponse, PaymentMethod> {
|
|
5
|
+
fromJson(data: IPaymentMethodResponse): PaymentMethod;
|
|
6
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SavedPaymentMethodType, SavedPaymentOrigin } from '../../enums';
|
|
2
|
+
import type { IPaymentMethodResponse } from '../../types';
|
|
3
|
+
import { PaymentCard, PayPal } from '../shared';
|
|
4
|
+
export declare class PaymentMethod {
|
|
5
|
+
readonly id: string;
|
|
6
|
+
readonly customerId: string;
|
|
7
|
+
readonly addressId: string;
|
|
8
|
+
readonly type: SavedPaymentMethodType;
|
|
9
|
+
readonly card: PaymentCard | null;
|
|
10
|
+
readonly paypal: PayPal | null;
|
|
11
|
+
readonly origin: SavedPaymentOrigin;
|
|
12
|
+
readonly savedAt: string;
|
|
13
|
+
readonly updatedAt: string;
|
|
14
|
+
constructor(paymentMethodResponse: IPaymentMethodResponse);
|
|
15
|
+
}
|
|
@@ -11,6 +11,7 @@ export * from './adjustment-original-amount';
|
|
|
11
11
|
export * from './chargeback-fee';
|
|
12
12
|
export * from './transaction-payout-totals-adjusted';
|
|
13
13
|
export * from './unit-totals';
|
|
14
|
+
export * from './paypal';
|
|
14
15
|
export * from './payment-card';
|
|
15
16
|
export * from './payment-method-details';
|
|
16
17
|
export * from './transaction-payment-attempt';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type SavedPaymentDeletionReason = 'replaced_by_newer_version' | 'api';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type SavedPaymentOrigin = 'saved_during_purchase' | 'subscription';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type SavedPaymentMethodType = 'alipay' | 'apple_pay' | 'card' | 'google_pay' | 'korea_local' | 'paypal';
|
package/dist/types/notifications/entities/payment-method/payment-method-deleted-notification.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type IPaymentMethodDeletedNotificationResponse } from '../../types';
|
|
2
|
+
import { type SavedPaymentMethodType, type SavedPaymentOrigin, type SavedPaymentDeletionReason } from '../../../enums';
|
|
3
|
+
export declare class PaymentMethodDeletedNotification {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly customerId: string;
|
|
6
|
+
readonly addressId: string;
|
|
7
|
+
readonly deletionReason: SavedPaymentDeletionReason;
|
|
8
|
+
readonly type: SavedPaymentMethodType;
|
|
9
|
+
readonly origin: SavedPaymentOrigin;
|
|
10
|
+
readonly savedAt: string;
|
|
11
|
+
readonly updatedAt: string;
|
|
12
|
+
constructor(paymentMethod: IPaymentMethodDeletedNotificationResponse);
|
|
13
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type SavedPaymentMethodType, type SavedPaymentOrigin } from '../../../enums';
|
|
2
|
+
import { type IPaymentMethodNotificationResponse } from '../../types';
|
|
3
|
+
export declare class PaymentMethodNotification {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly customerId: string;
|
|
6
|
+
readonly addressId: string;
|
|
7
|
+
readonly type: SavedPaymentMethodType;
|
|
8
|
+
readonly origin: SavedPaymentOrigin;
|
|
9
|
+
readonly savedAt: string;
|
|
10
|
+
readonly updatedAt: string;
|
|
11
|
+
constructor(paymentMethod: IPaymentMethodNotificationResponse);
|
|
12
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Event } from '../../../entities/events/event';
|
|
2
|
+
import { PaymentMethodDeletedNotification } from '../../entities';
|
|
3
|
+
import { EventName } from '../../helpers';
|
|
4
|
+
import { type IEventsResponse } from '../../../types';
|
|
5
|
+
import { type IPaymentMethodDeletedNotificationResponse } from '../../types';
|
|
6
|
+
export declare class PaymentMethodDeletedEvent extends Event {
|
|
7
|
+
readonly eventType = EventName.PaymentMethodDeleted;
|
|
8
|
+
readonly data: PaymentMethodDeletedNotification;
|
|
9
|
+
constructor(response: IEventsResponse<IPaymentMethodDeletedNotificationResponse>);
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Event } from '../../../entities/events/event';
|
|
2
|
+
import { PaymentMethodNotification } from '../../entities';
|
|
3
|
+
import { EventName } from '../../helpers';
|
|
4
|
+
import { type IEventsResponse } from '../../../types';
|
|
5
|
+
import { type IPaymentMethodNotificationResponse } from '../../types';
|
|
6
|
+
export declare class PaymentMethodSavedEvent extends Event {
|
|
7
|
+
readonly eventType = EventName.PaymentMethodSaved;
|
|
8
|
+
readonly data: PaymentMethodNotification;
|
|
9
|
+
constructor(response: IEventsResponse<IPaymentMethodNotificationResponse>);
|
|
10
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type AddressCreatedEvent, type AddressUpdatedEvent, type AddressImportedEvent, type BusinessCreatedEvent, type AdjustmentCreatedEvent, type AdjustmentUpdatedEvent, type BusinessUpdatedEvent, type CustomerCreatedEvent, type CustomerUpdatedEvent, type DiscountCreatedEvent, type DiscountImportedEvent, type DiscountUpdatedEvent, type PayoutCreatedEvent, type PayoutPaidEvent, type PriceCreatedEvent, type PriceUpdatedEvent, type ProductCreatedEvent, type ProductUpdatedEvent, type SubscriptionCreatedEvent, type SubscriptionActivatedEvent, type SubscriptionCanceledEvent, type SubscriptionImportedEvent, type SubscriptionPausedEvent, type SubscriptionResumedEvent, type SubscriptionTrialingEvent, type SubscriptionUpdatedEvent, type TransactionCanceledEvent, type TransactionBilledEvent, type TransactionCompletedEvent, type TransactionCreatedEvent, type TransactionPaidEvent, type SubscriptionPastDueEvent, type TransactionPastDueEvent, type TransactionPaymentFailedEvent, type TransactionReadyEvent, type TransactionUpdatedEvent, type ReportUpdatedEvent, type ReportCreatedEvent, type BusinessImportedEvent, type CustomerImportedEvent, type PriceImportedEvent, type ProductImportedEvent } from '../events';
|
|
2
|
-
export type EventEntity = AddressCreatedEvent | AddressUpdatedEvent | AddressImportedEvent | AdjustmentUpdatedEvent | AdjustmentCreatedEvent | BusinessCreatedEvent | BusinessUpdatedEvent | BusinessImportedEvent | CustomerCreatedEvent | CustomerUpdatedEvent | CustomerImportedEvent | DiscountCreatedEvent | DiscountUpdatedEvent | DiscountImportedEvent | PayoutCreatedEvent | PayoutPaidEvent | PriceCreatedEvent | PriceUpdatedEvent | PriceImportedEvent | ProductCreatedEvent | ProductUpdatedEvent | ProductImportedEvent | SubscriptionActivatedEvent | SubscriptionCanceledEvent | SubscriptionCreatedEvent | SubscriptionImportedEvent | SubscriptionPastDueEvent | SubscriptionPausedEvent | SubscriptionResumedEvent | SubscriptionTrialingEvent | SubscriptionUpdatedEvent | TransactionBilledEvent | TransactionCanceledEvent | TransactionCompletedEvent | TransactionCreatedEvent | TransactionPaidEvent | TransactionPastDueEvent | TransactionPaymentFailedEvent | TransactionReadyEvent | TransactionUpdatedEvent | ReportUpdatedEvent | ReportCreatedEvent;
|
|
1
|
+
import { type AddressCreatedEvent, type AddressUpdatedEvent, type AddressImportedEvent, type BusinessCreatedEvent, type AdjustmentCreatedEvent, type AdjustmentUpdatedEvent, type BusinessUpdatedEvent, type CustomerCreatedEvent, type CustomerUpdatedEvent, type DiscountCreatedEvent, type DiscountImportedEvent, type DiscountUpdatedEvent, type PaymentMethodDeletedEvent, type PaymentMethodSavedEvent, type PayoutCreatedEvent, type PayoutPaidEvent, type PriceCreatedEvent, type PriceUpdatedEvent, type ProductCreatedEvent, type ProductUpdatedEvent, type SubscriptionCreatedEvent, type SubscriptionActivatedEvent, type SubscriptionCanceledEvent, type SubscriptionImportedEvent, type SubscriptionPausedEvent, type SubscriptionResumedEvent, type SubscriptionTrialingEvent, type SubscriptionUpdatedEvent, type TransactionCanceledEvent, type TransactionBilledEvent, type TransactionCompletedEvent, type TransactionCreatedEvent, type TransactionPaidEvent, type SubscriptionPastDueEvent, type TransactionPastDueEvent, type TransactionPaymentFailedEvent, type TransactionReadyEvent, type TransactionUpdatedEvent, type ReportUpdatedEvent, type ReportCreatedEvent, type BusinessImportedEvent, type CustomerImportedEvent, type PriceImportedEvent, type ProductImportedEvent } from '../events';
|
|
2
|
+
export type EventEntity = AddressCreatedEvent | AddressUpdatedEvent | AddressImportedEvent | AdjustmentUpdatedEvent | AdjustmentCreatedEvent | BusinessCreatedEvent | BusinessUpdatedEvent | BusinessImportedEvent | CustomerCreatedEvent | CustomerUpdatedEvent | CustomerImportedEvent | DiscountCreatedEvent | DiscountUpdatedEvent | DiscountImportedEvent | PaymentMethodDeletedEvent | PaymentMethodSavedEvent | PayoutCreatedEvent | PayoutPaidEvent | PriceCreatedEvent | PriceUpdatedEvent | PriceImportedEvent | ProductCreatedEvent | ProductUpdatedEvent | ProductImportedEvent | SubscriptionActivatedEvent | SubscriptionCanceledEvent | SubscriptionCreatedEvent | SubscriptionImportedEvent | SubscriptionPastDueEvent | SubscriptionPausedEvent | SubscriptionResumedEvent | SubscriptionTrialingEvent | SubscriptionUpdatedEvent | TransactionBilledEvent | TransactionCanceledEvent | TransactionCompletedEvent | TransactionCreatedEvent | TransactionPaidEvent | TransactionPastDueEvent | TransactionPaymentFailedEvent | TransactionReadyEvent | TransactionUpdatedEvent | ReportUpdatedEvent | ReportCreatedEvent;
|
|
3
3
|
export declare enum EventName {
|
|
4
4
|
AddressCreated = "address.created",
|
|
5
5
|
AddressUpdated = "address.updated",
|
|
@@ -15,6 +15,8 @@ export declare enum EventName {
|
|
|
15
15
|
DiscountCreated = "discount.created",
|
|
16
16
|
DiscountUpdated = "discount.updated",
|
|
17
17
|
DiscountImported = "discount.imported",
|
|
18
|
+
PaymentMethodDeleted = "payment_method.deleted",
|
|
19
|
+
PaymentMethodSaved = "payment_method.saved",
|
|
18
20
|
PayoutCreated = "payout.created",
|
|
19
21
|
PayoutPaid = "payout.paid",
|
|
20
22
|
PriceCreated = "price.created",
|
|
@@ -44,4 +46,4 @@ export declare enum EventName {
|
|
|
44
46
|
ReportCreated = "report.created",
|
|
45
47
|
ReportUpdated = "report.updated"
|
|
46
48
|
}
|
|
47
|
-
export type IEventName = 'address.created' | 'address.updated' | 'address.imported' | 'adjustment.created' | 'adjustment.updated' | 'business.created' | 'business.updated' | 'business.imported' | 'customer.created' | 'customer.imported' | 'customer.updated' | 'discount.created' | 'discount.updated' | 'discount.imported' | 'payout.created' | 'payout.updated' | 'payout.paid' | 'price.updated' | 'price.created' | 'price.imported' | 'product.updated' | 'product.created' | 'product.imported' | 'subscription.activated' | 'subscription.canceled' | 'subscription.imported' | 'subscription.created' | 'subscription.past_due' | 'subscription.paused' | 'subscription.resumed' | 'subscription.trialing' | 'subscription.updated' | 'transaction.billed' | 'transaction.canceled' | 'transaction.completed' | 'transaction.paid' | 'transaction.created' | 'transaction.past_due' | 'transaction.payment_failed' | 'transaction.ready' | 'transaction.updated' | 'report.created' | 'report.updated';
|
|
49
|
+
export type IEventName = 'address.created' | 'address.updated' | 'address.imported' | 'adjustment.created' | 'adjustment.updated' | 'business.created' | 'business.updated' | 'business.imported' | 'customer.created' | 'customer.imported' | 'customer.updated' | 'discount.created' | 'discount.updated' | 'discount.imported' | 'payment_method.saved' | 'payment_method.deleted' | 'payout.created' | 'payout.updated' | 'payout.paid' | 'price.updated' | 'price.created' | 'price.imported' | 'product.updated' | 'product.created' | 'product.imported' | 'subscription.activated' | 'subscription.canceled' | 'subscription.imported' | 'subscription.created' | 'subscription.past_due' | 'subscription.paused' | 'subscription.resumed' | 'subscription.trialing' | 'subscription.updated' | 'transaction.billed' | 'transaction.canceled' | 'transaction.completed' | 'transaction.paid' | 'transaction.created' | 'transaction.past_due' | 'transaction.payment_failed' | 'transaction.ready' | 'transaction.updated' | 'report.created' | 'report.updated';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type SavedPaymentDeletionReason, type SavedPaymentMethodType, type SavedPaymentOrigin } from '../../../enums';
|
|
2
|
+
export interface IPaymentMethodDeletedNotificationResponse {
|
|
3
|
+
id: string;
|
|
4
|
+
customer_id: string;
|
|
5
|
+
address_id: string;
|
|
6
|
+
deletion_reason: SavedPaymentDeletionReason;
|
|
7
|
+
type: SavedPaymentMethodType;
|
|
8
|
+
origin: SavedPaymentOrigin;
|
|
9
|
+
saved_at: string;
|
|
10
|
+
updated_at: string;
|
|
11
|
+
}
|
package/dist/types/notifications/types/payment-method/payment-method-notification-response.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type SavedPaymentMethodType, type SavedPaymentOrigin } from '../../../enums';
|
|
2
|
+
export interface IPaymentMethodNotificationResponse {
|
|
3
|
+
id: string;
|
|
4
|
+
customer_id: string;
|
|
5
|
+
address_id: string;
|
|
6
|
+
type: SavedPaymentMethodType;
|
|
7
|
+
origin: SavedPaymentOrigin;
|
|
8
|
+
saved_at: string;
|
|
9
|
+
updated_at: string;
|
|
10
|
+
}
|
package/dist/types/paddle.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AddressesResource, AdjustmentsResource, BusinessesResource, CustomersResource, DiscountsResource, EventTypesResource, NotificationSettingsResource, NotificationsResource, PricesResource, PricingPreviewResource, ProductsResource, ReportsResource, SimulationTypesResource, SimulationsResource, SimulationRunsResource, SimulationRunEventsResource, SubscriptionsResource, TransactionsResource } from './resources';
|
|
1
|
+
import { AddressesResource, AdjustmentsResource, BusinessesResource, CustomersResource, DiscountsResource, EventTypesResource, NotificationSettingsResource, NotificationsResource, PaymentMethodsResource, PricesResource, PricingPreviewResource, ProductsResource, ReportsResource, SimulationTypesResource, SimulationsResource, SimulationRunsResource, SimulationRunEventsResource, SubscriptionsResource, TransactionsResource } from './resources';
|
|
2
2
|
import { type PaddleOptions } from './internal';
|
|
3
3
|
import { EventsResource } from './resources/events';
|
|
4
4
|
import { Webhooks } from './notifications';
|
|
@@ -14,6 +14,7 @@ export declare class Paddle {
|
|
|
14
14
|
businesses: BusinessesResource;
|
|
15
15
|
discounts: DiscountsResource;
|
|
16
16
|
subscriptions: SubscriptionsResource;
|
|
17
|
+
paymentMethods: PaymentMethodsResource;
|
|
17
18
|
pricingPreview: PricingPreviewResource;
|
|
18
19
|
events: EventsResource;
|
|
19
20
|
webhooks: Webhooks;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreditBalance, Customer, CustomerCollection } from '../../entities';
|
|
1
|
+
import { CreditBalance, Customer, CustomerCollection, AuthToken } from '../../entities';
|
|
2
2
|
import { BaseResource } from '../../internal/base';
|
|
3
3
|
import { type CreateCustomerRequestBody, type GetCreditBalanceQueryParameters, type ListCustomerQueryParameters, type UpdateCustomerRequestBody } from './operations';
|
|
4
4
|
export * from './operations';
|
|
@@ -9,4 +9,5 @@ export declare class CustomersResource extends BaseResource {
|
|
|
9
9
|
update(customerId: string, updateCustomer: UpdateCustomerRequestBody): Promise<Customer>;
|
|
10
10
|
getCreditBalance(customerId: string, queryParams?: GetCreditBalanceQueryParameters): Promise<CreditBalance[]>;
|
|
11
11
|
archive(customerId: string): Promise<Customer>;
|
|
12
|
+
generateAuthToken(customerId: string): Promise<AuthToken>;
|
|
12
13
|
}
|
|
@@ -7,6 +7,7 @@ export * from './prices';
|
|
|
7
7
|
export * from './products';
|
|
8
8
|
export * from './subscriptions';
|
|
9
9
|
export * from './transactions';
|
|
10
|
+
export * from './payment-methods';
|
|
10
11
|
export * from './pricing-preview';
|
|
11
12
|
export * from './event-types';
|
|
12
13
|
export * from './notification-settings';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PaymentMethod, PaymentMethodCollection } from '../../entities';
|
|
2
|
+
import { BaseResource } from '../../internal/base';
|
|
3
|
+
import { type ListCustomerPaymentMethodQueryParameters } from './operations';
|
|
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';
|