@paddle/paddle-node-sdk 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/README.md +57 -18
- package/dist/entities/discount/discount.d.ts +1 -1
- package/dist/entities/discount/discount.js +2 -1
- package/dist/entities/event-types/event-type.d.ts +9 -0
- package/dist/entities/event-types/event-type.js +12 -0
- package/dist/entities/event-types/index.d.ts +1 -0
- package/dist/entities/event-types/index.js +17 -0
- package/dist/entities/events/event-collection.d.ts +6 -0
- package/dist/entities/events/event-collection.js +11 -0
- package/dist/entities/events/event.d.ts +9 -0
- package/dist/entities/events/event.js +14 -0
- package/dist/entities/events/index.d.ts +1 -0
- package/dist/entities/events/index.js +17 -0
- package/dist/entities/index.d.ts +5 -0
- package/dist/entities/index.js +5 -0
- package/dist/entities/notification-settings/index.d.ts +1 -0
- package/dist/entities/notification-settings/index.js +17 -0
- package/dist/entities/notification-settings/notification-settings.d.ts +15 -0
- package/dist/entities/notification-settings/notification-settings.js +18 -0
- package/dist/entities/notifications/index.d.ts +5 -0
- package/dist/entities/notifications/index.js +21 -0
- package/dist/entities/notifications/notification-collection.d.ts +6 -0
- package/dist/entities/notifications/notification-collection.js +11 -0
- package/dist/entities/notifications/notification-log-collection.d.ts +6 -0
- package/dist/entities/notifications/notification-log-collection.js +11 -0
- package/dist/entities/notifications/notification-log.d.ts +8 -0
- package/dist/entities/notifications/notification-log.js +14 -0
- package/dist/entities/notifications/notification.d.ts +18 -0
- package/dist/entities/notifications/notification.js +22 -0
- package/dist/entities/notifications/replay-notification.d.ts +5 -0
- package/dist/entities/notifications/replay-notification.js +9 -0
- package/dist/entities/payout/index.d.ts +1 -0
- package/dist/entities/payout/index.js +17 -0
- package/dist/entities/payout/payout.d.ts +9 -0
- package/dist/entities/payout/payout.js +12 -0
- package/dist/entities/subscription/index.d.ts +1 -0
- package/dist/entities/subscription/index.js +1 -0
- package/dist/entities/subscription/subscription-notification.d.ts +28 -0
- package/dist/entities/subscription/subscription-notification.js +35 -0
- package/dist/entities/subscription/subscription-scheduled-change.d.ts +2 -2
- package/dist/enums/index.d.ts +3 -0
- package/dist/enums/index.js +3 -0
- package/dist/enums/notification/index.d.ts +2 -0
- package/dist/enums/notification/index.js +18 -0
- package/dist/enums/notification/notification-status.d.ts +1 -0
- package/dist/enums/notification/notification-status.js +2 -0
- package/dist/enums/notification/origin.d.ts +1 -0
- package/dist/enums/notification/origin.js +2 -0
- package/dist/enums/notification-settings/index.d.ts +1 -0
- package/dist/enums/notification-settings/index.js +17 -0
- package/dist/enums/notification-settings/notification-settings-type.d.ts +1 -0
- package/dist/enums/notification-settings/notification-settings-type.js +2 -0
- package/dist/enums/payout/index.d.ts +1 -0
- package/dist/enums/payout/index.js +17 -0
- package/dist/enums/payout/payout-status.d.ts +1 -0
- package/dist/enums/payout/payout-status.js +2 -0
- package/dist/internal/api/client.d.ts +2 -0
- package/dist/internal/api/client.js +14 -0
- package/dist/notifications/events/address/address-created-event.d.ts +9 -0
- package/dist/notifications/events/address/address-created-event.js +14 -0
- package/dist/notifications/events/address/address-updated-event.d.ts +9 -0
- package/dist/notifications/events/address/address-updated-event.js +14 -0
- package/dist/notifications/events/address/index.d.ts +2 -0
- package/dist/notifications/events/address/index.js +18 -0
- package/dist/notifications/events/adjustment/adjustment-created-event.d.ts +9 -0
- package/dist/notifications/events/adjustment/adjustment-created-event.js +14 -0
- package/dist/notifications/events/adjustment/adjustment-updated-event.d.ts +9 -0
- package/dist/notifications/events/adjustment/adjustment-updated-event.js +14 -0
- package/dist/notifications/events/adjustment/index.d.ts +2 -0
- package/dist/notifications/events/adjustment/index.js +18 -0
- package/dist/notifications/events/business/business-created-event.d.ts +9 -0
- package/dist/notifications/events/business/business-created-event.js +14 -0
- package/dist/notifications/events/business/business-updated-event.d.ts +9 -0
- package/dist/notifications/events/business/business-updated-event.js +14 -0
- package/dist/notifications/events/business/index.d.ts +2 -0
- package/dist/notifications/events/business/index.js +18 -0
- package/dist/notifications/events/customer/customer-created-event.d.ts +9 -0
- package/dist/notifications/events/customer/customer-created-event.js +14 -0
- package/dist/notifications/events/customer/customer-updated-event.d.ts +9 -0
- package/dist/notifications/events/customer/customer-updated-event.js +14 -0
- package/dist/notifications/events/customer/index.d.ts +2 -0
- package/dist/notifications/events/customer/index.js +18 -0
- package/dist/notifications/events/discount/discount-created-event.d.ts +9 -0
- package/dist/notifications/events/discount/discount-created-event.js +14 -0
- package/dist/notifications/events/discount/discount-imported-event.d.ts +9 -0
- package/dist/notifications/events/discount/discount-imported-event.js +14 -0
- package/dist/notifications/events/discount/discount-updated-event.d.ts +9 -0
- package/dist/notifications/events/discount/discount-updated-event.js +14 -0
- package/dist/notifications/events/discount/index.d.ts +3 -0
- package/dist/notifications/events/discount/index.js +19 -0
- package/dist/notifications/events/index.d.ts +10 -0
- package/dist/notifications/events/index.js +26 -0
- package/dist/notifications/events/payout/index.d.ts +2 -0
- package/dist/notifications/events/payout/index.js +18 -0
- package/dist/notifications/events/payout/payout-created-event.d.ts +9 -0
- package/dist/notifications/events/payout/payout-created-event.js +14 -0
- package/dist/notifications/events/payout/payout-paid-event.d.ts +9 -0
- package/dist/notifications/events/payout/payout-paid-event.js +14 -0
- package/dist/notifications/events/price/index.d.ts +2 -0
- package/dist/notifications/events/price/index.js +18 -0
- package/dist/notifications/events/price/price-created-event.d.ts +9 -0
- package/dist/notifications/events/price/price-created-event.js +14 -0
- package/dist/notifications/events/price/price-updated-event.d.ts +9 -0
- package/dist/notifications/events/price/price-updated-event.js +14 -0
- package/dist/notifications/events/product/index.d.ts +2 -0
- package/dist/notifications/events/product/index.js +18 -0
- package/dist/notifications/events/product/product-created-event.d.ts +9 -0
- package/dist/notifications/events/product/product-created-event.js +14 -0
- package/dist/notifications/events/product/product-updated-event.d.ts +9 -0
- package/dist/notifications/events/product/product-updated-event.js +14 -0
- package/dist/notifications/events/subscription/index.d.ts +9 -0
- package/dist/notifications/events/subscription/index.js +25 -0
- package/dist/notifications/events/subscription/subscription-activated-event.d.ts +9 -0
- package/dist/notifications/events/subscription/subscription-activated-event.js +14 -0
- package/dist/notifications/events/subscription/subscription-canceled-event.d.ts +9 -0
- package/dist/notifications/events/subscription/subscription-canceled-event.js +14 -0
- package/dist/notifications/events/subscription/subscription-created-event.d.ts +9 -0
- package/dist/notifications/events/subscription/subscription-created-event.js +14 -0
- package/dist/notifications/events/subscription/subscription-imported-event.d.ts +9 -0
- package/dist/notifications/events/subscription/subscription-imported-event.js +14 -0
- package/dist/notifications/events/subscription/subscription-past-due-event.d.ts +9 -0
- package/dist/notifications/events/subscription/subscription-past-due-event.js +14 -0
- package/dist/notifications/events/subscription/subscription-paused-event.d.ts +9 -0
- package/dist/notifications/events/subscription/subscription-paused-event.js +14 -0
- package/dist/notifications/events/subscription/subscription-resumed-event.d.ts +9 -0
- package/dist/notifications/events/subscription/subscription-resumed-event.js +14 -0
- package/dist/notifications/events/subscription/subscription-trialing-event.d.ts +9 -0
- package/dist/notifications/events/subscription/subscription-trialing-event.js +14 -0
- package/dist/notifications/events/subscription/subscription-updated-event.d.ts +9 -0
- package/dist/notifications/events/subscription/subscription-updated-event.js +14 -0
- package/dist/notifications/events/transaction/index.d.ts +9 -0
- package/dist/notifications/events/transaction/index.js +25 -0
- package/dist/notifications/events/transaction/transaction-billed-event.d.ts +9 -0
- package/dist/notifications/events/transaction/transaction-billed-event.js +14 -0
- package/dist/notifications/events/transaction/transaction-canceled-event.d.ts +9 -0
- package/dist/notifications/events/transaction/transaction-canceled-event.js +14 -0
- package/dist/notifications/events/transaction/transaction-completed-event.d.ts +9 -0
- package/dist/notifications/events/transaction/transaction-completed-event.js +14 -0
- package/dist/notifications/events/transaction/transaction-created-event.d.ts +9 -0
- package/dist/notifications/events/transaction/transaction-created-event.js +14 -0
- package/dist/notifications/events/transaction/transaction-paid-event.d.ts +9 -0
- package/dist/notifications/events/transaction/transaction-paid-event.js +14 -0
- package/dist/notifications/events/transaction/transaction-past-due-event.d.ts +9 -0
- package/dist/notifications/events/transaction/transaction-past-due-event.js +14 -0
- package/dist/notifications/events/transaction/transaction-payment-failed-event.d.ts +9 -0
- package/dist/notifications/events/transaction/transaction-payment-failed-event.js +14 -0
- package/dist/notifications/events/transaction/transaction-ready-event.d.ts +9 -0
- package/dist/notifications/events/transaction/transaction-ready-event.js +14 -0
- package/dist/notifications/events/transaction/transaction-updated-event.d.ts +9 -0
- package/dist/notifications/events/transaction/transaction-updated-event.js +14 -0
- package/dist/notifications/helpers/index.d.ts +3 -0
- package/dist/notifications/helpers/index.js +19 -0
- package/dist/notifications/helpers/types.d.ts +40 -0
- package/dist/notifications/helpers/types.js +41 -0
- package/dist/notifications/{validator/notifications-validator.d.ts → helpers/webhooks-validator.d.ts} +1 -1
- package/dist/notifications/{validator/notifications-validator.js → helpers/webhooks-validator.js} +6 -6
- package/dist/notifications/helpers/webhooks.d.ts +7 -0
- package/dist/notifications/helpers/webhooks.js +100 -0
- package/dist/notifications/index.d.ts +2 -1
- package/dist/notifications/index.js +2 -1
- package/dist/paddle.d.ts +9 -2
- package/dist/paddle.js +8 -1
- package/dist/resources/event-types/index.d.ts +5 -0
- package/dist/resources/event-types/index.js +27 -0
- package/dist/resources/events/index.d.ts +7 -0
- package/dist/resources/events/index.js +30 -0
- package/dist/resources/events/operations/index.d.ts +1 -0
- package/dist/resources/events/operations/index.js +17 -0
- package/dist/resources/events/operations/list-events-query-parameters.d.ts +5 -0
- package/dist/resources/events/operations/list-events-query-parameters.js +2 -0
- package/dist/resources/index.d.ts +3 -0
- package/dist/resources/index.js +3 -0
- package/dist/resources/notification-settings/index.d.ts +11 -0
- package/dist/resources/notification-settings/index.js +84 -0
- package/dist/resources/notification-settings/operations/create-notification-settings-request-body.d.ts +10 -0
- package/dist/resources/notification-settings/operations/create-notification-settings-request-body.js +2 -0
- package/dist/resources/notification-settings/operations/index.d.ts +2 -0
- package/dist/resources/notification-settings/operations/index.js +18 -0
- package/dist/resources/notification-settings/operations/update-notification-settings-request-body.d.ts +9 -0
- package/dist/resources/notification-settings/operations/update-notification-settings-request-body.js +2 -0
- package/dist/resources/notifications/index.d.ts +10 -0
- package/dist/resources/notifications/index.js +69 -0
- package/dist/resources/notifications/operations/index.d.ts +2 -0
- package/dist/resources/notifications/operations/index.js +18 -0
- package/dist/resources/notifications/operations/list-notification-log-query-parameters.d.ts +4 -0
- package/dist/resources/notifications/operations/list-notification-log-query-parameters.js +2 -0
- package/dist/resources/notifications/operations/list-notification-query-parameters.d.ts +12 -0
- package/dist/resources/notifications/operations/list-notification-query-parameters.js +2 -0
- package/dist/types/event-types/event-type-response.d.ts +7 -0
- package/dist/types/event-types/event-type-response.js +2 -0
- package/dist/types/event-types/index.d.ts +1 -0
- package/dist/types/event-types/index.js +17 -0
- package/dist/types/events/events-response.d.ts +125 -0
- package/dist/types/events/events-response.js +2 -0
- package/dist/types/events/index.d.ts +1 -0
- package/dist/types/events/index.js +17 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.js +5 -0
- package/dist/types/notification-settings/index.d.ts +1 -0
- package/dist/types/notification-settings/index.js +17 -0
- package/dist/types/notification-settings/notification-settings-response.d.ts +13 -0
- package/dist/types/notification-settings/notification-settings-response.js +2 -0
- package/dist/types/notifications/index.d.ts +3 -0
- package/dist/types/notifications/index.js +19 -0
- package/dist/types/notifications/notification-log.d.ts +7 -0
- package/dist/types/notifications/notification-log.js +2 -0
- package/dist/types/notifications/notification.d.ts +17 -0
- package/dist/types/notifications/notification.js +2 -0
- package/dist/types/notifications/replay-notification.d.ts +3 -0
- package/dist/types/notifications/replay-notification.js +2 -0
- package/dist/types/payout/index.d.ts +1 -0
- package/dist/types/payout/index.js +17 -0
- package/dist/types/payout/payout-response.d.ts +7 -0
- package/dist/types/payout/payout-response.js +2 -0
- package/dist/types/subscription/index.d.ts +1 -0
- package/dist/types/subscription/index.js +1 -0
- package/dist/types/subscription/subscription-notification-response.d.ts +28 -0
- package/dist/types/subscription/subscription-notification-response.js +2 -0
- package/dist/types/subscription/subscription-scheduled-change-response.d.ts +2 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Event } from '../../../entities/events/event';
|
|
2
|
+
import { Transaction } from '../../../entities';
|
|
3
|
+
import { EventName } from '../../helpers';
|
|
4
|
+
import { type IEventsResponse, type ITransactionResponse } from '../../../types';
|
|
5
|
+
export declare class TransactionCompletedEvent extends Event {
|
|
6
|
+
readonly eventType = EventName.TransactionCompleted;
|
|
7
|
+
readonly data: Transaction;
|
|
8
|
+
constructor(response: IEventsResponse<ITransactionResponse>);
|
|
9
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TransactionCompletedEvent = void 0;
|
|
4
|
+
const event_1 = require("../../../entities/events/event");
|
|
5
|
+
const entities_1 = require("../../../entities");
|
|
6
|
+
const helpers_1 = require("../../helpers");
|
|
7
|
+
class TransactionCompletedEvent extends event_1.Event {
|
|
8
|
+
constructor(response) {
|
|
9
|
+
super(response);
|
|
10
|
+
this.eventType = helpers_1.EventName.TransactionCompleted;
|
|
11
|
+
this.data = new entities_1.Transaction(response.data);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.TransactionCompletedEvent = TransactionCompletedEvent;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Event } from '../../../entities/events/event';
|
|
2
|
+
import { Transaction } from '../../../entities';
|
|
3
|
+
import { EventName } from '../../helpers';
|
|
4
|
+
import { type IEventsResponse, type ITransactionResponse } from '../../../types';
|
|
5
|
+
export declare class TransactionCreatedEvent extends Event {
|
|
6
|
+
readonly eventType = EventName.TransactionCreated;
|
|
7
|
+
readonly data: Transaction;
|
|
8
|
+
constructor(response: IEventsResponse<ITransactionResponse>);
|
|
9
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TransactionCreatedEvent = void 0;
|
|
4
|
+
const event_1 = require("../../../entities/events/event");
|
|
5
|
+
const entities_1 = require("../../../entities");
|
|
6
|
+
const helpers_1 = require("../../helpers");
|
|
7
|
+
class TransactionCreatedEvent extends event_1.Event {
|
|
8
|
+
constructor(response) {
|
|
9
|
+
super(response);
|
|
10
|
+
this.eventType = helpers_1.EventName.TransactionCreated;
|
|
11
|
+
this.data = new entities_1.Transaction(response.data);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.TransactionCreatedEvent = TransactionCreatedEvent;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Event } from '../../../entities/events/event';
|
|
2
|
+
import { Transaction } from '../../../entities';
|
|
3
|
+
import { EventName } from '../../helpers';
|
|
4
|
+
import { type IEventsResponse, type ITransactionResponse } from '../../../types';
|
|
5
|
+
export declare class TransactionPaidEvent extends Event {
|
|
6
|
+
readonly eventType = EventName.TransactionPaid;
|
|
7
|
+
readonly data: Transaction;
|
|
8
|
+
constructor(response: IEventsResponse<ITransactionResponse>);
|
|
9
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TransactionPaidEvent = void 0;
|
|
4
|
+
const event_1 = require("../../../entities/events/event");
|
|
5
|
+
const entities_1 = require("../../../entities");
|
|
6
|
+
const helpers_1 = require("../../helpers");
|
|
7
|
+
class TransactionPaidEvent extends event_1.Event {
|
|
8
|
+
constructor(response) {
|
|
9
|
+
super(response);
|
|
10
|
+
this.eventType = helpers_1.EventName.TransactionPaid;
|
|
11
|
+
this.data = new entities_1.Transaction(response.data);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.TransactionPaidEvent = TransactionPaidEvent;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Event } from '../../../entities/events/event';
|
|
2
|
+
import { Transaction } from '../../../entities';
|
|
3
|
+
import { EventName } from '../../helpers';
|
|
4
|
+
import { type IEventsResponse, type ITransactionResponse } from '../../../types';
|
|
5
|
+
export declare class TransactionPastDueEvent extends Event {
|
|
6
|
+
readonly eventType = EventName.TransactionPastDue;
|
|
7
|
+
readonly data: Transaction;
|
|
8
|
+
constructor(response: IEventsResponse<ITransactionResponse>);
|
|
9
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TransactionPastDueEvent = void 0;
|
|
4
|
+
const event_1 = require("../../../entities/events/event");
|
|
5
|
+
const entities_1 = require("../../../entities");
|
|
6
|
+
const helpers_1 = require("../../helpers");
|
|
7
|
+
class TransactionPastDueEvent extends event_1.Event {
|
|
8
|
+
constructor(response) {
|
|
9
|
+
super(response);
|
|
10
|
+
this.eventType = helpers_1.EventName.TransactionPastDue;
|
|
11
|
+
this.data = new entities_1.Transaction(response.data);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.TransactionPastDueEvent = TransactionPastDueEvent;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Event } from '../../../entities/events/event';
|
|
2
|
+
import { Transaction } from '../../../entities';
|
|
3
|
+
import { EventName } from '../../helpers';
|
|
4
|
+
import { type IEventsResponse, type ITransactionResponse } from '../../../types';
|
|
5
|
+
export declare class TransactionPaymentFailedEvent extends Event {
|
|
6
|
+
readonly eventType = EventName.TransactionPaymentFailed;
|
|
7
|
+
readonly data: Transaction;
|
|
8
|
+
constructor(response: IEventsResponse<ITransactionResponse>);
|
|
9
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TransactionPaymentFailedEvent = void 0;
|
|
4
|
+
const event_1 = require("../../../entities/events/event");
|
|
5
|
+
const entities_1 = require("../../../entities");
|
|
6
|
+
const helpers_1 = require("../../helpers");
|
|
7
|
+
class TransactionPaymentFailedEvent extends event_1.Event {
|
|
8
|
+
constructor(response) {
|
|
9
|
+
super(response);
|
|
10
|
+
this.eventType = helpers_1.EventName.TransactionPaymentFailed;
|
|
11
|
+
this.data = new entities_1.Transaction(response.data);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.TransactionPaymentFailedEvent = TransactionPaymentFailedEvent;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Event } from '../../../entities/events/event';
|
|
2
|
+
import { Transaction } from '../../../entities';
|
|
3
|
+
import { EventName } from '../../helpers';
|
|
4
|
+
import { type IEventsResponse, type ITransactionResponse } from '../../../types';
|
|
5
|
+
export declare class TransactionReadyEvent extends Event {
|
|
6
|
+
readonly eventType = EventName.TransactionReady;
|
|
7
|
+
readonly data: Transaction;
|
|
8
|
+
constructor(response: IEventsResponse<ITransactionResponse>);
|
|
9
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TransactionReadyEvent = void 0;
|
|
4
|
+
const event_1 = require("../../../entities/events/event");
|
|
5
|
+
const entities_1 = require("../../../entities");
|
|
6
|
+
const helpers_1 = require("../../helpers");
|
|
7
|
+
class TransactionReadyEvent extends event_1.Event {
|
|
8
|
+
constructor(response) {
|
|
9
|
+
super(response);
|
|
10
|
+
this.eventType = helpers_1.EventName.TransactionReady;
|
|
11
|
+
this.data = new entities_1.Transaction(response.data);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.TransactionReadyEvent = TransactionReadyEvent;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Event } from '../../../entities/events/event';
|
|
2
|
+
import { Transaction } from '../../../entities';
|
|
3
|
+
import { EventName } from '../../helpers';
|
|
4
|
+
import { type IEventsResponse, type ITransactionResponse } from '../../../types';
|
|
5
|
+
export declare class TransactionUpdatedEvent extends Event {
|
|
6
|
+
readonly eventType = EventName.TransactionUpdated;
|
|
7
|
+
readonly data: Transaction;
|
|
8
|
+
constructor(response: IEventsResponse<ITransactionResponse>);
|
|
9
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TransactionUpdatedEvent = void 0;
|
|
4
|
+
const event_1 = require("../../../entities/events/event");
|
|
5
|
+
const entities_1 = require("../../../entities");
|
|
6
|
+
const helpers_1 = require("../../helpers");
|
|
7
|
+
class TransactionUpdatedEvent extends event_1.Event {
|
|
8
|
+
constructor(response) {
|
|
9
|
+
super(response);
|
|
10
|
+
this.eventType = helpers_1.EventName.TransactionUpdated;
|
|
11
|
+
this.data = new entities_1.Transaction(response.data);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.TransactionUpdatedEvent = TransactionUpdatedEvent;
|
|
@@ -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("./types"), exports);
|
|
18
|
+
__exportStar(require("./webhooks"), exports);
|
|
19
|
+
__exportStar(require("./webhooks-validator"), exports);
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type AddressCreatedEvent, type AddressUpdatedEvent, 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 } from '../events';
|
|
2
|
+
export type EventEntity = AddressCreatedEvent | AddressUpdatedEvent | AdjustmentUpdatedEvent | AdjustmentCreatedEvent | BusinessCreatedEvent | BusinessUpdatedEvent | CustomerCreatedEvent | CustomerUpdatedEvent | DiscountCreatedEvent | DiscountUpdatedEvent | DiscountImportedEvent | PayoutCreatedEvent | PayoutPaidEvent | PriceCreatedEvent | PriceUpdatedEvent | ProductCreatedEvent | ProductUpdatedEvent | SubscriptionActivatedEvent | SubscriptionCanceledEvent | SubscriptionCreatedEvent | SubscriptionImportedEvent | SubscriptionPastDueEvent | SubscriptionPausedEvent | SubscriptionResumedEvent | SubscriptionTrialingEvent | SubscriptionUpdatedEvent | TransactionBilledEvent | TransactionCanceledEvent | TransactionCompletedEvent | TransactionCreatedEvent | TransactionPaidEvent | TransactionPastDueEvent | TransactionPaymentFailedEvent | TransactionReadyEvent | TransactionUpdatedEvent;
|
|
3
|
+
export declare enum EventName {
|
|
4
|
+
AddressCreated = "address.created",
|
|
5
|
+
AddressUpdated = "address.updated",
|
|
6
|
+
AdjustmentCreated = "adjustment.created",
|
|
7
|
+
AdjustmentUpdated = "adjustment.updated",
|
|
8
|
+
BusinessCreated = "business.created",
|
|
9
|
+
BusinessUpdated = "business.updated",
|
|
10
|
+
CustomerCreated = "customer.created",
|
|
11
|
+
CustomerUpdated = "customer.updated",
|
|
12
|
+
DiscountCreated = "discount.created",
|
|
13
|
+
DiscountUpdated = "discount.updated",
|
|
14
|
+
DiscountImported = "discount.imported",
|
|
15
|
+
PayoutCreated = "payout.created",
|
|
16
|
+
PayoutPaid = "payout.paid",
|
|
17
|
+
PriceCreated = "price.created",
|
|
18
|
+
PriceUpdated = "price.updated",
|
|
19
|
+
ProductCreated = "product.created",
|
|
20
|
+
ProductUpdated = "product.updated",
|
|
21
|
+
SubscriptionActivated = "subscription.activated",
|
|
22
|
+
SubscriptionCanceled = "subscription.canceled",
|
|
23
|
+
SubscriptionImported = "subscription.imported",
|
|
24
|
+
SubscriptionCreated = "subscription.created",
|
|
25
|
+
SubscriptionPastDue = "subscription.past_due",
|
|
26
|
+
SubscriptionPaused = "subscription.paused",
|
|
27
|
+
SubscriptionResumed = "subscription.resumed",
|
|
28
|
+
SubscriptionTrialing = "subscription.trialing",
|
|
29
|
+
SubscriptionUpdated = "subscription.updated",
|
|
30
|
+
TransactionBilled = "transaction.billed",
|
|
31
|
+
TransactionCanceled = "transaction.canceled",
|
|
32
|
+
TransactionCompleted = "transaction.completed",
|
|
33
|
+
TransactionPaid = "transaction.paid",
|
|
34
|
+
TransactionCreated = "transaction.created",
|
|
35
|
+
TransactionPastDue = "transaction.past_due",
|
|
36
|
+
TransactionPaymentFailed = "transaction.payment_failed",
|
|
37
|
+
TransactionReady = "transaction.ready",
|
|
38
|
+
TransactionUpdated = "transaction.updated"
|
|
39
|
+
}
|
|
40
|
+
export type IEventName = 'address.created' | 'address.updated' | 'adjustment.created' | 'adjustment.updated' | 'business.created' | 'business.updated' | 'customer.created' | 'customer.updated' | 'discount.created' | 'discount.updated' | 'discount.imported' | 'payout.updated' | 'payout.paid' | 'price.updated' | 'price.created' | 'product.updated' | 'product.created' | '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';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EventName = void 0;
|
|
4
|
+
var EventName;
|
|
5
|
+
(function (EventName) {
|
|
6
|
+
EventName["AddressCreated"] = "address.created";
|
|
7
|
+
EventName["AddressUpdated"] = "address.updated";
|
|
8
|
+
EventName["AdjustmentCreated"] = "adjustment.created";
|
|
9
|
+
EventName["AdjustmentUpdated"] = "adjustment.updated";
|
|
10
|
+
EventName["BusinessCreated"] = "business.created";
|
|
11
|
+
EventName["BusinessUpdated"] = "business.updated";
|
|
12
|
+
EventName["CustomerCreated"] = "customer.created";
|
|
13
|
+
EventName["CustomerUpdated"] = "customer.updated";
|
|
14
|
+
EventName["DiscountCreated"] = "discount.created";
|
|
15
|
+
EventName["DiscountUpdated"] = "discount.updated";
|
|
16
|
+
EventName["DiscountImported"] = "discount.imported";
|
|
17
|
+
EventName["PayoutCreated"] = "payout.created";
|
|
18
|
+
EventName["PayoutPaid"] = "payout.paid";
|
|
19
|
+
EventName["PriceCreated"] = "price.created";
|
|
20
|
+
EventName["PriceUpdated"] = "price.updated";
|
|
21
|
+
EventName["ProductCreated"] = "product.created";
|
|
22
|
+
EventName["ProductUpdated"] = "product.updated";
|
|
23
|
+
EventName["SubscriptionActivated"] = "subscription.activated";
|
|
24
|
+
EventName["SubscriptionCanceled"] = "subscription.canceled";
|
|
25
|
+
EventName["SubscriptionImported"] = "subscription.imported";
|
|
26
|
+
EventName["SubscriptionCreated"] = "subscription.created";
|
|
27
|
+
EventName["SubscriptionPastDue"] = "subscription.past_due";
|
|
28
|
+
EventName["SubscriptionPaused"] = "subscription.paused";
|
|
29
|
+
EventName["SubscriptionResumed"] = "subscription.resumed";
|
|
30
|
+
EventName["SubscriptionTrialing"] = "subscription.trialing";
|
|
31
|
+
EventName["SubscriptionUpdated"] = "subscription.updated";
|
|
32
|
+
EventName["TransactionBilled"] = "transaction.billed";
|
|
33
|
+
EventName["TransactionCanceled"] = "transaction.canceled";
|
|
34
|
+
EventName["TransactionCompleted"] = "transaction.completed";
|
|
35
|
+
EventName["TransactionPaid"] = "transaction.paid";
|
|
36
|
+
EventName["TransactionCreated"] = "transaction.created";
|
|
37
|
+
EventName["TransactionPastDue"] = "transaction.past_due";
|
|
38
|
+
EventName["TransactionPaymentFailed"] = "transaction.payment_failed";
|
|
39
|
+
EventName["TransactionReady"] = "transaction.ready";
|
|
40
|
+
EventName["TransactionUpdated"] = "transaction.updated";
|
|
41
|
+
})(EventName || (exports.EventName = EventName = {}));
|
package/dist/notifications/{validator/notifications-validator.js → helpers/webhooks-validator.js}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.WebhooksValidator = void 0;
|
|
4
4
|
const crypto_1 = require("crypto");
|
|
5
|
-
class
|
|
5
|
+
class WebhooksValidator {
|
|
6
6
|
extractHeader(header) {
|
|
7
7
|
const parts = header.split(';');
|
|
8
8
|
let ts = '';
|
|
@@ -22,13 +22,13 @@ class NotificationsValidator {
|
|
|
22
22
|
return { ts: parseInt(ts), h1 };
|
|
23
23
|
}
|
|
24
24
|
else {
|
|
25
|
-
throw new Error('Invalid
|
|
25
|
+
throw new Error('[Paddle] Invalid webhook signature');
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
isValidSignature(requestBody, secretKey, signature) {
|
|
29
29
|
const headers = this.extractHeader(signature);
|
|
30
30
|
const payloadWithTime = `${headers.ts}:${requestBody}`;
|
|
31
|
-
if (new Date().getTime() > new Date((headers.ts +
|
|
31
|
+
if (new Date().getTime() > new Date((headers.ts + WebhooksValidator.MAX_VALID_TIME_DIFFERENCE) * 1000).getTime()) {
|
|
32
32
|
return false;
|
|
33
33
|
}
|
|
34
34
|
const hmac = (0, crypto_1.createHmac)('sha256', secretKey);
|
|
@@ -37,5 +37,5 @@ class NotificationsValidator {
|
|
|
37
37
|
return computedHash === headers.h1;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
exports.
|
|
41
|
-
|
|
40
|
+
exports.WebhooksValidator = WebhooksValidator;
|
|
41
|
+
WebhooksValidator.MAX_VALID_TIME_DIFFERENCE = 5;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type IEvents } from '../../types';
|
|
2
|
+
import { type EventEntity } from './types';
|
|
3
|
+
export declare class Webhooks {
|
|
4
|
+
unmarshal(requestBody: string, secretKey: string, signature: string): EventEntity | null;
|
|
5
|
+
isSignatureValid(requestBody: string, secretKey: string, signature: string): boolean;
|
|
6
|
+
static fromJson(data: IEvents): EventEntity | null;
|
|
7
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Webhooks = void 0;
|
|
4
|
+
const events_1 = require("../events");
|
|
5
|
+
const types_1 = require("./types");
|
|
6
|
+
const webhooks_validator_1 = require("./webhooks-validator");
|
|
7
|
+
const logger_1 = require("../../internal/base/logger");
|
|
8
|
+
class Webhooks {
|
|
9
|
+
unmarshal(requestBody, secretKey, signature) {
|
|
10
|
+
const isSignatureValid = new webhooks_validator_1.WebhooksValidator().isValidSignature(requestBody, secretKey, signature);
|
|
11
|
+
if (isSignatureValid) {
|
|
12
|
+
const parsedRequest = JSON.parse(requestBody);
|
|
13
|
+
return Webhooks.fromJson(parsedRequest);
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
throw new Error('[Paddle] Webhook signature verification failed');
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
isSignatureValid(requestBody, secretKey, signature) {
|
|
20
|
+
return new webhooks_validator_1.WebhooksValidator().isValidSignature(requestBody, secretKey, signature);
|
|
21
|
+
}
|
|
22
|
+
static fromJson(data) {
|
|
23
|
+
switch (data.event_type) {
|
|
24
|
+
case types_1.EventName.AddressCreated:
|
|
25
|
+
return new events_1.AddressCreatedEvent(data);
|
|
26
|
+
case types_1.EventName.AddressUpdated:
|
|
27
|
+
return new events_1.AddressUpdatedEvent(data);
|
|
28
|
+
case types_1.EventName.AdjustmentCreated:
|
|
29
|
+
return new events_1.AdjustmentCreatedEvent(data);
|
|
30
|
+
case types_1.EventName.AdjustmentUpdated:
|
|
31
|
+
return new events_1.AdjustmentUpdatedEvent(data);
|
|
32
|
+
case types_1.EventName.BusinessCreated:
|
|
33
|
+
return new events_1.BusinessCreatedEvent(data);
|
|
34
|
+
case types_1.EventName.BusinessUpdated:
|
|
35
|
+
return new events_1.BusinessUpdatedEvent(data);
|
|
36
|
+
case types_1.EventName.CustomerCreated:
|
|
37
|
+
return new events_1.CustomerCreatedEvent(data);
|
|
38
|
+
case types_1.EventName.CustomerUpdated:
|
|
39
|
+
return new events_1.CustomerUpdatedEvent(data);
|
|
40
|
+
case types_1.EventName.DiscountCreated:
|
|
41
|
+
return new events_1.DiscountCreatedEvent(data);
|
|
42
|
+
case types_1.EventName.DiscountImported:
|
|
43
|
+
return new events_1.DiscountImportedEvent(data);
|
|
44
|
+
case types_1.EventName.DiscountUpdated:
|
|
45
|
+
return new events_1.DiscountUpdatedEvent(data);
|
|
46
|
+
case types_1.EventName.PayoutCreated:
|
|
47
|
+
return new events_1.PayoutCreatedEvent(data);
|
|
48
|
+
case types_1.EventName.PayoutPaid:
|
|
49
|
+
return new events_1.PayoutPaidEvent(data);
|
|
50
|
+
case types_1.EventName.PriceCreated:
|
|
51
|
+
return new events_1.PriceCreatedEvent(data);
|
|
52
|
+
case types_1.EventName.PriceUpdated:
|
|
53
|
+
return new events_1.PriceUpdatedEvent(data);
|
|
54
|
+
case types_1.EventName.ProductCreated:
|
|
55
|
+
return new events_1.ProductCreatedEvent(data);
|
|
56
|
+
case types_1.EventName.ProductUpdated:
|
|
57
|
+
return new events_1.ProductUpdatedEvent(data);
|
|
58
|
+
case types_1.EventName.SubscriptionActivated:
|
|
59
|
+
return new events_1.SubscriptionActivatedEvent(data);
|
|
60
|
+
case types_1.EventName.SubscriptionCanceled:
|
|
61
|
+
return new events_1.SubscriptionCanceledEvent(data);
|
|
62
|
+
case types_1.EventName.SubscriptionCreated:
|
|
63
|
+
return new events_1.SubscriptionCreatedEvent(data);
|
|
64
|
+
case types_1.EventName.SubscriptionImported:
|
|
65
|
+
return new events_1.SubscriptionImportedEvent(data);
|
|
66
|
+
case types_1.EventName.SubscriptionPastDue:
|
|
67
|
+
return new events_1.SubscriptionPastDueEvent(data);
|
|
68
|
+
case types_1.EventName.SubscriptionPaused:
|
|
69
|
+
return new events_1.SubscriptionPausedEvent(data);
|
|
70
|
+
case types_1.EventName.SubscriptionResumed:
|
|
71
|
+
return new events_1.SubscriptionResumedEvent(data);
|
|
72
|
+
case types_1.EventName.SubscriptionTrialing:
|
|
73
|
+
return new events_1.SubscriptionTrialingEvent(data);
|
|
74
|
+
case types_1.EventName.SubscriptionUpdated:
|
|
75
|
+
return new events_1.SubscriptionUpdatedEvent(data);
|
|
76
|
+
case types_1.EventName.TransactionBilled:
|
|
77
|
+
return new events_1.TransactionBilledEvent(data);
|
|
78
|
+
case types_1.EventName.TransactionCanceled:
|
|
79
|
+
return new events_1.TransactionCanceledEvent(data);
|
|
80
|
+
case types_1.EventName.TransactionCompleted:
|
|
81
|
+
return new events_1.TransactionCompletedEvent(data);
|
|
82
|
+
case types_1.EventName.TransactionCreated:
|
|
83
|
+
return new events_1.TransactionCreatedEvent(data);
|
|
84
|
+
case types_1.EventName.TransactionPaid:
|
|
85
|
+
return new events_1.TransactionPaidEvent(data);
|
|
86
|
+
case types_1.EventName.TransactionPastDue:
|
|
87
|
+
return new events_1.TransactionPastDueEvent(data);
|
|
88
|
+
case types_1.EventName.TransactionPaymentFailed:
|
|
89
|
+
return new events_1.TransactionPaymentFailedEvent(data);
|
|
90
|
+
case types_1.EventName.TransactionReady:
|
|
91
|
+
return new events_1.TransactionReadyEvent(data);
|
|
92
|
+
case types_1.EventName.TransactionUpdated:
|
|
93
|
+
return new events_1.TransactionUpdatedEvent(data);
|
|
94
|
+
default:
|
|
95
|
+
logger_1.Logger.log('Unknown event_type');
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
exports.Webhooks = Webhooks;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './helpers';
|
|
2
|
+
export * from './events';
|
|
@@ -14,4 +14,5 @@ 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("./
|
|
17
|
+
__exportStar(require("./helpers"), exports);
|
|
18
|
+
__exportStar(require("./events"), exports);
|
package/dist/paddle.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { AddressesResource, AdjustmentsResource, BusinessesResource, CustomersResource, DiscountsResource, PricesResource, PricingPreviewResource, ProductsResource, SubscriptionsResource, TransactionsResource } from './resources';
|
|
1
|
+
import { AddressesResource, AdjustmentsResource, BusinessesResource, CustomersResource, DiscountsResource, EventTypesResource, NotificationSettingsResource, NotificationsResource, PricesResource, PricingPreviewResource, ProductsResource, SubscriptionsResource, TransactionsResource } from './resources';
|
|
2
2
|
import { type PaddleOptions } from './internal';
|
|
3
|
+
import { EventsResource } from './resources/events';
|
|
4
|
+
import { Webhooks } from './notifications';
|
|
3
5
|
export declare class Paddle {
|
|
4
6
|
private readonly client;
|
|
5
7
|
private readonly defaultPaddleOptions;
|
|
@@ -13,5 +15,10 @@ export declare class Paddle {
|
|
|
13
15
|
discounts: DiscountsResource;
|
|
14
16
|
subscriptions: SubscriptionsResource;
|
|
15
17
|
pricingPreview: PricingPreviewResource;
|
|
16
|
-
|
|
18
|
+
events: EventsResource;
|
|
19
|
+
webhooks: Webhooks;
|
|
20
|
+
eventTypes: EventTypesResource;
|
|
21
|
+
notificationSettings: NotificationSettingsResource;
|
|
22
|
+
notifications: NotificationsResource;
|
|
23
|
+
constructor(apiKey: string, options?: PaddleOptions);
|
|
17
24
|
}
|
package/dist/paddle.js
CHANGED
|
@@ -4,12 +4,14 @@ exports.Paddle = void 0;
|
|
|
4
4
|
const client_1 = require("./internal/api/client");
|
|
5
5
|
const resources_1 = require("./resources");
|
|
6
6
|
const internal_1 = require("./internal");
|
|
7
|
+
const events_1 = require("./resources/events");
|
|
8
|
+
const notifications_1 = require("./notifications");
|
|
7
9
|
class Paddle {
|
|
8
10
|
constructor(apiKey, options) {
|
|
9
11
|
this.defaultPaddleOptions = {
|
|
10
12
|
environment: internal_1.Environment.production,
|
|
11
13
|
};
|
|
12
|
-
this.client = new client_1.Client(apiKey, Object.assign(Object.assign({}, this.defaultPaddleOptions), options));
|
|
14
|
+
this.client = new client_1.Client(apiKey, options ? Object.assign(Object.assign({}, this.defaultPaddleOptions), options) : Object.assign({}, this.defaultPaddleOptions));
|
|
13
15
|
this.products = new resources_1.ProductsResource(this.client);
|
|
14
16
|
this.prices = new resources_1.PricesResource(this.client);
|
|
15
17
|
this.transactions = new resources_1.TransactionsResource(this.client);
|
|
@@ -20,6 +22,11 @@ class Paddle {
|
|
|
20
22
|
this.discounts = new resources_1.DiscountsResource(this.client);
|
|
21
23
|
this.subscriptions = new resources_1.SubscriptionsResource(this.client);
|
|
22
24
|
this.pricingPreview = new resources_1.PricingPreviewResource(this.client);
|
|
25
|
+
this.events = new events_1.EventsResource(this.client);
|
|
26
|
+
this.webhooks = new notifications_1.Webhooks();
|
|
27
|
+
this.eventTypes = new resources_1.EventTypesResource(this.client);
|
|
28
|
+
this.notificationSettings = new resources_1.NotificationSettingsResource(this.client);
|
|
29
|
+
this.notifications = new resources_1.NotificationsResource(this.client);
|
|
23
30
|
}
|
|
24
31
|
}
|
|
25
32
|
exports.Paddle = Paddle;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.EventTypesResource = void 0;
|
|
13
|
+
const base_1 = require("../../internal/base");
|
|
14
|
+
const entities_1 = require("../../entities");
|
|
15
|
+
const EventTypesPaths = {
|
|
16
|
+
list: '/event-types',
|
|
17
|
+
};
|
|
18
|
+
class EventTypesResource extends base_1.BaseResource {
|
|
19
|
+
list() {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
const response = yield this.client.get(EventTypesPaths.list);
|
|
22
|
+
const data = this.handleResponse(response);
|
|
23
|
+
return data.map((eventType) => new entities_1.EventType(eventType));
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.EventTypesResource = EventTypesResource;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BaseResource } from '../../internal/base';
|
|
2
|
+
import { type ListEventsQueryParameters } from './operations';
|
|
3
|
+
import { EventCollection } from '../../entities';
|
|
4
|
+
export * from './operations';
|
|
5
|
+
export declare class EventsResource extends BaseResource {
|
|
6
|
+
list(queryParams?: ListEventsQueryParameters): EventCollection;
|
|
7
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
exports.EventsResource = void 0;
|
|
18
|
+
const base_1 = require("../../internal/base");
|
|
19
|
+
const entities_1 = require("../../entities");
|
|
20
|
+
const EventPaths = {
|
|
21
|
+
list: '/events',
|
|
22
|
+
};
|
|
23
|
+
__exportStar(require("./operations"), exports);
|
|
24
|
+
class EventsResource extends base_1.BaseResource {
|
|
25
|
+
list(queryParams) {
|
|
26
|
+
const queryParameters = new base_1.QueryParameters(queryParams);
|
|
27
|
+
return new entities_1.EventCollection(this.client, EventPaths.list + queryParameters.toQueryString());
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.EventsResource = EventsResource;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './list-events-query-parameters';
|
|
@@ -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-events-query-parameters"), exports);
|