@paddle/paddle-node-sdk 2.0.0-rc.2 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -16
- package/dist/cjs/entities/customer-portal-session/customer-portal-session.js +13 -0
- package/dist/cjs/entities/customer-portal-session/customer-portal-subscription-url.js +11 -0
- package/dist/cjs/entities/customer-portal-session/general.js +9 -0
- package/dist/cjs/entities/customer-portal-session/index.js +18 -0
- package/dist/cjs/entities/customer-portal-session/urls.js +13 -0
- package/dist/cjs/entities/index.js +1 -0
- package/dist/cjs/internal/api/case-helpers.js +19 -32
- package/dist/cjs/paddle.js +1 -0
- package/dist/cjs/resources/customer-portal-sessions/index.js +32 -0
- package/dist/cjs/resources/customer-portal-sessions/operations/create-customer-portal-session-request-object.js +2 -0
- package/dist/cjs/resources/customer-portal-sessions/operations/index.js +17 -0
- package/dist/cjs/resources/index.js +1 -0
- package/dist/cjs/types/customer-portal-session/customer-portal-session-response.js +2 -0
- package/dist/cjs/types/customer-portal-session/customer-portal-subscription-url.js +2 -0
- package/dist/cjs/types/customer-portal-session/general.js +2 -0
- package/dist/cjs/types/customer-portal-session/index.js +20 -0
- package/dist/cjs/types/customer-portal-session/urls.js +2 -0
- package/dist/cjs/types/index.js +1 -0
- package/dist/cjs/version.js +1 -1
- package/dist/esm/entities/customer-portal-session/customer-portal-session.js +9 -0
- package/dist/esm/entities/customer-portal-session/customer-portal-subscription-url.js +7 -0
- package/dist/esm/entities/customer-portal-session/general.js +5 -0
- package/dist/esm/entities/customer-portal-session/index.js +2 -0
- package/dist/esm/entities/customer-portal-session/urls.js +9 -0
- package/dist/esm/entities/index.js +1 -0
- package/dist/esm/internal/api/case-helpers.js +19 -9
- package/dist/esm/paddle.js +2 -1
- package/dist/esm/resources/customer-portal-sessions/index.js +28 -0
- package/dist/esm/resources/customer-portal-sessions/operations/create-customer-portal-session-request-object.js +1 -0
- package/dist/esm/resources/customer-portal-sessions/operations/index.js +1 -0
- package/dist/esm/resources/index.js +1 -0
- package/dist/esm/types/customer-portal-session/customer-portal-session-response.js +1 -0
- package/dist/esm/types/customer-portal-session/customer-portal-subscription-url.js +1 -0
- package/dist/esm/types/customer-portal-session/general.js +1 -0
- package/dist/esm/types/customer-portal-session/index.js +4 -0
- package/dist/esm/types/customer-portal-session/urls.js +1 -0
- package/dist/esm/types/index.js +1 -0
- package/dist/esm/version.js +1 -1
- package/dist/types/entities/customer-portal-session/customer-portal-session.d.ts +9 -0
- package/dist/types/entities/customer-portal-session/customer-portal-subscription-url.d.ts +7 -0
- package/dist/types/entities/customer-portal-session/general.d.ts +5 -0
- package/dist/types/entities/customer-portal-session/index.d.ts +2 -0
- package/dist/types/entities/customer-portal-session/urls.d.ts +8 -0
- package/dist/types/entities/index.d.ts +1 -0
- package/dist/types/paddle.d.ts +2 -1
- package/dist/types/resources/customer-portal-sessions/index.d.ts +5 -0
- package/dist/types/resources/customer-portal-sessions/operations/create-customer-portal-session-request-object.d.ts +3 -0
- package/dist/types/resources/customer-portal-sessions/operations/index.d.ts +1 -0
- package/dist/types/resources/index.d.ts +1 -0
- package/dist/types/types/customer-portal-session/customer-portal-session-response.d.ts +7 -0
- package/dist/types/types/customer-portal-session/customer-portal-subscription-url.d.ts +5 -0
- package/dist/types/types/customer-portal-session/general.d.ts +3 -0
- package/dist/types/types/customer-portal-session/index.d.ts +4 -0
- package/dist/types/types/customer-portal-session/urls.d.ts +6 -0
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -4
package/CHANGELOG.md
CHANGED
|
@@ -12,33 +12,27 @@ When we make [non-breaking changes](https://developer.paddle.com/api-reference/a
|
|
|
12
12
|
|
|
13
13
|
This means when upgrading minor versions of the SDK, you may notice type errors. You can safely ignore these or fix by adding additional type guards.
|
|
14
14
|
|
|
15
|
-
## 2.
|
|
15
|
+
## 2.1.0 - 2024-11-21
|
|
16
16
|
|
|
17
17
|
### Added
|
|
18
18
|
|
|
19
|
-
- Added
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
- Added `generateAuthToken` for customer
|
|
19
|
+
- Added `customerPortalSessions` resources
|
|
20
|
+
|
|
21
|
+
## 2.0.0 - 2024-11-20
|
|
23
22
|
|
|
24
|
-
|
|
23
|
+
> **Breaking changes:** This version includes major improvements that introduce breaking changes. These are called out below.
|
|
25
24
|
|
|
26
25
|
### Added
|
|
27
26
|
|
|
27
|
+
- Added support for edge runtime.
|
|
28
28
|
- Added `simulationTypes` resources
|
|
29
29
|
- Added `simulations` resources
|
|
30
30
|
- Added `simulationRuns` resources
|
|
31
31
|
- Added `simulationRunEvents` resources
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
> **Breaking changes:** This version includes major improvements that introduce breaking changes. These are called out below.
|
|
38
|
-
|
|
39
|
-
### Added
|
|
40
|
-
|
|
41
|
-
- Added support for edge runtime.
|
|
32
|
+
- Added the `trafficSource` filter on notification settings
|
|
33
|
+
- Omitted the `transactionId` completely from `SubscriptionNotification` and created a separate `SubscriptionCreatedNotification` with the non-null `transactionId`
|
|
34
|
+
- Added `paymentMethods` resources
|
|
35
|
+
- Added `generateAuthToken` for customer
|
|
42
36
|
|
|
43
37
|
### Changed
|
|
44
38
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CustomerPortalSession = void 0;
|
|
4
|
+
const urls_js_1 = require("./urls.js");
|
|
5
|
+
class CustomerPortalSession {
|
|
6
|
+
constructor(customerPortalSessionResponse) {
|
|
7
|
+
this.id = customerPortalSessionResponse.id;
|
|
8
|
+
this.customerId = customerPortalSessionResponse.customer_id;
|
|
9
|
+
this.urls = new urls_js_1.Urls(customerPortalSessionResponse.urls);
|
|
10
|
+
this.createdAt = customerPortalSessionResponse.created_at;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.CustomerPortalSession = CustomerPortalSession;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CustomerPortalSubscriptionUrl = void 0;
|
|
4
|
+
class CustomerPortalSubscriptionUrl {
|
|
5
|
+
constructor(customerPortalSubscriptionUrlResponse) {
|
|
6
|
+
this.id = customerPortalSubscriptionUrlResponse.id;
|
|
7
|
+
this.cancelSubscription = customerPortalSubscriptionUrlResponse.cancel_subscription;
|
|
8
|
+
this.updateSubscriptionPaymentMethod = customerPortalSubscriptionUrlResponse.update_subscription_payment_method;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.CustomerPortalSubscriptionUrl = CustomerPortalSubscriptionUrl;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./customer-portal-subscription-url.js"), exports);
|
|
18
|
+
__exportStar(require("./customer-portal-session.js"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Urls = void 0;
|
|
4
|
+
const general_js_1 = require("./general.js");
|
|
5
|
+
const customer_portal_subscription_url_js_1 = require("./customer-portal-subscription-url.js");
|
|
6
|
+
class Urls {
|
|
7
|
+
constructor(urlsResponse) {
|
|
8
|
+
var _a;
|
|
9
|
+
this.general = new general_js_1.General(urlsResponse.general);
|
|
10
|
+
this.subscriptions = (_a = urlsResponse.subscriptions) === null || _a === void 0 ? void 0 : _a.map((subscription) => { var _a; return (_a = new customer_portal_subscription_url_js_1.CustomerPortalSubscriptionUrl(subscription)) !== null && _a !== void 0 ? _a : []; });
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.Urls = Urls;
|
|
@@ -20,6 +20,7 @@ __exportStar(require("./price/index.js"), exports);
|
|
|
20
20
|
__exportStar(require("./transaction/index.js"), exports);
|
|
21
21
|
__exportStar(require("./adjustment/index.js"), exports);
|
|
22
22
|
__exportStar(require("./customer/index.js"), exports);
|
|
23
|
+
__exportStar(require("./customer-portal-session/index.js"), exports);
|
|
23
24
|
__exportStar(require("./business/index.js"), exports);
|
|
24
25
|
__exportStar(require("./subscription/index.js"), exports);
|
|
25
26
|
__exportStar(require("./address/index.js"), exports);
|
|
@@ -1,27 +1,4 @@
|
|
|
1
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
3
|
var t = {};
|
|
27
4
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -35,22 +12,32 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
35
12
|
};
|
|
36
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
14
|
exports.convertToSnakeCase = void 0;
|
|
38
|
-
const lodash = __importStar(require("lodash"));
|
|
39
15
|
function isTopLevelCustomDataCamel(input) {
|
|
40
16
|
return 'customData' in input;
|
|
41
17
|
}
|
|
18
|
+
function isObject(input) {
|
|
19
|
+
return input != null && typeof input === 'object';
|
|
20
|
+
}
|
|
21
|
+
function snakeCase(input) {
|
|
22
|
+
return input
|
|
23
|
+
.trim()
|
|
24
|
+
.replace(/([a-z])([A-Z])/g, '$1_$2')
|
|
25
|
+
.replace(/[\W]+/g, '_')
|
|
26
|
+
.replace(/^_+|_+$/g, '')
|
|
27
|
+
.toLowerCase();
|
|
28
|
+
}
|
|
42
29
|
function decamelizeKeys(obj) {
|
|
43
|
-
if (!
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
30
|
+
if (!isObject(obj) ||
|
|
31
|
+
obj instanceof Date ||
|
|
32
|
+
obj instanceof RegExp ||
|
|
33
|
+
typeof obj === 'boolean' ||
|
|
34
|
+
typeof obj === 'function') {
|
|
48
35
|
return obj;
|
|
49
36
|
}
|
|
50
37
|
let output;
|
|
51
38
|
let i = 0;
|
|
52
39
|
let l = 0;
|
|
53
|
-
if (
|
|
40
|
+
if (Array.isArray(obj)) {
|
|
54
41
|
output = [];
|
|
55
42
|
for (l = obj.length; i < l; i++) {
|
|
56
43
|
output.push(decamelizeKeys(obj[i]));
|
|
@@ -60,14 +47,14 @@ function decamelizeKeys(obj) {
|
|
|
60
47
|
output = {};
|
|
61
48
|
for (const key in obj) {
|
|
62
49
|
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
63
|
-
output[
|
|
50
|
+
output[snakeCase(key)] = decamelizeKeys(obj[key]);
|
|
64
51
|
}
|
|
65
52
|
}
|
|
66
53
|
}
|
|
67
54
|
return output;
|
|
68
55
|
}
|
|
69
56
|
function convertToSnakeCase(input) {
|
|
70
|
-
if (!input || !
|
|
57
|
+
if (!input || !isObject(input)) {
|
|
71
58
|
return input;
|
|
72
59
|
}
|
|
73
60
|
if (isTopLevelCustomDataCamel(input)) {
|
package/dist/cjs/paddle.js
CHANGED
|
@@ -18,6 +18,7 @@ class Paddle {
|
|
|
18
18
|
this.transactions = new index_js_2.TransactionsResource(this.client);
|
|
19
19
|
this.adjustments = new index_js_2.AdjustmentsResource(this.client);
|
|
20
20
|
this.customers = new index_js_2.CustomersResource(this.client);
|
|
21
|
+
this.customerPortalSessions = new index_js_2.CustomerPortalSessionsResource(this.client);
|
|
21
22
|
this.addresses = new index_js_2.AddressesResource(this.client);
|
|
22
23
|
this.businesses = new index_js_2.BusinessesResource(this.client);
|
|
23
24
|
this.discounts = new index_js_2.DiscountsResource(this.client);
|
|
@@ -0,0 +1,32 @@
|
|
|
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.CustomerPortalSessionsResource = void 0;
|
|
13
|
+
const index_js_1 = require("../../entities/index.js");
|
|
14
|
+
const base_1 = require("../../internal/base");
|
|
15
|
+
const CustomerPortalSessionPaths = {
|
|
16
|
+
create: '/customers/{customer_id}/portal-sessions',
|
|
17
|
+
};
|
|
18
|
+
class CustomerPortalSessionsResource extends base_1.BaseResource {
|
|
19
|
+
create(customerId, subscriptionIds) {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
const urlWithPathParams = new base_1.PathParameters(CustomerPortalSessionPaths.create, {
|
|
22
|
+
customer_id: customerId,
|
|
23
|
+
}).deriveUrl();
|
|
24
|
+
const response = yield this.client.post(urlWithPathParams, {
|
|
25
|
+
subscriptionIds,
|
|
26
|
+
});
|
|
27
|
+
const data = this.handleResponse(response);
|
|
28
|
+
return new index_js_1.CustomerPortalSession(data);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.CustomerPortalSessionsResource = CustomerPortalSessionsResource;
|
|
@@ -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("./create-customer-portal-session-request-object.js"), exports);
|
|
@@ -18,6 +18,7 @@ __exportStar(require("./addresses/index.js"), exports);
|
|
|
18
18
|
__exportStar(require("./adjustments/index.js"), exports);
|
|
19
19
|
__exportStar(require("./businesses/index.js"), exports);
|
|
20
20
|
__exportStar(require("./customers/index.js"), exports);
|
|
21
|
+
__exportStar(require("./customer-portal-sessions/index.js"), exports);
|
|
21
22
|
__exportStar(require("./discounts/index.js"), exports);
|
|
22
23
|
__exportStar(require("./prices/index.js"), exports);
|
|
23
24
|
__exportStar(require("./products/index.js"), exports);
|
|
@@ -0,0 +1,20 @@
|
|
|
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("./general.js"), exports);
|
|
18
|
+
__exportStar(require("./customer-portal-subscription-url.js"), exports);
|
|
19
|
+
__exportStar(require("./urls.js"), exports);
|
|
20
|
+
__exportStar(require("./customer-portal-session-response.js"), exports);
|
package/dist/cjs/types/index.js
CHANGED
|
@@ -20,6 +20,7 @@ __exportStar(require("./price/index.js"), exports);
|
|
|
20
20
|
__exportStar(require("./transaction/index.js"), exports);
|
|
21
21
|
__exportStar(require("./adjustment/index.js"), exports);
|
|
22
22
|
__exportStar(require("./customer/index.js"), exports);
|
|
23
|
+
__exportStar(require("./customer-portal-session/index.js"), exports);
|
|
23
24
|
__exportStar(require("./business/index.js"), exports);
|
|
24
25
|
__exportStar(require("./subscription/index.js"), exports);
|
|
25
26
|
__exportStar(require("./address/index.js"), exports);
|
package/dist/cjs/version.js
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Urls } from './urls.js';
|
|
2
|
+
export class CustomerPortalSession {
|
|
3
|
+
constructor(customerPortalSessionResponse) {
|
|
4
|
+
this.id = customerPortalSessionResponse.id;
|
|
5
|
+
this.customerId = customerPortalSessionResponse.customer_id;
|
|
6
|
+
this.urls = new Urls(customerPortalSessionResponse.urls);
|
|
7
|
+
this.createdAt = customerPortalSessionResponse.created_at;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export class CustomerPortalSubscriptionUrl {
|
|
2
|
+
constructor(customerPortalSubscriptionUrlResponse) {
|
|
3
|
+
this.id = customerPortalSubscriptionUrlResponse.id;
|
|
4
|
+
this.cancelSubscription = customerPortalSubscriptionUrlResponse.cancel_subscription;
|
|
5
|
+
this.updateSubscriptionPaymentMethod = customerPortalSubscriptionUrlResponse.update_subscription_payment_method;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { General } from './general.js';
|
|
2
|
+
import { CustomerPortalSubscriptionUrl } from './customer-portal-subscription-url.js';
|
|
3
|
+
export class Urls {
|
|
4
|
+
constructor(urlsResponse) {
|
|
5
|
+
var _a;
|
|
6
|
+
this.general = new General(urlsResponse.general);
|
|
7
|
+
this.subscriptions = (_a = urlsResponse.subscriptions) === null || _a === void 0 ? void 0 : _a.map((subscription) => { var _a; return (_a = new CustomerPortalSubscriptionUrl(subscription)) !== null && _a !== void 0 ? _a : []; });
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -4,6 +4,7 @@ export * from './price/index.js';
|
|
|
4
4
|
export * from './transaction/index.js';
|
|
5
5
|
export * from './adjustment/index.js';
|
|
6
6
|
export * from './customer/index.js';
|
|
7
|
+
export * from './customer-portal-session/index.js';
|
|
7
8
|
export * from './business/index.js';
|
|
8
9
|
export * from './subscription/index.js';
|
|
9
10
|
export * from './address/index.js';
|
|
@@ -9,22 +9,32 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import * as lodash from 'lodash';
|
|
13
12
|
function isTopLevelCustomDataCamel(input) {
|
|
14
13
|
return 'customData' in input;
|
|
15
14
|
}
|
|
15
|
+
function isObject(input) {
|
|
16
|
+
return input != null && typeof input === 'object';
|
|
17
|
+
}
|
|
18
|
+
function snakeCase(input) {
|
|
19
|
+
return input
|
|
20
|
+
.trim()
|
|
21
|
+
.replace(/([a-z])([A-Z])/g, '$1_$2')
|
|
22
|
+
.replace(/[\W]+/g, '_')
|
|
23
|
+
.replace(/^_+|_+$/g, '')
|
|
24
|
+
.toLowerCase();
|
|
25
|
+
}
|
|
16
26
|
function decamelizeKeys(obj) {
|
|
17
|
-
if (!
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
27
|
+
if (!isObject(obj) ||
|
|
28
|
+
obj instanceof Date ||
|
|
29
|
+
obj instanceof RegExp ||
|
|
30
|
+
typeof obj === 'boolean' ||
|
|
31
|
+
typeof obj === 'function') {
|
|
22
32
|
return obj;
|
|
23
33
|
}
|
|
24
34
|
let output;
|
|
25
35
|
let i = 0;
|
|
26
36
|
let l = 0;
|
|
27
|
-
if (
|
|
37
|
+
if (Array.isArray(obj)) {
|
|
28
38
|
output = [];
|
|
29
39
|
for (l = obj.length; i < l; i++) {
|
|
30
40
|
output.push(decamelizeKeys(obj[i]));
|
|
@@ -34,14 +44,14 @@ function decamelizeKeys(obj) {
|
|
|
34
44
|
output = {};
|
|
35
45
|
for (const key in obj) {
|
|
36
46
|
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
37
|
-
output[
|
|
47
|
+
output[snakeCase(key)] = decamelizeKeys(obj[key]);
|
|
38
48
|
}
|
|
39
49
|
}
|
|
40
50
|
}
|
|
41
51
|
return output;
|
|
42
52
|
}
|
|
43
53
|
export function convertToSnakeCase(input) {
|
|
44
|
-
if (!input || !
|
|
54
|
+
if (!input || !isObject(input)) {
|
|
45
55
|
return input;
|
|
46
56
|
}
|
|
47
57
|
if (isTopLevelCustomDataCamel(input)) {
|
package/dist/esm/paddle.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Client } from './internal/api/client.js';
|
|
2
2
|
import { Environment, LogLevel } from './internal/index.js';
|
|
3
|
-
import { AddressesResource, AdjustmentsResource, BusinessesResource, CustomersResource, DiscountsResource, EventTypesResource, NotificationSettingsResource, NotificationsResource, PaymentMethodsResource, PricesResource, PricingPreviewResource, ProductsResource, ReportsResource, SimulationTypesResource, SimulationsResource, SimulationRunsResource, SimulationRunEventsResource, SubscriptionsResource, TransactionsResource, } from './resources/index.js';
|
|
3
|
+
import { AddressesResource, AdjustmentsResource, BusinessesResource, CustomersResource, CustomerPortalSessionsResource, DiscountsResource, EventTypesResource, NotificationSettingsResource, NotificationsResource, PaymentMethodsResource, PricesResource, PricingPreviewResource, ProductsResource, ReportsResource, SimulationTypesResource, SimulationsResource, SimulationRunsResource, SimulationRunEventsResource, SubscriptionsResource, TransactionsResource, } from './resources/index.js';
|
|
4
4
|
import { EventsResource } from './resources/events/index.js';
|
|
5
5
|
import { Webhooks } from './notifications/index.js';
|
|
6
6
|
export class Paddle {
|
|
@@ -15,6 +15,7 @@ export class Paddle {
|
|
|
15
15
|
this.transactions = new TransactionsResource(this.client);
|
|
16
16
|
this.adjustments = new AdjustmentsResource(this.client);
|
|
17
17
|
this.customers = new CustomersResource(this.client);
|
|
18
|
+
this.customerPortalSessions = new CustomerPortalSessionsResource(this.client);
|
|
18
19
|
this.addresses = new AddressesResource(this.client);
|
|
19
20
|
this.businesses = new BusinessesResource(this.client);
|
|
20
21
|
this.discounts = new DiscountsResource(this.client);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { CustomerPortalSession } from '../../entities/index.js';
|
|
11
|
+
import { BaseResource, PathParameters } from '../../internal/base';
|
|
12
|
+
const CustomerPortalSessionPaths = {
|
|
13
|
+
create: '/customers/{customer_id}/portal-sessions',
|
|
14
|
+
};
|
|
15
|
+
export class CustomerPortalSessionsResource extends BaseResource {
|
|
16
|
+
create(customerId, subscriptionIds) {
|
|
17
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
const urlWithPathParams = new PathParameters(CustomerPortalSessionPaths.create, {
|
|
19
|
+
customer_id: customerId,
|
|
20
|
+
}).deriveUrl();
|
|
21
|
+
const response = yield this.client.post(urlWithPathParams, {
|
|
22
|
+
subscriptionIds,
|
|
23
|
+
});
|
|
24
|
+
const data = this.handleResponse(response);
|
|
25
|
+
return new CustomerPortalSession(data);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './create-customer-portal-session-request-object.js';
|
|
@@ -2,6 +2,7 @@ export * from './addresses/index.js';
|
|
|
2
2
|
export * from './adjustments/index.js';
|
|
3
3
|
export * from './businesses/index.js';
|
|
4
4
|
export * from './customers/index.js';
|
|
5
|
+
export * from './customer-portal-sessions/index.js';
|
|
5
6
|
export * from './discounts/index.js';
|
|
6
7
|
export * from './prices/index.js';
|
|
7
8
|
export * from './products/index.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/esm/types/index.js
CHANGED
|
@@ -4,6 +4,7 @@ export * from './price/index.js';
|
|
|
4
4
|
export * from './transaction/index.js';
|
|
5
5
|
export * from './adjustment/index.js';
|
|
6
6
|
export * from './customer/index.js';
|
|
7
|
+
export * from './customer-portal-session/index.js';
|
|
7
8
|
export * from './business/index.js';
|
|
8
9
|
export * from './subscription/index.js';
|
|
9
10
|
export * from './address/index.js';
|
package/dist/esm/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = '2.
|
|
1
|
+
export const SDK_VERSION = '2.1.0';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ICustomerPortalSessionResponse } from '../../types/index.js';
|
|
2
|
+
import { Urls } from './urls.js';
|
|
3
|
+
export declare class CustomerPortalSession {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly customerId: string | null;
|
|
6
|
+
readonly urls: Urls;
|
|
7
|
+
readonly createdAt: string;
|
|
8
|
+
constructor(customerPortalSessionResponse: ICustomerPortalSessionResponse);
|
|
9
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ICustomerPortalSubscriptionUrl } from '../../types/index.js';
|
|
2
|
+
export declare class CustomerPortalSubscriptionUrl {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
readonly cancelSubscription: string;
|
|
5
|
+
readonly updateSubscriptionPaymentMethod: string;
|
|
6
|
+
constructor(customerPortalSubscriptionUrlResponse: ICustomerPortalSubscriptionUrl);
|
|
7
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type IUrlsResponse } from '../../types/index.js';
|
|
2
|
+
import { General } from './general.js';
|
|
3
|
+
import { CustomerPortalSubscriptionUrl } from './customer-portal-subscription-url.js';
|
|
4
|
+
export declare class Urls {
|
|
5
|
+
readonly general: General;
|
|
6
|
+
readonly subscriptions: CustomerPortalSubscriptionUrl[];
|
|
7
|
+
constructor(urlsResponse: IUrlsResponse);
|
|
8
|
+
}
|
|
@@ -4,6 +4,7 @@ export * from './price/index.js';
|
|
|
4
4
|
export * from './transaction/index.js';
|
|
5
5
|
export * from './adjustment/index.js';
|
|
6
6
|
export * from './customer/index.js';
|
|
7
|
+
export * from './customer-portal-session/index.js';
|
|
7
8
|
export * from './business/index.js';
|
|
8
9
|
export * from './subscription/index.js';
|
|
9
10
|
export * from './address/index.js';
|
package/dist/types/paddle.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type PaddleOptions } from './internal/index.js';
|
|
2
|
-
import { AddressesResource, AdjustmentsResource, BusinessesResource, CustomersResource, DiscountsResource, EventTypesResource, NotificationSettingsResource, NotificationsResource, PaymentMethodsResource, PricesResource, PricingPreviewResource, ProductsResource, ReportsResource, SimulationTypesResource, SimulationsResource, SimulationRunsResource, SimulationRunEventsResource, SubscriptionsResource, TransactionsResource } from './resources/index.js';
|
|
2
|
+
import { AddressesResource, AdjustmentsResource, BusinessesResource, CustomersResource, CustomerPortalSessionsResource, DiscountsResource, EventTypesResource, NotificationSettingsResource, NotificationsResource, PaymentMethodsResource, PricesResource, PricingPreviewResource, ProductsResource, ReportsResource, SimulationTypesResource, SimulationsResource, SimulationRunsResource, SimulationRunEventsResource, SubscriptionsResource, TransactionsResource } from './resources/index.js';
|
|
3
3
|
import { EventsResource } from './resources/events/index.js';
|
|
4
4
|
import { Webhooks } from './notifications/index.js';
|
|
5
5
|
export declare class Paddle {
|
|
@@ -10,6 +10,7 @@ export declare class Paddle {
|
|
|
10
10
|
transactions: TransactionsResource;
|
|
11
11
|
adjustments: AdjustmentsResource;
|
|
12
12
|
customers: CustomersResource;
|
|
13
|
+
customerPortalSessions: CustomerPortalSessionsResource;
|
|
13
14
|
addresses: AddressesResource;
|
|
14
15
|
businesses: BusinessesResource;
|
|
15
16
|
discounts: DiscountsResource;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CustomerPortalSession } from '../../entities/index.js';
|
|
2
|
+
import { BaseResource } from '../../internal/base';
|
|
3
|
+
export declare class CustomerPortalSessionsResource extends BaseResource {
|
|
4
|
+
create(customerId: string, subscriptionIds: string[]): Promise<CustomerPortalSession>;
|
|
5
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './create-customer-portal-session-request-object.js';
|
|
@@ -2,6 +2,7 @@ export * from './addresses/index.js';
|
|
|
2
2
|
export * from './adjustments/index.js';
|
|
3
3
|
export * from './businesses/index.js';
|
|
4
4
|
export * from './customers/index.js';
|
|
5
|
+
export * from './customer-portal-sessions/index.js';
|
|
5
6
|
export * from './discounts/index.js';
|
|
6
7
|
export * from './prices/index.js';
|
|
7
8
|
export * from './products/index.js';
|
|
@@ -4,6 +4,7 @@ export * from './price/index.js';
|
|
|
4
4
|
export * from './transaction/index.js';
|
|
5
5
|
export * from './adjustment/index.js';
|
|
6
6
|
export * from './customer/index.js';
|
|
7
|
+
export * from './customer-portal-session/index.js';
|
|
7
8
|
export * from './business/index.js';
|
|
8
9
|
export * from './subscription/index.js';
|
|
9
10
|
export * from './address/index.js';
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "2.
|
|
1
|
+
export declare const SDK_VERSION = "2.1.0";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paddle/paddle-node-sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "A Node.js SDK that you can use to integrate Paddle Billing with applications written in server-side JavaScript.",
|
|
5
5
|
"main": "dist/cjs/index.cjs.node.js",
|
|
6
6
|
"module": "dist/esm/index.esm.node.js",
|
|
@@ -58,9 +58,6 @@
|
|
|
58
58
|
"prettier": "^3.0.3",
|
|
59
59
|
"typescript": "^5.2.2"
|
|
60
60
|
},
|
|
61
|
-
"dependencies": {
|
|
62
|
-
"lodash": "^4.17.21"
|
|
63
|
-
},
|
|
64
61
|
"exports": {
|
|
65
62
|
"types": "./dist/types/index.cjs.node.d.ts",
|
|
66
63
|
"worker": {
|