stripe 16.13.0-beta.1 → 17.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +139 -849
- package/README.md +4 -3
- package/VERSION +1 -1
- package/cjs/Error.js +31 -4
- package/cjs/RequestSender.js +114 -74
- package/cjs/StripeResource.js +8 -3
- package/cjs/apiVersion.js +2 -3
- package/cjs/autoPagination.js +51 -7
- package/cjs/crypto/CryptoProvider.js +6 -0
- package/cjs/crypto/NodeCryptoProvider.js +7 -0
- package/cjs/crypto/SubtleCryptoProvider.js +4 -0
- package/cjs/resources/{Capital/FinancingSummary.js → Billing/CreditBalanceSummary.js} +3 -3
- package/cjs/resources/{FinancialConnections/Institutions.js → Billing/CreditBalanceTransactions.js} +4 -4
- package/cjs/resources/Billing/CreditGrants.js +30 -0
- package/cjs/resources/FinancialConnections/Accounts.js +0 -5
- package/cjs/resources/Invoices.js +0 -17
- 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/V2/Billing/MeterEventAdjustments.js +12 -0
- package/cjs/resources/V2/Billing/MeterEventSession.js +12 -0
- package/cjs/resources/V2/Billing/MeterEventStream.js +13 -0
- package/cjs/resources/V2/Billing/MeterEvents.js +9 -0
- package/cjs/resources/V2/Billing.js +18 -0
- package/cjs/resources/V2/Core/Events.js +14 -0
- package/cjs/resources/V2/Core.js +12 -0
- package/cjs/resources/V2.js +14 -0
- package/cjs/resources.js +18 -42
- package/cjs/stripe.core.js +20 -8
- package/cjs/utils.js +41 -10
- package/esm/Error.js +27 -2
- package/esm/RequestSender.js +115 -75
- package/esm/StripeResource.js +9 -4
- package/esm/apiVersion.js +1 -2
- package/esm/autoPagination.js +52 -8
- package/esm/crypto/CryptoProvider.js +6 -0
- package/esm/crypto/NodeCryptoProvider.js +7 -0
- package/esm/crypto/SubtleCryptoProvider.js +4 -0
- package/esm/resources/{Capital/FinancingSummary.js → Billing/CreditBalanceSummary.js} +2 -2
- package/esm/resources/{FinancialConnections/Institutions.js → Billing/CreditBalanceTransactions.js} +3 -3
- package/esm/resources/Billing/CreditGrants.js +27 -0
- package/esm/resources/FinancialConnections/Accounts.js +0 -5
- package/esm/resources/Invoices.js +0 -17
- 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/V2/Billing/MeterEventAdjustments.js +9 -0
- package/esm/resources/V2/Billing/MeterEventSession.js +9 -0
- package/esm/resources/V2/Billing/MeterEventStream.js +10 -0
- package/esm/resources/V2/Billing/MeterEvents.js +6 -0
- package/esm/resources/V2/Billing.js +15 -0
- package/esm/resources/V2/Core/Events.js +11 -0
- package/esm/resources/V2/Core.js +9 -0
- package/esm/resources/V2.js +11 -0
- package/esm/resources.js +7 -29
- package/esm/stripe.core.js +21 -9
- package/esm/utils.js +38 -9
- package/package.json +1 -1
- package/types/AccountLinksResource.d.ts +1 -5
- package/types/AccountSessions.d.ts +0 -45
- package/types/AccountSessionsResource.d.ts +0 -288
- package/types/Accounts.d.ts +1 -113
- package/types/AccountsResource.d.ts +0 -270
- package/types/Billing/Alerts.d.ts +17 -13
- package/types/Billing/AlertsResource.d.ts +18 -21
- package/types/Billing/CreditBalanceSummary.d.ts +94 -0
- package/types/Billing/CreditBalanceSummaryResource.d.ts +64 -0
- package/types/Billing/CreditBalanceTransactions.d.ts +159 -0
- package/types/Billing/CreditBalanceTransactionsResource.d.ts +54 -0
- package/types/Billing/CreditGrants.d.ts +124 -0
- package/types/Billing/CreditGrantsResource.d.ts +219 -0
- package/types/BillingPortal/ConfigurationsResource.d.ts +2 -2
- package/types/Capabilities.d.ts +1 -1
- package/types/Charges.d.ts +0 -71
- package/types/ChargesResource.d.ts +0 -1294
- package/types/Checkout/Sessions.d.ts +4 -296
- package/types/Checkout/SessionsResource.d.ts +6 -352
- package/types/ConfirmationTokens.d.ts +0 -67
- package/types/Coupons.d.ts +1 -1
- package/types/CouponsResource.d.ts +1 -1
- package/types/CreditNoteLineItems.d.ts +30 -0
- package/types/CreditNotes.d.ts +27 -18
- package/types/CreditNotesResource.d.ts +0 -51
- package/types/Customers.d.ts +2 -3
- package/types/CustomersResource.d.ts +0 -3
- package/types/Disputes.d.ts +0 -152
- package/types/DisputesResource.d.ts +0 -120
- package/types/Errors.d.ts +32 -2
- package/types/EventTypes.d.ts +2 -545
- package/types/Events.d.ts +0 -90
- 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/InvoiceItems.d.ts +0 -5
- package/types/InvoiceItemsResource.d.ts +0 -98
- package/types/InvoiceLineItems.d.ts +29 -20
- package/types/Invoices.d.ts +25 -108
- package/types/InvoicesResource.d.ts +1835 -5493
- package/types/Issuing/CardholdersResource.d.ts +1 -2
- package/types/Issuing/Transactions.d.ts +0 -2
- package/types/Issuing/TransactionsResource.d.ts +0 -5
- package/types/LineItems.d.ts +0 -7
- package/types/Mandates.d.ts +0 -77
- package/types/PaymentIntents.d.ts +1 -503
- package/types/PaymentIntentsResource.d.ts +3464 -7064
- package/types/PaymentLinks.d.ts +0 -3
- package/types/PaymentLinksResource.d.ts +0 -6
- package/types/PaymentMethodConfigurations.d.ts +0 -36
- package/types/PaymentMethodConfigurationsResource.d.ts +0 -50
- package/types/PaymentMethods.d.ts +0 -67
- package/types/PaymentMethodsResource.d.ts +0 -88
- package/types/Prices.d.ts +0 -22
- package/types/PricesResource.d.ts +0 -22
- package/types/Products.d.ts +0 -39
- package/types/ProductsResource.d.ts +28 -37
- package/types/PromotionCodes.d.ts +1 -1
- package/types/PromotionCodesResource.d.ts +3 -1
- package/types/Quotes.d.ts +1 -596
- package/types/QuotesResource.d.ts +199 -2531
- package/types/SetupAttempts.d.ts +0 -10
- package/types/SetupIntents.d.ts +1 -111
- package/types/SetupIntentsResource.d.ts +3 -522
- 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 -200
- package/types/SubscriptionSchedulesResource.d.ts +13 -1231
- package/types/Subscriptions.d.ts +1 -82
- package/types/SubscriptionsResource.d.ts +5 -350
- package/types/Tax/Settings.d.ts +1 -1
- package/types/Terminal/Readers.d.ts +0 -278
- package/types/Terminal/ReadersResource.d.ts +13 -212
- package/types/TestHelpers/ConfirmationTokensResource.d.ts +0 -63
- package/types/TestHelpers/Treasury/ReceivedCreditsResource.d.ts +0 -26
- package/types/TestHelpers/Treasury/ReceivedDebitsResource.d.ts +0 -26
- package/types/ThinEvent.d.ts +36 -0
- package/types/Treasury/FinancialAccounts.d.ts +0 -5
- package/types/Treasury/FinancialAccountsResource.d.ts +0 -10
- package/types/Treasury/OutboundTransfers.d.ts +0 -26
- package/types/Treasury/OutboundTransfersResource.d.ts +0 -26
- package/types/Treasury/ReceivedCredits.d.ts +5 -27
- package/types/Treasury/ReceivedDebits.d.ts +0 -31
- package/types/V2/Billing/MeterEventAdjustments.d.ts +65 -0
- package/types/V2/Billing/MeterEventAdjustmentsResource.d.ts +47 -0
- package/types/V2/Billing/MeterEventSessionResource.d.ts +26 -0
- package/types/V2/Billing/MeterEventSessions.d.ts +45 -0
- package/types/V2/Billing/MeterEventStreamResource.d.ts +62 -0
- package/types/V2/Billing/MeterEvents.d.ts +54 -0
- package/types/V2/Billing/MeterEventsResource.d.ts +52 -0
- package/types/V2/BillingResource.d.ts +14 -0
- package/types/V2/Core/EventsResource.d.ts +57 -0
- package/types/V2/CoreResource.d.ts +11 -0
- package/types/V2/EventTypes.d.ts +214 -0
- package/types/V2/Events.d.ts +75 -0
- package/types/V2Resource.d.ts +10 -0
- package/types/WebhookEndpointsResource.d.ts +2 -65
- package/types/index.d.ts +67 -53
- package/types/lib.d.ts +1 -6
- package/types/test/typescriptTest.ts +3 -3
- package/cjs/resources/AccountNotices.js +0 -21
- package/cjs/resources/Capital/FinancingOffers.js +0 -21
- package/cjs/resources/Capital/FinancingTransactions.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/Issuing/DisputeSettlementDetails.js +0 -17
- package/cjs/resources/Margins.js +0 -22
- package/cjs/resources/Orders.js +0 -24
- package/cjs/resources/Tax/Associations.js +0 -9
- package/cjs/resources/Tax/Forms.js +0 -20
- package/cjs/resources/Terminal/ReaderCollectedData.js +0 -12
- package/esm/resources/AccountNotices.js +0 -18
- package/esm/resources/Capital/FinancingOffers.js +0 -18
- package/esm/resources/Capital/FinancingTransactions.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/Issuing/DisputeSettlementDetails.js +0 -14
- package/esm/resources/Margins.js +0 -19
- package/esm/resources/Orders.js +0 -21
- package/esm/resources/Tax/Associations.js +0 -6
- package/esm/resources/Tax/Forms.js +0 -17
- package/esm/resources/Terminal/ReaderCollectedData.js +0 -9
- package/types/AccountNotices.d.ts +0 -113
- package/types/AccountNoticesResource.d.ts +0 -98
- package/types/Billing/MeterErrorReports.d.ts +0 -106
- 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 -138
- package/types/Issuing/CreditUnderwritingRecords.d.ts +0 -451
- package/types/Issuing/CreditUnderwritingRecordsResource.d.ts +0 -1032
- package/types/Issuing/DisputeSettlementDetails.d.ts +0 -73
- package/types/Issuing/DisputeSettlementDetailsResource.d.ts +0 -52
- package/types/Issuing/Settlements.d.ts +0 -103
- package/types/Margins.d.ts +0 -56
- package/types/MarginsResource.d.ts +0 -114
- package/types/Orders.d.ts +0 -1084
- package/types/OrdersResource.d.ts +0 -2765
- package/types/QuoteLines.d.ts +0 -634
- package/types/QuotePreviewInvoices.d.ts +0 -1548
- package/types/QuotePreviewSubscriptionSchedules.d.ts +0 -814
- package/types/Tax/Associations.d.ts +0 -126
- package/types/Tax/AssociationsResource.d.ts +0 -29
- package/types/Tax/Forms.d.ts +0 -133
- package/types/Tax/FormsResource.d.ts +0 -90
- package/types/Terminal/ReaderCollectedData.d.ts +0 -51
- package/types/Terminal/ReaderCollectedDataResource.d.ts +0 -29
package/esm/Error.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* eslint-disable camelcase */
|
|
2
|
-
|
|
2
|
+
/* eslint-disable no-warning-comments */
|
|
3
|
+
export const generateV1Error = (rawStripeError) => {
|
|
3
4
|
switch (rawStripeError.type) {
|
|
4
5
|
case 'card_error':
|
|
5
6
|
return new StripeCardError(rawStripeError);
|
|
@@ -19,6 +20,22 @@ export const generate = (rawStripeError) => {
|
|
|
19
20
|
return new StripeUnknownError(rawStripeError);
|
|
20
21
|
}
|
|
21
22
|
};
|
|
23
|
+
// eslint-disable-next-line complexity
|
|
24
|
+
export const generateV2Error = (rawStripeError) => {
|
|
25
|
+
switch (rawStripeError.type) {
|
|
26
|
+
// switchCases: The beginning of the section generated from our OpenAPI spec
|
|
27
|
+
case 'temporary_session_expired':
|
|
28
|
+
return new TemporarySessionExpiredError(rawStripeError);
|
|
29
|
+
// switchCases: The end of the section generated from our OpenAPI spec
|
|
30
|
+
}
|
|
31
|
+
// Special handling for requests with missing required fields in V2 APIs.
|
|
32
|
+
// invalid_field response in V2 APIs returns the field 'code' instead of 'type'.
|
|
33
|
+
switch (rawStripeError.code) {
|
|
34
|
+
case 'invalid_fields':
|
|
35
|
+
return new StripeInvalidRequestError(rawStripeError);
|
|
36
|
+
}
|
|
37
|
+
return generateV1Error(rawStripeError);
|
|
38
|
+
};
|
|
22
39
|
/**
|
|
23
40
|
* StripeError is the base error from which all other more specific Stripe errors derive.
|
|
24
41
|
* Specifically for errors returned from Stripe's REST API.
|
|
@@ -38,6 +55,7 @@ export class StripeError extends Error {
|
|
|
38
55
|
this.statusCode = raw.statusCode;
|
|
39
56
|
// @ts-ignore
|
|
40
57
|
this.message = raw.message;
|
|
58
|
+
this.userMessage = raw.user_message;
|
|
41
59
|
this.charge = raw.charge;
|
|
42
60
|
this.decline_code = raw.decline_code;
|
|
43
61
|
this.payment_intent = raw.payment_intent;
|
|
@@ -50,7 +68,7 @@ export class StripeError extends Error {
|
|
|
50
68
|
/**
|
|
51
69
|
* Helper factory which takes raw stripe errors and outputs wrapping instances
|
|
52
70
|
*/
|
|
53
|
-
StripeError.generate =
|
|
71
|
+
StripeError.generate = generateV1Error;
|
|
54
72
|
// Specific Stripe Error types:
|
|
55
73
|
/**
|
|
56
74
|
* CardError is raised when a user enters a card that can't be charged for
|
|
@@ -158,3 +176,10 @@ export class StripeUnknownError extends StripeError {
|
|
|
158
176
|
super(raw, 'StripeUnknownError');
|
|
159
177
|
}
|
|
160
178
|
}
|
|
179
|
+
// classDefinitions: The beginning of the section generated from our OpenAPI spec
|
|
180
|
+
export class TemporarySessionExpiredError extends StripeError {
|
|
181
|
+
constructor(rawStripeError = {}) {
|
|
182
|
+
super(rawStripeError, 'TemporarySessionExpiredError');
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
// classDefinitions: The end of the section generated from our OpenAPI spec
|
package/esm/RequestSender.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { StripeAPIError, StripeAuthenticationError, StripeConnectionError, StripeError, StripePermissionError, StripeRateLimitError, } from './Error.js';
|
|
2
|
-
import { emitWarning, jsonStringifyRequestData, normalizeHeaders, removeNullish, queryStringifyRequestData, getDataFromArgs, getOptionsFromArgs, } from './utils.js';
|
|
1
|
+
import { StripeAPIError, StripeAuthenticationError, StripeConnectionError, StripeError, StripePermissionError, StripeRateLimitError, generateV1Error, generateV2Error, } from './Error.js';
|
|
3
2
|
import { HttpClient } from './net/HttpClient.js';
|
|
4
|
-
import {
|
|
3
|
+
import { emitWarning, jsonStringifyRequestData, normalizeHeaders, queryStringifyRequestData, removeNullish, getAPIMode, getOptionsFromArgs, getDataFromArgs, } from './utils.js';
|
|
5
4
|
const MAX_RETRY_AFTER_WAIT = 60;
|
|
6
5
|
export class RequestSender {
|
|
7
6
|
constructor(stripe, maxBufferedRequestMetric) {
|
|
@@ -67,7 +66,7 @@ export class RequestSender {
|
|
|
67
66
|
* parses the JSON and returns it (i.e. passes it to the callback) if there
|
|
68
67
|
* is no "error" field. Otherwise constructs/passes an appropriate Error.
|
|
69
68
|
*/
|
|
70
|
-
_jsonResponseHandler(requestEvent, usage, callback) {
|
|
69
|
+
_jsonResponseHandler(requestEvent, apiMode, usage, callback) {
|
|
71
70
|
return (res) => {
|
|
72
71
|
const headers = res.getHeaders();
|
|
73
72
|
const requestId = this._getRequestId(headers);
|
|
@@ -99,8 +98,11 @@ export class RequestSender {
|
|
|
99
98
|
else if (statusCode === 429) {
|
|
100
99
|
err = new StripeRateLimitError(jsonResponse.error);
|
|
101
100
|
}
|
|
101
|
+
else if (apiMode === 'v2') {
|
|
102
|
+
err = generateV2Error(jsonResponse.error);
|
|
103
|
+
}
|
|
102
104
|
else {
|
|
103
|
-
err =
|
|
105
|
+
err = generateV1Error(jsonResponse.error);
|
|
104
106
|
}
|
|
105
107
|
throw err;
|
|
106
108
|
}
|
|
@@ -172,7 +174,7 @@ export class RequestSender {
|
|
|
172
174
|
// Apply exponential backoff with initialNetworkRetryDelay on the
|
|
173
175
|
// number of numRetries so far as inputs. Do not allow the number to exceed
|
|
174
176
|
// maxNetworkRetryDelay.
|
|
175
|
-
let sleepSeconds = Math.min(initialNetworkRetryDelay * Math.pow(numRetries - 1
|
|
177
|
+
let sleepSeconds = Math.min(initialNetworkRetryDelay * Math.pow(2, numRetries - 1), maxNetworkRetryDelay);
|
|
176
178
|
// Apply some jitter by randomizing the value in the range of
|
|
177
179
|
// (sleepSeconds / 2) to (sleepSeconds).
|
|
178
180
|
sleepSeconds *= 0.5 * (1 + Math.random());
|
|
@@ -191,26 +193,34 @@ export class RequestSender {
|
|
|
191
193
|
? settings.maxNetworkRetries
|
|
192
194
|
: this._stripe.getMaxNetworkRetries();
|
|
193
195
|
}
|
|
194
|
-
_defaultIdempotencyKey(method, settings) {
|
|
196
|
+
_defaultIdempotencyKey(method, settings, apiMode) {
|
|
195
197
|
// If this is a POST and we allow multiple retries, ensure an idempotency key.
|
|
196
198
|
const maxRetries = this._getMaxNetworkRetries(settings);
|
|
197
|
-
|
|
198
|
-
|
|
199
|
+
const genKey = () => `stripe-node-retry-${this._stripe._platformFunctions.uuid4()}`;
|
|
200
|
+
// more verbose than it needs to be, but gives clear separation between V1 and V2 behavior
|
|
201
|
+
if (apiMode === 'v2') {
|
|
202
|
+
if (method === 'POST' || method === 'DELETE') {
|
|
203
|
+
return genKey();
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
else if (apiMode === 'v1') {
|
|
207
|
+
if (method === 'POST' && maxRetries > 0) {
|
|
208
|
+
return genKey();
|
|
209
|
+
}
|
|
199
210
|
}
|
|
200
211
|
return null;
|
|
201
212
|
}
|
|
202
|
-
_makeHeaders(
|
|
213
|
+
_makeHeaders({ contentType, contentLength, apiVersion, clientUserAgent, method, userSuppliedHeaders, userSuppliedSettings, stripeAccount, stripeContext, apiMode, }) {
|
|
203
214
|
const defaultHeaders = {
|
|
204
|
-
// Use specified auth token or use default from this stripe instance:
|
|
205
|
-
Authorization: auth ? `Bearer ${auth}` : this._stripe.getApiField('auth'),
|
|
206
215
|
Accept: 'application/json',
|
|
207
216
|
'Content-Type': contentType,
|
|
208
|
-
'User-Agent': this._getUserAgentString(),
|
|
217
|
+
'User-Agent': this._getUserAgentString(apiMode),
|
|
209
218
|
'X-Stripe-Client-User-Agent': clientUserAgent,
|
|
210
219
|
'X-Stripe-Client-Telemetry': this._getTelemetryHeader(),
|
|
211
220
|
'Stripe-Version': apiVersion,
|
|
212
|
-
'Stripe-Account':
|
|
213
|
-
'
|
|
221
|
+
'Stripe-Account': stripeAccount,
|
|
222
|
+
'Stripe-Context': stripeContext,
|
|
223
|
+
'Idempotency-Key': this._defaultIdempotencyKey(method, userSuppliedSettings, apiMode),
|
|
214
224
|
};
|
|
215
225
|
// As per https://datatracker.ietf.org/doc/html/rfc7230#section-3.3.2:
|
|
216
226
|
// A user agent SHOULD send a Content-Length in a request message when
|
|
@@ -239,12 +249,12 @@ export class RequestSender {
|
|
|
239
249
|
// If the user supplied, say 'idempotency-key', override instead of appending by ensuring caps are the same.
|
|
240
250
|
normalizeHeaders(userSuppliedHeaders));
|
|
241
251
|
}
|
|
242
|
-
_getUserAgentString() {
|
|
252
|
+
_getUserAgentString(apiMode) {
|
|
243
253
|
const packageVersion = this._stripe.getConstant('PACKAGE_VERSION');
|
|
244
254
|
const appInfo = this._stripe._appInfo
|
|
245
255
|
? this._stripe.getAppInfoAsString()
|
|
246
256
|
: '';
|
|
247
|
-
return `Stripe
|
|
257
|
+
return `Stripe/${apiMode} NodeBindings/${packageVersion} ${appInfo}`.trim();
|
|
248
258
|
}
|
|
249
259
|
_getTelemetryHeader() {
|
|
250
260
|
if (this._stripe.getTelemetryEnabled() &&
|
|
@@ -287,19 +297,19 @@ export class RequestSender {
|
|
|
287
297
|
const dataFromArgs = getDataFromArgs(args);
|
|
288
298
|
const data = Object.assign({}, dataFromArgs);
|
|
289
299
|
const calculatedOptions = getOptionsFromArgs(args);
|
|
290
|
-
const apiMode = calculatedOptions.apiMode || 'standard';
|
|
291
300
|
const headers = calculatedOptions.headers;
|
|
301
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
302
|
+
const authenticator = calculatedOptions.authenticator;
|
|
292
303
|
opts = {
|
|
293
304
|
requestMethod,
|
|
294
305
|
requestPath: path,
|
|
295
306
|
bodyData: data,
|
|
296
307
|
queryData: {},
|
|
297
|
-
|
|
308
|
+
authenticator,
|
|
298
309
|
headers,
|
|
299
310
|
host: null,
|
|
300
311
|
streaming: false,
|
|
301
312
|
settings: {},
|
|
302
|
-
apiMode: apiMode,
|
|
303
313
|
usage: ['raw_request'],
|
|
304
314
|
};
|
|
305
315
|
}
|
|
@@ -316,12 +326,17 @@ export class RequestSender {
|
|
|
316
326
|
}
|
|
317
327
|
}
|
|
318
328
|
const { headers, settings } = opts;
|
|
319
|
-
|
|
329
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
330
|
+
const authenticator = opts.authenticator;
|
|
331
|
+
this._request(opts.requestMethod, opts.host, path, opts.bodyData, authenticator, { headers, settings, streaming: opts.streaming }, opts.usage, requestCallback);
|
|
320
332
|
});
|
|
321
333
|
return requestPromise;
|
|
322
334
|
}
|
|
323
|
-
_request(method, host, path, data,
|
|
335
|
+
_request(method, host, path, data, authenticator, options, usage = [], callback, requestDataProcessor = null) {
|
|
336
|
+
var _a;
|
|
324
337
|
let requestData;
|
|
338
|
+
authenticator = (_a = authenticator !== null && authenticator !== void 0 ? authenticator : this._stripe._authenticator) !== null && _a !== void 0 ? _a : null;
|
|
339
|
+
const apiMode = getAPIMode(path);
|
|
325
340
|
const retryRequest = (requestFn, apiVersion, headers, requestRetries, retryAfter) => {
|
|
326
341
|
return setTimeout(requestFn, this._getSleepTimeInMS(requestRetries, retryAfter), apiVersion, headers, requestRetries + 1);
|
|
327
342
|
};
|
|
@@ -333,50 +348,68 @@ export class RequestSender {
|
|
|
333
348
|
options.settings.timeout >= 0
|
|
334
349
|
? options.settings.timeout
|
|
335
350
|
: this._stripe.getApiField('timeout');
|
|
336
|
-
const
|
|
337
|
-
.getApiField('
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
if (RequestSender._shouldRetry(null, requestRetries, maxRetries, error)) {
|
|
368
|
-
return retryRequest(makeRequest, apiVersion, headers, requestRetries, null);
|
|
369
|
-
}
|
|
370
|
-
else {
|
|
371
|
-
const isTimeoutError = error.code && error.code === HttpClient.TIMEOUT_ERROR_CODE;
|
|
372
|
-
return callback(new StripeConnectionError({
|
|
373
|
-
message: isTimeoutError
|
|
374
|
-
? `Request aborted due to timeout being reached (${timeout}ms)`
|
|
375
|
-
: RequestSender._generateConnectionErrorMessage(requestRetries),
|
|
351
|
+
const request = {
|
|
352
|
+
host: host || this._stripe.getApiField('host'),
|
|
353
|
+
port: this._stripe.getApiField('port'),
|
|
354
|
+
path: path,
|
|
355
|
+
method: method,
|
|
356
|
+
headers: Object.assign({}, headers),
|
|
357
|
+
body: requestData,
|
|
358
|
+
protocol: this._stripe.getApiField('protocol'),
|
|
359
|
+
};
|
|
360
|
+
authenticator(request)
|
|
361
|
+
.then(() => {
|
|
362
|
+
const req = this._stripe
|
|
363
|
+
.getApiField('httpClient')
|
|
364
|
+
.makeRequest(request.host, request.port, request.path, request.method, request.headers, request.body, request.protocol, timeout);
|
|
365
|
+
const requestStartTime = Date.now();
|
|
366
|
+
// @ts-ignore
|
|
367
|
+
const requestEvent = removeNullish({
|
|
368
|
+
api_version: apiVersion,
|
|
369
|
+
account: headers['Stripe-Account'],
|
|
370
|
+
idempotency_key: headers['Idempotency-Key'],
|
|
371
|
+
method,
|
|
372
|
+
path,
|
|
373
|
+
request_start_time: requestStartTime,
|
|
374
|
+
});
|
|
375
|
+
const requestRetries = numRetries || 0;
|
|
376
|
+
const maxRetries = this._getMaxNetworkRetries(options.settings || {});
|
|
377
|
+
this._stripe._emitter.emit('request', requestEvent);
|
|
378
|
+
req
|
|
379
|
+
.then((res) => {
|
|
380
|
+
if (RequestSender._shouldRetry(res, requestRetries, maxRetries)) {
|
|
381
|
+
return retryRequest(makeRequest, apiVersion, headers, requestRetries,
|
|
376
382
|
// @ts-ignore
|
|
377
|
-
|
|
378
|
-
}
|
|
379
|
-
|
|
383
|
+
res.getHeaders()['retry-after']);
|
|
384
|
+
}
|
|
385
|
+
else if (options.streaming && res.getStatusCode() < 400) {
|
|
386
|
+
return this._streamingResponseHandler(requestEvent, usage, callback)(res);
|
|
387
|
+
}
|
|
388
|
+
else {
|
|
389
|
+
return this._jsonResponseHandler(requestEvent, apiMode, usage, callback)(res);
|
|
390
|
+
}
|
|
391
|
+
})
|
|
392
|
+
.catch((error) => {
|
|
393
|
+
if (RequestSender._shouldRetry(null, requestRetries, maxRetries, error)) {
|
|
394
|
+
return retryRequest(makeRequest, apiVersion, headers, requestRetries, null);
|
|
395
|
+
}
|
|
396
|
+
else {
|
|
397
|
+
const isTimeoutError = error.code && error.code === HttpClient.TIMEOUT_ERROR_CODE;
|
|
398
|
+
return callback(new StripeConnectionError({
|
|
399
|
+
message: isTimeoutError
|
|
400
|
+
? `Request aborted due to timeout being reached (${timeout}ms)`
|
|
401
|
+
: RequestSender._generateConnectionErrorMessage(requestRetries),
|
|
402
|
+
// @ts-ignore
|
|
403
|
+
detail: error,
|
|
404
|
+
}));
|
|
405
|
+
}
|
|
406
|
+
});
|
|
407
|
+
})
|
|
408
|
+
.catch((e) => {
|
|
409
|
+
throw new StripeError({
|
|
410
|
+
message: 'Unable to authenticate the request',
|
|
411
|
+
exception: e,
|
|
412
|
+
});
|
|
380
413
|
});
|
|
381
414
|
};
|
|
382
415
|
const prepareAndMakeRequest = (error, data) => {
|
|
@@ -384,15 +417,22 @@ export class RequestSender {
|
|
|
384
417
|
return callback(error);
|
|
385
418
|
}
|
|
386
419
|
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
420
|
this._stripe.getClientUserAgent((clientUserAgent) => {
|
|
394
|
-
|
|
395
|
-
const headers = this._makeHeaders(
|
|
421
|
+
const apiVersion = this._stripe.getApiField('version');
|
|
422
|
+
const headers = this._makeHeaders({
|
|
423
|
+
contentType: apiMode == 'v2'
|
|
424
|
+
? 'application/json'
|
|
425
|
+
: 'application/x-www-form-urlencoded',
|
|
426
|
+
contentLength: requestData.length,
|
|
427
|
+
apiVersion: apiVersion,
|
|
428
|
+
clientUserAgent,
|
|
429
|
+
method,
|
|
430
|
+
userSuppliedHeaders: options.headers,
|
|
431
|
+
userSuppliedSettings: options.settings,
|
|
432
|
+
stripeAccount: apiMode == 'v2' ? null : this._stripe.getApiField('stripeAccount'),
|
|
433
|
+
stripeContext: apiMode == 'v2' ? this._stripe.getApiField('stripeContext') : null,
|
|
434
|
+
apiMode: apiMode,
|
|
435
|
+
});
|
|
396
436
|
makeRequest(apiVersion, headers, 0);
|
|
397
437
|
});
|
|
398
438
|
};
|
|
@@ -401,11 +441,11 @@ export class RequestSender {
|
|
|
401
441
|
}
|
|
402
442
|
else {
|
|
403
443
|
let stringifiedData;
|
|
404
|
-
if (
|
|
444
|
+
if (apiMode == 'v2') {
|
|
405
445
|
stringifiedData = data ? jsonStringifyRequestData(data) : '';
|
|
406
446
|
}
|
|
407
447
|
else {
|
|
408
|
-
stringifiedData = queryStringifyRequestData(data || {});
|
|
448
|
+
stringifiedData = queryStringifyRequestData(data || {}, apiMode);
|
|
409
449
|
}
|
|
410
450
|
prepareAndMakeRequest(null, stringifiedData);
|
|
411
451
|
}
|
package/esm/StripeResource.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getDataFromArgs, getOptionsFromArgs, makeURLInterpolator, protoExtend, queryStringifyRequestData, } from './utils.js';
|
|
1
|
+
import { getDataFromArgs, getOptionsFromArgs, makeURLInterpolator, protoExtend, queryStringifyRequestData, getAPIMode, } 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;
|
|
@@ -75,6 +75,7 @@ StripeResource.prototype = {
|
|
|
75
75
|
return parts.join('/').replace(/\/{2,}/g, '/');
|
|
76
76
|
},
|
|
77
77
|
_getRequestOpts(requestArgs, spec, overrideData) {
|
|
78
|
+
var _a;
|
|
78
79
|
// Extract spec values with defaults.
|
|
79
80
|
const requestMethod = (spec.method || 'GET').toUpperCase();
|
|
80
81
|
const usage = spec.usage || [];
|
|
@@ -125,7 +126,7 @@ StripeResource.prototype = {
|
|
|
125
126
|
requestPath,
|
|
126
127
|
bodyData,
|
|
127
128
|
queryData,
|
|
128
|
-
|
|
129
|
+
authenticator: (_a = options.authenticator) !== null && _a !== void 0 ? _a : null,
|
|
129
130
|
headers,
|
|
130
131
|
host: host !== null && host !== void 0 ? host : null,
|
|
131
132
|
streaming,
|
|
@@ -158,10 +159,14 @@ StripeResource.prototype = {
|
|
|
158
159
|
const path = [
|
|
159
160
|
opts.requestPath,
|
|
160
161
|
emptyQuery ? '' : '?',
|
|
161
|
-
queryStringifyRequestData(opts.queryData),
|
|
162
|
+
queryStringifyRequestData(opts.queryData, getAPIMode(opts.requestPath)),
|
|
162
163
|
].join('');
|
|
163
164
|
const { headers, settings } = opts;
|
|
164
|
-
this._stripe._requestSender._request(opts.requestMethod, opts.host, path, opts.bodyData, opts.
|
|
165
|
+
this._stripe._requestSender._request(opts.requestMethod, opts.host, path, opts.bodyData, opts.authenticator, {
|
|
166
|
+
headers,
|
|
167
|
+
settings,
|
|
168
|
+
streaming: opts.streaming,
|
|
169
|
+
}, opts.usage, requestCallback, (_a = this.requestDataProcessor) === null || _a === void 0 ? void 0 : _a.bind(this));
|
|
165
170
|
});
|
|
166
171
|
},
|
|
167
172
|
};
|
package/esm/apiVersion.js
CHANGED
package/esm/autoPagination.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { callbackifyPromiseWithTimeout, getDataFromArgs } from './utils.js';
|
|
2
|
-
class
|
|
1
|
+
import { callbackifyPromiseWithTimeout, getDataFromArgs, getAPIMode, } from './utils.js';
|
|
2
|
+
class V1Iterator {
|
|
3
3
|
constructor(firstPagePromise, requestArgs, spec, stripeResource) {
|
|
4
4
|
this.index = 0;
|
|
5
5
|
this.pagePromise = firstPagePromise;
|
|
@@ -57,7 +57,7 @@ class StripeIterator {
|
|
|
57
57
|
return nextPromise;
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
class
|
|
60
|
+
class V1ListIterator extends V1Iterator {
|
|
61
61
|
getNextPage(pageResult) {
|
|
62
62
|
const reverseIteration = isReverseIteration(this.requestArgs);
|
|
63
63
|
const lastId = getLastId(pageResult, reverseIteration);
|
|
@@ -66,7 +66,7 @@ class ListIterator extends StripeIterator {
|
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
class
|
|
69
|
+
class V1SearchIterator extends V1Iterator {
|
|
70
70
|
getNextPage(pageResult) {
|
|
71
71
|
if (!pageResult.next_page) {
|
|
72
72
|
throw Error('Unexpected: Stripe API response does not have a well-formed `next_page` field, but `has_more` was true.');
|
|
@@ -76,12 +76,56 @@ class SearchIterator extends StripeIterator {
|
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
+
class V2ListIterator {
|
|
80
|
+
constructor(firstPagePromise, requestArgs, spec, stripeResource) {
|
|
81
|
+
this.currentPageIterator = (async () => {
|
|
82
|
+
const page = await firstPagePromise;
|
|
83
|
+
return page.data[Symbol.iterator]();
|
|
84
|
+
})();
|
|
85
|
+
this.nextPageUrl = (async () => {
|
|
86
|
+
const page = await firstPagePromise;
|
|
87
|
+
return page.next_page_url || null;
|
|
88
|
+
})();
|
|
89
|
+
this.requestArgs = requestArgs;
|
|
90
|
+
this.spec = spec;
|
|
91
|
+
this.stripeResource = stripeResource;
|
|
92
|
+
}
|
|
93
|
+
async turnPage() {
|
|
94
|
+
const nextPageUrl = await this.nextPageUrl;
|
|
95
|
+
if (!nextPageUrl)
|
|
96
|
+
return null;
|
|
97
|
+
this.spec.fullPath = nextPageUrl;
|
|
98
|
+
const page = await this.stripeResource._makeRequest([], this.spec, {});
|
|
99
|
+
this.nextPageUrl = Promise.resolve(page.next_page_url);
|
|
100
|
+
this.currentPageIterator = Promise.resolve(page.data[Symbol.iterator]());
|
|
101
|
+
return this.currentPageIterator;
|
|
102
|
+
}
|
|
103
|
+
async next() {
|
|
104
|
+
{
|
|
105
|
+
const result = (await this.currentPageIterator).next();
|
|
106
|
+
if (!result.done)
|
|
107
|
+
return { done: false, value: result.value };
|
|
108
|
+
}
|
|
109
|
+
const nextPageIterator = await this.turnPage();
|
|
110
|
+
if (!nextPageIterator) {
|
|
111
|
+
return { done: true, value: undefined };
|
|
112
|
+
}
|
|
113
|
+
const result = nextPageIterator.next();
|
|
114
|
+
if (!result.done)
|
|
115
|
+
return { done: false, value: result.value };
|
|
116
|
+
return { done: true, value: undefined };
|
|
117
|
+
}
|
|
118
|
+
}
|
|
79
119
|
export const makeAutoPaginationMethods = (stripeResource, requestArgs, spec, firstPagePromise) => {
|
|
80
|
-
|
|
81
|
-
|
|
120
|
+
const apiMode = getAPIMode(spec.fullPath || spec.path);
|
|
121
|
+
if (apiMode !== 'v2' && spec.methodType === 'search') {
|
|
122
|
+
return makeAutoPaginationMethodsFromIterator(new V1SearchIterator(firstPagePromise, requestArgs, spec, stripeResource));
|
|
123
|
+
}
|
|
124
|
+
if (apiMode !== 'v2' && spec.methodType === 'list') {
|
|
125
|
+
return makeAutoPaginationMethodsFromIterator(new V1ListIterator(firstPagePromise, requestArgs, spec, stripeResource));
|
|
82
126
|
}
|
|
83
|
-
if (spec.methodType === 'list') {
|
|
84
|
-
return makeAutoPaginationMethodsFromIterator(new
|
|
127
|
+
if (apiMode === 'v2' && spec.methodType === 'list') {
|
|
128
|
+
return makeAutoPaginationMethodsFromIterator(new V2ListIterator(firstPagePromise, requestArgs, spec, stripeResource));
|
|
85
129
|
}
|
|
86
130
|
return null;
|
|
87
131
|
};
|
|
@@ -28,6 +28,12 @@ export class CryptoProvider {
|
|
|
28
28
|
computeHMACSignatureAsync(payload, secret) {
|
|
29
29
|
throw new Error('computeHMACSignatureAsync not implemented.');
|
|
30
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Computes a SHA-256 hash of the data.
|
|
33
|
+
*/
|
|
34
|
+
computeSHA256Async(data) {
|
|
35
|
+
throw new Error('computeSHA256 not implemented.');
|
|
36
|
+
}
|
|
31
37
|
}
|
|
32
38
|
/**
|
|
33
39
|
* If the crypto provider only supports asynchronous operations,
|
|
@@ -16,4 +16,11 @@ export class NodeCryptoProvider extends CryptoProvider {
|
|
|
16
16
|
const signature = await this.computeHMACSignature(payload, secret);
|
|
17
17
|
return signature;
|
|
18
18
|
}
|
|
19
|
+
/** @override */
|
|
20
|
+
async computeSHA256Async(data) {
|
|
21
|
+
return new Uint8Array(await crypto
|
|
22
|
+
.createHash('sha256')
|
|
23
|
+
.update(data)
|
|
24
|
+
.digest());
|
|
25
|
+
}
|
|
19
26
|
}
|
|
@@ -34,6 +34,10 @@ export class SubtleCryptoProvider extends CryptoProvider {
|
|
|
34
34
|
}
|
|
35
35
|
return signatureHexCodes.join('');
|
|
36
36
|
}
|
|
37
|
+
/** @override */
|
|
38
|
+
async computeSHA256Async(data) {
|
|
39
|
+
return new Uint8Array(await this.subtleCrypto.digest('SHA-256', data));
|
|
40
|
+
}
|
|
37
41
|
}
|
|
38
42
|
// Cached mapping of byte to hex representation. We do this once to avoid re-
|
|
39
43
|
// computing every time we need to convert the result of a signature to hex.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec
|
|
2
2
|
import { StripeResource } from '../../StripeResource.js';
|
|
3
3
|
const stripeMethod = StripeResource.method;
|
|
4
|
-
export const
|
|
4
|
+
export const CreditBalanceSummary = StripeResource.extend({
|
|
5
5
|
retrieve: stripeMethod({
|
|
6
6
|
method: 'GET',
|
|
7
|
-
fullPath: '/v1/
|
|
7
|
+
fullPath: '/v1/billing/credit_balance_summary',
|
|
8
8
|
}),
|
|
9
9
|
});
|
package/esm/resources/{FinancialConnections/Institutions.js → Billing/CreditBalanceTransactions.js}
RENAMED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec
|
|
2
2
|
import { StripeResource } from '../../StripeResource.js';
|
|
3
3
|
const stripeMethod = StripeResource.method;
|
|
4
|
-
export const
|
|
4
|
+
export const CreditBalanceTransactions = StripeResource.extend({
|
|
5
5
|
retrieve: stripeMethod({
|
|
6
6
|
method: 'GET',
|
|
7
|
-
fullPath: '/v1/
|
|
7
|
+
fullPath: '/v1/billing/credit_balance_transactions/{id}',
|
|
8
8
|
}),
|
|
9
9
|
list: stripeMethod({
|
|
10
10
|
method: 'GET',
|
|
11
|
-
fullPath: '/v1/
|
|
11
|
+
fullPath: '/v1/billing/credit_balance_transactions',
|
|
12
12
|
methodType: 'list',
|
|
13
13
|
}),
|
|
14
14
|
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec
|
|
2
|
+
import { StripeResource } from '../../StripeResource.js';
|
|
3
|
+
const stripeMethod = StripeResource.method;
|
|
4
|
+
export const CreditGrants = StripeResource.extend({
|
|
5
|
+
create: stripeMethod({ method: 'POST', fullPath: '/v1/billing/credit_grants' }),
|
|
6
|
+
retrieve: stripeMethod({
|
|
7
|
+
method: 'GET',
|
|
8
|
+
fullPath: '/v1/billing/credit_grants/{id}',
|
|
9
|
+
}),
|
|
10
|
+
update: stripeMethod({
|
|
11
|
+
method: 'POST',
|
|
12
|
+
fullPath: '/v1/billing/credit_grants/{id}',
|
|
13
|
+
}),
|
|
14
|
+
list: stripeMethod({
|
|
15
|
+
method: 'GET',
|
|
16
|
+
fullPath: '/v1/billing/credit_grants',
|
|
17
|
+
methodType: 'list',
|
|
18
|
+
}),
|
|
19
|
+
expire: stripeMethod({
|
|
20
|
+
method: 'POST',
|
|
21
|
+
fullPath: '/v1/billing/credit_grants/{id}/expire',
|
|
22
|
+
}),
|
|
23
|
+
voidGrant: stripeMethod({
|
|
24
|
+
method: 'POST',
|
|
25
|
+
fullPath: '/v1/billing/credit_grants/{id}/void',
|
|
26
|
+
}),
|
|
27
|
+
});
|
|
@@ -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,14 +15,6 @@ export const Invoices = StripeResource.extend({
|
|
|
15
15
|
method: 'POST',
|
|
16
16
|
fullPath: '/v1/invoices/{invoice}/add_lines',
|
|
17
17
|
}),
|
|
18
|
-
attachPayment: stripeMethod({
|
|
19
|
-
method: 'POST',
|
|
20
|
-
fullPath: '/v1/invoices/{invoice}/attach_payment',
|
|
21
|
-
}),
|
|
22
|
-
attachPaymentIntent: stripeMethod({
|
|
23
|
-
method: 'POST',
|
|
24
|
-
fullPath: '/v1/invoices/{invoice}/attach_payment_intent',
|
|
25
|
-
}),
|
|
26
18
|
createPreview: stripeMethod({
|
|
27
19
|
method: 'POST',
|
|
28
20
|
fullPath: '/v1/invoices/create_preview',
|
|
@@ -36,11 +28,6 @@ export const Invoices = StripeResource.extend({
|
|
|
36
28
|
fullPath: '/v1/invoices/{invoice}/lines',
|
|
37
29
|
methodType: 'list',
|
|
38
30
|
}),
|
|
39
|
-
listPayments: stripeMethod({
|
|
40
|
-
method: 'GET',
|
|
41
|
-
fullPath: '/v1/invoices/{invoice}/payments',
|
|
42
|
-
methodType: 'list',
|
|
43
|
-
}),
|
|
44
31
|
listUpcomingLines: stripeMethod({
|
|
45
32
|
method: 'GET',
|
|
46
33
|
fullPath: '/v1/invoices/upcoming/lines',
|
|
@@ -55,10 +42,6 @@ export const Invoices = StripeResource.extend({
|
|
|
55
42
|
method: 'POST',
|
|
56
43
|
fullPath: '/v1/invoices/{invoice}/remove_lines',
|
|
57
44
|
}),
|
|
58
|
-
retrievePayment: stripeMethod({
|
|
59
|
-
method: 'GET',
|
|
60
|
-
fullPath: '/v1/invoices/{invoice}/payments/{invoice_payment}',
|
|
61
|
-
}),
|
|
62
45
|
retrieveUpcoming: stripeMethod({
|
|
63
46
|
method: 'GET',
|
|
64
47
|
fullPath: '/v1/invoices/upcoming',
|
|
@@ -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',
|