@paid-ai/paid-node 1.0.0 → 1.0.1-alpha0
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/dist/cjs/BaseClient.d.ts +4 -17
- package/dist/cjs/BaseClient.js +0 -59
- package/dist/cjs/Client.d.ts +28 -28
- package/dist/cjs/Client.js +52 -11
- package/dist/cjs/api/errors/BadRequestError.js +1 -5
- package/dist/cjs/api/errors/ForbiddenError.js +1 -5
- package/dist/cjs/api/errors/InternalServerError.js +1 -5
- package/dist/cjs/api/errors/NotFoundError.js +1 -5
- package/dist/cjs/api/resources/agents/client/Client.d.ts +23 -22
- package/dist/cjs/api/resources/agents/client/Client.js +158 -55
- package/dist/cjs/api/resources/contacts/client/Client.d.ts +19 -18
- package/dist/cjs/api/resources/contacts/client/Client.js +122 -43
- package/dist/cjs/api/resources/customers/client/Client.d.ts +37 -36
- package/dist/cjs/api/resources/customers/client/Client.js +315 -113
- package/dist/cjs/api/resources/orders/client/Client.d.ts +28 -27
- package/dist/cjs/api/resources/orders/client/Client.js +177 -62
- package/dist/cjs/api/resources/orders/resources/lines/client/Client.d.ts +9 -8
- package/dist/cjs/api/resources/orders/resources/lines/client/Client.js +32 -13
- package/dist/cjs/api/resources/plans/client/Client.d.ts +13 -12
- package/dist/cjs/api/resources/plans/client/Client.js +82 -32
- package/dist/cjs/api/resources/products/client/Client.d.ts +23 -22
- package/dist/cjs/api/resources/products/client/Client.js +158 -55
- package/dist/cjs/api/resources/products/client/requests/index.d.ts +1 -1
- package/dist/cjs/api/resources/products/client/requests/index.js +0 -3
- package/dist/cjs/api/resources/traces/client/Client.d.ts +9 -8
- package/dist/cjs/api/resources/traces/client/Client.js +57 -23
- package/dist/cjs/api/resources/usage/client/Client.d.ts +13 -12
- package/dist/cjs/api/resources/usage/client/Client.js +68 -25
- package/dist/cjs/core/auth/AuthProvider.d.ts +1 -4
- package/dist/cjs/core/auth/BearerToken.d.ts +1 -3
- package/dist/cjs/core/auth/BearerToken.js +6 -7
- package/dist/cjs/core/auth/index.d.ts +0 -1
- package/dist/cjs/core/auth/index.js +1 -3
- package/dist/cjs/core/fetcher/BinaryResponse.d.ts +7 -6
- package/dist/cjs/core/fetcher/EndpointSupplier.d.ts +2 -2
- package/dist/cjs/core/fetcher/Fetcher.d.ts +4 -10
- package/dist/cjs/core/fetcher/Fetcher.js +10 -204
- package/dist/cjs/core/fetcher/ResponseWithBody.d.ts +4 -0
- package/dist/cjs/core/fetcher/ResponseWithBody.js +6 -0
- package/dist/cjs/core/fetcher/getRequestBody.d.ts +1 -1
- package/dist/cjs/core/fetcher/getRequestBody.js +0 -4
- package/dist/cjs/core/fetcher/getResponseBody.js +4 -18
- package/dist/cjs/core/fetcher/makeRequest.d.ts +1 -1
- package/dist/cjs/core/fetcher/makeRequest.js +2 -0
- package/dist/cjs/core/fetcher/requestWithRetries.js +9 -0
- package/dist/cjs/core/fetcher/signals.d.ts +7 -1
- package/dist/cjs/core/fetcher/signals.js +12 -0
- package/dist/cjs/core/headers.d.ts +2 -2
- package/dist/cjs/core/headers.js +4 -6
- package/dist/cjs/core/index.d.ts +0 -1
- package/dist/cjs/core/index.js +1 -2
- package/dist/cjs/core/runtime/runtime.js +10 -11
- package/dist/cjs/core/url/join.js +1 -0
- package/dist/cjs/errors/PaidError.js +1 -5
- package/dist/cjs/errors/PaidTimeoutError.js +1 -5
- package/dist/cjs/index.d.ts +0 -1
- package/dist/cjs/index.js +0 -4
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.d.mts +4 -17
- package/dist/esm/BaseClient.mjs +1 -24
- package/dist/esm/Client.d.mts +28 -28
- package/dist/esm/Client.mjs +27 -19
- package/dist/esm/api/errors/BadRequestError.mjs +1 -5
- package/dist/esm/api/errors/ForbiddenError.mjs +1 -5
- package/dist/esm/api/errors/InternalServerError.mjs +1 -5
- package/dist/esm/api/errors/NotFoundError.mjs +1 -5
- package/dist/esm/api/resources/agents/client/Client.d.mts +23 -22
- package/dist/esm/api/resources/agents/client/Client.mjs +157 -54
- package/dist/esm/api/resources/contacts/client/Client.d.mts +19 -18
- package/dist/esm/api/resources/contacts/client/Client.mjs +121 -42
- package/dist/esm/api/resources/customers/client/Client.d.mts +37 -36
- package/dist/esm/api/resources/customers/client/Client.mjs +314 -112
- package/dist/esm/api/resources/orders/client/Client.d.mts +28 -27
- package/dist/esm/api/resources/orders/client/Client.mjs +177 -62
- package/dist/esm/api/resources/orders/resources/lines/client/Client.d.mts +9 -8
- package/dist/esm/api/resources/orders/resources/lines/client/Client.mjs +31 -12
- package/dist/esm/api/resources/plans/client/Client.d.mts +13 -12
- package/dist/esm/api/resources/plans/client/Client.mjs +81 -31
- package/dist/esm/api/resources/products/client/Client.d.mts +23 -22
- package/dist/esm/api/resources/products/client/Client.mjs +157 -54
- package/dist/esm/api/resources/products/client/requests/index.d.mts +1 -1
- package/dist/esm/api/resources/products/client/requests/index.mjs +1 -1
- package/dist/esm/api/resources/traces/client/Client.d.mts +9 -8
- package/dist/esm/api/resources/traces/client/Client.mjs +56 -22
- package/dist/esm/api/resources/usage/client/Client.d.mts +13 -12
- package/dist/esm/api/resources/usage/client/Client.mjs +67 -24
- package/dist/esm/core/auth/AuthProvider.d.mts +1 -4
- package/dist/esm/core/auth/BearerToken.d.mts +1 -3
- package/dist/esm/core/auth/BearerToken.mjs +6 -7
- package/dist/esm/core/auth/index.d.mts +0 -1
- package/dist/esm/core/auth/index.mjs +0 -1
- package/dist/esm/core/fetcher/BinaryResponse.d.mts +7 -6
- package/dist/esm/core/fetcher/EndpointSupplier.d.mts +2 -2
- package/dist/esm/core/fetcher/Fetcher.d.mts +4 -10
- package/dist/esm/core/fetcher/Fetcher.mjs +10 -204
- package/dist/esm/core/fetcher/ResponseWithBody.d.mts +4 -0
- package/dist/esm/core/fetcher/ResponseWithBody.mjs +3 -0
- package/dist/esm/core/fetcher/getRequestBody.d.mts +1 -1
- package/dist/esm/core/fetcher/getRequestBody.mjs +0 -4
- package/dist/esm/core/fetcher/getResponseBody.mjs +4 -18
- package/dist/esm/core/fetcher/makeRequest.d.mts +1 -1
- package/dist/esm/core/fetcher/makeRequest.mjs +2 -0
- package/dist/esm/core/fetcher/requestWithRetries.mjs +9 -0
- package/dist/esm/core/fetcher/signals.d.mts +7 -1
- package/dist/esm/core/fetcher/signals.mjs +12 -0
- package/dist/esm/core/headers.d.mts +2 -2
- package/dist/esm/core/headers.mjs +4 -6
- package/dist/esm/core/index.d.mts +0 -1
- package/dist/esm/core/index.mjs +0 -1
- package/dist/esm/core/runtime/runtime.mjs +10 -11
- package/dist/esm/core/url/join.mjs +1 -0
- package/dist/esm/errors/PaidError.mjs +1 -5
- package/dist/esm/errors/PaidTimeoutError.mjs +1 -5
- package/dist/esm/index.d.mts +0 -1
- package/dist/esm/index.mjs +0 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +3 -6
- package/reference.md +54 -54
- package/dist/cjs/auth/BearerAuthProvider.d.ts +0 -20
- package/dist/cjs/auth/BearerAuthProvider.js +0 -79
- package/dist/cjs/auth/index.d.ts +0 -1
- package/dist/cjs/auth/index.js +0 -5
- package/dist/cjs/core/auth/NoOpAuthProvider.d.ts +0 -5
- package/dist/cjs/core/auth/NoOpAuthProvider.js +0 -9
- package/dist/cjs/core/exports.d.ts +0 -1
- package/dist/cjs/core/exports.js +0 -17
- package/dist/cjs/core/logging/exports.d.ts +0 -18
- package/dist/cjs/core/logging/exports.js +0 -45
- package/dist/cjs/core/logging/index.d.ts +0 -1
- package/dist/cjs/core/logging/index.js +0 -17
- package/dist/cjs/core/logging/logger.d.ts +0 -126
- package/dist/cjs/core/logging/logger.js +0 -144
- package/dist/cjs/errors/handleNonStatusCodeError.d.ts +0 -2
- package/dist/cjs/errors/handleNonStatusCodeError.js +0 -65
- package/dist/cjs/exports.d.ts +0 -1
- package/dist/cjs/exports.js +0 -17
- package/dist/esm/auth/BearerAuthProvider.d.mts +0 -20
- package/dist/esm/auth/BearerAuthProvider.mjs +0 -42
- package/dist/esm/auth/index.d.mts +0 -1
- package/dist/esm/auth/index.mjs +0 -1
- package/dist/esm/core/auth/NoOpAuthProvider.d.mts +0 -5
- package/dist/esm/core/auth/NoOpAuthProvider.mjs +0 -5
- package/dist/esm/core/exports.d.mts +0 -1
- package/dist/esm/core/exports.mjs +0 -1
- package/dist/esm/core/logging/exports.d.mts +0 -18
- package/dist/esm/core/logging/exports.mjs +0 -9
- package/dist/esm/core/logging/index.d.mts +0 -1
- package/dist/esm/core/logging/index.mjs +0 -1
- package/dist/esm/core/logging/logger.d.mts +0 -126
- package/dist/esm/core/logging/logger.mjs +0 -138
- package/dist/esm/errors/handleNonStatusCodeError.d.mts +0 -2
- package/dist/esm/errors/handleNonStatusCodeError.mjs +0 -29
- package/dist/esm/exports.d.mts +0 -1
- package/dist/esm/exports.mjs +0 -1
|
@@ -8,19 +8,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
import {
|
|
12
|
-
import { mergeHeaders } from "../../../../core/headers.mjs";
|
|
11
|
+
import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
|
|
13
12
|
import * as core from "../../../../core/index.mjs";
|
|
14
13
|
import * as environments from "../../../../environments.mjs";
|
|
15
|
-
import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.mjs";
|
|
16
14
|
import * as errors from "../../../../errors/index.mjs";
|
|
17
15
|
import * as Paid from "../../../index.mjs";
|
|
18
|
-
export class
|
|
19
|
-
constructor(
|
|
20
|
-
this._options =
|
|
16
|
+
export class Customers {
|
|
17
|
+
constructor(_options = {}) {
|
|
18
|
+
this._options = _options;
|
|
21
19
|
}
|
|
22
20
|
/**
|
|
23
|
-
* @param {
|
|
21
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
24
22
|
*
|
|
25
23
|
* @example
|
|
26
24
|
* await client.customers.list()
|
|
@@ -30,8 +28,8 @@ export class CustomersClient {
|
|
|
30
28
|
}
|
|
31
29
|
__list(requestOptions) {
|
|
32
30
|
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
34
|
-
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
31
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
32
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
35
33
|
const _response = yield core.fetcher({
|
|
36
34
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Production, "customers"),
|
|
37
35
|
method: "GET",
|
|
@@ -40,8 +38,6 @@ export class CustomersClient {
|
|
|
40
38
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
41
39
|
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
42
40
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
43
|
-
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
44
|
-
logging: this._options.logging,
|
|
45
41
|
});
|
|
46
42
|
if (_response.ok) {
|
|
47
43
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
@@ -53,12 +49,26 @@ export class CustomersClient {
|
|
|
53
49
|
rawResponse: _response.rawResponse,
|
|
54
50
|
});
|
|
55
51
|
}
|
|
56
|
-
|
|
52
|
+
switch (_response.error.reason) {
|
|
53
|
+
case "non-json":
|
|
54
|
+
throw new errors.PaidError({
|
|
55
|
+
statusCode: _response.error.statusCode,
|
|
56
|
+
body: _response.error.rawBody,
|
|
57
|
+
rawResponse: _response.rawResponse,
|
|
58
|
+
});
|
|
59
|
+
case "timeout":
|
|
60
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers.");
|
|
61
|
+
case "unknown":
|
|
62
|
+
throw new errors.PaidError({
|
|
63
|
+
message: _response.error.errorMessage,
|
|
64
|
+
rawResponse: _response.rawResponse,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
57
67
|
});
|
|
58
68
|
}
|
|
59
69
|
/**
|
|
60
70
|
* @param {Paid.CustomerCreate} request
|
|
61
|
-
* @param {
|
|
71
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
62
72
|
*
|
|
63
73
|
* @example
|
|
64
74
|
* await client.customers.create({
|
|
@@ -84,8 +94,8 @@ export class CustomersClient {
|
|
|
84
94
|
}
|
|
85
95
|
__create(request, requestOptions) {
|
|
86
96
|
return __awaiter(this, void 0, void 0, function* () {
|
|
87
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
88
|
-
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
97
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
98
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
89
99
|
const _response = yield core.fetcher({
|
|
90
100
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Production, "customers"),
|
|
91
101
|
method: "POST",
|
|
@@ -97,8 +107,6 @@ export class CustomersClient {
|
|
|
97
107
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
98
108
|
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
99
109
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
100
|
-
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
101
|
-
logging: this._options.logging,
|
|
102
110
|
});
|
|
103
111
|
if (_response.ok) {
|
|
104
112
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
@@ -110,12 +118,26 @@ export class CustomersClient {
|
|
|
110
118
|
rawResponse: _response.rawResponse,
|
|
111
119
|
});
|
|
112
120
|
}
|
|
113
|
-
|
|
121
|
+
switch (_response.error.reason) {
|
|
122
|
+
case "non-json":
|
|
123
|
+
throw new errors.PaidError({
|
|
124
|
+
statusCode: _response.error.statusCode,
|
|
125
|
+
body: _response.error.rawBody,
|
|
126
|
+
rawResponse: _response.rawResponse,
|
|
127
|
+
});
|
|
128
|
+
case "timeout":
|
|
129
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /customers.");
|
|
130
|
+
case "unknown":
|
|
131
|
+
throw new errors.PaidError({
|
|
132
|
+
message: _response.error.errorMessage,
|
|
133
|
+
rawResponse: _response.rawResponse,
|
|
134
|
+
});
|
|
135
|
+
}
|
|
114
136
|
});
|
|
115
137
|
}
|
|
116
138
|
/**
|
|
117
139
|
* @param {string} customerId
|
|
118
|
-
* @param {
|
|
140
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
119
141
|
*
|
|
120
142
|
* @example
|
|
121
143
|
* await client.customers.get("customerId")
|
|
@@ -125,8 +147,8 @@ export class CustomersClient {
|
|
|
125
147
|
}
|
|
126
148
|
__get(customerId, requestOptions) {
|
|
127
149
|
return __awaiter(this, void 0, void 0, function* () {
|
|
128
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
129
|
-
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
150
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
151
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
130
152
|
const _response = yield core.fetcher({
|
|
131
153
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Production, `customers/${core.url.encodePathParam(customerId)}`),
|
|
132
154
|
method: "GET",
|
|
@@ -135,8 +157,6 @@ export class CustomersClient {
|
|
|
135
157
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
136
158
|
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
137
159
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
138
|
-
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
139
|
-
logging: this._options.logging,
|
|
140
160
|
});
|
|
141
161
|
if (_response.ok) {
|
|
142
162
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
@@ -148,13 +168,27 @@ export class CustomersClient {
|
|
|
148
168
|
rawResponse: _response.rawResponse,
|
|
149
169
|
});
|
|
150
170
|
}
|
|
151
|
-
|
|
171
|
+
switch (_response.error.reason) {
|
|
172
|
+
case "non-json":
|
|
173
|
+
throw new errors.PaidError({
|
|
174
|
+
statusCode: _response.error.statusCode,
|
|
175
|
+
body: _response.error.rawBody,
|
|
176
|
+
rawResponse: _response.rawResponse,
|
|
177
|
+
});
|
|
178
|
+
case "timeout":
|
|
179
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/{customerId}.");
|
|
180
|
+
case "unknown":
|
|
181
|
+
throw new errors.PaidError({
|
|
182
|
+
message: _response.error.errorMessage,
|
|
183
|
+
rawResponse: _response.rawResponse,
|
|
184
|
+
});
|
|
185
|
+
}
|
|
152
186
|
});
|
|
153
187
|
}
|
|
154
188
|
/**
|
|
155
189
|
* @param {string} customerId
|
|
156
190
|
* @param {Paid.CustomerUpdate} request
|
|
157
|
-
* @param {
|
|
191
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
158
192
|
*
|
|
159
193
|
* @example
|
|
160
194
|
* await client.customers.update("customerId", {
|
|
@@ -169,8 +203,8 @@ export class CustomersClient {
|
|
|
169
203
|
}
|
|
170
204
|
__update(customerId, request, requestOptions) {
|
|
171
205
|
return __awaiter(this, void 0, void 0, function* () {
|
|
172
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
173
|
-
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
206
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
207
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
174
208
|
const _response = yield core.fetcher({
|
|
175
209
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Production, `customers/${core.url.encodePathParam(customerId)}`),
|
|
176
210
|
method: "PUT",
|
|
@@ -182,8 +216,6 @@ export class CustomersClient {
|
|
|
182
216
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
183
217
|
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
184
218
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
185
|
-
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
186
|
-
logging: this._options.logging,
|
|
187
219
|
});
|
|
188
220
|
if (_response.ok) {
|
|
189
221
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
@@ -195,12 +227,26 @@ export class CustomersClient {
|
|
|
195
227
|
rawResponse: _response.rawResponse,
|
|
196
228
|
});
|
|
197
229
|
}
|
|
198
|
-
|
|
230
|
+
switch (_response.error.reason) {
|
|
231
|
+
case "non-json":
|
|
232
|
+
throw new errors.PaidError({
|
|
233
|
+
statusCode: _response.error.statusCode,
|
|
234
|
+
body: _response.error.rawBody,
|
|
235
|
+
rawResponse: _response.rawResponse,
|
|
236
|
+
});
|
|
237
|
+
case "timeout":
|
|
238
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling PUT /customers/{customerId}.");
|
|
239
|
+
case "unknown":
|
|
240
|
+
throw new errors.PaidError({
|
|
241
|
+
message: _response.error.errorMessage,
|
|
242
|
+
rawResponse: _response.rawResponse,
|
|
243
|
+
});
|
|
244
|
+
}
|
|
199
245
|
});
|
|
200
246
|
}
|
|
201
247
|
/**
|
|
202
248
|
* @param {string} customerId
|
|
203
|
-
* @param {
|
|
249
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
204
250
|
*
|
|
205
251
|
* @example
|
|
206
252
|
* await client.customers.delete("customerId")
|
|
@@ -210,8 +256,8 @@ export class CustomersClient {
|
|
|
210
256
|
}
|
|
211
257
|
__delete(customerId, requestOptions) {
|
|
212
258
|
return __awaiter(this, void 0, void 0, function* () {
|
|
213
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
214
|
-
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
259
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
260
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
215
261
|
const _response = yield core.fetcher({
|
|
216
262
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Production, `customers/${core.url.encodePathParam(customerId)}`),
|
|
217
263
|
method: "DELETE",
|
|
@@ -220,8 +266,6 @@ export class CustomersClient {
|
|
|
220
266
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
221
267
|
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
222
268
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
223
|
-
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
224
|
-
logging: this._options.logging,
|
|
225
269
|
});
|
|
226
270
|
if (_response.ok) {
|
|
227
271
|
return { data: undefined, rawResponse: _response.rawResponse };
|
|
@@ -233,13 +277,27 @@ export class CustomersClient {
|
|
|
233
277
|
rawResponse: _response.rawResponse,
|
|
234
278
|
});
|
|
235
279
|
}
|
|
236
|
-
|
|
280
|
+
switch (_response.error.reason) {
|
|
281
|
+
case "non-json":
|
|
282
|
+
throw new errors.PaidError({
|
|
283
|
+
statusCode: _response.error.statusCode,
|
|
284
|
+
body: _response.error.rawBody,
|
|
285
|
+
rawResponse: _response.rawResponse,
|
|
286
|
+
});
|
|
287
|
+
case "timeout":
|
|
288
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling DELETE /customers/{customerId}.");
|
|
289
|
+
case "unknown":
|
|
290
|
+
throw new errors.PaidError({
|
|
291
|
+
message: _response.error.errorMessage,
|
|
292
|
+
rawResponse: _response.rawResponse,
|
|
293
|
+
});
|
|
294
|
+
}
|
|
237
295
|
});
|
|
238
296
|
}
|
|
239
297
|
/**
|
|
240
298
|
* @param {string} customerId - The customer ID
|
|
241
299
|
* @param {Paid.CustomersCheckEntitlementRequest} request
|
|
242
|
-
* @param {
|
|
300
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
243
301
|
*
|
|
244
302
|
* @throws {@link Paid.BadRequestError}
|
|
245
303
|
* @throws {@link Paid.NotFoundError}
|
|
@@ -255,13 +313,14 @@ export class CustomersClient {
|
|
|
255
313
|
}
|
|
256
314
|
__checkEntitlement(customerId, request, requestOptions) {
|
|
257
315
|
return __awaiter(this, void 0, void 0, function* () {
|
|
258
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
316
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
259
317
|
const { event_name: eventName, view } = request;
|
|
260
|
-
const _queryParams = {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
318
|
+
const _queryParams = {};
|
|
319
|
+
_queryParams.event_name = eventName;
|
|
320
|
+
if (view != null) {
|
|
321
|
+
_queryParams.view = view;
|
|
322
|
+
}
|
|
323
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
265
324
|
const _response = yield core.fetcher({
|
|
266
325
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Production, `customers/${core.url.encodePathParam(customerId)}/entitlement`),
|
|
267
326
|
method: "GET",
|
|
@@ -270,8 +329,6 @@ export class CustomersClient {
|
|
|
270
329
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
271
330
|
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
272
331
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
273
|
-
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
274
|
-
logging: this._options.logging,
|
|
275
332
|
});
|
|
276
333
|
if (_response.ok) {
|
|
277
334
|
return {
|
|
@@ -293,12 +350,26 @@ export class CustomersClient {
|
|
|
293
350
|
});
|
|
294
351
|
}
|
|
295
352
|
}
|
|
296
|
-
|
|
353
|
+
switch (_response.error.reason) {
|
|
354
|
+
case "non-json":
|
|
355
|
+
throw new errors.PaidError({
|
|
356
|
+
statusCode: _response.error.statusCode,
|
|
357
|
+
body: _response.error.rawBody,
|
|
358
|
+
rawResponse: _response.rawResponse,
|
|
359
|
+
});
|
|
360
|
+
case "timeout":
|
|
361
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/{customerId}/entitlement.");
|
|
362
|
+
case "unknown":
|
|
363
|
+
throw new errors.PaidError({
|
|
364
|
+
message: _response.error.errorMessage,
|
|
365
|
+
rawResponse: _response.rawResponse,
|
|
366
|
+
});
|
|
367
|
+
}
|
|
297
368
|
});
|
|
298
369
|
}
|
|
299
370
|
/**
|
|
300
371
|
* @param {string} customerId - The customer ID
|
|
301
|
-
* @param {
|
|
372
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
302
373
|
*
|
|
303
374
|
* @throws {@link Paid.ForbiddenError}
|
|
304
375
|
*
|
|
@@ -310,8 +381,8 @@ export class CustomersClient {
|
|
|
310
381
|
}
|
|
311
382
|
__getEntitlements(customerId, requestOptions) {
|
|
312
383
|
return __awaiter(this, void 0, void 0, function* () {
|
|
313
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
314
|
-
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
384
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
385
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
315
386
|
const _response = yield core.fetcher({
|
|
316
387
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Production, `customers/${core.url.encodePathParam(customerId)}/credit-bundles`),
|
|
317
388
|
method: "GET",
|
|
@@ -320,8 +391,6 @@ export class CustomersClient {
|
|
|
320
391
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
321
392
|
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
322
393
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
323
|
-
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
324
|
-
logging: this._options.logging,
|
|
325
394
|
});
|
|
326
395
|
if (_response.ok) {
|
|
327
396
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
@@ -338,12 +407,26 @@ export class CustomersClient {
|
|
|
338
407
|
});
|
|
339
408
|
}
|
|
340
409
|
}
|
|
341
|
-
|
|
410
|
+
switch (_response.error.reason) {
|
|
411
|
+
case "non-json":
|
|
412
|
+
throw new errors.PaidError({
|
|
413
|
+
statusCode: _response.error.statusCode,
|
|
414
|
+
body: _response.error.rawBody,
|
|
415
|
+
rawResponse: _response.rawResponse,
|
|
416
|
+
});
|
|
417
|
+
case "timeout":
|
|
418
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/{customerId}/credit-bundles.");
|
|
419
|
+
case "unknown":
|
|
420
|
+
throw new errors.PaidError({
|
|
421
|
+
message: _response.error.errorMessage,
|
|
422
|
+
rawResponse: _response.rawResponse,
|
|
423
|
+
});
|
|
424
|
+
}
|
|
342
425
|
});
|
|
343
426
|
}
|
|
344
427
|
/**
|
|
345
428
|
* @param {string} externalId
|
|
346
|
-
* @param {
|
|
429
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
347
430
|
*
|
|
348
431
|
* @example
|
|
349
432
|
* await client.customers.getByExternalId("externalId")
|
|
@@ -353,8 +436,8 @@ export class CustomersClient {
|
|
|
353
436
|
}
|
|
354
437
|
__getByExternalId(externalId, requestOptions) {
|
|
355
438
|
return __awaiter(this, void 0, void 0, function* () {
|
|
356
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
357
|
-
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
439
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
440
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
358
441
|
const _response = yield core.fetcher({
|
|
359
442
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Production, `customers/external/${core.url.encodePathParam(externalId)}`),
|
|
360
443
|
method: "GET",
|
|
@@ -363,8 +446,6 @@ export class CustomersClient {
|
|
|
363
446
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
364
447
|
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
365
448
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
366
|
-
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
367
|
-
logging: this._options.logging,
|
|
368
449
|
});
|
|
369
450
|
if (_response.ok) {
|
|
370
451
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
@@ -376,13 +457,27 @@ export class CustomersClient {
|
|
|
376
457
|
rawResponse: _response.rawResponse,
|
|
377
458
|
});
|
|
378
459
|
}
|
|
379
|
-
|
|
460
|
+
switch (_response.error.reason) {
|
|
461
|
+
case "non-json":
|
|
462
|
+
throw new errors.PaidError({
|
|
463
|
+
statusCode: _response.error.statusCode,
|
|
464
|
+
body: _response.error.rawBody,
|
|
465
|
+
rawResponse: _response.rawResponse,
|
|
466
|
+
});
|
|
467
|
+
case "timeout":
|
|
468
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/external/{externalId}.");
|
|
469
|
+
case "unknown":
|
|
470
|
+
throw new errors.PaidError({
|
|
471
|
+
message: _response.error.errorMessage,
|
|
472
|
+
rawResponse: _response.rawResponse,
|
|
473
|
+
});
|
|
474
|
+
}
|
|
380
475
|
});
|
|
381
476
|
}
|
|
382
477
|
/**
|
|
383
478
|
* @param {string} externalId
|
|
384
479
|
* @param {Paid.CustomerUpdate} request
|
|
385
|
-
* @param {
|
|
480
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
386
481
|
*
|
|
387
482
|
* @example
|
|
388
483
|
* await client.customers.updateByExternalId("externalId", {})
|
|
@@ -392,8 +487,8 @@ export class CustomersClient {
|
|
|
392
487
|
}
|
|
393
488
|
__updateByExternalId(externalId, request, requestOptions) {
|
|
394
489
|
return __awaiter(this, void 0, void 0, function* () {
|
|
395
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
396
|
-
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
490
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
491
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
397
492
|
const _response = yield core.fetcher({
|
|
398
493
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Production, `customers/external/${core.url.encodePathParam(externalId)}`),
|
|
399
494
|
method: "PUT",
|
|
@@ -405,8 +500,6 @@ export class CustomersClient {
|
|
|
405
500
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
406
501
|
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
407
502
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
408
|
-
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
409
|
-
logging: this._options.logging,
|
|
410
503
|
});
|
|
411
504
|
if (_response.ok) {
|
|
412
505
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
@@ -418,12 +511,26 @@ export class CustomersClient {
|
|
|
418
511
|
rawResponse: _response.rawResponse,
|
|
419
512
|
});
|
|
420
513
|
}
|
|
421
|
-
|
|
514
|
+
switch (_response.error.reason) {
|
|
515
|
+
case "non-json":
|
|
516
|
+
throw new errors.PaidError({
|
|
517
|
+
statusCode: _response.error.statusCode,
|
|
518
|
+
body: _response.error.rawBody,
|
|
519
|
+
rawResponse: _response.rawResponse,
|
|
520
|
+
});
|
|
521
|
+
case "timeout":
|
|
522
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling PUT /customers/external/{externalId}.");
|
|
523
|
+
case "unknown":
|
|
524
|
+
throw new errors.PaidError({
|
|
525
|
+
message: _response.error.errorMessage,
|
|
526
|
+
rawResponse: _response.rawResponse,
|
|
527
|
+
});
|
|
528
|
+
}
|
|
422
529
|
});
|
|
423
530
|
}
|
|
424
531
|
/**
|
|
425
532
|
* @param {string} externalId
|
|
426
|
-
* @param {
|
|
533
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
427
534
|
*
|
|
428
535
|
* @example
|
|
429
536
|
* await client.customers.deleteByExternalId("externalId")
|
|
@@ -433,8 +540,8 @@ export class CustomersClient {
|
|
|
433
540
|
}
|
|
434
541
|
__deleteByExternalId(externalId, requestOptions) {
|
|
435
542
|
return __awaiter(this, void 0, void 0, function* () {
|
|
436
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
437
|
-
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
543
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
544
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
438
545
|
const _response = yield core.fetcher({
|
|
439
546
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Production, `customers/external/${core.url.encodePathParam(externalId)}`),
|
|
440
547
|
method: "DELETE",
|
|
@@ -443,8 +550,6 @@ export class CustomersClient {
|
|
|
443
550
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
444
551
|
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
445
552
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
446
|
-
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
447
|
-
logging: this._options.logging,
|
|
448
553
|
});
|
|
449
554
|
if (_response.ok) {
|
|
450
555
|
return { data: undefined, rawResponse: _response.rawResponse };
|
|
@@ -456,13 +561,27 @@ export class CustomersClient {
|
|
|
456
561
|
rawResponse: _response.rawResponse,
|
|
457
562
|
});
|
|
458
563
|
}
|
|
459
|
-
|
|
564
|
+
switch (_response.error.reason) {
|
|
565
|
+
case "non-json":
|
|
566
|
+
throw new errors.PaidError({
|
|
567
|
+
statusCode: _response.error.statusCode,
|
|
568
|
+
body: _response.error.rawBody,
|
|
569
|
+
rawResponse: _response.rawResponse,
|
|
570
|
+
});
|
|
571
|
+
case "timeout":
|
|
572
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling DELETE /customers/external/{externalId}.");
|
|
573
|
+
case "unknown":
|
|
574
|
+
throw new errors.PaidError({
|
|
575
|
+
message: _response.error.errorMessage,
|
|
576
|
+
rawResponse: _response.rawResponse,
|
|
577
|
+
});
|
|
578
|
+
}
|
|
460
579
|
});
|
|
461
580
|
}
|
|
462
581
|
/**
|
|
463
582
|
* @param {string} externalId - The external ID of the customer
|
|
464
583
|
* @param {Paid.CustomersGetCostsByExternalIdRequest} request
|
|
465
|
-
* @param {
|
|
584
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
466
585
|
*
|
|
467
586
|
* @throws {@link Paid.BadRequestError}
|
|
468
587
|
* @throws {@link Paid.ForbiddenError}
|
|
@@ -481,15 +600,22 @@ export class CustomersClient {
|
|
|
481
600
|
}
|
|
482
601
|
__getCostsByExternalId(externalId_1) {
|
|
483
602
|
return __awaiter(this, arguments, void 0, function* (externalId, request = {}, requestOptions) {
|
|
484
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
603
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
485
604
|
const { limit, offset, startTime, endTime } = request;
|
|
486
|
-
const _queryParams = {
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
605
|
+
const _queryParams = {};
|
|
606
|
+
if (limit != null) {
|
|
607
|
+
_queryParams.limit = limit.toString();
|
|
608
|
+
}
|
|
609
|
+
if (offset != null) {
|
|
610
|
+
_queryParams.offset = offset.toString();
|
|
611
|
+
}
|
|
612
|
+
if (startTime != null) {
|
|
613
|
+
_queryParams.startTime = startTime;
|
|
614
|
+
}
|
|
615
|
+
if (endTime != null) {
|
|
616
|
+
_queryParams.endTime = endTime;
|
|
617
|
+
}
|
|
618
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
493
619
|
const _response = yield core.fetcher({
|
|
494
620
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Production, `customers/external/${core.url.encodePathParam(externalId)}/costs`),
|
|
495
621
|
method: "GET",
|
|
@@ -498,8 +624,6 @@ export class CustomersClient {
|
|
|
498
624
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
499
625
|
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
500
626
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
501
|
-
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
502
|
-
logging: this._options.logging,
|
|
503
627
|
});
|
|
504
628
|
if (_response.ok) {
|
|
505
629
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
@@ -520,13 +644,27 @@ export class CustomersClient {
|
|
|
520
644
|
});
|
|
521
645
|
}
|
|
522
646
|
}
|
|
523
|
-
|
|
647
|
+
switch (_response.error.reason) {
|
|
648
|
+
case "non-json":
|
|
649
|
+
throw new errors.PaidError({
|
|
650
|
+
statusCode: _response.error.statusCode,
|
|
651
|
+
body: _response.error.rawBody,
|
|
652
|
+
rawResponse: _response.rawResponse,
|
|
653
|
+
});
|
|
654
|
+
case "timeout":
|
|
655
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/external/{externalId}/costs.");
|
|
656
|
+
case "unknown":
|
|
657
|
+
throw new errors.PaidError({
|
|
658
|
+
message: _response.error.errorMessage,
|
|
659
|
+
rawResponse: _response.rawResponse,
|
|
660
|
+
});
|
|
661
|
+
}
|
|
524
662
|
});
|
|
525
663
|
}
|
|
526
664
|
/**
|
|
527
665
|
* @param {string} externalId - The external ID of the customer
|
|
528
666
|
* @param {Paid.CustomersGetUsageByExternalIdRequest} request
|
|
529
|
-
* @param {
|
|
667
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
530
668
|
*
|
|
531
669
|
* @throws {@link Paid.BadRequestError}
|
|
532
670
|
* @throws {@link Paid.ForbiddenError}
|
|
@@ -545,15 +683,22 @@ export class CustomersClient {
|
|
|
545
683
|
}
|
|
546
684
|
__getUsageByExternalId(externalId_1) {
|
|
547
685
|
return __awaiter(this, arguments, void 0, function* (externalId, request = {}, requestOptions) {
|
|
548
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
686
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
549
687
|
const { limit, offset, startTime, endTime } = request;
|
|
550
|
-
const _queryParams = {
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
688
|
+
const _queryParams = {};
|
|
689
|
+
if (limit != null) {
|
|
690
|
+
_queryParams.limit = limit.toString();
|
|
691
|
+
}
|
|
692
|
+
if (offset != null) {
|
|
693
|
+
_queryParams.offset = offset.toString();
|
|
694
|
+
}
|
|
695
|
+
if (startTime != null) {
|
|
696
|
+
_queryParams.startTime = startTime;
|
|
697
|
+
}
|
|
698
|
+
if (endTime != null) {
|
|
699
|
+
_queryParams.endTime = endTime;
|
|
700
|
+
}
|
|
701
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
557
702
|
const _response = yield core.fetcher({
|
|
558
703
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Production, `customers/external/${core.url.encodePathParam(externalId)}/usage`),
|
|
559
704
|
method: "GET",
|
|
@@ -562,8 +707,6 @@ export class CustomersClient {
|
|
|
562
707
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
563
708
|
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
564
709
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
565
|
-
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
566
|
-
logging: this._options.logging,
|
|
567
710
|
});
|
|
568
711
|
if (_response.ok) {
|
|
569
712
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
@@ -584,14 +727,28 @@ export class CustomersClient {
|
|
|
584
727
|
});
|
|
585
728
|
}
|
|
586
729
|
}
|
|
587
|
-
|
|
730
|
+
switch (_response.error.reason) {
|
|
731
|
+
case "non-json":
|
|
732
|
+
throw new errors.PaidError({
|
|
733
|
+
statusCode: _response.error.statusCode,
|
|
734
|
+
body: _response.error.rawBody,
|
|
735
|
+
rawResponse: _response.rawResponse,
|
|
736
|
+
});
|
|
737
|
+
case "timeout":
|
|
738
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/external/{externalId}/usage.");
|
|
739
|
+
case "unknown":
|
|
740
|
+
throw new errors.PaidError({
|
|
741
|
+
message: _response.error.errorMessage,
|
|
742
|
+
rawResponse: _response.rawResponse,
|
|
743
|
+
});
|
|
744
|
+
}
|
|
588
745
|
});
|
|
589
746
|
}
|
|
590
747
|
/**
|
|
591
748
|
* Retrieves all payment methods associated with a customer identified by their external ID.
|
|
592
749
|
*
|
|
593
750
|
* @param {string} externalId - The external ID of the customer
|
|
594
|
-
* @param {
|
|
751
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
595
752
|
*
|
|
596
753
|
* @throws {@link Paid.ForbiddenError}
|
|
597
754
|
* @throws {@link Paid.NotFoundError}
|
|
@@ -604,8 +761,8 @@ export class CustomersClient {
|
|
|
604
761
|
}
|
|
605
762
|
__listPaymentMethods(externalId, requestOptions) {
|
|
606
763
|
return __awaiter(this, void 0, void 0, function* () {
|
|
607
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
608
|
-
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
764
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
765
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
609
766
|
const _response = yield core.fetcher({
|
|
610
767
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Production, `customers/external/${core.url.encodePathParam(externalId)}/payment-methods`),
|
|
611
768
|
method: "GET",
|
|
@@ -614,8 +771,6 @@ export class CustomersClient {
|
|
|
614
771
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
615
772
|
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
616
773
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
617
|
-
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
618
|
-
logging: this._options.logging,
|
|
619
774
|
});
|
|
620
775
|
if (_response.ok) {
|
|
621
776
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
@@ -634,7 +789,21 @@ export class CustomersClient {
|
|
|
634
789
|
});
|
|
635
790
|
}
|
|
636
791
|
}
|
|
637
|
-
|
|
792
|
+
switch (_response.error.reason) {
|
|
793
|
+
case "non-json":
|
|
794
|
+
throw new errors.PaidError({
|
|
795
|
+
statusCode: _response.error.statusCode,
|
|
796
|
+
body: _response.error.rawBody,
|
|
797
|
+
rawResponse: _response.rawResponse,
|
|
798
|
+
});
|
|
799
|
+
case "timeout":
|
|
800
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/external/{externalId}/payment-methods.");
|
|
801
|
+
case "unknown":
|
|
802
|
+
throw new errors.PaidError({
|
|
803
|
+
message: _response.error.errorMessage,
|
|
804
|
+
rawResponse: _response.rawResponse,
|
|
805
|
+
});
|
|
806
|
+
}
|
|
638
807
|
});
|
|
639
808
|
}
|
|
640
809
|
/**
|
|
@@ -642,7 +811,7 @@ export class CustomersClient {
|
|
|
642
811
|
*
|
|
643
812
|
* @param {string} externalId - The external ID of the customer
|
|
644
813
|
* @param {Paid.CustomersCreatePaymentMethodRequest} request
|
|
645
|
-
* @param {
|
|
814
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
646
815
|
*
|
|
647
816
|
* @throws {@link Paid.BadRequestError}
|
|
648
817
|
* @throws {@link Paid.ForbiddenError}
|
|
@@ -662,8 +831,8 @@ export class CustomersClient {
|
|
|
662
831
|
}
|
|
663
832
|
__createPaymentMethod(externalId, request, requestOptions) {
|
|
664
833
|
return __awaiter(this, void 0, void 0, function* () {
|
|
665
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
666
|
-
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
834
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
835
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
667
836
|
const _response = yield core.fetcher({
|
|
668
837
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Production, `customers/external/${core.url.encodePathParam(externalId)}/payment-methods`),
|
|
669
838
|
method: "POST",
|
|
@@ -675,8 +844,6 @@ export class CustomersClient {
|
|
|
675
844
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
676
845
|
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
677
846
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
678
|
-
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
679
|
-
logging: this._options.logging,
|
|
680
847
|
});
|
|
681
848
|
if (_response.ok) {
|
|
682
849
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
@@ -697,7 +864,21 @@ export class CustomersClient {
|
|
|
697
864
|
});
|
|
698
865
|
}
|
|
699
866
|
}
|
|
700
|
-
|
|
867
|
+
switch (_response.error.reason) {
|
|
868
|
+
case "non-json":
|
|
869
|
+
throw new errors.PaidError({
|
|
870
|
+
statusCode: _response.error.statusCode,
|
|
871
|
+
body: _response.error.rawBody,
|
|
872
|
+
rawResponse: _response.rawResponse,
|
|
873
|
+
});
|
|
874
|
+
case "timeout":
|
|
875
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /customers/external/{externalId}/payment-methods.");
|
|
876
|
+
case "unknown":
|
|
877
|
+
throw new errors.PaidError({
|
|
878
|
+
message: _response.error.errorMessage,
|
|
879
|
+
rawResponse: _response.rawResponse,
|
|
880
|
+
});
|
|
881
|
+
}
|
|
701
882
|
});
|
|
702
883
|
}
|
|
703
884
|
/**
|
|
@@ -705,7 +886,7 @@ export class CustomersClient {
|
|
|
705
886
|
*
|
|
706
887
|
* @param {string} externalId - The external ID of the customer
|
|
707
888
|
* @param {string} paymentMethodId - The ID of the payment method to delete
|
|
708
|
-
* @param {
|
|
889
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
709
890
|
*
|
|
710
891
|
* @throws {@link Paid.ForbiddenError}
|
|
711
892
|
* @throws {@link Paid.NotFoundError}
|
|
@@ -718,8 +899,8 @@ export class CustomersClient {
|
|
|
718
899
|
}
|
|
719
900
|
__deletePaymentMethod(externalId, paymentMethodId, requestOptions) {
|
|
720
901
|
return __awaiter(this, void 0, void 0, function* () {
|
|
721
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
722
|
-
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
902
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
903
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
723
904
|
const _response = yield core.fetcher({
|
|
724
905
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Production, `customers/external/${core.url.encodePathParam(externalId)}/payment-methods/${core.url.encodePathParam(paymentMethodId)}`),
|
|
725
906
|
method: "DELETE",
|
|
@@ -728,8 +909,6 @@ export class CustomersClient {
|
|
|
728
909
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
729
910
|
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
730
911
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
731
|
-
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
732
|
-
logging: this._options.logging,
|
|
733
912
|
});
|
|
734
913
|
if (_response.ok) {
|
|
735
914
|
return { data: undefined, rawResponse: _response.rawResponse };
|
|
@@ -748,7 +927,30 @@ export class CustomersClient {
|
|
|
748
927
|
});
|
|
749
928
|
}
|
|
750
929
|
}
|
|
751
|
-
|
|
930
|
+
switch (_response.error.reason) {
|
|
931
|
+
case "non-json":
|
|
932
|
+
throw new errors.PaidError({
|
|
933
|
+
statusCode: _response.error.statusCode,
|
|
934
|
+
body: _response.error.rawBody,
|
|
935
|
+
rawResponse: _response.rawResponse,
|
|
936
|
+
});
|
|
937
|
+
case "timeout":
|
|
938
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling DELETE /customers/external/{externalId}/payment-methods/{paymentMethodId}.");
|
|
939
|
+
case "unknown":
|
|
940
|
+
throw new errors.PaidError({
|
|
941
|
+
message: _response.error.errorMessage,
|
|
942
|
+
rawResponse: _response.rawResponse,
|
|
943
|
+
});
|
|
944
|
+
}
|
|
945
|
+
});
|
|
946
|
+
}
|
|
947
|
+
_getAuthorizationHeader() {
|
|
948
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
949
|
+
const bearer = yield core.Supplier.get(this._options.token);
|
|
950
|
+
if (bearer != null) {
|
|
951
|
+
return `Bearer ${bearer}`;
|
|
952
|
+
}
|
|
953
|
+
return undefined;
|
|
752
954
|
});
|
|
753
955
|
}
|
|
754
956
|
}
|