stripe 16.3.0-beta.1 → 16.4.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 +136 -761
- package/README.md +0 -33
- package/VERSION +1 -1
- package/cjs/RequestSender.js +5 -66
- package/cjs/ResourceNamespace.js +3 -0
- package/cjs/StripeResource.js +1 -1
- package/cjs/Webhooks.js +29 -17
- package/cjs/apiVersion.js +1 -2
- package/cjs/multipart.js +4 -1
- package/cjs/resources/FinancialConnections/Accounts.js +0 -5
- package/cjs/resources/Invoices.js +0 -13
- package/cjs/resources/OAuth.js +1 -1
- package/cjs/resources/PaymentIntents.js +0 -4
- package/cjs/resources/Quotes.js +0 -32
- package/cjs/resources/SubscriptionSchedules.js +0 -4
- package/cjs/resources/Terminal/Readers.js +0 -12
- package/cjs/resources.js +10 -38
- package/cjs/stripe.core.js +13 -10
- package/cjs/utils.js +3 -30
- package/esm/RequestSender.js +6 -67
- package/esm/ResourceNamespace.js +3 -0
- package/esm/StripeResource.js +2 -2
- package/esm/Webhooks.js +29 -17
- package/esm/apiVersion.js +0 -1
- package/esm/multipart.js +5 -2
- package/esm/resources/FinancialConnections/Accounts.js +0 -5
- package/esm/resources/Invoices.js +0 -13
- package/esm/resources/OAuth.js +2 -2
- package/esm/resources/PaymentIntents.js +0 -4
- package/esm/resources/Quotes.js +0 -32
- package/esm/resources/SubscriptionSchedules.js +0 -4
- package/esm/resources/Terminal/Readers.js +0 -12
- package/esm/resources.js +0 -24
- package/esm/stripe.core.js +13 -10
- package/esm/utils.js +1 -27
- package/package.json +1 -1
- package/types/AccountLinksResource.d.ts +1 -5
- package/types/AccountSessions.d.ts +0 -15
- package/types/AccountSessionsResource.d.ts +0 -205
- package/types/Accounts.d.ts +1 -88
- package/types/AccountsResource.d.ts +0 -204
- package/types/BillingPortal/Sessions.d.ts +1 -1
- package/types/Charges.d.ts +0 -67
- package/types/ChargesResource.d.ts +0 -1294
- package/types/Checkout/Sessions.d.ts +1 -28
- package/types/Checkout/SessionsResource.d.ts +1 -15
- package/types/ConfirmationTokens.d.ts +6 -63
- package/types/Coupons.d.ts +1 -1
- package/types/CouponsResource.d.ts +1 -1
- package/types/CreditNotes.d.ts +0 -21
- package/types/CreditNotesResource.d.ts +0 -51
- package/types/CustomerSessions.d.ts +1 -1
- package/types/CustomersResource.d.ts +0 -2
- package/types/Disputes.d.ts +0 -167
- package/types/DisputesResource.d.ts +3 -120
- package/types/EventTypes.d.ts +17 -426
- package/types/Events.d.ts +1 -83
- package/types/EventsResource.d.ts +1 -1
- package/types/FinancialConnections/Accounts.d.ts +1 -29
- package/types/FinancialConnections/AccountsResource.d.ts +3 -35
- package/types/FinancialConnections/Sessions.d.ts +1 -49
- package/types/FinancialConnections/SessionsResource.d.ts +1 -38
- package/types/Identity/VerificationReports.d.ts +1 -1
- package/types/InvoiceItems.d.ts +0 -5
- package/types/InvoiceItemsResource.d.ts +0 -98
- package/types/InvoiceLineItems.d.ts +0 -22
- package/types/Invoices.d.ts +2 -121
- package/types/InvoicesResource.d.ts +1784 -5359
- package/types/Issuing/CardholdersResource.d.ts +1 -2
- package/types/LineItems.d.ts +0 -7
- package/types/Mandates.d.ts +0 -77
- package/types/PaymentIntents.d.ts +1 -474
- package/types/PaymentIntentsResource.d.ts +3377 -6725
- package/types/PaymentMethodDomains.d.ts +1 -1
- package/types/PaymentMethods.d.ts +0 -62
- package/types/PaymentMethodsResource.d.ts +0 -110
- package/types/Plans.d.ts +1 -1
- package/types/Prices.d.ts +1 -23
- package/types/PricesResource.d.ts +0 -22
- package/types/Products.d.ts +0 -39
- package/types/ProductsResource.d.ts +0 -36
- package/types/Quotes.d.ts +1 -578
- package/types/QuotesResource.d.ts +266 -3175
- package/types/SetupAttempts.d.ts +0 -14
- package/types/SetupIntents.d.ts +1 -115
- package/types/SetupIntentsResource.d.ts +3 -498
- package/types/Sources.d.ts +0 -23
- package/types/SubscriptionItems.d.ts +0 -21
- package/types/SubscriptionItemsResource.d.ts +0 -109
- package/types/SubscriptionSchedules.d.ts +0 -164
- package/types/SubscriptionSchedulesResource.d.ts +13 -1231
- package/types/Subscriptions.d.ts +3 -47
- package/types/SubscriptionsResource.d.ts +9 -352
- package/types/Terminal/Readers.d.ts +2 -279
- package/types/Terminal/ReadersResource.d.ts +1 -208
- package/types/TestHelpers/ConfirmationTokensResource.d.ts +0 -55
- package/types/TestHelpers/Treasury/ReceivedCreditsResource.d.ts +0 -26
- package/types/TestHelpers/Treasury/ReceivedDebitsResource.d.ts +0 -26
- package/types/Treasury/OutboundTransfers.d.ts +0 -26
- package/types/Treasury/OutboundTransfersResource.d.ts +0 -26
- package/types/Treasury/ReceivedCredits.d.ts +0 -26
- package/types/Treasury/ReceivedDebits.d.ts +0 -31
- package/types/WebhookEndpointsResource.d.ts +2 -50
- package/types/index.d.ts +0 -64
- package/types/lib.d.ts +0 -12
- package/cjs/resources/AccountNotices.js +0 -21
- package/cjs/resources/Capital/FinancingOffers.js +0 -21
- package/cjs/resources/Capital/FinancingSummary.js +0 -12
- package/cjs/resources/Capital/FinancingTransactions.js +0 -17
- package/cjs/resources/FinancialConnections/Institutions.js +0 -17
- package/cjs/resources/GiftCards/Cards.js +0 -23
- package/cjs/resources/GiftCards/Transactions.js +0 -33
- package/cjs/resources/Issuing/CreditUnderwritingRecords.js +0 -33
- package/cjs/resources/Margins.js +0 -22
- package/cjs/resources/Orders.js +0 -24
- package/cjs/resources/QuotePhases.js +0 -22
- package/cjs/resources/Tax/Forms.js +0 -20
- package/esm/resources/AccountNotices.js +0 -18
- package/esm/resources/Capital/FinancingOffers.js +0 -18
- package/esm/resources/Capital/FinancingSummary.js +0 -9
- package/esm/resources/Capital/FinancingTransactions.js +0 -14
- package/esm/resources/FinancialConnections/Institutions.js +0 -14
- package/esm/resources/GiftCards/Cards.js +0 -20
- package/esm/resources/GiftCards/Transactions.js +0 -30
- package/esm/resources/Issuing/CreditUnderwritingRecords.js +0 -30
- package/esm/resources/Margins.js +0 -19
- package/esm/resources/Orders.js +0 -21
- package/esm/resources/QuotePhases.js +0 -19
- package/esm/resources/Tax/Forms.js +0 -17
- package/types/AccountNotices.d.ts +0 -110
- package/types/AccountNoticesResource.d.ts +0 -98
- package/types/Capital/FinancingOffers.d.ts +0 -188
- package/types/Capital/FinancingOffersResource.d.ts +0 -97
- package/types/Capital/FinancingSummary.d.ts +0 -106
- package/types/Capital/FinancingSummaryResource.d.ts +0 -27
- package/types/Capital/FinancingTransactions.d.ts +0 -135
- package/types/Capital/FinancingTransactionsResource.d.ts +0 -68
- package/types/FinancialConnections/AccountInferredBalances.d.ts +0 -38
- package/types/FinancialConnections/Institutions.d.ts +0 -93
- package/types/FinancialConnections/InstitutionsResource.d.ts +0 -47
- package/types/GiftCards/Cards.d.ts +0 -118
- package/types/GiftCards/CardsResource.d.ts +0 -159
- package/types/GiftCards/Transactions.d.ts +0 -129
- package/types/GiftCards/TransactionsResource.d.ts +0 -201
- package/types/InvoicePayments.d.ts +0 -91
- package/types/Issuing/CreditUnderwritingRecords.d.ts +0 -446
- package/types/Issuing/CreditUnderwritingRecordsResource.d.ts +0 -1017
- package/types/Margins.d.ts +0 -56
- package/types/MarginsResource.d.ts +0 -114
- package/types/Orders.d.ts +0 -1057
- package/types/OrdersResource.d.ts +0 -2711
- package/types/QuoteLines.d.ts +0 -634
- package/types/QuotePhases.d.ts +0 -198
- package/types/QuotePhasesResource.d.ts +0 -67
- package/types/QuotePreviewInvoices.d.ts +0 -1535
- package/types/QuotePreviewSubscriptionSchedules.d.ts +0 -778
- package/types/Tax/Forms.d.ts +0 -133
- package/types/Tax/FormsResource.d.ts +0 -90
package/cjs/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.concat = exports.determineProcessUserAgentProperties = exports.validateInteger = exports.flattenAndStringify = exports.isObject = exports.emitWarning = exports.pascalToCamelCase = exports.callbackifyPromiseWithTimeout = exports.normalizeHeader = exports.normalizeHeaders = exports.removeNullish = exports.protoExtend = exports.getOptionsFromArgs = exports.getDataFromArgs = exports.extractUrlParams = exports.makeURLInterpolator = exports.stringifyRequestData = exports.isOptionsHash = void 0;
|
|
4
4
|
const qs = require("qs");
|
|
5
5
|
const OPTIONS_KEYS = [
|
|
6
6
|
'apiKey',
|
|
@@ -10,8 +10,6 @@ const OPTIONS_KEYS = [
|
|
|
10
10
|
'maxNetworkRetries',
|
|
11
11
|
'timeout',
|
|
12
12
|
'host',
|
|
13
|
-
'apiMode',
|
|
14
|
-
'additionalHeaders',
|
|
15
13
|
];
|
|
16
14
|
function isOptionsHash(o) {
|
|
17
15
|
return (o &&
|
|
@@ -23,7 +21,7 @@ exports.isOptionsHash = isOptionsHash;
|
|
|
23
21
|
* Stringifies an Object, accommodating nested objects
|
|
24
22
|
* (forming the conventional key 'parent[child]=value')
|
|
25
23
|
*/
|
|
26
|
-
function
|
|
24
|
+
function stringifyRequestData(data) {
|
|
27
25
|
return (qs
|
|
28
26
|
.stringify(data, {
|
|
29
27
|
serializeDate: (d) => Math.floor(d.getTime() / 1000).toString(),
|
|
@@ -34,7 +32,7 @@ function queryStringifyRequestData(data) {
|
|
|
34
32
|
.replace(/%5B/g, '[')
|
|
35
33
|
.replace(/%5D/g, ']'));
|
|
36
34
|
}
|
|
37
|
-
exports.
|
|
35
|
+
exports.stringifyRequestData = stringifyRequestData;
|
|
38
36
|
/**
|
|
39
37
|
* Outputs a new function with interpolated object property values.
|
|
40
38
|
* Use like so:
|
|
@@ -133,15 +131,6 @@ function getOptionsFromArgs(args) {
|
|
|
133
131
|
if (params.host) {
|
|
134
132
|
opts.host = params.host;
|
|
135
133
|
}
|
|
136
|
-
if (params.apiMode) {
|
|
137
|
-
if (params.apiMode !== 'standard' && params.apiMode !== 'preview') {
|
|
138
|
-
throw new Error(`Invalid apiMode: ${params.apiMode}. Must be one of 'standard' or 'preview'`);
|
|
139
|
-
}
|
|
140
|
-
opts.apiMode = params.apiMode;
|
|
141
|
-
}
|
|
142
|
-
if (params.additionalHeaders) {
|
|
143
|
-
opts.headers = params.additionalHeaders;
|
|
144
|
-
}
|
|
145
134
|
}
|
|
146
135
|
}
|
|
147
136
|
return opts;
|
|
@@ -316,19 +305,3 @@ function concat(arrays) {
|
|
|
316
305
|
return merged;
|
|
317
306
|
}
|
|
318
307
|
exports.concat = concat;
|
|
319
|
-
/**
|
|
320
|
-
* Replaces Date objects with Unix timestamps
|
|
321
|
-
*/
|
|
322
|
-
function dateTimeReplacer(key, value) {
|
|
323
|
-
if (this[key] instanceof Date) {
|
|
324
|
-
return Math.floor(this[key].getTime() / 1000).toString();
|
|
325
|
-
}
|
|
326
|
-
return value;
|
|
327
|
-
}
|
|
328
|
-
/**
|
|
329
|
-
* JSON stringifies an Object, replacing Date objects with Unix timestamps
|
|
330
|
-
*/
|
|
331
|
-
function jsonStringifyRequestData(data) {
|
|
332
|
-
return JSON.stringify(data, dateTimeReplacer);
|
|
333
|
-
}
|
|
334
|
-
exports.jsonStringifyRequestData = jsonStringifyRequestData;
|
package/esm/RequestSender.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { StripeAPIError, StripeAuthenticationError, StripeConnectionError, StripeError, StripePermissionError, StripeRateLimitError, } from './Error.js';
|
|
2
|
-
import { emitWarning,
|
|
2
|
+
import { emitWarning, normalizeHeaders, removeNullish, stringifyRequestData, } from './utils.js';
|
|
3
3
|
import { HttpClient } from './net/HttpClient.js';
|
|
4
|
-
import { PreviewVersion } from './apiVersion.js';
|
|
5
4
|
const MAX_RETRY_AFTER_WAIT = 60;
|
|
6
5
|
export class RequestSender {
|
|
7
6
|
constructor(stripe, maxBufferedRequestMetric) {
|
|
@@ -199,12 +198,12 @@ export class RequestSender {
|
|
|
199
198
|
}
|
|
200
199
|
return null;
|
|
201
200
|
}
|
|
202
|
-
_makeHeaders(auth,
|
|
201
|
+
_makeHeaders(auth, contentLength, apiVersion, clientUserAgent, method, userSuppliedHeaders, userSuppliedSettings) {
|
|
203
202
|
const defaultHeaders = {
|
|
204
203
|
// Use specified auth token or use default from this stripe instance:
|
|
205
204
|
Authorization: auth ? `Bearer ${auth}` : this._stripe.getApiField('auth'),
|
|
206
205
|
Accept: 'application/json',
|
|
207
|
-
'Content-Type':
|
|
206
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
|
208
207
|
'User-Agent': this._getUserAgentString(),
|
|
209
208
|
'X-Stripe-Client-User-Agent': clientUserAgent,
|
|
210
209
|
'X-Stripe-Client-Telemetry': this._getTelemetryHeader(),
|
|
@@ -272,54 +271,6 @@ export class RequestSender {
|
|
|
272
271
|
}
|
|
273
272
|
}
|
|
274
273
|
}
|
|
275
|
-
_rawRequest(method, path, params, options) {
|
|
276
|
-
const requestPromise = new Promise((resolve, reject) => {
|
|
277
|
-
let opts;
|
|
278
|
-
try {
|
|
279
|
-
const requestMethod = method.toUpperCase();
|
|
280
|
-
if (requestMethod !== 'POST' &&
|
|
281
|
-
params &&
|
|
282
|
-
Object.keys(params).length !== 0) {
|
|
283
|
-
throw new Error('rawRequest only supports params on POST requests. Please pass null and add your parameters to path.');
|
|
284
|
-
}
|
|
285
|
-
const args = [].slice.call([params, options]);
|
|
286
|
-
// Pull request data and options (headers, auth) from args.
|
|
287
|
-
const dataFromArgs = getDataFromArgs(args);
|
|
288
|
-
const data = Object.assign({}, dataFromArgs);
|
|
289
|
-
const calculatedOptions = getOptionsFromArgs(args);
|
|
290
|
-
const apiMode = calculatedOptions.apiMode || 'standard';
|
|
291
|
-
const headers = calculatedOptions.headers;
|
|
292
|
-
opts = {
|
|
293
|
-
requestMethod,
|
|
294
|
-
requestPath: path,
|
|
295
|
-
bodyData: data,
|
|
296
|
-
queryData: {},
|
|
297
|
-
auth: calculatedOptions.auth,
|
|
298
|
-
headers,
|
|
299
|
-
host: null,
|
|
300
|
-
streaming: false,
|
|
301
|
-
settings: {},
|
|
302
|
-
apiMode: apiMode,
|
|
303
|
-
usage: ['raw_request'],
|
|
304
|
-
};
|
|
305
|
-
}
|
|
306
|
-
catch (err) {
|
|
307
|
-
reject(err);
|
|
308
|
-
return;
|
|
309
|
-
}
|
|
310
|
-
function requestCallback(err, response) {
|
|
311
|
-
if (err) {
|
|
312
|
-
reject(err);
|
|
313
|
-
}
|
|
314
|
-
else {
|
|
315
|
-
resolve(response);
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
const { headers, settings } = opts;
|
|
319
|
-
this._request(opts.requestMethod, opts.host, path, opts.bodyData, opts.auth, { headers, settings, streaming: opts.streaming, apiMode: opts.apiMode }, opts.usage, requestCallback);
|
|
320
|
-
});
|
|
321
|
-
return requestPromise;
|
|
322
|
-
}
|
|
323
274
|
_request(method, host, path, data, auth, options = {}, usage = [], callback, requestDataProcessor = null) {
|
|
324
275
|
let requestData;
|
|
325
276
|
const retryRequest = (requestFn, apiVersion, headers, requestRetries, retryAfter) => {
|
|
@@ -384,15 +335,10 @@ export class RequestSender {
|
|
|
384
335
|
return callback(error);
|
|
385
336
|
}
|
|
386
337
|
requestData = data;
|
|
387
|
-
let contentType = 'application/x-www-form-urlencoded';
|
|
388
|
-
let apiVersion = this._stripe.getApiField('version');
|
|
389
|
-
if (options.apiMode === 'preview') {
|
|
390
|
-
contentType = 'application/json';
|
|
391
|
-
apiVersion = PreviewVersion;
|
|
392
|
-
}
|
|
393
338
|
this._stripe.getClientUserAgent((clientUserAgent) => {
|
|
394
339
|
var _a, _b;
|
|
395
|
-
const
|
|
340
|
+
const apiVersion = this._stripe.getApiField('version');
|
|
341
|
+
const headers = this._makeHeaders(auth, requestData.length, apiVersion, clientUserAgent, method, (_a = options.headers) !== null && _a !== void 0 ? _a : null, (_b = options.settings) !== null && _b !== void 0 ? _b : {});
|
|
396
342
|
makeRequest(apiVersion, headers, 0);
|
|
397
343
|
});
|
|
398
344
|
};
|
|
@@ -400,14 +346,7 @@ export class RequestSender {
|
|
|
400
346
|
requestDataProcessor(method, data, options.headers, prepareAndMakeRequest);
|
|
401
347
|
}
|
|
402
348
|
else {
|
|
403
|
-
|
|
404
|
-
if (options.apiMode === 'preview') {
|
|
405
|
-
stringifiedData = data ? jsonStringifyRequestData(data) : '';
|
|
406
|
-
}
|
|
407
|
-
else {
|
|
408
|
-
stringifiedData = queryStringifyRequestData(data || {});
|
|
409
|
-
}
|
|
410
|
-
prepareAndMakeRequest(null, stringifiedData);
|
|
349
|
+
prepareAndMakeRequest(null, stringifyRequestData(data || {}));
|
|
411
350
|
}
|
|
412
351
|
}
|
|
413
352
|
}
|
package/esm/ResourceNamespace.js
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
// It also works recursively, so you could do i.e. `stripe.billing.invoicing.pay`.
|
|
3
3
|
function ResourceNamespace(stripe, resources) {
|
|
4
4
|
for (const name in resources) {
|
|
5
|
+
if (!Object.prototype.hasOwnProperty.call(resources, name)) {
|
|
6
|
+
continue;
|
|
7
|
+
}
|
|
5
8
|
const camelCaseName = name[0].toLowerCase() + name.substring(1);
|
|
6
9
|
const resource = new resources[name](stripe);
|
|
7
10
|
this[camelCaseName] = resource;
|
package/esm/StripeResource.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getDataFromArgs, getOptionsFromArgs, makeURLInterpolator, protoExtend,
|
|
1
|
+
import { getDataFromArgs, getOptionsFromArgs, makeURLInterpolator, protoExtend, stringifyRequestData, } from './utils.js';
|
|
2
2
|
import { stripeMethod } from './StripeMethod.js';
|
|
3
3
|
// Provide extension mechanism for Stripe Resource Sub-Classes
|
|
4
4
|
StripeResource.extend = protoExtend;
|
|
@@ -158,7 +158,7 @@ StripeResource.prototype = {
|
|
|
158
158
|
const path = [
|
|
159
159
|
opts.requestPath,
|
|
160
160
|
emptyQuery ? '' : '?',
|
|
161
|
-
|
|
161
|
+
stringifyRequestData(opts.queryData),
|
|
162
162
|
].join('');
|
|
163
163
|
const { headers, settings } = opts;
|
|
164
164
|
this._stripe._requestSender._request(opts.requestMethod, opts.host, path, opts.bodyData, opts.auth, { headers, settings, streaming: opts.streaming }, opts.usage, requestCallback, (_a = this.requestDataProcessor) === null || _a === void 0 ? void 0 : _a.bind(this));
|
package/esm/Webhooks.js
CHANGED
|
@@ -40,23 +40,16 @@ export function createWebhooks(platformFunctions) {
|
|
|
40
40
|
* @property {CryptoProvider} cryptoProvider - Crypto provider to use for computing the signature if none was provided. Defaults to NodeCryptoProvider.
|
|
41
41
|
*/
|
|
42
42
|
generateTestHeaderString: function (opts) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
opts.signature ||
|
|
54
|
-
opts.cryptoProvider.computeHMACSignature(opts.timestamp + '.' + opts.payload, opts.secret);
|
|
55
|
-
const generatedHeader = [
|
|
56
|
-
't=' + opts.timestamp,
|
|
57
|
-
opts.scheme + '=' + opts.signature,
|
|
58
|
-
].join(',');
|
|
59
|
-
return generatedHeader;
|
|
43
|
+
const preparedOpts = prepareOptions(opts);
|
|
44
|
+
const signature = preparedOpts.signature ||
|
|
45
|
+
preparedOpts.cryptoProvider.computeHMACSignature(preparedOpts.payloadString, preparedOpts.secret);
|
|
46
|
+
return preparedOpts.generateHeaderString(signature);
|
|
47
|
+
},
|
|
48
|
+
generateTestHeaderStringAsync: async function (opts) {
|
|
49
|
+
const preparedOpts = prepareOptions(opts);
|
|
50
|
+
const signature = preparedOpts.signature ||
|
|
51
|
+
(await preparedOpts.cryptoProvider.computeHMACSignatureAsync(preparedOpts.payloadString, preparedOpts.secret));
|
|
52
|
+
return preparedOpts.generateHeaderString(signature);
|
|
60
53
|
},
|
|
61
54
|
};
|
|
62
55
|
const signature = {
|
|
@@ -191,6 +184,25 @@ export function createWebhooks(platformFunctions) {
|
|
|
191
184
|
}
|
|
192
185
|
return webhooksCryptoProviderInstance;
|
|
193
186
|
}
|
|
187
|
+
function prepareOptions(opts) {
|
|
188
|
+
if (!opts) {
|
|
189
|
+
throw new StripeError({
|
|
190
|
+
message: 'Options are required',
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
const timestamp = Math.floor(opts.timestamp) || Math.floor(Date.now() / 1000);
|
|
194
|
+
const scheme = opts.scheme || signature.EXPECTED_SCHEME;
|
|
195
|
+
const cryptoProvider = opts.cryptoProvider || getCryptoProvider();
|
|
196
|
+
const payloadString = `${timestamp}.${opts.payload}`;
|
|
197
|
+
const generateHeaderString = (signature) => {
|
|
198
|
+
return `t=${timestamp},${scheme}=${signature}`;
|
|
199
|
+
};
|
|
200
|
+
return Object.assign(Object.assign({}, opts), { timestamp,
|
|
201
|
+
scheme,
|
|
202
|
+
cryptoProvider,
|
|
203
|
+
payloadString,
|
|
204
|
+
generateHeaderString });
|
|
205
|
+
}
|
|
194
206
|
Webhook.signature = signature;
|
|
195
207
|
return Webhook;
|
|
196
208
|
}
|
package/esm/apiVersion.js
CHANGED
package/esm/multipart.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { flattenAndStringify,
|
|
1
|
+
import { flattenAndStringify, stringifyRequestData } from './utils.js';
|
|
2
2
|
// Method for formatting HTTP body for the multipart/form-data specification
|
|
3
3
|
// Mostly taken from Fermata.js
|
|
4
4
|
// https://github.com/natevw/fermata/blob/5d9732a33d776ce925013a265935facd1626cc88/fermata.js#L315-L343
|
|
@@ -21,6 +21,9 @@ const multipartDataGenerator = (method, data, headers) => {
|
|
|
21
21
|
}
|
|
22
22
|
const flattenedData = flattenAndStringify(data);
|
|
23
23
|
for (const k in flattenedData) {
|
|
24
|
+
if (!Object.prototype.hasOwnProperty.call(flattenedData, k)) {
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
24
27
|
const v = flattenedData[k];
|
|
25
28
|
push(`--${segno}`);
|
|
26
29
|
if (Object.prototype.hasOwnProperty.call(v, 'data')) {
|
|
@@ -42,7 +45,7 @@ const multipartDataGenerator = (method, data, headers) => {
|
|
|
42
45
|
export function multipartRequestDataProcessor(method, data, headers, callback) {
|
|
43
46
|
data = data || {};
|
|
44
47
|
if (method !== 'POST') {
|
|
45
|
-
return callback(null,
|
|
48
|
+
return callback(null, stringifyRequestData(data));
|
|
46
49
|
}
|
|
47
50
|
this._stripe._platformFunctions
|
|
48
51
|
.tryBufferData(data)
|
|
@@ -15,11 +15,6 @@ export const Accounts = StripeResource.extend({
|
|
|
15
15
|
method: 'POST',
|
|
16
16
|
fullPath: '/v1/financial_connections/accounts/{account}/disconnect',
|
|
17
17
|
}),
|
|
18
|
-
listInferredBalances: stripeMethod({
|
|
19
|
-
method: 'GET',
|
|
20
|
-
fullPath: '/v1/financial_connections/accounts/{account}/inferred_balances',
|
|
21
|
-
methodType: 'list',
|
|
22
|
-
}),
|
|
23
18
|
listOwners: stripeMethod({
|
|
24
19
|
method: 'GET',
|
|
25
20
|
fullPath: '/v1/financial_connections/accounts/{account}/owners',
|
|
@@ -15,10 +15,6 @@ export const Invoices = StripeResource.extend({
|
|
|
15
15
|
method: 'POST',
|
|
16
16
|
fullPath: '/v1/invoices/{invoice}/add_lines',
|
|
17
17
|
}),
|
|
18
|
-
attachPaymentIntent: stripeMethod({
|
|
19
|
-
method: 'POST',
|
|
20
|
-
fullPath: '/v1/invoices/{invoice}/attach_payment_intent',
|
|
21
|
-
}),
|
|
22
18
|
createPreview: stripeMethod({
|
|
23
19
|
method: 'POST',
|
|
24
20
|
fullPath: '/v1/invoices/create_preview',
|
|
@@ -32,11 +28,6 @@ export const Invoices = StripeResource.extend({
|
|
|
32
28
|
fullPath: '/v1/invoices/{invoice}/lines',
|
|
33
29
|
methodType: 'list',
|
|
34
30
|
}),
|
|
35
|
-
listPayments: stripeMethod({
|
|
36
|
-
method: 'GET',
|
|
37
|
-
fullPath: '/v1/invoices/{invoice}/payments',
|
|
38
|
-
methodType: 'list',
|
|
39
|
-
}),
|
|
40
31
|
listUpcomingLines: stripeMethod({
|
|
41
32
|
method: 'GET',
|
|
42
33
|
fullPath: '/v1/invoices/upcoming/lines',
|
|
@@ -51,10 +42,6 @@ export const Invoices = StripeResource.extend({
|
|
|
51
42
|
method: 'POST',
|
|
52
43
|
fullPath: '/v1/invoices/{invoice}/remove_lines',
|
|
53
44
|
}),
|
|
54
|
-
retrievePayment: stripeMethod({
|
|
55
|
-
method: 'GET',
|
|
56
|
-
fullPath: '/v1/invoices/{invoice}/payments/{invoice_payment}',
|
|
57
|
-
}),
|
|
58
45
|
retrieveUpcoming: stripeMethod({
|
|
59
46
|
method: 'GET',
|
|
60
47
|
fullPath: '/v1/invoices/upcoming',
|
package/esm/resources/OAuth.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
import { StripeResource } from '../StripeResource.js';
|
|
3
|
-
import {
|
|
3
|
+
import { stringifyRequestData } from '../utils.js';
|
|
4
4
|
const stripeMethod = StripeResource.method;
|
|
5
5
|
const oAuthHost = 'connect.stripe.com';
|
|
6
6
|
export const OAuth = StripeResource.extend({
|
|
@@ -22,7 +22,7 @@ export const OAuth = StripeResource.extend({
|
|
|
22
22
|
if (!params.scope) {
|
|
23
23
|
params.scope = 'read_write';
|
|
24
24
|
}
|
|
25
|
-
return `https://${oAuthHost}/${path}?${
|
|
25
|
+
return `https://${oAuthHost}/${path}?${stringifyRequestData(params)}`;
|
|
26
26
|
},
|
|
27
27
|
token: stripeMethod({
|
|
28
28
|
method: 'POST',
|
|
@@ -32,10 +32,6 @@ export const PaymentIntents = StripeResource.extend({
|
|
|
32
32
|
method: 'POST',
|
|
33
33
|
fullPath: '/v1/payment_intents/{intent}/confirm',
|
|
34
34
|
}),
|
|
35
|
-
decrementAuthorization: stripeMethod({
|
|
36
|
-
method: 'POST',
|
|
37
|
-
fullPath: '/v1/payment_intents/{intent}/decrement_authorization',
|
|
38
|
-
}),
|
|
39
35
|
incrementAuthorization: stripeMethod({
|
|
40
36
|
method: 'POST',
|
|
41
37
|
fullPath: '/v1/payment_intents/{intent}/increment_authorization',
|
package/esm/resources/Quotes.js
CHANGED
|
@@ -16,11 +16,6 @@ export const Quotes = StripeResource.extend({
|
|
|
16
16
|
method: 'POST',
|
|
17
17
|
fullPath: '/v1/quotes/{quote}/finalize',
|
|
18
18
|
}),
|
|
19
|
-
listPreviewInvoiceLines: stripeMethod({
|
|
20
|
-
method: 'GET',
|
|
21
|
-
fullPath: '/v1/quotes/{quote}/preview_invoices/{preview_invoice}/lines',
|
|
22
|
-
methodType: 'list',
|
|
23
|
-
}),
|
|
24
19
|
listComputedUpfrontLineItems: stripeMethod({
|
|
25
20
|
method: 'GET',
|
|
26
21
|
fullPath: '/v1/quotes/{quote}/computed_upfront_line_items',
|
|
@@ -31,37 +26,10 @@ export const Quotes = StripeResource.extend({
|
|
|
31
26
|
fullPath: '/v1/quotes/{quote}/line_items',
|
|
32
27
|
methodType: 'list',
|
|
33
28
|
}),
|
|
34
|
-
listLines: stripeMethod({
|
|
35
|
-
method: 'GET',
|
|
36
|
-
fullPath: '/v1/quotes/{quote}/lines',
|
|
37
|
-
methodType: 'list',
|
|
38
|
-
}),
|
|
39
|
-
listPreviewInvoices: stripeMethod({
|
|
40
|
-
method: 'GET',
|
|
41
|
-
fullPath: '/v1/quotes/{quote}/preview_invoices',
|
|
42
|
-
methodType: 'list',
|
|
43
|
-
}),
|
|
44
|
-
listPreviewSubscriptionSchedules: stripeMethod({
|
|
45
|
-
method: 'GET',
|
|
46
|
-
fullPath: '/v1/quotes/{quote}/preview_subscription_schedules',
|
|
47
|
-
methodType: 'list',
|
|
48
|
-
}),
|
|
49
|
-
markDraft: stripeMethod({
|
|
50
|
-
method: 'POST',
|
|
51
|
-
fullPath: '/v1/quotes/{quote}/mark_draft',
|
|
52
|
-
}),
|
|
53
|
-
markStale: stripeMethod({
|
|
54
|
-
method: 'POST',
|
|
55
|
-
fullPath: '/v1/quotes/{quote}/mark_stale',
|
|
56
|
-
}),
|
|
57
29
|
pdf: stripeMethod({
|
|
58
30
|
method: 'GET',
|
|
59
31
|
fullPath: '/v1/quotes/{quote}/pdf',
|
|
60
32
|
host: 'files.stripe.com',
|
|
61
33
|
streaming: true,
|
|
62
34
|
}),
|
|
63
|
-
reestimate: stripeMethod({
|
|
64
|
-
method: 'POST',
|
|
65
|
-
fullPath: '/v1/quotes/{quote}/reestimate',
|
|
66
|
-
}),
|
|
67
35
|
});
|
|
@@ -19,10 +19,6 @@ export const SubscriptionSchedules = StripeResource.extend({
|
|
|
19
19
|
fullPath: '/v1/subscription_schedules',
|
|
20
20
|
methodType: 'list',
|
|
21
21
|
}),
|
|
22
|
-
amend: stripeMethod({
|
|
23
|
-
method: 'POST',
|
|
24
|
-
fullPath: '/v1/subscription_schedules/{schedule}/amend',
|
|
25
|
-
}),
|
|
26
22
|
cancel: stripeMethod({
|
|
27
23
|
method: 'POST',
|
|
28
24
|
fullPath: '/v1/subscription_schedules/{schedule}/cancel',
|
|
@@ -24,18 +24,6 @@ export const Readers = StripeResource.extend({
|
|
|
24
24
|
method: 'POST',
|
|
25
25
|
fullPath: '/v1/terminal/readers/{reader}/cancel_action',
|
|
26
26
|
}),
|
|
27
|
-
collectInputs: stripeMethod({
|
|
28
|
-
method: 'POST',
|
|
29
|
-
fullPath: '/v1/terminal/readers/{reader}/collect_inputs',
|
|
30
|
-
}),
|
|
31
|
-
collectPaymentMethod: stripeMethod({
|
|
32
|
-
method: 'POST',
|
|
33
|
-
fullPath: '/v1/terminal/readers/{reader}/collect_payment_method',
|
|
34
|
-
}),
|
|
35
|
-
confirmPaymentIntent: stripeMethod({
|
|
36
|
-
method: 'POST',
|
|
37
|
-
fullPath: '/v1/terminal/readers/{reader}/confirm_payment_intent',
|
|
38
|
-
}),
|
|
39
27
|
processPaymentIntent: stripeMethod({
|
|
40
28
|
method: 'POST',
|
|
41
29
|
fullPath: '/v1/terminal/readers/{reader}/process_payment_intent',
|
package/esm/resources.js
CHANGED
|
@@ -7,27 +7,20 @@ import { Authorizations as IssuingAuthorizations } from './resources/Issuing/Aut
|
|
|
7
7
|
import { Calculations as TaxCalculations } from './resources/Tax/Calculations.js';
|
|
8
8
|
import { Cardholders as IssuingCardholders } from './resources/Issuing/Cardholders.js';
|
|
9
9
|
import { Cards as TestHelpersIssuingCards } from './resources/TestHelpers/Issuing/Cards.js';
|
|
10
|
-
import { Cards as GiftCardsCards } from './resources/GiftCards/Cards.js';
|
|
11
10
|
import { Cards as IssuingCards } from './resources/Issuing/Cards.js';
|
|
12
11
|
import { Configurations as BillingPortalConfigurations } from './resources/BillingPortal/Configurations.js';
|
|
13
12
|
import { Configurations as TerminalConfigurations } from './resources/Terminal/Configurations.js';
|
|
14
13
|
import { ConfirmationTokens as TestHelpersConfirmationTokens } from './resources/TestHelpers/ConfirmationTokens.js';
|
|
15
14
|
import { ConnectionTokens as TerminalConnectionTokens } from './resources/Terminal/ConnectionTokens.js';
|
|
16
15
|
import { CreditReversals as TreasuryCreditReversals } from './resources/Treasury/CreditReversals.js';
|
|
17
|
-
import { CreditUnderwritingRecords as IssuingCreditUnderwritingRecords } from './resources/Issuing/CreditUnderwritingRecords.js';
|
|
18
16
|
import { Customers as TestHelpersCustomers } from './resources/TestHelpers/Customers.js';
|
|
19
17
|
import { DebitReversals as TreasuryDebitReversals } from './resources/Treasury/DebitReversals.js';
|
|
20
18
|
import { Disputes as IssuingDisputes } from './resources/Issuing/Disputes.js';
|
|
21
19
|
import { EarlyFraudWarnings as RadarEarlyFraudWarnings } from './resources/Radar/EarlyFraudWarnings.js';
|
|
22
20
|
import { Features as EntitlementsFeatures } from './resources/Entitlements/Features.js';
|
|
23
21
|
import { FinancialAccounts as TreasuryFinancialAccounts } from './resources/Treasury/FinancialAccounts.js';
|
|
24
|
-
import { FinancingOffers as CapitalFinancingOffers } from './resources/Capital/FinancingOffers.js';
|
|
25
|
-
import { FinancingSummary as CapitalFinancingSummary } from './resources/Capital/FinancingSummary.js';
|
|
26
|
-
import { FinancingTransactions as CapitalFinancingTransactions } from './resources/Capital/FinancingTransactions.js';
|
|
27
|
-
import { Forms as TaxForms } from './resources/Tax/Forms.js';
|
|
28
22
|
import { InboundTransfers as TestHelpersTreasuryInboundTransfers } from './resources/TestHelpers/Treasury/InboundTransfers.js';
|
|
29
23
|
import { InboundTransfers as TreasuryInboundTransfers } from './resources/Treasury/InboundTransfers.js';
|
|
30
|
-
import { Institutions as FinancialConnectionsInstitutions } from './resources/FinancialConnections/Institutions.js';
|
|
31
24
|
import { Locations as TerminalLocations } from './resources/Terminal/Locations.js';
|
|
32
25
|
import { MeterEventAdjustments as BillingMeterEventAdjustments } from './resources/Billing/MeterEventAdjustments.js';
|
|
33
26
|
import { MeterEvents as BillingMeterEvents } from './resources/Billing/MeterEvents.js';
|
|
@@ -64,7 +57,6 @@ import { Tokens as IssuingTokens } from './resources/Issuing/Tokens.js';
|
|
|
64
57
|
import { TransactionEntries as TreasuryTransactionEntries } from './resources/Treasury/TransactionEntries.js';
|
|
65
58
|
import { Transactions as TestHelpersIssuingTransactions } from './resources/TestHelpers/Issuing/Transactions.js';
|
|
66
59
|
import { Transactions as FinancialConnectionsTransactions } from './resources/FinancialConnections/Transactions.js';
|
|
67
|
-
import { Transactions as GiftCardsTransactions } from './resources/GiftCards/Transactions.js';
|
|
68
60
|
import { Transactions as IssuingTransactions } from './resources/Issuing/Transactions.js';
|
|
69
61
|
import { Transactions as TaxTransactions } from './resources/Tax/Transactions.js';
|
|
70
62
|
import { Transactions as TreasuryTransactions } from './resources/Treasury/Transactions.js';
|
|
@@ -74,7 +66,6 @@ import { VerificationReports as IdentityVerificationReports } from './resources/
|
|
|
74
66
|
import { VerificationSessions as IdentityVerificationSessions } from './resources/Identity/VerificationSessions.js';
|
|
75
67
|
export { Accounts as Account } from './resources/Accounts.js';
|
|
76
68
|
export { AccountLinks } from './resources/AccountLinks.js';
|
|
77
|
-
export { AccountNotices } from './resources/AccountNotices.js';
|
|
78
69
|
export { AccountSessions } from './resources/AccountSessions.js';
|
|
79
70
|
export { Accounts } from './resources/Accounts.js';
|
|
80
71
|
export { ApplePayDomains } from './resources/ApplePayDomains.js';
|
|
@@ -97,9 +88,7 @@ export { Files } from './resources/Files.js';
|
|
|
97
88
|
export { InvoiceItems } from './resources/InvoiceItems.js';
|
|
98
89
|
export { Invoices } from './resources/Invoices.js';
|
|
99
90
|
export { Mandates } from './resources/Mandates.js';
|
|
100
|
-
export { Margins } from './resources/Margins.js';
|
|
101
91
|
export { OAuth } from './resources/OAuth.js';
|
|
102
|
-
export { Orders } from './resources/Orders.js';
|
|
103
92
|
export { PaymentIntents } from './resources/PaymentIntents.js';
|
|
104
93
|
export { PaymentLinks } from './resources/PaymentLinks.js';
|
|
105
94
|
export { PaymentMethodConfigurations } from './resources/PaymentMethodConfigurations.js';
|
|
@@ -110,7 +99,6 @@ export { Plans } from './resources/Plans.js';
|
|
|
110
99
|
export { Prices } from './resources/Prices.js';
|
|
111
100
|
export { Products } from './resources/Products.js';
|
|
112
101
|
export { PromotionCodes } from './resources/PromotionCodes.js';
|
|
113
|
-
export { QuotePhases } from './resources/QuotePhases.js';
|
|
114
102
|
export { Quotes } from './resources/Quotes.js';
|
|
115
103
|
export { Refunds } from './resources/Refunds.js';
|
|
116
104
|
export { Reviews } from './resources/Reviews.js';
|
|
@@ -138,11 +126,6 @@ export const BillingPortal = resourceNamespace('billingPortal', {
|
|
|
138
126
|
Configurations: BillingPortalConfigurations,
|
|
139
127
|
Sessions: BillingPortalSessions,
|
|
140
128
|
});
|
|
141
|
-
export const Capital = resourceNamespace('capital', {
|
|
142
|
-
FinancingOffers: CapitalFinancingOffers,
|
|
143
|
-
FinancingSummary: CapitalFinancingSummary,
|
|
144
|
-
FinancingTransactions: CapitalFinancingTransactions,
|
|
145
|
-
});
|
|
146
129
|
export const Checkout = resourceNamespace('checkout', {
|
|
147
130
|
Sessions: CheckoutSessions,
|
|
148
131
|
});
|
|
@@ -157,17 +140,12 @@ export const Entitlements = resourceNamespace('entitlements', {
|
|
|
157
140
|
});
|
|
158
141
|
export const FinancialConnections = resourceNamespace('financialConnections', {
|
|
159
142
|
Accounts: FinancialConnectionsAccounts,
|
|
160
|
-
Institutions: FinancialConnectionsInstitutions,
|
|
161
143
|
Sessions: FinancialConnectionsSessions,
|
|
162
144
|
Transactions: FinancialConnectionsTransactions,
|
|
163
145
|
});
|
|
164
146
|
export const Forwarding = resourceNamespace('forwarding', {
|
|
165
147
|
Requests: ForwardingRequests,
|
|
166
148
|
});
|
|
167
|
-
export const GiftCards = resourceNamespace('giftCards', {
|
|
168
|
-
Cards: GiftCardsCards,
|
|
169
|
-
Transactions: GiftCardsTransactions,
|
|
170
|
-
});
|
|
171
149
|
export const Identity = resourceNamespace('identity', {
|
|
172
150
|
VerificationReports: IdentityVerificationReports,
|
|
173
151
|
VerificationSessions: IdentityVerificationSessions,
|
|
@@ -176,7 +154,6 @@ export const Issuing = resourceNamespace('issuing', {
|
|
|
176
154
|
Authorizations: IssuingAuthorizations,
|
|
177
155
|
Cardholders: IssuingCardholders,
|
|
178
156
|
Cards: IssuingCards,
|
|
179
|
-
CreditUnderwritingRecords: IssuingCreditUnderwritingRecords,
|
|
180
157
|
Disputes: IssuingDisputes,
|
|
181
158
|
PersonalizationDesigns: IssuingPersonalizationDesigns,
|
|
182
159
|
PhysicalBundles: IssuingPhysicalBundles,
|
|
@@ -197,7 +174,6 @@ export const Sigma = resourceNamespace('sigma', {
|
|
|
197
174
|
});
|
|
198
175
|
export const Tax = resourceNamespace('tax', {
|
|
199
176
|
Calculations: TaxCalculations,
|
|
200
|
-
Forms: TaxForms,
|
|
201
177
|
Registrations: TaxRegistrations,
|
|
202
178
|
Settings: TaxSettings,
|
|
203
179
|
Transactions: TaxTransactions,
|
package/esm/stripe.core.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import * as _Error from './Error.js';
|
|
2
|
-
import { ApiVersion } from './apiVersion.js';
|
|
3
|
-
import * as resources from './resources.js';
|
|
4
|
-
import { HttpClient, HttpClientResponse } from './net/HttpClient.js';
|
|
5
|
-
import { determineProcessUserAgentProperties, pascalToCamelCase, validateInteger, } from './utils.js';
|
|
6
|
-
import { CryptoProvider } from './crypto/CryptoProvider.js';
|
|
7
2
|
import { RequestSender } from './RequestSender.js';
|
|
8
3
|
import { StripeResource } from './StripeResource.js';
|
|
9
4
|
import { createWebhooks } from './Webhooks.js';
|
|
5
|
+
import * as apiVersion from './apiVersion.js';
|
|
6
|
+
import { CryptoProvider } from './crypto/CryptoProvider.js';
|
|
7
|
+
import { HttpClient, HttpClientResponse } from './net/HttpClient.js';
|
|
8
|
+
import * as resources from './resources.js';
|
|
9
|
+
import { determineProcessUserAgentProperties, pascalToCamelCase, validateInteger, } from './utils.js';
|
|
10
10
|
const DEFAULT_HOST = 'api.stripe.com';
|
|
11
11
|
const DEFAULT_PORT = '443';
|
|
12
12
|
const DEFAULT_BASE_PATH = '/v1/';
|
|
13
|
-
const DEFAULT_API_VERSION = ApiVersion;
|
|
13
|
+
const DEFAULT_API_VERSION = apiVersion.ApiVersion;
|
|
14
14
|
const DEFAULT_TIMEOUT = 80000;
|
|
15
15
|
const MAX_NETWORK_RETRY_DELAY_SEC = 2;
|
|
16
16
|
const INITIAL_NETWORK_RETRY_DELAY_SEC = 0.5;
|
|
@@ -31,7 +31,7 @@ const ALLOWED_CONFIG_PROPERTIES = [
|
|
|
31
31
|
];
|
|
32
32
|
const defaultRequestSenderFactory = (stripe) => new RequestSender(stripe, StripeResource.MAX_BUFFERED_REQUEST_METRICS);
|
|
33
33
|
export function createStripe(platformFunctions, requestSender = defaultRequestSenderFactory) {
|
|
34
|
-
Stripe.PACKAGE_VERSION = '16.
|
|
34
|
+
Stripe.PACKAGE_VERSION = '16.4.0';
|
|
35
35
|
Stripe.USER_AGENT = Object.assign({ bindings_version: Stripe.PACKAGE_VERSION, lang: 'node', publisher: 'stripe', uname: null, typescript: false }, determineProcessUserAgentProperties());
|
|
36
36
|
Stripe.StripeResource = StripeResource;
|
|
37
37
|
Stripe.resources = resources;
|
|
@@ -147,9 +147,6 @@ export function createStripe(platformFunctions, requestSender = defaultRequestSe
|
|
|
147
147
|
_enableTelemetry: null,
|
|
148
148
|
_requestSender: null,
|
|
149
149
|
_platformFunctions: null,
|
|
150
|
-
rawRequest(method, path, params, options) {
|
|
151
|
-
return this._requestSender._rawRequest(method, path, params, options);
|
|
152
|
-
},
|
|
153
150
|
/**
|
|
154
151
|
* @private
|
|
155
152
|
*/
|
|
@@ -274,6 +271,9 @@ export function createStripe(platformFunctions, requestSender = defaultRequestSe
|
|
|
274
271
|
var _a;
|
|
275
272
|
const userAgent = {};
|
|
276
273
|
for (const field in seed) {
|
|
274
|
+
if (!Object.prototype.hasOwnProperty.call(seed, field)) {
|
|
275
|
+
continue;
|
|
276
|
+
}
|
|
277
277
|
userAgent[field] = encodeURIComponent((_a = seed[field]) !== null && _a !== void 0 ? _a : 'null');
|
|
278
278
|
}
|
|
279
279
|
// URI-encode in case there are unusual characters in the system's uname.
|
|
@@ -317,6 +317,9 @@ export function createStripe(platformFunctions, requestSender = defaultRequestSe
|
|
|
317
317
|
*/
|
|
318
318
|
_prepResources() {
|
|
319
319
|
for (const name in resources) {
|
|
320
|
+
if (!Object.prototype.hasOwnProperty.call(resources, name)) {
|
|
321
|
+
continue;
|
|
322
|
+
}
|
|
320
323
|
// @ts-ignore
|
|
321
324
|
this[pascalToCamelCase(name)] = new resources[name](this);
|
|
322
325
|
}
|