@paddle/paddle-node-sdk 0.2.5 → 0.2.6
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 +15 -0
- package/README.md +3 -3
- package/dist/entities/price/price-with-includes.d.ts +2 -1
- package/dist/entities/price/price-with-includes.js +2 -0
- package/dist/entities/price/price.d.ts +2 -1
- package/dist/entities/price/price.js +2 -0
- package/dist/entities/pricing-preview/pricing-preview.d.ts +2 -0
- package/dist/entities/pricing-preview/pricing-preview.js +2 -1
- package/dist/entities/product/product-with-includes.d.ts +2 -1
- package/dist/entities/product/product-with-includes.js +2 -0
- package/dist/entities/product/product.d.ts +2 -1
- package/dist/entities/product/product.js +2 -0
- package/dist/entities/transaction/transaction-preview.d.ts +2 -0
- package/dist/entities/transaction/transaction-preview.js +2 -0
- package/dist/enums/shared/available-payment-methods.d.ts +1 -0
- package/dist/enums/shared/available-payment-methods.js +2 -0
- package/dist/enums/shared/catalog-type.d.ts +1 -0
- package/dist/enums/shared/catalog-type.js +2 -0
- package/dist/enums/shared/index.d.ts +1 -0
- package/dist/enums/shared/index.js +1 -0
- package/dist/enums/subscription/index.d.ts +1 -0
- package/dist/enums/subscription/index.js +1 -0
- package/dist/enums/subscription/subscription-on-payment-failure.d.ts +1 -0
- package/dist/enums/subscription/subscription-on-payment-failure.js +2 -0
- package/dist/internal/api/client.js +2 -2
- package/dist/notifications/events/address/address-imported-event.d.ts +9 -0
- package/dist/notifications/events/address/address-imported-event.js +14 -0
- package/dist/notifications/events/address/index.d.ts +1 -0
- package/dist/notifications/events/address/index.js +1 -0
- package/dist/notifications/events/business/business-imported-event.d.ts +9 -0
- package/dist/notifications/events/business/business-imported-event.js +14 -0
- package/dist/notifications/events/business/index.d.ts +1 -0
- package/dist/notifications/events/business/index.js +1 -0
- package/dist/notifications/events/customer/customer-imported-event.d.ts +9 -0
- package/dist/notifications/events/customer/customer-imported-event.js +14 -0
- package/dist/notifications/events/customer/index.d.ts +1 -0
- package/dist/notifications/events/customer/index.js +1 -0
- package/dist/notifications/events/price/index.d.ts +1 -0
- package/dist/notifications/events/price/index.js +1 -0
- package/dist/notifications/events/price/price-imported-event.d.ts +9 -0
- package/dist/notifications/events/price/price-imported-event.js +14 -0
- package/dist/notifications/events/product/index.d.ts +1 -0
- package/dist/notifications/events/product/index.js +1 -0
- package/dist/notifications/events/product/product-imported-event.d.ts +9 -0
- package/dist/notifications/events/product/product-imported-event.js +14 -0
- package/dist/notifications/helpers/types.d.ts +8 -3
- package/dist/notifications/helpers/types.js +5 -0
- package/dist/notifications/helpers/webhooks.js +11 -1
- package/dist/resources/prices/operations/create-price-request-body.d.ts +2 -1
- package/dist/resources/prices/operations/list-price-query-parameters.d.ts +2 -1
- package/dist/resources/prices/operations/update-price-request-body.d.ts +2 -1
- package/dist/resources/products/operations/create-product-request-body.d.ts +2 -1
- package/dist/resources/products/operations/list-product-query-parameters.d.ts +2 -1
- package/dist/resources/products/operations/update-product-request-body.d.ts +2 -1
- package/dist/resources/subscriptions/operations/create-subscription-charge-request-object.d.ts +16 -2
- package/dist/resources/subscriptions/operations/update-subscription-request-body.d.ts +2 -1
- package/dist/resources/transactions/operations/create-transaction-request-body.d.ts +2 -2
- package/dist/resources/transactions/operations/update-transaction-request-body.d.ts +2 -2
- package/dist/types/events/events-response.d.ts +16 -1
- package/dist/types/price/index.d.ts +2 -0
- package/dist/types/price/index.js +2 -0
- package/dist/types/price/non-catalog-price-request.d.ts +24 -0
- package/dist/types/price/non-catalog-price-request.js +2 -0
- package/dist/types/price/price-response.d.ts +2 -1
- package/dist/types/price/subscription-non-catalog-price-request.d.ts +22 -0
- package/dist/types/price/subscription-non-catalog-price-request.js +2 -0
- package/dist/types/pricing-preview/pricing-preview-response.d.ts +2 -0
- package/dist/types/product/product-response.d.ts +2 -1
- package/dist/types/shared/shared-price-response.d.ts +2 -1
- package/dist/types/shared/shared-product-response.d.ts +2 -1
- package/dist/types/transaction/transaction-item.d.ts +9 -1
- package/dist/types/transaction/transaction-preview-item.d.ts +12 -2
- package/dist/types/transaction/transaction-preview-response.d.ts +2 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,21 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
8
8
|
|
|
9
9
|
Check our main [developer changelog](https://developer.paddle.com/?utm_source=dx&utm_medium=paddle-node-sdk) for information about changes to the Paddle Billing platform, the Paddle API, and other developer tools.
|
|
10
10
|
|
|
11
|
+
## 0.2.6 - 2023-12-22
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- Added support for `address.imported`, `business.imported`, `customer.imported`, `price.imported` and `product.imported` notifications.
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- Added support to get available payment methods when previewing prices or transactions, see [related changelog](https://developer.paddle.com/changelog/2023/available-payment-methods?utm_source=dx&utm_medium=paddle-node-sdk).
|
|
20
|
+
- Added support to bill a one time non-catalog products and prices to subscription, see [related changelog](https://developer.paddle.com/changelog/2023/bill-custom-items-one-time-subscription-charge?utm_source=dx&utm_medium=paddle-node-sdk).
|
|
21
|
+
- Added support for non-catalog products and prices to transaction, see [related changelog](https://developer.paddle.com/changelog/2023/add-custom-items-transaction?utm_source=dx&utm_medium=paddle-node-sdk).
|
|
22
|
+
- Added `subscription.onPaymentFailure` to update subscriptions and preview update subscription operations, see [related changelog](https://developer.paddle.com/changelog/2023/payment-failure-behavior-update-subscription?utm_source=dx&utm_medium=paddle-node-sdk).
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
11
26
|
## 0.2.5 - 2023-12-15
|
|
12
27
|
|
|
13
28
|
### Added
|
package/README.md
CHANGED
|
@@ -235,13 +235,13 @@ app.post('/webhooks', express.raw({ type: 'application/json' }), (req: Request,
|
|
|
235
235
|
// req.body should be of type `buffer`, convert to string before passing it to `unmarshal`.
|
|
236
236
|
// If express returned a JSON, remove any other middleware that might have processed raw request to object
|
|
237
237
|
const rawRequestBody = req.body.toString();
|
|
238
|
-
// Replace
|
|
239
|
-
const
|
|
238
|
+
// Replace `WEBHOOK_SECRET_KEY` with the secret key in notifications from vendor dashboard
|
|
239
|
+
const secretKey = process.env['WEBHOOK_SECRET_KEY'] || '';
|
|
240
240
|
|
|
241
241
|
try {
|
|
242
242
|
if (signature && rawRequestBody) {
|
|
243
243
|
// The `unmarshal` function will validate the integrity of the webhook and return an entity
|
|
244
|
-
const eventData = paddle.webhooks.unmarshal(rawRequestBody,
|
|
244
|
+
const eventData = paddle.webhooks.unmarshal(rawRequestBody, secretKey, signature);
|
|
245
245
|
switch (eventData.eventType) {
|
|
246
246
|
case EventName.ProductUpdated:
|
|
247
247
|
console.log(`Product ${eventData.data.id} was updated`);
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { type IPriceResponse } from '../../types';
|
|
2
2
|
import { type CustomData, ImportMeta, Money, PriceQuantity, Product, TimePeriod, UnitPriceOverride } from '../index';
|
|
3
|
-
import { type Status, type TaxMode } from '../../enums';
|
|
3
|
+
import { type CatalogType, type Status, type TaxMode } from '../../enums';
|
|
4
4
|
export declare class PriceWithIncludes {
|
|
5
5
|
readonly id: string;
|
|
6
6
|
readonly productId: string;
|
|
7
7
|
readonly description: string;
|
|
8
8
|
readonly name: string | null;
|
|
9
|
+
readonly type: CatalogType | null;
|
|
9
10
|
readonly billingCycle: TimePeriod | null;
|
|
10
11
|
readonly trialPeriod: TimePeriod | null;
|
|
11
12
|
readonly taxMode: TaxMode;
|
|
@@ -4,9 +4,11 @@ exports.PriceWithIncludes = void 0;
|
|
|
4
4
|
const index_1 = require("../index");
|
|
5
5
|
class PriceWithIncludes {
|
|
6
6
|
constructor(price) {
|
|
7
|
+
var _a;
|
|
7
8
|
this.id = price.id;
|
|
8
9
|
this.productId = price.product_id;
|
|
9
10
|
this.description = price.description;
|
|
11
|
+
this.type = (_a = price.type) !== null && _a !== void 0 ? _a : null;
|
|
10
12
|
this.name = price.name ? price.name : null;
|
|
11
13
|
this.billingCycle = price.billing_cycle ? new index_1.TimePeriod(price.billing_cycle) : null;
|
|
12
14
|
this.trialPeriod = price.trial_period ? new index_1.TimePeriod(price.trial_period) : null;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { type ICustomData, type ISharedPriceResponse } from '../../types';
|
|
2
2
|
import { TimePeriod, Money, UnitPriceOverride, PriceQuantity, ImportMeta } from '../index';
|
|
3
|
-
import { type TaxMode, type Status } from '../../enums';
|
|
3
|
+
import { type TaxMode, type Status, type CatalogType } from '../../enums';
|
|
4
4
|
export declare class Price {
|
|
5
5
|
readonly id: string;
|
|
6
6
|
readonly productId: string;
|
|
7
7
|
readonly description: string;
|
|
8
8
|
readonly name: string | null;
|
|
9
|
+
readonly type: CatalogType | null;
|
|
9
10
|
readonly billingCycle: TimePeriod | null;
|
|
10
11
|
readonly trialPeriod: TimePeriod | null;
|
|
11
12
|
readonly taxMode: TaxMode;
|
|
@@ -4,9 +4,11 @@ exports.Price = void 0;
|
|
|
4
4
|
const index_1 = require("../index");
|
|
5
5
|
class Price {
|
|
6
6
|
constructor(price) {
|
|
7
|
+
var _a;
|
|
7
8
|
this.id = price.id;
|
|
8
9
|
this.productId = price.product_id;
|
|
9
10
|
this.description = price.description;
|
|
11
|
+
this.type = (_a = price.type) !== null && _a !== void 0 ? _a : null;
|
|
10
12
|
this.name = price.name ? price.name : null;
|
|
11
13
|
this.billingCycle = price.billing_cycle ? new index_1.TimePeriod(price.billing_cycle) : null;
|
|
12
14
|
this.trialPeriod = price.trial_period ? new index_1.TimePeriod(price.trial_period) : null;
|
|
@@ -2,6 +2,7 @@ import { type CurrencyCode } from '../../enums';
|
|
|
2
2
|
import { type IPricingPreviewResponse } from '../../types';
|
|
3
3
|
import { AddressPreview } from '../transaction';
|
|
4
4
|
import { PricingPreviewDetails } from './pricing-preview-details';
|
|
5
|
+
import { type AvailablePaymentMethod } from '../../enums/shared/available-payment-methods';
|
|
5
6
|
export declare class PricingPreview {
|
|
6
7
|
readonly customerId: string | null;
|
|
7
8
|
readonly addressId: string | null;
|
|
@@ -11,5 +12,6 @@ export declare class PricingPreview {
|
|
|
11
12
|
readonly address: AddressPreview | null;
|
|
12
13
|
readonly customerIpAddress: string | null;
|
|
13
14
|
readonly details: PricingPreviewDetails | null;
|
|
15
|
+
readonly availablePaymentMethods: AvailablePaymentMethod | null;
|
|
14
16
|
constructor(pricePreview: IPricingPreviewResponse);
|
|
15
17
|
}
|
|
@@ -5,7 +5,7 @@ const transaction_1 = require("../transaction");
|
|
|
5
5
|
const pricing_preview_details_1 = require("./pricing-preview-details");
|
|
6
6
|
class PricingPreview {
|
|
7
7
|
constructor(pricePreview) {
|
|
8
|
-
var _a, _b, _c, _d, _e, _f;
|
|
8
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
9
9
|
this.customerId = (_a = pricePreview.customer_id) !== null && _a !== void 0 ? _a : null;
|
|
10
10
|
this.addressId = (_b = pricePreview.address_id) !== null && _b !== void 0 ? _b : null;
|
|
11
11
|
this.businessId = (_c = pricePreview.business_id) !== null && _c !== void 0 ? _c : null;
|
|
@@ -14,6 +14,7 @@ class PricingPreview {
|
|
|
14
14
|
this.address = pricePreview.address ? new transaction_1.AddressPreview(pricePreview.address) : null;
|
|
15
15
|
this.customerIpAddress = (_f = pricePreview.customer_ip_address) !== null && _f !== void 0 ? _f : null;
|
|
16
16
|
this.details = pricePreview.details ? new pricing_preview_details_1.PricingPreviewDetails(pricePreview.details) : null;
|
|
17
|
+
this.availablePaymentMethods = (_g = pricePreview.available_payment_method) !== null && _g !== void 0 ? _g : null;
|
|
17
18
|
}
|
|
18
19
|
}
|
|
19
20
|
exports.PricingPreview = PricingPreview;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { type IProductResponse } from '../../types';
|
|
2
2
|
import { type CustomData, ImportMeta, Price } from '../index';
|
|
3
|
-
import { type Status, type TaxCategory } from '../../enums';
|
|
3
|
+
import { type CatalogType, type Status, type TaxCategory } from '../../enums';
|
|
4
4
|
export declare class ProductWithIncludes {
|
|
5
5
|
readonly id: string;
|
|
6
6
|
readonly name: string;
|
|
7
|
+
readonly type: CatalogType | null;
|
|
7
8
|
readonly description: string | null;
|
|
8
9
|
readonly taxCategory: TaxCategory;
|
|
9
10
|
readonly imageUrl: string | null;
|
|
@@ -4,8 +4,10 @@ exports.ProductWithIncludes = void 0;
|
|
|
4
4
|
const index_1 = require("../index");
|
|
5
5
|
class ProductWithIncludes {
|
|
6
6
|
constructor(product) {
|
|
7
|
+
var _a;
|
|
7
8
|
this.id = product.id;
|
|
8
9
|
this.name = product.name;
|
|
10
|
+
this.type = (_a = product.type) !== null && _a !== void 0 ? _a : null;
|
|
9
11
|
this.description = product.description ? product.description : null;
|
|
10
12
|
this.taxCategory = product.tax_category;
|
|
11
13
|
this.imageUrl = product.image_url ? product.image_url : null;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { type ISharedProductResponse } from '../../types';
|
|
2
2
|
import { type CustomData, ImportMeta } from '../index';
|
|
3
|
-
import { type TaxCategory, type Status } from '../../enums';
|
|
3
|
+
import { type TaxCategory, type Status, type CatalogType } from '../../enums';
|
|
4
4
|
export declare class Product {
|
|
5
5
|
readonly id: string;
|
|
6
6
|
readonly name: string;
|
|
7
|
+
readonly type: CatalogType | null;
|
|
7
8
|
readonly description: string | null;
|
|
8
9
|
readonly taxCategory: TaxCategory;
|
|
9
10
|
readonly imageUrl: string | null;
|
|
@@ -4,8 +4,10 @@ exports.Product = void 0;
|
|
|
4
4
|
const index_1 = require("../index");
|
|
5
5
|
class Product {
|
|
6
6
|
constructor(product) {
|
|
7
|
+
var _a;
|
|
7
8
|
this.id = product.id;
|
|
8
9
|
this.name = product.name;
|
|
10
|
+
this.type = (_a = product.type) !== null && _a !== void 0 ? _a : null;
|
|
9
11
|
this.description = product.description ? product.description : null;
|
|
10
12
|
this.taxCategory = product.tax_category;
|
|
11
13
|
this.imageUrl = product.image_url ? product.image_url : null;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type ITransactionPreviewResponse } from '../../types';
|
|
2
2
|
import { AddressPreview, TransactionDetailsPreview, TransactionItemPreview } from '../index';
|
|
3
3
|
import { type CurrencyCode } from '../../enums';
|
|
4
|
+
import { type AvailablePaymentMethod } from '../../enums/shared/available-payment-methods';
|
|
4
5
|
export declare class TransactionPreview {
|
|
5
6
|
readonly customerId: string | null;
|
|
6
7
|
readonly addressId: string | null;
|
|
@@ -12,5 +13,6 @@ export declare class TransactionPreview {
|
|
|
12
13
|
readonly ignoreTrials: boolean | null;
|
|
13
14
|
readonly items: TransactionItemPreview[];
|
|
14
15
|
readonly details: TransactionDetailsPreview;
|
|
16
|
+
readonly availablePaymentMethods: AvailablePaymentMethod | null;
|
|
15
17
|
constructor(transactionPreview: ITransactionPreviewResponse);
|
|
16
18
|
}
|
|
@@ -4,6 +4,7 @@ exports.TransactionPreview = void 0;
|
|
|
4
4
|
const index_1 = require("../index");
|
|
5
5
|
class TransactionPreview {
|
|
6
6
|
constructor(transactionPreview) {
|
|
7
|
+
var _a;
|
|
7
8
|
this.customerId = transactionPreview.customer_id ? transactionPreview.customer_id : null;
|
|
8
9
|
this.addressId = transactionPreview.address_id ? transactionPreview.address_id : null;
|
|
9
10
|
this.businessId = transactionPreview.business_id ? transactionPreview.business_id : null;
|
|
@@ -14,6 +15,7 @@ class TransactionPreview {
|
|
|
14
15
|
this.ignoreTrials = transactionPreview.ignore_trials ? transactionPreview.ignore_trials : null;
|
|
15
16
|
this.items = transactionPreview.items.map((item) => new index_1.TransactionItemPreview(item));
|
|
16
17
|
this.details = new index_1.TransactionDetailsPreview(transactionPreview.details);
|
|
18
|
+
this.availablePaymentMethods = (_a = transactionPreview.available_payment_method) !== null && _a !== void 0 ? _a : null;
|
|
17
19
|
}
|
|
18
20
|
}
|
|
19
21
|
exports.TransactionPreview = TransactionPreview;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type AvailablePaymentMethod = 'alipay' | 'apple_pay' | 'bancontact' | 'card' | 'google_pay' | 'ideal' | 'paypal';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type CatalogType = 'standard' | 'custom';
|
|
@@ -27,3 +27,4 @@ __exportStar(require("./payout-currency-code"), exports);
|
|
|
27
27
|
__exportStar(require("./payment-attempt-status"), exports);
|
|
28
28
|
__exportStar(require("./error-code"), exports);
|
|
29
29
|
__exportStar(require("./payment-type"), exports);
|
|
30
|
+
__exportStar(require("./catalog-type"), exports);
|
|
@@ -19,3 +19,4 @@ __exportStar(require("./proration-billing-mode"), exports);
|
|
|
19
19
|
__exportStar(require("./scheduled-change-action"), exports);
|
|
20
20
|
__exportStar(require("./subscription-status"), exports);
|
|
21
21
|
__exportStar(require("./subscription-item-status"), exports);
|
|
22
|
+
__exportStar(require("./subscription-on-payment-failure"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type SubscriptionOnPaymentFailure = 'prevent_change' | 'apply_change';
|
|
@@ -28,7 +28,7 @@ class Client {
|
|
|
28
28
|
}
|
|
29
29
|
getBaseUrl(environment) {
|
|
30
30
|
const urlBasedOnEnv = constants_1.API_ENVIRONMENT_TO_BASE_URL_MAP[environment !== null && environment !== void 0 ? environment : environment_1.Environment.production];
|
|
31
|
-
return urlBasedOnEnv ||
|
|
31
|
+
return urlBasedOnEnv || environment;
|
|
32
32
|
}
|
|
33
33
|
getHeaders() {
|
|
34
34
|
const uuid = (0, crypto_1.randomUUID)();
|
|
@@ -45,7 +45,7 @@ class Client {
|
|
|
45
45
|
if (!finalUrl.includes('?') && queryParams) {
|
|
46
46
|
finalUrl += queryParams.toQueryString();
|
|
47
47
|
}
|
|
48
|
-
const logUrl =
|
|
48
|
+
const logUrl = finalUrl.split('?')[0];
|
|
49
49
|
const headers = this.getHeaders();
|
|
50
50
|
logger_1.Logger.logRequest('GET', logUrl, headers);
|
|
51
51
|
const rawResponse = yield (0, node_fetch_1.default)(finalUrl, {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Event } from '../../../entities/events/event';
|
|
2
|
+
import { Address } from '../../../entities';
|
|
3
|
+
import { type IAddressResponse, type IEventsResponse } from '../../../types';
|
|
4
|
+
import { EventName } from '../../helpers';
|
|
5
|
+
export declare class AddressImportedEvent extends Event {
|
|
6
|
+
readonly eventType = EventName.AddressImported;
|
|
7
|
+
readonly data: Address;
|
|
8
|
+
constructor(response: IEventsResponse<IAddressResponse>);
|
|
9
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AddressImportedEvent = void 0;
|
|
4
|
+
const event_1 = require("../../../entities/events/event");
|
|
5
|
+
const entities_1 = require("../../../entities");
|
|
6
|
+
const helpers_1 = require("../../helpers");
|
|
7
|
+
class AddressImportedEvent extends event_1.Event {
|
|
8
|
+
constructor(response) {
|
|
9
|
+
super(response);
|
|
10
|
+
this.eventType = helpers_1.EventName.AddressImported;
|
|
11
|
+
this.data = new entities_1.Address(response.data);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.AddressImportedEvent = AddressImportedEvent;
|
|
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./address-created-event"), exports);
|
|
18
18
|
__exportStar(require("./address-updated-event"), exports);
|
|
19
|
+
__exportStar(require("./address-imported-event"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Event } from '../../../entities/events/event';
|
|
2
|
+
import { Business } from '../../../entities';
|
|
3
|
+
import { type IBusinessResponse, type IEventsResponse } from '../../../types';
|
|
4
|
+
import { EventName } from '../../helpers';
|
|
5
|
+
export declare class BusinessImportedEvent extends Event {
|
|
6
|
+
readonly eventType = EventName.BusinessImported;
|
|
7
|
+
readonly data: Business;
|
|
8
|
+
constructor(response: IEventsResponse<IBusinessResponse>);
|
|
9
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BusinessImportedEvent = void 0;
|
|
4
|
+
const event_1 = require("../../../entities/events/event");
|
|
5
|
+
const entities_1 = require("../../../entities");
|
|
6
|
+
const helpers_1 = require("../../helpers");
|
|
7
|
+
class BusinessImportedEvent extends event_1.Event {
|
|
8
|
+
constructor(response) {
|
|
9
|
+
super(response);
|
|
10
|
+
this.eventType = helpers_1.EventName.BusinessImported;
|
|
11
|
+
this.data = new entities_1.Business(response.data);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.BusinessImportedEvent = BusinessImportedEvent;
|
|
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./business-created-event"), exports);
|
|
18
18
|
__exportStar(require("./business-updated-event"), exports);
|
|
19
|
+
__exportStar(require("./business-imported-event"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Event } from '../../../entities/events/event';
|
|
2
|
+
import { Customer } from '../../../entities';
|
|
3
|
+
import { type ICustomerResponse, type IEventsResponse } from '../../../types';
|
|
4
|
+
import { EventName } from '../../helpers';
|
|
5
|
+
export declare class CustomerImportedEvent extends Event {
|
|
6
|
+
readonly eventType = EventName.CustomerImported;
|
|
7
|
+
readonly data: Customer;
|
|
8
|
+
constructor(response: IEventsResponse<ICustomerResponse>);
|
|
9
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CustomerImportedEvent = void 0;
|
|
4
|
+
const event_1 = require("../../../entities/events/event");
|
|
5
|
+
const entities_1 = require("../../../entities");
|
|
6
|
+
const helpers_1 = require("../../helpers");
|
|
7
|
+
class CustomerImportedEvent extends event_1.Event {
|
|
8
|
+
constructor(response) {
|
|
9
|
+
super(response);
|
|
10
|
+
this.eventType = helpers_1.EventName.CustomerImported;
|
|
11
|
+
this.data = new entities_1.Customer(response.data);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.CustomerImportedEvent = CustomerImportedEvent;
|
|
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./customer-created-event"), exports);
|
|
18
18
|
__exportStar(require("./customer-updated-event"), exports);
|
|
19
|
+
__exportStar(require("./customer-imported-event"), exports);
|
|
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./price-created-event"), exports);
|
|
18
18
|
__exportStar(require("./price-updated-event"), exports);
|
|
19
|
+
__exportStar(require("./price-imported-event"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Event } from '../../../entities/events/event';
|
|
2
|
+
import { Price } from '../../../entities';
|
|
3
|
+
import { EventName } from '../../helpers';
|
|
4
|
+
import { type IEventsResponse, type IPriceResponse } from '../../../types';
|
|
5
|
+
export declare class PriceImportedEvent extends Event {
|
|
6
|
+
readonly eventType = EventName.PriceImported;
|
|
7
|
+
readonly data: Price;
|
|
8
|
+
constructor(response: IEventsResponse<IPriceResponse>);
|
|
9
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PriceImportedEvent = void 0;
|
|
4
|
+
const event_1 = require("../../../entities/events/event");
|
|
5
|
+
const entities_1 = require("../../../entities");
|
|
6
|
+
const helpers_1 = require("../../helpers");
|
|
7
|
+
class PriceImportedEvent extends event_1.Event {
|
|
8
|
+
constructor(response) {
|
|
9
|
+
super(response);
|
|
10
|
+
this.eventType = helpers_1.EventName.PriceImported;
|
|
11
|
+
this.data = new entities_1.Price(response.data);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.PriceImportedEvent = PriceImportedEvent;
|
|
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./product-created-event"), exports);
|
|
18
18
|
__exportStar(require("./product-updated-event"), exports);
|
|
19
|
+
__exportStar(require("./product-imported-event"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Event } from '../../../entities/events/event';
|
|
2
|
+
import { Product } from '../../../entities';
|
|
3
|
+
import { EventName } from '../../helpers';
|
|
4
|
+
import { type IEventsResponse, type IProductResponse } from '../../../types';
|
|
5
|
+
export declare class ProductImportedEvent extends Event {
|
|
6
|
+
readonly eventType = EventName.ProductImported;
|
|
7
|
+
readonly data: Product;
|
|
8
|
+
constructor(response: IEventsResponse<IProductResponse>);
|
|
9
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProductImportedEvent = void 0;
|
|
4
|
+
const event_1 = require("../../../entities/events/event");
|
|
5
|
+
const entities_1 = require("../../../entities");
|
|
6
|
+
const helpers_1 = require("../../helpers");
|
|
7
|
+
class ProductImportedEvent extends event_1.Event {
|
|
8
|
+
constructor(response) {
|
|
9
|
+
super(response);
|
|
10
|
+
this.eventType = helpers_1.EventName.ProductImported;
|
|
11
|
+
this.data = new entities_1.Product(response.data);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.ProductImportedEvent = ProductImportedEvent;
|
|
@@ -1,14 +1,17 @@
|
|
|
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, type ReportUpdatedEvent, type ReportCreatedEvent } 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 | 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 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;
|
|
3
3
|
export declare enum EventName {
|
|
4
4
|
AddressCreated = "address.created",
|
|
5
5
|
AddressUpdated = "address.updated",
|
|
6
|
+
AddressImported = "address.imported",
|
|
6
7
|
AdjustmentCreated = "adjustment.created",
|
|
7
8
|
AdjustmentUpdated = "adjustment.updated",
|
|
8
9
|
BusinessCreated = "business.created",
|
|
10
|
+
BusinessImported = "business.imported",
|
|
9
11
|
BusinessUpdated = "business.updated",
|
|
10
12
|
CustomerCreated = "customer.created",
|
|
11
13
|
CustomerUpdated = "customer.updated",
|
|
14
|
+
CustomerImported = "customer.imported",
|
|
12
15
|
DiscountCreated = "discount.created",
|
|
13
16
|
DiscountUpdated = "discount.updated",
|
|
14
17
|
DiscountImported = "discount.imported",
|
|
@@ -16,8 +19,10 @@ export declare enum EventName {
|
|
|
16
19
|
PayoutPaid = "payout.paid",
|
|
17
20
|
PriceCreated = "price.created",
|
|
18
21
|
PriceUpdated = "price.updated",
|
|
22
|
+
PriceImported = "price.imported",
|
|
19
23
|
ProductCreated = "product.created",
|
|
20
24
|
ProductUpdated = "product.updated",
|
|
25
|
+
ProductImported = "product.imported",
|
|
21
26
|
SubscriptionActivated = "subscription.activated",
|
|
22
27
|
SubscriptionCanceled = "subscription.canceled",
|
|
23
28
|
SubscriptionImported = "subscription.imported",
|
|
@@ -39,4 +44,4 @@ export declare enum EventName {
|
|
|
39
44
|
ReportCreated = "report.created",
|
|
40
45
|
ReportUpdated = "report.updated"
|
|
41
46
|
}
|
|
42
|
-
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' | 'report.created' | 'report.updated';
|
|
47
|
+
export type IEventName = 'address.created' | 'address.updated' | 'address.imported' | 'adjustment.created' | 'adjustment.updated' | 'business.created' | 'business.updated' | 'business.imported' | 'customer.created' | 'customer.updated' | 'discount.created' | 'discount.updated' | 'discount.imported' | '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';
|
|
@@ -5,12 +5,15 @@ var EventName;
|
|
|
5
5
|
(function (EventName) {
|
|
6
6
|
EventName["AddressCreated"] = "address.created";
|
|
7
7
|
EventName["AddressUpdated"] = "address.updated";
|
|
8
|
+
EventName["AddressImported"] = "address.imported";
|
|
8
9
|
EventName["AdjustmentCreated"] = "adjustment.created";
|
|
9
10
|
EventName["AdjustmentUpdated"] = "adjustment.updated";
|
|
10
11
|
EventName["BusinessCreated"] = "business.created";
|
|
12
|
+
EventName["BusinessImported"] = "business.imported";
|
|
11
13
|
EventName["BusinessUpdated"] = "business.updated";
|
|
12
14
|
EventName["CustomerCreated"] = "customer.created";
|
|
13
15
|
EventName["CustomerUpdated"] = "customer.updated";
|
|
16
|
+
EventName["CustomerImported"] = "customer.imported";
|
|
14
17
|
EventName["DiscountCreated"] = "discount.created";
|
|
15
18
|
EventName["DiscountUpdated"] = "discount.updated";
|
|
16
19
|
EventName["DiscountImported"] = "discount.imported";
|
|
@@ -18,8 +21,10 @@ var EventName;
|
|
|
18
21
|
EventName["PayoutPaid"] = "payout.paid";
|
|
19
22
|
EventName["PriceCreated"] = "price.created";
|
|
20
23
|
EventName["PriceUpdated"] = "price.updated";
|
|
24
|
+
EventName["PriceImported"] = "price.imported";
|
|
21
25
|
EventName["ProductCreated"] = "product.created";
|
|
22
26
|
EventName["ProductUpdated"] = "product.updated";
|
|
27
|
+
EventName["ProductImported"] = "product.imported";
|
|
23
28
|
EventName["SubscriptionActivated"] = "subscription.activated";
|
|
24
29
|
EventName["SubscriptionCanceled"] = "subscription.canceled";
|
|
25
30
|
EventName["SubscriptionImported"] = "subscription.imported";
|
|
@@ -25,6 +25,8 @@ class Webhooks {
|
|
|
25
25
|
return new events_1.AddressCreatedEvent(data);
|
|
26
26
|
case types_1.EventName.AddressUpdated:
|
|
27
27
|
return new events_1.AddressUpdatedEvent(data);
|
|
28
|
+
case types_1.EventName.AddressImported:
|
|
29
|
+
return new events_1.AddressImportedEvent(data);
|
|
28
30
|
case types_1.EventName.AdjustmentCreated:
|
|
29
31
|
return new events_1.AdjustmentCreatedEvent(data);
|
|
30
32
|
case types_1.EventName.AdjustmentUpdated:
|
|
@@ -33,10 +35,14 @@ class Webhooks {
|
|
|
33
35
|
return new events_1.BusinessCreatedEvent(data);
|
|
34
36
|
case types_1.EventName.BusinessUpdated:
|
|
35
37
|
return new events_1.BusinessUpdatedEvent(data);
|
|
38
|
+
case types_1.EventName.BusinessImported:
|
|
39
|
+
return new events_1.BusinessImportedEvent(data);
|
|
36
40
|
case types_1.EventName.CustomerCreated:
|
|
37
41
|
return new events_1.CustomerCreatedEvent(data);
|
|
38
42
|
case types_1.EventName.CustomerUpdated:
|
|
39
43
|
return new events_1.CustomerUpdatedEvent(data);
|
|
44
|
+
case types_1.EventName.CustomerImported:
|
|
45
|
+
return new events_1.CustomerImportedEvent(data);
|
|
40
46
|
case types_1.EventName.DiscountCreated:
|
|
41
47
|
return new events_1.DiscountCreatedEvent(data);
|
|
42
48
|
case types_1.EventName.DiscountImported:
|
|
@@ -51,10 +57,14 @@ class Webhooks {
|
|
|
51
57
|
return new events_1.PriceCreatedEvent(data);
|
|
52
58
|
case types_1.EventName.PriceUpdated:
|
|
53
59
|
return new events_1.PriceUpdatedEvent(data);
|
|
60
|
+
case types_1.EventName.PriceImported:
|
|
61
|
+
return new events_1.PriceImportedEvent(data);
|
|
54
62
|
case types_1.EventName.ProductCreated:
|
|
55
63
|
return new events_1.ProductCreatedEvent(data);
|
|
56
64
|
case types_1.EventName.ProductUpdated:
|
|
57
65
|
return new events_1.ProductUpdatedEvent(data);
|
|
66
|
+
case types_1.EventName.ProductImported:
|
|
67
|
+
return new events_1.ProductImportedEvent(data);
|
|
58
68
|
case types_1.EventName.SubscriptionActivated:
|
|
59
69
|
return new events_1.SubscriptionActivatedEvent(data);
|
|
60
70
|
case types_1.EventName.SubscriptionCanceled:
|
|
@@ -96,7 +106,7 @@ class Webhooks {
|
|
|
96
106
|
case types_1.EventName.ReportUpdated:
|
|
97
107
|
return new events_1.ReportUpdatedEvent(data);
|
|
98
108
|
default:
|
|
99
|
-
logger_1.Logger.log(
|
|
109
|
+
logger_1.Logger.log(`Unknown event_type ${data.event_type}`);
|
|
100
110
|
return null;
|
|
101
111
|
}
|
|
102
112
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { type ICustomData, type IMoney, type IPriceQuantity, type ITimePeriod, type IUnitPriceOverride } from '../../../types';
|
|
2
|
-
import { type TaxMode } from '../../../enums';
|
|
2
|
+
import { type CatalogType, type TaxMode } from '../../../enums';
|
|
3
3
|
export interface CreatePriceRequestBody {
|
|
4
4
|
name?: string | null;
|
|
5
5
|
description: string;
|
|
6
|
+
type?: CatalogType | null;
|
|
6
7
|
productId: string;
|
|
7
8
|
unitPrice: IMoney;
|
|
8
9
|
billingCycle?: ITimePeriod | null;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { type Status } from '../../../enums';
|
|
1
|
+
import { type CatalogType, type Status } from '../../../enums';
|
|
2
2
|
export interface ListPriceQueryParameters {
|
|
3
3
|
after?: string;
|
|
4
4
|
id?: string[];
|
|
5
|
+
type?: CatalogType[];
|
|
5
6
|
include?: string[];
|
|
6
7
|
orderBy?: string;
|
|
7
8
|
perPage?: number;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { type ICustomData, type IMoney, type IPriceQuantity, type ITimePeriod, type IUnitPriceOverride } from '../../../types';
|
|
2
|
-
import { type Status, type TaxMode } from '../../../enums';
|
|
2
|
+
import { type CatalogType, type Status, type TaxMode } from '../../../enums';
|
|
3
3
|
export interface UpdatePriceRequestBody {
|
|
4
4
|
description?: string;
|
|
5
5
|
name?: string | null;
|
|
6
|
+
type?: CatalogType | null;
|
|
6
7
|
billingCycle?: ITimePeriod | null;
|
|
7
8
|
trialPeriod?: ITimePeriod | null;
|
|
8
9
|
taxMode?: TaxMode;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { type ICustomData } from '../../../types';
|
|
2
|
-
import { type TaxCategory } from '../../../enums';
|
|
2
|
+
import { type CatalogType, type TaxCategory } from '../../../enums';
|
|
3
3
|
export interface CreateProductRequestBody {
|
|
4
4
|
name: string;
|
|
5
5
|
taxCategory: TaxCategory;
|
|
6
|
+
type?: CatalogType | null;
|
|
6
7
|
description?: string | null;
|
|
7
8
|
imageUrl?: string | null;
|
|
8
9
|
customData?: ICustomData | null;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { type Status, type TaxCategory } from '../../../enums';
|
|
1
|
+
import { type CatalogType, type Status, type TaxCategory } from '../../../enums';
|
|
2
2
|
export interface ListProductQueryParameters {
|
|
3
3
|
after?: string;
|
|
4
|
+
type?: CatalogType[];
|
|
4
5
|
id?: string[];
|
|
5
6
|
include?: string[];
|
|
6
7
|
orderBy?: string;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { type ICustomData } from '../../../types';
|
|
2
|
-
import { type TaxCategory, type Status } from '../../../enums';
|
|
2
|
+
import { type TaxCategory, type Status, type CatalogType } from '../../../enums';
|
|
3
3
|
export interface UpdateProductRequestBody {
|
|
4
4
|
name?: string;
|
|
5
5
|
description?: string | null;
|
|
6
|
+
type?: CatalogType | null;
|
|
6
7
|
taxCategory?: TaxCategory;
|
|
7
8
|
imageUrl?: string | null;
|
|
8
9
|
customData?: ICustomData | null;
|
package/dist/resources/subscriptions/operations/create-subscription-charge-request-object.d.ts
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
|
-
import { type SubscriptionEffectiveFrom } from '../../../enums';
|
|
2
|
-
import { type
|
|
1
|
+
import { type SubscriptionEffectiveFrom, type SubscriptionOnPaymentFailure } from '../../../enums';
|
|
2
|
+
import { type ISubscriptionNonCatalogPriceRequest } from '../../../types';
|
|
3
|
+
interface ITransactionItemBase {
|
|
4
|
+
quantity: number;
|
|
5
|
+
}
|
|
6
|
+
interface ITransactionItemWithPriceId extends ITransactionItemBase {
|
|
7
|
+
priceId: string;
|
|
8
|
+
price?: never;
|
|
9
|
+
}
|
|
10
|
+
interface ITransactionItemWithPrice extends ITransactionItemBase {
|
|
11
|
+
priceId?: never;
|
|
12
|
+
price: ISubscriptionNonCatalogPriceRequest;
|
|
13
|
+
}
|
|
14
|
+
type ITransactionItem = ITransactionItemWithPriceId | ITransactionItemWithPrice;
|
|
3
15
|
export interface CreateSubscriptionCharge {
|
|
4
16
|
effectiveFrom: SubscriptionEffectiveFrom;
|
|
5
17
|
items: ITransactionItem[];
|
|
18
|
+
onPaymentFailure?: SubscriptionOnPaymentFailure;
|
|
6
19
|
}
|
|
20
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type IBillingDetailsUpdate, type ICustomData, type ISubscriptionUpdateItem } from '../../../types';
|
|
2
|
-
import { type CollectionMode, type CurrencyCode, type ProrationBillingMode, type SubscriptionEffectiveFrom } from '../../../enums';
|
|
2
|
+
import { type CollectionMode, type CurrencyCode, type ProrationBillingMode, type SubscriptionEffectiveFrom, type SubscriptionOnPaymentFailure } from '../../../enums';
|
|
3
3
|
export interface UpdateSubscriptionDiscount {
|
|
4
4
|
id: string;
|
|
5
5
|
effectiveFrom: SubscriptionEffectiveFrom;
|
|
@@ -22,4 +22,5 @@ export interface UpdateSubscriptionRequestBody {
|
|
|
22
22
|
items?: ISubscriptionUpdateItem[];
|
|
23
23
|
customData?: ICustomData | null;
|
|
24
24
|
prorationBillingMode?: ProrationBillingMode;
|
|
25
|
+
onPaymentFailure?: SubscriptionOnPaymentFailure;
|
|
25
26
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type IBillingDetailsCreate, type ICustomData, type ITransactionCheckout, type
|
|
1
|
+
import { type IBillingDetailsCreate, type ICustomData, type ITransactionCheckout, type ITransactionItemWithNonCatalogPrice, type ITransactionsTimePeriod } from '../../../types';
|
|
2
2
|
import { type CollectionMode, type CurrencyCode, type TransactionStatus } from '../../../enums';
|
|
3
3
|
export interface CreateTransactionRequestBody {
|
|
4
|
-
items:
|
|
4
|
+
items: ITransactionItemWithNonCatalogPrice[];
|
|
5
5
|
status?: TransactionStatus;
|
|
6
6
|
customerId?: string | null;
|
|
7
7
|
addressId?: string | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type IBillingDetailsUpdate, type
|
|
1
|
+
import { type IBillingDetailsUpdate, type ICustomData, type ITransactionCheckout, type ITransactionItemWithNonCatalogPrice, type ITransactionsTimePeriod } from '../../../types';
|
|
2
2
|
import { type CollectionMode, type CurrencyCode, type TransactionStatus } from '../../../enums';
|
|
3
3
|
export interface UpdateTransactionRequestBody {
|
|
4
4
|
status?: TransactionStatus;
|
|
@@ -11,6 +11,6 @@ export interface UpdateTransactionRequestBody {
|
|
|
11
11
|
discountId?: string | null;
|
|
12
12
|
billingDetails?: IBillingDetailsUpdate | null;
|
|
13
13
|
billingPeriod?: ITransactionsTimePeriod | null;
|
|
14
|
-
items?:
|
|
14
|
+
items?: ITransactionItemWithNonCatalogPrice[];
|
|
15
15
|
checkout?: ITransactionCheckout | null;
|
|
16
16
|
}
|
|
@@ -23,6 +23,9 @@ interface IAddressCreated extends IEventsResponse<IAddressResponse> {
|
|
|
23
23
|
interface IAddressUpdated extends IEventsResponse<IAddressResponse> {
|
|
24
24
|
event_type: EventName.AddressUpdated;
|
|
25
25
|
}
|
|
26
|
+
interface IAddressImported extends IEventsResponse<IAddressResponse> {
|
|
27
|
+
event_type: EventName.AddressImported;
|
|
28
|
+
}
|
|
26
29
|
interface IAdjustmentCreated extends IEventsResponse<IAdjustmentResponse> {
|
|
27
30
|
event_type: EventName.AdjustmentCreated;
|
|
28
31
|
}
|
|
@@ -35,12 +38,18 @@ interface IBusinessCreated extends IEventsResponse<IBusinessResponse> {
|
|
|
35
38
|
interface IBusinessUpdated extends IEventsResponse<IBusinessResponse> {
|
|
36
39
|
event_type: EventName.BusinessUpdated;
|
|
37
40
|
}
|
|
41
|
+
interface IBusinessImported extends IEventsResponse<IBusinessResponse> {
|
|
42
|
+
event_type: EventName.BusinessImported;
|
|
43
|
+
}
|
|
38
44
|
interface ICustomerCreated extends IEventsResponse<ICustomerResponse> {
|
|
39
45
|
event_type: EventName.CustomerCreated;
|
|
40
46
|
}
|
|
41
47
|
interface ICustomerUpdated extends IEventsResponse<ICustomerResponse> {
|
|
42
48
|
event_type: EventName.CustomerUpdated;
|
|
43
49
|
}
|
|
50
|
+
interface ICustomerImported extends IEventsResponse<ICustomerResponse> {
|
|
51
|
+
event_type: EventName.CustomerImported;
|
|
52
|
+
}
|
|
44
53
|
interface IDiscountCreated extends IEventsResponse<IDiscountResponse> {
|
|
45
54
|
event_type: EventName.DiscountCreated;
|
|
46
55
|
}
|
|
@@ -62,12 +71,18 @@ interface IPriceCreated extends IEventsResponse<IPriceResponse> {
|
|
|
62
71
|
interface IPriceUpdated extends IEventsResponse<IPriceResponse> {
|
|
63
72
|
event_type: EventName.PriceUpdated;
|
|
64
73
|
}
|
|
74
|
+
interface IPriceImported extends IEventsResponse<IPriceResponse> {
|
|
75
|
+
event_type: EventName.PriceImported;
|
|
76
|
+
}
|
|
65
77
|
interface IProductCreated extends IEventsResponse<IProductResponse> {
|
|
66
78
|
event_type: EventName.ProductCreated;
|
|
67
79
|
}
|
|
68
80
|
interface IProductUpdated extends IEventsResponse<IProductResponse> {
|
|
69
81
|
event_type: EventName.ProductUpdated;
|
|
70
82
|
}
|
|
83
|
+
interface IProductImported extends IEventsResponse<IProductResponse> {
|
|
84
|
+
event_type: EventName.ProductImported;
|
|
85
|
+
}
|
|
71
86
|
interface ISubscriptionActivated extends IEventsResponse<ISubscriptionNotificationResponse> {
|
|
72
87
|
event_type: EventName.SubscriptionActivated;
|
|
73
88
|
}
|
|
@@ -128,5 +143,5 @@ interface IReportCreated extends IEventsResponse<IReportResponse> {
|
|
|
128
143
|
interface IReportUpdated extends IEventsResponse<IReportResponse> {
|
|
129
144
|
event_type: EventName.ReportUpdated;
|
|
130
145
|
}
|
|
131
|
-
export type IEvents = IAddressCreated | IAddressUpdated | IAdjustmentCreated | IAdjustmentUpdated | IBusinessCreated | IBusinessUpdated | ICustomerCreated | ICustomerUpdated | IDiscountCreated | IDiscountUpdated | IDiscountImported | IPayoutCreated | IPayoutPaid | IPriceCreated | IPriceUpdated | IProductCreated | IProductUpdated | ISubscriptionActivated | ISubscriptionCanceled | ISubscriptionCreated | ISubscriptionImported | ISubscriptionPastDue | ISubscriptionPaused | ISubscriptionResumed | ISubscriptionTrialing | ISubscriptionUpdated | ITransactionBilled | ITransactionCanceled | ITransactionCompleted | ITransactionCreated | ITransactionPaid | ITransactionPastDue | ITransactionPaymentFailed | ITransactionReady | ITransactionUpdated | IReportCreated | IReportUpdated;
|
|
146
|
+
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;
|
|
132
147
|
export {};
|
|
@@ -15,3 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./price-response"), exports);
|
|
18
|
+
__exportStar(require("./subscription-non-catalog-price-request"), exports);
|
|
19
|
+
__exportStar(require("./non-catalog-price-request"), exports);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ICustomData, IMoney, IPriceQuantity, ITimePeriod, IUnitPriceOverride } from '../shared';
|
|
2
|
+
import type { TaxMode } from '../../enums';
|
|
3
|
+
import type { CreateProductRequestBody } from '../../resources';
|
|
4
|
+
interface INonCatalogBasePriceRequestBody {
|
|
5
|
+
name?: string | null;
|
|
6
|
+
description: string;
|
|
7
|
+
unitPrice: IMoney;
|
|
8
|
+
billingCycle?: ITimePeriod | null;
|
|
9
|
+
trialPeriod?: ITimePeriod | null;
|
|
10
|
+
taxMode?: TaxMode;
|
|
11
|
+
unitPriceOverrides?: IUnitPriceOverride[];
|
|
12
|
+
quantity?: IPriceQuantity;
|
|
13
|
+
customData?: ICustomData | null;
|
|
14
|
+
}
|
|
15
|
+
interface INonCatalogBasePriceRequestBodyWithProductId extends INonCatalogBasePriceRequestBody {
|
|
16
|
+
productId: string;
|
|
17
|
+
product?: never;
|
|
18
|
+
}
|
|
19
|
+
interface INonCatalogBasePriceRequestBodyWithProduct extends INonCatalogBasePriceRequestBody {
|
|
20
|
+
productId?: never;
|
|
21
|
+
product: Omit<CreateProductRequestBody, 'type'>;
|
|
22
|
+
}
|
|
23
|
+
export type INonCatalogPriceRequestBody = INonCatalogBasePriceRequestBodyWithProductId | INonCatalogBasePriceRequestBodyWithProduct;
|
|
24
|
+
export {};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { type ITimePeriod, type IMoneyResponse, type IUnitPriceOverrideResponse, type IPriceQuantity, type ICustomData, type ISharedProductResponse, type IImportMetaResponse } from '../index';
|
|
2
|
-
import { type TaxMode, type Status } from '../../enums';
|
|
2
|
+
import { type TaxMode, type Status, type CatalogType } from '../../enums';
|
|
3
3
|
export interface IPriceResponse {
|
|
4
4
|
id: string;
|
|
5
5
|
product_id: string;
|
|
6
6
|
description: string;
|
|
7
|
+
type?: CatalogType | null;
|
|
7
8
|
name?: string | null;
|
|
8
9
|
billing_cycle?: ITimePeriod | null;
|
|
9
10
|
trial_period?: ITimePeriod | null;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { TaxMode } from '../../enums';
|
|
2
|
+
import type { ICustomData, IMoney, IPriceQuantity, IUnitPriceOverride } from '../shared';
|
|
3
|
+
import { type CreateProductRequestBody } from '../../resources';
|
|
4
|
+
interface INonCatalogBasePriceRequest {
|
|
5
|
+
name?: string | null;
|
|
6
|
+
description: string;
|
|
7
|
+
unitPrice: IMoney;
|
|
8
|
+
taxMode?: TaxMode;
|
|
9
|
+
unitPriceOverrides?: IUnitPriceOverride[];
|
|
10
|
+
quantity?: IPriceQuantity;
|
|
11
|
+
customData?: ICustomData | null;
|
|
12
|
+
}
|
|
13
|
+
interface INonCatalogPriceRequestWithProductId extends INonCatalogBasePriceRequest {
|
|
14
|
+
productId: string;
|
|
15
|
+
product?: never;
|
|
16
|
+
}
|
|
17
|
+
interface INonCatalogPriceRequestWithProduct extends INonCatalogBasePriceRequest {
|
|
18
|
+
productId?: never;
|
|
19
|
+
product: Omit<CreateProductRequestBody, 'type'>;
|
|
20
|
+
}
|
|
21
|
+
export type ISubscriptionNonCatalogPriceRequest = INonCatalogPriceRequestWithProductId | INonCatalogPriceRequestWithProduct;
|
|
22
|
+
export {};
|
|
@@ -2,6 +2,7 @@ import { type CurrencyCode } from '../../enums';
|
|
|
2
2
|
import { type IAddressPreviewResponse } from '../../resources';
|
|
3
3
|
import { type IPricingPreviewItemResponse } from './pricing-preview-item-response';
|
|
4
4
|
import { type IPricingPreviewDetailsResponse } from './pricing-preview-details-response';
|
|
5
|
+
import { type AvailablePaymentMethod } from '../../enums/shared/available-payment-methods';
|
|
5
6
|
export interface IPricingPreviewResponse {
|
|
6
7
|
customer_id?: string | null;
|
|
7
8
|
address_id?: string | null;
|
|
@@ -12,4 +13,5 @@ export interface IPricingPreviewResponse {
|
|
|
12
13
|
customer_ip_address?: string | null;
|
|
13
14
|
items: IPricingPreviewItemResponse[];
|
|
14
15
|
details?: IPricingPreviewDetailsResponse | null;
|
|
16
|
+
available_payment_method?: AvailablePaymentMethod | null;
|
|
15
17
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { type ICustomData, type IImportMetaResponse, type ISharedPriceResponse } from '../index';
|
|
2
|
-
import { type TaxCategory, type Status } from '../../enums';
|
|
2
|
+
import { type TaxCategory, type Status, type CatalogType } from '../../enums';
|
|
3
3
|
export interface IProductResponse {
|
|
4
4
|
id: string;
|
|
5
5
|
name: string;
|
|
6
|
+
type?: CatalogType | null;
|
|
6
7
|
description?: string | null;
|
|
7
8
|
tax_category: TaxCategory;
|
|
8
9
|
image_url?: string | null;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { type ITimePeriod, type IMoneyResponse, type IUnitPriceOverrideResponse, type IPriceQuantity, type ICustomData, type IImportMetaResponse } from '../index';
|
|
2
|
-
import { type TaxMode, type Status } from '../../enums';
|
|
2
|
+
import { type TaxMode, type Status, type CatalogType } from '../../enums';
|
|
3
3
|
export interface ISharedPriceResponse {
|
|
4
4
|
id: string;
|
|
5
5
|
product_id: string;
|
|
6
6
|
description: string;
|
|
7
|
+
type?: CatalogType | null;
|
|
7
8
|
name?: string | null;
|
|
8
9
|
billing_cycle?: ITimePeriod | null;
|
|
9
10
|
trial_period?: ITimePeriod | null;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { type ICustomData, type IImportMetaResponse } from '../index';
|
|
2
|
-
import { type TaxCategory, type Status } from '../../enums';
|
|
2
|
+
import { type TaxCategory, type Status, type CatalogType } from '../../enums';
|
|
3
3
|
export interface ISharedProductResponse {
|
|
4
4
|
id: string;
|
|
5
5
|
name: string;
|
|
6
|
+
type?: CatalogType | null;
|
|
6
7
|
description?: string | null;
|
|
7
8
|
tax_category: TaxCategory;
|
|
8
9
|
image_url?: string | null;
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import { type INonCatalogPriceRequestBody } from '../price';
|
|
2
|
+
export interface ITransactionItemWithPriceId {
|
|
2
3
|
priceId: string;
|
|
4
|
+
price?: never;
|
|
3
5
|
quantity: number;
|
|
4
6
|
}
|
|
7
|
+
export interface ITransactionItemWithPrice {
|
|
8
|
+
priceId?: never;
|
|
9
|
+
price: INonCatalogPriceRequestBody;
|
|
10
|
+
quantity: number;
|
|
11
|
+
}
|
|
12
|
+
export type ITransactionItemWithNonCatalogPrice = ITransactionItemWithPriceId | ITransactionItemWithPrice;
|
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { type INonCatalogPriceRequestBody } from '../price';
|
|
2
|
+
interface IBaseTransactionItemPreview {
|
|
3
3
|
quantity: number;
|
|
4
4
|
includeInTotals?: boolean | null;
|
|
5
5
|
}
|
|
6
|
+
interface ITransactionItemWithPriceId extends IBaseTransactionItemPreview {
|
|
7
|
+
priceId: string;
|
|
8
|
+
price?: never;
|
|
9
|
+
}
|
|
10
|
+
interface ITransactionItemWithPrice extends IBaseTransactionItemPreview {
|
|
11
|
+
priceId?: never;
|
|
12
|
+
price: INonCatalogPriceRequestBody;
|
|
13
|
+
}
|
|
14
|
+
export type ITransactionItemPreviewRequest = ITransactionItemWithPriceId | ITransactionItemWithPrice;
|
|
15
|
+
export {};
|
|
@@ -3,6 +3,7 @@ import { type IAddressPreviewResponse } from '../../resources';
|
|
|
3
3
|
import { type ITransactionDetailsPreviewResponse } from '../shared';
|
|
4
4
|
import { type IPriceResponse } from '../price';
|
|
5
5
|
import { type ITransactionsTimePeriodResponse } from './transactions-time-period-response';
|
|
6
|
+
import { type AvailablePaymentMethod } from '../../enums/shared/available-payment-methods';
|
|
6
7
|
export interface IProrationResponse {
|
|
7
8
|
rate: string;
|
|
8
9
|
billing_period: ITransactionsTimePeriodResponse;
|
|
@@ -24,4 +25,5 @@ export interface ITransactionPreviewResponse {
|
|
|
24
25
|
ignore_trials?: boolean | null;
|
|
25
26
|
items: ITransactionItemPreviewResponse[];
|
|
26
27
|
details: ITransactionDetailsPreviewResponse;
|
|
28
|
+
available_payment_method?: AvailablePaymentMethod | null;
|
|
27
29
|
}
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.2.
|
|
1
|
+
export declare const SDK_VERSION = "0.2.6";
|
package/dist/version.js
CHANGED