From 96d3dc5a5d639f731f496cf7c27ddd5494727cf4 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Thu, 16 Mar 2023 01:36:07 +0000 Subject: [PATCH 1/7] Update generated code for v261 --- OPENAPI_VERSION | 2 +- types/AccountsResource.d.ts | 21 ++++ types/BankAccounts.d.ts | 198 ++++++++++++++++++++++++++++++++++++ 3 files changed, 220 insertions(+), 1 deletion(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index f93f657afe..23ee098c2d 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v249 \ No newline at end of file +v261 \ No newline at end of file diff --git a/types/AccountsResource.d.ts b/types/AccountsResource.d.ts index 98660a0e03..e2eea57fb9 100644 --- a/types/AccountsResource.d.ts +++ b/types/AccountsResource.d.ts @@ -2908,6 +2908,11 @@ declare module 'stripe' { */ default_for_currency?: boolean; + /** + * Documents that may be submitted to satisfy various informational requests. + */ + documents?: ExternalAccountUpdateParams.Documents; + /** * Two digit number representing the card's expiration month. */ @@ -2938,6 +2943,22 @@ declare module 'stripe' { type AccountHolderType = 'company' | 'individual'; type AccountType = 'checking' | 'futsu' | 'savings' | 'toza'; + + interface Documents { + /** + * One or more documents that support the [Bank account ownership verification](https://support.stripe.com/questions/bank-account-ownership-verification) requirement. Must be a document associated with the bank account that displays the last 4 digits of the account number, either a statement or a voided check. + */ + bank_account_ownership_verification?: Documents.BankAccountOwnershipVerification; + } + + namespace Documents { + interface BankAccountOwnershipVerification { + /** + * One or more document ids returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `account_requirement`. + */ + files?: Array; + } + } } interface PersonUpdateParams { diff --git a/types/BankAccounts.d.ts b/types/BankAccounts.d.ts index 632b6e627f..8d22ba360c 100644 --- a/types/BankAccounts.d.ts +++ b/types/BankAccounts.d.ts @@ -81,6 +81,11 @@ declare module 'stripe' { */ fingerprint: string | null; + /** + * Information about upcoming new requirements for the bank account, including what information needs to be collected. + */ + future_requirements?: BankAccount.FutureRequirements | null; + /** * The last four digits of the bank account number. */ @@ -91,6 +96,11 @@ declare module 'stripe' { */ metadata?: Stripe.Metadata | null; + /** + * Information about the requirements for the bank account, including what information needs to be collected. + */ + requirements?: BankAccount.Requirements | null; + /** * The routing transit number for the bank account. */ @@ -106,6 +116,194 @@ declare module 'stripe' { namespace BankAccount { type AvailablePayoutMethod = 'instant' | 'standard'; + + interface FutureRequirements { + /** + * Fields that need to be collected to keep the external account enabled. If not collected by `current_deadline`, these fields appear in `past_due` as well, and the account is disabled. + */ + currently_due: Array | null; + + /** + * Fields that are `currently_due` and need to be collected again because validation or verification failed. + */ + errors: Array | null; + + /** + * Fields that weren't collected by `current_deadline`. These fields need to be collected to enable the external account. + */ + past_due: Array | null; + + /** + * Fields that may become required depending on the results of verification or review. Will be an empty array unless an asynchronous verification is pending. If verification fails, these fields move to `eventually_due`, `currently_due`, or `past_due`. + */ + pending_verification: Array | null; + } + + namespace FutureRequirements { + interface Error { + /** + * The code for the type of error. + */ + code: Error.Code; + + /** + * An informative message that indicates the error type and provides additional details about the error. + */ + reason: string; + + /** + * The specific user onboarding requirement field (in the requirements hash) that needs to be resolved. + */ + requirement: string; + } + + namespace Error { + type Code = + | 'invalid_address_city_state_postal_code' + | 'invalid_dob_age_under_18' + | 'invalid_representative_country' + | 'invalid_street_address' + | 'invalid_tos_acceptance' + | 'invalid_value_other' + | 'verification_document_address_mismatch' + | 'verification_document_address_missing' + | 'verification_document_corrupt' + | 'verification_document_country_not_supported' + | 'verification_document_dob_mismatch' + | 'verification_document_duplicate_type' + | 'verification_document_expired' + | 'verification_document_failed_copy' + | 'verification_document_failed_greyscale' + | 'verification_document_failed_other' + | 'verification_document_failed_test_mode' + | 'verification_document_fraudulent' + | 'verification_document_id_number_mismatch' + | 'verification_document_id_number_missing' + | 'verification_document_incomplete' + | 'verification_document_invalid' + | 'verification_document_issue_or_expiry_date_missing' + | 'verification_document_manipulated' + | 'verification_document_missing_back' + | 'verification_document_missing_front' + | 'verification_document_name_mismatch' + | 'verification_document_name_missing' + | 'verification_document_nationality_mismatch' + | 'verification_document_not_readable' + | 'verification_document_not_signed' + | 'verification_document_not_uploaded' + | 'verification_document_photo_mismatch' + | 'verification_document_too_large' + | 'verification_document_type_not_supported' + | 'verification_failed_address_match' + | 'verification_failed_business_iec_number' + | 'verification_failed_document_match' + | 'verification_failed_id_number_match' + | 'verification_failed_keyed_identity' + | 'verification_failed_keyed_match' + | 'verification_failed_name_match' + | 'verification_failed_other' + | 'verification_failed_residential_address' + | 'verification_failed_tax_id_match' + | 'verification_failed_tax_id_not_issued' + | 'verification_missing_executives' + | 'verification_missing_owners' + | 'verification_requires_additional_memorandum_of_associations'; + } + } + + interface Requirements { + /** + * Fields that need to be collected to keep the external account enabled. If not collected by `current_deadline`, these fields appear in `past_due` as well, and the account is disabled. + */ + currently_due: Array | null; + + /** + * Fields that are `currently_due` and need to be collected again because validation or verification failed. + */ + errors: Array | null; + + /** + * Fields that weren't collected by `current_deadline`. These fields need to be collected to enable the external account. + */ + past_due: Array | null; + + /** + * Fields that may become required depending on the results of verification or review. Will be an empty array unless an asynchronous verification is pending. If verification fails, these fields move to `eventually_due`, `currently_due`, or `past_due`. + */ + pending_verification: Array | null; + } + + namespace Requirements { + interface Error { + /** + * The code for the type of error. + */ + code: Error.Code; + + /** + * An informative message that indicates the error type and provides additional details about the error. + */ + reason: string; + + /** + * The specific user onboarding requirement field (in the requirements hash) that needs to be resolved. + */ + requirement: string; + } + + namespace Error { + type Code = + | 'invalid_address_city_state_postal_code' + | 'invalid_dob_age_under_18' + | 'invalid_representative_country' + | 'invalid_street_address' + | 'invalid_tos_acceptance' + | 'invalid_value_other' + | 'verification_document_address_mismatch' + | 'verification_document_address_missing' + | 'verification_document_corrupt' + | 'verification_document_country_not_supported' + | 'verification_document_dob_mismatch' + | 'verification_document_duplicate_type' + | 'verification_document_expired' + | 'verification_document_failed_copy' + | 'verification_document_failed_greyscale' + | 'verification_document_failed_other' + | 'verification_document_failed_test_mode' + | 'verification_document_fraudulent' + | 'verification_document_id_number_mismatch' + | 'verification_document_id_number_missing' + | 'verification_document_incomplete' + | 'verification_document_invalid' + | 'verification_document_issue_or_expiry_date_missing' + | 'verification_document_manipulated' + | 'verification_document_missing_back' + | 'verification_document_missing_front' + | 'verification_document_name_mismatch' + | 'verification_document_name_missing' + | 'verification_document_nationality_mismatch' + | 'verification_document_not_readable' + | 'verification_document_not_signed' + | 'verification_document_not_uploaded' + | 'verification_document_photo_mismatch' + | 'verification_document_too_large' + | 'verification_document_type_not_supported' + | 'verification_failed_address_match' + | 'verification_failed_business_iec_number' + | 'verification_failed_document_match' + | 'verification_failed_id_number_match' + | 'verification_failed_keyed_identity' + | 'verification_failed_keyed_match' + | 'verification_failed_name_match' + | 'verification_failed_other' + | 'verification_failed_residential_address' + | 'verification_failed_tax_id_match' + | 'verification_failed_tax_id_not_issued' + | 'verification_missing_executives' + | 'verification_missing_owners' + | 'verification_requires_additional_memorandum_of_associations'; + } + } } /** From 2dbbb518310e194b227141774b1e9c1a287e8ae3 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Thu, 16 Mar 2023 20:08:57 +0000 Subject: [PATCH 2/7] Update generated code for v262 --- OPENAPI_VERSION | 2 +- types/Checkout/SessionsResource.d.ts | 2 +- types/PaymentIntents.d.ts | 2 +- types/PaymentIntentsResource.d.ts | 6 +++--- types/PaymentLinks.d.ts | 2 +- types/PaymentLinksResource.d.ts | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 23ee098c2d..8c736d3f50 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v261 \ No newline at end of file +v262 \ No newline at end of file diff --git a/types/Checkout/SessionsResource.d.ts b/types/Checkout/SessionsResource.d.ts index d09a9b8fbd..dc80355cbd 100644 --- a/types/Checkout/SessionsResource.d.ts +++ b/types/Checkout/SessionsResource.d.ts @@ -760,7 +760,7 @@ declare module 'stripe' { } namespace PaymentIntentData { - type CaptureMethod = 'automatic' | 'manual'; + type CaptureMethod = 'automatic' | 'automatic_async' | 'manual'; type SetupFutureUsage = 'off_session' | 'on_session'; diff --git a/types/PaymentIntents.d.ts b/types/PaymentIntents.d.ts index c1c9a17b53..af42386a53 100644 --- a/types/PaymentIntents.d.ts +++ b/types/PaymentIntents.d.ts @@ -253,7 +253,7 @@ declare module 'stripe' { | 'requested_by_customer' | 'void_invoice'; - type CaptureMethod = 'automatic' | 'manual'; + type CaptureMethod = 'automatic' | 'automatic_async' | 'manual'; type ConfirmationMethod = 'automatic' | 'manual'; diff --git a/types/PaymentIntentsResource.d.ts b/types/PaymentIntentsResource.d.ts index 2c8c72aed6..bc58b434b0 100644 --- a/types/PaymentIntentsResource.d.ts +++ b/types/PaymentIntentsResource.d.ts @@ -172,7 +172,7 @@ declare module 'stripe' { enabled: boolean; } - type CaptureMethod = 'automatic' | 'manual'; + type CaptureMethod = 'automatic' | 'automatic_async' | 'manual'; type ConfirmationMethod = 'automatic' | 'manual'; @@ -2035,7 +2035,7 @@ declare module 'stripe' { } namespace PaymentIntentUpdateParams { - type CaptureMethod = 'automatic' | 'manual'; + type CaptureMethod = 'automatic' | 'automatic_async' | 'manual'; interface PaymentMethodData { /** @@ -3894,7 +3894,7 @@ declare module 'stripe' { } namespace PaymentIntentConfirmParams { - type CaptureMethod = 'automatic' | 'manual'; + type CaptureMethod = 'automatic' | 'automatic_async' | 'manual'; interface MandateData1 { /** diff --git a/types/PaymentLinks.d.ts b/types/PaymentLinks.d.ts index 994767731e..4817068359 100644 --- a/types/PaymentLinks.d.ts +++ b/types/PaymentLinks.d.ts @@ -376,7 +376,7 @@ declare module 'stripe' { } namespace PaymentIntentData { - type CaptureMethod = 'automatic' | 'manual'; + type CaptureMethod = 'automatic' | 'automatic_async' | 'manual'; type SetupFutureUsage = 'off_session' | 'on_session'; } diff --git a/types/PaymentLinksResource.d.ts b/types/PaymentLinksResource.d.ts index cec8e54ee5..a9c6c88400 100644 --- a/types/PaymentLinksResource.d.ts +++ b/types/PaymentLinksResource.d.ts @@ -432,7 +432,7 @@ declare module 'stripe' { } namespace PaymentIntentData { - type CaptureMethod = 'automatic' | 'manual'; + type CaptureMethod = 'automatic' | 'automatic_async' | 'manual'; type SetupFutureUsage = 'off_session' | 'on_session'; } From 507fb29035d0cc99ac012b3b867e5895eaeed954 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Thu, 16 Mar 2023 20:50:03 +0000 Subject: [PATCH 3/7] Update generated code for v263 --- OPENAPI_VERSION | 2 +- types/Charges.d.ts | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 8c736d3f50..811b18420b 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v262 \ No newline at end of file +v263 \ No newline at end of file diff --git a/types/Charges.d.ts b/types/Charges.d.ts index b21caaf2b6..1b6a64d2cb 100644 --- a/types/Charges.d.ts +++ b/types/Charges.d.ts @@ -1501,7 +1501,13 @@ declare module 'stripe' { } } - interface Link {} + interface Link { + /** + * Two-letter ISO code representing the funding source country beneath the Link payment. + * You could use this attribute to get a sense of international fees. + */ + country: string | null; + } interface Multibanco { /** From 3259b2b7ea164547e6f21f0fee2885c65edff25d Mon Sep 17 00:00:00 2001 From: Richard Marmorstein Date: Thu, 16 Mar 2023 19:00:50 -0700 Subject: [PATCH 4/7] Bump version to 11.15.0 --- CHANGELOG.md | 28 ++++++++++++++++++++++++++++ VERSION | 2 +- package.json | 2 +- src/stripe.core.ts | 2 +- 4 files changed, 31 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e7c639fcb1..b7c4744790 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,33 @@ # Changelog +## 11.15.0 - 2023-03-16 +* [#1714](https://github.com/stripe/stripe-node/pull/1714) API Updates + * Add support for `cashapp_payments` on `Account.capabilities`, `AccountCreateParams.capabilities`, and `AccountUpdateParams.capabilities` + * Add support for new value `cashapp` as a new `type` throughout the API. + * Add support for `future_requirements` and `requirements` on `BankAccount` + * Add support for `country` on `Charge.payment_method_details.link` + * Add support for new value `automatic_async` on enums `CheckoutSessionCreateParams.payment_intent_data.capture_method`, `PaymentIntent.capture_method`, `PaymentIntentConfirmParams.capture_method`, `PaymentIntentCreateParams.capture_method`, `PaymentIntentUpdateParams.capture_method`, `PaymentLink.payment_intent_data.capture_method`, and `PaymentLinkCreateParams.payment_intent_data.capture_method` + + * Add support for `preferred_locale` on `PaymentIntent.payment_method_options.affirm`, + * Add support for `cashapp_handle_redirect_or_display_qr_code` on `PaymentIntent.next_action` and `SetupIntent.next_action` + * Add support for new value `payout.reconciliation_completed` on enums `WebhookEndpointCreateParams.enabled_events[]` and `WebhookEndpointUpdateParams.enabled_events[]` +* [#1709](https://github.com/stripe/stripe-node/pull/1709) Add ES module package entry point + * Add support for ES modules by defining a separate ESM entry point. This updates stripe-node to be a [dual CommonJS / ES module package](https://nodejs.org/api/packages.html#dual-commonjses-module-packages). +* [#1704](https://github.com/stripe/stripe-node/pull/1704) Configure 2 TypeScript compile targets for ESM and CJS +* [#1710](https://github.com/stripe/stripe-node/pull/1710) Update generated code (new) + * Add support for `cashapp_payments` on `Account.capabilities`, `AccountCreateParams.capabilities`, and `AccountUpdateParams.capabilities` + * Add support for `cashapp` on `Charge.payment_method_details`, `Checkout.Session.payment_method_options`, `CheckoutSessionCreateParams.payment_method_options`, `Mandate.payment_method_details`, `PaymentIntent.payment_method_options`, `PaymentIntentConfirmParams.payment_method_data`, `PaymentIntentConfirmParams.payment_method_options`, `PaymentIntentCreateParams.payment_method_data`, `PaymentIntentCreateParams.payment_method_options`, `PaymentIntentUpdateParams.payment_method_data`, `PaymentIntentUpdateParams.payment_method_options`, `PaymentMethodCreateParams`, `PaymentMethodUpdateParams`, `PaymentMethod`, `SetupAttempt.payment_method_details`, `SetupIntentConfirmParams.payment_method_data`, `SetupIntentCreateParams.payment_method_data`, and `SetupIntentUpdateParams.payment_method_data` + * Add support for new value `cashapp` on enum `CheckoutSessionCreateParams.payment_method_types[]` + * Add support for new value `cashapp` on enums `CustomerListPaymentMethodsParams.type` and `PaymentMethodListParams.type` + * Add support for new value `cashapp` on enums `Invoice.payment_settings.payment_method_types[]`, `InvoiceCreateParams.payment_settings.payment_method_types[]`, `InvoiceUpdateParams.payment_settings.payment_method_types[]`, `Subscription.payment_settings.payment_method_types[]`, `SubscriptionCreateParams.payment_settings.payment_method_types[]`, and `SubscriptionUpdateParams.payment_settings.payment_method_types[]` + * Add support for new value `cashapp` on enums `PaymentIntentConfirmParams.payment_method_data.type`, `PaymentIntentCreateParams.payment_method_data.type`, `PaymentIntentUpdateParams.payment_method_data.type`, `SetupIntentConfirmParams.payment_method_data.type`, `SetupIntentCreateParams.payment_method_data.type`, and `SetupIntentUpdateParams.payment_method_data.type` + * Add support for `preferred_locale` on `PaymentIntent.payment_method_options.affirm`, `PaymentIntentConfirmParams.payment_method_options.affirm`, `PaymentIntentCreateParams.payment_method_options.affirm`, and `PaymentIntentUpdateParams.payment_method_options.affirm` + * Add support for `cashapp_handle_redirect_or_display_qr_code` on `PaymentIntent.next_action` and `SetupIntent.next_action` + * Add support for new value `cashapp` on enums `PaymentLink.payment_method_types[]`, `PaymentLinkCreateParams.payment_method_types[]`, and `PaymentLinkUpdateParams.payment_method_types[]` + * Add support for new value `cashapp` on enum `PaymentMethodCreateParams.type` + * Add support for new value `cashapp` on enum `PaymentMethod.type` + * Add support for new value `payout.reconciliation_completed` on enums `WebhookEndpointCreateParams.enabled_events[]` and `WebhookEndpointUpdateParams.enabled_events[]` + ## 11.14.0 - 2023-03-09 * [#1703](https://github.com/stripe/stripe-node/pull/1703) API Updates * Add support for `card_issuing` on `IssuingCardholderCreateParams.individual` and `IssuingCardholderUpdateParams.individual` diff --git a/VERSION b/VERSION index 2d1951b4aa..c5b7294eae 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -11.14.0 +11.15.0 diff --git a/package.json b/package.json index 91d6c02224..32ef1ab105 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "stripe", - "version": "11.14.0", + "version": "11.15.0", "description": "Stripe API wrapper", "keywords": [ "stripe", diff --git a/src/stripe.core.ts b/src/stripe.core.ts index 703fc47a5e..5e5006faca 100644 --- a/src/stripe.core.ts +++ b/src/stripe.core.ts @@ -47,7 +47,7 @@ export function createStripe( platformFunctions: PlatformFunctions, requestSender: RequestSenderFactory = defaultRequestSenderFactory ): typeof Stripe { - Stripe.PACKAGE_VERSION = '11.14.0'; + Stripe.PACKAGE_VERSION = '11.15.0'; Stripe.USER_AGENT = { bindings_version: Stripe.PACKAGE_VERSION, lang: 'node', From 145b708932e8c87ccc3e161b8a8b1e7ea58e197d Mon Sep 17 00:00:00 2001 From: anniel-stripe <97691964+anniel-stripe@users.noreply.github.com> Date: Fri, 17 Mar 2023 08:05:54 -0700 Subject: [PATCH 5/7] Update version in builds (#1716) * Update version in builds * make update-version --- Makefile | 2 +- cjs/stripe.core.js | 2 +- esm/stripe.core.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 316836357a..7ab089751c 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ update-version: @echo "$(VERSION)" > VERSION @perl -pi -e 's|"version": "[.\-\d\w]+"|"version": "$(VERSION)"|' package.json - @perl -pi -e "s|Stripe.PACKAGE_VERSION = '[.\-\d\w]+'|Stripe.PACKAGE_VERSION = '$(VERSION)'|" src/stripe.core.ts + @perl -pi -e "s|Stripe.PACKAGE_VERSION = '[.\-\d\w]+'|Stripe.PACKAGE_VERSION = '$(VERSION)'|" src/stripe.core.ts cjs/stripe.core.js esm/stripe.core.js codegen-format: yarn && yarn fix && yarn build diff --git a/cjs/stripe.core.js b/cjs/stripe.core.js index 4f2d7149dc..b70d83c257 100644 --- a/cjs/stripe.core.js +++ b/cjs/stripe.core.js @@ -33,7 +33,7 @@ const ALLOWED_CONFIG_PROPERTIES = [ ]; const defaultRequestSenderFactory = (stripe) => new RequestSender_js_1.RequestSender(stripe, StripeResource_js_1.StripeResource.MAX_BUFFERED_REQUEST_METRICS); function createStripe(platformFunctions, requestSender = defaultRequestSenderFactory) { - Stripe.PACKAGE_VERSION = '11.14.0'; + Stripe.PACKAGE_VERSION = '11.15.0'; Stripe.USER_AGENT = Object.assign({ bindings_version: Stripe.PACKAGE_VERSION, lang: 'node', publisher: 'stripe', uname: null, typescript: false }, (0, utils_js_1.determineProcessUserAgentProperties)()); Stripe.StripeResource = StripeResource_js_1.StripeResource; Stripe.resources = resources; diff --git a/esm/stripe.core.js b/esm/stripe.core.js index 250c2525aa..3a632759d0 100644 --- a/esm/stripe.core.js +++ b/esm/stripe.core.js @@ -30,7 +30,7 @@ const ALLOWED_CONFIG_PROPERTIES = [ ]; const defaultRequestSenderFactory = (stripe) => new RequestSender(stripe, StripeResource.MAX_BUFFERED_REQUEST_METRICS); export function createStripe(platformFunctions, requestSender = defaultRequestSenderFactory) { - Stripe.PACKAGE_VERSION = '11.14.0'; + Stripe.PACKAGE_VERSION = '11.15.0'; Stripe.USER_AGENT = Object.assign({ bindings_version: Stripe.PACKAGE_VERSION, lang: 'node', publisher: 'stripe', uname: null, typescript: false }, determineProcessUserAgentProperties()); Stripe.StripeResource = StripeResource; Stripe.resources = resources; From 03b11d1901ad56cf64d251e64f8d4b7aca91314e Mon Sep 17 00:00:00 2001 From: anniel-stripe <97691964+anniel-stripe@users.noreply.github.com> Date: Fri, 17 Mar 2023 09:30:50 -0700 Subject: [PATCH 6/7] Don't check in build output (#1717) * Don't check in cjs and esm * Remove cjs and esm --- .gitattributes | 2 - .github/workflows/main.yml | 10 - .gitignore | 2 + cjs/Error.js | 146 -------- cjs/RequestSender.js | 352 ------------------ cjs/ResourceNamespace.js | 18 - cjs/StripeEmitter.js | 46 --- cjs/StripeMethod.js | 41 -- cjs/StripeResource.js | 169 --------- cjs/Webhooks.js | 179 --------- cjs/apiVersion.js | 5 - cjs/autoPagination.js | 234 ------------ cjs/crypto/CryptoProvider.js | 35 -- cjs/crypto/NodeCryptoProvider.js | 23 -- cjs/crypto/SubtleCryptoProvider.js | 47 --- cjs/multipart.js | 58 --- cjs/net/FetchHttpClient.js | 106 ------ cjs/net/HttpClient.js | 53 --- cjs/net/NodeHttpClient.js | 100 ----- cjs/package.json | 1 - cjs/platform/NodePlatformFunctions.js | 126 ------- cjs/platform/PlatformFunctions.js | 98 ----- cjs/platform/WebPlatformFunctions.js | 42 --- cjs/resources.js | 210 ----------- cjs/resources/AccountLinks.js | 12 - cjs/resources/Accounts.js | 109 ------ cjs/resources/ApplePayDomains.js | 25 -- cjs/resources/ApplicationFees.js | 34 -- cjs/resources/Apps/Secrets.js | 25 -- cjs/resources/Balance.js | 12 - cjs/resources/BalanceTransactions.js | 17 - cjs/resources/BillingPortal/Configurations.js | 25 -- cjs/resources/BillingPortal/Sessions.js | 12 - cjs/resources/Charges.js | 34 -- cjs/resources/Checkout/Sessions.js | 30 -- cjs/resources/CountrySpecs.js | 17 - cjs/resources/Coupons.js | 29 -- cjs/resources/CreditNotes.js | 43 --- cjs/resources/Customers.js | 127 ------- cjs/resources/Disputes.js | 25 -- cjs/resources/EphemeralKeys.js | 21 -- cjs/resources/Events.js | 17 - cjs/resources/ExchangeRates.js | 17 - cjs/resources/FileLinks.js | 25 -- cjs/resources/Files.js | 27 -- .../FinancialConnections/Accounts.js | 30 -- .../FinancialConnections/Sessions.js | 16 - cjs/resources/Identity/VerificationReports.js | 17 - .../Identity/VerificationSessions.js | 33 -- cjs/resources/InvoiceItems.js | 29 -- cjs/resources/Invoices.js | 68 ---- cjs/resources/Issuing/Authorizations.js | 29 -- cjs/resources/Issuing/Cardholders.js | 25 -- cjs/resources/Issuing/Cards.js | 25 -- cjs/resources/Issuing/Disputes.js | 29 -- cjs/resources/Issuing/Transactions.js | 21 -- cjs/resources/Mandates.js | 12 - cjs/resources/OAuth.js | 44 --- cjs/resources/PaymentIntents.js | 54 --- cjs/resources/PaymentLinks.js | 30 -- cjs/resources/PaymentMethods.js | 33 -- cjs/resources/Payouts.js | 33 -- cjs/resources/Plans.js | 29 -- cjs/resources/Prices.js | 30 -- cjs/resources/Products.js | 34 -- cjs/resources/PromotionCodes.js | 25 -- cjs/resources/Quotes.js | 53 --- cjs/resources/Radar/EarlyFraudWarnings.js | 17 - cjs/resources/Radar/ValueListItems.js | 25 -- cjs/resources/Radar/ValueLists.js | 29 -- cjs/resources/Refunds.js | 29 -- cjs/resources/Reporting/ReportRuns.js | 21 -- cjs/resources/Reporting/ReportTypes.js | 17 - cjs/resources/Reviews.js | 21 -- cjs/resources/SetupAttempts.js | 13 - cjs/resources/SetupIntents.js | 37 -- cjs/resources/ShippingRates.js | 25 -- cjs/resources/Sigma/ScheduledQueryRuns.js | 17 - cjs/resources/Sources.js | 29 -- cjs/resources/SubscriptionItems.js | 38 -- cjs/resources/SubscriptionSchedules.js | 33 -- cjs/resources/Subscriptions.js | 46 --- cjs/resources/TaxCodes.js | 17 - cjs/resources/TaxRates.js | 25 -- cjs/resources/Terminal/Configurations.js | 29 -- cjs/resources/Terminal/ConnectionTokens.js | 12 - cjs/resources/Terminal/Locations.js | 29 -- cjs/resources/Terminal/Readers.js | 49 --- cjs/resources/TestHelpers/Customers.js | 12 - cjs/resources/TestHelpers/Issuing/Cards.js | 24 -- cjs/resources/TestHelpers/Refunds.js | 12 - cjs/resources/TestHelpers/Terminal/Readers.js | 12 - cjs/resources/TestHelpers/TestClocks.js | 29 -- .../TestHelpers/Treasury/InboundTransfers.js | 20 - .../TestHelpers/Treasury/OutboundPayments.js | 20 - .../TestHelpers/Treasury/OutboundTransfers.js | 20 - .../TestHelpers/Treasury/ReceivedCredits.js | 12 - .../TestHelpers/Treasury/ReceivedDebits.js | 12 - cjs/resources/Tokens.js | 16 - cjs/resources/Topups.js | 29 -- cjs/resources/Transfers.js | 42 --- cjs/resources/Treasury/CreditReversals.js | 21 -- cjs/resources/Treasury/DebitReversals.js | 21 -- cjs/resources/Treasury/FinancialAccounts.js | 33 -- cjs/resources/Treasury/InboundTransfers.js | 25 -- cjs/resources/Treasury/OutboundPayments.js | 25 -- cjs/resources/Treasury/OutboundTransfers.js | 25 -- cjs/resources/Treasury/ReceivedCredits.js | 17 - cjs/resources/Treasury/ReceivedDebits.js | 17 - cjs/resources/Treasury/TransactionEntries.js | 17 - cjs/resources/Treasury/Transactions.js | 17 - cjs/resources/WebhookEndpoints.js | 29 -- cjs/stripe.cjs.node.js | 11 - cjs/stripe.cjs.worker.js | 11 - cjs/stripe.core.js | 352 ------------------ cjs/utils.js | 307 --------------- esm/Error.js | 130 ------- esm/RequestSender.js | 348 ----------------- esm/ResourceNamespace.js | 14 - esm/StripeEmitter.js | 42 --- esm/StripeMethod.js | 37 -- esm/StripeResource.js | 166 --------- esm/Webhooks.js | 175 --------- esm/apiVersion.js | 2 - esm/autoPagination.js | 230 ------------ esm/crypto/CryptoProvider.js | 31 -- esm/crypto/NodeCryptoProvider.js | 19 - esm/crypto/SubtleCryptoProvider.js | 43 --- esm/multipart.js | 54 --- esm/net/FetchHttpClient.js | 101 ----- esm/net/HttpClient.js | 48 --- esm/net/NodeHttpClient.js | 95 ----- esm/package.json | 1 - esm/platform/NodePlatformFunctions.js | 122 ------ esm/platform/PlatformFunctions.js | 94 ----- esm/platform/WebPlatformFunctions.js | 38 -- esm/resources.js | 160 -------- esm/resources/AccountLinks.js | 9 - esm/resources/Accounts.js | 106 ------ esm/resources/ApplePayDomains.js | 22 -- esm/resources/ApplicationFees.js | 31 -- esm/resources/Apps/Secrets.js | 22 -- esm/resources/Balance.js | 9 - esm/resources/BalanceTransactions.js | 14 - esm/resources/BillingPortal/Configurations.js | 22 -- esm/resources/BillingPortal/Sessions.js | 9 - esm/resources/Charges.js | 31 -- esm/resources/Checkout/Sessions.js | 27 -- esm/resources/CountrySpecs.js | 14 - esm/resources/Coupons.js | 26 -- esm/resources/CreditNotes.js | 40 -- esm/resources/Customers.js | 124 ------ esm/resources/Disputes.js | 22 -- esm/resources/EphemeralKeys.js | 18 - esm/resources/Events.js | 14 - esm/resources/ExchangeRates.js | 14 - esm/resources/FileLinks.js | 22 -- esm/resources/Files.js | 24 -- .../FinancialConnections/Accounts.js | 27 -- .../FinancialConnections/Sessions.js | 13 - esm/resources/Identity/VerificationReports.js | 14 - .../Identity/VerificationSessions.js | 30 -- esm/resources/InvoiceItems.js | 26 -- esm/resources/Invoices.js | 65 ---- esm/resources/Issuing/Authorizations.js | 26 -- esm/resources/Issuing/Cardholders.js | 22 -- esm/resources/Issuing/Cards.js | 22 -- esm/resources/Issuing/Disputes.js | 26 -- esm/resources/Issuing/Transactions.js | 18 - esm/resources/Mandates.js | 9 - esm/resources/OAuth.js | 42 --- esm/resources/PaymentIntents.js | 51 --- esm/resources/PaymentLinks.js | 27 -- esm/resources/PaymentMethods.js | 30 -- esm/resources/Payouts.js | 30 -- esm/resources/Plans.js | 26 -- esm/resources/Prices.js | 27 -- esm/resources/Products.js | 31 -- esm/resources/PromotionCodes.js | 22 -- esm/resources/Quotes.js | 50 --- esm/resources/Radar/EarlyFraudWarnings.js | 14 - esm/resources/Radar/ValueListItems.js | 22 -- esm/resources/Radar/ValueLists.js | 26 -- esm/resources/Refunds.js | 26 -- esm/resources/Reporting/ReportRuns.js | 18 - esm/resources/Reporting/ReportTypes.js | 14 - esm/resources/Reviews.js | 18 - esm/resources/SetupAttempts.js | 10 - esm/resources/SetupIntents.js | 34 -- esm/resources/ShippingRates.js | 22 -- esm/resources/Sigma/ScheduledQueryRuns.js | 14 - esm/resources/Sources.js | 26 -- esm/resources/SubscriptionItems.js | 35 -- esm/resources/SubscriptionSchedules.js | 30 -- esm/resources/Subscriptions.js | 43 --- esm/resources/TaxCodes.js | 14 - esm/resources/TaxRates.js | 22 -- esm/resources/Terminal/Configurations.js | 26 -- esm/resources/Terminal/ConnectionTokens.js | 9 - esm/resources/Terminal/Locations.js | 26 -- esm/resources/Terminal/Readers.js | 46 --- esm/resources/TestHelpers/Customers.js | 9 - esm/resources/TestHelpers/Issuing/Cards.js | 21 -- esm/resources/TestHelpers/Refunds.js | 9 - esm/resources/TestHelpers/Terminal/Readers.js | 9 - esm/resources/TestHelpers/TestClocks.js | 26 -- .../TestHelpers/Treasury/InboundTransfers.js | 17 - .../TestHelpers/Treasury/OutboundPayments.js | 17 - .../TestHelpers/Treasury/OutboundTransfers.js | 17 - .../TestHelpers/Treasury/ReceivedCredits.js | 9 - .../TestHelpers/Treasury/ReceivedDebits.js | 9 - esm/resources/Tokens.js | 13 - esm/resources/Topups.js | 26 -- esm/resources/Transfers.js | 39 -- esm/resources/Treasury/CreditReversals.js | 18 - esm/resources/Treasury/DebitReversals.js | 18 - esm/resources/Treasury/FinancialAccounts.js | 30 -- esm/resources/Treasury/InboundTransfers.js | 22 -- esm/resources/Treasury/OutboundPayments.js | 22 -- esm/resources/Treasury/OutboundTransfers.js | 22 -- esm/resources/Treasury/ReceivedCredits.js | 14 - esm/resources/Treasury/ReceivedDebits.js | 14 - esm/resources/Treasury/TransactionEntries.js | 14 - esm/resources/Treasury/Transactions.js | 14 - esm/resources/WebhookEndpoints.js | 26 -- esm/stripe.core.js | 348 ----------------- esm/stripe.esm.node.js | 4 - esm/stripe.esm.worker.js | 4 - esm/utils.js | 287 -------------- 229 files changed, 2 insertions(+), 10006 deletions(-) delete mode 100644 .gitattributes delete mode 100644 cjs/Error.js delete mode 100644 cjs/RequestSender.js delete mode 100644 cjs/ResourceNamespace.js delete mode 100644 cjs/StripeEmitter.js delete mode 100644 cjs/StripeMethod.js delete mode 100644 cjs/StripeResource.js delete mode 100644 cjs/Webhooks.js delete mode 100644 cjs/apiVersion.js delete mode 100644 cjs/autoPagination.js delete mode 100644 cjs/crypto/CryptoProvider.js delete mode 100644 cjs/crypto/NodeCryptoProvider.js delete mode 100644 cjs/crypto/SubtleCryptoProvider.js delete mode 100644 cjs/multipart.js delete mode 100644 cjs/net/FetchHttpClient.js delete mode 100644 cjs/net/HttpClient.js delete mode 100644 cjs/net/NodeHttpClient.js delete mode 100644 cjs/package.json delete mode 100644 cjs/platform/NodePlatformFunctions.js delete mode 100644 cjs/platform/PlatformFunctions.js delete mode 100644 cjs/platform/WebPlatformFunctions.js delete mode 100644 cjs/resources.js delete mode 100644 cjs/resources/AccountLinks.js delete mode 100644 cjs/resources/Accounts.js delete mode 100644 cjs/resources/ApplePayDomains.js delete mode 100644 cjs/resources/ApplicationFees.js delete mode 100644 cjs/resources/Apps/Secrets.js delete mode 100644 cjs/resources/Balance.js delete mode 100644 cjs/resources/BalanceTransactions.js delete mode 100644 cjs/resources/BillingPortal/Configurations.js delete mode 100644 cjs/resources/BillingPortal/Sessions.js delete mode 100644 cjs/resources/Charges.js delete mode 100644 cjs/resources/Checkout/Sessions.js delete mode 100644 cjs/resources/CountrySpecs.js delete mode 100644 cjs/resources/Coupons.js delete mode 100644 cjs/resources/CreditNotes.js delete mode 100644 cjs/resources/Customers.js delete mode 100644 cjs/resources/Disputes.js delete mode 100644 cjs/resources/EphemeralKeys.js delete mode 100644 cjs/resources/Events.js delete mode 100644 cjs/resources/ExchangeRates.js delete mode 100644 cjs/resources/FileLinks.js delete mode 100644 cjs/resources/Files.js delete mode 100644 cjs/resources/FinancialConnections/Accounts.js delete mode 100644 cjs/resources/FinancialConnections/Sessions.js delete mode 100644 cjs/resources/Identity/VerificationReports.js delete mode 100644 cjs/resources/Identity/VerificationSessions.js delete mode 100644 cjs/resources/InvoiceItems.js delete mode 100644 cjs/resources/Invoices.js delete mode 100644 cjs/resources/Issuing/Authorizations.js delete mode 100644 cjs/resources/Issuing/Cardholders.js delete mode 100644 cjs/resources/Issuing/Cards.js delete mode 100644 cjs/resources/Issuing/Disputes.js delete mode 100644 cjs/resources/Issuing/Transactions.js delete mode 100644 cjs/resources/Mandates.js delete mode 100644 cjs/resources/OAuth.js delete mode 100644 cjs/resources/PaymentIntents.js delete mode 100644 cjs/resources/PaymentLinks.js delete mode 100644 cjs/resources/PaymentMethods.js delete mode 100644 cjs/resources/Payouts.js delete mode 100644 cjs/resources/Plans.js delete mode 100644 cjs/resources/Prices.js delete mode 100644 cjs/resources/Products.js delete mode 100644 cjs/resources/PromotionCodes.js delete mode 100644 cjs/resources/Quotes.js delete mode 100644 cjs/resources/Radar/EarlyFraudWarnings.js delete mode 100644 cjs/resources/Radar/ValueListItems.js delete mode 100644 cjs/resources/Radar/ValueLists.js delete mode 100644 cjs/resources/Refunds.js delete mode 100644 cjs/resources/Reporting/ReportRuns.js delete mode 100644 cjs/resources/Reporting/ReportTypes.js delete mode 100644 cjs/resources/Reviews.js delete mode 100644 cjs/resources/SetupAttempts.js delete mode 100644 cjs/resources/SetupIntents.js delete mode 100644 cjs/resources/ShippingRates.js delete mode 100644 cjs/resources/Sigma/ScheduledQueryRuns.js delete mode 100644 cjs/resources/Sources.js delete mode 100644 cjs/resources/SubscriptionItems.js delete mode 100644 cjs/resources/SubscriptionSchedules.js delete mode 100644 cjs/resources/Subscriptions.js delete mode 100644 cjs/resources/TaxCodes.js delete mode 100644 cjs/resources/TaxRates.js delete mode 100644 cjs/resources/Terminal/Configurations.js delete mode 100644 cjs/resources/Terminal/ConnectionTokens.js delete mode 100644 cjs/resources/Terminal/Locations.js delete mode 100644 cjs/resources/Terminal/Readers.js delete mode 100644 cjs/resources/TestHelpers/Customers.js delete mode 100644 cjs/resources/TestHelpers/Issuing/Cards.js delete mode 100644 cjs/resources/TestHelpers/Refunds.js delete mode 100644 cjs/resources/TestHelpers/Terminal/Readers.js delete mode 100644 cjs/resources/TestHelpers/TestClocks.js delete mode 100644 cjs/resources/TestHelpers/Treasury/InboundTransfers.js delete mode 100644 cjs/resources/TestHelpers/Treasury/OutboundPayments.js delete mode 100644 cjs/resources/TestHelpers/Treasury/OutboundTransfers.js delete mode 100644 cjs/resources/TestHelpers/Treasury/ReceivedCredits.js delete mode 100644 cjs/resources/TestHelpers/Treasury/ReceivedDebits.js delete mode 100644 cjs/resources/Tokens.js delete mode 100644 cjs/resources/Topups.js delete mode 100644 cjs/resources/Transfers.js delete mode 100644 cjs/resources/Treasury/CreditReversals.js delete mode 100644 cjs/resources/Treasury/DebitReversals.js delete mode 100644 cjs/resources/Treasury/FinancialAccounts.js delete mode 100644 cjs/resources/Treasury/InboundTransfers.js delete mode 100644 cjs/resources/Treasury/OutboundPayments.js delete mode 100644 cjs/resources/Treasury/OutboundTransfers.js delete mode 100644 cjs/resources/Treasury/ReceivedCredits.js delete mode 100644 cjs/resources/Treasury/ReceivedDebits.js delete mode 100644 cjs/resources/Treasury/TransactionEntries.js delete mode 100644 cjs/resources/Treasury/Transactions.js delete mode 100644 cjs/resources/WebhookEndpoints.js delete mode 100644 cjs/stripe.cjs.node.js delete mode 100644 cjs/stripe.cjs.worker.js delete mode 100644 cjs/stripe.core.js delete mode 100644 cjs/utils.js delete mode 100644 esm/Error.js delete mode 100644 esm/RequestSender.js delete mode 100644 esm/ResourceNamespace.js delete mode 100644 esm/StripeEmitter.js delete mode 100644 esm/StripeMethod.js delete mode 100644 esm/StripeResource.js delete mode 100644 esm/Webhooks.js delete mode 100644 esm/apiVersion.js delete mode 100644 esm/autoPagination.js delete mode 100644 esm/crypto/CryptoProvider.js delete mode 100644 esm/crypto/NodeCryptoProvider.js delete mode 100644 esm/crypto/SubtleCryptoProvider.js delete mode 100644 esm/multipart.js delete mode 100644 esm/net/FetchHttpClient.js delete mode 100644 esm/net/HttpClient.js delete mode 100644 esm/net/NodeHttpClient.js delete mode 100644 esm/package.json delete mode 100644 esm/platform/NodePlatformFunctions.js delete mode 100644 esm/platform/PlatformFunctions.js delete mode 100644 esm/platform/WebPlatformFunctions.js delete mode 100644 esm/resources.js delete mode 100644 esm/resources/AccountLinks.js delete mode 100644 esm/resources/Accounts.js delete mode 100644 esm/resources/ApplePayDomains.js delete mode 100644 esm/resources/ApplicationFees.js delete mode 100644 esm/resources/Apps/Secrets.js delete mode 100644 esm/resources/Balance.js delete mode 100644 esm/resources/BalanceTransactions.js delete mode 100644 esm/resources/BillingPortal/Configurations.js delete mode 100644 esm/resources/BillingPortal/Sessions.js delete mode 100644 esm/resources/Charges.js delete mode 100644 esm/resources/Checkout/Sessions.js delete mode 100644 esm/resources/CountrySpecs.js delete mode 100644 esm/resources/Coupons.js delete mode 100644 esm/resources/CreditNotes.js delete mode 100644 esm/resources/Customers.js delete mode 100644 esm/resources/Disputes.js delete mode 100644 esm/resources/EphemeralKeys.js delete mode 100644 esm/resources/Events.js delete mode 100644 esm/resources/ExchangeRates.js delete mode 100644 esm/resources/FileLinks.js delete mode 100644 esm/resources/Files.js delete mode 100644 esm/resources/FinancialConnections/Accounts.js delete mode 100644 esm/resources/FinancialConnections/Sessions.js delete mode 100644 esm/resources/Identity/VerificationReports.js delete mode 100644 esm/resources/Identity/VerificationSessions.js delete mode 100644 esm/resources/InvoiceItems.js delete mode 100644 esm/resources/Invoices.js delete mode 100644 esm/resources/Issuing/Authorizations.js delete mode 100644 esm/resources/Issuing/Cardholders.js delete mode 100644 esm/resources/Issuing/Cards.js delete mode 100644 esm/resources/Issuing/Disputes.js delete mode 100644 esm/resources/Issuing/Transactions.js delete mode 100644 esm/resources/Mandates.js delete mode 100644 esm/resources/OAuth.js delete mode 100644 esm/resources/PaymentIntents.js delete mode 100644 esm/resources/PaymentLinks.js delete mode 100644 esm/resources/PaymentMethods.js delete mode 100644 esm/resources/Payouts.js delete mode 100644 esm/resources/Plans.js delete mode 100644 esm/resources/Prices.js delete mode 100644 esm/resources/Products.js delete mode 100644 esm/resources/PromotionCodes.js delete mode 100644 esm/resources/Quotes.js delete mode 100644 esm/resources/Radar/EarlyFraudWarnings.js delete mode 100644 esm/resources/Radar/ValueListItems.js delete mode 100644 esm/resources/Radar/ValueLists.js delete mode 100644 esm/resources/Refunds.js delete mode 100644 esm/resources/Reporting/ReportRuns.js delete mode 100644 esm/resources/Reporting/ReportTypes.js delete mode 100644 esm/resources/Reviews.js delete mode 100644 esm/resources/SetupAttempts.js delete mode 100644 esm/resources/SetupIntents.js delete mode 100644 esm/resources/ShippingRates.js delete mode 100644 esm/resources/Sigma/ScheduledQueryRuns.js delete mode 100644 esm/resources/Sources.js delete mode 100644 esm/resources/SubscriptionItems.js delete mode 100644 esm/resources/SubscriptionSchedules.js delete mode 100644 esm/resources/Subscriptions.js delete mode 100644 esm/resources/TaxCodes.js delete mode 100644 esm/resources/TaxRates.js delete mode 100644 esm/resources/Terminal/Configurations.js delete mode 100644 esm/resources/Terminal/ConnectionTokens.js delete mode 100644 esm/resources/Terminal/Locations.js delete mode 100644 esm/resources/Terminal/Readers.js delete mode 100644 esm/resources/TestHelpers/Customers.js delete mode 100644 esm/resources/TestHelpers/Issuing/Cards.js delete mode 100644 esm/resources/TestHelpers/Refunds.js delete mode 100644 esm/resources/TestHelpers/Terminal/Readers.js delete mode 100644 esm/resources/TestHelpers/TestClocks.js delete mode 100644 esm/resources/TestHelpers/Treasury/InboundTransfers.js delete mode 100644 esm/resources/TestHelpers/Treasury/OutboundPayments.js delete mode 100644 esm/resources/TestHelpers/Treasury/OutboundTransfers.js delete mode 100644 esm/resources/TestHelpers/Treasury/ReceivedCredits.js delete mode 100644 esm/resources/TestHelpers/Treasury/ReceivedDebits.js delete mode 100644 esm/resources/Tokens.js delete mode 100644 esm/resources/Topups.js delete mode 100644 esm/resources/Transfers.js delete mode 100644 esm/resources/Treasury/CreditReversals.js delete mode 100644 esm/resources/Treasury/DebitReversals.js delete mode 100644 esm/resources/Treasury/FinancialAccounts.js delete mode 100644 esm/resources/Treasury/InboundTransfers.js delete mode 100644 esm/resources/Treasury/OutboundPayments.js delete mode 100644 esm/resources/Treasury/OutboundTransfers.js delete mode 100644 esm/resources/Treasury/ReceivedCredits.js delete mode 100644 esm/resources/Treasury/ReceivedDebits.js delete mode 100644 esm/resources/Treasury/TransactionEntries.js delete mode 100644 esm/resources/Treasury/Transactions.js delete mode 100644 esm/resources/WebhookEndpoints.js delete mode 100644 esm/stripe.core.js delete mode 100644 esm/stripe.esm.node.js delete mode 100644 esm/stripe.esm.worker.js delete mode 100644 esm/utils.js diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 7c11600fe9..0000000000 --- a/.gitattributes +++ /dev/null @@ -1,2 +0,0 @@ -cjs/** linguist-generated -esm/** linguist-generated diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6c17ee75f9..d682a75303 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -44,16 +44,6 @@ jobs: - name: Build Typescript run: yarn && yarn build - - name: Check for changes - run: | - if [[ `git status --porcelain` ]]; then - git diff - >&2 echo "Changes detected after compiling TypeScript. Please run yarn build and check in all compiled files in cjs/ and esm/." - exit 1 - else - exit 0 - fi - - name: Lint run: yarn lint diff --git a/.gitignore b/.gitignore index 9bc0539f53..449e62353d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ node_modules +cjs +esm .npm-debug.log tags .nyc_output diff --git a/cjs/Error.js b/cjs/Error.js deleted file mode 100644 index e6f17b6693..0000000000 --- a/cjs/Error.js +++ /dev/null @@ -1,146 +0,0 @@ -"use strict"; -/* eslint-disable camelcase */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.StripeUnknownError = exports.StripeInvalidGrantError = exports.StripeIdempotencyError = exports.StripeSignatureVerificationError = exports.StripeConnectionError = exports.StripeRateLimitError = exports.StripePermissionError = exports.StripeAuthenticationError = exports.StripeAPIError = exports.StripeInvalidRequestError = exports.StripeCardError = exports.StripeError = exports.generate = void 0; -const generate = (rawStripeError) => { - switch (rawStripeError.type) { - case 'card_error': - return new StripeCardError(rawStripeError); - case 'invalid_request_error': - return new StripeInvalidRequestError(rawStripeError); - case 'api_error': - return new StripeAPIError(rawStripeError); - case 'authentication_error': - return new StripeAuthenticationError(rawStripeError); - case 'rate_limit_error': - return new StripeRateLimitError(rawStripeError); - case 'idempotency_error': - return new StripeIdempotencyError(rawStripeError); - case 'invalid_grant': - return new StripeInvalidGrantError(rawStripeError); - default: - return new StripeUnknownError(rawStripeError); - } -}; -exports.generate = generate; -/** - * StripeError is the base error from which all other more specific Stripe errors derive. - * Specifically for errors returned from Stripe's REST API. - */ -class StripeError extends Error { - constructor(raw = {}) { - super(raw.message); - this.type = this.constructor.name; - this.raw = raw; - this.rawType = raw.type; - this.code = raw.code; - this.doc_url = raw.doc_url; - this.param = raw.param; - this.detail = raw.detail; - this.headers = raw.headers; - this.requestId = raw.requestId; - this.statusCode = raw.statusCode; - // @ts-ignore - this.message = raw.message; - this.charge = raw.charge; - this.decline_code = raw.decline_code; - this.payment_intent = raw.payment_intent; - this.payment_method = raw.payment_method; - this.payment_method_type = raw.payment_method_type; - this.setup_intent = raw.setup_intent; - this.source = raw.source; - } -} -exports.StripeError = StripeError; -/** - * Helper factory which takes raw stripe errors and outputs wrapping instances - */ -StripeError.generate = exports.generate; -// Specific Stripe Error types: -/** - * CardError is raised when a user enters a card that can't be charged for - * some reason. - */ -class StripeCardError extends StripeError { -} -exports.StripeCardError = StripeCardError; -/** - * InvalidRequestError is raised when a request is initiated with invalid - * parameters. - */ -class StripeInvalidRequestError extends StripeError { -} -exports.StripeInvalidRequestError = StripeInvalidRequestError; -/** - * APIError is a generic error that may be raised in cases where none of the - * other named errors cover the problem. It could also be raised in the case - * that a new error has been introduced in the API, but this version of the - * Node.JS SDK doesn't know how to handle it. - */ -class StripeAPIError extends StripeError { -} -exports.StripeAPIError = StripeAPIError; -/** - * AuthenticationError is raised when invalid credentials are used to connect - * to Stripe's servers. - */ -class StripeAuthenticationError extends StripeError { -} -exports.StripeAuthenticationError = StripeAuthenticationError; -/** - * PermissionError is raised in cases where access was attempted on a resource - * that wasn't allowed. - */ -class StripePermissionError extends StripeError { -} -exports.StripePermissionError = StripePermissionError; -/** - * RateLimitError is raised in cases where an account is putting too much load - * on Stripe's API servers (usually by performing too many requests). Please - * back off on request rate. - */ -class StripeRateLimitError extends StripeError { -} -exports.StripeRateLimitError = StripeRateLimitError; -/** - * StripeConnectionError is raised in the event that the SDK can't connect to - * Stripe's servers. That can be for a variety of different reasons from a - * downed network to a bad TLS certificate. - */ -class StripeConnectionError extends StripeError { -} -exports.StripeConnectionError = StripeConnectionError; -/** - * SignatureVerificationError is raised when the signature verification for a - * webhook fails - */ -class StripeSignatureVerificationError extends StripeError { - constructor(header, payload, raw = {}) { - super(raw); - this.header = header; - this.payload = payload; - } -} -exports.StripeSignatureVerificationError = StripeSignatureVerificationError; -/** - * IdempotencyError is raised in cases where an idempotency key was used - * improperly. - */ -class StripeIdempotencyError extends StripeError { -} -exports.StripeIdempotencyError = StripeIdempotencyError; -/** - * InvalidGrantError is raised when a specified code doesn't exist, is - * expired, has been used, or doesn't belong to you; a refresh token doesn't - * exist, or doesn't belong to you; or if an API key's mode (live or test) - * doesn't match the mode of a code or refresh token. - */ -class StripeInvalidGrantError extends StripeError { -} -exports.StripeInvalidGrantError = StripeInvalidGrantError; -/** - * Any other error from Stripe not specifically captured above - */ -class StripeUnknownError extends StripeError { -} -exports.StripeUnknownError = StripeUnknownError; diff --git a/cjs/RequestSender.js b/cjs/RequestSender.js deleted file mode 100644 index 5884d69f4f..0000000000 --- a/cjs/RequestSender.js +++ /dev/null @@ -1,352 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.RequestSender = void 0; -const Error_js_1 = require("./Error.js"); -const utils_js_1 = require("./utils.js"); -const HttpClient_js_1 = require("./net/HttpClient.js"); -const MAX_RETRY_AFTER_WAIT = 60; -class RequestSender { - constructor(stripe, maxBufferedRequestMetric) { - this._stripe = stripe; - this._maxBufferedRequestMetric = maxBufferedRequestMetric; - } - _addHeadersDirectlyToObject(obj, headers) { - // For convenience, make some headers easily accessible on - // lastResponse. - // NOTE: Stripe responds with lowercase header names/keys. - obj.requestId = headers['request-id']; - obj.stripeAccount = obj.stripeAccount || headers['stripe-account']; - obj.apiVersion = obj.apiVersion || headers['stripe-version']; - obj.idempotencyKey = obj.idempotencyKey || headers['idempotency-key']; - } - _makeResponseEvent(requestEvent, statusCode, headers) { - const requestEndTime = Date.now(); - const requestDurationMs = requestEndTime - requestEvent.request_start_time; - return (0, utils_js_1.removeNullish)({ - api_version: headers['stripe-version'], - account: headers['stripe-account'], - idempotency_key: headers['idempotency-key'], - method: requestEvent.method, - path: requestEvent.path, - status: statusCode, - request_id: this._getRequestId(headers), - elapsed: requestDurationMs, - request_start_time: requestEvent.request_start_time, - request_end_time: requestEndTime, - }); - } - _getRequestId(headers) { - return headers['request-id']; - } - /** - * Used by methods with spec.streaming === true. For these methods, we do not - * buffer successful responses into memory or do parse them into stripe - * objects, we delegate that all of that to the user and pass back the raw - * http.Response object to the callback. - * - * (Unsuccessful responses shouldn't make it here, they should - * still be buffered/parsed and handled by _jsonResponseHandler -- see - * makeRequest) - */ - _streamingResponseHandler(requestEvent, callback) { - return (res) => { - const headers = res.getHeaders(); - const streamCompleteCallback = () => { - const responseEvent = this._makeResponseEvent(requestEvent, res.getStatusCode(), headers); - this._stripe._emitter.emit('response', responseEvent); - this._recordRequestMetrics(this._getRequestId(headers), responseEvent.elapsed); - }; - const stream = res.toStream(streamCompleteCallback); - // This is here for backwards compatibility, as the stream is a raw - // HTTP response in Node and the legacy behavior was to mutate this - // response. - this._addHeadersDirectlyToObject(stream, headers); - return callback(null, stream); - }; - } - /** - * Default handler for Stripe responses. Buffers the response into memory, - * parses the JSON and returns it (i.e. passes it to the callback) if there - * is no "error" field. Otherwise constructs/passes an appropriate Error. - */ - _jsonResponseHandler(requestEvent, callback) { - return (res) => { - const headers = res.getHeaders(); - const requestId = this._getRequestId(headers); - const statusCode = res.getStatusCode(); - const responseEvent = this._makeResponseEvent(requestEvent, statusCode, headers); - this._stripe._emitter.emit('response', responseEvent); - res - .toJSON() - .then((jsonResponse) => { - if (jsonResponse.error) { - let err; - // Convert OAuth error responses into a standard format - // so that the rest of the error logic can be shared - if (typeof jsonResponse.error === 'string') { - jsonResponse.error = { - type: jsonResponse.error, - message: jsonResponse.error_description, - }; - } - jsonResponse.error.headers = headers; - jsonResponse.error.statusCode = statusCode; - jsonResponse.error.requestId = requestId; - if (statusCode === 401) { - err = new Error_js_1.StripeAuthenticationError(jsonResponse.error); - } - else if (statusCode === 403) { - err = new Error_js_1.StripePermissionError(jsonResponse.error); - } - else if (statusCode === 429) { - err = new Error_js_1.StripeRateLimitError(jsonResponse.error); - } - else { - err = Error_js_1.StripeError.generate(jsonResponse.error); - } - throw err; - } - return jsonResponse; - }, (e) => { - throw new Error_js_1.StripeAPIError({ - message: 'Invalid JSON received from the Stripe API', - exception: e, - requestId: headers['request-id'], - }); - }) - .then((jsonResponse) => { - this._recordRequestMetrics(requestId, responseEvent.elapsed); - // Expose raw response object. - const rawResponse = res.getRawResponse(); - this._addHeadersDirectlyToObject(rawResponse, headers); - Object.defineProperty(jsonResponse, 'lastResponse', { - enumerable: false, - writable: false, - value: rawResponse, - }); - callback(null, jsonResponse); - }, (e) => callback(e, null)); - }; - } - static _generateConnectionErrorMessage(requestRetries) { - return `An error occurred with our connection to Stripe.${requestRetries > 0 ? ` Request was retried ${requestRetries} times.` : ''}`; - } - // For more on when and how to retry API requests, see https://stripe.com/docs/error-handling#safely-retrying-requests-with-idempotency - static _shouldRetry(res, numRetries, maxRetries, error) { - if (error && - numRetries === 0 && - HttpClient_js_1.HttpClient.CONNECTION_CLOSED_ERROR_CODES.includes(error.code)) { - return true; - } - // Do not retry if we are out of retries. - if (numRetries >= maxRetries) { - return false; - } - // Retry on connection error. - if (!res) { - return true; - } - // The API may ask us not to retry (e.g., if doing so would be a no-op) - // or advise us to retry (e.g., in cases of lock timeouts); we defer to that. - if (res.getHeaders()['stripe-should-retry'] === 'false') { - return false; - } - if (res.getHeaders()['stripe-should-retry'] === 'true') { - return true; - } - // Retry on conflict errors. - if (res.getStatusCode() === 409) { - return true; - } - // Retry on 500, 503, and other internal errors. - // - // Note that we expect the stripe-should-retry header to be false - // in most cases when a 500 is returned, since our idempotency framework - // would typically replay it anyway. - if (res.getStatusCode() >= 500) { - return true; - } - return false; - } - _getSleepTimeInMS(numRetries, retryAfter = null) { - const initialNetworkRetryDelay = this._stripe.getInitialNetworkRetryDelay(); - const maxNetworkRetryDelay = this._stripe.getMaxNetworkRetryDelay(); - // Apply exponential backoff with initialNetworkRetryDelay on the - // number of numRetries so far as inputs. Do not allow the number to exceed - // maxNetworkRetryDelay. - let sleepSeconds = Math.min(initialNetworkRetryDelay * Math.pow(numRetries - 1, 2), maxNetworkRetryDelay); - // Apply some jitter by randomizing the value in the range of - // (sleepSeconds / 2) to (sleepSeconds). - sleepSeconds *= 0.5 * (1 + Math.random()); - // But never sleep less than the base sleep seconds. - sleepSeconds = Math.max(initialNetworkRetryDelay, sleepSeconds); - // And never sleep less than the time the API asks us to wait, assuming it's a reasonable ask. - if (Number.isInteger(retryAfter) && retryAfter <= MAX_RETRY_AFTER_WAIT) { - sleepSeconds = Math.max(sleepSeconds, retryAfter); - } - return sleepSeconds * 1000; - } - // Max retries can be set on a per request basis. Favor those over the global setting - _getMaxNetworkRetries(settings = {}) { - return settings.maxNetworkRetries && - Number.isInteger(settings.maxNetworkRetries) - ? settings.maxNetworkRetries - : this._stripe.getMaxNetworkRetries(); - } - _defaultIdempotencyKey(method, settings) { - // If this is a POST and we allow multiple retries, ensure an idempotency key. - const maxRetries = this._getMaxNetworkRetries(settings); - if (method === 'POST' && maxRetries > 0) { - return `stripe-node-retry-${this._stripe._platformFunctions.uuid4()}`; - } - return null; - } - _makeHeaders(auth, contentLength, apiVersion, clientUserAgent, method, userSuppliedHeaders, userSuppliedSettings) { - const defaultHeaders = { - // Use specified auth token or use default from this stripe instance: - Authorization: auth ? `Bearer ${auth}` : this._stripe.getApiField('auth'), - Accept: 'application/json', - 'Content-Type': 'application/x-www-form-urlencoded', - 'User-Agent': this._getUserAgentString(), - 'X-Stripe-Client-User-Agent': clientUserAgent, - 'X-Stripe-Client-Telemetry': this._getTelemetryHeader(), - 'Stripe-Version': apiVersion, - 'Stripe-Account': this._stripe.getApiField('stripeAccount'), - 'Idempotency-Key': this._defaultIdempotencyKey(method, userSuppliedSettings), - }; - // As per https://datatracker.ietf.org/doc/html/rfc7230#section-3.3.2: - // A user agent SHOULD send a Content-Length in a request message when - // no Transfer-Encoding is sent and the request method defines a meaning - // for an enclosed payload body. For example, a Content-Length header - // field is normally sent in a POST request even when the value is 0 - // (indicating an empty payload body). A user agent SHOULD NOT send a - // Content-Length header field when the request message does not contain - // a payload body and the method semantics do not anticipate such a - // body. - // - // These method types are expected to have bodies and so we should always - // include a Content-Length. - const methodHasPayload = method == 'POST' || method == 'PUT' || method == 'PATCH'; - // If a content length was specified, we always include it regardless of - // whether the method semantics anticipate such a body. This keeps us - // consistent with historical behavior. We do however want to warn on this - // and fix these cases as they are semantically incorrect. - if (methodHasPayload || contentLength) { - if (!methodHasPayload) { - (0, utils_js_1.emitWarning)(`${method} method had non-zero contentLength but no payload is expected for this verb`); - } - defaultHeaders['Content-Length'] = contentLength; - } - return Object.assign((0, utils_js_1.removeNullish)(defaultHeaders), - // If the user supplied, say 'idempotency-key', override instead of appending by ensuring caps are the same. - (0, utils_js_1.normalizeHeaders)(userSuppliedHeaders)); - } - _getUserAgentString() { - const packageVersion = this._stripe.getConstant('PACKAGE_VERSION'); - const appInfo = this._stripe._appInfo - ? this._stripe.getAppInfoAsString() - : ''; - return `Stripe/v1 NodeBindings/${packageVersion} ${appInfo}`.trim(); - } - _getTelemetryHeader() { - if (this._stripe.getTelemetryEnabled() && - this._stripe._prevRequestMetrics.length > 0) { - const metrics = this._stripe._prevRequestMetrics.shift(); - return JSON.stringify({ - last_request_metrics: metrics, - }); - } - } - _recordRequestMetrics(requestId, requestDurationMs) { - if (this._stripe.getTelemetryEnabled() && requestId) { - if (this._stripe._prevRequestMetrics.length > this._maxBufferedRequestMetric) { - (0, utils_js_1.emitWarning)('Request metrics buffer is full, dropping telemetry message.'); - } - else { - this._stripe._prevRequestMetrics.push({ - request_id: requestId, - request_duration_ms: requestDurationMs, - }); - } - } - } - _request(method, host, path, data, auth, options = {}, callback, requestDataProcessor = null) { - let requestData; - const retryRequest = (requestFn, apiVersion, headers, requestRetries, retryAfter) => { - return setTimeout(requestFn, this._getSleepTimeInMS(requestRetries, retryAfter), apiVersion, headers, requestRetries + 1); - }; - const makeRequest = (apiVersion, headers, numRetries) => { - // timeout can be set on a per-request basis. Favor that over the global setting - const timeout = options.settings && - options.settings.timeout && - Number.isInteger(options.settings.timeout) && - options.settings.timeout >= 0 - ? options.settings.timeout - : this._stripe.getApiField('timeout'); - const req = this._stripe - .getApiField('httpClient') - .makeRequest(host || this._stripe.getApiField('host'), this._stripe.getApiField('port'), path, method, headers, requestData, this._stripe.getApiField('protocol'), timeout); - const requestStartTime = Date.now(); - // @ts-ignore - const requestEvent = (0, utils_js_1.removeNullish)({ - api_version: apiVersion, - account: headers['Stripe-Account'], - idempotency_key: headers['Idempotency-Key'], - method, - path, - request_start_time: requestStartTime, - }); - const requestRetries = numRetries || 0; - const maxRetries = this._getMaxNetworkRetries(options.settings || {}); - this._stripe._emitter.emit('request', requestEvent); - req - .then((res) => { - if (RequestSender._shouldRetry(res, requestRetries, maxRetries)) { - return retryRequest(makeRequest, apiVersion, headers, requestRetries, - // @ts-ignore - res.getHeaders()['retry-after']); - } - else if (options.streaming && res.getStatusCode() < 400) { - return this._streamingResponseHandler(requestEvent, callback)(res); - } - else { - return this._jsonResponseHandler(requestEvent, callback)(res); - } - }) - .catch((error) => { - if (RequestSender._shouldRetry(null, requestRetries, maxRetries, error)) { - return retryRequest(makeRequest, apiVersion, headers, requestRetries, null); - } - else { - const isTimeoutError = error.code && error.code === HttpClient_js_1.HttpClient.TIMEOUT_ERROR_CODE; - return callback(new Error_js_1.StripeConnectionError({ - message: isTimeoutError - ? `Request aborted due to timeout being reached (${timeout}ms)` - : RequestSender._generateConnectionErrorMessage(requestRetries), - // @ts-ignore - detail: error, - })); - } - }); - }; - const prepareAndMakeRequest = (error, data) => { - if (error) { - return callback(error); - } - requestData = data; - this._stripe.getClientUserAgent((clientUserAgent) => { - var _a, _b; - const apiVersion = this._stripe.getApiField('version'); - 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 : {}); - makeRequest(apiVersion, headers, 0); - }); - }; - if (requestDataProcessor) { - requestDataProcessor(method, data, options.headers, prepareAndMakeRequest); - } - else { - prepareAndMakeRequest(null, (0, utils_js_1.stringifyRequestData)(data || {})); - } - } -} -exports.RequestSender = RequestSender; diff --git a/cjs/ResourceNamespace.js b/cjs/ResourceNamespace.js deleted file mode 100644 index d482e115e6..0000000000 --- a/cjs/ResourceNamespace.js +++ /dev/null @@ -1,18 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.resourceNamespace = void 0; -// ResourceNamespace allows you to create nested resources, i.e. `stripe.issuing.cards`. -// It also works recursively, so you could do i.e. `stripe.billing.invoicing.pay`. -function ResourceNamespace(stripe, resources) { - for (const name in resources) { - const camelCaseName = name[0].toLowerCase() + name.substring(1); - const resource = new resources[name](stripe); - this[camelCaseName] = resource; - } -} -function resourceNamespace(namespace, resources) { - return function (stripe) { - return new ResourceNamespace(stripe, resources); - }; -} -exports.resourceNamespace = resourceNamespace; diff --git a/cjs/StripeEmitter.js b/cjs/StripeEmitter.js deleted file mode 100644 index 703b867758..0000000000 --- a/cjs/StripeEmitter.js +++ /dev/null @@ -1,46 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.StripeEmitter = void 0; -/** - * @private - * (For internal use in stripe-node.) - * Wrapper around the Event Web API. - */ -class _StripeEvent extends Event { - constructor(eventName, data) { - super(eventName); - this.data = data; - } -} -/** Minimal EventEmitter wrapper around EventTarget. */ -class StripeEmitter { - constructor() { - this.eventTarget = new EventTarget(); - this.listenerMapping = new Map(); - } - on(eventName, listener) { - const listenerWrapper = (event) => { - listener(event.data); - }; - this.listenerMapping.set(listener, listenerWrapper); - return this.eventTarget.addEventListener(eventName, listenerWrapper); - } - removeListener(eventName, listener) { - const listenerWrapper = this.listenerMapping.get(listener); - this.listenerMapping.delete(listener); - return this.eventTarget.removeEventListener(eventName, listenerWrapper); - } - once(eventName, listener) { - const listenerWrapper = (event) => { - listener(event.data); - }; - this.listenerMapping.set(listener, listenerWrapper); - return this.eventTarget.addEventListener(eventName, listenerWrapper, { - once: true, - }); - } - emit(eventName, data) { - return this.eventTarget.dispatchEvent(new _StripeEvent(eventName, data)); - } -} -exports.StripeEmitter = StripeEmitter; diff --git a/cjs/StripeMethod.js b/cjs/StripeMethod.js deleted file mode 100644 index a30ef4c262..0000000000 --- a/cjs/StripeMethod.js +++ /dev/null @@ -1,41 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.stripeMethod = void 0; -const utils_js_1 = require("./utils.js"); -const autoPagination_js_1 = require("./autoPagination.js"); -/** - * Create an API method from the declared spec. - * - * @param [spec.method='GET'] Request Method (POST, GET, DELETE, PUT) - * @param [spec.path=''] Path to be appended to the API BASE_PATH, joined with - * the instance's path (e.g. 'charges' or 'customers') - * @param [spec.fullPath=''] Fully qualified path to the method (eg. /v1/a/b/c). - * If this is specified, path should not be specified. - * @param [spec.urlParams=[]] Array of required arguments in the order that they - * must be passed by the consumer of the API. Subsequent optional arguments are - * optionally passed through a hash (Object) as the penultimate argument - * (preceding the also-optional callback argument - * @param [spec.encode] Function for mutating input parameters to a method. - * Usefully for applying transforms to data on a per-method basis. - * @param [spec.host] Hostname for the request. - * - * - */ -function stripeMethod(spec) { - if (spec.path !== undefined && spec.fullPath !== undefined) { - throw new Error(`Method spec specified both a 'path' (${spec.path}) and a 'fullPath' (${spec.fullPath}).`); - } - return function (...args) { - const callback = typeof args[args.length - 1] == 'function' && args.pop(); - spec.urlParams = (0, utils_js_1.extractUrlParams)(spec.fullPath || this.createResourcePathWithSymbols(spec.path || '')); - const requestPromise = (0, utils_js_1.callbackifyPromiseWithTimeout)(this._makeRequest(args, spec, {}), callback); - // Please note `spec.methodType === 'search'` is beta functionality and this - // interface is subject to change/removal at any time. - if (spec.methodType === 'list' || spec.methodType === 'search') { - const autoPaginationMethods = (0, autoPagination_js_1.makeAutoPaginationMethods)(this, args, spec, requestPromise); - Object.assign(requestPromise, autoPaginationMethods); - } - return requestPromise; - }; -} -exports.stripeMethod = stripeMethod; diff --git a/cjs/StripeResource.js b/cjs/StripeResource.js deleted file mode 100644 index f02f9f43ba..0000000000 --- a/cjs/StripeResource.js +++ /dev/null @@ -1,169 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.StripeResource = void 0; -const utils_js_1 = require("./utils.js"); -const StripeMethod_js_1 = require("./StripeMethod.js"); -// Provide extension mechanism for Stripe Resource Sub-Classes -StripeResource.extend = utils_js_1.protoExtend; -// Expose method-creator -StripeResource.method = StripeMethod_js_1.stripeMethod; -StripeResource.MAX_BUFFERED_REQUEST_METRICS = 100; -/** - * Encapsulates request logic for a Stripe Resource - */ -function StripeResource(stripe, deprecatedUrlData) { - this._stripe = stripe; - if (deprecatedUrlData) { - throw new Error('Support for curried url params was dropped in stripe-node v7.0.0. Instead, pass two ids.'); - } - this.basePath = (0, utils_js_1.makeURLInterpolator)( - // @ts-ignore changing type of basePath - this.basePath || stripe.getApiField('basePath')); - // @ts-ignore changing type of path - this.resourcePath = this.path; - // @ts-ignore changing type of path - this.path = (0, utils_js_1.makeURLInterpolator)(this.path); - this.initialize(...arguments); -} -exports.StripeResource = StripeResource; -StripeResource.prototype = { - _stripe: null, - // @ts-ignore the type of path changes in ctor - path: '', - resourcePath: '', - // Methods that don't use the API's default '/v1' path can override it with this setting. - basePath: null, - initialize() { }, - // Function to override the default data processor. This allows full control - // over how a StripeResource's request data will get converted into an HTTP - // body. This is useful for non-standard HTTP requests. The function should - // take method name, data, and headers as arguments. - requestDataProcessor: null, - // Function to add a validation checks before sending the request, errors should - // be thrown, and they will be passed to the callback/promise. - validateRequest: null, - createFullPath(commandPath, urlData) { - const urlParts = [this.basePath(urlData), this.path(urlData)]; - if (typeof commandPath === 'function') { - const computedCommandPath = commandPath(urlData); - // If we have no actual command path, we just omit it to avoid adding a - // trailing slash. This is important for top-level listing requests, which - // do not have a command path. - if (computedCommandPath) { - urlParts.push(computedCommandPath); - } - } - else { - urlParts.push(commandPath); - } - return this._joinUrlParts(urlParts); - }, - // Creates a relative resource path with symbols left in (unlike - // createFullPath which takes some data to replace them with). For example it - // might produce: /invoices/{id} - createResourcePathWithSymbols(pathWithSymbols) { - // If there is no path beyond the resource path, we want to produce just - // / rather than //. - if (pathWithSymbols) { - return `/${this._joinUrlParts([this.resourcePath, pathWithSymbols])}`; - } - else { - return `/${this.resourcePath}`; - } - }, - _joinUrlParts(parts) { - // Replace any accidentally doubled up slashes. This previously used - // path.join, which would do this as well. Unfortunately we need to do this - // as the functions for creating paths are technically part of the public - // interface and so we need to preserve backwards compatibility. - return parts.join('/').replace(/\/{2,}/g, '/'); - }, - _getRequestOpts(requestArgs, spec, overrideData) { - // Extract spec values with defaults. - const requestMethod = (spec.method || 'GET').toUpperCase(); - const urlParams = spec.urlParams || []; - const encode = spec.encode || ((data) => data); - const isUsingFullPath = !!spec.fullPath; - const commandPath = (0, utils_js_1.makeURLInterpolator)(isUsingFullPath ? spec.fullPath : spec.path || ''); - // When using fullPath, we ignore the resource path as it should already be - // fully qualified. - const path = isUsingFullPath - ? spec.fullPath - : this.createResourcePathWithSymbols(spec.path); - // Don't mutate args externally. - const args = [].slice.call(requestArgs); - // Generate and validate url params. - const urlData = urlParams.reduce((urlData, param) => { - const arg = args.shift(); - if (typeof arg !== 'string') { - throw new Error(`Stripe: Argument "${param}" must be a string, but got: ${arg} (on API request to \`${requestMethod} ${path}\`)`); - } - urlData[param] = arg; - return urlData; - }, {}); - // Pull request data and options (headers, auth) from args. - const dataFromArgs = (0, utils_js_1.getDataFromArgs)(args); - const data = encode(Object.assign({}, dataFromArgs, overrideData)); - const options = (0, utils_js_1.getOptionsFromArgs)(args); - const host = options.host || spec.host; - const streaming = !!spec.streaming; - // Validate that there are no more args. - if (args.filter((x) => x != null).length) { - throw new Error(`Stripe: Unknown arguments (${args}). Did you mean to pass an options object? See https://github.com/stripe/stripe-node/wiki/Passing-Options. (on API request to ${requestMethod} \`${path}\`)`); - } - // When using full path, we can just invoke the URL interpolator directly - // as we don't need to use the resource to create a full path. - const requestPath = isUsingFullPath - ? commandPath(urlData) - : this.createFullPath(commandPath, urlData); - const headers = Object.assign(options.headers, spec.headers); - if (spec.validator) { - spec.validator(data, { headers }); - } - const dataInQuery = spec.method === 'GET' || spec.method === 'DELETE'; - const bodyData = dataInQuery ? {} : data; - const queryData = dataInQuery ? data : {}; - return { - requestMethod, - requestPath, - bodyData, - queryData, - auth: options.auth, - headers, - host: host !== null && host !== void 0 ? host : null, - streaming, - settings: options.settings, - }; - }, - _makeRequest(requestArgs, spec, overrideData) { - return new Promise((resolve, reject) => { - var _a; - let opts; - try { - opts = this._getRequestOpts(requestArgs, spec, overrideData); - } - catch (err) { - reject(err); - return; - } - function requestCallback(err, response) { - if (err) { - reject(err); - } - else { - resolve(spec.transformResponseData - ? spec.transformResponseData(response) - : response); - } - } - const emptyQuery = Object.keys(opts.queryData).length === 0; - const path = [ - opts.requestPath, - emptyQuery ? '' : '?', - (0, utils_js_1.stringifyRequestData)(opts.queryData), - ].join(''); - const { headers, settings } = opts; - this._stripe._requestSender._request(opts.requestMethod, opts.host, path, opts.bodyData, opts.auth, { headers, settings, streaming: opts.streaming }, requestCallback, (_a = this.requestDataProcessor) === null || _a === void 0 ? void 0 : _a.bind(this)); - }); - }, -}; diff --git a/cjs/Webhooks.js b/cjs/Webhooks.js deleted file mode 100644 index b8629d97d2..0000000000 --- a/cjs/Webhooks.js +++ /dev/null @@ -1,179 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.createWebhooks = void 0; -const Error_js_1 = require("./Error.js"); -function createWebhooks(platformFunctions) { - const Webhook = { - DEFAULT_TOLERANCE: 300, - // @ts-ignore - signature: null, - constructEvent(payload, header, secret, tolerance, cryptoProvider) { - this.signature.verifyHeader(payload, header, secret, tolerance || Webhook.DEFAULT_TOLERANCE, cryptoProvider); - const jsonPayload = payload instanceof Uint8Array - ? JSON.parse(new TextDecoder('utf8').decode(payload)) - : JSON.parse(payload); - return jsonPayload; - }, - async constructEventAsync(payload, header, secret, tolerance, cryptoProvider) { - await this.signature.verifyHeaderAsync(payload, header, secret, tolerance || Webhook.DEFAULT_TOLERANCE, cryptoProvider); - const jsonPayload = payload instanceof Uint8Array - ? JSON.parse(new TextDecoder('utf8').decode(payload)) - : JSON.parse(payload); - return jsonPayload; - }, - /** - * Generates a header to be used for webhook mocking - * - * @typedef {object} opts - * @property {number} timestamp - Timestamp of the header. Defaults to Date.now() - * @property {string} payload - JSON stringified payload object, containing the 'id' and 'object' parameters - * @property {string} secret - Stripe webhook secret 'whsec_...' - * @property {string} scheme - Version of API to hit. Defaults to 'v1'. - * @property {string} signature - Computed webhook signature - * @property {CryptoProvider} cryptoProvider - Crypto provider to use for computing the signature if none was provided. Defaults to NodeCryptoProvider. - */ - generateTestHeaderString: function (opts) { - if (!opts) { - throw new Error_js_1.StripeError({ - message: 'Options are required', - }); - } - opts.timestamp = - Math.floor(opts.timestamp) || Math.floor(Date.now() / 1000); - opts.scheme = opts.scheme || signature.EXPECTED_SCHEME; - opts.cryptoProvider = opts.cryptoProvider || getCryptoProvider(); - opts.signature = - opts.signature || - opts.cryptoProvider.computeHMACSignature(opts.timestamp + '.' + opts.payload, opts.secret); - const generatedHeader = [ - 't=' + opts.timestamp, - opts.scheme + '=' + opts.signature, - ].join(','); - return generatedHeader; - }, - }; - const signature = { - EXPECTED_SCHEME: 'v1', - verifyHeader(encodedPayload, encodedHeader, secret, tolerance, cryptoProvider) { - const { decodedHeader: header, decodedPayload: payload, details, suspectPayloadType, } = parseEventDetails(encodedPayload, encodedHeader, this.EXPECTED_SCHEME); - cryptoProvider = cryptoProvider || getCryptoProvider(); - const expectedSignature = cryptoProvider.computeHMACSignature(makeHMACContent(payload, details), secret); - validateComputedSignature(payload, header, details, expectedSignature, tolerance, suspectPayloadType); - return true; - }, - async verifyHeaderAsync(encodedPayload, encodedHeader, secret, tolerance, cryptoProvider) { - const { decodedHeader: header, decodedPayload: payload, details, suspectPayloadType, } = parseEventDetails(encodedPayload, encodedHeader, this.EXPECTED_SCHEME); - cryptoProvider = cryptoProvider || getCryptoProvider(); - const expectedSignature = await cryptoProvider.computeHMACSignatureAsync(makeHMACContent(payload, details), secret); - return validateComputedSignature(payload, header, details, expectedSignature, tolerance, suspectPayloadType); - }, - }; - function makeHMACContent(payload, details) { - return `${details.timestamp}.${payload}`; - } - function parseEventDetails(encodedPayload, encodedHeader, expectedScheme) { - if (!encodedPayload) { - throw new Error_js_1.StripeSignatureVerificationError(encodedHeader, encodedPayload, { - message: 'No webhook payload was provided.', - }); - } - const suspectPayloadType = typeof encodedPayload != 'string' && - !(encodedPayload instanceof Uint8Array); - const textDecoder = new TextDecoder('utf8'); - const decodedPayload = encodedPayload instanceof Uint8Array - ? textDecoder.decode(encodedPayload) - : encodedPayload; - // Express's type for `Request#headers` is `string | []string` - // which is because the `set-cookie` header is an array, - // but no other headers are an array (docs: https://nodejs.org/api/http.html#http_message_headers) - // (Express's Request class is an extension of http.IncomingMessage, and doesn't appear to be relevantly modified: https://github.com/expressjs/express/blob/master/lib/request.js#L31) - if (Array.isArray(encodedHeader)) { - throw new Error('Unexpected: An array was passed as a header, which should not be possible for the stripe-signature header.'); - } - if (encodedHeader == null || encodedHeader == '') { - throw new Error_js_1.StripeSignatureVerificationError(encodedHeader, encodedPayload, { - message: 'No stripe-signature header value was provided.', - }); - } - const decodedHeader = encodedHeader instanceof Uint8Array - ? textDecoder.decode(encodedHeader) - : encodedHeader; - const details = parseHeader(decodedHeader, expectedScheme); - if (!details || details.timestamp === -1) { - throw new Error_js_1.StripeSignatureVerificationError(decodedHeader, decodedPayload, { - message: 'Unable to extract timestamp and signatures from header', - }); - } - if (!details.signatures.length) { - throw new Error_js_1.StripeSignatureVerificationError(decodedHeader, decodedPayload, { - message: 'No signatures found with expected scheme', - }); - } - return { - decodedPayload, - decodedHeader, - details, - suspectPayloadType, - }; - } - function validateComputedSignature(payload, header, details, expectedSignature, tolerance, suspectPayloadType) { - const signatureFound = !!details.signatures.filter(platformFunctions.secureCompare.bind(platformFunctions, expectedSignature)).length; - if (!signatureFound) { - if (suspectPayloadType) { - throw new Error_js_1.StripeSignatureVerificationError(header, payload, { - message: 'Webhook payload must be provided as a string or a Buffer (https://nodejs.org/api/buffer.html) instance representing the _raw_ request body.' + - 'Payload was provided as a parsed JavaScript object instead. \n' + - 'Signature verification is impossible without access to the original signed material. \n' + - 'Learn more about webhook signing and explore webhook integration examples for various frameworks at ' + - 'https://github.com/stripe/stripe-node#webhook-signing', - }); - } - throw new Error_js_1.StripeSignatureVerificationError(header, payload, { - message: 'No signatures found matching the expected signature for payload.' + - ' Are you passing the raw request body you received from Stripe? \n' + - 'Learn more about webhook signing and explore webhook integration examples for various frameworks at ' + - 'https://github.com/stripe/stripe-node#webhook-signing', - }); - } - const timestampAge = Math.floor(Date.now() / 1000) - details.timestamp; - if (tolerance > 0 && timestampAge > tolerance) { - // @ts-ignore - throw new Error_js_1.StripeSignatureVerificationError(header, payload, { - message: 'Timestamp outside the tolerance zone', - }); - } - return true; - } - function parseHeader(header, scheme) { - if (typeof header !== 'string') { - return null; - } - return header.split(',').reduce((accum, item) => { - const kv = item.split('='); - if (kv[0] === 't') { - accum.timestamp = parseInt(kv[1], 10); - } - if (kv[0] === scheme) { - accum.signatures.push(kv[1]); - } - return accum; - }, { - timestamp: -1, - signatures: [], - }); - } - let webhooksCryptoProviderInstance = null; - /** - * Lazily instantiate a CryptoProvider instance. This is a stateless object - * so a singleton can be used here. - */ - function getCryptoProvider() { - if (!webhooksCryptoProviderInstance) { - webhooksCryptoProviderInstance = platformFunctions.createDefaultCryptoProvider(); - } - return webhooksCryptoProviderInstance; - } - Webhook.signature = signature; - return Webhook; -} -exports.createWebhooks = createWebhooks; diff --git a/cjs/apiVersion.js b/cjs/apiVersion.js deleted file mode 100644 index e3d14a8ced..0000000000 --- a/cjs/apiVersion.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ApiVersion = void 0; -exports.ApiVersion = '2022-11-15'; diff --git a/cjs/autoPagination.js b/cjs/autoPagination.js deleted file mode 100644 index c0b734ff78..0000000000 --- a/cjs/autoPagination.js +++ /dev/null @@ -1,234 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.makeAutoPaginationMethods = void 0; -const utils_js_1 = require("./utils.js"); -function makeAutoPaginationMethods(self, requestArgs, spec, firstPagePromise) { - const promiseCache = { currentPromise: null }; - const reverseIteration = isReverseIteration(requestArgs); - let pagePromise = firstPagePromise; - let i = 0; - // Search and List methods iterate differently. - // Search relies on a `next_page` token and can only iterate in one direction. - // List relies on either an `ending_before` or `starting_after` field with - // an item ID to paginate and is bi-directional. - // - // Please note: spec.methodType === 'search' is beta functionality and is - // subject to change/removal at any time. - let getNextPagePromise; - if (spec.methodType === 'search') { - getNextPagePromise = (pageResult) => { - if (!pageResult.next_page) { - throw Error('Unexpected: Stripe API response does not have a well-formed `next_page` field, but `has_more` was true.'); - } - return self._makeRequest(requestArgs, spec, { - page: pageResult.next_page, - }); - }; - } - else { - getNextPagePromise = (pageResult) => { - const lastId = getLastId(pageResult, reverseIteration); - return self._makeRequest(requestArgs, spec, { - [reverseIteration ? 'ending_before' : 'starting_after']: lastId, - }); - }; - } - function iterate(pageResult) { - if (!(pageResult && - pageResult.data && - typeof pageResult.data.length === 'number')) { - throw Error('Unexpected: Stripe API response does not have a well-formed `data` array.'); - } - if (i < pageResult.data.length) { - const idx = reverseIteration ? pageResult.data.length - 1 - i : i; - const value = pageResult.data[idx]; - i += 1; - return { value, done: false }; - } - else if (pageResult.has_more) { - // Reset counter, request next page, and recurse. - i = 0; - pagePromise = getNextPagePromise(pageResult); - return pagePromise.then(iterate); - } - return { value: undefined, done: true }; - } - function asyncIteratorNext() { - return memoizedPromise(promiseCache, (resolve, reject) => { - return pagePromise - .then(iterate) - .then(resolve) - .catch(reject); - }); - } - const autoPagingEach = makeAutoPagingEach(asyncIteratorNext); - const autoPagingToArray = makeAutoPagingToArray(autoPagingEach); - const autoPaginationMethods = { - autoPagingEach, - autoPagingToArray, - // Async iterator functions: - next: asyncIteratorNext, - return: () => { - // This is required for `break`. - return {}; - }, - [getAsyncIteratorSymbol()]: () => { - return autoPaginationMethods; - }, - }; - return autoPaginationMethods; -} -exports.makeAutoPaginationMethods = makeAutoPaginationMethods; -/** - * ---------------- - * Private Helpers: - * ---------------- - */ -function getAsyncIteratorSymbol() { - if (typeof Symbol !== 'undefined' && Symbol.asyncIterator) { - return Symbol.asyncIterator; - } - // Follow the convention from libraries like iterall: https://github.com/leebyron/iterall#asynciterator-1 - return '@@asyncIterator'; -} -function getDoneCallback(args) { - if (args.length < 2) { - return null; - } - const onDone = args[1]; - if (typeof onDone !== 'function') { - throw Error(`The second argument to autoPagingEach, if present, must be a callback function; received ${typeof onDone}`); - } - return onDone; -} -/** - * We allow four forms of the `onItem` callback (the middle two being equivalent), - * - * 1. `.autoPagingEach((item) => { doSomething(item); return false; });` - * 2. `.autoPagingEach(async (item) => { await doSomething(item); return false; });` - * 3. `.autoPagingEach((item) => doSomething(item).then(() => false));` - * 4. `.autoPagingEach((item, next) => { doSomething(item); next(false); });` - * - * In addition to standard validation, this helper - * coalesces the former forms into the latter form. - */ -function getItemCallback(args) { - if (args.length === 0) { - return undefined; - } - const onItem = args[0]; - if (typeof onItem !== 'function') { - throw Error(`The first argument to autoPagingEach, if present, must be a callback function; received ${typeof onItem}`); - } - // 4. `.autoPagingEach((item, next) => { doSomething(item); next(false); });` - if (onItem.length === 2) { - return onItem; - } - if (onItem.length > 2) { - throw Error(`The \`onItem\` callback function passed to autoPagingEach must accept at most two arguments; got ${onItem}`); - } - // This magically handles all three of these usecases (the latter two being functionally identical): - // 1. `.autoPagingEach((item) => { doSomething(item); return false; });` - // 2. `.autoPagingEach(async (item) => { await doSomething(item); return false; });` - // 3. `.autoPagingEach((item) => doSomething(item).then(() => false));` - return function _onItem(item, next) { - const shouldContinue = onItem(item); - next(shouldContinue); - }; -} -function getLastId(listResult, reverseIteration) { - const lastIdx = reverseIteration ? 0 : listResult.data.length - 1; - const lastItem = listResult.data[lastIdx]; - const lastId = lastItem && lastItem.id; - if (!lastId) { - throw Error('Unexpected: No `id` found on the last item while auto-paging a list.'); - } - return lastId; -} -/** - * If a user calls `.next()` multiple times in parallel, - * return the same result until something has resolved - * to prevent page-turning race conditions. - */ -function memoizedPromise(promiseCache, cb) { - if (promiseCache.currentPromise) { - return promiseCache.currentPromise; - } - promiseCache.currentPromise = new Promise(cb).then((ret) => { - promiseCache.currentPromise = undefined; - return ret; - }); - return promiseCache.currentPromise; -} -function makeAutoPagingEach(asyncIteratorNext) { - return function autoPagingEach( /* onItem?, onDone? */) { - const args = [].slice.call(arguments); - const onItem = getItemCallback(args); - const onDone = getDoneCallback(args); - if (args.length > 2) { - throw Error(`autoPagingEach takes up to two arguments; received ${args}`); - } - const autoPagePromise = wrapAsyncIteratorWithCallback(asyncIteratorNext, - // @ts-ignore we might need a null check - onItem); - return (0, utils_js_1.callbackifyPromiseWithTimeout)(autoPagePromise, onDone); - }; -} -function makeAutoPagingToArray(autoPagingEach) { - return function autoPagingToArray(opts, onDone) { - const limit = opts && opts.limit; - if (!limit) { - throw Error('You must pass a `limit` option to autoPagingToArray, e.g., `autoPagingToArray({limit: 1000});`.'); - } - if (limit > 10000) { - throw Error('You cannot specify a limit of more than 10,000 items to fetch in `autoPagingToArray`; use `autoPagingEach` to iterate through longer lists.'); - } - const promise = new Promise((resolve, reject) => { - const items = []; - autoPagingEach((item) => { - items.push(item); - if (items.length >= limit) { - return false; - } - }) - .then(() => { - resolve(items); - }) - .catch(reject); - }); - // @ts-ignore - return (0, utils_js_1.callbackifyPromiseWithTimeout)(promise, onDone); - }; -} -function wrapAsyncIteratorWithCallback(asyncIteratorNext, onItem) { - return new Promise((resolve, reject) => { - function handleIteration(iterResult) { - if (iterResult.done) { - resolve(); - return; - } - const item = iterResult.value; - return new Promise((next) => { - // Bit confusing, perhaps; we pass a `resolve` fn - // to the user, so they can decide when and if to continue. - // They can return false, or a promise which resolves to false, to break. - onItem(item, next); - }).then((shouldContinue) => { - if (shouldContinue === false) { - return handleIteration({ done: true }); - } - else { - return asyncIteratorNext().then(handleIteration); - } - }); - } - asyncIteratorNext() - .then(handleIteration) - .catch(reject); - }); -} -function isReverseIteration(requestArgs) { - const args = [].slice.call(requestArgs); - const dataFromArgs = (0, utils_js_1.getDataFromArgs)(args); - return !!dataFromArgs.ending_before; -} diff --git a/cjs/crypto/CryptoProvider.js b/cjs/crypto/CryptoProvider.js deleted file mode 100644 index 560ceede1c..0000000000 --- a/cjs/crypto/CryptoProvider.js +++ /dev/null @@ -1,35 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.CryptoProvider = void 0; -/** - * Interface encapsulating the various crypto computations used by the library, - * allowing pluggable underlying crypto implementations. - */ -class CryptoProvider { - /** - * Computes a SHA-256 HMAC given a secret and a payload (encoded in UTF-8). - * The output HMAC should be encoded in hexadecimal. - * - * Sample values for implementations: - * - computeHMACSignature('', 'test_secret') => 'f7f9bd47fb987337b5796fdc1fdb9ba221d0d5396814bfcaf9521f43fd8927fd' - * - computeHMACSignature('\ud83d\ude00', 'test_secret') => '837da296d05c4fe31f61d5d7ead035099d9585a5bcde87de952012a78f0b0c43 - */ - computeHMACSignature(payload, secret) { - throw new Error('computeHMACSignature not implemented.'); - } - /** - * Asynchronous version of `computeHMACSignature`. Some implementations may - * only allow support async signature computation. - * - * Computes a SHA-256 HMAC given a secret and a payload (encoded in UTF-8). - * The output HMAC should be encoded in hexadecimal. - * - * Sample values for implementations: - * - computeHMACSignature('', 'test_secret') => 'f7f9bd47fb987337b5796fdc1fdb9ba221d0d5396814bfcaf9521f43fd8927fd' - * - computeHMACSignature('\ud83d\ude00', 'test_secret') => '837da296d05c4fe31f61d5d7ead035099d9585a5bcde87de952012a78f0b0c43 - */ - computeHMACSignatureAsync(payload, secret) { - throw new Error('computeHMACSignatureAsync not implemented.'); - } -} -exports.CryptoProvider = CryptoProvider; diff --git a/cjs/crypto/NodeCryptoProvider.js b/cjs/crypto/NodeCryptoProvider.js deleted file mode 100644 index 54993975b7..0000000000 --- a/cjs/crypto/NodeCryptoProvider.js +++ /dev/null @@ -1,23 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.NodeCryptoProvider = void 0; -const crypto = require("crypto"); -const CryptoProvider_js_1 = require("./CryptoProvider.js"); -/** - * `CryptoProvider which uses the Node `crypto` package for its computations. - */ -class NodeCryptoProvider extends CryptoProvider_js_1.CryptoProvider { - /** @override */ - computeHMACSignature(payload, secret) { - return crypto - .createHmac('sha256', secret) - .update(payload, 'utf8') - .digest('hex'); - } - /** @override */ - async computeHMACSignatureAsync(payload, secret) { - const signature = await this.computeHMACSignature(payload, secret); - return signature; - } -} -exports.NodeCryptoProvider = NodeCryptoProvider; diff --git a/cjs/crypto/SubtleCryptoProvider.js b/cjs/crypto/SubtleCryptoProvider.js deleted file mode 100644 index 39cd030357..0000000000 --- a/cjs/crypto/SubtleCryptoProvider.js +++ /dev/null @@ -1,47 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.SubtleCryptoProvider = void 0; -const CryptoProvider_js_1 = require("./CryptoProvider.js"); -/** - * `CryptoProvider which uses the SubtleCrypto interface of the Web Crypto API. - * - * This only supports asynchronous operations. - */ -class SubtleCryptoProvider extends CryptoProvider_js_1.CryptoProvider { - constructor(subtleCrypto) { - super(); - // If no subtle crypto is interface, default to the global namespace. This - // is to allow custom interfaces (eg. using the Node webcrypto interface in - // tests). - this.subtleCrypto = subtleCrypto || crypto.subtle; - } - /** @override */ - computeHMACSignature(payload, secret) { - throw new Error('SubtleCryptoProvider cannot be used in a synchronous context.'); - } - /** @override */ - async computeHMACSignatureAsync(payload, secret) { - const encoder = new TextEncoder(); - const key = await this.subtleCrypto.importKey('raw', encoder.encode(secret), { - name: 'HMAC', - hash: { name: 'SHA-256' }, - }, false, ['sign']); - const signatureBuffer = await this.subtleCrypto.sign('hmac', key, encoder.encode(payload)); - // crypto.subtle returns the signature in base64 format. This must be - // encoded in hex to match the CryptoProvider contract. We map each byte in - // the buffer to its corresponding hex octet and then combine into a string. - const signatureBytes = new Uint8Array(signatureBuffer); - const signatureHexCodes = new Array(signatureBytes.length); - for (let i = 0; i < signatureBytes.length; i++) { - signatureHexCodes[i] = byteHexMapping[signatureBytes[i]]; - } - return signatureHexCodes.join(''); - } -} -exports.SubtleCryptoProvider = SubtleCryptoProvider; -// Cached mapping of byte to hex representation. We do this once to avoid re- -// computing every time we need to convert the result of a signature to hex. -const byteHexMapping = new Array(256); -for (let i = 0; i < byteHexMapping.length; i++) { - byteHexMapping[i] = i.toString(16).padStart(2, '0'); -} diff --git a/cjs/multipart.js b/cjs/multipart.js deleted file mode 100644 index 98d4c0cc4b..0000000000 --- a/cjs/multipart.js +++ /dev/null @@ -1,58 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.multipartRequestDataProcessor = void 0; -const utils_js_1 = require("./utils.js"); -// Method for formatting HTTP body for the multipart/form-data specification -// Mostly taken from Fermata.js -// https://github.com/natevw/fermata/blob/5d9732a33d776ce925013a265935facd1626cc88/fermata.js#L315-L343 -const multipartDataGenerator = (method, data, headers) => { - const segno = (Math.round(Math.random() * 1e16) + Math.round(Math.random() * 1e16)).toString(); - headers['Content-Type'] = `multipart/form-data; boundary=${segno}`; - const textEncoder = new TextEncoder(); - let buffer = new Uint8Array(0); - const endBuffer = textEncoder.encode('\r\n'); - function push(l) { - const prevBuffer = buffer; - const newBuffer = l instanceof Uint8Array ? l : new Uint8Array(textEncoder.encode(l)); - buffer = new Uint8Array(prevBuffer.length + newBuffer.length + 2); - buffer.set(prevBuffer); - buffer.set(newBuffer, prevBuffer.length); - buffer.set(endBuffer, buffer.length - 2); - } - function q(s) { - return `"${s.replace(/"|"/g, '%22').replace(/\r\n|\r|\n/g, ' ')}"`; - } - const flattenedData = (0, utils_js_1.flattenAndStringify)(data); - for (const k in flattenedData) { - const v = flattenedData[k]; - push(`--${segno}`); - if (Object.prototype.hasOwnProperty.call(v, 'data')) { - const typedEntry = v; - push(`Content-Disposition: form-data; name=${q(k)}; filename=${q(typedEntry.name || 'blob')}`); - push(`Content-Type: ${typedEntry.type || 'application/octet-stream'}`); - push(''); - push(typedEntry.data); - } - else { - push(`Content-Disposition: form-data; name=${q(k)}`); - push(''); - push(v); - } - } - push(`--${segno}--`); - return buffer; -}; -function multipartRequestDataProcessor(method, data, headers, callback) { - data = data || {}; - if (method !== 'POST') { - return callback(null, (0, utils_js_1.stringifyRequestData)(data)); - } - this._stripe._platformFunctions - .tryBufferData(data) - .then((bufferedData) => { - const buffer = multipartDataGenerator(method, bufferedData, headers); - return callback(null, buffer); - }) - .catch((err) => callback(err, null)); -} -exports.multipartRequestDataProcessor = multipartRequestDataProcessor; diff --git a/cjs/net/FetchHttpClient.js b/cjs/net/FetchHttpClient.js deleted file mode 100644 index 76d8e18d8b..0000000000 --- a/cjs/net/FetchHttpClient.js +++ /dev/null @@ -1,106 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FetchHttpClientResponse = exports.FetchHttpClient = void 0; -const HttpClient_js_1 = require("./HttpClient.js"); -/** - * HTTP client which uses a `fetch` function to issue requests. - * - * By default relies on the global `fetch` function, but an optional function - * can be passed in. If passing in a function, it is expected to match the Web - * Fetch API. As an example, this could be the function provided by the - * node-fetch package (https://github.com/node-fetch/node-fetch). - */ -class FetchHttpClient extends HttpClient_js_1.HttpClient { - constructor(fetchFn) { - super(); - this._fetchFn = fetchFn; - } - /** @override. */ - getClientName() { - return 'fetch'; - } - makeRequest(host, port, path, method, headers, requestData, protocol, timeout) { - const isInsecureConnection = protocol === 'http'; - const url = new URL(path, `${isInsecureConnection ? 'http' : 'https'}://${host}`); - url.port = port; - // For methods which expect payloads, we should always pass a body value - // even when it is empty. Without this, some JS runtimes (eg. Deno) will - // inject a second Content-Length header. See https://github.com/stripe/stripe-node/issues/1519 - // for more details. - const methodHasPayload = method == 'POST' || method == 'PUT' || method == 'PATCH'; - const body = requestData || (methodHasPayload ? '' : undefined); - const fetchFn = this._fetchFn || fetch; - const fetchPromise = fetchFn(url.toString(), { - method, - // @ts-ignore - headers, - // @ts-ignore - body, - }); - // The Fetch API does not support passing in a timeout natively, so a - // timeout promise is constructed to race against the fetch and preempt the - // request, simulating a timeout. - // - // This timeout behavior differs from Node: - // - Fetch uses a single timeout for the entire length of the request. - // - Node is more fine-grained and resets the timeout after each stage of - // the request. - // - // As an example, if the timeout is set to 30s and the connection takes 20s - // to be established followed by 20s for the body, Fetch would timeout but - // Node would not. The more fine-grained timeout cannot be implemented with - // fetch. - let pendingTimeoutId; - const timeoutPromise = new Promise((_, reject) => { - pendingTimeoutId = setTimeout(() => { - pendingTimeoutId = null; - reject(HttpClient_js_1.HttpClient.makeTimeoutError()); - }, timeout); - }); - return Promise.race([fetchPromise, timeoutPromise]) - .then((res) => { - return new FetchHttpClientResponse(res); - }) - .finally(() => { - if (pendingTimeoutId) { - clearTimeout(pendingTimeoutId); - } - }); - } -} -exports.FetchHttpClient = FetchHttpClient; -class FetchHttpClientResponse extends HttpClient_js_1.HttpClientResponse { - constructor(res) { - super(res.status, FetchHttpClientResponse._transformHeadersToObject(res.headers)); - this._res = res; - } - getRawResponse() { - return this._res; - } - toStream(streamCompleteCallback) { - // Unfortunately `fetch` does not have event handlers for when the stream is - // completely read. We therefore invoke the streamCompleteCallback right - // away. This callback emits a response event with metadata and completes - // metrics, so it's ok to do this without waiting for the stream to be - // completely read. - streamCompleteCallback(); - // Fetch's `body` property is expected to be a readable stream of the body. - return this._res.body; - } - toJSON() { - return this._res.json(); - } - static _transformHeadersToObject(headers) { - // Fetch uses a Headers instance so this must be converted to a barebones - // JS object to meet the HttpClient interface. - const headersObj = {}; - for (const entry of headers) { - if (!Array.isArray(entry) || entry.length != 2) { - throw new Error('Response objects produced by the fetch function given to FetchHttpClient do not have an iterable headers map. Response#headers should be an iterable object.'); - } - headersObj[entry[0]] = entry[1]; - } - return headersObj; - } -} -exports.FetchHttpClientResponse = FetchHttpClientResponse; diff --git a/cjs/net/HttpClient.js b/cjs/net/HttpClient.js deleted file mode 100644 index ab1c4726e8..0000000000 --- a/cjs/net/HttpClient.js +++ /dev/null @@ -1,53 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.HttpClientResponse = exports.HttpClient = void 0; -/** - * Encapsulates the logic for issuing a request to the Stripe API. - * - * A custom HTTP client should should implement: - * 1. A response class which extends HttpClientResponse and wraps around their - * own internal representation of a response. - * 2. A client class which extends HttpClient and implements all methods, - * returning their own response class when making requests. - */ -class HttpClient { - /** The client name used for diagnostics. */ - getClientName() { - throw new Error('getClientName not implemented.'); - } - makeRequest(host, port, path, method, headers, requestData, protocol, timeout) { - throw new Error('makeRequest not implemented.'); - } - /** Helper to make a consistent timeout error across implementations. */ - static makeTimeoutError() { - const timeoutErr = new TypeError(HttpClient.TIMEOUT_ERROR_CODE); - timeoutErr.code = HttpClient.TIMEOUT_ERROR_CODE; - return timeoutErr; - } -} -exports.HttpClient = HttpClient; -// Public API accessible via Stripe.HttpClient -HttpClient.CONNECTION_CLOSED_ERROR_CODES = ['ECONNRESET', 'EPIPE']; -HttpClient.TIMEOUT_ERROR_CODE = 'ETIMEDOUT'; -class HttpClientResponse { - constructor(statusCode, headers) { - this._statusCode = statusCode; - this._headers = headers; - } - getStatusCode() { - return this._statusCode; - } - getHeaders() { - return this._headers; - } - getRawResponse() { - throw new Error('getRawResponse not implemented.'); - } - toStream(streamCompleteCallback) { - throw new Error('toStream not implemented.'); - } - toJSON() { - throw new Error('toJSON not implemented.'); - } -} -exports.HttpClientResponse = HttpClientResponse; diff --git a/cjs/net/NodeHttpClient.js b/cjs/net/NodeHttpClient.js deleted file mode 100644 index bab87208db..0000000000 --- a/cjs/net/NodeHttpClient.js +++ /dev/null @@ -1,100 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.NodeHttpClientResponse = exports.NodeHttpClient = void 0; -const http = require("http"); -const https = require("https"); -const HttpClient_js_1 = require("./HttpClient.js"); -const defaultHttpAgent = new http.Agent({ keepAlive: true }); -const defaultHttpsAgent = new https.Agent({ keepAlive: true }); -/** - * HTTP client which uses the Node `http` and `https` packages to issue - * requests.` - */ -class NodeHttpClient extends HttpClient_js_1.HttpClient { - constructor(agent) { - super(); - this._agent = agent; - } - /** @override. */ - getClientName() { - return 'node'; - } - makeRequest(host, port, path, method, headers, requestData, protocol, timeout) { - const isInsecureConnection = protocol === 'http'; - let agent = this._agent; - if (!agent) { - agent = isInsecureConnection ? defaultHttpAgent : defaultHttpsAgent; - } - const requestPromise = new Promise((resolve, reject) => { - const req = (isInsecureConnection ? http : https).request({ - host: host, - port: port, - path, - method, - agent, - headers, - ciphers: 'DEFAULT:!aNULL:!eNULL:!LOW:!EXPORT:!SSLv2:!MD5', - }); - req.setTimeout(timeout, () => { - req.destroy(HttpClient_js_1.HttpClient.makeTimeoutError()); - }); - req.on('response', (res) => { - resolve(new NodeHttpClientResponse(res)); - }); - req.on('error', (error) => { - reject(error); - }); - req.once('socket', (socket) => { - if (socket.connecting) { - socket.once(isInsecureConnection ? 'connect' : 'secureConnect', () => { - // Send payload; we're safe: - req.write(requestData); - req.end(); - }); - } - else { - // we're already connected - req.write(requestData); - req.end(); - } - }); - }); - return requestPromise; - } -} -exports.NodeHttpClient = NodeHttpClient; -class NodeHttpClientResponse extends HttpClient_js_1.HttpClientResponse { - constructor(res) { - // @ts-ignore - super(res.statusCode, res.headers || {}); - this._res = res; - } - getRawResponse() { - return this._res; - } - toStream(streamCompleteCallback) { - // The raw response is itself the stream, so we just return that. To be - // backwards compatible, we should invoke the streamCompleteCallback only - // once the stream has been fully consumed. - this._res.once('end', () => streamCompleteCallback()); - return this._res; - } - toJSON() { - return new Promise((resolve, reject) => { - let response = ''; - this._res.setEncoding('utf8'); - this._res.on('data', (chunk) => { - response += chunk; - }); - this._res.once('end', () => { - try { - resolve(JSON.parse(response)); - } - catch (e) { - reject(e); - } - }); - }); - } -} -exports.NodeHttpClientResponse = NodeHttpClientResponse; diff --git a/cjs/package.json b/cjs/package.json deleted file mode 100644 index 729ac4d93b..0000000000 --- a/cjs/package.json +++ /dev/null @@ -1 +0,0 @@ -{"type":"commonjs"} diff --git a/cjs/platform/NodePlatformFunctions.js b/cjs/platform/NodePlatformFunctions.js deleted file mode 100644 index adcadc470d..0000000000 --- a/cjs/platform/NodePlatformFunctions.js +++ /dev/null @@ -1,126 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.NodePlatformFunctions = void 0; -const crypto = require("crypto"); -const events_1 = require("events"); -const NodeCryptoProvider_js_1 = require("../crypto/NodeCryptoProvider.js"); -const NodeHttpClient_js_1 = require("../net/NodeHttpClient.js"); -const PlatformFunctions_js_1 = require("./PlatformFunctions.js"); -const Error_js_1 = require("../Error.js"); -const utils_js_1 = require("../utils.js"); -const child_process_1 = require("child_process"); -class StreamProcessingError extends Error_js_1.StripeError { -} -/** - * Specializes WebPlatformFunctions using APIs available in Node.js. - */ -class NodePlatformFunctions extends PlatformFunctions_js_1.PlatformFunctions { - constructor() { - super(); - this._exec = child_process_1.exec; - this._UNAME_CACHE = null; - } - /** @override */ - uuid4() { - // available in: v14.17.x+ - if (crypto.randomUUID) { - return crypto.randomUUID(); - } - return super.uuid4(); - } - /** - * @override - * Node's built in `exec` function sometimes throws outright, - * and sometimes has a callback with an error, - * depending on the type of error. - * - * This unifies that interface by resolving with a null uname - * if an error is encountered. - */ - getUname() { - if (!this._UNAME_CACHE) { - this._UNAME_CACHE = new Promise((resolve, reject) => { - try { - this._exec('uname -a', (err, uname) => { - if (err) { - return resolve(null); - } - resolve(uname); - }); - } - catch (e) { - resolve(null); - } - }); - } - return this._UNAME_CACHE; - } - /** - * @override - * Secure compare, from https://github.com/freewil/scmp - */ - secureCompare(a, b) { - if (!a || !b) { - throw new Error('secureCompare must receive two arguments'); - } - // return early here if buffer lengths are not equal since timingSafeEqual - // will throw if buffer lengths are not equal - if (a.length !== b.length) { - return false; - } - // use crypto.timingSafeEqual if available (since Node.js v6.6.0), - // otherwise use our own scmp-internal function. - if (crypto.timingSafeEqual) { - const textEncoder = new TextEncoder(); - const aEncoded = textEncoder.encode(a); - const bEncoded = textEncoder.encode(b); - return crypto.timingSafeEqual(aEncoded, bEncoded); - } - return super.secureCompare(a, b); - } - createEmitter() { - return new events_1.EventEmitter(); - } - /** @override */ - tryBufferData(data) { - if (!(data.file.data instanceof events_1.EventEmitter)) { - return Promise.resolve(data); - } - const bufferArray = []; - return new Promise((resolve, reject) => { - data.file.data - .on('data', (line) => { - bufferArray.push(line); - }) - .once('end', () => { - // @ts-ignore - const bufferData = Object.assign({}, data); - bufferData.file.data = (0, utils_js_1.concat)(bufferArray); - resolve(bufferData); - }) - .on('error', (err) => { - reject(new StreamProcessingError({ - message: 'An error occurred while attempting to process the file for upload.', - detail: err, - })); - }); - }); - } - /** @override */ - createNodeHttpClient(agent) { - return new NodeHttpClient_js_1.NodeHttpClient(agent); - } - /** @override */ - createDefaultHttpClient() { - return new NodeHttpClient_js_1.NodeHttpClient(); - } - /** @override */ - createNodeCryptoProvider() { - return new NodeCryptoProvider_js_1.NodeCryptoProvider(); - } - /** @override */ - createDefaultCryptoProvider() { - return this.createNodeCryptoProvider(); - } -} -exports.NodePlatformFunctions = NodePlatformFunctions; diff --git a/cjs/platform/PlatformFunctions.js b/cjs/platform/PlatformFunctions.js deleted file mode 100644 index cb7e2876c5..0000000000 --- a/cjs/platform/PlatformFunctions.js +++ /dev/null @@ -1,98 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.PlatformFunctions = void 0; -const FetchHttpClient_js_1 = require("../net/FetchHttpClient.js"); -const SubtleCryptoProvider_js_1 = require("../crypto/SubtleCryptoProvider.js"); -/** - * Interface encapsulating various utility functions whose - * implementations depend on the platform / JS runtime. - */ -class PlatformFunctions { - constructor() { - this._fetchFn = null; - this._agent = null; - } - /** - * Gets uname with Node's built-in `exec` function, if available. - */ - getUname() { - throw new Error('getUname not implemented.'); - } - /** - * Generates a v4 UUID. See https://stackoverflow.com/a/2117523 - */ - uuid4() { - return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => { - const r = (Math.random() * 16) | 0; - const v = c === 'x' ? r : (r & 0x3) | 0x8; - return v.toString(16); - }); - } - /** - * Compares strings in constant time. - */ - secureCompare(a, b) { - // return early here if buffer lengths are not equal - if (a.length !== b.length) { - return false; - } - const len = a.length; - let result = 0; - for (let i = 0; i < len; ++i) { - result |= a.charCodeAt(i) ^ b.charCodeAt(i); - } - return result === 0; - } - /** - * Creates an event emitter. - */ - createEmitter() { - throw new Error('createEmitter not implemented.'); - } - /** - * Checks if the request data is a stream. If so, read the entire stream - * to a buffer and return the buffer. - */ - tryBufferData(data) { - throw new Error('tryBufferData not implemented.'); - } - /** - * Creates an HTTP client which uses the Node `http` and `https` packages - * to issue requests. - */ - createNodeHttpClient(agent) { - throw new Error('createNodeHttpClient not implemented.'); - } - /** - * Creates an HTTP client for issuing Stripe API requests which uses the Web - * Fetch API. - * - * A fetch function can optionally be passed in as a parameter. If none is - * passed, will default to the default `fetch` function in the global scope. - */ - createFetchHttpClient(fetchFn) { - return new FetchHttpClient_js_1.FetchHttpClient(fetchFn); - } - /** - * Creates an HTTP client using runtime-specific APIs. - */ - createDefaultHttpClient() { - throw new Error('createDefaultHttpClient not implemented.'); - } - /** - * Creates a CryptoProvider which uses the Node `crypto` package for its computations. - */ - createNodeCryptoProvider() { - throw new Error('createNodeCryptoProvider not implemented.'); - } - /** - * Creates a CryptoProvider which uses the SubtleCrypto interface of the Web Crypto API. - */ - createSubtleCryptoProvider(subtleCrypto) { - return new SubtleCryptoProvider_js_1.SubtleCryptoProvider(subtleCrypto); - } - createDefaultCryptoProvider() { - throw new Error('createDefaultCryptoProvider not implemented.'); - } -} -exports.PlatformFunctions = PlatformFunctions; diff --git a/cjs/platform/WebPlatformFunctions.js b/cjs/platform/WebPlatformFunctions.js deleted file mode 100644 index 54df135b04..0000000000 --- a/cjs/platform/WebPlatformFunctions.js +++ /dev/null @@ -1,42 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.WebPlatformFunctions = void 0; -const PlatformFunctions_js_1 = require("./PlatformFunctions.js"); -const StripeEmitter_js_1 = require("../StripeEmitter.js"); -/** - * Specializes WebPlatformFunctions using APIs available in Web workers. - */ -class WebPlatformFunctions extends PlatformFunctions_js_1.PlatformFunctions { - /** @override */ - getUname() { - return Promise.resolve(null); - } - /** @override */ - createEmitter() { - return new StripeEmitter_js_1.StripeEmitter(); - } - /** @override */ - tryBufferData(data) { - if (data.file.data instanceof ReadableStream) { - throw new Error('Uploading a file as a stream is not supported in non-Node environments. Please open or upvote an issue at github.com/stripe/stripe-node if you use this, detailing your use-case.'); - } - return Promise.resolve(data); - } - /** @override */ - createNodeHttpClient() { - throw new Error('Stripe: `createNodeHttpClient()` is not available in non-Node environments. Please use `createFetchHttpClient()` instead.'); - } - /** @override */ - createDefaultHttpClient() { - return super.createFetchHttpClient(); - } - /** @override */ - createNodeCryptoProvider() { - throw new Error('Stripe: `createNodeCryptoProvider()` is not available in non-Node environments. Please use `createSubtleCryptoProvider()` instead.'); - } - /** @override */ - createDefaultCryptoProvider() { - return this.createSubtleCryptoProvider(); - } -} -exports.WebPlatformFunctions = WebPlatformFunctions; diff --git a/cjs/resources.js b/cjs/resources.js deleted file mode 100644 index 99d7c51625..0000000000 --- a/cjs/resources.js +++ /dev/null @@ -1,210 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FinancialConnections = exports.Checkout = exports.BillingPortal = exports.Apps = exports.WebhookEndpoints = exports.Transfers = exports.Topups = exports.Tokens = exports.TaxRates = exports.TaxCodes = exports.SubscriptionSchedules = exports.SubscriptionItems = exports.Subscriptions = exports.Sources = exports.ShippingRates = exports.SetupIntents = exports.SetupAttempts = exports.Reviews = exports.Refunds = exports.Quotes = exports.PromotionCodes = exports.Products = exports.Prices = exports.Plans = exports.Payouts = exports.PaymentMethods = exports.PaymentLinks = exports.PaymentIntents = exports.Mandates = exports.InvoiceItems = exports.Invoices = exports.FileLinks = exports.Files = exports.ExchangeRates = exports.Events = exports.EphemeralKeys = exports.Disputes = exports.Customers = exports.CreditNotes = exports.Coupons = exports.CountrySpecs = exports.Charges = exports.BalanceTransactions = exports.Balance = exports.ApplicationFees = exports.ApplePayDomains = exports.AccountLinks = exports.Accounts = exports.OAuth = exports.Account = void 0; -exports.Treasury = exports.TestHelpers = exports.Terminal = exports.Sigma = exports.Reporting = exports.Radar = exports.Issuing = exports.Identity = void 0; -const ResourceNamespace_js_1 = require("./ResourceNamespace.js"); -const Accounts_js_1 = require("./resources/FinancialConnections/Accounts.js"); -const Authorizations_js_1 = require("./resources/Issuing/Authorizations.js"); -const Cardholders_js_1 = require("./resources/Issuing/Cardholders.js"); -const Cards_js_1 = require("./resources/TestHelpers/Issuing/Cards.js"); -const Cards_js_2 = require("./resources/Issuing/Cards.js"); -const Configurations_js_1 = require("./resources/BillingPortal/Configurations.js"); -const Configurations_js_2 = require("./resources/Terminal/Configurations.js"); -const ConnectionTokens_js_1 = require("./resources/Terminal/ConnectionTokens.js"); -const CreditReversals_js_1 = require("./resources/Treasury/CreditReversals.js"); -const Customers_js_1 = require("./resources/TestHelpers/Customers.js"); -const DebitReversals_js_1 = require("./resources/Treasury/DebitReversals.js"); -const Disputes_js_1 = require("./resources/Issuing/Disputes.js"); -const EarlyFraudWarnings_js_1 = require("./resources/Radar/EarlyFraudWarnings.js"); -const FinancialAccounts_js_1 = require("./resources/Treasury/FinancialAccounts.js"); -const InboundTransfers_js_1 = require("./resources/TestHelpers/Treasury/InboundTransfers.js"); -const InboundTransfers_js_2 = require("./resources/Treasury/InboundTransfers.js"); -const Locations_js_1 = require("./resources/Terminal/Locations.js"); -const OutboundPayments_js_1 = require("./resources/TestHelpers/Treasury/OutboundPayments.js"); -const OutboundPayments_js_2 = require("./resources/Treasury/OutboundPayments.js"); -const OutboundTransfers_js_1 = require("./resources/TestHelpers/Treasury/OutboundTransfers.js"); -const OutboundTransfers_js_2 = require("./resources/Treasury/OutboundTransfers.js"); -const Readers_js_1 = require("./resources/TestHelpers/Terminal/Readers.js"); -const Readers_js_2 = require("./resources/Terminal/Readers.js"); -const ReceivedCredits_js_1 = require("./resources/TestHelpers/Treasury/ReceivedCredits.js"); -const ReceivedCredits_js_2 = require("./resources/Treasury/ReceivedCredits.js"); -const ReceivedDebits_js_1 = require("./resources/TestHelpers/Treasury/ReceivedDebits.js"); -const ReceivedDebits_js_2 = require("./resources/Treasury/ReceivedDebits.js"); -const Refunds_js_1 = require("./resources/TestHelpers/Refunds.js"); -const ReportRuns_js_1 = require("./resources/Reporting/ReportRuns.js"); -const ReportTypes_js_1 = require("./resources/Reporting/ReportTypes.js"); -const ScheduledQueryRuns_js_1 = require("./resources/Sigma/ScheduledQueryRuns.js"); -const Secrets_js_1 = require("./resources/Apps/Secrets.js"); -const Sessions_js_1 = require("./resources/BillingPortal/Sessions.js"); -const Sessions_js_2 = require("./resources/Checkout/Sessions.js"); -const Sessions_js_3 = require("./resources/FinancialConnections/Sessions.js"); -const TestClocks_js_1 = require("./resources/TestHelpers/TestClocks.js"); -const TransactionEntries_js_1 = require("./resources/Treasury/TransactionEntries.js"); -const Transactions_js_1 = require("./resources/Issuing/Transactions.js"); -const Transactions_js_2 = require("./resources/Treasury/Transactions.js"); -const ValueListItems_js_1 = require("./resources/Radar/ValueListItems.js"); -const ValueLists_js_1 = require("./resources/Radar/ValueLists.js"); -const VerificationReports_js_1 = require("./resources/Identity/VerificationReports.js"); -const VerificationSessions_js_1 = require("./resources/Identity/VerificationSessions.js"); -var Accounts_js_2 = require("./resources/Accounts.js"); -Object.defineProperty(exports, "Account", { enumerable: true, get: function () { return Accounts_js_2.Accounts; } }); -var OAuth_js_1 = require("./resources/OAuth.js"); -Object.defineProperty(exports, "OAuth", { enumerable: true, get: function () { return OAuth_js_1.OAuth; } }); -var Accounts_js_3 = require("./resources/Accounts.js"); -Object.defineProperty(exports, "Accounts", { enumerable: true, get: function () { return Accounts_js_3.Accounts; } }); -var AccountLinks_js_1 = require("./resources/AccountLinks.js"); -Object.defineProperty(exports, "AccountLinks", { enumerable: true, get: function () { return AccountLinks_js_1.AccountLinks; } }); -var ApplePayDomains_js_1 = require("./resources/ApplePayDomains.js"); -Object.defineProperty(exports, "ApplePayDomains", { enumerable: true, get: function () { return ApplePayDomains_js_1.ApplePayDomains; } }); -var ApplicationFees_js_1 = require("./resources/ApplicationFees.js"); -Object.defineProperty(exports, "ApplicationFees", { enumerable: true, get: function () { return ApplicationFees_js_1.ApplicationFees; } }); -var Balance_js_1 = require("./resources/Balance.js"); -Object.defineProperty(exports, "Balance", { enumerable: true, get: function () { return Balance_js_1.Balance; } }); -var BalanceTransactions_js_1 = require("./resources/BalanceTransactions.js"); -Object.defineProperty(exports, "BalanceTransactions", { enumerable: true, get: function () { return BalanceTransactions_js_1.BalanceTransactions; } }); -var Charges_js_1 = require("./resources/Charges.js"); -Object.defineProperty(exports, "Charges", { enumerable: true, get: function () { return Charges_js_1.Charges; } }); -var CountrySpecs_js_1 = require("./resources/CountrySpecs.js"); -Object.defineProperty(exports, "CountrySpecs", { enumerable: true, get: function () { return CountrySpecs_js_1.CountrySpecs; } }); -var Coupons_js_1 = require("./resources/Coupons.js"); -Object.defineProperty(exports, "Coupons", { enumerable: true, get: function () { return Coupons_js_1.Coupons; } }); -var CreditNotes_js_1 = require("./resources/CreditNotes.js"); -Object.defineProperty(exports, "CreditNotes", { enumerable: true, get: function () { return CreditNotes_js_1.CreditNotes; } }); -var Customers_js_2 = require("./resources/Customers.js"); -Object.defineProperty(exports, "Customers", { enumerable: true, get: function () { return Customers_js_2.Customers; } }); -var Disputes_js_2 = require("./resources/Disputes.js"); -Object.defineProperty(exports, "Disputes", { enumerable: true, get: function () { return Disputes_js_2.Disputes; } }); -var EphemeralKeys_js_1 = require("./resources/EphemeralKeys.js"); -Object.defineProperty(exports, "EphemeralKeys", { enumerable: true, get: function () { return EphemeralKeys_js_1.EphemeralKeys; } }); -var Events_js_1 = require("./resources/Events.js"); -Object.defineProperty(exports, "Events", { enumerable: true, get: function () { return Events_js_1.Events; } }); -var ExchangeRates_js_1 = require("./resources/ExchangeRates.js"); -Object.defineProperty(exports, "ExchangeRates", { enumerable: true, get: function () { return ExchangeRates_js_1.ExchangeRates; } }); -var Files_js_1 = require("./resources/Files.js"); -Object.defineProperty(exports, "Files", { enumerable: true, get: function () { return Files_js_1.Files; } }); -var FileLinks_js_1 = require("./resources/FileLinks.js"); -Object.defineProperty(exports, "FileLinks", { enumerable: true, get: function () { return FileLinks_js_1.FileLinks; } }); -var Invoices_js_1 = require("./resources/Invoices.js"); -Object.defineProperty(exports, "Invoices", { enumerable: true, get: function () { return Invoices_js_1.Invoices; } }); -var InvoiceItems_js_1 = require("./resources/InvoiceItems.js"); -Object.defineProperty(exports, "InvoiceItems", { enumerable: true, get: function () { return InvoiceItems_js_1.InvoiceItems; } }); -var Mandates_js_1 = require("./resources/Mandates.js"); -Object.defineProperty(exports, "Mandates", { enumerable: true, get: function () { return Mandates_js_1.Mandates; } }); -var PaymentIntents_js_1 = require("./resources/PaymentIntents.js"); -Object.defineProperty(exports, "PaymentIntents", { enumerable: true, get: function () { return PaymentIntents_js_1.PaymentIntents; } }); -var PaymentLinks_js_1 = require("./resources/PaymentLinks.js"); -Object.defineProperty(exports, "PaymentLinks", { enumerable: true, get: function () { return PaymentLinks_js_1.PaymentLinks; } }); -var PaymentMethods_js_1 = require("./resources/PaymentMethods.js"); -Object.defineProperty(exports, "PaymentMethods", { enumerable: true, get: function () { return PaymentMethods_js_1.PaymentMethods; } }); -var Payouts_js_1 = require("./resources/Payouts.js"); -Object.defineProperty(exports, "Payouts", { enumerable: true, get: function () { return Payouts_js_1.Payouts; } }); -var Plans_js_1 = require("./resources/Plans.js"); -Object.defineProperty(exports, "Plans", { enumerable: true, get: function () { return Plans_js_1.Plans; } }); -var Prices_js_1 = require("./resources/Prices.js"); -Object.defineProperty(exports, "Prices", { enumerable: true, get: function () { return Prices_js_1.Prices; } }); -var Products_js_1 = require("./resources/Products.js"); -Object.defineProperty(exports, "Products", { enumerable: true, get: function () { return Products_js_1.Products; } }); -var PromotionCodes_js_1 = require("./resources/PromotionCodes.js"); -Object.defineProperty(exports, "PromotionCodes", { enumerable: true, get: function () { return PromotionCodes_js_1.PromotionCodes; } }); -var Quotes_js_1 = require("./resources/Quotes.js"); -Object.defineProperty(exports, "Quotes", { enumerable: true, get: function () { return Quotes_js_1.Quotes; } }); -var Refunds_js_2 = require("./resources/Refunds.js"); -Object.defineProperty(exports, "Refunds", { enumerable: true, get: function () { return Refunds_js_2.Refunds; } }); -var Reviews_js_1 = require("./resources/Reviews.js"); -Object.defineProperty(exports, "Reviews", { enumerable: true, get: function () { return Reviews_js_1.Reviews; } }); -var SetupAttempts_js_1 = require("./resources/SetupAttempts.js"); -Object.defineProperty(exports, "SetupAttempts", { enumerable: true, get: function () { return SetupAttempts_js_1.SetupAttempts; } }); -var SetupIntents_js_1 = require("./resources/SetupIntents.js"); -Object.defineProperty(exports, "SetupIntents", { enumerable: true, get: function () { return SetupIntents_js_1.SetupIntents; } }); -var ShippingRates_js_1 = require("./resources/ShippingRates.js"); -Object.defineProperty(exports, "ShippingRates", { enumerable: true, get: function () { return ShippingRates_js_1.ShippingRates; } }); -var Sources_js_1 = require("./resources/Sources.js"); -Object.defineProperty(exports, "Sources", { enumerable: true, get: function () { return Sources_js_1.Sources; } }); -var Subscriptions_js_1 = require("./resources/Subscriptions.js"); -Object.defineProperty(exports, "Subscriptions", { enumerable: true, get: function () { return Subscriptions_js_1.Subscriptions; } }); -var SubscriptionItems_js_1 = require("./resources/SubscriptionItems.js"); -Object.defineProperty(exports, "SubscriptionItems", { enumerable: true, get: function () { return SubscriptionItems_js_1.SubscriptionItems; } }); -var SubscriptionSchedules_js_1 = require("./resources/SubscriptionSchedules.js"); -Object.defineProperty(exports, "SubscriptionSchedules", { enumerable: true, get: function () { return SubscriptionSchedules_js_1.SubscriptionSchedules; } }); -var TaxCodes_js_1 = require("./resources/TaxCodes.js"); -Object.defineProperty(exports, "TaxCodes", { enumerable: true, get: function () { return TaxCodes_js_1.TaxCodes; } }); -var TaxRates_js_1 = require("./resources/TaxRates.js"); -Object.defineProperty(exports, "TaxRates", { enumerable: true, get: function () { return TaxRates_js_1.TaxRates; } }); -var Tokens_js_1 = require("./resources/Tokens.js"); -Object.defineProperty(exports, "Tokens", { enumerable: true, get: function () { return Tokens_js_1.Tokens; } }); -var Topups_js_1 = require("./resources/Topups.js"); -Object.defineProperty(exports, "Topups", { enumerable: true, get: function () { return Topups_js_1.Topups; } }); -var Transfers_js_1 = require("./resources/Transfers.js"); -Object.defineProperty(exports, "Transfers", { enumerable: true, get: function () { return Transfers_js_1.Transfers; } }); -var WebhookEndpoints_js_1 = require("./resources/WebhookEndpoints.js"); -Object.defineProperty(exports, "WebhookEndpoints", { enumerable: true, get: function () { return WebhookEndpoints_js_1.WebhookEndpoints; } }); -exports.Apps = (0, ResourceNamespace_js_1.resourceNamespace)('apps', { Secrets: Secrets_js_1.Secrets }); -exports.BillingPortal = (0, ResourceNamespace_js_1.resourceNamespace)('billingPortal', { - Configurations: Configurations_js_1.Configurations, - Sessions: Sessions_js_1.Sessions, -}); -exports.Checkout = (0, ResourceNamespace_js_1.resourceNamespace)('checkout', { - Sessions: Sessions_js_2.Sessions, -}); -exports.FinancialConnections = (0, ResourceNamespace_js_1.resourceNamespace)('financialConnections', { - Accounts: Accounts_js_1.Accounts, - Sessions: Sessions_js_3.Sessions, -}); -exports.Identity = (0, ResourceNamespace_js_1.resourceNamespace)('identity', { - VerificationReports: VerificationReports_js_1.VerificationReports, - VerificationSessions: VerificationSessions_js_1.VerificationSessions, -}); -exports.Issuing = (0, ResourceNamespace_js_1.resourceNamespace)('issuing', { - Authorizations: Authorizations_js_1.Authorizations, - Cardholders: Cardholders_js_1.Cardholders, - Cards: Cards_js_2.Cards, - Disputes: Disputes_js_1.Disputes, - Transactions: Transactions_js_1.Transactions, -}); -exports.Radar = (0, ResourceNamespace_js_1.resourceNamespace)('radar', { - EarlyFraudWarnings: EarlyFraudWarnings_js_1.EarlyFraudWarnings, - ValueListItems: ValueListItems_js_1.ValueListItems, - ValueLists: ValueLists_js_1.ValueLists, -}); -exports.Reporting = (0, ResourceNamespace_js_1.resourceNamespace)('reporting', { - ReportRuns: ReportRuns_js_1.ReportRuns, - ReportTypes: ReportTypes_js_1.ReportTypes, -}); -exports.Sigma = (0, ResourceNamespace_js_1.resourceNamespace)('sigma', { - ScheduledQueryRuns: ScheduledQueryRuns_js_1.ScheduledQueryRuns, -}); -exports.Terminal = (0, ResourceNamespace_js_1.resourceNamespace)('terminal', { - Configurations: Configurations_js_2.Configurations, - ConnectionTokens: ConnectionTokens_js_1.ConnectionTokens, - Locations: Locations_js_1.Locations, - Readers: Readers_js_2.Readers, -}); -exports.TestHelpers = (0, ResourceNamespace_js_1.resourceNamespace)('testHelpers', { - Customers: Customers_js_1.Customers, - Refunds: Refunds_js_1.Refunds, - TestClocks: TestClocks_js_1.TestClocks, - Issuing: (0, ResourceNamespace_js_1.resourceNamespace)('issuing', { Cards: Cards_js_1.Cards }), - Terminal: (0, ResourceNamespace_js_1.resourceNamespace)('terminal', { - Readers: Readers_js_1.Readers, - }), - Treasury: (0, ResourceNamespace_js_1.resourceNamespace)('treasury', { - InboundTransfers: InboundTransfers_js_1.InboundTransfers, - OutboundPayments: OutboundPayments_js_1.OutboundPayments, - OutboundTransfers: OutboundTransfers_js_1.OutboundTransfers, - ReceivedCredits: ReceivedCredits_js_1.ReceivedCredits, - ReceivedDebits: ReceivedDebits_js_1.ReceivedDebits, - }), -}); -exports.Treasury = (0, ResourceNamespace_js_1.resourceNamespace)('treasury', { - CreditReversals: CreditReversals_js_1.CreditReversals, - DebitReversals: DebitReversals_js_1.DebitReversals, - FinancialAccounts: FinancialAccounts_js_1.FinancialAccounts, - InboundTransfers: InboundTransfers_js_2.InboundTransfers, - OutboundPayments: OutboundPayments_js_2.OutboundPayments, - OutboundTransfers: OutboundTransfers_js_2.OutboundTransfers, - ReceivedCredits: ReceivedCredits_js_2.ReceivedCredits, - ReceivedDebits: ReceivedDebits_js_2.ReceivedDebits, - TransactionEntries: TransactionEntries_js_1.TransactionEntries, - Transactions: Transactions_js_2.Transactions, -}); diff --git a/cjs/resources/AccountLinks.js b/cjs/resources/AccountLinks.js deleted file mode 100644 index 4511749717..0000000000 --- a/cjs/resources/AccountLinks.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.AccountLinks = void 0; -const StripeResource_js_1 = require("../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.AccountLinks = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/account_links', - }), -}); diff --git a/cjs/resources/Accounts.js b/cjs/resources/Accounts.js deleted file mode 100644 index c7c4ae4cfb..0000000000 --- a/cjs/resources/Accounts.js +++ /dev/null @@ -1,109 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Accounts = void 0; -const StripeResource_js_1 = require("../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -// Since path can either be `account` or `accounts`, support both through stripeMethod path; -exports.Accounts = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/accounts', - }), - retrieve(id, ...args) { - // No longer allow an api key to be passed as the first string to this function due to ambiguity between - // old account ids and api keys. To request the account for an api key, send null as the id - if (typeof id === 'string') { - return stripeMethod({ - method: 'GET', - fullPath: '/v1/accounts/{id}', - }).apply(this, [id, ...args]); - } - else { - if (id === null || id === undefined) { - // Remove id as stripeMethod would complain of unexpected argument - [].shift.apply([id, ...args]); - } - return stripeMethod({ - method: 'GET', - fullPath: '/v1/account', - }).apply(this, [id, ...args]); - } - }, - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/accounts/{account}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/accounts', - methodType: 'list', - }), - del: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/accounts/{account}', - }), - createExternalAccount: stripeMethod({ - method: 'POST', - fullPath: '/v1/accounts/{account}/external_accounts', - }), - createLoginLink: stripeMethod({ - method: 'POST', - fullPath: '/v1/accounts/{account}/login_links', - }), - createPerson: stripeMethod({ - method: 'POST', - fullPath: '/v1/accounts/{account}/persons', - }), - deleteExternalAccount: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/accounts/{account}/external_accounts/{id}', - }), - deletePerson: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/accounts/{account}/persons/{person}', - }), - listCapabilities: stripeMethod({ - method: 'GET', - fullPath: '/v1/accounts/{account}/capabilities', - methodType: 'list', - }), - listExternalAccounts: stripeMethod({ - method: 'GET', - fullPath: '/v1/accounts/{account}/external_accounts', - methodType: 'list', - }), - listPersons: stripeMethod({ - method: 'GET', - fullPath: '/v1/accounts/{account}/persons', - methodType: 'list', - }), - reject: stripeMethod({ - method: 'POST', - fullPath: '/v1/accounts/{account}/reject', - }), - retrieveCapability: stripeMethod({ - method: 'GET', - fullPath: '/v1/accounts/{account}/capabilities/{capability}', - }), - retrieveExternalAccount: stripeMethod({ - method: 'GET', - fullPath: '/v1/accounts/{account}/external_accounts/{id}', - }), - retrievePerson: stripeMethod({ - method: 'GET', - fullPath: '/v1/accounts/{account}/persons/{person}', - }), - updateCapability: stripeMethod({ - method: 'POST', - fullPath: '/v1/accounts/{account}/capabilities/{capability}', - }), - updateExternalAccount: stripeMethod({ - method: 'POST', - fullPath: '/v1/accounts/{account}/external_accounts/{id}', - }), - updatePerson: stripeMethod({ - method: 'POST', - fullPath: '/v1/accounts/{account}/persons/{person}', - }), -}); diff --git a/cjs/resources/ApplePayDomains.js b/cjs/resources/ApplePayDomains.js deleted file mode 100644 index 27697f771c..0000000000 --- a/cjs/resources/ApplePayDomains.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ApplePayDomains = void 0; -const StripeResource_js_1 = require("../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.ApplePayDomains = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/apple_pay/domains', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/apple_pay/domains/{domain}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/apple_pay/domains', - methodType: 'list', - }), - del: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/apple_pay/domains/{domain}', - }), -}); diff --git a/cjs/resources/ApplicationFees.js b/cjs/resources/ApplicationFees.js deleted file mode 100644 index c3d041f91b..0000000000 --- a/cjs/resources/ApplicationFees.js +++ /dev/null @@ -1,34 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ApplicationFees = void 0; -const StripeResource_js_1 = require("../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.ApplicationFees = StripeResource_js_1.StripeResource.extend({ - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/application_fees/{id}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/application_fees', - methodType: 'list', - }), - createRefund: stripeMethod({ - method: 'POST', - fullPath: '/v1/application_fees/{id}/refunds', - }), - listRefunds: stripeMethod({ - method: 'GET', - fullPath: '/v1/application_fees/{id}/refunds', - methodType: 'list', - }), - retrieveRefund: stripeMethod({ - method: 'GET', - fullPath: '/v1/application_fees/{fee}/refunds/{id}', - }), - updateRefund: stripeMethod({ - method: 'POST', - fullPath: '/v1/application_fees/{fee}/refunds/{id}', - }), -}); diff --git a/cjs/resources/Apps/Secrets.js b/cjs/resources/Apps/Secrets.js deleted file mode 100644 index 2df0243a77..0000000000 --- a/cjs/resources/Apps/Secrets.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Secrets = void 0; -const StripeResource_js_1 = require("../../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.Secrets = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/apps/secrets', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/apps/secrets', - methodType: 'list', - }), - deleteWhere: stripeMethod({ - method: 'POST', - fullPath: '/v1/apps/secrets/delete', - }), - find: stripeMethod({ - method: 'GET', - fullPath: '/v1/apps/secrets/find', - }), -}); diff --git a/cjs/resources/Balance.js b/cjs/resources/Balance.js deleted file mode 100644 index ce0157482c..0000000000 --- a/cjs/resources/Balance.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Balance = void 0; -const StripeResource_js_1 = require("../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.Balance = StripeResource_js_1.StripeResource.extend({ - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/balance', - }), -}); diff --git a/cjs/resources/BalanceTransactions.js b/cjs/resources/BalanceTransactions.js deleted file mode 100644 index 2eb5b67bdb..0000000000 --- a/cjs/resources/BalanceTransactions.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.BalanceTransactions = void 0; -const StripeResource_js_1 = require("../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.BalanceTransactions = StripeResource_js_1.StripeResource.extend({ - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/balance_transactions/{id}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/balance_transactions', - methodType: 'list', - }), -}); diff --git a/cjs/resources/BillingPortal/Configurations.js b/cjs/resources/BillingPortal/Configurations.js deleted file mode 100644 index bd365026c3..0000000000 --- a/cjs/resources/BillingPortal/Configurations.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Configurations = void 0; -const StripeResource_js_1 = require("../../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.Configurations = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/billing_portal/configurations', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/billing_portal/configurations/{configuration}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/billing_portal/configurations/{configuration}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/billing_portal/configurations', - methodType: 'list', - }), -}); diff --git a/cjs/resources/BillingPortal/Sessions.js b/cjs/resources/BillingPortal/Sessions.js deleted file mode 100644 index ed4c12f223..0000000000 --- a/cjs/resources/BillingPortal/Sessions.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Sessions = void 0; -const StripeResource_js_1 = require("../../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.Sessions = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/billing_portal/sessions', - }), -}); diff --git a/cjs/resources/Charges.js b/cjs/resources/Charges.js deleted file mode 100644 index 6ffff65148..0000000000 --- a/cjs/resources/Charges.js +++ /dev/null @@ -1,34 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Charges = void 0; -const StripeResource_js_1 = require("../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.Charges = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/charges', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/charges/{charge}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/charges/{charge}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/charges', - methodType: 'list', - }), - capture: stripeMethod({ - method: 'POST', - fullPath: '/v1/charges/{charge}/capture', - }), - search: stripeMethod({ - method: 'GET', - fullPath: '/v1/charges/search', - methodType: 'search', - }), -}); diff --git a/cjs/resources/Checkout/Sessions.js b/cjs/resources/Checkout/Sessions.js deleted file mode 100644 index a9b1035919..0000000000 --- a/cjs/resources/Checkout/Sessions.js +++ /dev/null @@ -1,30 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Sessions = void 0; -const StripeResource_js_1 = require("../../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.Sessions = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/checkout/sessions', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/checkout/sessions/{session}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/checkout/sessions', - methodType: 'list', - }), - expire: stripeMethod({ - method: 'POST', - fullPath: '/v1/checkout/sessions/{session}/expire', - }), - listLineItems: stripeMethod({ - method: 'GET', - fullPath: '/v1/checkout/sessions/{session}/line_items', - methodType: 'list', - }), -}); diff --git a/cjs/resources/CountrySpecs.js b/cjs/resources/CountrySpecs.js deleted file mode 100644 index e7890e10ca..0000000000 --- a/cjs/resources/CountrySpecs.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.CountrySpecs = void 0; -const StripeResource_js_1 = require("../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.CountrySpecs = StripeResource_js_1.StripeResource.extend({ - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/country_specs/{country}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/country_specs', - methodType: 'list', - }), -}); diff --git a/cjs/resources/Coupons.js b/cjs/resources/Coupons.js deleted file mode 100644 index cbb529556b..0000000000 --- a/cjs/resources/Coupons.js +++ /dev/null @@ -1,29 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Coupons = void 0; -const StripeResource_js_1 = require("../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.Coupons = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/coupons', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/coupons/{coupon}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/coupons/{coupon}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/coupons', - methodType: 'list', - }), - del: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/coupons/{coupon}', - }), -}); diff --git a/cjs/resources/CreditNotes.js b/cjs/resources/CreditNotes.js deleted file mode 100644 index c70a452b1b..0000000000 --- a/cjs/resources/CreditNotes.js +++ /dev/null @@ -1,43 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.CreditNotes = void 0; -const StripeResource_js_1 = require("../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.CreditNotes = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/credit_notes', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/credit_notes/{id}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/credit_notes/{id}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/credit_notes', - methodType: 'list', - }), - listLineItems: stripeMethod({ - method: 'GET', - fullPath: '/v1/credit_notes/{credit_note}/lines', - methodType: 'list', - }), - listPreviewLineItems: stripeMethod({ - method: 'GET', - fullPath: '/v1/credit_notes/preview/lines', - methodType: 'list', - }), - preview: stripeMethod({ - method: 'GET', - fullPath: '/v1/credit_notes/preview', - }), - voidCreditNote: stripeMethod({ - method: 'POST', - fullPath: '/v1/credit_notes/{id}/void', - }), -}); diff --git a/cjs/resources/Customers.js b/cjs/resources/Customers.js deleted file mode 100644 index ded714af97..0000000000 --- a/cjs/resources/Customers.js +++ /dev/null @@ -1,127 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Customers = void 0; -const StripeResource_js_1 = require("../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.Customers = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/customers', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/customers/{customer}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/customers/{customer}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/customers', - methodType: 'list', - }), - del: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/customers/{customer}', - }), - createFundingInstructions: stripeMethod({ - method: 'POST', - fullPath: '/v1/customers/{customer}/funding_instructions', - }), - createBalanceTransaction: stripeMethod({ - method: 'POST', - fullPath: '/v1/customers/{customer}/balance_transactions', - }), - createSource: stripeMethod({ - method: 'POST', - fullPath: '/v1/customers/{customer}/sources', - }), - createTaxId: stripeMethod({ - method: 'POST', - fullPath: '/v1/customers/{customer}/tax_ids', - }), - deleteDiscount: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/customers/{customer}/discount', - }), - deleteSource: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/customers/{customer}/sources/{id}', - }), - deleteTaxId: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/customers/{customer}/tax_ids/{id}', - }), - listPaymentMethods: stripeMethod({ - method: 'GET', - fullPath: '/v1/customers/{customer}/payment_methods', - methodType: 'list', - }), - listBalanceTransactions: stripeMethod({ - method: 'GET', - fullPath: '/v1/customers/{customer}/balance_transactions', - methodType: 'list', - }), - listCashBalanceTransactions: stripeMethod({ - method: 'GET', - fullPath: '/v1/customers/{customer}/cash_balance_transactions', - methodType: 'list', - }), - listSources: stripeMethod({ - method: 'GET', - fullPath: '/v1/customers/{customer}/sources', - methodType: 'list', - }), - listTaxIds: stripeMethod({ - method: 'GET', - fullPath: '/v1/customers/{customer}/tax_ids', - methodType: 'list', - }), - retrievePaymentMethod: stripeMethod({ - method: 'GET', - fullPath: '/v1/customers/{customer}/payment_methods/{payment_method}', - }), - retrieveBalanceTransaction: stripeMethod({ - method: 'GET', - fullPath: '/v1/customers/{customer}/balance_transactions/{transaction}', - }), - retrieveCashBalance: stripeMethod({ - method: 'GET', - fullPath: '/v1/customers/{customer}/cash_balance', - }), - retrieveCashBalanceTransaction: stripeMethod({ - method: 'GET', - fullPath: '/v1/customers/{customer}/cash_balance_transactions/{transaction}', - }), - retrieveSource: stripeMethod({ - method: 'GET', - fullPath: '/v1/customers/{customer}/sources/{id}', - }), - retrieveTaxId: stripeMethod({ - method: 'GET', - fullPath: '/v1/customers/{customer}/tax_ids/{id}', - }), - search: stripeMethod({ - method: 'GET', - fullPath: '/v1/customers/search', - methodType: 'search', - }), - updateBalanceTransaction: stripeMethod({ - method: 'POST', - fullPath: '/v1/customers/{customer}/balance_transactions/{transaction}', - }), - updateCashBalance: stripeMethod({ - method: 'POST', - fullPath: '/v1/customers/{customer}/cash_balance', - }), - updateSource: stripeMethod({ - method: 'POST', - fullPath: '/v1/customers/{customer}/sources/{id}', - }), - verifySource: stripeMethod({ - method: 'POST', - fullPath: '/v1/customers/{customer}/sources/{id}/verify', - }), -}); diff --git a/cjs/resources/Disputes.js b/cjs/resources/Disputes.js deleted file mode 100644 index 704741a071..0000000000 --- a/cjs/resources/Disputes.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Disputes = void 0; -const StripeResource_js_1 = require("../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.Disputes = StripeResource_js_1.StripeResource.extend({ - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/disputes/{dispute}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/disputes/{dispute}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/disputes', - methodType: 'list', - }), - close: stripeMethod({ - method: 'POST', - fullPath: '/v1/disputes/{dispute}/close', - }), -}); diff --git a/cjs/resources/EphemeralKeys.js b/cjs/resources/EphemeralKeys.js deleted file mode 100644 index d354bfc359..0000000000 --- a/cjs/resources/EphemeralKeys.js +++ /dev/null @@ -1,21 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.EphemeralKeys = void 0; -const StripeResource_js_1 = require("../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.EphemeralKeys = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/ephemeral_keys', - validator: (data, options) => { - if (!options.headers || !options.headers['Stripe-Version']) { - throw new Error('Passing apiVersion in a separate options hash is required to create an ephemeral key. See https://stripe.com/docs/api/versioning?lang=node'); - } - }, - }), - del: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/ephemeral_keys/{key}', - }), -}); diff --git a/cjs/resources/Events.js b/cjs/resources/Events.js deleted file mode 100644 index 2e73632bbe..0000000000 --- a/cjs/resources/Events.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Events = void 0; -const StripeResource_js_1 = require("../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.Events = StripeResource_js_1.StripeResource.extend({ - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/events/{id}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/events', - methodType: 'list', - }), -}); diff --git a/cjs/resources/ExchangeRates.js b/cjs/resources/ExchangeRates.js deleted file mode 100644 index 9d5a5227b9..0000000000 --- a/cjs/resources/ExchangeRates.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ExchangeRates = void 0; -const StripeResource_js_1 = require("../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.ExchangeRates = StripeResource_js_1.StripeResource.extend({ - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/exchange_rates/{rate_id}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/exchange_rates', - methodType: 'list', - }), -}); diff --git a/cjs/resources/FileLinks.js b/cjs/resources/FileLinks.js deleted file mode 100644 index 5d6e06eb11..0000000000 --- a/cjs/resources/FileLinks.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FileLinks = void 0; -const StripeResource_js_1 = require("../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.FileLinks = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/file_links', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/file_links/{link}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/file_links/{link}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/file_links', - methodType: 'list', - }), -}); diff --git a/cjs/resources/Files.js b/cjs/resources/Files.js deleted file mode 100644 index 0091194b31..0000000000 --- a/cjs/resources/Files.js +++ /dev/null @@ -1,27 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Files = void 0; -const multipart_js_1 = require("../multipart.js"); -const StripeResource_js_1 = require("../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.Files = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/files', - headers: { - 'Content-Type': 'multipart/form-data', - }, - host: 'files.stripe.com', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/files/{file}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/files', - methodType: 'list', - }), - requestDataProcessor: multipart_js_1.multipartRequestDataProcessor, -}); diff --git a/cjs/resources/FinancialConnections/Accounts.js b/cjs/resources/FinancialConnections/Accounts.js deleted file mode 100644 index 9aa9046c91..0000000000 --- a/cjs/resources/FinancialConnections/Accounts.js +++ /dev/null @@ -1,30 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Accounts = void 0; -const StripeResource_js_1 = require("../../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.Accounts = StripeResource_js_1.StripeResource.extend({ - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/financial_connections/accounts/{account}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/financial_connections/accounts', - methodType: 'list', - }), - disconnect: stripeMethod({ - method: 'POST', - fullPath: '/v1/financial_connections/accounts/{account}/disconnect', - }), - listOwners: stripeMethod({ - method: 'GET', - fullPath: '/v1/financial_connections/accounts/{account}/owners', - methodType: 'list', - }), - refresh: stripeMethod({ - method: 'POST', - fullPath: '/v1/financial_connections/accounts/{account}/refresh', - }), -}); diff --git a/cjs/resources/FinancialConnections/Sessions.js b/cjs/resources/FinancialConnections/Sessions.js deleted file mode 100644 index 1297b66104..0000000000 --- a/cjs/resources/FinancialConnections/Sessions.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Sessions = void 0; -const StripeResource_js_1 = require("../../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.Sessions = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/financial_connections/sessions', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/financial_connections/sessions/{session}', - }), -}); diff --git a/cjs/resources/Identity/VerificationReports.js b/cjs/resources/Identity/VerificationReports.js deleted file mode 100644 index fe160c194a..0000000000 --- a/cjs/resources/Identity/VerificationReports.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.VerificationReports = void 0; -const StripeResource_js_1 = require("../../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.VerificationReports = StripeResource_js_1.StripeResource.extend({ - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/identity/verification_reports/{report}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/identity/verification_reports', - methodType: 'list', - }), -}); diff --git a/cjs/resources/Identity/VerificationSessions.js b/cjs/resources/Identity/VerificationSessions.js deleted file mode 100644 index b9d9e3d897..0000000000 --- a/cjs/resources/Identity/VerificationSessions.js +++ /dev/null @@ -1,33 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.VerificationSessions = void 0; -const StripeResource_js_1 = require("../../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.VerificationSessions = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/identity/verification_sessions', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/identity/verification_sessions/{session}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/identity/verification_sessions/{session}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/identity/verification_sessions', - methodType: 'list', - }), - cancel: stripeMethod({ - method: 'POST', - fullPath: '/v1/identity/verification_sessions/{session}/cancel', - }), - redact: stripeMethod({ - method: 'POST', - fullPath: '/v1/identity/verification_sessions/{session}/redact', - }), -}); diff --git a/cjs/resources/InvoiceItems.js b/cjs/resources/InvoiceItems.js deleted file mode 100644 index 904d99cf1b..0000000000 --- a/cjs/resources/InvoiceItems.js +++ /dev/null @@ -1,29 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.InvoiceItems = void 0; -const StripeResource_js_1 = require("../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.InvoiceItems = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/invoiceitems', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/invoiceitems/{invoiceitem}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/invoiceitems/{invoiceitem}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/invoiceitems', - methodType: 'list', - }), - del: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/invoiceitems/{invoiceitem}', - }), -}); diff --git a/cjs/resources/Invoices.js b/cjs/resources/Invoices.js deleted file mode 100644 index 064eb0a85c..0000000000 --- a/cjs/resources/Invoices.js +++ /dev/null @@ -1,68 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Invoices = void 0; -const StripeResource_js_1 = require("../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.Invoices = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/invoices', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/invoices/{invoice}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/invoices/{invoice}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/invoices', - methodType: 'list', - }), - del: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/invoices/{invoice}', - }), - finalizeInvoice: stripeMethod({ - method: 'POST', - fullPath: '/v1/invoices/{invoice}/finalize', - }), - listLineItems: stripeMethod({ - method: 'GET', - fullPath: '/v1/invoices/{invoice}/lines', - methodType: 'list', - }), - listUpcomingLines: stripeMethod({ - method: 'GET', - fullPath: '/v1/invoices/upcoming/lines', - methodType: 'list', - }), - markUncollectible: stripeMethod({ - method: 'POST', - fullPath: '/v1/invoices/{invoice}/mark_uncollectible', - }), - pay: stripeMethod({ - method: 'POST', - fullPath: '/v1/invoices/{invoice}/pay', - }), - retrieveUpcoming: stripeMethod({ - method: 'GET', - fullPath: '/v1/invoices/upcoming', - }), - search: stripeMethod({ - method: 'GET', - fullPath: '/v1/invoices/search', - methodType: 'search', - }), - sendInvoice: stripeMethod({ - method: 'POST', - fullPath: '/v1/invoices/{invoice}/send', - }), - voidInvoice: stripeMethod({ - method: 'POST', - fullPath: '/v1/invoices/{invoice}/void', - }), -}); diff --git a/cjs/resources/Issuing/Authorizations.js b/cjs/resources/Issuing/Authorizations.js deleted file mode 100644 index 12b4286adf..0000000000 --- a/cjs/resources/Issuing/Authorizations.js +++ /dev/null @@ -1,29 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Authorizations = void 0; -const StripeResource_js_1 = require("../../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.Authorizations = StripeResource_js_1.StripeResource.extend({ - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/issuing/authorizations/{authorization}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/issuing/authorizations/{authorization}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/issuing/authorizations', - methodType: 'list', - }), - approve: stripeMethod({ - method: 'POST', - fullPath: '/v1/issuing/authorizations/{authorization}/approve', - }), - decline: stripeMethod({ - method: 'POST', - fullPath: '/v1/issuing/authorizations/{authorization}/decline', - }), -}); diff --git a/cjs/resources/Issuing/Cardholders.js b/cjs/resources/Issuing/Cardholders.js deleted file mode 100644 index 8cc560ae49..0000000000 --- a/cjs/resources/Issuing/Cardholders.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Cardholders = void 0; -const StripeResource_js_1 = require("../../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.Cardholders = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/issuing/cardholders', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/issuing/cardholders/{cardholder}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/issuing/cardholders/{cardholder}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/issuing/cardholders', - methodType: 'list', - }), -}); diff --git a/cjs/resources/Issuing/Cards.js b/cjs/resources/Issuing/Cards.js deleted file mode 100644 index ba7d15422c..0000000000 --- a/cjs/resources/Issuing/Cards.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Cards = void 0; -const StripeResource_js_1 = require("../../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.Cards = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/issuing/cards', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/issuing/cards/{card}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/issuing/cards/{card}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/issuing/cards', - methodType: 'list', - }), -}); diff --git a/cjs/resources/Issuing/Disputes.js b/cjs/resources/Issuing/Disputes.js deleted file mode 100644 index 364bc87623..0000000000 --- a/cjs/resources/Issuing/Disputes.js +++ /dev/null @@ -1,29 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Disputes = void 0; -const StripeResource_js_1 = require("../../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.Disputes = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/issuing/disputes', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/issuing/disputes/{dispute}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/issuing/disputes/{dispute}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/issuing/disputes', - methodType: 'list', - }), - submit: stripeMethod({ - method: 'POST', - fullPath: '/v1/issuing/disputes/{dispute}/submit', - }), -}); diff --git a/cjs/resources/Issuing/Transactions.js b/cjs/resources/Issuing/Transactions.js deleted file mode 100644 index abc1fb9225..0000000000 --- a/cjs/resources/Issuing/Transactions.js +++ /dev/null @@ -1,21 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Transactions = void 0; -const StripeResource_js_1 = require("../../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.Transactions = StripeResource_js_1.StripeResource.extend({ - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/issuing/transactions/{transaction}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/issuing/transactions/{transaction}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/issuing/transactions', - methodType: 'list', - }), -}); diff --git a/cjs/resources/Mandates.js b/cjs/resources/Mandates.js deleted file mode 100644 index 46d3c1a0d6..0000000000 --- a/cjs/resources/Mandates.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Mandates = void 0; -const StripeResource_js_1 = require("../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.Mandates = StripeResource_js_1.StripeResource.extend({ - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/mandates/{mandate}', - }), -}); diff --git a/cjs/resources/OAuth.js b/cjs/resources/OAuth.js deleted file mode 100644 index 6860182521..0000000000 --- a/cjs/resources/OAuth.js +++ /dev/null @@ -1,44 +0,0 @@ -'use strict'; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.OAuth = void 0; -const StripeResource_js_1 = require("../StripeResource.js"); -const utils_js_1 = require("../utils.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -const oAuthHost = 'connect.stripe.com'; -exports.OAuth = StripeResource_js_1.StripeResource.extend({ - basePath: '/', - authorizeUrl(params, options) { - params = params || {}; - options = options || {}; - let path = 'oauth/authorize'; - // For Express accounts, the path changes - if (options.express) { - path = `express/${path}`; - } - if (!params.response_type) { - params.response_type = 'code'; - } - if (!params.client_id) { - params.client_id = this._stripe.getClientId(); - } - if (!params.scope) { - params.scope = 'read_write'; - } - return `https://${oAuthHost}/${path}?${(0, utils_js_1.stringifyRequestData)(params)}`; - }, - token: stripeMethod({ - method: 'POST', - path: 'oauth/token', - host: oAuthHost, - }), - deauthorize(spec, ...args) { - if (!spec.client_id) { - spec.client_id = this._stripe.getClientId(); - } - return stripeMethod({ - method: 'POST', - path: 'oauth/deauthorize', - host: oAuthHost, - }).apply(this, [spec, ...args]); - }, -}); diff --git a/cjs/resources/PaymentIntents.js b/cjs/resources/PaymentIntents.js deleted file mode 100644 index e5d0c9a286..0000000000 --- a/cjs/resources/PaymentIntents.js +++ /dev/null @@ -1,54 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.PaymentIntents = void 0; -const StripeResource_js_1 = require("../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.PaymentIntents = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/payment_intents', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/payment_intents/{intent}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/payment_intents/{intent}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/payment_intents', - methodType: 'list', - }), - applyCustomerBalance: stripeMethod({ - method: 'POST', - fullPath: '/v1/payment_intents/{intent}/apply_customer_balance', - }), - cancel: stripeMethod({ - method: 'POST', - fullPath: '/v1/payment_intents/{intent}/cancel', - }), - capture: stripeMethod({ - method: 'POST', - fullPath: '/v1/payment_intents/{intent}/capture', - }), - confirm: stripeMethod({ - method: 'POST', - fullPath: '/v1/payment_intents/{intent}/confirm', - }), - incrementAuthorization: stripeMethod({ - method: 'POST', - fullPath: '/v1/payment_intents/{intent}/increment_authorization', - }), - search: stripeMethod({ - method: 'GET', - fullPath: '/v1/payment_intents/search', - methodType: 'search', - }), - verifyMicrodeposits: stripeMethod({ - method: 'POST', - fullPath: '/v1/payment_intents/{intent}/verify_microdeposits', - }), -}); diff --git a/cjs/resources/PaymentLinks.js b/cjs/resources/PaymentLinks.js deleted file mode 100644 index 679d1507b7..0000000000 --- a/cjs/resources/PaymentLinks.js +++ /dev/null @@ -1,30 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.PaymentLinks = void 0; -const StripeResource_js_1 = require("../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.PaymentLinks = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/payment_links', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/payment_links/{payment_link}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/payment_links/{payment_link}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/payment_links', - methodType: 'list', - }), - listLineItems: stripeMethod({ - method: 'GET', - fullPath: '/v1/payment_links/{payment_link}/line_items', - methodType: 'list', - }), -}); diff --git a/cjs/resources/PaymentMethods.js b/cjs/resources/PaymentMethods.js deleted file mode 100644 index b350f87404..0000000000 --- a/cjs/resources/PaymentMethods.js +++ /dev/null @@ -1,33 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.PaymentMethods = void 0; -const StripeResource_js_1 = require("../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.PaymentMethods = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/payment_methods', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/payment_methods/{payment_method}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/payment_methods/{payment_method}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/payment_methods', - methodType: 'list', - }), - attach: stripeMethod({ - method: 'POST', - fullPath: '/v1/payment_methods/{payment_method}/attach', - }), - detach: stripeMethod({ - method: 'POST', - fullPath: '/v1/payment_methods/{payment_method}/detach', - }), -}); diff --git a/cjs/resources/Payouts.js b/cjs/resources/Payouts.js deleted file mode 100644 index 963f9dfd0f..0000000000 --- a/cjs/resources/Payouts.js +++ /dev/null @@ -1,33 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Payouts = void 0; -const StripeResource_js_1 = require("../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.Payouts = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/payouts', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/payouts/{payout}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/payouts/{payout}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/payouts', - methodType: 'list', - }), - cancel: stripeMethod({ - method: 'POST', - fullPath: '/v1/payouts/{payout}/cancel', - }), - reverse: stripeMethod({ - method: 'POST', - fullPath: '/v1/payouts/{payout}/reverse', - }), -}); diff --git a/cjs/resources/Plans.js b/cjs/resources/Plans.js deleted file mode 100644 index 2f6240473b..0000000000 --- a/cjs/resources/Plans.js +++ /dev/null @@ -1,29 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Plans = void 0; -const StripeResource_js_1 = require("../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.Plans = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/plans', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/plans/{plan}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/plans/{plan}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/plans', - methodType: 'list', - }), - del: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/plans/{plan}', - }), -}); diff --git a/cjs/resources/Prices.js b/cjs/resources/Prices.js deleted file mode 100644 index 0c550cd2bb..0000000000 --- a/cjs/resources/Prices.js +++ /dev/null @@ -1,30 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Prices = void 0; -const StripeResource_js_1 = require("../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.Prices = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/prices', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/prices/{price}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/prices/{price}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/prices', - methodType: 'list', - }), - search: stripeMethod({ - method: 'GET', - fullPath: '/v1/prices/search', - methodType: 'search', - }), -}); diff --git a/cjs/resources/Products.js b/cjs/resources/Products.js deleted file mode 100644 index c781f5eae6..0000000000 --- a/cjs/resources/Products.js +++ /dev/null @@ -1,34 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Products = void 0; -const StripeResource_js_1 = require("../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.Products = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/products', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/products/{id}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/products/{id}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/products', - methodType: 'list', - }), - del: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/products/{id}', - }), - search: stripeMethod({ - method: 'GET', - fullPath: '/v1/products/search', - methodType: 'search', - }), -}); diff --git a/cjs/resources/PromotionCodes.js b/cjs/resources/PromotionCodes.js deleted file mode 100644 index 24ead81dea..0000000000 --- a/cjs/resources/PromotionCodes.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.PromotionCodes = void 0; -const StripeResource_js_1 = require("../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.PromotionCodes = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/promotion_codes', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/promotion_codes/{promotion_code}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/promotion_codes/{promotion_code}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/promotion_codes', - methodType: 'list', - }), -}); diff --git a/cjs/resources/Quotes.js b/cjs/resources/Quotes.js deleted file mode 100644 index e2456d3019..0000000000 --- a/cjs/resources/Quotes.js +++ /dev/null @@ -1,53 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Quotes = void 0; -const StripeResource_js_1 = require("../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.Quotes = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/quotes', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/quotes/{quote}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/quotes/{quote}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/quotes', - methodType: 'list', - }), - accept: stripeMethod({ - method: 'POST', - fullPath: '/v1/quotes/{quote}/accept', - }), - cancel: stripeMethod({ - method: 'POST', - fullPath: '/v1/quotes/{quote}/cancel', - }), - finalizeQuote: stripeMethod({ - method: 'POST', - fullPath: '/v1/quotes/{quote}/finalize', - }), - listComputedUpfrontLineItems: stripeMethod({ - method: 'GET', - fullPath: '/v1/quotes/{quote}/computed_upfront_line_items', - methodType: 'list', - }), - listLineItems: stripeMethod({ - method: 'GET', - fullPath: '/v1/quotes/{quote}/line_items', - methodType: 'list', - }), - pdf: stripeMethod({ - host: 'files.stripe.com', - method: 'GET', - fullPath: '/v1/quotes/{quote}/pdf', - streaming: true, - }), -}); diff --git a/cjs/resources/Radar/EarlyFraudWarnings.js b/cjs/resources/Radar/EarlyFraudWarnings.js deleted file mode 100644 index e1941ef9f8..0000000000 --- a/cjs/resources/Radar/EarlyFraudWarnings.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.EarlyFraudWarnings = void 0; -const StripeResource_js_1 = require("../../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.EarlyFraudWarnings = StripeResource_js_1.StripeResource.extend({ - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/radar/early_fraud_warnings/{early_fraud_warning}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/radar/early_fraud_warnings', - methodType: 'list', - }), -}); diff --git a/cjs/resources/Radar/ValueListItems.js b/cjs/resources/Radar/ValueListItems.js deleted file mode 100644 index 174a2820d4..0000000000 --- a/cjs/resources/Radar/ValueListItems.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ValueListItems = void 0; -const StripeResource_js_1 = require("../../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.ValueListItems = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/radar/value_list_items', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/radar/value_list_items/{item}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/radar/value_list_items', - methodType: 'list', - }), - del: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/radar/value_list_items/{item}', - }), -}); diff --git a/cjs/resources/Radar/ValueLists.js b/cjs/resources/Radar/ValueLists.js deleted file mode 100644 index 908be6753a..0000000000 --- a/cjs/resources/Radar/ValueLists.js +++ /dev/null @@ -1,29 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ValueLists = void 0; -const StripeResource_js_1 = require("../../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.ValueLists = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/radar/value_lists', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/radar/value_lists/{value_list}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/radar/value_lists/{value_list}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/radar/value_lists', - methodType: 'list', - }), - del: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/radar/value_lists/{value_list}', - }), -}); diff --git a/cjs/resources/Refunds.js b/cjs/resources/Refunds.js deleted file mode 100644 index 83359c12e9..0000000000 --- a/cjs/resources/Refunds.js +++ /dev/null @@ -1,29 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Refunds = void 0; -const StripeResource_js_1 = require("../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.Refunds = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/refunds', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/refunds/{refund}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/refunds/{refund}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/refunds', - methodType: 'list', - }), - cancel: stripeMethod({ - method: 'POST', - fullPath: '/v1/refunds/{refund}/cancel', - }), -}); diff --git a/cjs/resources/Reporting/ReportRuns.js b/cjs/resources/Reporting/ReportRuns.js deleted file mode 100644 index b4d06c7dfc..0000000000 --- a/cjs/resources/Reporting/ReportRuns.js +++ /dev/null @@ -1,21 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ReportRuns = void 0; -const StripeResource_js_1 = require("../../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.ReportRuns = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/reporting/report_runs', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/reporting/report_runs/{report_run}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/reporting/report_runs', - methodType: 'list', - }), -}); diff --git a/cjs/resources/Reporting/ReportTypes.js b/cjs/resources/Reporting/ReportTypes.js deleted file mode 100644 index c21366b69c..0000000000 --- a/cjs/resources/Reporting/ReportTypes.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ReportTypes = void 0; -const StripeResource_js_1 = require("../../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.ReportTypes = StripeResource_js_1.StripeResource.extend({ - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/reporting/report_types/{report_type}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/reporting/report_types', - methodType: 'list', - }), -}); diff --git a/cjs/resources/Reviews.js b/cjs/resources/Reviews.js deleted file mode 100644 index 954b74d4db..0000000000 --- a/cjs/resources/Reviews.js +++ /dev/null @@ -1,21 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Reviews = void 0; -const StripeResource_js_1 = require("../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.Reviews = StripeResource_js_1.StripeResource.extend({ - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/reviews/{review}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/reviews', - methodType: 'list', - }), - approve: stripeMethod({ - method: 'POST', - fullPath: '/v1/reviews/{review}/approve', - }), -}); diff --git a/cjs/resources/SetupAttempts.js b/cjs/resources/SetupAttempts.js deleted file mode 100644 index 864dad719b..0000000000 --- a/cjs/resources/SetupAttempts.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.SetupAttempts = void 0; -const StripeResource_js_1 = require("../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.SetupAttempts = StripeResource_js_1.StripeResource.extend({ - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/setup_attempts', - methodType: 'list', - }), -}); diff --git a/cjs/resources/SetupIntents.js b/cjs/resources/SetupIntents.js deleted file mode 100644 index d3bdcc2df6..0000000000 --- a/cjs/resources/SetupIntents.js +++ /dev/null @@ -1,37 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.SetupIntents = void 0; -const StripeResource_js_1 = require("../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.SetupIntents = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/setup_intents', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/setup_intents/{intent}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/setup_intents/{intent}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/setup_intents', - methodType: 'list', - }), - cancel: stripeMethod({ - method: 'POST', - fullPath: '/v1/setup_intents/{intent}/cancel', - }), - confirm: stripeMethod({ - method: 'POST', - fullPath: '/v1/setup_intents/{intent}/confirm', - }), - verifyMicrodeposits: stripeMethod({ - method: 'POST', - fullPath: '/v1/setup_intents/{intent}/verify_microdeposits', - }), -}); diff --git a/cjs/resources/ShippingRates.js b/cjs/resources/ShippingRates.js deleted file mode 100644 index fe778b6dae..0000000000 --- a/cjs/resources/ShippingRates.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ShippingRates = void 0; -const StripeResource_js_1 = require("../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.ShippingRates = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/shipping_rates', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/shipping_rates/{shipping_rate_token}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/shipping_rates/{shipping_rate_token}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/shipping_rates', - methodType: 'list', - }), -}); diff --git a/cjs/resources/Sigma/ScheduledQueryRuns.js b/cjs/resources/Sigma/ScheduledQueryRuns.js deleted file mode 100644 index d76a598b9c..0000000000 --- a/cjs/resources/Sigma/ScheduledQueryRuns.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ScheduledQueryRuns = void 0; -const StripeResource_js_1 = require("../../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.ScheduledQueryRuns = StripeResource_js_1.StripeResource.extend({ - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/sigma/scheduled_query_runs/{scheduled_query_run}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/sigma/scheduled_query_runs', - methodType: 'list', - }), -}); diff --git a/cjs/resources/Sources.js b/cjs/resources/Sources.js deleted file mode 100644 index 467e1ea079..0000000000 --- a/cjs/resources/Sources.js +++ /dev/null @@ -1,29 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Sources = void 0; -const StripeResource_js_1 = require("../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.Sources = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/sources', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/sources/{source}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/sources/{source}', - }), - listSourceTransactions: stripeMethod({ - method: 'GET', - fullPath: '/v1/sources/{source}/source_transactions', - methodType: 'list', - }), - verify: stripeMethod({ - method: 'POST', - fullPath: '/v1/sources/{source}/verify', - }), -}); diff --git a/cjs/resources/SubscriptionItems.js b/cjs/resources/SubscriptionItems.js deleted file mode 100644 index b662c80ea7..0000000000 --- a/cjs/resources/SubscriptionItems.js +++ /dev/null @@ -1,38 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.SubscriptionItems = void 0; -const StripeResource_js_1 = require("../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.SubscriptionItems = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/subscription_items', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/subscription_items/{item}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/subscription_items/{item}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/subscription_items', - methodType: 'list', - }), - del: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/subscription_items/{item}', - }), - createUsageRecord: stripeMethod({ - method: 'POST', - fullPath: '/v1/subscription_items/{subscription_item}/usage_records', - }), - listUsageRecordSummaries: stripeMethod({ - method: 'GET', - fullPath: '/v1/subscription_items/{subscription_item}/usage_record_summaries', - methodType: 'list', - }), -}); diff --git a/cjs/resources/SubscriptionSchedules.js b/cjs/resources/SubscriptionSchedules.js deleted file mode 100644 index 3924896634..0000000000 --- a/cjs/resources/SubscriptionSchedules.js +++ /dev/null @@ -1,33 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.SubscriptionSchedules = void 0; -const StripeResource_js_1 = require("../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.SubscriptionSchedules = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/subscription_schedules', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/subscription_schedules/{schedule}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/subscription_schedules/{schedule}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/subscription_schedules', - methodType: 'list', - }), - cancel: stripeMethod({ - method: 'POST', - fullPath: '/v1/subscription_schedules/{schedule}/cancel', - }), - release: stripeMethod({ - method: 'POST', - fullPath: '/v1/subscription_schedules/{schedule}/release', - }), -}); diff --git a/cjs/resources/Subscriptions.js b/cjs/resources/Subscriptions.js deleted file mode 100644 index 12b0dba8f5..0000000000 --- a/cjs/resources/Subscriptions.js +++ /dev/null @@ -1,46 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Subscriptions = void 0; -const StripeResource_js_1 = require("../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.Subscriptions = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/subscriptions', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/subscriptions/{subscription_exposed_id}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/subscriptions/{subscription_exposed_id}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/subscriptions', - methodType: 'list', - }), - cancel: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/subscriptions/{subscription_exposed_id}', - }), - del: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/subscriptions/{subscription_exposed_id}', - }), - deleteDiscount: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/subscriptions/{subscription_exposed_id}/discount', - }), - resume: stripeMethod({ - method: 'POST', - fullPath: '/v1/subscriptions/{subscription}/resume', - }), - search: stripeMethod({ - method: 'GET', - fullPath: '/v1/subscriptions/search', - methodType: 'search', - }), -}); diff --git a/cjs/resources/TaxCodes.js b/cjs/resources/TaxCodes.js deleted file mode 100644 index 15ba1e4753..0000000000 --- a/cjs/resources/TaxCodes.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.TaxCodes = void 0; -const StripeResource_js_1 = require("../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.TaxCodes = StripeResource_js_1.StripeResource.extend({ - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/tax_codes/{id}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/tax_codes', - methodType: 'list', - }), -}); diff --git a/cjs/resources/TaxRates.js b/cjs/resources/TaxRates.js deleted file mode 100644 index f308344c6f..0000000000 --- a/cjs/resources/TaxRates.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.TaxRates = void 0; -const StripeResource_js_1 = require("../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.TaxRates = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/tax_rates', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/tax_rates/{tax_rate}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/tax_rates/{tax_rate}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/tax_rates', - methodType: 'list', - }), -}); diff --git a/cjs/resources/Terminal/Configurations.js b/cjs/resources/Terminal/Configurations.js deleted file mode 100644 index 6a0203d1e9..0000000000 --- a/cjs/resources/Terminal/Configurations.js +++ /dev/null @@ -1,29 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Configurations = void 0; -const StripeResource_js_1 = require("../../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.Configurations = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/terminal/configurations', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/terminal/configurations/{configuration}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/terminal/configurations/{configuration}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/terminal/configurations', - methodType: 'list', - }), - del: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/terminal/configurations/{configuration}', - }), -}); diff --git a/cjs/resources/Terminal/ConnectionTokens.js b/cjs/resources/Terminal/ConnectionTokens.js deleted file mode 100644 index 65681ed3b8..0000000000 --- a/cjs/resources/Terminal/ConnectionTokens.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ConnectionTokens = void 0; -const StripeResource_js_1 = require("../../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.ConnectionTokens = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/terminal/connection_tokens', - }), -}); diff --git a/cjs/resources/Terminal/Locations.js b/cjs/resources/Terminal/Locations.js deleted file mode 100644 index b614ff163d..0000000000 --- a/cjs/resources/Terminal/Locations.js +++ /dev/null @@ -1,29 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Locations = void 0; -const StripeResource_js_1 = require("../../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.Locations = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/terminal/locations', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/terminal/locations/{location}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/terminal/locations/{location}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/terminal/locations', - methodType: 'list', - }), - del: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/terminal/locations/{location}', - }), -}); diff --git a/cjs/resources/Terminal/Readers.js b/cjs/resources/Terminal/Readers.js deleted file mode 100644 index d6ecd399be..0000000000 --- a/cjs/resources/Terminal/Readers.js +++ /dev/null @@ -1,49 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Readers = void 0; -const StripeResource_js_1 = require("../../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.Readers = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/terminal/readers', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/terminal/readers/{reader}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/terminal/readers/{reader}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/terminal/readers', - methodType: 'list', - }), - del: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/terminal/readers/{reader}', - }), - cancelAction: stripeMethod({ - method: 'POST', - fullPath: '/v1/terminal/readers/{reader}/cancel_action', - }), - processPaymentIntent: stripeMethod({ - method: 'POST', - fullPath: '/v1/terminal/readers/{reader}/process_payment_intent', - }), - processSetupIntent: stripeMethod({ - method: 'POST', - fullPath: '/v1/terminal/readers/{reader}/process_setup_intent', - }), - refundPayment: stripeMethod({ - method: 'POST', - fullPath: '/v1/terminal/readers/{reader}/refund_payment', - }), - setReaderDisplay: stripeMethod({ - method: 'POST', - fullPath: '/v1/terminal/readers/{reader}/set_reader_display', - }), -}); diff --git a/cjs/resources/TestHelpers/Customers.js b/cjs/resources/TestHelpers/Customers.js deleted file mode 100644 index e5d547a918..0000000000 --- a/cjs/resources/TestHelpers/Customers.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Customers = void 0; -const StripeResource_js_1 = require("../../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.Customers = StripeResource_js_1.StripeResource.extend({ - fundCashBalance: stripeMethod({ - method: 'POST', - fullPath: '/v1/test_helpers/customers/{customer}/fund_cash_balance', - }), -}); diff --git a/cjs/resources/TestHelpers/Issuing/Cards.js b/cjs/resources/TestHelpers/Issuing/Cards.js deleted file mode 100644 index 293760cb1a..0000000000 --- a/cjs/resources/TestHelpers/Issuing/Cards.js +++ /dev/null @@ -1,24 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Cards = void 0; -const StripeResource_js_1 = require("../../../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.Cards = StripeResource_js_1.StripeResource.extend({ - deliverCard: stripeMethod({ - method: 'POST', - fullPath: '/v1/test_helpers/issuing/cards/{card}/shipping/deliver', - }), - failCard: stripeMethod({ - method: 'POST', - fullPath: '/v1/test_helpers/issuing/cards/{card}/shipping/fail', - }), - returnCard: stripeMethod({ - method: 'POST', - fullPath: '/v1/test_helpers/issuing/cards/{card}/shipping/return', - }), - shipCard: stripeMethod({ - method: 'POST', - fullPath: '/v1/test_helpers/issuing/cards/{card}/shipping/ship', - }), -}); diff --git a/cjs/resources/TestHelpers/Refunds.js b/cjs/resources/TestHelpers/Refunds.js deleted file mode 100644 index 8c302151b7..0000000000 --- a/cjs/resources/TestHelpers/Refunds.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Refunds = void 0; -const StripeResource_js_1 = require("../../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.Refunds = StripeResource_js_1.StripeResource.extend({ - expire: stripeMethod({ - method: 'POST', - fullPath: '/v1/test_helpers/refunds/{refund}/expire', - }), -}); diff --git a/cjs/resources/TestHelpers/Terminal/Readers.js b/cjs/resources/TestHelpers/Terminal/Readers.js deleted file mode 100644 index 3ac97456dc..0000000000 --- a/cjs/resources/TestHelpers/Terminal/Readers.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Readers = void 0; -const StripeResource_js_1 = require("../../../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.Readers = StripeResource_js_1.StripeResource.extend({ - presentPaymentMethod: stripeMethod({ - method: 'POST', - fullPath: '/v1/test_helpers/terminal/readers/{reader}/present_payment_method', - }), -}); diff --git a/cjs/resources/TestHelpers/TestClocks.js b/cjs/resources/TestHelpers/TestClocks.js deleted file mode 100644 index 013aab1144..0000000000 --- a/cjs/resources/TestHelpers/TestClocks.js +++ /dev/null @@ -1,29 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.TestClocks = void 0; -const StripeResource_js_1 = require("../../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.TestClocks = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/test_helpers/test_clocks', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/test_helpers/test_clocks/{test_clock}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/test_helpers/test_clocks', - methodType: 'list', - }), - del: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/test_helpers/test_clocks/{test_clock}', - }), - advance: stripeMethod({ - method: 'POST', - fullPath: '/v1/test_helpers/test_clocks/{test_clock}/advance', - }), -}); diff --git a/cjs/resources/TestHelpers/Treasury/InboundTransfers.js b/cjs/resources/TestHelpers/Treasury/InboundTransfers.js deleted file mode 100644 index ed2bb8b4fb..0000000000 --- a/cjs/resources/TestHelpers/Treasury/InboundTransfers.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.InboundTransfers = void 0; -const StripeResource_js_1 = require("../../../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.InboundTransfers = StripeResource_js_1.StripeResource.extend({ - fail: stripeMethod({ - method: 'POST', - fullPath: '/v1/test_helpers/treasury/inbound_transfers/{id}/fail', - }), - returnInboundTransfer: stripeMethod({ - method: 'POST', - fullPath: '/v1/test_helpers/treasury/inbound_transfers/{id}/return', - }), - succeed: stripeMethod({ - method: 'POST', - fullPath: '/v1/test_helpers/treasury/inbound_transfers/{id}/succeed', - }), -}); diff --git a/cjs/resources/TestHelpers/Treasury/OutboundPayments.js b/cjs/resources/TestHelpers/Treasury/OutboundPayments.js deleted file mode 100644 index b87470138b..0000000000 --- a/cjs/resources/TestHelpers/Treasury/OutboundPayments.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.OutboundPayments = void 0; -const StripeResource_js_1 = require("../../../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.OutboundPayments = StripeResource_js_1.StripeResource.extend({ - fail: stripeMethod({ - method: 'POST', - fullPath: '/v1/test_helpers/treasury/outbound_payments/{id}/fail', - }), - post: stripeMethod({ - method: 'POST', - fullPath: '/v1/test_helpers/treasury/outbound_payments/{id}/post', - }), - returnOutboundPayment: stripeMethod({ - method: 'POST', - fullPath: '/v1/test_helpers/treasury/outbound_payments/{id}/return', - }), -}); diff --git a/cjs/resources/TestHelpers/Treasury/OutboundTransfers.js b/cjs/resources/TestHelpers/Treasury/OutboundTransfers.js deleted file mode 100644 index 186e0feb73..0000000000 --- a/cjs/resources/TestHelpers/Treasury/OutboundTransfers.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.OutboundTransfers = void 0; -const StripeResource_js_1 = require("../../../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.OutboundTransfers = StripeResource_js_1.StripeResource.extend({ - fail: stripeMethod({ - method: 'POST', - fullPath: '/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}/fail', - }), - post: stripeMethod({ - method: 'POST', - fullPath: '/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}/post', - }), - returnOutboundTransfer: stripeMethod({ - method: 'POST', - fullPath: '/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}/return', - }), -}); diff --git a/cjs/resources/TestHelpers/Treasury/ReceivedCredits.js b/cjs/resources/TestHelpers/Treasury/ReceivedCredits.js deleted file mode 100644 index 68b3f339e5..0000000000 --- a/cjs/resources/TestHelpers/Treasury/ReceivedCredits.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ReceivedCredits = void 0; -const StripeResource_js_1 = require("../../../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.ReceivedCredits = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/test_helpers/treasury/received_credits', - }), -}); diff --git a/cjs/resources/TestHelpers/Treasury/ReceivedDebits.js b/cjs/resources/TestHelpers/Treasury/ReceivedDebits.js deleted file mode 100644 index bb17521ce7..0000000000 --- a/cjs/resources/TestHelpers/Treasury/ReceivedDebits.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ReceivedDebits = void 0; -const StripeResource_js_1 = require("../../../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.ReceivedDebits = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/test_helpers/treasury/received_debits', - }), -}); diff --git a/cjs/resources/Tokens.js b/cjs/resources/Tokens.js deleted file mode 100644 index 5833be9c83..0000000000 --- a/cjs/resources/Tokens.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Tokens = void 0; -const StripeResource_js_1 = require("../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.Tokens = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/tokens', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/tokens/{token}', - }), -}); diff --git a/cjs/resources/Topups.js b/cjs/resources/Topups.js deleted file mode 100644 index 9cb956b719..0000000000 --- a/cjs/resources/Topups.js +++ /dev/null @@ -1,29 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Topups = void 0; -const StripeResource_js_1 = require("../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.Topups = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/topups', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/topups/{topup}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/topups/{topup}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/topups', - methodType: 'list', - }), - cancel: stripeMethod({ - method: 'POST', - fullPath: '/v1/topups/{topup}/cancel', - }), -}); diff --git a/cjs/resources/Transfers.js b/cjs/resources/Transfers.js deleted file mode 100644 index 7017a94f8e..0000000000 --- a/cjs/resources/Transfers.js +++ /dev/null @@ -1,42 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Transfers = void 0; -const StripeResource_js_1 = require("../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.Transfers = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/transfers', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/transfers/{transfer}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/transfers/{transfer}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/transfers', - methodType: 'list', - }), - createReversal: stripeMethod({ - method: 'POST', - fullPath: '/v1/transfers/{id}/reversals', - }), - listReversals: stripeMethod({ - method: 'GET', - fullPath: '/v1/transfers/{id}/reversals', - methodType: 'list', - }), - retrieveReversal: stripeMethod({ - method: 'GET', - fullPath: '/v1/transfers/{transfer}/reversals/{id}', - }), - updateReversal: stripeMethod({ - method: 'POST', - fullPath: '/v1/transfers/{transfer}/reversals/{id}', - }), -}); diff --git a/cjs/resources/Treasury/CreditReversals.js b/cjs/resources/Treasury/CreditReversals.js deleted file mode 100644 index a6bdac128d..0000000000 --- a/cjs/resources/Treasury/CreditReversals.js +++ /dev/null @@ -1,21 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.CreditReversals = void 0; -const StripeResource_js_1 = require("../../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.CreditReversals = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/treasury/credit_reversals', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/treasury/credit_reversals/{credit_reversal}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/treasury/credit_reversals', - methodType: 'list', - }), -}); diff --git a/cjs/resources/Treasury/DebitReversals.js b/cjs/resources/Treasury/DebitReversals.js deleted file mode 100644 index a6194c9b21..0000000000 --- a/cjs/resources/Treasury/DebitReversals.js +++ /dev/null @@ -1,21 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.DebitReversals = void 0; -const StripeResource_js_1 = require("../../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.DebitReversals = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/treasury/debit_reversals', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/treasury/debit_reversals/{debit_reversal}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/treasury/debit_reversals', - methodType: 'list', - }), -}); diff --git a/cjs/resources/Treasury/FinancialAccounts.js b/cjs/resources/Treasury/FinancialAccounts.js deleted file mode 100644 index 1b97059127..0000000000 --- a/cjs/resources/Treasury/FinancialAccounts.js +++ /dev/null @@ -1,33 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FinancialAccounts = void 0; -const StripeResource_js_1 = require("../../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.FinancialAccounts = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/treasury/financial_accounts', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/treasury/financial_accounts/{financial_account}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/treasury/financial_accounts/{financial_account}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/treasury/financial_accounts', - methodType: 'list', - }), - retrieveFeatures: stripeMethod({ - method: 'GET', - fullPath: '/v1/treasury/financial_accounts/{financial_account}/features', - }), - updateFeatures: stripeMethod({ - method: 'POST', - fullPath: '/v1/treasury/financial_accounts/{financial_account}/features', - }), -}); diff --git a/cjs/resources/Treasury/InboundTransfers.js b/cjs/resources/Treasury/InboundTransfers.js deleted file mode 100644 index 4d8f65ac22..0000000000 --- a/cjs/resources/Treasury/InboundTransfers.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.InboundTransfers = void 0; -const StripeResource_js_1 = require("../../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.InboundTransfers = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/treasury/inbound_transfers', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/treasury/inbound_transfers/{id}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/treasury/inbound_transfers', - methodType: 'list', - }), - cancel: stripeMethod({ - method: 'POST', - fullPath: '/v1/treasury/inbound_transfers/{inbound_transfer}/cancel', - }), -}); diff --git a/cjs/resources/Treasury/OutboundPayments.js b/cjs/resources/Treasury/OutboundPayments.js deleted file mode 100644 index c5bb25a1b0..0000000000 --- a/cjs/resources/Treasury/OutboundPayments.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.OutboundPayments = void 0; -const StripeResource_js_1 = require("../../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.OutboundPayments = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/treasury/outbound_payments', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/treasury/outbound_payments/{id}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/treasury/outbound_payments', - methodType: 'list', - }), - cancel: stripeMethod({ - method: 'POST', - fullPath: '/v1/treasury/outbound_payments/{id}/cancel', - }), -}); diff --git a/cjs/resources/Treasury/OutboundTransfers.js b/cjs/resources/Treasury/OutboundTransfers.js deleted file mode 100644 index bd168a6673..0000000000 --- a/cjs/resources/Treasury/OutboundTransfers.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.OutboundTransfers = void 0; -const StripeResource_js_1 = require("../../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.OutboundTransfers = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/treasury/outbound_transfers', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/treasury/outbound_transfers/{outbound_transfer}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/treasury/outbound_transfers', - methodType: 'list', - }), - cancel: stripeMethod({ - method: 'POST', - fullPath: '/v1/treasury/outbound_transfers/{outbound_transfer}/cancel', - }), -}); diff --git a/cjs/resources/Treasury/ReceivedCredits.js b/cjs/resources/Treasury/ReceivedCredits.js deleted file mode 100644 index ac7a420d00..0000000000 --- a/cjs/resources/Treasury/ReceivedCredits.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ReceivedCredits = void 0; -const StripeResource_js_1 = require("../../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.ReceivedCredits = StripeResource_js_1.StripeResource.extend({ - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/treasury/received_credits/{id}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/treasury/received_credits', - methodType: 'list', - }), -}); diff --git a/cjs/resources/Treasury/ReceivedDebits.js b/cjs/resources/Treasury/ReceivedDebits.js deleted file mode 100644 index 7d4e5f3945..0000000000 --- a/cjs/resources/Treasury/ReceivedDebits.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ReceivedDebits = void 0; -const StripeResource_js_1 = require("../../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.ReceivedDebits = StripeResource_js_1.StripeResource.extend({ - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/treasury/received_debits/{id}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/treasury/received_debits', - methodType: 'list', - }), -}); diff --git a/cjs/resources/Treasury/TransactionEntries.js b/cjs/resources/Treasury/TransactionEntries.js deleted file mode 100644 index 648d23b637..0000000000 --- a/cjs/resources/Treasury/TransactionEntries.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.TransactionEntries = void 0; -const StripeResource_js_1 = require("../../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.TransactionEntries = StripeResource_js_1.StripeResource.extend({ - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/treasury/transaction_entries/{id}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/treasury/transaction_entries', - methodType: 'list', - }), -}); diff --git a/cjs/resources/Treasury/Transactions.js b/cjs/resources/Treasury/Transactions.js deleted file mode 100644 index 9d420ddd52..0000000000 --- a/cjs/resources/Treasury/Transactions.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Transactions = void 0; -const StripeResource_js_1 = require("../../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.Transactions = StripeResource_js_1.StripeResource.extend({ - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/treasury/transactions/{id}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/treasury/transactions', - methodType: 'list', - }), -}); diff --git a/cjs/resources/WebhookEndpoints.js b/cjs/resources/WebhookEndpoints.js deleted file mode 100644 index 96a207a76f..0000000000 --- a/cjs/resources/WebhookEndpoints.js +++ /dev/null @@ -1,29 +0,0 @@ -"use strict"; -// File generated from our OpenAPI spec -Object.defineProperty(exports, "__esModule", { value: true }); -exports.WebhookEndpoints = void 0; -const StripeResource_js_1 = require("../StripeResource.js"); -const stripeMethod = StripeResource_js_1.StripeResource.method; -exports.WebhookEndpoints = StripeResource_js_1.StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/webhook_endpoints', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/webhook_endpoints/{webhook_endpoint}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/webhook_endpoints/{webhook_endpoint}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/webhook_endpoints', - methodType: 'list', - }), - del: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/webhook_endpoints/{webhook_endpoint}', - }), -}); diff --git a/cjs/stripe.cjs.node.js b/cjs/stripe.cjs.node.js deleted file mode 100644 index 14f06adb23..0000000000 --- a/cjs/stripe.cjs.node.js +++ /dev/null @@ -1,11 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const NodePlatformFunctions_js_1 = require("./platform/NodePlatformFunctions.js"); -const stripe_core_js_1 = require("./stripe.core.js"); -const Stripe = (0, stripe_core_js_1.createStripe)(new NodePlatformFunctions_js_1.NodePlatformFunctions()); -module.exports = Stripe; -// expose constructor as a named property to enable mocking with Sinon.JS -module.exports.Stripe = Stripe; -// Allow use with the TypeScript compiler without `esModuleInterop`. -// We may also want to add `Object.defineProperty(exports, "__esModule", {value: true});` in the future, so that Babel users will use the `default` version. -module.exports.default = Stripe; diff --git a/cjs/stripe.cjs.worker.js b/cjs/stripe.cjs.worker.js deleted file mode 100644 index 3de23401f7..0000000000 --- a/cjs/stripe.cjs.worker.js +++ /dev/null @@ -1,11 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const WebPlatformFunctions_js_1 = require("./platform/WebPlatformFunctions.js"); -const stripe_core_js_1 = require("./stripe.core.js"); -const Stripe = (0, stripe_core_js_1.createStripe)(new WebPlatformFunctions_js_1.WebPlatformFunctions()); -module.exports = Stripe; -// expose constructor as a named property to enable mocking with Sinon.JS -module.exports.Stripe = Stripe; -// Allow use with the TypeScript compiler without `esModuleInterop`. -// We may also want to add `Object.defineProperty(exports, "__esModule", {value: true});` in the future, so that Babel users will use the `default` version. -module.exports.default = Stripe; diff --git a/cjs/stripe.core.js b/cjs/stripe.core.js deleted file mode 100644 index b70d83c257..0000000000 --- a/cjs/stripe.core.js +++ /dev/null @@ -1,352 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.createStripe = void 0; -const _Error = require("./Error.js"); -const resources = require("./resources.js"); -const HttpClient_js_1 = require("./net/HttpClient.js"); -const utils_js_1 = require("./utils.js"); -const CryptoProvider_js_1 = require("./crypto/CryptoProvider.js"); -const RequestSender_js_1 = require("./RequestSender.js"); -const StripeResource_js_1 = require("./StripeResource.js"); -const Webhooks_js_1 = require("./Webhooks.js"); -const DEFAULT_HOST = 'api.stripe.com'; -const DEFAULT_PORT = '443'; -const DEFAULT_BASE_PATH = '/v1/'; -const DEFAULT_API_VERSION = null; -const DEFAULT_TIMEOUT = 80000; -const MAX_NETWORK_RETRY_DELAY_SEC = 2; -const INITIAL_NETWORK_RETRY_DELAY_SEC = 0.5; -const APP_INFO_PROPERTIES = ['name', 'version', 'url', 'partner_id']; -const ALLOWED_CONFIG_PROPERTIES = [ - 'apiVersion', - 'typescript', - 'maxNetworkRetries', - 'httpAgent', - 'httpClient', - 'timeout', - 'host', - 'port', - 'protocol', - 'telemetry', - 'appInfo', - 'stripeAccount', -]; -const defaultRequestSenderFactory = (stripe) => new RequestSender_js_1.RequestSender(stripe, StripeResource_js_1.StripeResource.MAX_BUFFERED_REQUEST_METRICS); -function createStripe(platformFunctions, requestSender = defaultRequestSenderFactory) { - Stripe.PACKAGE_VERSION = '11.15.0'; - Stripe.USER_AGENT = Object.assign({ bindings_version: Stripe.PACKAGE_VERSION, lang: 'node', publisher: 'stripe', uname: null, typescript: false }, (0, utils_js_1.determineProcessUserAgentProperties)()); - Stripe.StripeResource = StripeResource_js_1.StripeResource; - Stripe.resources = resources; - Stripe.HttpClient = HttpClient_js_1.HttpClient; - Stripe.HttpClientResponse = HttpClient_js_1.HttpClientResponse; - Stripe.CryptoProvider = CryptoProvider_js_1.CryptoProvider; - // For backwards compatibiblity after moving to separate CJS and ESM entrypoints. - // To be removed in the next major version. - Stripe.Stripe = Stripe; - Stripe.default = Stripe; - function Stripe(key, config = {}) { - if (!(this instanceof Stripe)) { - return new Stripe(key, config); - } - const props = this._getPropsFromConfig(config); - this._platformFunctions = platformFunctions; - Object.defineProperty(this, '_emitter', { - value: this._platformFunctions.createEmitter(), - enumerable: false, - configurable: false, - writable: false, - }); - this.VERSION = Stripe.PACKAGE_VERSION; - this.on = this._emitter.on.bind(this._emitter); - this.once = this._emitter.once.bind(this._emitter); - this.off = this._emitter.removeListener.bind(this._emitter); - if (props.protocol && - props.protocol !== 'https' && - (!props.host || /\.stripe\.com$/.test(props.host))) { - throw new Error('The `https` protocol must be used when sending requests to `*.stripe.com`'); - } - const agent = props.httpAgent || null; - this._api = { - auth: null, - host: props.host || DEFAULT_HOST, - port: props.port || DEFAULT_PORT, - protocol: props.protocol || 'https', - basePath: DEFAULT_BASE_PATH, - version: props.apiVersion || DEFAULT_API_VERSION, - timeout: (0, utils_js_1.validateInteger)('timeout', props.timeout, DEFAULT_TIMEOUT), - maxNetworkRetries: (0, utils_js_1.validateInteger)('maxNetworkRetries', props.maxNetworkRetries, 0), - agent: agent, - httpClient: props.httpClient || - (agent - ? this._platformFunctions.createNodeHttpClient(agent) - : this._platformFunctions.createDefaultHttpClient()), - dev: false, - stripeAccount: props.stripeAccount || null, - }; - const typescript = props.typescript || false; - if (typescript !== Stripe.USER_AGENT.typescript) { - // The mutation here is uncomfortable, but likely fastest; - // serializing the user agent involves shelling out to the system, - // and given some users may instantiate the library many times without switching between TS and non-TS, - // we only want to incur the performance hit when that actually happens. - Stripe.USER_AGENT.typescript = typescript; - } - if (props.appInfo) { - this._setAppInfo(props.appInfo); - } - this._prepResources(); - this._setApiKey(key); - this.errors = _Error; - this.webhooks = (0, Webhooks_js_1.createWebhooks)(platformFunctions); - this._prevRequestMetrics = []; - this._enableTelemetry = props.telemetry !== false; - this._requestSender = requestSender(this); - // Expose StripeResource on the instance too - // @ts-ignore - this.StripeResource = Stripe.StripeResource; - } - Stripe.errors = _Error; - Stripe.webhooks = Webhooks_js_1.createWebhooks; - Stripe.createNodeHttpClient = platformFunctions.createNodeHttpClient; - /** - * Creates an HTTP client for issuing Stripe API requests which uses the Web - * Fetch API. - * - * A fetch function can optionally be passed in as a parameter. If none is - * passed, will default to the default `fetch` function in the global scope. - */ - Stripe.createFetchHttpClient = platformFunctions.createFetchHttpClient; - /** - * Create a CryptoProvider which uses the built-in Node crypto libraries for - * its crypto operations. - */ - Stripe.createNodeCryptoProvider = platformFunctions.createNodeCryptoProvider; - /** - * Creates a CryptoProvider which uses the Subtle Crypto API from the Web - * Crypto API spec for its crypto operations. - * - * A SubtleCrypto interface can optionally be passed in as a parameter. If none - * is passed, will default to the default `crypto.subtle` object in the global - * scope. - */ - Stripe.createSubtleCryptoProvider = - platformFunctions.createSubtleCryptoProvider; - Stripe.prototype = { - // Properties are set in the constructor above - _appInfo: undefined, - on: null, - off: null, - once: null, - VERSION: null, - StripeResource: null, - webhooks: null, - errors: null, - _api: null, - _prevRequestMetrics: null, - _emitter: null, - _enableTelemetry: null, - _requestSender: null, - _platformFunctions: null, - /** - * @private - */ - _setApiKey(key) { - if (key) { - this._setApiField('auth', `Bearer ${key}`); - } - }, - /** - * @private - * This may be removed in the future. - */ - _setAppInfo(info) { - if (info && typeof info !== 'object') { - throw new Error('AppInfo must be an object.'); - } - if (info && !info.name) { - throw new Error('AppInfo.name is required'); - } - info = info || {}; - this._appInfo = APP_INFO_PROPERTIES.reduce((accum, prop) => { - if (typeof info[prop] == 'string') { - accum = accum || {}; - accum[prop] = info[prop]; - } - return accum; - }, - // @ts-ignore - undefined); - }, - /** - * @private - * This may be removed in the future. - */ - _setApiField(key, value) { - this._api[key] = value; - }, - /** - * @private - * Please open or upvote an issue at github.com/stripe/stripe-node - * if you use this, detailing your use-case. - * - * It may be deprecated and removed in the future. - */ - getApiField(key) { - return this._api[key]; - }, - setClientId(clientId) { - this._clientId = clientId; - }, - getClientId() { - return this._clientId; - }, - /** - * @private - * Please open or upvote an issue at github.com/stripe/stripe-node - * if you use this, detailing your use-case. - * - * It may be deprecated and removed in the future. - */ - getConstant: (c) => { - switch (c) { - case 'DEFAULT_HOST': - return DEFAULT_HOST; - case 'DEFAULT_PORT': - return DEFAULT_PORT; - case 'DEFAULT_BASE_PATH': - return DEFAULT_BASE_PATH; - case 'DEFAULT_API_VERSION': - return DEFAULT_API_VERSION; - case 'DEFAULT_TIMEOUT': - return DEFAULT_TIMEOUT; - case 'MAX_NETWORK_RETRY_DELAY_SEC': - return MAX_NETWORK_RETRY_DELAY_SEC; - case 'INITIAL_NETWORK_RETRY_DELAY_SEC': - return INITIAL_NETWORK_RETRY_DELAY_SEC; - } - return Stripe[c]; - }, - getMaxNetworkRetries() { - return this.getApiField('maxNetworkRetries'); - }, - /** - * @private - * This may be removed in the future. - */ - _setApiNumberField(prop, n, defaultVal) { - const val = (0, utils_js_1.validateInteger)(prop, n, defaultVal); - this._setApiField(prop, val); - }, - getMaxNetworkRetryDelay() { - return MAX_NETWORK_RETRY_DELAY_SEC; - }, - getInitialNetworkRetryDelay() { - return INITIAL_NETWORK_RETRY_DELAY_SEC; - }, - /** - * @private - * Please open or upvote an issue at github.com/stripe/stripe-node - * if you use this, detailing your use-case. - * - * It may be deprecated and removed in the future. - * - * Gets a JSON version of a User-Agent and uses a cached version for a slight - * speed advantage. - */ - getClientUserAgent(cb) { - return this.getClientUserAgentSeeded(Stripe.USER_AGENT, cb); - }, - /** - * @private - * Please open or upvote an issue at github.com/stripe/stripe-node - * if you use this, detailing your use-case. - * - * It may be deprecated and removed in the future. - * - * Gets a JSON version of a User-Agent by encoding a seeded object and - * fetching a uname from the system. - */ - getClientUserAgentSeeded(seed, cb) { - this._platformFunctions.getUname().then((uname) => { - var _a; - const userAgent = {}; - for (const field in seed) { - userAgent[field] = encodeURIComponent((_a = seed[field]) !== null && _a !== void 0 ? _a : 'null'); - } - // URI-encode in case there are unusual characters in the system's uname. - userAgent.uname = encodeURIComponent(uname || 'UNKNOWN'); - const client = this.getApiField('httpClient'); - if (client) { - userAgent.httplib = encodeURIComponent(client.getClientName()); - } - if (this._appInfo) { - userAgent.application = this._appInfo; - } - cb(JSON.stringify(userAgent)); - }); - }, - /** - * @private - * Please open or upvote an issue at github.com/stripe/stripe-node - * if you use this, detailing your use-case. - * - * It may be deprecated and removed in the future. - */ - getAppInfoAsString() { - if (!this._appInfo) { - return ''; - } - let formatted = this._appInfo.name; - if (this._appInfo.version) { - formatted += `/${this._appInfo.version}`; - } - if (this._appInfo.url) { - formatted += ` (${this._appInfo.url})`; - } - return formatted; - }, - getTelemetryEnabled() { - return this._enableTelemetry; - }, - /** - * @private - * This may be removed in the future. - */ - _prepResources() { - for (const name in resources) { - // @ts-ignore - this[(0, utils_js_1.pascalToCamelCase)(name)] = new resources[name](this); - } - }, - /** - * @private - * This may be removed in the future. - */ - _getPropsFromConfig(config) { - // If config is null or undefined, just bail early with no props - if (!config) { - return {}; - } - // config can be an object or a string - const isString = typeof config === 'string'; - const isObject = config === Object(config) && !Array.isArray(config); - if (!isObject && !isString) { - throw new Error('Config must either be an object or a string'); - } - // If config is a string, we assume the old behavior of passing in a string representation of the api version - if (isString) { - return { - apiVersion: config, - }; - } - // If config is an object, we assume the new behavior and make sure it doesn't contain any unexpected values - const values = Object.keys(config).filter((value) => !ALLOWED_CONFIG_PROPERTIES.includes(value)); - if (values.length > 0) { - throw new Error(`Config object may only contain the following: ${ALLOWED_CONFIG_PROPERTIES.join(', ')}`); - } - return config; - }, - }; - return Stripe; -} -exports.createStripe = createStripe; diff --git a/cjs/utils.js b/cjs/utils.js deleted file mode 100644 index e9dc1d1ce3..0000000000 --- a/cjs/utils.js +++ /dev/null @@ -1,307 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -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; -const qs = require("qs"); -const OPTIONS_KEYS = [ - 'apiKey', - 'idempotencyKey', - 'stripeAccount', - 'apiVersion', - 'maxNetworkRetries', - 'timeout', - 'host', -]; -function isOptionsHash(o) { - return (o && - typeof o === 'object' && - OPTIONS_KEYS.some((prop) => Object.prototype.hasOwnProperty.call(o, prop))); -} -exports.isOptionsHash = isOptionsHash; -/** - * Stringifies an Object, accommodating nested objects - * (forming the conventional key 'parent[child]=value') - */ -function stringifyRequestData(data) { - return (qs - .stringify(data, { - serializeDate: (d) => Math.floor(d.getTime() / 1000).toString(), - }) - // Don't use strict form encoding by changing the square bracket control - // characters back to their literals. This is fine by the server, and - // makes these parameter strings easier to read. - .replace(/%5B/g, '[') - .replace(/%5D/g, ']')); -} -exports.stringifyRequestData = stringifyRequestData; -/** - * Outputs a new function with interpolated object property values. - * Use like so: - * const fn = makeURLInterpolator('some/url/{param1}/{param2}'); - * fn({ param1: 123, param2: 456 }); // => 'some/url/123/456' - */ -exports.makeURLInterpolator = (() => { - const rc = { - '\n': '\\n', - '"': '\\"', - '\u2028': '\\u2028', - '\u2029': '\\u2029', - }; - return (str) => { - const cleanString = str.replace(/["\n\r\u2028\u2029]/g, ($0) => rc[$0]); - return (outputs) => { - return cleanString.replace(/\{([\s\S]+?)\}/g, ($0, $1) => - // @ts-ignore - encodeURIComponent(outputs[$1] || '')); - }; - }; -})(); -function extractUrlParams(path) { - const params = path.match(/\{\w+\}/g); - if (!params) { - return []; - } - return params.map((param) => param.replace(/[{}]/g, '')); -} -exports.extractUrlParams = extractUrlParams; -/** - * Return the data argument from a list of arguments - * - * @param {object[]} args - * @returns {object} - */ -function getDataFromArgs(args) { - if (!Array.isArray(args) || !args[0] || typeof args[0] !== 'object') { - return {}; - } - if (!isOptionsHash(args[0])) { - return args.shift(); - } - const argKeys = Object.keys(args[0]); - const optionKeysInArgs = argKeys.filter((key) => OPTIONS_KEYS.includes(key)); - // In some cases options may be the provided as the first argument. - // Here we're detecting a case where there are two distinct arguments - // (the first being args and the second options) and with known - // option keys in the first so that we can warn the user about it. - if (optionKeysInArgs.length > 0 && - optionKeysInArgs.length !== argKeys.length) { - emitWarning(`Options found in arguments (${optionKeysInArgs.join(', ')}). Did you mean to pass an options object? See https://github.com/stripe/stripe-node/wiki/Passing-Options.`); - } - return {}; -} -exports.getDataFromArgs = getDataFromArgs; -/** - * Return the options hash from a list of arguments - */ -function getOptionsFromArgs(args) { - const opts = { - auth: null, - host: null, - headers: {}, - settings: {}, - }; - if (args.length > 0) { - const arg = args[args.length - 1]; - if (typeof arg === 'string') { - opts.auth = args.pop(); - } - else if (isOptionsHash(arg)) { - const params = Object.assign({}, args.pop()); - const extraKeys = Object.keys(params).filter((key) => !OPTIONS_KEYS.includes(key)); - if (extraKeys.length) { - emitWarning(`Invalid options found (${extraKeys.join(', ')}); ignoring.`); - } - if (params.apiKey) { - opts.auth = params.apiKey; - } - if (params.idempotencyKey) { - opts.headers['Idempotency-Key'] = params.idempotencyKey; - } - if (params.stripeAccount) { - opts.headers['Stripe-Account'] = params.stripeAccount; - } - if (params.apiVersion) { - opts.headers['Stripe-Version'] = params.apiVersion; - } - if (Number.isInteger(params.maxNetworkRetries)) { - opts.settings.maxNetworkRetries = params.maxNetworkRetries; - } - if (Number.isInteger(params.timeout)) { - opts.settings.timeout = params.timeout; - } - if (params.host) { - opts.host = params.host; - } - } - } - return opts; -} -exports.getOptionsFromArgs = getOptionsFromArgs; -/** - * Provide simple "Class" extension mechanism. - * - */ -function protoExtend(sub) { - // eslint-disable-next-line @typescript-eslint/no-this-alias - const Super = this; - const Constructor = Object.prototype.hasOwnProperty.call(sub, 'constructor') - ? sub.constructor - : function (...args) { - Super.apply(this, args); - }; - // This initialization logic is somewhat sensitive to be compatible with - // divergent JS implementations like the one found in Qt. See here for more - // context: - // - // https://github.com/stripe/stripe-node/pull/334 - Object.assign(Constructor, Super); - Constructor.prototype = Object.create(Super.prototype); - Object.assign(Constructor.prototype, sub); - return Constructor; -} -exports.protoExtend = protoExtend; -/** - * Remove empty values from an object - */ -function removeNullish(obj) { - if (typeof obj !== 'object') { - throw new Error('Argument must be an object'); - } - return Object.keys(obj).reduce((result, key) => { - if (obj[key] != null) { - result[key] = obj[key]; - } - return result; - }, {}); -} -exports.removeNullish = removeNullish; -/** - * Normalize standard HTTP Headers: - * {'foo-bar': 'hi'} - * becomes - * {'Foo-Bar': 'hi'} - */ -function normalizeHeaders(obj) { - if (!(obj && typeof obj === 'object')) { - return obj; - } - return Object.keys(obj).reduce((result, header) => { - result[normalizeHeader(header)] = obj[header]; - return result; - }, {}); -} -exports.normalizeHeaders = normalizeHeaders; -/** - * Stolen from https://github.com/marten-de-vries/header-case-normalizer/blob/master/index.js#L36-L41 - * without the exceptions which are irrelevant to us. - */ -function normalizeHeader(header) { - return header - .split('-') - .map((text) => text.charAt(0).toUpperCase() + text.substr(1).toLowerCase()) - .join('-'); -} -exports.normalizeHeader = normalizeHeader; -function callbackifyPromiseWithTimeout(promise, callback) { - if (callback) { - // Ensure callback is called outside of promise stack. - return promise.then((res) => { - setTimeout(() => { - callback(null, res); - }, 0); - }, (err) => { - setTimeout(() => { - callback(err, null); - }, 0); - }); - } - return promise; -} -exports.callbackifyPromiseWithTimeout = callbackifyPromiseWithTimeout; -/** - * Allow for special capitalization cases (such as OAuth) - */ -function pascalToCamelCase(name) { - if (name === 'OAuth') { - return 'oauth'; - } - else { - return name[0].toLowerCase() + name.substring(1); - } -} -exports.pascalToCamelCase = pascalToCamelCase; -function emitWarning(warning) { - if (typeof process.emitWarning !== 'function') { - return console.warn(`Stripe: ${warning}`); /* eslint-disable-line no-console */ - } - return process.emitWarning(warning, 'Stripe'); -} -exports.emitWarning = emitWarning; -function isObject(obj) { - const type = typeof obj; - return (type === 'function' || type === 'object') && !!obj; -} -exports.isObject = isObject; -// For use in multipart requests -function flattenAndStringify(data) { - const result = {}; - const step = (obj, prevKey) => { - Object.keys(obj).forEach((key) => { - // @ts-ignore - const value = obj[key]; - const newKey = prevKey ? `${prevKey}[${key}]` : key; - if (isObject(value)) { - if (!(value instanceof Uint8Array) && - !Object.prototype.hasOwnProperty.call(value, 'data')) { - // Non-buffer non-file Objects are recursively flattened - return step(value, newKey); - } - else { - // Buffers and file objects are stored without modification - result[newKey] = value; - } - } - else { - // Primitives are converted to strings - result[newKey] = String(value); - } - }); - }; - step(data, null); - return result; -} -exports.flattenAndStringify = flattenAndStringify; -function validateInteger(name, n, defaultVal) { - if (!Number.isInteger(n)) { - if (defaultVal !== undefined) { - return defaultVal; - } - else { - throw new Error(`${name} must be an integer`); - } - } - return n; -} -exports.validateInteger = validateInteger; -function determineProcessUserAgentProperties() { - return typeof process === 'undefined' - ? {} - : { - lang_version: process.version, - platform: process.platform, - }; -} -exports.determineProcessUserAgentProperties = determineProcessUserAgentProperties; -/** - * Joins an array of Uint8Arrays into a single Uint8Array - */ -function concat(arrays) { - const totalLength = arrays.reduce((len, array) => len + array.length, 0); - const merged = new Uint8Array(totalLength); - let offset = 0; - arrays.forEach((array) => { - merged.set(array, offset); - offset += array.length; - }); - return merged; -} -exports.concat = concat; diff --git a/esm/Error.js b/esm/Error.js deleted file mode 100644 index f8c0eab1ec..0000000000 --- a/esm/Error.js +++ /dev/null @@ -1,130 +0,0 @@ -/* eslint-disable camelcase */ -export const generate = (rawStripeError) => { - switch (rawStripeError.type) { - case 'card_error': - return new StripeCardError(rawStripeError); - case 'invalid_request_error': - return new StripeInvalidRequestError(rawStripeError); - case 'api_error': - return new StripeAPIError(rawStripeError); - case 'authentication_error': - return new StripeAuthenticationError(rawStripeError); - case 'rate_limit_error': - return new StripeRateLimitError(rawStripeError); - case 'idempotency_error': - return new StripeIdempotencyError(rawStripeError); - case 'invalid_grant': - return new StripeInvalidGrantError(rawStripeError); - default: - return new StripeUnknownError(rawStripeError); - } -}; -/** - * StripeError is the base error from which all other more specific Stripe errors derive. - * Specifically for errors returned from Stripe's REST API. - */ -export class StripeError extends Error { - constructor(raw = {}) { - super(raw.message); - this.type = this.constructor.name; - this.raw = raw; - this.rawType = raw.type; - this.code = raw.code; - this.doc_url = raw.doc_url; - this.param = raw.param; - this.detail = raw.detail; - this.headers = raw.headers; - this.requestId = raw.requestId; - this.statusCode = raw.statusCode; - // @ts-ignore - this.message = raw.message; - this.charge = raw.charge; - this.decline_code = raw.decline_code; - this.payment_intent = raw.payment_intent; - this.payment_method = raw.payment_method; - this.payment_method_type = raw.payment_method_type; - this.setup_intent = raw.setup_intent; - this.source = raw.source; - } -} -/** - * Helper factory which takes raw stripe errors and outputs wrapping instances - */ -StripeError.generate = generate; -// Specific Stripe Error types: -/** - * CardError is raised when a user enters a card that can't be charged for - * some reason. - */ -export class StripeCardError extends StripeError { -} -/** - * InvalidRequestError is raised when a request is initiated with invalid - * parameters. - */ -export class StripeInvalidRequestError extends StripeError { -} -/** - * APIError is a generic error that may be raised in cases where none of the - * other named errors cover the problem. It could also be raised in the case - * that a new error has been introduced in the API, but this version of the - * Node.JS SDK doesn't know how to handle it. - */ -export class StripeAPIError extends StripeError { -} -/** - * AuthenticationError is raised when invalid credentials are used to connect - * to Stripe's servers. - */ -export class StripeAuthenticationError extends StripeError { -} -/** - * PermissionError is raised in cases where access was attempted on a resource - * that wasn't allowed. - */ -export class StripePermissionError extends StripeError { -} -/** - * RateLimitError is raised in cases where an account is putting too much load - * on Stripe's API servers (usually by performing too many requests). Please - * back off on request rate. - */ -export class StripeRateLimitError extends StripeError { -} -/** - * StripeConnectionError is raised in the event that the SDK can't connect to - * Stripe's servers. That can be for a variety of different reasons from a - * downed network to a bad TLS certificate. - */ -export class StripeConnectionError extends StripeError { -} -/** - * SignatureVerificationError is raised when the signature verification for a - * webhook fails - */ -export class StripeSignatureVerificationError extends StripeError { - constructor(header, payload, raw = {}) { - super(raw); - this.header = header; - this.payload = payload; - } -} -/** - * IdempotencyError is raised in cases where an idempotency key was used - * improperly. - */ -export class StripeIdempotencyError extends StripeError { -} -/** - * InvalidGrantError is raised when a specified code doesn't exist, is - * expired, has been used, or doesn't belong to you; a refresh token doesn't - * exist, or doesn't belong to you; or if an API key's mode (live or test) - * doesn't match the mode of a code or refresh token. - */ -export class StripeInvalidGrantError extends StripeError { -} -/** - * Any other error from Stripe not specifically captured above - */ -export class StripeUnknownError extends StripeError { -} diff --git a/esm/RequestSender.js b/esm/RequestSender.js deleted file mode 100644 index eb4660a7ab..0000000000 --- a/esm/RequestSender.js +++ /dev/null @@ -1,348 +0,0 @@ -import { StripeAPIError, StripeAuthenticationError, StripeConnectionError, StripeError, StripePermissionError, StripeRateLimitError, } from './Error.js'; -import { emitWarning, normalizeHeaders, removeNullish, stringifyRequestData, } from './utils.js'; -import { HttpClient } from './net/HttpClient.js'; -const MAX_RETRY_AFTER_WAIT = 60; -export class RequestSender { - constructor(stripe, maxBufferedRequestMetric) { - this._stripe = stripe; - this._maxBufferedRequestMetric = maxBufferedRequestMetric; - } - _addHeadersDirectlyToObject(obj, headers) { - // For convenience, make some headers easily accessible on - // lastResponse. - // NOTE: Stripe responds with lowercase header names/keys. - obj.requestId = headers['request-id']; - obj.stripeAccount = obj.stripeAccount || headers['stripe-account']; - obj.apiVersion = obj.apiVersion || headers['stripe-version']; - obj.idempotencyKey = obj.idempotencyKey || headers['idempotency-key']; - } - _makeResponseEvent(requestEvent, statusCode, headers) { - const requestEndTime = Date.now(); - const requestDurationMs = requestEndTime - requestEvent.request_start_time; - return removeNullish({ - api_version: headers['stripe-version'], - account: headers['stripe-account'], - idempotency_key: headers['idempotency-key'], - method: requestEvent.method, - path: requestEvent.path, - status: statusCode, - request_id: this._getRequestId(headers), - elapsed: requestDurationMs, - request_start_time: requestEvent.request_start_time, - request_end_time: requestEndTime, - }); - } - _getRequestId(headers) { - return headers['request-id']; - } - /** - * Used by methods with spec.streaming === true. For these methods, we do not - * buffer successful responses into memory or do parse them into stripe - * objects, we delegate that all of that to the user and pass back the raw - * http.Response object to the callback. - * - * (Unsuccessful responses shouldn't make it here, they should - * still be buffered/parsed and handled by _jsonResponseHandler -- see - * makeRequest) - */ - _streamingResponseHandler(requestEvent, callback) { - return (res) => { - const headers = res.getHeaders(); - const streamCompleteCallback = () => { - const responseEvent = this._makeResponseEvent(requestEvent, res.getStatusCode(), headers); - this._stripe._emitter.emit('response', responseEvent); - this._recordRequestMetrics(this._getRequestId(headers), responseEvent.elapsed); - }; - const stream = res.toStream(streamCompleteCallback); - // This is here for backwards compatibility, as the stream is a raw - // HTTP response in Node and the legacy behavior was to mutate this - // response. - this._addHeadersDirectlyToObject(stream, headers); - return callback(null, stream); - }; - } - /** - * Default handler for Stripe responses. Buffers the response into memory, - * parses the JSON and returns it (i.e. passes it to the callback) if there - * is no "error" field. Otherwise constructs/passes an appropriate Error. - */ - _jsonResponseHandler(requestEvent, callback) { - return (res) => { - const headers = res.getHeaders(); - const requestId = this._getRequestId(headers); - const statusCode = res.getStatusCode(); - const responseEvent = this._makeResponseEvent(requestEvent, statusCode, headers); - this._stripe._emitter.emit('response', responseEvent); - res - .toJSON() - .then((jsonResponse) => { - if (jsonResponse.error) { - let err; - // Convert OAuth error responses into a standard format - // so that the rest of the error logic can be shared - if (typeof jsonResponse.error === 'string') { - jsonResponse.error = { - type: jsonResponse.error, - message: jsonResponse.error_description, - }; - } - jsonResponse.error.headers = headers; - jsonResponse.error.statusCode = statusCode; - jsonResponse.error.requestId = requestId; - if (statusCode === 401) { - err = new StripeAuthenticationError(jsonResponse.error); - } - else if (statusCode === 403) { - err = new StripePermissionError(jsonResponse.error); - } - else if (statusCode === 429) { - err = new StripeRateLimitError(jsonResponse.error); - } - else { - err = StripeError.generate(jsonResponse.error); - } - throw err; - } - return jsonResponse; - }, (e) => { - throw new StripeAPIError({ - message: 'Invalid JSON received from the Stripe API', - exception: e, - requestId: headers['request-id'], - }); - }) - .then((jsonResponse) => { - this._recordRequestMetrics(requestId, responseEvent.elapsed); - // Expose raw response object. - const rawResponse = res.getRawResponse(); - this._addHeadersDirectlyToObject(rawResponse, headers); - Object.defineProperty(jsonResponse, 'lastResponse', { - enumerable: false, - writable: false, - value: rawResponse, - }); - callback(null, jsonResponse); - }, (e) => callback(e, null)); - }; - } - static _generateConnectionErrorMessage(requestRetries) { - return `An error occurred with our connection to Stripe.${requestRetries > 0 ? ` Request was retried ${requestRetries} times.` : ''}`; - } - // For more on when and how to retry API requests, see https://stripe.com/docs/error-handling#safely-retrying-requests-with-idempotency - static _shouldRetry(res, numRetries, maxRetries, error) { - if (error && - numRetries === 0 && - HttpClient.CONNECTION_CLOSED_ERROR_CODES.includes(error.code)) { - return true; - } - // Do not retry if we are out of retries. - if (numRetries >= maxRetries) { - return false; - } - // Retry on connection error. - if (!res) { - return true; - } - // The API may ask us not to retry (e.g., if doing so would be a no-op) - // or advise us to retry (e.g., in cases of lock timeouts); we defer to that. - if (res.getHeaders()['stripe-should-retry'] === 'false') { - return false; - } - if (res.getHeaders()['stripe-should-retry'] === 'true') { - return true; - } - // Retry on conflict errors. - if (res.getStatusCode() === 409) { - return true; - } - // Retry on 500, 503, and other internal errors. - // - // Note that we expect the stripe-should-retry header to be false - // in most cases when a 500 is returned, since our idempotency framework - // would typically replay it anyway. - if (res.getStatusCode() >= 500) { - return true; - } - return false; - } - _getSleepTimeInMS(numRetries, retryAfter = null) { - const initialNetworkRetryDelay = this._stripe.getInitialNetworkRetryDelay(); - const maxNetworkRetryDelay = this._stripe.getMaxNetworkRetryDelay(); - // Apply exponential backoff with initialNetworkRetryDelay on the - // number of numRetries so far as inputs. Do not allow the number to exceed - // maxNetworkRetryDelay. - let sleepSeconds = Math.min(initialNetworkRetryDelay * Math.pow(numRetries - 1, 2), maxNetworkRetryDelay); - // Apply some jitter by randomizing the value in the range of - // (sleepSeconds / 2) to (sleepSeconds). - sleepSeconds *= 0.5 * (1 + Math.random()); - // But never sleep less than the base sleep seconds. - sleepSeconds = Math.max(initialNetworkRetryDelay, sleepSeconds); - // And never sleep less than the time the API asks us to wait, assuming it's a reasonable ask. - if (Number.isInteger(retryAfter) && retryAfter <= MAX_RETRY_AFTER_WAIT) { - sleepSeconds = Math.max(sleepSeconds, retryAfter); - } - return sleepSeconds * 1000; - } - // Max retries can be set on a per request basis. Favor those over the global setting - _getMaxNetworkRetries(settings = {}) { - return settings.maxNetworkRetries && - Number.isInteger(settings.maxNetworkRetries) - ? settings.maxNetworkRetries - : this._stripe.getMaxNetworkRetries(); - } - _defaultIdempotencyKey(method, settings) { - // If this is a POST and we allow multiple retries, ensure an idempotency key. - const maxRetries = this._getMaxNetworkRetries(settings); - if (method === 'POST' && maxRetries > 0) { - return `stripe-node-retry-${this._stripe._platformFunctions.uuid4()}`; - } - return null; - } - _makeHeaders(auth, contentLength, apiVersion, clientUserAgent, method, userSuppliedHeaders, userSuppliedSettings) { - const defaultHeaders = { - // Use specified auth token or use default from this stripe instance: - Authorization: auth ? `Bearer ${auth}` : this._stripe.getApiField('auth'), - Accept: 'application/json', - 'Content-Type': 'application/x-www-form-urlencoded', - 'User-Agent': this._getUserAgentString(), - 'X-Stripe-Client-User-Agent': clientUserAgent, - 'X-Stripe-Client-Telemetry': this._getTelemetryHeader(), - 'Stripe-Version': apiVersion, - 'Stripe-Account': this._stripe.getApiField('stripeAccount'), - 'Idempotency-Key': this._defaultIdempotencyKey(method, userSuppliedSettings), - }; - // As per https://datatracker.ietf.org/doc/html/rfc7230#section-3.3.2: - // A user agent SHOULD send a Content-Length in a request message when - // no Transfer-Encoding is sent and the request method defines a meaning - // for an enclosed payload body. For example, a Content-Length header - // field is normally sent in a POST request even when the value is 0 - // (indicating an empty payload body). A user agent SHOULD NOT send a - // Content-Length header field when the request message does not contain - // a payload body and the method semantics do not anticipate such a - // body. - // - // These method types are expected to have bodies and so we should always - // include a Content-Length. - const methodHasPayload = method == 'POST' || method == 'PUT' || method == 'PATCH'; - // If a content length was specified, we always include it regardless of - // whether the method semantics anticipate such a body. This keeps us - // consistent with historical behavior. We do however want to warn on this - // and fix these cases as they are semantically incorrect. - if (methodHasPayload || contentLength) { - if (!methodHasPayload) { - emitWarning(`${method} method had non-zero contentLength but no payload is expected for this verb`); - } - defaultHeaders['Content-Length'] = contentLength; - } - return Object.assign(removeNullish(defaultHeaders), - // If the user supplied, say 'idempotency-key', override instead of appending by ensuring caps are the same. - normalizeHeaders(userSuppliedHeaders)); - } - _getUserAgentString() { - const packageVersion = this._stripe.getConstant('PACKAGE_VERSION'); - const appInfo = this._stripe._appInfo - ? this._stripe.getAppInfoAsString() - : ''; - return `Stripe/v1 NodeBindings/${packageVersion} ${appInfo}`.trim(); - } - _getTelemetryHeader() { - if (this._stripe.getTelemetryEnabled() && - this._stripe._prevRequestMetrics.length > 0) { - const metrics = this._stripe._prevRequestMetrics.shift(); - return JSON.stringify({ - last_request_metrics: metrics, - }); - } - } - _recordRequestMetrics(requestId, requestDurationMs) { - if (this._stripe.getTelemetryEnabled() && requestId) { - if (this._stripe._prevRequestMetrics.length > this._maxBufferedRequestMetric) { - emitWarning('Request metrics buffer is full, dropping telemetry message.'); - } - else { - this._stripe._prevRequestMetrics.push({ - request_id: requestId, - request_duration_ms: requestDurationMs, - }); - } - } - } - _request(method, host, path, data, auth, options = {}, callback, requestDataProcessor = null) { - let requestData; - const retryRequest = (requestFn, apiVersion, headers, requestRetries, retryAfter) => { - return setTimeout(requestFn, this._getSleepTimeInMS(requestRetries, retryAfter), apiVersion, headers, requestRetries + 1); - }; - const makeRequest = (apiVersion, headers, numRetries) => { - // timeout can be set on a per-request basis. Favor that over the global setting - const timeout = options.settings && - options.settings.timeout && - Number.isInteger(options.settings.timeout) && - options.settings.timeout >= 0 - ? options.settings.timeout - : this._stripe.getApiField('timeout'); - const req = this._stripe - .getApiField('httpClient') - .makeRequest(host || this._stripe.getApiField('host'), this._stripe.getApiField('port'), path, method, headers, requestData, this._stripe.getApiField('protocol'), timeout); - const requestStartTime = Date.now(); - // @ts-ignore - const requestEvent = removeNullish({ - api_version: apiVersion, - account: headers['Stripe-Account'], - idempotency_key: headers['Idempotency-Key'], - method, - path, - request_start_time: requestStartTime, - }); - const requestRetries = numRetries || 0; - const maxRetries = this._getMaxNetworkRetries(options.settings || {}); - this._stripe._emitter.emit('request', requestEvent); - req - .then((res) => { - if (RequestSender._shouldRetry(res, requestRetries, maxRetries)) { - return retryRequest(makeRequest, apiVersion, headers, requestRetries, - // @ts-ignore - res.getHeaders()['retry-after']); - } - else if (options.streaming && res.getStatusCode() < 400) { - return this._streamingResponseHandler(requestEvent, callback)(res); - } - else { - return this._jsonResponseHandler(requestEvent, callback)(res); - } - }) - .catch((error) => { - if (RequestSender._shouldRetry(null, requestRetries, maxRetries, error)) { - return retryRequest(makeRequest, apiVersion, headers, requestRetries, null); - } - else { - const isTimeoutError = error.code && error.code === HttpClient.TIMEOUT_ERROR_CODE; - return callback(new StripeConnectionError({ - message: isTimeoutError - ? `Request aborted due to timeout being reached (${timeout}ms)` - : RequestSender._generateConnectionErrorMessage(requestRetries), - // @ts-ignore - detail: error, - })); - } - }); - }; - const prepareAndMakeRequest = (error, data) => { - if (error) { - return callback(error); - } - requestData = data; - this._stripe.getClientUserAgent((clientUserAgent) => { - var _a, _b; - const apiVersion = this._stripe.getApiField('version'); - 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 : {}); - makeRequest(apiVersion, headers, 0); - }); - }; - if (requestDataProcessor) { - requestDataProcessor(method, data, options.headers, prepareAndMakeRequest); - } - else { - prepareAndMakeRequest(null, stringifyRequestData(data || {})); - } - } -} diff --git a/esm/ResourceNamespace.js b/esm/ResourceNamespace.js deleted file mode 100644 index e404487200..0000000000 --- a/esm/ResourceNamespace.js +++ /dev/null @@ -1,14 +0,0 @@ -// ResourceNamespace allows you to create nested resources, i.e. `stripe.issuing.cards`. -// It also works recursively, so you could do i.e. `stripe.billing.invoicing.pay`. -function ResourceNamespace(stripe, resources) { - for (const name in resources) { - const camelCaseName = name[0].toLowerCase() + name.substring(1); - const resource = new resources[name](stripe); - this[camelCaseName] = resource; - } -} -export function resourceNamespace(namespace, resources) { - return function (stripe) { - return new ResourceNamespace(stripe, resources); - }; -} diff --git a/esm/StripeEmitter.js b/esm/StripeEmitter.js deleted file mode 100644 index b62982edf8..0000000000 --- a/esm/StripeEmitter.js +++ /dev/null @@ -1,42 +0,0 @@ -/** - * @private - * (For internal use in stripe-node.) - * Wrapper around the Event Web API. - */ -class _StripeEvent extends Event { - constructor(eventName, data) { - super(eventName); - this.data = data; - } -} -/** Minimal EventEmitter wrapper around EventTarget. */ -export class StripeEmitter { - constructor() { - this.eventTarget = new EventTarget(); - this.listenerMapping = new Map(); - } - on(eventName, listener) { - const listenerWrapper = (event) => { - listener(event.data); - }; - this.listenerMapping.set(listener, listenerWrapper); - return this.eventTarget.addEventListener(eventName, listenerWrapper); - } - removeListener(eventName, listener) { - const listenerWrapper = this.listenerMapping.get(listener); - this.listenerMapping.delete(listener); - return this.eventTarget.removeEventListener(eventName, listenerWrapper); - } - once(eventName, listener) { - const listenerWrapper = (event) => { - listener(event.data); - }; - this.listenerMapping.set(listener, listenerWrapper); - return this.eventTarget.addEventListener(eventName, listenerWrapper, { - once: true, - }); - } - emit(eventName, data) { - return this.eventTarget.dispatchEvent(new _StripeEvent(eventName, data)); - } -} diff --git a/esm/StripeMethod.js b/esm/StripeMethod.js deleted file mode 100644 index e76432a97a..0000000000 --- a/esm/StripeMethod.js +++ /dev/null @@ -1,37 +0,0 @@ -import { callbackifyPromiseWithTimeout, extractUrlParams } from './utils.js'; -import { makeAutoPaginationMethods } from './autoPagination.js'; -/** - * Create an API method from the declared spec. - * - * @param [spec.method='GET'] Request Method (POST, GET, DELETE, PUT) - * @param [spec.path=''] Path to be appended to the API BASE_PATH, joined with - * the instance's path (e.g. 'charges' or 'customers') - * @param [spec.fullPath=''] Fully qualified path to the method (eg. /v1/a/b/c). - * If this is specified, path should not be specified. - * @param [spec.urlParams=[]] Array of required arguments in the order that they - * must be passed by the consumer of the API. Subsequent optional arguments are - * optionally passed through a hash (Object) as the penultimate argument - * (preceding the also-optional callback argument - * @param [spec.encode] Function for mutating input parameters to a method. - * Usefully for applying transforms to data on a per-method basis. - * @param [spec.host] Hostname for the request. - * - * - */ -export function stripeMethod(spec) { - if (spec.path !== undefined && spec.fullPath !== undefined) { - throw new Error(`Method spec specified both a 'path' (${spec.path}) and a 'fullPath' (${spec.fullPath}).`); - } - return function (...args) { - const callback = typeof args[args.length - 1] == 'function' && args.pop(); - spec.urlParams = extractUrlParams(spec.fullPath || this.createResourcePathWithSymbols(spec.path || '')); - const requestPromise = callbackifyPromiseWithTimeout(this._makeRequest(args, spec, {}), callback); - // Please note `spec.methodType === 'search'` is beta functionality and this - // interface is subject to change/removal at any time. - if (spec.methodType === 'list' || spec.methodType === 'search') { - const autoPaginationMethods = makeAutoPaginationMethods(this, args, spec, requestPromise); - Object.assign(requestPromise, autoPaginationMethods); - } - return requestPromise; - }; -} diff --git a/esm/StripeResource.js b/esm/StripeResource.js deleted file mode 100644 index 5d8efae1d6..0000000000 --- a/esm/StripeResource.js +++ /dev/null @@ -1,166 +0,0 @@ -import { getDataFromArgs, getOptionsFromArgs, makeURLInterpolator, protoExtend, stringifyRequestData, } from './utils.js'; -import { stripeMethod } from './StripeMethod.js'; -// Provide extension mechanism for Stripe Resource Sub-Classes -StripeResource.extend = protoExtend; -// Expose method-creator -StripeResource.method = stripeMethod; -StripeResource.MAX_BUFFERED_REQUEST_METRICS = 100; -/** - * Encapsulates request logic for a Stripe Resource - */ -function StripeResource(stripe, deprecatedUrlData) { - this._stripe = stripe; - if (deprecatedUrlData) { - throw new Error('Support for curried url params was dropped in stripe-node v7.0.0. Instead, pass two ids.'); - } - this.basePath = makeURLInterpolator( - // @ts-ignore changing type of basePath - this.basePath || stripe.getApiField('basePath')); - // @ts-ignore changing type of path - this.resourcePath = this.path; - // @ts-ignore changing type of path - this.path = makeURLInterpolator(this.path); - this.initialize(...arguments); -} -StripeResource.prototype = { - _stripe: null, - // @ts-ignore the type of path changes in ctor - path: '', - resourcePath: '', - // Methods that don't use the API's default '/v1' path can override it with this setting. - basePath: null, - initialize() { }, - // Function to override the default data processor. This allows full control - // over how a StripeResource's request data will get converted into an HTTP - // body. This is useful for non-standard HTTP requests. The function should - // take method name, data, and headers as arguments. - requestDataProcessor: null, - // Function to add a validation checks before sending the request, errors should - // be thrown, and they will be passed to the callback/promise. - validateRequest: null, - createFullPath(commandPath, urlData) { - const urlParts = [this.basePath(urlData), this.path(urlData)]; - if (typeof commandPath === 'function') { - const computedCommandPath = commandPath(urlData); - // If we have no actual command path, we just omit it to avoid adding a - // trailing slash. This is important for top-level listing requests, which - // do not have a command path. - if (computedCommandPath) { - urlParts.push(computedCommandPath); - } - } - else { - urlParts.push(commandPath); - } - return this._joinUrlParts(urlParts); - }, - // Creates a relative resource path with symbols left in (unlike - // createFullPath which takes some data to replace them with). For example it - // might produce: /invoices/{id} - createResourcePathWithSymbols(pathWithSymbols) { - // If there is no path beyond the resource path, we want to produce just - // / rather than //. - if (pathWithSymbols) { - return `/${this._joinUrlParts([this.resourcePath, pathWithSymbols])}`; - } - else { - return `/${this.resourcePath}`; - } - }, - _joinUrlParts(parts) { - // Replace any accidentally doubled up slashes. This previously used - // path.join, which would do this as well. Unfortunately we need to do this - // as the functions for creating paths are technically part of the public - // interface and so we need to preserve backwards compatibility. - return parts.join('/').replace(/\/{2,}/g, '/'); - }, - _getRequestOpts(requestArgs, spec, overrideData) { - // Extract spec values with defaults. - const requestMethod = (spec.method || 'GET').toUpperCase(); - const urlParams = spec.urlParams || []; - const encode = spec.encode || ((data) => data); - const isUsingFullPath = !!spec.fullPath; - const commandPath = makeURLInterpolator(isUsingFullPath ? spec.fullPath : spec.path || ''); - // When using fullPath, we ignore the resource path as it should already be - // fully qualified. - const path = isUsingFullPath - ? spec.fullPath - : this.createResourcePathWithSymbols(spec.path); - // Don't mutate args externally. - const args = [].slice.call(requestArgs); - // Generate and validate url params. - const urlData = urlParams.reduce((urlData, param) => { - const arg = args.shift(); - if (typeof arg !== 'string') { - throw new Error(`Stripe: Argument "${param}" must be a string, but got: ${arg} (on API request to \`${requestMethod} ${path}\`)`); - } - urlData[param] = arg; - return urlData; - }, {}); - // Pull request data and options (headers, auth) from args. - const dataFromArgs = getDataFromArgs(args); - const data = encode(Object.assign({}, dataFromArgs, overrideData)); - const options = getOptionsFromArgs(args); - const host = options.host || spec.host; - const streaming = !!spec.streaming; - // Validate that there are no more args. - if (args.filter((x) => x != null).length) { - throw new Error(`Stripe: Unknown arguments (${args}). Did you mean to pass an options object? See https://github.com/stripe/stripe-node/wiki/Passing-Options. (on API request to ${requestMethod} \`${path}\`)`); - } - // When using full path, we can just invoke the URL interpolator directly - // as we don't need to use the resource to create a full path. - const requestPath = isUsingFullPath - ? commandPath(urlData) - : this.createFullPath(commandPath, urlData); - const headers = Object.assign(options.headers, spec.headers); - if (spec.validator) { - spec.validator(data, { headers }); - } - const dataInQuery = spec.method === 'GET' || spec.method === 'DELETE'; - const bodyData = dataInQuery ? {} : data; - const queryData = dataInQuery ? data : {}; - return { - requestMethod, - requestPath, - bodyData, - queryData, - auth: options.auth, - headers, - host: host !== null && host !== void 0 ? host : null, - streaming, - settings: options.settings, - }; - }, - _makeRequest(requestArgs, spec, overrideData) { - return new Promise((resolve, reject) => { - var _a; - let opts; - try { - opts = this._getRequestOpts(requestArgs, spec, overrideData); - } - catch (err) { - reject(err); - return; - } - function requestCallback(err, response) { - if (err) { - reject(err); - } - else { - resolve(spec.transformResponseData - ? spec.transformResponseData(response) - : response); - } - } - const emptyQuery = Object.keys(opts.queryData).length === 0; - const path = [ - opts.requestPath, - emptyQuery ? '' : '?', - stringifyRequestData(opts.queryData), - ].join(''); - const { headers, settings } = opts; - this._stripe._requestSender._request(opts.requestMethod, opts.host, path, opts.bodyData, opts.auth, { headers, settings, streaming: opts.streaming }, requestCallback, (_a = this.requestDataProcessor) === null || _a === void 0 ? void 0 : _a.bind(this)); - }); - }, -}; -export { StripeResource }; diff --git a/esm/Webhooks.js b/esm/Webhooks.js deleted file mode 100644 index 99a6a21100..0000000000 --- a/esm/Webhooks.js +++ /dev/null @@ -1,175 +0,0 @@ -import { StripeError, StripeSignatureVerificationError } from './Error.js'; -export function createWebhooks(platformFunctions) { - const Webhook = { - DEFAULT_TOLERANCE: 300, - // @ts-ignore - signature: null, - constructEvent(payload, header, secret, tolerance, cryptoProvider) { - this.signature.verifyHeader(payload, header, secret, tolerance || Webhook.DEFAULT_TOLERANCE, cryptoProvider); - const jsonPayload = payload instanceof Uint8Array - ? JSON.parse(new TextDecoder('utf8').decode(payload)) - : JSON.parse(payload); - return jsonPayload; - }, - async constructEventAsync(payload, header, secret, tolerance, cryptoProvider) { - await this.signature.verifyHeaderAsync(payload, header, secret, tolerance || Webhook.DEFAULT_TOLERANCE, cryptoProvider); - const jsonPayload = payload instanceof Uint8Array - ? JSON.parse(new TextDecoder('utf8').decode(payload)) - : JSON.parse(payload); - return jsonPayload; - }, - /** - * Generates a header to be used for webhook mocking - * - * @typedef {object} opts - * @property {number} timestamp - Timestamp of the header. Defaults to Date.now() - * @property {string} payload - JSON stringified payload object, containing the 'id' and 'object' parameters - * @property {string} secret - Stripe webhook secret 'whsec_...' - * @property {string} scheme - Version of API to hit. Defaults to 'v1'. - * @property {string} signature - Computed webhook signature - * @property {CryptoProvider} cryptoProvider - Crypto provider to use for computing the signature if none was provided. Defaults to NodeCryptoProvider. - */ - generateTestHeaderString: function (opts) { - if (!opts) { - throw new StripeError({ - message: 'Options are required', - }); - } - opts.timestamp = - Math.floor(opts.timestamp) || Math.floor(Date.now() / 1000); - opts.scheme = opts.scheme || signature.EXPECTED_SCHEME; - opts.cryptoProvider = opts.cryptoProvider || getCryptoProvider(); - opts.signature = - opts.signature || - opts.cryptoProvider.computeHMACSignature(opts.timestamp + '.' + opts.payload, opts.secret); - const generatedHeader = [ - 't=' + opts.timestamp, - opts.scheme + '=' + opts.signature, - ].join(','); - return generatedHeader; - }, - }; - const signature = { - EXPECTED_SCHEME: 'v1', - verifyHeader(encodedPayload, encodedHeader, secret, tolerance, cryptoProvider) { - const { decodedHeader: header, decodedPayload: payload, details, suspectPayloadType, } = parseEventDetails(encodedPayload, encodedHeader, this.EXPECTED_SCHEME); - cryptoProvider = cryptoProvider || getCryptoProvider(); - const expectedSignature = cryptoProvider.computeHMACSignature(makeHMACContent(payload, details), secret); - validateComputedSignature(payload, header, details, expectedSignature, tolerance, suspectPayloadType); - return true; - }, - async verifyHeaderAsync(encodedPayload, encodedHeader, secret, tolerance, cryptoProvider) { - const { decodedHeader: header, decodedPayload: payload, details, suspectPayloadType, } = parseEventDetails(encodedPayload, encodedHeader, this.EXPECTED_SCHEME); - cryptoProvider = cryptoProvider || getCryptoProvider(); - const expectedSignature = await cryptoProvider.computeHMACSignatureAsync(makeHMACContent(payload, details), secret); - return validateComputedSignature(payload, header, details, expectedSignature, tolerance, suspectPayloadType); - }, - }; - function makeHMACContent(payload, details) { - return `${details.timestamp}.${payload}`; - } - function parseEventDetails(encodedPayload, encodedHeader, expectedScheme) { - if (!encodedPayload) { - throw new StripeSignatureVerificationError(encodedHeader, encodedPayload, { - message: 'No webhook payload was provided.', - }); - } - const suspectPayloadType = typeof encodedPayload != 'string' && - !(encodedPayload instanceof Uint8Array); - const textDecoder = new TextDecoder('utf8'); - const decodedPayload = encodedPayload instanceof Uint8Array - ? textDecoder.decode(encodedPayload) - : encodedPayload; - // Express's type for `Request#headers` is `string | []string` - // which is because the `set-cookie` header is an array, - // but no other headers are an array (docs: https://nodejs.org/api/http.html#http_message_headers) - // (Express's Request class is an extension of http.IncomingMessage, and doesn't appear to be relevantly modified: https://github.com/expressjs/express/blob/master/lib/request.js#L31) - if (Array.isArray(encodedHeader)) { - throw new Error('Unexpected: An array was passed as a header, which should not be possible for the stripe-signature header.'); - } - if (encodedHeader == null || encodedHeader == '') { - throw new StripeSignatureVerificationError(encodedHeader, encodedPayload, { - message: 'No stripe-signature header value was provided.', - }); - } - const decodedHeader = encodedHeader instanceof Uint8Array - ? textDecoder.decode(encodedHeader) - : encodedHeader; - const details = parseHeader(decodedHeader, expectedScheme); - if (!details || details.timestamp === -1) { - throw new StripeSignatureVerificationError(decodedHeader, decodedPayload, { - message: 'Unable to extract timestamp and signatures from header', - }); - } - if (!details.signatures.length) { - throw new StripeSignatureVerificationError(decodedHeader, decodedPayload, { - message: 'No signatures found with expected scheme', - }); - } - return { - decodedPayload, - decodedHeader, - details, - suspectPayloadType, - }; - } - function validateComputedSignature(payload, header, details, expectedSignature, tolerance, suspectPayloadType) { - const signatureFound = !!details.signatures.filter(platformFunctions.secureCompare.bind(platformFunctions, expectedSignature)).length; - if (!signatureFound) { - if (suspectPayloadType) { - throw new StripeSignatureVerificationError(header, payload, { - message: 'Webhook payload must be provided as a string or a Buffer (https://nodejs.org/api/buffer.html) instance representing the _raw_ request body.' + - 'Payload was provided as a parsed JavaScript object instead. \n' + - 'Signature verification is impossible without access to the original signed material. \n' + - 'Learn more about webhook signing and explore webhook integration examples for various frameworks at ' + - 'https://github.com/stripe/stripe-node#webhook-signing', - }); - } - throw new StripeSignatureVerificationError(header, payload, { - message: 'No signatures found matching the expected signature for payload.' + - ' Are you passing the raw request body you received from Stripe? \n' + - 'Learn more about webhook signing and explore webhook integration examples for various frameworks at ' + - 'https://github.com/stripe/stripe-node#webhook-signing', - }); - } - const timestampAge = Math.floor(Date.now() / 1000) - details.timestamp; - if (tolerance > 0 && timestampAge > tolerance) { - // @ts-ignore - throw new StripeSignatureVerificationError(header, payload, { - message: 'Timestamp outside the tolerance zone', - }); - } - return true; - } - function parseHeader(header, scheme) { - if (typeof header !== 'string') { - return null; - } - return header.split(',').reduce((accum, item) => { - const kv = item.split('='); - if (kv[0] === 't') { - accum.timestamp = parseInt(kv[1], 10); - } - if (kv[0] === scheme) { - accum.signatures.push(kv[1]); - } - return accum; - }, { - timestamp: -1, - signatures: [], - }); - } - let webhooksCryptoProviderInstance = null; - /** - * Lazily instantiate a CryptoProvider instance. This is a stateless object - * so a singleton can be used here. - */ - function getCryptoProvider() { - if (!webhooksCryptoProviderInstance) { - webhooksCryptoProviderInstance = platformFunctions.createDefaultCryptoProvider(); - } - return webhooksCryptoProviderInstance; - } - Webhook.signature = signature; - return Webhook; -} diff --git a/esm/apiVersion.js b/esm/apiVersion.js deleted file mode 100644 index 6e9ed7837d..0000000000 --- a/esm/apiVersion.js +++ /dev/null @@ -1,2 +0,0 @@ -// File generated from our OpenAPI spec -export const ApiVersion = '2022-11-15'; diff --git a/esm/autoPagination.js b/esm/autoPagination.js deleted file mode 100644 index e217319c42..0000000000 --- a/esm/autoPagination.js +++ /dev/null @@ -1,230 +0,0 @@ -import { callbackifyPromiseWithTimeout, getDataFromArgs } from './utils.js'; -export function makeAutoPaginationMethods(self, requestArgs, spec, firstPagePromise) { - const promiseCache = { currentPromise: null }; - const reverseIteration = isReverseIteration(requestArgs); - let pagePromise = firstPagePromise; - let i = 0; - // Search and List methods iterate differently. - // Search relies on a `next_page` token and can only iterate in one direction. - // List relies on either an `ending_before` or `starting_after` field with - // an item ID to paginate and is bi-directional. - // - // Please note: spec.methodType === 'search' is beta functionality and is - // subject to change/removal at any time. - let getNextPagePromise; - if (spec.methodType === 'search') { - getNextPagePromise = (pageResult) => { - if (!pageResult.next_page) { - throw Error('Unexpected: Stripe API response does not have a well-formed `next_page` field, but `has_more` was true.'); - } - return self._makeRequest(requestArgs, spec, { - page: pageResult.next_page, - }); - }; - } - else { - getNextPagePromise = (pageResult) => { - const lastId = getLastId(pageResult, reverseIteration); - return self._makeRequest(requestArgs, spec, { - [reverseIteration ? 'ending_before' : 'starting_after']: lastId, - }); - }; - } - function iterate(pageResult) { - if (!(pageResult && - pageResult.data && - typeof pageResult.data.length === 'number')) { - throw Error('Unexpected: Stripe API response does not have a well-formed `data` array.'); - } - if (i < pageResult.data.length) { - const idx = reverseIteration ? pageResult.data.length - 1 - i : i; - const value = pageResult.data[idx]; - i += 1; - return { value, done: false }; - } - else if (pageResult.has_more) { - // Reset counter, request next page, and recurse. - i = 0; - pagePromise = getNextPagePromise(pageResult); - return pagePromise.then(iterate); - } - return { value: undefined, done: true }; - } - function asyncIteratorNext() { - return memoizedPromise(promiseCache, (resolve, reject) => { - return pagePromise - .then(iterate) - .then(resolve) - .catch(reject); - }); - } - const autoPagingEach = makeAutoPagingEach(asyncIteratorNext); - const autoPagingToArray = makeAutoPagingToArray(autoPagingEach); - const autoPaginationMethods = { - autoPagingEach, - autoPagingToArray, - // Async iterator functions: - next: asyncIteratorNext, - return: () => { - // This is required for `break`. - return {}; - }, - [getAsyncIteratorSymbol()]: () => { - return autoPaginationMethods; - }, - }; - return autoPaginationMethods; -} -/** - * ---------------- - * Private Helpers: - * ---------------- - */ -function getAsyncIteratorSymbol() { - if (typeof Symbol !== 'undefined' && Symbol.asyncIterator) { - return Symbol.asyncIterator; - } - // Follow the convention from libraries like iterall: https://github.com/leebyron/iterall#asynciterator-1 - return '@@asyncIterator'; -} -function getDoneCallback(args) { - if (args.length < 2) { - return null; - } - const onDone = args[1]; - if (typeof onDone !== 'function') { - throw Error(`The second argument to autoPagingEach, if present, must be a callback function; received ${typeof onDone}`); - } - return onDone; -} -/** - * We allow four forms of the `onItem` callback (the middle two being equivalent), - * - * 1. `.autoPagingEach((item) => { doSomething(item); return false; });` - * 2. `.autoPagingEach(async (item) => { await doSomething(item); return false; });` - * 3. `.autoPagingEach((item) => doSomething(item).then(() => false));` - * 4. `.autoPagingEach((item, next) => { doSomething(item); next(false); });` - * - * In addition to standard validation, this helper - * coalesces the former forms into the latter form. - */ -function getItemCallback(args) { - if (args.length === 0) { - return undefined; - } - const onItem = args[0]; - if (typeof onItem !== 'function') { - throw Error(`The first argument to autoPagingEach, if present, must be a callback function; received ${typeof onItem}`); - } - // 4. `.autoPagingEach((item, next) => { doSomething(item); next(false); });` - if (onItem.length === 2) { - return onItem; - } - if (onItem.length > 2) { - throw Error(`The \`onItem\` callback function passed to autoPagingEach must accept at most two arguments; got ${onItem}`); - } - // This magically handles all three of these usecases (the latter two being functionally identical): - // 1. `.autoPagingEach((item) => { doSomething(item); return false; });` - // 2. `.autoPagingEach(async (item) => { await doSomething(item); return false; });` - // 3. `.autoPagingEach((item) => doSomething(item).then(() => false));` - return function _onItem(item, next) { - const shouldContinue = onItem(item); - next(shouldContinue); - }; -} -function getLastId(listResult, reverseIteration) { - const lastIdx = reverseIteration ? 0 : listResult.data.length - 1; - const lastItem = listResult.data[lastIdx]; - const lastId = lastItem && lastItem.id; - if (!lastId) { - throw Error('Unexpected: No `id` found on the last item while auto-paging a list.'); - } - return lastId; -} -/** - * If a user calls `.next()` multiple times in parallel, - * return the same result until something has resolved - * to prevent page-turning race conditions. - */ -function memoizedPromise(promiseCache, cb) { - if (promiseCache.currentPromise) { - return promiseCache.currentPromise; - } - promiseCache.currentPromise = new Promise(cb).then((ret) => { - promiseCache.currentPromise = undefined; - return ret; - }); - return promiseCache.currentPromise; -} -function makeAutoPagingEach(asyncIteratorNext) { - return function autoPagingEach( /* onItem?, onDone? */) { - const args = [].slice.call(arguments); - const onItem = getItemCallback(args); - const onDone = getDoneCallback(args); - if (args.length > 2) { - throw Error(`autoPagingEach takes up to two arguments; received ${args}`); - } - const autoPagePromise = wrapAsyncIteratorWithCallback(asyncIteratorNext, - // @ts-ignore we might need a null check - onItem); - return callbackifyPromiseWithTimeout(autoPagePromise, onDone); - }; -} -function makeAutoPagingToArray(autoPagingEach) { - return function autoPagingToArray(opts, onDone) { - const limit = opts && opts.limit; - if (!limit) { - throw Error('You must pass a `limit` option to autoPagingToArray, e.g., `autoPagingToArray({limit: 1000});`.'); - } - if (limit > 10000) { - throw Error('You cannot specify a limit of more than 10,000 items to fetch in `autoPagingToArray`; use `autoPagingEach` to iterate through longer lists.'); - } - const promise = new Promise((resolve, reject) => { - const items = []; - autoPagingEach((item) => { - items.push(item); - if (items.length >= limit) { - return false; - } - }) - .then(() => { - resolve(items); - }) - .catch(reject); - }); - // @ts-ignore - return callbackifyPromiseWithTimeout(promise, onDone); - }; -} -function wrapAsyncIteratorWithCallback(asyncIteratorNext, onItem) { - return new Promise((resolve, reject) => { - function handleIteration(iterResult) { - if (iterResult.done) { - resolve(); - return; - } - const item = iterResult.value; - return new Promise((next) => { - // Bit confusing, perhaps; we pass a `resolve` fn - // to the user, so they can decide when and if to continue. - // They can return false, or a promise which resolves to false, to break. - onItem(item, next); - }).then((shouldContinue) => { - if (shouldContinue === false) { - return handleIteration({ done: true }); - } - else { - return asyncIteratorNext().then(handleIteration); - } - }); - } - asyncIteratorNext() - .then(handleIteration) - .catch(reject); - }); -} -function isReverseIteration(requestArgs) { - const args = [].slice.call(requestArgs); - const dataFromArgs = getDataFromArgs(args); - return !!dataFromArgs.ending_before; -} diff --git a/esm/crypto/CryptoProvider.js b/esm/crypto/CryptoProvider.js deleted file mode 100644 index 5bf141d9e8..0000000000 --- a/esm/crypto/CryptoProvider.js +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Interface encapsulating the various crypto computations used by the library, - * allowing pluggable underlying crypto implementations. - */ -export class CryptoProvider { - /** - * Computes a SHA-256 HMAC given a secret and a payload (encoded in UTF-8). - * The output HMAC should be encoded in hexadecimal. - * - * Sample values for implementations: - * - computeHMACSignature('', 'test_secret') => 'f7f9bd47fb987337b5796fdc1fdb9ba221d0d5396814bfcaf9521f43fd8927fd' - * - computeHMACSignature('\ud83d\ude00', 'test_secret') => '837da296d05c4fe31f61d5d7ead035099d9585a5bcde87de952012a78f0b0c43 - */ - computeHMACSignature(payload, secret) { - throw new Error('computeHMACSignature not implemented.'); - } - /** - * Asynchronous version of `computeHMACSignature`. Some implementations may - * only allow support async signature computation. - * - * Computes a SHA-256 HMAC given a secret and a payload (encoded in UTF-8). - * The output HMAC should be encoded in hexadecimal. - * - * Sample values for implementations: - * - computeHMACSignature('', 'test_secret') => 'f7f9bd47fb987337b5796fdc1fdb9ba221d0d5396814bfcaf9521f43fd8927fd' - * - computeHMACSignature('\ud83d\ude00', 'test_secret') => '837da296d05c4fe31f61d5d7ead035099d9585a5bcde87de952012a78f0b0c43 - */ - computeHMACSignatureAsync(payload, secret) { - throw new Error('computeHMACSignatureAsync not implemented.'); - } -} diff --git a/esm/crypto/NodeCryptoProvider.js b/esm/crypto/NodeCryptoProvider.js deleted file mode 100644 index 52d6485d0b..0000000000 --- a/esm/crypto/NodeCryptoProvider.js +++ /dev/null @@ -1,19 +0,0 @@ -import * as crypto from 'crypto'; -import { CryptoProvider } from './CryptoProvider.js'; -/** - * `CryptoProvider which uses the Node `crypto` package for its computations. - */ -export class NodeCryptoProvider extends CryptoProvider { - /** @override */ - computeHMACSignature(payload, secret) { - return crypto - .createHmac('sha256', secret) - .update(payload, 'utf8') - .digest('hex'); - } - /** @override */ - async computeHMACSignatureAsync(payload, secret) { - const signature = await this.computeHMACSignature(payload, secret); - return signature; - } -} diff --git a/esm/crypto/SubtleCryptoProvider.js b/esm/crypto/SubtleCryptoProvider.js deleted file mode 100644 index 1e6fb4d244..0000000000 --- a/esm/crypto/SubtleCryptoProvider.js +++ /dev/null @@ -1,43 +0,0 @@ -import { CryptoProvider } from './CryptoProvider.js'; -/** - * `CryptoProvider which uses the SubtleCrypto interface of the Web Crypto API. - * - * This only supports asynchronous operations. - */ -export class SubtleCryptoProvider extends CryptoProvider { - constructor(subtleCrypto) { - super(); - // If no subtle crypto is interface, default to the global namespace. This - // is to allow custom interfaces (eg. using the Node webcrypto interface in - // tests). - this.subtleCrypto = subtleCrypto || crypto.subtle; - } - /** @override */ - computeHMACSignature(payload, secret) { - throw new Error('SubtleCryptoProvider cannot be used in a synchronous context.'); - } - /** @override */ - async computeHMACSignatureAsync(payload, secret) { - const encoder = new TextEncoder(); - const key = await this.subtleCrypto.importKey('raw', encoder.encode(secret), { - name: 'HMAC', - hash: { name: 'SHA-256' }, - }, false, ['sign']); - const signatureBuffer = await this.subtleCrypto.sign('hmac', key, encoder.encode(payload)); - // crypto.subtle returns the signature in base64 format. This must be - // encoded in hex to match the CryptoProvider contract. We map each byte in - // the buffer to its corresponding hex octet and then combine into a string. - const signatureBytes = new Uint8Array(signatureBuffer); - const signatureHexCodes = new Array(signatureBytes.length); - for (let i = 0; i < signatureBytes.length; i++) { - signatureHexCodes[i] = byteHexMapping[signatureBytes[i]]; - } - return signatureHexCodes.join(''); - } -} -// Cached mapping of byte to hex representation. We do this once to avoid re- -// computing every time we need to convert the result of a signature to hex. -const byteHexMapping = new Array(256); -for (let i = 0; i < byteHexMapping.length; i++) { - byteHexMapping[i] = i.toString(16).padStart(2, '0'); -} diff --git a/esm/multipart.js b/esm/multipart.js deleted file mode 100644 index 4df244d81e..0000000000 --- a/esm/multipart.js +++ /dev/null @@ -1,54 +0,0 @@ -import { flattenAndStringify, stringifyRequestData } from './utils.js'; -// Method for formatting HTTP body for the multipart/form-data specification -// Mostly taken from Fermata.js -// https://github.com/natevw/fermata/blob/5d9732a33d776ce925013a265935facd1626cc88/fermata.js#L315-L343 -const multipartDataGenerator = (method, data, headers) => { - const segno = (Math.round(Math.random() * 1e16) + Math.round(Math.random() * 1e16)).toString(); - headers['Content-Type'] = `multipart/form-data; boundary=${segno}`; - const textEncoder = new TextEncoder(); - let buffer = new Uint8Array(0); - const endBuffer = textEncoder.encode('\r\n'); - function push(l) { - const prevBuffer = buffer; - const newBuffer = l instanceof Uint8Array ? l : new Uint8Array(textEncoder.encode(l)); - buffer = new Uint8Array(prevBuffer.length + newBuffer.length + 2); - buffer.set(prevBuffer); - buffer.set(newBuffer, prevBuffer.length); - buffer.set(endBuffer, buffer.length - 2); - } - function q(s) { - return `"${s.replace(/"|"/g, '%22').replace(/\r\n|\r|\n/g, ' ')}"`; - } - const flattenedData = flattenAndStringify(data); - for (const k in flattenedData) { - const v = flattenedData[k]; - push(`--${segno}`); - if (Object.prototype.hasOwnProperty.call(v, 'data')) { - const typedEntry = v; - push(`Content-Disposition: form-data; name=${q(k)}; filename=${q(typedEntry.name || 'blob')}`); - push(`Content-Type: ${typedEntry.type || 'application/octet-stream'}`); - push(''); - push(typedEntry.data); - } - else { - push(`Content-Disposition: form-data; name=${q(k)}`); - push(''); - push(v); - } - } - push(`--${segno}--`); - return buffer; -}; -export function multipartRequestDataProcessor(method, data, headers, callback) { - data = data || {}; - if (method !== 'POST') { - return callback(null, stringifyRequestData(data)); - } - this._stripe._platformFunctions - .tryBufferData(data) - .then((bufferedData) => { - const buffer = multipartDataGenerator(method, bufferedData, headers); - return callback(null, buffer); - }) - .catch((err) => callback(err, null)); -} diff --git a/esm/net/FetchHttpClient.js b/esm/net/FetchHttpClient.js deleted file mode 100644 index b313ec2429..0000000000 --- a/esm/net/FetchHttpClient.js +++ /dev/null @@ -1,101 +0,0 @@ -import { HttpClient, HttpClientResponse } from './HttpClient.js'; -/** - * HTTP client which uses a `fetch` function to issue requests. - * - * By default relies on the global `fetch` function, but an optional function - * can be passed in. If passing in a function, it is expected to match the Web - * Fetch API. As an example, this could be the function provided by the - * node-fetch package (https://github.com/node-fetch/node-fetch). - */ -export class FetchHttpClient extends HttpClient { - constructor(fetchFn) { - super(); - this._fetchFn = fetchFn; - } - /** @override. */ - getClientName() { - return 'fetch'; - } - makeRequest(host, port, path, method, headers, requestData, protocol, timeout) { - const isInsecureConnection = protocol === 'http'; - const url = new URL(path, `${isInsecureConnection ? 'http' : 'https'}://${host}`); - url.port = port; - // For methods which expect payloads, we should always pass a body value - // even when it is empty. Without this, some JS runtimes (eg. Deno) will - // inject a second Content-Length header. See https://github.com/stripe/stripe-node/issues/1519 - // for more details. - const methodHasPayload = method == 'POST' || method == 'PUT' || method == 'PATCH'; - const body = requestData || (methodHasPayload ? '' : undefined); - const fetchFn = this._fetchFn || fetch; - const fetchPromise = fetchFn(url.toString(), { - method, - // @ts-ignore - headers, - // @ts-ignore - body, - }); - // The Fetch API does not support passing in a timeout natively, so a - // timeout promise is constructed to race against the fetch and preempt the - // request, simulating a timeout. - // - // This timeout behavior differs from Node: - // - Fetch uses a single timeout for the entire length of the request. - // - Node is more fine-grained and resets the timeout after each stage of - // the request. - // - // As an example, if the timeout is set to 30s and the connection takes 20s - // to be established followed by 20s for the body, Fetch would timeout but - // Node would not. The more fine-grained timeout cannot be implemented with - // fetch. - let pendingTimeoutId; - const timeoutPromise = new Promise((_, reject) => { - pendingTimeoutId = setTimeout(() => { - pendingTimeoutId = null; - reject(HttpClient.makeTimeoutError()); - }, timeout); - }); - return Promise.race([fetchPromise, timeoutPromise]) - .then((res) => { - return new FetchHttpClientResponse(res); - }) - .finally(() => { - if (pendingTimeoutId) { - clearTimeout(pendingTimeoutId); - } - }); - } -} -export class FetchHttpClientResponse extends HttpClientResponse { - constructor(res) { - super(res.status, FetchHttpClientResponse._transformHeadersToObject(res.headers)); - this._res = res; - } - getRawResponse() { - return this._res; - } - toStream(streamCompleteCallback) { - // Unfortunately `fetch` does not have event handlers for when the stream is - // completely read. We therefore invoke the streamCompleteCallback right - // away. This callback emits a response event with metadata and completes - // metrics, so it's ok to do this without waiting for the stream to be - // completely read. - streamCompleteCallback(); - // Fetch's `body` property is expected to be a readable stream of the body. - return this._res.body; - } - toJSON() { - return this._res.json(); - } - static _transformHeadersToObject(headers) { - // Fetch uses a Headers instance so this must be converted to a barebones - // JS object to meet the HttpClient interface. - const headersObj = {}; - for (const entry of headers) { - if (!Array.isArray(entry) || entry.length != 2) { - throw new Error('Response objects produced by the fetch function given to FetchHttpClient do not have an iterable headers map. Response#headers should be an iterable object.'); - } - headersObj[entry[0]] = entry[1]; - } - return headersObj; - } -} diff --git a/esm/net/HttpClient.js b/esm/net/HttpClient.js deleted file mode 100644 index a25056ebd1..0000000000 --- a/esm/net/HttpClient.js +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Encapsulates the logic for issuing a request to the Stripe API. - * - * A custom HTTP client should should implement: - * 1. A response class which extends HttpClientResponse and wraps around their - * own internal representation of a response. - * 2. A client class which extends HttpClient and implements all methods, - * returning their own response class when making requests. - */ -export class HttpClient { - /** The client name used for diagnostics. */ - getClientName() { - throw new Error('getClientName not implemented.'); - } - makeRequest(host, port, path, method, headers, requestData, protocol, timeout) { - throw new Error('makeRequest not implemented.'); - } - /** Helper to make a consistent timeout error across implementations. */ - static makeTimeoutError() { - const timeoutErr = new TypeError(HttpClient.TIMEOUT_ERROR_CODE); - timeoutErr.code = HttpClient.TIMEOUT_ERROR_CODE; - return timeoutErr; - } -} -// Public API accessible via Stripe.HttpClient -HttpClient.CONNECTION_CLOSED_ERROR_CODES = ['ECONNRESET', 'EPIPE']; -HttpClient.TIMEOUT_ERROR_CODE = 'ETIMEDOUT'; -export class HttpClientResponse { - constructor(statusCode, headers) { - this._statusCode = statusCode; - this._headers = headers; - } - getStatusCode() { - return this._statusCode; - } - getHeaders() { - return this._headers; - } - getRawResponse() { - throw new Error('getRawResponse not implemented.'); - } - toStream(streamCompleteCallback) { - throw new Error('toStream not implemented.'); - } - toJSON() { - throw new Error('toJSON not implemented.'); - } -} diff --git a/esm/net/NodeHttpClient.js b/esm/net/NodeHttpClient.js deleted file mode 100644 index 4566296a24..0000000000 --- a/esm/net/NodeHttpClient.js +++ /dev/null @@ -1,95 +0,0 @@ -import * as http from 'http'; -import * as https from 'https'; -import { HttpClient, HttpClientResponse } from './HttpClient.js'; -const defaultHttpAgent = new http.Agent({ keepAlive: true }); -const defaultHttpsAgent = new https.Agent({ keepAlive: true }); -/** - * HTTP client which uses the Node `http` and `https` packages to issue - * requests.` - */ -export class NodeHttpClient extends HttpClient { - constructor(agent) { - super(); - this._agent = agent; - } - /** @override. */ - getClientName() { - return 'node'; - } - makeRequest(host, port, path, method, headers, requestData, protocol, timeout) { - const isInsecureConnection = protocol === 'http'; - let agent = this._agent; - if (!agent) { - agent = isInsecureConnection ? defaultHttpAgent : defaultHttpsAgent; - } - const requestPromise = new Promise((resolve, reject) => { - const req = (isInsecureConnection ? http : https).request({ - host: host, - port: port, - path, - method, - agent, - headers, - ciphers: 'DEFAULT:!aNULL:!eNULL:!LOW:!EXPORT:!SSLv2:!MD5', - }); - req.setTimeout(timeout, () => { - req.destroy(HttpClient.makeTimeoutError()); - }); - req.on('response', (res) => { - resolve(new NodeHttpClientResponse(res)); - }); - req.on('error', (error) => { - reject(error); - }); - req.once('socket', (socket) => { - if (socket.connecting) { - socket.once(isInsecureConnection ? 'connect' : 'secureConnect', () => { - // Send payload; we're safe: - req.write(requestData); - req.end(); - }); - } - else { - // we're already connected - req.write(requestData); - req.end(); - } - }); - }); - return requestPromise; - } -} -export class NodeHttpClientResponse extends HttpClientResponse { - constructor(res) { - // @ts-ignore - super(res.statusCode, res.headers || {}); - this._res = res; - } - getRawResponse() { - return this._res; - } - toStream(streamCompleteCallback) { - // The raw response is itself the stream, so we just return that. To be - // backwards compatible, we should invoke the streamCompleteCallback only - // once the stream has been fully consumed. - this._res.once('end', () => streamCompleteCallback()); - return this._res; - } - toJSON() { - return new Promise((resolve, reject) => { - let response = ''; - this._res.setEncoding('utf8'); - this._res.on('data', (chunk) => { - response += chunk; - }); - this._res.once('end', () => { - try { - resolve(JSON.parse(response)); - } - catch (e) { - reject(e); - } - }); - }); - } -} diff --git a/esm/package.json b/esm/package.json deleted file mode 100644 index 089153bcb5..0000000000 --- a/esm/package.json +++ /dev/null @@ -1 +0,0 @@ -{"type":"module"} diff --git a/esm/platform/NodePlatformFunctions.js b/esm/platform/NodePlatformFunctions.js deleted file mode 100644 index 9dd7363718..0000000000 --- a/esm/platform/NodePlatformFunctions.js +++ /dev/null @@ -1,122 +0,0 @@ -import * as crypto from 'crypto'; -import { EventEmitter } from 'events'; -import { NodeCryptoProvider } from '../crypto/NodeCryptoProvider.js'; -import { NodeHttpClient } from '../net/NodeHttpClient.js'; -import { PlatformFunctions } from './PlatformFunctions.js'; -import { StripeError } from '../Error.js'; -import { concat } from '../utils.js'; -import { exec } from 'child_process'; -class StreamProcessingError extends StripeError { -} -/** - * Specializes WebPlatformFunctions using APIs available in Node.js. - */ -export class NodePlatformFunctions extends PlatformFunctions { - constructor() { - super(); - this._exec = exec; - this._UNAME_CACHE = null; - } - /** @override */ - uuid4() { - // available in: v14.17.x+ - if (crypto.randomUUID) { - return crypto.randomUUID(); - } - return super.uuid4(); - } - /** - * @override - * Node's built in `exec` function sometimes throws outright, - * and sometimes has a callback with an error, - * depending on the type of error. - * - * This unifies that interface by resolving with a null uname - * if an error is encountered. - */ - getUname() { - if (!this._UNAME_CACHE) { - this._UNAME_CACHE = new Promise((resolve, reject) => { - try { - this._exec('uname -a', (err, uname) => { - if (err) { - return resolve(null); - } - resolve(uname); - }); - } - catch (e) { - resolve(null); - } - }); - } - return this._UNAME_CACHE; - } - /** - * @override - * Secure compare, from https://github.com/freewil/scmp - */ - secureCompare(a, b) { - if (!a || !b) { - throw new Error('secureCompare must receive two arguments'); - } - // return early here if buffer lengths are not equal since timingSafeEqual - // will throw if buffer lengths are not equal - if (a.length !== b.length) { - return false; - } - // use crypto.timingSafeEqual if available (since Node.js v6.6.0), - // otherwise use our own scmp-internal function. - if (crypto.timingSafeEqual) { - const textEncoder = new TextEncoder(); - const aEncoded = textEncoder.encode(a); - const bEncoded = textEncoder.encode(b); - return crypto.timingSafeEqual(aEncoded, bEncoded); - } - return super.secureCompare(a, b); - } - createEmitter() { - return new EventEmitter(); - } - /** @override */ - tryBufferData(data) { - if (!(data.file.data instanceof EventEmitter)) { - return Promise.resolve(data); - } - const bufferArray = []; - return new Promise((resolve, reject) => { - data.file.data - .on('data', (line) => { - bufferArray.push(line); - }) - .once('end', () => { - // @ts-ignore - const bufferData = Object.assign({}, data); - bufferData.file.data = concat(bufferArray); - resolve(bufferData); - }) - .on('error', (err) => { - reject(new StreamProcessingError({ - message: 'An error occurred while attempting to process the file for upload.', - detail: err, - })); - }); - }); - } - /** @override */ - createNodeHttpClient(agent) { - return new NodeHttpClient(agent); - } - /** @override */ - createDefaultHttpClient() { - return new NodeHttpClient(); - } - /** @override */ - createNodeCryptoProvider() { - return new NodeCryptoProvider(); - } - /** @override */ - createDefaultCryptoProvider() { - return this.createNodeCryptoProvider(); - } -} diff --git a/esm/platform/PlatformFunctions.js b/esm/platform/PlatformFunctions.js deleted file mode 100644 index e6789d068e..0000000000 --- a/esm/platform/PlatformFunctions.js +++ /dev/null @@ -1,94 +0,0 @@ -import { FetchHttpClient } from '../net/FetchHttpClient.js'; -import { SubtleCryptoProvider } from '../crypto/SubtleCryptoProvider.js'; -/** - * Interface encapsulating various utility functions whose - * implementations depend on the platform / JS runtime. - */ -export class PlatformFunctions { - constructor() { - this._fetchFn = null; - this._agent = null; - } - /** - * Gets uname with Node's built-in `exec` function, if available. - */ - getUname() { - throw new Error('getUname not implemented.'); - } - /** - * Generates a v4 UUID. See https://stackoverflow.com/a/2117523 - */ - uuid4() { - return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => { - const r = (Math.random() * 16) | 0; - const v = c === 'x' ? r : (r & 0x3) | 0x8; - return v.toString(16); - }); - } - /** - * Compares strings in constant time. - */ - secureCompare(a, b) { - // return early here if buffer lengths are not equal - if (a.length !== b.length) { - return false; - } - const len = a.length; - let result = 0; - for (let i = 0; i < len; ++i) { - result |= a.charCodeAt(i) ^ b.charCodeAt(i); - } - return result === 0; - } - /** - * Creates an event emitter. - */ - createEmitter() { - throw new Error('createEmitter not implemented.'); - } - /** - * Checks if the request data is a stream. If so, read the entire stream - * to a buffer and return the buffer. - */ - tryBufferData(data) { - throw new Error('tryBufferData not implemented.'); - } - /** - * Creates an HTTP client which uses the Node `http` and `https` packages - * to issue requests. - */ - createNodeHttpClient(agent) { - throw new Error('createNodeHttpClient not implemented.'); - } - /** - * Creates an HTTP client for issuing Stripe API requests which uses the Web - * Fetch API. - * - * A fetch function can optionally be passed in as a parameter. If none is - * passed, will default to the default `fetch` function in the global scope. - */ - createFetchHttpClient(fetchFn) { - return new FetchHttpClient(fetchFn); - } - /** - * Creates an HTTP client using runtime-specific APIs. - */ - createDefaultHttpClient() { - throw new Error('createDefaultHttpClient not implemented.'); - } - /** - * Creates a CryptoProvider which uses the Node `crypto` package for its computations. - */ - createNodeCryptoProvider() { - throw new Error('createNodeCryptoProvider not implemented.'); - } - /** - * Creates a CryptoProvider which uses the SubtleCrypto interface of the Web Crypto API. - */ - createSubtleCryptoProvider(subtleCrypto) { - return new SubtleCryptoProvider(subtleCrypto); - } - createDefaultCryptoProvider() { - throw new Error('createDefaultCryptoProvider not implemented.'); - } -} diff --git a/esm/platform/WebPlatformFunctions.js b/esm/platform/WebPlatformFunctions.js deleted file mode 100644 index aa9fc2a999..0000000000 --- a/esm/platform/WebPlatformFunctions.js +++ /dev/null @@ -1,38 +0,0 @@ -import { PlatformFunctions } from './PlatformFunctions.js'; -import { StripeEmitter } from '../StripeEmitter.js'; -/** - * Specializes WebPlatformFunctions using APIs available in Web workers. - */ -export class WebPlatformFunctions extends PlatformFunctions { - /** @override */ - getUname() { - return Promise.resolve(null); - } - /** @override */ - createEmitter() { - return new StripeEmitter(); - } - /** @override */ - tryBufferData(data) { - if (data.file.data instanceof ReadableStream) { - throw new Error('Uploading a file as a stream is not supported in non-Node environments. Please open or upvote an issue at github.com/stripe/stripe-node if you use this, detailing your use-case.'); - } - return Promise.resolve(data); - } - /** @override */ - createNodeHttpClient() { - throw new Error('Stripe: `createNodeHttpClient()` is not available in non-Node environments. Please use `createFetchHttpClient()` instead.'); - } - /** @override */ - createDefaultHttpClient() { - return super.createFetchHttpClient(); - } - /** @override */ - createNodeCryptoProvider() { - throw new Error('Stripe: `createNodeCryptoProvider()` is not available in non-Node environments. Please use `createSubtleCryptoProvider()` instead.'); - } - /** @override */ - createDefaultCryptoProvider() { - return this.createSubtleCryptoProvider(); - } -} diff --git a/esm/resources.js b/esm/resources.js deleted file mode 100644 index 4308190b31..0000000000 --- a/esm/resources.js +++ /dev/null @@ -1,160 +0,0 @@ -// File generated from our OpenAPI spec -import { resourceNamespace } from './ResourceNamespace.js'; -import { Accounts as FinancialConnectionsAccounts } from './resources/FinancialConnections/Accounts.js'; -import { Authorizations as IssuingAuthorizations } from './resources/Issuing/Authorizations.js'; -import { Cardholders as IssuingCardholders } from './resources/Issuing/Cardholders.js'; -import { Cards as TestHelpersIssuingCards } from './resources/TestHelpers/Issuing/Cards.js'; -import { Cards as IssuingCards } from './resources/Issuing/Cards.js'; -import { Configurations as BillingPortalConfigurations } from './resources/BillingPortal/Configurations.js'; -import { Configurations as TerminalConfigurations } from './resources/Terminal/Configurations.js'; -import { ConnectionTokens as TerminalConnectionTokens } from './resources/Terminal/ConnectionTokens.js'; -import { CreditReversals as TreasuryCreditReversals } from './resources/Treasury/CreditReversals.js'; -import { Customers as TestHelpersCustomers } from './resources/TestHelpers/Customers.js'; -import { DebitReversals as TreasuryDebitReversals } from './resources/Treasury/DebitReversals.js'; -import { Disputes as IssuingDisputes } from './resources/Issuing/Disputes.js'; -import { EarlyFraudWarnings as RadarEarlyFraudWarnings } from './resources/Radar/EarlyFraudWarnings.js'; -import { FinancialAccounts as TreasuryFinancialAccounts } from './resources/Treasury/FinancialAccounts.js'; -import { InboundTransfers as TestHelpersTreasuryInboundTransfers } from './resources/TestHelpers/Treasury/InboundTransfers.js'; -import { InboundTransfers as TreasuryInboundTransfers } from './resources/Treasury/InboundTransfers.js'; -import { Locations as TerminalLocations } from './resources/Terminal/Locations.js'; -import { OutboundPayments as TestHelpersTreasuryOutboundPayments } from './resources/TestHelpers/Treasury/OutboundPayments.js'; -import { OutboundPayments as TreasuryOutboundPayments } from './resources/Treasury/OutboundPayments.js'; -import { OutboundTransfers as TestHelpersTreasuryOutboundTransfers } from './resources/TestHelpers/Treasury/OutboundTransfers.js'; -import { OutboundTransfers as TreasuryOutboundTransfers } from './resources/Treasury/OutboundTransfers.js'; -import { Readers as TestHelpersTerminalReaders } from './resources/TestHelpers/Terminal/Readers.js'; -import { Readers as TerminalReaders } from './resources/Terminal/Readers.js'; -import { ReceivedCredits as TestHelpersTreasuryReceivedCredits } from './resources/TestHelpers/Treasury/ReceivedCredits.js'; -import { ReceivedCredits as TreasuryReceivedCredits } from './resources/Treasury/ReceivedCredits.js'; -import { ReceivedDebits as TestHelpersTreasuryReceivedDebits } from './resources/TestHelpers/Treasury/ReceivedDebits.js'; -import { ReceivedDebits as TreasuryReceivedDebits } from './resources/Treasury/ReceivedDebits.js'; -import { Refunds as TestHelpersRefunds } from './resources/TestHelpers/Refunds.js'; -import { ReportRuns as ReportingReportRuns } from './resources/Reporting/ReportRuns.js'; -import { ReportTypes as ReportingReportTypes } from './resources/Reporting/ReportTypes.js'; -import { ScheduledQueryRuns as SigmaScheduledQueryRuns } from './resources/Sigma/ScheduledQueryRuns.js'; -import { Secrets as AppsSecrets } from './resources/Apps/Secrets.js'; -import { Sessions as BillingPortalSessions } from './resources/BillingPortal/Sessions.js'; -import { Sessions as CheckoutSessions } from './resources/Checkout/Sessions.js'; -import { Sessions as FinancialConnectionsSessions } from './resources/FinancialConnections/Sessions.js'; -import { TestClocks as TestHelpersTestClocks } from './resources/TestHelpers/TestClocks.js'; -import { TransactionEntries as TreasuryTransactionEntries } from './resources/Treasury/TransactionEntries.js'; -import { Transactions as IssuingTransactions } from './resources/Issuing/Transactions.js'; -import { Transactions as TreasuryTransactions } from './resources/Treasury/Transactions.js'; -import { ValueListItems as RadarValueListItems } from './resources/Radar/ValueListItems.js'; -import { ValueLists as RadarValueLists } from './resources/Radar/ValueLists.js'; -import { VerificationReports as IdentityVerificationReports } from './resources/Identity/VerificationReports.js'; -import { VerificationSessions as IdentityVerificationSessions } from './resources/Identity/VerificationSessions.js'; -export { Accounts as Account } from './resources/Accounts.js'; -export { OAuth } from './resources/OAuth.js'; -export { Accounts } from './resources/Accounts.js'; -export { AccountLinks } from './resources/AccountLinks.js'; -export { ApplePayDomains } from './resources/ApplePayDomains.js'; -export { ApplicationFees } from './resources/ApplicationFees.js'; -export { Balance } from './resources/Balance.js'; -export { BalanceTransactions } from './resources/BalanceTransactions.js'; -export { Charges } from './resources/Charges.js'; -export { CountrySpecs } from './resources/CountrySpecs.js'; -export { Coupons } from './resources/Coupons.js'; -export { CreditNotes } from './resources/CreditNotes.js'; -export { Customers } from './resources/Customers.js'; -export { Disputes } from './resources/Disputes.js'; -export { EphemeralKeys } from './resources/EphemeralKeys.js'; -export { Events } from './resources/Events.js'; -export { ExchangeRates } from './resources/ExchangeRates.js'; -export { Files } from './resources/Files.js'; -export { FileLinks } from './resources/FileLinks.js'; -export { Invoices } from './resources/Invoices.js'; -export { InvoiceItems } from './resources/InvoiceItems.js'; -export { Mandates } from './resources/Mandates.js'; -export { PaymentIntents } from './resources/PaymentIntents.js'; -export { PaymentLinks } from './resources/PaymentLinks.js'; -export { PaymentMethods } from './resources/PaymentMethods.js'; -export { Payouts } from './resources/Payouts.js'; -export { Plans } from './resources/Plans.js'; -export { Prices } from './resources/Prices.js'; -export { Products } from './resources/Products.js'; -export { PromotionCodes } from './resources/PromotionCodes.js'; -export { Quotes } from './resources/Quotes.js'; -export { Refunds } from './resources/Refunds.js'; -export { Reviews } from './resources/Reviews.js'; -export { SetupAttempts } from './resources/SetupAttempts.js'; -export { SetupIntents } from './resources/SetupIntents.js'; -export { ShippingRates } from './resources/ShippingRates.js'; -export { Sources } from './resources/Sources.js'; -export { Subscriptions } from './resources/Subscriptions.js'; -export { SubscriptionItems } from './resources/SubscriptionItems.js'; -export { SubscriptionSchedules } from './resources/SubscriptionSchedules.js'; -export { TaxCodes } from './resources/TaxCodes.js'; -export { TaxRates } from './resources/TaxRates.js'; -export { Tokens } from './resources/Tokens.js'; -export { Topups } from './resources/Topups.js'; -export { Transfers } from './resources/Transfers.js'; -export { WebhookEndpoints } from './resources/WebhookEndpoints.js'; -export const Apps = resourceNamespace('apps', { Secrets: AppsSecrets }); -export const BillingPortal = resourceNamespace('billingPortal', { - Configurations: BillingPortalConfigurations, - Sessions: BillingPortalSessions, -}); -export const Checkout = resourceNamespace('checkout', { - Sessions: CheckoutSessions, -}); -export const FinancialConnections = resourceNamespace('financialConnections', { - Accounts: FinancialConnectionsAccounts, - Sessions: FinancialConnectionsSessions, -}); -export const Identity = resourceNamespace('identity', { - VerificationReports: IdentityVerificationReports, - VerificationSessions: IdentityVerificationSessions, -}); -export const Issuing = resourceNamespace('issuing', { - Authorizations: IssuingAuthorizations, - Cardholders: IssuingCardholders, - Cards: IssuingCards, - Disputes: IssuingDisputes, - Transactions: IssuingTransactions, -}); -export const Radar = resourceNamespace('radar', { - EarlyFraudWarnings: RadarEarlyFraudWarnings, - ValueListItems: RadarValueListItems, - ValueLists: RadarValueLists, -}); -export const Reporting = resourceNamespace('reporting', { - ReportRuns: ReportingReportRuns, - ReportTypes: ReportingReportTypes, -}); -export const Sigma = resourceNamespace('sigma', { - ScheduledQueryRuns: SigmaScheduledQueryRuns, -}); -export const Terminal = resourceNamespace('terminal', { - Configurations: TerminalConfigurations, - ConnectionTokens: TerminalConnectionTokens, - Locations: TerminalLocations, - Readers: TerminalReaders, -}); -export const TestHelpers = resourceNamespace('testHelpers', { - Customers: TestHelpersCustomers, - Refunds: TestHelpersRefunds, - TestClocks: TestHelpersTestClocks, - Issuing: resourceNamespace('issuing', { Cards: TestHelpersIssuingCards }), - Terminal: resourceNamespace('terminal', { - Readers: TestHelpersTerminalReaders, - }), - Treasury: resourceNamespace('treasury', { - InboundTransfers: TestHelpersTreasuryInboundTransfers, - OutboundPayments: TestHelpersTreasuryOutboundPayments, - OutboundTransfers: TestHelpersTreasuryOutboundTransfers, - ReceivedCredits: TestHelpersTreasuryReceivedCredits, - ReceivedDebits: TestHelpersTreasuryReceivedDebits, - }), -}); -export const Treasury = resourceNamespace('treasury', { - CreditReversals: TreasuryCreditReversals, - DebitReversals: TreasuryDebitReversals, - FinancialAccounts: TreasuryFinancialAccounts, - InboundTransfers: TreasuryInboundTransfers, - OutboundPayments: TreasuryOutboundPayments, - OutboundTransfers: TreasuryOutboundTransfers, - ReceivedCredits: TreasuryReceivedCredits, - ReceivedDebits: TreasuryReceivedDebits, - TransactionEntries: TreasuryTransactionEntries, - Transactions: TreasuryTransactions, -}); diff --git a/esm/resources/AccountLinks.js b/esm/resources/AccountLinks.js deleted file mode 100644 index d068a6af08..0000000000 --- a/esm/resources/AccountLinks.js +++ /dev/null @@ -1,9 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const AccountLinks = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/account_links', - }), -}); diff --git a/esm/resources/Accounts.js b/esm/resources/Accounts.js deleted file mode 100644 index 3c05ba38b2..0000000000 --- a/esm/resources/Accounts.js +++ /dev/null @@ -1,106 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../StripeResource.js'; -const stripeMethod = StripeResource.method; -// Since path can either be `account` or `accounts`, support both through stripeMethod path; -export const Accounts = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/accounts', - }), - retrieve(id, ...args) { - // No longer allow an api key to be passed as the first string to this function due to ambiguity between - // old account ids and api keys. To request the account for an api key, send null as the id - if (typeof id === 'string') { - return stripeMethod({ - method: 'GET', - fullPath: '/v1/accounts/{id}', - }).apply(this, [id, ...args]); - } - else { - if (id === null || id === undefined) { - // Remove id as stripeMethod would complain of unexpected argument - [].shift.apply([id, ...args]); - } - return stripeMethod({ - method: 'GET', - fullPath: '/v1/account', - }).apply(this, [id, ...args]); - } - }, - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/accounts/{account}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/accounts', - methodType: 'list', - }), - del: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/accounts/{account}', - }), - createExternalAccount: stripeMethod({ - method: 'POST', - fullPath: '/v1/accounts/{account}/external_accounts', - }), - createLoginLink: stripeMethod({ - method: 'POST', - fullPath: '/v1/accounts/{account}/login_links', - }), - createPerson: stripeMethod({ - method: 'POST', - fullPath: '/v1/accounts/{account}/persons', - }), - deleteExternalAccount: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/accounts/{account}/external_accounts/{id}', - }), - deletePerson: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/accounts/{account}/persons/{person}', - }), - listCapabilities: stripeMethod({ - method: 'GET', - fullPath: '/v1/accounts/{account}/capabilities', - methodType: 'list', - }), - listExternalAccounts: stripeMethod({ - method: 'GET', - fullPath: '/v1/accounts/{account}/external_accounts', - methodType: 'list', - }), - listPersons: stripeMethod({ - method: 'GET', - fullPath: '/v1/accounts/{account}/persons', - methodType: 'list', - }), - reject: stripeMethod({ - method: 'POST', - fullPath: '/v1/accounts/{account}/reject', - }), - retrieveCapability: stripeMethod({ - method: 'GET', - fullPath: '/v1/accounts/{account}/capabilities/{capability}', - }), - retrieveExternalAccount: stripeMethod({ - method: 'GET', - fullPath: '/v1/accounts/{account}/external_accounts/{id}', - }), - retrievePerson: stripeMethod({ - method: 'GET', - fullPath: '/v1/accounts/{account}/persons/{person}', - }), - updateCapability: stripeMethod({ - method: 'POST', - fullPath: '/v1/accounts/{account}/capabilities/{capability}', - }), - updateExternalAccount: stripeMethod({ - method: 'POST', - fullPath: '/v1/accounts/{account}/external_accounts/{id}', - }), - updatePerson: stripeMethod({ - method: 'POST', - fullPath: '/v1/accounts/{account}/persons/{person}', - }), -}); diff --git a/esm/resources/ApplePayDomains.js b/esm/resources/ApplePayDomains.js deleted file mode 100644 index 69b4780472..0000000000 --- a/esm/resources/ApplePayDomains.js +++ /dev/null @@ -1,22 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const ApplePayDomains = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/apple_pay/domains', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/apple_pay/domains/{domain}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/apple_pay/domains', - methodType: 'list', - }), - del: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/apple_pay/domains/{domain}', - }), -}); diff --git a/esm/resources/ApplicationFees.js b/esm/resources/ApplicationFees.js deleted file mode 100644 index e6a73bf8a2..0000000000 --- a/esm/resources/ApplicationFees.js +++ /dev/null @@ -1,31 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const ApplicationFees = StripeResource.extend({ - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/application_fees/{id}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/application_fees', - methodType: 'list', - }), - createRefund: stripeMethod({ - method: 'POST', - fullPath: '/v1/application_fees/{id}/refunds', - }), - listRefunds: stripeMethod({ - method: 'GET', - fullPath: '/v1/application_fees/{id}/refunds', - methodType: 'list', - }), - retrieveRefund: stripeMethod({ - method: 'GET', - fullPath: '/v1/application_fees/{fee}/refunds/{id}', - }), - updateRefund: stripeMethod({ - method: 'POST', - fullPath: '/v1/application_fees/{fee}/refunds/{id}', - }), -}); diff --git a/esm/resources/Apps/Secrets.js b/esm/resources/Apps/Secrets.js deleted file mode 100644 index 675b9c9782..0000000000 --- a/esm/resources/Apps/Secrets.js +++ /dev/null @@ -1,22 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const Secrets = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/apps/secrets', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/apps/secrets', - methodType: 'list', - }), - deleteWhere: stripeMethod({ - method: 'POST', - fullPath: '/v1/apps/secrets/delete', - }), - find: stripeMethod({ - method: 'GET', - fullPath: '/v1/apps/secrets/find', - }), -}); diff --git a/esm/resources/Balance.js b/esm/resources/Balance.js deleted file mode 100644 index bee896dde8..0000000000 --- a/esm/resources/Balance.js +++ /dev/null @@ -1,9 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const Balance = StripeResource.extend({ - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/balance', - }), -}); diff --git a/esm/resources/BalanceTransactions.js b/esm/resources/BalanceTransactions.js deleted file mode 100644 index 7f81c6127c..0000000000 --- a/esm/resources/BalanceTransactions.js +++ /dev/null @@ -1,14 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const BalanceTransactions = StripeResource.extend({ - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/balance_transactions/{id}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/balance_transactions', - methodType: 'list', - }), -}); diff --git a/esm/resources/BillingPortal/Configurations.js b/esm/resources/BillingPortal/Configurations.js deleted file mode 100644 index 69ac2eff18..0000000000 --- a/esm/resources/BillingPortal/Configurations.js +++ /dev/null @@ -1,22 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const Configurations = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/billing_portal/configurations', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/billing_portal/configurations/{configuration}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/billing_portal/configurations/{configuration}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/billing_portal/configurations', - methodType: 'list', - }), -}); diff --git a/esm/resources/BillingPortal/Sessions.js b/esm/resources/BillingPortal/Sessions.js deleted file mode 100644 index 648b2b3292..0000000000 --- a/esm/resources/BillingPortal/Sessions.js +++ /dev/null @@ -1,9 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const Sessions = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/billing_portal/sessions', - }), -}); diff --git a/esm/resources/Charges.js b/esm/resources/Charges.js deleted file mode 100644 index 1b5baabe79..0000000000 --- a/esm/resources/Charges.js +++ /dev/null @@ -1,31 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const Charges = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/charges', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/charges/{charge}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/charges/{charge}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/charges', - methodType: 'list', - }), - capture: stripeMethod({ - method: 'POST', - fullPath: '/v1/charges/{charge}/capture', - }), - search: stripeMethod({ - method: 'GET', - fullPath: '/v1/charges/search', - methodType: 'search', - }), -}); diff --git a/esm/resources/Checkout/Sessions.js b/esm/resources/Checkout/Sessions.js deleted file mode 100644 index 28736bc347..0000000000 --- a/esm/resources/Checkout/Sessions.js +++ /dev/null @@ -1,27 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const Sessions = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/checkout/sessions', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/checkout/sessions/{session}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/checkout/sessions', - methodType: 'list', - }), - expire: stripeMethod({ - method: 'POST', - fullPath: '/v1/checkout/sessions/{session}/expire', - }), - listLineItems: stripeMethod({ - method: 'GET', - fullPath: '/v1/checkout/sessions/{session}/line_items', - methodType: 'list', - }), -}); diff --git a/esm/resources/CountrySpecs.js b/esm/resources/CountrySpecs.js deleted file mode 100644 index ecd1c80c50..0000000000 --- a/esm/resources/CountrySpecs.js +++ /dev/null @@ -1,14 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const CountrySpecs = StripeResource.extend({ - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/country_specs/{country}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/country_specs', - methodType: 'list', - }), -}); diff --git a/esm/resources/Coupons.js b/esm/resources/Coupons.js deleted file mode 100644 index 45451f7106..0000000000 --- a/esm/resources/Coupons.js +++ /dev/null @@ -1,26 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const Coupons = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/coupons', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/coupons/{coupon}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/coupons/{coupon}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/coupons', - methodType: 'list', - }), - del: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/coupons/{coupon}', - }), -}); diff --git a/esm/resources/CreditNotes.js b/esm/resources/CreditNotes.js deleted file mode 100644 index 6c9bdd93cf..0000000000 --- a/esm/resources/CreditNotes.js +++ /dev/null @@ -1,40 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const CreditNotes = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/credit_notes', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/credit_notes/{id}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/credit_notes/{id}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/credit_notes', - methodType: 'list', - }), - listLineItems: stripeMethod({ - method: 'GET', - fullPath: '/v1/credit_notes/{credit_note}/lines', - methodType: 'list', - }), - listPreviewLineItems: stripeMethod({ - method: 'GET', - fullPath: '/v1/credit_notes/preview/lines', - methodType: 'list', - }), - preview: stripeMethod({ - method: 'GET', - fullPath: '/v1/credit_notes/preview', - }), - voidCreditNote: stripeMethod({ - method: 'POST', - fullPath: '/v1/credit_notes/{id}/void', - }), -}); diff --git a/esm/resources/Customers.js b/esm/resources/Customers.js deleted file mode 100644 index 10178a7a36..0000000000 --- a/esm/resources/Customers.js +++ /dev/null @@ -1,124 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const Customers = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/customers', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/customers/{customer}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/customers/{customer}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/customers', - methodType: 'list', - }), - del: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/customers/{customer}', - }), - createFundingInstructions: stripeMethod({ - method: 'POST', - fullPath: '/v1/customers/{customer}/funding_instructions', - }), - createBalanceTransaction: stripeMethod({ - method: 'POST', - fullPath: '/v1/customers/{customer}/balance_transactions', - }), - createSource: stripeMethod({ - method: 'POST', - fullPath: '/v1/customers/{customer}/sources', - }), - createTaxId: stripeMethod({ - method: 'POST', - fullPath: '/v1/customers/{customer}/tax_ids', - }), - deleteDiscount: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/customers/{customer}/discount', - }), - deleteSource: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/customers/{customer}/sources/{id}', - }), - deleteTaxId: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/customers/{customer}/tax_ids/{id}', - }), - listPaymentMethods: stripeMethod({ - method: 'GET', - fullPath: '/v1/customers/{customer}/payment_methods', - methodType: 'list', - }), - listBalanceTransactions: stripeMethod({ - method: 'GET', - fullPath: '/v1/customers/{customer}/balance_transactions', - methodType: 'list', - }), - listCashBalanceTransactions: stripeMethod({ - method: 'GET', - fullPath: '/v1/customers/{customer}/cash_balance_transactions', - methodType: 'list', - }), - listSources: stripeMethod({ - method: 'GET', - fullPath: '/v1/customers/{customer}/sources', - methodType: 'list', - }), - listTaxIds: stripeMethod({ - method: 'GET', - fullPath: '/v1/customers/{customer}/tax_ids', - methodType: 'list', - }), - retrievePaymentMethod: stripeMethod({ - method: 'GET', - fullPath: '/v1/customers/{customer}/payment_methods/{payment_method}', - }), - retrieveBalanceTransaction: stripeMethod({ - method: 'GET', - fullPath: '/v1/customers/{customer}/balance_transactions/{transaction}', - }), - retrieveCashBalance: stripeMethod({ - method: 'GET', - fullPath: '/v1/customers/{customer}/cash_balance', - }), - retrieveCashBalanceTransaction: stripeMethod({ - method: 'GET', - fullPath: '/v1/customers/{customer}/cash_balance_transactions/{transaction}', - }), - retrieveSource: stripeMethod({ - method: 'GET', - fullPath: '/v1/customers/{customer}/sources/{id}', - }), - retrieveTaxId: stripeMethod({ - method: 'GET', - fullPath: '/v1/customers/{customer}/tax_ids/{id}', - }), - search: stripeMethod({ - method: 'GET', - fullPath: '/v1/customers/search', - methodType: 'search', - }), - updateBalanceTransaction: stripeMethod({ - method: 'POST', - fullPath: '/v1/customers/{customer}/balance_transactions/{transaction}', - }), - updateCashBalance: stripeMethod({ - method: 'POST', - fullPath: '/v1/customers/{customer}/cash_balance', - }), - updateSource: stripeMethod({ - method: 'POST', - fullPath: '/v1/customers/{customer}/sources/{id}', - }), - verifySource: stripeMethod({ - method: 'POST', - fullPath: '/v1/customers/{customer}/sources/{id}/verify', - }), -}); diff --git a/esm/resources/Disputes.js b/esm/resources/Disputes.js deleted file mode 100644 index d0942853d5..0000000000 --- a/esm/resources/Disputes.js +++ /dev/null @@ -1,22 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const Disputes = StripeResource.extend({ - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/disputes/{dispute}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/disputes/{dispute}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/disputes', - methodType: 'list', - }), - close: stripeMethod({ - method: 'POST', - fullPath: '/v1/disputes/{dispute}/close', - }), -}); diff --git a/esm/resources/EphemeralKeys.js b/esm/resources/EphemeralKeys.js deleted file mode 100644 index a1949908f1..0000000000 --- a/esm/resources/EphemeralKeys.js +++ /dev/null @@ -1,18 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const EphemeralKeys = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/ephemeral_keys', - validator: (data, options) => { - if (!options.headers || !options.headers['Stripe-Version']) { - throw new Error('Passing apiVersion in a separate options hash is required to create an ephemeral key. See https://stripe.com/docs/api/versioning?lang=node'); - } - }, - }), - del: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/ephemeral_keys/{key}', - }), -}); diff --git a/esm/resources/Events.js b/esm/resources/Events.js deleted file mode 100644 index 5da4c2f3b9..0000000000 --- a/esm/resources/Events.js +++ /dev/null @@ -1,14 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const Events = StripeResource.extend({ - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/events/{id}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/events', - methodType: 'list', - }), -}); diff --git a/esm/resources/ExchangeRates.js b/esm/resources/ExchangeRates.js deleted file mode 100644 index e1de6705e0..0000000000 --- a/esm/resources/ExchangeRates.js +++ /dev/null @@ -1,14 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const ExchangeRates = StripeResource.extend({ - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/exchange_rates/{rate_id}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/exchange_rates', - methodType: 'list', - }), -}); diff --git a/esm/resources/FileLinks.js b/esm/resources/FileLinks.js deleted file mode 100644 index f4fa6dbab3..0000000000 --- a/esm/resources/FileLinks.js +++ /dev/null @@ -1,22 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const FileLinks = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/file_links', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/file_links/{link}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/file_links/{link}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/file_links', - methodType: 'list', - }), -}); diff --git a/esm/resources/Files.js b/esm/resources/Files.js deleted file mode 100644 index d6eba2de81..0000000000 --- a/esm/resources/Files.js +++ /dev/null @@ -1,24 +0,0 @@ -// File generated from our OpenAPI spec -import { multipartRequestDataProcessor } from '../multipart.js'; -import { StripeResource } from '../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const Files = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/files', - headers: { - 'Content-Type': 'multipart/form-data', - }, - host: 'files.stripe.com', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/files/{file}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/files', - methodType: 'list', - }), - requestDataProcessor: multipartRequestDataProcessor, -}); diff --git a/esm/resources/FinancialConnections/Accounts.js b/esm/resources/FinancialConnections/Accounts.js deleted file mode 100644 index 9f21df7c79..0000000000 --- a/esm/resources/FinancialConnections/Accounts.js +++ /dev/null @@ -1,27 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const Accounts = StripeResource.extend({ - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/financial_connections/accounts/{account}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/financial_connections/accounts', - methodType: 'list', - }), - disconnect: stripeMethod({ - method: 'POST', - fullPath: '/v1/financial_connections/accounts/{account}/disconnect', - }), - listOwners: stripeMethod({ - method: 'GET', - fullPath: '/v1/financial_connections/accounts/{account}/owners', - methodType: 'list', - }), - refresh: stripeMethod({ - method: 'POST', - fullPath: '/v1/financial_connections/accounts/{account}/refresh', - }), -}); diff --git a/esm/resources/FinancialConnections/Sessions.js b/esm/resources/FinancialConnections/Sessions.js deleted file mode 100644 index dfb75828ef..0000000000 --- a/esm/resources/FinancialConnections/Sessions.js +++ /dev/null @@ -1,13 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const Sessions = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/financial_connections/sessions', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/financial_connections/sessions/{session}', - }), -}); diff --git a/esm/resources/Identity/VerificationReports.js b/esm/resources/Identity/VerificationReports.js deleted file mode 100644 index 91d825a879..0000000000 --- a/esm/resources/Identity/VerificationReports.js +++ /dev/null @@ -1,14 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const VerificationReports = StripeResource.extend({ - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/identity/verification_reports/{report}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/identity/verification_reports', - methodType: 'list', - }), -}); diff --git a/esm/resources/Identity/VerificationSessions.js b/esm/resources/Identity/VerificationSessions.js deleted file mode 100644 index 537d347087..0000000000 --- a/esm/resources/Identity/VerificationSessions.js +++ /dev/null @@ -1,30 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const VerificationSessions = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/identity/verification_sessions', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/identity/verification_sessions/{session}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/identity/verification_sessions/{session}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/identity/verification_sessions', - methodType: 'list', - }), - cancel: stripeMethod({ - method: 'POST', - fullPath: '/v1/identity/verification_sessions/{session}/cancel', - }), - redact: stripeMethod({ - method: 'POST', - fullPath: '/v1/identity/verification_sessions/{session}/redact', - }), -}); diff --git a/esm/resources/InvoiceItems.js b/esm/resources/InvoiceItems.js deleted file mode 100644 index c835c32086..0000000000 --- a/esm/resources/InvoiceItems.js +++ /dev/null @@ -1,26 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const InvoiceItems = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/invoiceitems', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/invoiceitems/{invoiceitem}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/invoiceitems/{invoiceitem}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/invoiceitems', - methodType: 'list', - }), - del: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/invoiceitems/{invoiceitem}', - }), -}); diff --git a/esm/resources/Invoices.js b/esm/resources/Invoices.js deleted file mode 100644 index 8c450d0f00..0000000000 --- a/esm/resources/Invoices.js +++ /dev/null @@ -1,65 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const Invoices = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/invoices', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/invoices/{invoice}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/invoices/{invoice}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/invoices', - methodType: 'list', - }), - del: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/invoices/{invoice}', - }), - finalizeInvoice: stripeMethod({ - method: 'POST', - fullPath: '/v1/invoices/{invoice}/finalize', - }), - listLineItems: stripeMethod({ - method: 'GET', - fullPath: '/v1/invoices/{invoice}/lines', - methodType: 'list', - }), - listUpcomingLines: stripeMethod({ - method: 'GET', - fullPath: '/v1/invoices/upcoming/lines', - methodType: 'list', - }), - markUncollectible: stripeMethod({ - method: 'POST', - fullPath: '/v1/invoices/{invoice}/mark_uncollectible', - }), - pay: stripeMethod({ - method: 'POST', - fullPath: '/v1/invoices/{invoice}/pay', - }), - retrieveUpcoming: stripeMethod({ - method: 'GET', - fullPath: '/v1/invoices/upcoming', - }), - search: stripeMethod({ - method: 'GET', - fullPath: '/v1/invoices/search', - methodType: 'search', - }), - sendInvoice: stripeMethod({ - method: 'POST', - fullPath: '/v1/invoices/{invoice}/send', - }), - voidInvoice: stripeMethod({ - method: 'POST', - fullPath: '/v1/invoices/{invoice}/void', - }), -}); diff --git a/esm/resources/Issuing/Authorizations.js b/esm/resources/Issuing/Authorizations.js deleted file mode 100644 index dd5dbccd5a..0000000000 --- a/esm/resources/Issuing/Authorizations.js +++ /dev/null @@ -1,26 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const Authorizations = StripeResource.extend({ - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/issuing/authorizations/{authorization}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/issuing/authorizations/{authorization}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/issuing/authorizations', - methodType: 'list', - }), - approve: stripeMethod({ - method: 'POST', - fullPath: '/v1/issuing/authorizations/{authorization}/approve', - }), - decline: stripeMethod({ - method: 'POST', - fullPath: '/v1/issuing/authorizations/{authorization}/decline', - }), -}); diff --git a/esm/resources/Issuing/Cardholders.js b/esm/resources/Issuing/Cardholders.js deleted file mode 100644 index f1af851e03..0000000000 --- a/esm/resources/Issuing/Cardholders.js +++ /dev/null @@ -1,22 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const Cardholders = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/issuing/cardholders', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/issuing/cardholders/{cardholder}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/issuing/cardholders/{cardholder}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/issuing/cardholders', - methodType: 'list', - }), -}); diff --git a/esm/resources/Issuing/Cards.js b/esm/resources/Issuing/Cards.js deleted file mode 100644 index 078cac3cd2..0000000000 --- a/esm/resources/Issuing/Cards.js +++ /dev/null @@ -1,22 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const Cards = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/issuing/cards', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/issuing/cards/{card}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/issuing/cards/{card}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/issuing/cards', - methodType: 'list', - }), -}); diff --git a/esm/resources/Issuing/Disputes.js b/esm/resources/Issuing/Disputes.js deleted file mode 100644 index 7ff473ae1b..0000000000 --- a/esm/resources/Issuing/Disputes.js +++ /dev/null @@ -1,26 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const Disputes = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/issuing/disputes', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/issuing/disputes/{dispute}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/issuing/disputes/{dispute}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/issuing/disputes', - methodType: 'list', - }), - submit: stripeMethod({ - method: 'POST', - fullPath: '/v1/issuing/disputes/{dispute}/submit', - }), -}); diff --git a/esm/resources/Issuing/Transactions.js b/esm/resources/Issuing/Transactions.js deleted file mode 100644 index 069956e438..0000000000 --- a/esm/resources/Issuing/Transactions.js +++ /dev/null @@ -1,18 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const Transactions = StripeResource.extend({ - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/issuing/transactions/{transaction}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/issuing/transactions/{transaction}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/issuing/transactions', - methodType: 'list', - }), -}); diff --git a/esm/resources/Mandates.js b/esm/resources/Mandates.js deleted file mode 100644 index a97c7e7113..0000000000 --- a/esm/resources/Mandates.js +++ /dev/null @@ -1,9 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const Mandates = StripeResource.extend({ - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/mandates/{mandate}', - }), -}); diff --git a/esm/resources/OAuth.js b/esm/resources/OAuth.js deleted file mode 100644 index a95450052b..0000000000 --- a/esm/resources/OAuth.js +++ /dev/null @@ -1,42 +0,0 @@ -'use strict'; -import { StripeResource } from '../StripeResource.js'; -import { stringifyRequestData } from '../utils.js'; -const stripeMethod = StripeResource.method; -const oAuthHost = 'connect.stripe.com'; -export const OAuth = StripeResource.extend({ - basePath: '/', - authorizeUrl(params, options) { - params = params || {}; - options = options || {}; - let path = 'oauth/authorize'; - // For Express accounts, the path changes - if (options.express) { - path = `express/${path}`; - } - if (!params.response_type) { - params.response_type = 'code'; - } - if (!params.client_id) { - params.client_id = this._stripe.getClientId(); - } - if (!params.scope) { - params.scope = 'read_write'; - } - return `https://${oAuthHost}/${path}?${stringifyRequestData(params)}`; - }, - token: stripeMethod({ - method: 'POST', - path: 'oauth/token', - host: oAuthHost, - }), - deauthorize(spec, ...args) { - if (!spec.client_id) { - spec.client_id = this._stripe.getClientId(); - } - return stripeMethod({ - method: 'POST', - path: 'oauth/deauthorize', - host: oAuthHost, - }).apply(this, [spec, ...args]); - }, -}); diff --git a/esm/resources/PaymentIntents.js b/esm/resources/PaymentIntents.js deleted file mode 100644 index 450dbab73f..0000000000 --- a/esm/resources/PaymentIntents.js +++ /dev/null @@ -1,51 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const PaymentIntents = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/payment_intents', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/payment_intents/{intent}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/payment_intents/{intent}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/payment_intents', - methodType: 'list', - }), - applyCustomerBalance: stripeMethod({ - method: 'POST', - fullPath: '/v1/payment_intents/{intent}/apply_customer_balance', - }), - cancel: stripeMethod({ - method: 'POST', - fullPath: '/v1/payment_intents/{intent}/cancel', - }), - capture: stripeMethod({ - method: 'POST', - fullPath: '/v1/payment_intents/{intent}/capture', - }), - confirm: stripeMethod({ - method: 'POST', - fullPath: '/v1/payment_intents/{intent}/confirm', - }), - incrementAuthorization: stripeMethod({ - method: 'POST', - fullPath: '/v1/payment_intents/{intent}/increment_authorization', - }), - search: stripeMethod({ - method: 'GET', - fullPath: '/v1/payment_intents/search', - methodType: 'search', - }), - verifyMicrodeposits: stripeMethod({ - method: 'POST', - fullPath: '/v1/payment_intents/{intent}/verify_microdeposits', - }), -}); diff --git a/esm/resources/PaymentLinks.js b/esm/resources/PaymentLinks.js deleted file mode 100644 index 47af8f3ef9..0000000000 --- a/esm/resources/PaymentLinks.js +++ /dev/null @@ -1,27 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const PaymentLinks = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/payment_links', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/payment_links/{payment_link}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/payment_links/{payment_link}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/payment_links', - methodType: 'list', - }), - listLineItems: stripeMethod({ - method: 'GET', - fullPath: '/v1/payment_links/{payment_link}/line_items', - methodType: 'list', - }), -}); diff --git a/esm/resources/PaymentMethods.js b/esm/resources/PaymentMethods.js deleted file mode 100644 index 90b7584009..0000000000 --- a/esm/resources/PaymentMethods.js +++ /dev/null @@ -1,30 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const PaymentMethods = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/payment_methods', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/payment_methods/{payment_method}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/payment_methods/{payment_method}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/payment_methods', - methodType: 'list', - }), - attach: stripeMethod({ - method: 'POST', - fullPath: '/v1/payment_methods/{payment_method}/attach', - }), - detach: stripeMethod({ - method: 'POST', - fullPath: '/v1/payment_methods/{payment_method}/detach', - }), -}); diff --git a/esm/resources/Payouts.js b/esm/resources/Payouts.js deleted file mode 100644 index 759eb4d4d8..0000000000 --- a/esm/resources/Payouts.js +++ /dev/null @@ -1,30 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const Payouts = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/payouts', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/payouts/{payout}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/payouts/{payout}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/payouts', - methodType: 'list', - }), - cancel: stripeMethod({ - method: 'POST', - fullPath: '/v1/payouts/{payout}/cancel', - }), - reverse: stripeMethod({ - method: 'POST', - fullPath: '/v1/payouts/{payout}/reverse', - }), -}); diff --git a/esm/resources/Plans.js b/esm/resources/Plans.js deleted file mode 100644 index 204353c476..0000000000 --- a/esm/resources/Plans.js +++ /dev/null @@ -1,26 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const Plans = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/plans', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/plans/{plan}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/plans/{plan}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/plans', - methodType: 'list', - }), - del: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/plans/{plan}', - }), -}); diff --git a/esm/resources/Prices.js b/esm/resources/Prices.js deleted file mode 100644 index 877cae03c4..0000000000 --- a/esm/resources/Prices.js +++ /dev/null @@ -1,27 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const Prices = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/prices', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/prices/{price}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/prices/{price}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/prices', - methodType: 'list', - }), - search: stripeMethod({ - method: 'GET', - fullPath: '/v1/prices/search', - methodType: 'search', - }), -}); diff --git a/esm/resources/Products.js b/esm/resources/Products.js deleted file mode 100644 index 95691eea41..0000000000 --- a/esm/resources/Products.js +++ /dev/null @@ -1,31 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const Products = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/products', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/products/{id}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/products/{id}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/products', - methodType: 'list', - }), - del: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/products/{id}', - }), - search: stripeMethod({ - method: 'GET', - fullPath: '/v1/products/search', - methodType: 'search', - }), -}); diff --git a/esm/resources/PromotionCodes.js b/esm/resources/PromotionCodes.js deleted file mode 100644 index cfeb531407..0000000000 --- a/esm/resources/PromotionCodes.js +++ /dev/null @@ -1,22 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const PromotionCodes = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/promotion_codes', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/promotion_codes/{promotion_code}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/promotion_codes/{promotion_code}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/promotion_codes', - methodType: 'list', - }), -}); diff --git a/esm/resources/Quotes.js b/esm/resources/Quotes.js deleted file mode 100644 index 0cb9827dc9..0000000000 --- a/esm/resources/Quotes.js +++ /dev/null @@ -1,50 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const Quotes = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/quotes', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/quotes/{quote}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/quotes/{quote}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/quotes', - methodType: 'list', - }), - accept: stripeMethod({ - method: 'POST', - fullPath: '/v1/quotes/{quote}/accept', - }), - cancel: stripeMethod({ - method: 'POST', - fullPath: '/v1/quotes/{quote}/cancel', - }), - finalizeQuote: stripeMethod({ - method: 'POST', - fullPath: '/v1/quotes/{quote}/finalize', - }), - listComputedUpfrontLineItems: stripeMethod({ - method: 'GET', - fullPath: '/v1/quotes/{quote}/computed_upfront_line_items', - methodType: 'list', - }), - listLineItems: stripeMethod({ - method: 'GET', - fullPath: '/v1/quotes/{quote}/line_items', - methodType: 'list', - }), - pdf: stripeMethod({ - host: 'files.stripe.com', - method: 'GET', - fullPath: '/v1/quotes/{quote}/pdf', - streaming: true, - }), -}); diff --git a/esm/resources/Radar/EarlyFraudWarnings.js b/esm/resources/Radar/EarlyFraudWarnings.js deleted file mode 100644 index 19fff377e7..0000000000 --- a/esm/resources/Radar/EarlyFraudWarnings.js +++ /dev/null @@ -1,14 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const EarlyFraudWarnings = StripeResource.extend({ - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/radar/early_fraud_warnings/{early_fraud_warning}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/radar/early_fraud_warnings', - methodType: 'list', - }), -}); diff --git a/esm/resources/Radar/ValueListItems.js b/esm/resources/Radar/ValueListItems.js deleted file mode 100644 index 8a21475f8a..0000000000 --- a/esm/resources/Radar/ValueListItems.js +++ /dev/null @@ -1,22 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const ValueListItems = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/radar/value_list_items', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/radar/value_list_items/{item}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/radar/value_list_items', - methodType: 'list', - }), - del: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/radar/value_list_items/{item}', - }), -}); diff --git a/esm/resources/Radar/ValueLists.js b/esm/resources/Radar/ValueLists.js deleted file mode 100644 index 6a23f9bca1..0000000000 --- a/esm/resources/Radar/ValueLists.js +++ /dev/null @@ -1,26 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const ValueLists = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/radar/value_lists', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/radar/value_lists/{value_list}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/radar/value_lists/{value_list}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/radar/value_lists', - methodType: 'list', - }), - del: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/radar/value_lists/{value_list}', - }), -}); diff --git a/esm/resources/Refunds.js b/esm/resources/Refunds.js deleted file mode 100644 index 37591f85ec..0000000000 --- a/esm/resources/Refunds.js +++ /dev/null @@ -1,26 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const Refunds = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/refunds', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/refunds/{refund}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/refunds/{refund}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/refunds', - methodType: 'list', - }), - cancel: stripeMethod({ - method: 'POST', - fullPath: '/v1/refunds/{refund}/cancel', - }), -}); diff --git a/esm/resources/Reporting/ReportRuns.js b/esm/resources/Reporting/ReportRuns.js deleted file mode 100644 index 2ed789dff2..0000000000 --- a/esm/resources/Reporting/ReportRuns.js +++ /dev/null @@ -1,18 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const ReportRuns = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/reporting/report_runs', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/reporting/report_runs/{report_run}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/reporting/report_runs', - methodType: 'list', - }), -}); diff --git a/esm/resources/Reporting/ReportTypes.js b/esm/resources/Reporting/ReportTypes.js deleted file mode 100644 index 9b28604d78..0000000000 --- a/esm/resources/Reporting/ReportTypes.js +++ /dev/null @@ -1,14 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const ReportTypes = StripeResource.extend({ - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/reporting/report_types/{report_type}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/reporting/report_types', - methodType: 'list', - }), -}); diff --git a/esm/resources/Reviews.js b/esm/resources/Reviews.js deleted file mode 100644 index b39eb54372..0000000000 --- a/esm/resources/Reviews.js +++ /dev/null @@ -1,18 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const Reviews = StripeResource.extend({ - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/reviews/{review}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/reviews', - methodType: 'list', - }), - approve: stripeMethod({ - method: 'POST', - fullPath: '/v1/reviews/{review}/approve', - }), -}); diff --git a/esm/resources/SetupAttempts.js b/esm/resources/SetupAttempts.js deleted file mode 100644 index 55775e1de9..0000000000 --- a/esm/resources/SetupAttempts.js +++ /dev/null @@ -1,10 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const SetupAttempts = StripeResource.extend({ - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/setup_attempts', - methodType: 'list', - }), -}); diff --git a/esm/resources/SetupIntents.js b/esm/resources/SetupIntents.js deleted file mode 100644 index ffad1f8c47..0000000000 --- a/esm/resources/SetupIntents.js +++ /dev/null @@ -1,34 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const SetupIntents = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/setup_intents', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/setup_intents/{intent}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/setup_intents/{intent}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/setup_intents', - methodType: 'list', - }), - cancel: stripeMethod({ - method: 'POST', - fullPath: '/v1/setup_intents/{intent}/cancel', - }), - confirm: stripeMethod({ - method: 'POST', - fullPath: '/v1/setup_intents/{intent}/confirm', - }), - verifyMicrodeposits: stripeMethod({ - method: 'POST', - fullPath: '/v1/setup_intents/{intent}/verify_microdeposits', - }), -}); diff --git a/esm/resources/ShippingRates.js b/esm/resources/ShippingRates.js deleted file mode 100644 index 72d67763b3..0000000000 --- a/esm/resources/ShippingRates.js +++ /dev/null @@ -1,22 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const ShippingRates = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/shipping_rates', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/shipping_rates/{shipping_rate_token}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/shipping_rates/{shipping_rate_token}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/shipping_rates', - methodType: 'list', - }), -}); diff --git a/esm/resources/Sigma/ScheduledQueryRuns.js b/esm/resources/Sigma/ScheduledQueryRuns.js deleted file mode 100644 index ea4cb63cd6..0000000000 --- a/esm/resources/Sigma/ScheduledQueryRuns.js +++ /dev/null @@ -1,14 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const ScheduledQueryRuns = StripeResource.extend({ - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/sigma/scheduled_query_runs/{scheduled_query_run}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/sigma/scheduled_query_runs', - methodType: 'list', - }), -}); diff --git a/esm/resources/Sources.js b/esm/resources/Sources.js deleted file mode 100644 index 05fc693f2c..0000000000 --- a/esm/resources/Sources.js +++ /dev/null @@ -1,26 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const Sources = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/sources', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/sources/{source}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/sources/{source}', - }), - listSourceTransactions: stripeMethod({ - method: 'GET', - fullPath: '/v1/sources/{source}/source_transactions', - methodType: 'list', - }), - verify: stripeMethod({ - method: 'POST', - fullPath: '/v1/sources/{source}/verify', - }), -}); diff --git a/esm/resources/SubscriptionItems.js b/esm/resources/SubscriptionItems.js deleted file mode 100644 index 44d11222e6..0000000000 --- a/esm/resources/SubscriptionItems.js +++ /dev/null @@ -1,35 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const SubscriptionItems = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/subscription_items', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/subscription_items/{item}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/subscription_items/{item}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/subscription_items', - methodType: 'list', - }), - del: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/subscription_items/{item}', - }), - createUsageRecord: stripeMethod({ - method: 'POST', - fullPath: '/v1/subscription_items/{subscription_item}/usage_records', - }), - listUsageRecordSummaries: stripeMethod({ - method: 'GET', - fullPath: '/v1/subscription_items/{subscription_item}/usage_record_summaries', - methodType: 'list', - }), -}); diff --git a/esm/resources/SubscriptionSchedules.js b/esm/resources/SubscriptionSchedules.js deleted file mode 100644 index 343b7375fa..0000000000 --- a/esm/resources/SubscriptionSchedules.js +++ /dev/null @@ -1,30 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const SubscriptionSchedules = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/subscription_schedules', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/subscription_schedules/{schedule}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/subscription_schedules/{schedule}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/subscription_schedules', - methodType: 'list', - }), - cancel: stripeMethod({ - method: 'POST', - fullPath: '/v1/subscription_schedules/{schedule}/cancel', - }), - release: stripeMethod({ - method: 'POST', - fullPath: '/v1/subscription_schedules/{schedule}/release', - }), -}); diff --git a/esm/resources/Subscriptions.js b/esm/resources/Subscriptions.js deleted file mode 100644 index 7780b81b89..0000000000 --- a/esm/resources/Subscriptions.js +++ /dev/null @@ -1,43 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const Subscriptions = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/subscriptions', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/subscriptions/{subscription_exposed_id}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/subscriptions/{subscription_exposed_id}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/subscriptions', - methodType: 'list', - }), - cancel: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/subscriptions/{subscription_exposed_id}', - }), - del: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/subscriptions/{subscription_exposed_id}', - }), - deleteDiscount: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/subscriptions/{subscription_exposed_id}/discount', - }), - resume: stripeMethod({ - method: 'POST', - fullPath: '/v1/subscriptions/{subscription}/resume', - }), - search: stripeMethod({ - method: 'GET', - fullPath: '/v1/subscriptions/search', - methodType: 'search', - }), -}); diff --git a/esm/resources/TaxCodes.js b/esm/resources/TaxCodes.js deleted file mode 100644 index c5738991c7..0000000000 --- a/esm/resources/TaxCodes.js +++ /dev/null @@ -1,14 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const TaxCodes = StripeResource.extend({ - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/tax_codes/{id}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/tax_codes', - methodType: 'list', - }), -}); diff --git a/esm/resources/TaxRates.js b/esm/resources/TaxRates.js deleted file mode 100644 index 5e7b76e61c..0000000000 --- a/esm/resources/TaxRates.js +++ /dev/null @@ -1,22 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const TaxRates = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/tax_rates', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/tax_rates/{tax_rate}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/tax_rates/{tax_rate}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/tax_rates', - methodType: 'list', - }), -}); diff --git a/esm/resources/Terminal/Configurations.js b/esm/resources/Terminal/Configurations.js deleted file mode 100644 index 461f9c4a37..0000000000 --- a/esm/resources/Terminal/Configurations.js +++ /dev/null @@ -1,26 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const Configurations = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/terminal/configurations', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/terminal/configurations/{configuration}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/terminal/configurations/{configuration}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/terminal/configurations', - methodType: 'list', - }), - del: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/terminal/configurations/{configuration}', - }), -}); diff --git a/esm/resources/Terminal/ConnectionTokens.js b/esm/resources/Terminal/ConnectionTokens.js deleted file mode 100644 index 0547395373..0000000000 --- a/esm/resources/Terminal/ConnectionTokens.js +++ /dev/null @@ -1,9 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const ConnectionTokens = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/terminal/connection_tokens', - }), -}); diff --git a/esm/resources/Terminal/Locations.js b/esm/resources/Terminal/Locations.js deleted file mode 100644 index 2f80792f7b..0000000000 --- a/esm/resources/Terminal/Locations.js +++ /dev/null @@ -1,26 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const Locations = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/terminal/locations', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/terminal/locations/{location}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/terminal/locations/{location}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/terminal/locations', - methodType: 'list', - }), - del: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/terminal/locations/{location}', - }), -}); diff --git a/esm/resources/Terminal/Readers.js b/esm/resources/Terminal/Readers.js deleted file mode 100644 index ce650cff57..0000000000 --- a/esm/resources/Terminal/Readers.js +++ /dev/null @@ -1,46 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const Readers = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/terminal/readers', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/terminal/readers/{reader}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/terminal/readers/{reader}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/terminal/readers', - methodType: 'list', - }), - del: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/terminal/readers/{reader}', - }), - cancelAction: stripeMethod({ - method: 'POST', - fullPath: '/v1/terminal/readers/{reader}/cancel_action', - }), - processPaymentIntent: stripeMethod({ - method: 'POST', - fullPath: '/v1/terminal/readers/{reader}/process_payment_intent', - }), - processSetupIntent: stripeMethod({ - method: 'POST', - fullPath: '/v1/terminal/readers/{reader}/process_setup_intent', - }), - refundPayment: stripeMethod({ - method: 'POST', - fullPath: '/v1/terminal/readers/{reader}/refund_payment', - }), - setReaderDisplay: stripeMethod({ - method: 'POST', - fullPath: '/v1/terminal/readers/{reader}/set_reader_display', - }), -}); diff --git a/esm/resources/TestHelpers/Customers.js b/esm/resources/TestHelpers/Customers.js deleted file mode 100644 index c77b515697..0000000000 --- a/esm/resources/TestHelpers/Customers.js +++ /dev/null @@ -1,9 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const Customers = StripeResource.extend({ - fundCashBalance: stripeMethod({ - method: 'POST', - fullPath: '/v1/test_helpers/customers/{customer}/fund_cash_balance', - }), -}); diff --git a/esm/resources/TestHelpers/Issuing/Cards.js b/esm/resources/TestHelpers/Issuing/Cards.js deleted file mode 100644 index 1826b555a1..0000000000 --- a/esm/resources/TestHelpers/Issuing/Cards.js +++ /dev/null @@ -1,21 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../../../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const Cards = StripeResource.extend({ - deliverCard: stripeMethod({ - method: 'POST', - fullPath: '/v1/test_helpers/issuing/cards/{card}/shipping/deliver', - }), - failCard: stripeMethod({ - method: 'POST', - fullPath: '/v1/test_helpers/issuing/cards/{card}/shipping/fail', - }), - returnCard: stripeMethod({ - method: 'POST', - fullPath: '/v1/test_helpers/issuing/cards/{card}/shipping/return', - }), - shipCard: stripeMethod({ - method: 'POST', - fullPath: '/v1/test_helpers/issuing/cards/{card}/shipping/ship', - }), -}); diff --git a/esm/resources/TestHelpers/Refunds.js b/esm/resources/TestHelpers/Refunds.js deleted file mode 100644 index bfd1da34af..0000000000 --- a/esm/resources/TestHelpers/Refunds.js +++ /dev/null @@ -1,9 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const Refunds = StripeResource.extend({ - expire: stripeMethod({ - method: 'POST', - fullPath: '/v1/test_helpers/refunds/{refund}/expire', - }), -}); diff --git a/esm/resources/TestHelpers/Terminal/Readers.js b/esm/resources/TestHelpers/Terminal/Readers.js deleted file mode 100644 index 4cdc3e4243..0000000000 --- a/esm/resources/TestHelpers/Terminal/Readers.js +++ /dev/null @@ -1,9 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../../../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const Readers = StripeResource.extend({ - presentPaymentMethod: stripeMethod({ - method: 'POST', - fullPath: '/v1/test_helpers/terminal/readers/{reader}/present_payment_method', - }), -}); diff --git a/esm/resources/TestHelpers/TestClocks.js b/esm/resources/TestHelpers/TestClocks.js deleted file mode 100644 index 54fd011ee3..0000000000 --- a/esm/resources/TestHelpers/TestClocks.js +++ /dev/null @@ -1,26 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const TestClocks = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/test_helpers/test_clocks', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/test_helpers/test_clocks/{test_clock}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/test_helpers/test_clocks', - methodType: 'list', - }), - del: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/test_helpers/test_clocks/{test_clock}', - }), - advance: stripeMethod({ - method: 'POST', - fullPath: '/v1/test_helpers/test_clocks/{test_clock}/advance', - }), -}); diff --git a/esm/resources/TestHelpers/Treasury/InboundTransfers.js b/esm/resources/TestHelpers/Treasury/InboundTransfers.js deleted file mode 100644 index 0a2e6e29e0..0000000000 --- a/esm/resources/TestHelpers/Treasury/InboundTransfers.js +++ /dev/null @@ -1,17 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../../../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const InboundTransfers = StripeResource.extend({ - fail: stripeMethod({ - method: 'POST', - fullPath: '/v1/test_helpers/treasury/inbound_transfers/{id}/fail', - }), - returnInboundTransfer: stripeMethod({ - method: 'POST', - fullPath: '/v1/test_helpers/treasury/inbound_transfers/{id}/return', - }), - succeed: stripeMethod({ - method: 'POST', - fullPath: '/v1/test_helpers/treasury/inbound_transfers/{id}/succeed', - }), -}); diff --git a/esm/resources/TestHelpers/Treasury/OutboundPayments.js b/esm/resources/TestHelpers/Treasury/OutboundPayments.js deleted file mode 100644 index 5cb39b5eb7..0000000000 --- a/esm/resources/TestHelpers/Treasury/OutboundPayments.js +++ /dev/null @@ -1,17 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../../../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const OutboundPayments = StripeResource.extend({ - fail: stripeMethod({ - method: 'POST', - fullPath: '/v1/test_helpers/treasury/outbound_payments/{id}/fail', - }), - post: stripeMethod({ - method: 'POST', - fullPath: '/v1/test_helpers/treasury/outbound_payments/{id}/post', - }), - returnOutboundPayment: stripeMethod({ - method: 'POST', - fullPath: '/v1/test_helpers/treasury/outbound_payments/{id}/return', - }), -}); diff --git a/esm/resources/TestHelpers/Treasury/OutboundTransfers.js b/esm/resources/TestHelpers/Treasury/OutboundTransfers.js deleted file mode 100644 index 8e9a7d69c6..0000000000 --- a/esm/resources/TestHelpers/Treasury/OutboundTransfers.js +++ /dev/null @@ -1,17 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../../../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const OutboundTransfers = StripeResource.extend({ - fail: stripeMethod({ - method: 'POST', - fullPath: '/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}/fail', - }), - post: stripeMethod({ - method: 'POST', - fullPath: '/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}/post', - }), - returnOutboundTransfer: stripeMethod({ - method: 'POST', - fullPath: '/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}/return', - }), -}); diff --git a/esm/resources/TestHelpers/Treasury/ReceivedCredits.js b/esm/resources/TestHelpers/Treasury/ReceivedCredits.js deleted file mode 100644 index 68165146bd..0000000000 --- a/esm/resources/TestHelpers/Treasury/ReceivedCredits.js +++ /dev/null @@ -1,9 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../../../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const ReceivedCredits = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/test_helpers/treasury/received_credits', - }), -}); diff --git a/esm/resources/TestHelpers/Treasury/ReceivedDebits.js b/esm/resources/TestHelpers/Treasury/ReceivedDebits.js deleted file mode 100644 index 74453ddaa5..0000000000 --- a/esm/resources/TestHelpers/Treasury/ReceivedDebits.js +++ /dev/null @@ -1,9 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../../../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const ReceivedDebits = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/test_helpers/treasury/received_debits', - }), -}); diff --git a/esm/resources/Tokens.js b/esm/resources/Tokens.js deleted file mode 100644 index b9288872d5..0000000000 --- a/esm/resources/Tokens.js +++ /dev/null @@ -1,13 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const Tokens = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/tokens', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/tokens/{token}', - }), -}); diff --git a/esm/resources/Topups.js b/esm/resources/Topups.js deleted file mode 100644 index 4346574e20..0000000000 --- a/esm/resources/Topups.js +++ /dev/null @@ -1,26 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const Topups = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/topups', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/topups/{topup}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/topups/{topup}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/topups', - methodType: 'list', - }), - cancel: stripeMethod({ - method: 'POST', - fullPath: '/v1/topups/{topup}/cancel', - }), -}); diff --git a/esm/resources/Transfers.js b/esm/resources/Transfers.js deleted file mode 100644 index 83fd484769..0000000000 --- a/esm/resources/Transfers.js +++ /dev/null @@ -1,39 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const Transfers = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/transfers', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/transfers/{transfer}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/transfers/{transfer}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/transfers', - methodType: 'list', - }), - createReversal: stripeMethod({ - method: 'POST', - fullPath: '/v1/transfers/{id}/reversals', - }), - listReversals: stripeMethod({ - method: 'GET', - fullPath: '/v1/transfers/{id}/reversals', - methodType: 'list', - }), - retrieveReversal: stripeMethod({ - method: 'GET', - fullPath: '/v1/transfers/{transfer}/reversals/{id}', - }), - updateReversal: stripeMethod({ - method: 'POST', - fullPath: '/v1/transfers/{transfer}/reversals/{id}', - }), -}); diff --git a/esm/resources/Treasury/CreditReversals.js b/esm/resources/Treasury/CreditReversals.js deleted file mode 100644 index 96e70583c1..0000000000 --- a/esm/resources/Treasury/CreditReversals.js +++ /dev/null @@ -1,18 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const CreditReversals = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/treasury/credit_reversals', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/treasury/credit_reversals/{credit_reversal}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/treasury/credit_reversals', - methodType: 'list', - }), -}); diff --git a/esm/resources/Treasury/DebitReversals.js b/esm/resources/Treasury/DebitReversals.js deleted file mode 100644 index cc101daeac..0000000000 --- a/esm/resources/Treasury/DebitReversals.js +++ /dev/null @@ -1,18 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const DebitReversals = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/treasury/debit_reversals', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/treasury/debit_reversals/{debit_reversal}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/treasury/debit_reversals', - methodType: 'list', - }), -}); diff --git a/esm/resources/Treasury/FinancialAccounts.js b/esm/resources/Treasury/FinancialAccounts.js deleted file mode 100644 index 7c55e94e56..0000000000 --- a/esm/resources/Treasury/FinancialAccounts.js +++ /dev/null @@ -1,30 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const FinancialAccounts = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/treasury/financial_accounts', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/treasury/financial_accounts/{financial_account}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/treasury/financial_accounts/{financial_account}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/treasury/financial_accounts', - methodType: 'list', - }), - retrieveFeatures: stripeMethod({ - method: 'GET', - fullPath: '/v1/treasury/financial_accounts/{financial_account}/features', - }), - updateFeatures: stripeMethod({ - method: 'POST', - fullPath: '/v1/treasury/financial_accounts/{financial_account}/features', - }), -}); diff --git a/esm/resources/Treasury/InboundTransfers.js b/esm/resources/Treasury/InboundTransfers.js deleted file mode 100644 index 82e4422f46..0000000000 --- a/esm/resources/Treasury/InboundTransfers.js +++ /dev/null @@ -1,22 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const InboundTransfers = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/treasury/inbound_transfers', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/treasury/inbound_transfers/{id}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/treasury/inbound_transfers', - methodType: 'list', - }), - cancel: stripeMethod({ - method: 'POST', - fullPath: '/v1/treasury/inbound_transfers/{inbound_transfer}/cancel', - }), -}); diff --git a/esm/resources/Treasury/OutboundPayments.js b/esm/resources/Treasury/OutboundPayments.js deleted file mode 100644 index 825423c7f6..0000000000 --- a/esm/resources/Treasury/OutboundPayments.js +++ /dev/null @@ -1,22 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const OutboundPayments = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/treasury/outbound_payments', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/treasury/outbound_payments/{id}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/treasury/outbound_payments', - methodType: 'list', - }), - cancel: stripeMethod({ - method: 'POST', - fullPath: '/v1/treasury/outbound_payments/{id}/cancel', - }), -}); diff --git a/esm/resources/Treasury/OutboundTransfers.js b/esm/resources/Treasury/OutboundTransfers.js deleted file mode 100644 index 6e9379cf40..0000000000 --- a/esm/resources/Treasury/OutboundTransfers.js +++ /dev/null @@ -1,22 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const OutboundTransfers = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/treasury/outbound_transfers', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/treasury/outbound_transfers/{outbound_transfer}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/treasury/outbound_transfers', - methodType: 'list', - }), - cancel: stripeMethod({ - method: 'POST', - fullPath: '/v1/treasury/outbound_transfers/{outbound_transfer}/cancel', - }), -}); diff --git a/esm/resources/Treasury/ReceivedCredits.js b/esm/resources/Treasury/ReceivedCredits.js deleted file mode 100644 index d71015686b..0000000000 --- a/esm/resources/Treasury/ReceivedCredits.js +++ /dev/null @@ -1,14 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const ReceivedCredits = StripeResource.extend({ - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/treasury/received_credits/{id}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/treasury/received_credits', - methodType: 'list', - }), -}); diff --git a/esm/resources/Treasury/ReceivedDebits.js b/esm/resources/Treasury/ReceivedDebits.js deleted file mode 100644 index 64600127b9..0000000000 --- a/esm/resources/Treasury/ReceivedDebits.js +++ /dev/null @@ -1,14 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const ReceivedDebits = StripeResource.extend({ - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/treasury/received_debits/{id}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/treasury/received_debits', - methodType: 'list', - }), -}); diff --git a/esm/resources/Treasury/TransactionEntries.js b/esm/resources/Treasury/TransactionEntries.js deleted file mode 100644 index dabcbee3a1..0000000000 --- a/esm/resources/Treasury/TransactionEntries.js +++ /dev/null @@ -1,14 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const TransactionEntries = StripeResource.extend({ - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/treasury/transaction_entries/{id}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/treasury/transaction_entries', - methodType: 'list', - }), -}); diff --git a/esm/resources/Treasury/Transactions.js b/esm/resources/Treasury/Transactions.js deleted file mode 100644 index 32f1e182bc..0000000000 --- a/esm/resources/Treasury/Transactions.js +++ /dev/null @@ -1,14 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const Transactions = StripeResource.extend({ - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/treasury/transactions/{id}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/treasury/transactions', - methodType: 'list', - }), -}); diff --git a/esm/resources/WebhookEndpoints.js b/esm/resources/WebhookEndpoints.js deleted file mode 100644 index 71971edacf..0000000000 --- a/esm/resources/WebhookEndpoints.js +++ /dev/null @@ -1,26 +0,0 @@ -// File generated from our OpenAPI spec -import { StripeResource } from '../StripeResource.js'; -const stripeMethod = StripeResource.method; -export const WebhookEndpoints = StripeResource.extend({ - create: stripeMethod({ - method: 'POST', - fullPath: '/v1/webhook_endpoints', - }), - retrieve: stripeMethod({ - method: 'GET', - fullPath: '/v1/webhook_endpoints/{webhook_endpoint}', - }), - update: stripeMethod({ - method: 'POST', - fullPath: '/v1/webhook_endpoints/{webhook_endpoint}', - }), - list: stripeMethod({ - method: 'GET', - fullPath: '/v1/webhook_endpoints', - methodType: 'list', - }), - del: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/webhook_endpoints/{webhook_endpoint}', - }), -}); diff --git a/esm/stripe.core.js b/esm/stripe.core.js deleted file mode 100644 index 3a632759d0..0000000000 --- a/esm/stripe.core.js +++ /dev/null @@ -1,348 +0,0 @@ -import * as _Error from './Error.js'; -import * as resources from './resources.js'; -import { HttpClient, HttpClientResponse } from './net/HttpClient.js'; -import { determineProcessUserAgentProperties, pascalToCamelCase, validateInteger, } from './utils.js'; -import { CryptoProvider } from './crypto/CryptoProvider.js'; -import { RequestSender } from './RequestSender.js'; -import { StripeResource } from './StripeResource.js'; -import { createWebhooks } from './Webhooks.js'; -const DEFAULT_HOST = 'api.stripe.com'; -const DEFAULT_PORT = '443'; -const DEFAULT_BASE_PATH = '/v1/'; -const DEFAULT_API_VERSION = null; -const DEFAULT_TIMEOUT = 80000; -const MAX_NETWORK_RETRY_DELAY_SEC = 2; -const INITIAL_NETWORK_RETRY_DELAY_SEC = 0.5; -const APP_INFO_PROPERTIES = ['name', 'version', 'url', 'partner_id']; -const ALLOWED_CONFIG_PROPERTIES = [ - 'apiVersion', - 'typescript', - 'maxNetworkRetries', - 'httpAgent', - 'httpClient', - 'timeout', - 'host', - 'port', - 'protocol', - 'telemetry', - 'appInfo', - 'stripeAccount', -]; -const defaultRequestSenderFactory = (stripe) => new RequestSender(stripe, StripeResource.MAX_BUFFERED_REQUEST_METRICS); -export function createStripe(platformFunctions, requestSender = defaultRequestSenderFactory) { - Stripe.PACKAGE_VERSION = '11.15.0'; - Stripe.USER_AGENT = Object.assign({ bindings_version: Stripe.PACKAGE_VERSION, lang: 'node', publisher: 'stripe', uname: null, typescript: false }, determineProcessUserAgentProperties()); - Stripe.StripeResource = StripeResource; - Stripe.resources = resources; - Stripe.HttpClient = HttpClient; - Stripe.HttpClientResponse = HttpClientResponse; - Stripe.CryptoProvider = CryptoProvider; - // For backwards compatibiblity after moving to separate CJS and ESM entrypoints. - // To be removed in the next major version. - Stripe.Stripe = Stripe; - Stripe.default = Stripe; - function Stripe(key, config = {}) { - if (!(this instanceof Stripe)) { - return new Stripe(key, config); - } - const props = this._getPropsFromConfig(config); - this._platformFunctions = platformFunctions; - Object.defineProperty(this, '_emitter', { - value: this._platformFunctions.createEmitter(), - enumerable: false, - configurable: false, - writable: false, - }); - this.VERSION = Stripe.PACKAGE_VERSION; - this.on = this._emitter.on.bind(this._emitter); - this.once = this._emitter.once.bind(this._emitter); - this.off = this._emitter.removeListener.bind(this._emitter); - if (props.protocol && - props.protocol !== 'https' && - (!props.host || /\.stripe\.com$/.test(props.host))) { - throw new Error('The `https` protocol must be used when sending requests to `*.stripe.com`'); - } - const agent = props.httpAgent || null; - this._api = { - auth: null, - host: props.host || DEFAULT_HOST, - port: props.port || DEFAULT_PORT, - protocol: props.protocol || 'https', - basePath: DEFAULT_BASE_PATH, - version: props.apiVersion || DEFAULT_API_VERSION, - timeout: validateInteger('timeout', props.timeout, DEFAULT_TIMEOUT), - maxNetworkRetries: validateInteger('maxNetworkRetries', props.maxNetworkRetries, 0), - agent: agent, - httpClient: props.httpClient || - (agent - ? this._platformFunctions.createNodeHttpClient(agent) - : this._platformFunctions.createDefaultHttpClient()), - dev: false, - stripeAccount: props.stripeAccount || null, - }; - const typescript = props.typescript || false; - if (typescript !== Stripe.USER_AGENT.typescript) { - // The mutation here is uncomfortable, but likely fastest; - // serializing the user agent involves shelling out to the system, - // and given some users may instantiate the library many times without switching between TS and non-TS, - // we only want to incur the performance hit when that actually happens. - Stripe.USER_AGENT.typescript = typescript; - } - if (props.appInfo) { - this._setAppInfo(props.appInfo); - } - this._prepResources(); - this._setApiKey(key); - this.errors = _Error; - this.webhooks = createWebhooks(platformFunctions); - this._prevRequestMetrics = []; - this._enableTelemetry = props.telemetry !== false; - this._requestSender = requestSender(this); - // Expose StripeResource on the instance too - // @ts-ignore - this.StripeResource = Stripe.StripeResource; - } - Stripe.errors = _Error; - Stripe.webhooks = createWebhooks; - Stripe.createNodeHttpClient = platformFunctions.createNodeHttpClient; - /** - * Creates an HTTP client for issuing Stripe API requests which uses the Web - * Fetch API. - * - * A fetch function can optionally be passed in as a parameter. If none is - * passed, will default to the default `fetch` function in the global scope. - */ - Stripe.createFetchHttpClient = platformFunctions.createFetchHttpClient; - /** - * Create a CryptoProvider which uses the built-in Node crypto libraries for - * its crypto operations. - */ - Stripe.createNodeCryptoProvider = platformFunctions.createNodeCryptoProvider; - /** - * Creates a CryptoProvider which uses the Subtle Crypto API from the Web - * Crypto API spec for its crypto operations. - * - * A SubtleCrypto interface can optionally be passed in as a parameter. If none - * is passed, will default to the default `crypto.subtle` object in the global - * scope. - */ - Stripe.createSubtleCryptoProvider = - platformFunctions.createSubtleCryptoProvider; - Stripe.prototype = { - // Properties are set in the constructor above - _appInfo: undefined, - on: null, - off: null, - once: null, - VERSION: null, - StripeResource: null, - webhooks: null, - errors: null, - _api: null, - _prevRequestMetrics: null, - _emitter: null, - _enableTelemetry: null, - _requestSender: null, - _platformFunctions: null, - /** - * @private - */ - _setApiKey(key) { - if (key) { - this._setApiField('auth', `Bearer ${key}`); - } - }, - /** - * @private - * This may be removed in the future. - */ - _setAppInfo(info) { - if (info && typeof info !== 'object') { - throw new Error('AppInfo must be an object.'); - } - if (info && !info.name) { - throw new Error('AppInfo.name is required'); - } - info = info || {}; - this._appInfo = APP_INFO_PROPERTIES.reduce((accum, prop) => { - if (typeof info[prop] == 'string') { - accum = accum || {}; - accum[prop] = info[prop]; - } - return accum; - }, - // @ts-ignore - undefined); - }, - /** - * @private - * This may be removed in the future. - */ - _setApiField(key, value) { - this._api[key] = value; - }, - /** - * @private - * Please open or upvote an issue at github.com/stripe/stripe-node - * if you use this, detailing your use-case. - * - * It may be deprecated and removed in the future. - */ - getApiField(key) { - return this._api[key]; - }, - setClientId(clientId) { - this._clientId = clientId; - }, - getClientId() { - return this._clientId; - }, - /** - * @private - * Please open or upvote an issue at github.com/stripe/stripe-node - * if you use this, detailing your use-case. - * - * It may be deprecated and removed in the future. - */ - getConstant: (c) => { - switch (c) { - case 'DEFAULT_HOST': - return DEFAULT_HOST; - case 'DEFAULT_PORT': - return DEFAULT_PORT; - case 'DEFAULT_BASE_PATH': - return DEFAULT_BASE_PATH; - case 'DEFAULT_API_VERSION': - return DEFAULT_API_VERSION; - case 'DEFAULT_TIMEOUT': - return DEFAULT_TIMEOUT; - case 'MAX_NETWORK_RETRY_DELAY_SEC': - return MAX_NETWORK_RETRY_DELAY_SEC; - case 'INITIAL_NETWORK_RETRY_DELAY_SEC': - return INITIAL_NETWORK_RETRY_DELAY_SEC; - } - return Stripe[c]; - }, - getMaxNetworkRetries() { - return this.getApiField('maxNetworkRetries'); - }, - /** - * @private - * This may be removed in the future. - */ - _setApiNumberField(prop, n, defaultVal) { - const val = validateInteger(prop, n, defaultVal); - this._setApiField(prop, val); - }, - getMaxNetworkRetryDelay() { - return MAX_NETWORK_RETRY_DELAY_SEC; - }, - getInitialNetworkRetryDelay() { - return INITIAL_NETWORK_RETRY_DELAY_SEC; - }, - /** - * @private - * Please open or upvote an issue at github.com/stripe/stripe-node - * if you use this, detailing your use-case. - * - * It may be deprecated and removed in the future. - * - * Gets a JSON version of a User-Agent and uses a cached version for a slight - * speed advantage. - */ - getClientUserAgent(cb) { - return this.getClientUserAgentSeeded(Stripe.USER_AGENT, cb); - }, - /** - * @private - * Please open or upvote an issue at github.com/stripe/stripe-node - * if you use this, detailing your use-case. - * - * It may be deprecated and removed in the future. - * - * Gets a JSON version of a User-Agent by encoding a seeded object and - * fetching a uname from the system. - */ - getClientUserAgentSeeded(seed, cb) { - this._platformFunctions.getUname().then((uname) => { - var _a; - const userAgent = {}; - for (const field in seed) { - userAgent[field] = encodeURIComponent((_a = seed[field]) !== null && _a !== void 0 ? _a : 'null'); - } - // URI-encode in case there are unusual characters in the system's uname. - userAgent.uname = encodeURIComponent(uname || 'UNKNOWN'); - const client = this.getApiField('httpClient'); - if (client) { - userAgent.httplib = encodeURIComponent(client.getClientName()); - } - if (this._appInfo) { - userAgent.application = this._appInfo; - } - cb(JSON.stringify(userAgent)); - }); - }, - /** - * @private - * Please open or upvote an issue at github.com/stripe/stripe-node - * if you use this, detailing your use-case. - * - * It may be deprecated and removed in the future. - */ - getAppInfoAsString() { - if (!this._appInfo) { - return ''; - } - let formatted = this._appInfo.name; - if (this._appInfo.version) { - formatted += `/${this._appInfo.version}`; - } - if (this._appInfo.url) { - formatted += ` (${this._appInfo.url})`; - } - return formatted; - }, - getTelemetryEnabled() { - return this._enableTelemetry; - }, - /** - * @private - * This may be removed in the future. - */ - _prepResources() { - for (const name in resources) { - // @ts-ignore - this[pascalToCamelCase(name)] = new resources[name](this); - } - }, - /** - * @private - * This may be removed in the future. - */ - _getPropsFromConfig(config) { - // If config is null or undefined, just bail early with no props - if (!config) { - return {}; - } - // config can be an object or a string - const isString = typeof config === 'string'; - const isObject = config === Object(config) && !Array.isArray(config); - if (!isObject && !isString) { - throw new Error('Config must either be an object or a string'); - } - // If config is a string, we assume the old behavior of passing in a string representation of the api version - if (isString) { - return { - apiVersion: config, - }; - } - // If config is an object, we assume the new behavior and make sure it doesn't contain any unexpected values - const values = Object.keys(config).filter((value) => !ALLOWED_CONFIG_PROPERTIES.includes(value)); - if (values.length > 0) { - throw new Error(`Config object may only contain the following: ${ALLOWED_CONFIG_PROPERTIES.join(', ')}`); - } - return config; - }, - }; - return Stripe; -} diff --git a/esm/stripe.esm.node.js b/esm/stripe.esm.node.js deleted file mode 100644 index 4bd8e623fe..0000000000 --- a/esm/stripe.esm.node.js +++ /dev/null @@ -1,4 +0,0 @@ -import { NodePlatformFunctions } from './platform/NodePlatformFunctions.js'; -import { createStripe } from './stripe.core.js'; -export const Stripe = createStripe(new NodePlatformFunctions()); -export default Stripe; diff --git a/esm/stripe.esm.worker.js b/esm/stripe.esm.worker.js deleted file mode 100644 index 26de3893f6..0000000000 --- a/esm/stripe.esm.worker.js +++ /dev/null @@ -1,4 +0,0 @@ -import { WebPlatformFunctions } from './platform/WebPlatformFunctions.js'; -import { createStripe } from './stripe.core.js'; -export const Stripe = createStripe(new WebPlatformFunctions()); -export default Stripe; diff --git a/esm/utils.js b/esm/utils.js deleted file mode 100644 index 633f7cc52c..0000000000 --- a/esm/utils.js +++ /dev/null @@ -1,287 +0,0 @@ -import * as qs from 'qs'; -const OPTIONS_KEYS = [ - 'apiKey', - 'idempotencyKey', - 'stripeAccount', - 'apiVersion', - 'maxNetworkRetries', - 'timeout', - 'host', -]; -export function isOptionsHash(o) { - return (o && - typeof o === 'object' && - OPTIONS_KEYS.some((prop) => Object.prototype.hasOwnProperty.call(o, prop))); -} -/** - * Stringifies an Object, accommodating nested objects - * (forming the conventional key 'parent[child]=value') - */ -export function stringifyRequestData(data) { - return (qs - .stringify(data, { - serializeDate: (d) => Math.floor(d.getTime() / 1000).toString(), - }) - // Don't use strict form encoding by changing the square bracket control - // characters back to their literals. This is fine by the server, and - // makes these parameter strings easier to read. - .replace(/%5B/g, '[') - .replace(/%5D/g, ']')); -} -/** - * Outputs a new function with interpolated object property values. - * Use like so: - * const fn = makeURLInterpolator('some/url/{param1}/{param2}'); - * fn({ param1: 123, param2: 456 }); // => 'some/url/123/456' - */ -export const makeURLInterpolator = (() => { - const rc = { - '\n': '\\n', - '"': '\\"', - '\u2028': '\\u2028', - '\u2029': '\\u2029', - }; - return (str) => { - const cleanString = str.replace(/["\n\r\u2028\u2029]/g, ($0) => rc[$0]); - return (outputs) => { - return cleanString.replace(/\{([\s\S]+?)\}/g, ($0, $1) => - // @ts-ignore - encodeURIComponent(outputs[$1] || '')); - }; - }; -})(); -export function extractUrlParams(path) { - const params = path.match(/\{\w+\}/g); - if (!params) { - return []; - } - return params.map((param) => param.replace(/[{}]/g, '')); -} -/** - * Return the data argument from a list of arguments - * - * @param {object[]} args - * @returns {object} - */ -export function getDataFromArgs(args) { - if (!Array.isArray(args) || !args[0] || typeof args[0] !== 'object') { - return {}; - } - if (!isOptionsHash(args[0])) { - return args.shift(); - } - const argKeys = Object.keys(args[0]); - const optionKeysInArgs = argKeys.filter((key) => OPTIONS_KEYS.includes(key)); - // In some cases options may be the provided as the first argument. - // Here we're detecting a case where there are two distinct arguments - // (the first being args and the second options) and with known - // option keys in the first so that we can warn the user about it. - if (optionKeysInArgs.length > 0 && - optionKeysInArgs.length !== argKeys.length) { - emitWarning(`Options found in arguments (${optionKeysInArgs.join(', ')}). Did you mean to pass an options object? See https://github.com/stripe/stripe-node/wiki/Passing-Options.`); - } - return {}; -} -/** - * Return the options hash from a list of arguments - */ -export function getOptionsFromArgs(args) { - const opts = { - auth: null, - host: null, - headers: {}, - settings: {}, - }; - if (args.length > 0) { - const arg = args[args.length - 1]; - if (typeof arg === 'string') { - opts.auth = args.pop(); - } - else if (isOptionsHash(arg)) { - const params = Object.assign({}, args.pop()); - const extraKeys = Object.keys(params).filter((key) => !OPTIONS_KEYS.includes(key)); - if (extraKeys.length) { - emitWarning(`Invalid options found (${extraKeys.join(', ')}); ignoring.`); - } - if (params.apiKey) { - opts.auth = params.apiKey; - } - if (params.idempotencyKey) { - opts.headers['Idempotency-Key'] = params.idempotencyKey; - } - if (params.stripeAccount) { - opts.headers['Stripe-Account'] = params.stripeAccount; - } - if (params.apiVersion) { - opts.headers['Stripe-Version'] = params.apiVersion; - } - if (Number.isInteger(params.maxNetworkRetries)) { - opts.settings.maxNetworkRetries = params.maxNetworkRetries; - } - if (Number.isInteger(params.timeout)) { - opts.settings.timeout = params.timeout; - } - if (params.host) { - opts.host = params.host; - } - } - } - return opts; -} -/** - * Provide simple "Class" extension mechanism. - * - */ -export function protoExtend(sub) { - // eslint-disable-next-line @typescript-eslint/no-this-alias - const Super = this; - const Constructor = Object.prototype.hasOwnProperty.call(sub, 'constructor') - ? sub.constructor - : function (...args) { - Super.apply(this, args); - }; - // This initialization logic is somewhat sensitive to be compatible with - // divergent JS implementations like the one found in Qt. See here for more - // context: - // - // https://github.com/stripe/stripe-node/pull/334 - Object.assign(Constructor, Super); - Constructor.prototype = Object.create(Super.prototype); - Object.assign(Constructor.prototype, sub); - return Constructor; -} -/** - * Remove empty values from an object - */ -export function removeNullish(obj) { - if (typeof obj !== 'object') { - throw new Error('Argument must be an object'); - } - return Object.keys(obj).reduce((result, key) => { - if (obj[key] != null) { - result[key] = obj[key]; - } - return result; - }, {}); -} -/** - * Normalize standard HTTP Headers: - * {'foo-bar': 'hi'} - * becomes - * {'Foo-Bar': 'hi'} - */ -export function normalizeHeaders(obj) { - if (!(obj && typeof obj === 'object')) { - return obj; - } - return Object.keys(obj).reduce((result, header) => { - result[normalizeHeader(header)] = obj[header]; - return result; - }, {}); -} -/** - * Stolen from https://github.com/marten-de-vries/header-case-normalizer/blob/master/index.js#L36-L41 - * without the exceptions which are irrelevant to us. - */ -export function normalizeHeader(header) { - return header - .split('-') - .map((text) => text.charAt(0).toUpperCase() + text.substr(1).toLowerCase()) - .join('-'); -} -export function callbackifyPromiseWithTimeout(promise, callback) { - if (callback) { - // Ensure callback is called outside of promise stack. - return promise.then((res) => { - setTimeout(() => { - callback(null, res); - }, 0); - }, (err) => { - setTimeout(() => { - callback(err, null); - }, 0); - }); - } - return promise; -} -/** - * Allow for special capitalization cases (such as OAuth) - */ -export function pascalToCamelCase(name) { - if (name === 'OAuth') { - return 'oauth'; - } - else { - return name[0].toLowerCase() + name.substring(1); - } -} -export function emitWarning(warning) { - if (typeof process.emitWarning !== 'function') { - return console.warn(`Stripe: ${warning}`); /* eslint-disable-line no-console */ - } - return process.emitWarning(warning, 'Stripe'); -} -export function isObject(obj) { - const type = typeof obj; - return (type === 'function' || type === 'object') && !!obj; -} -// For use in multipart requests -export function flattenAndStringify(data) { - const result = {}; - const step = (obj, prevKey) => { - Object.keys(obj).forEach((key) => { - // @ts-ignore - const value = obj[key]; - const newKey = prevKey ? `${prevKey}[${key}]` : key; - if (isObject(value)) { - if (!(value instanceof Uint8Array) && - !Object.prototype.hasOwnProperty.call(value, 'data')) { - // Non-buffer non-file Objects are recursively flattened - return step(value, newKey); - } - else { - // Buffers and file objects are stored without modification - result[newKey] = value; - } - } - else { - // Primitives are converted to strings - result[newKey] = String(value); - } - }); - }; - step(data, null); - return result; -} -export function validateInteger(name, n, defaultVal) { - if (!Number.isInteger(n)) { - if (defaultVal !== undefined) { - return defaultVal; - } - else { - throw new Error(`${name} must be an integer`); - } - } - return n; -} -export function determineProcessUserAgentProperties() { - return typeof process === 'undefined' - ? {} - : { - lang_version: process.version, - platform: process.platform, - }; -} -/** - * Joins an array of Uint8Arrays into a single Uint8Array - */ -export function concat(arrays) { - const totalLength = arrays.reduce((len, array) => len + array.length, 0); - const merged = new Uint8Array(totalLength); - let offset = 0; - arrays.forEach((array) => { - merged.set(array, offset); - offset += array.length; - }); - return merged; -} From 170f80f5b2899ec2abf3cd13a97fc7de389e4717 Mon Sep 17 00:00:00 2001 From: Richard Marmorstein Date: Fri, 17 Mar 2023 12:01:09 -0700 Subject: [PATCH 7/7] Revert "Bump version to 11.16.0-beta.1" This reverts commit 5a9c3e706c78ffed3518328a670e0ef5858c24ae. --- CHANGELOG.md | 30 ------------------------------ VERSION | 2 +- package.json | 2 +- src/stripe.core.ts | 2 +- 4 files changed, 3 insertions(+), 33 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ea1f91d04..2d83df180a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,35 +1,5 @@ # Changelog -## 11.16.0-beta.1 - 2023-03-16 -* [#1713](https://github.com/stripe/stripe-node/pull/1713) API Updates - * Add support for `create_from_calculation` method on resource `Tax.Transaction` - * Change type of `Invoice.applies_to` from `QuotesResourceQuoteLinesAppliesTo | null` to `QuotesResourceQuoteLinesAppliesTo` - * Add support for `paypal` on `Mandate.payment_method_details`, `SetupAttempt.payment_method_details`, `SetupIntent.payment_method_options`, `SetupIntentConfirmParams.payment_method_options`, `SetupIntentCreateParams.payment_method_options`, and `SetupIntentUpdateParams.payment_method_options` - * Add support for new value `automatic_async` on enums `Order.payment.settings.payment_method_options.afterpay_clearpay.capture_method`, `Order.payment.settings.payment_method_options.card.capture_method`, `OrderCreateParams.payment.settings.payment_method_options.afterpay_clearpay.capture_method`, `OrderCreateParams.payment.settings.payment_method_options.card.capture_method`, `OrderUpdateParams.payment.settings.payment_method_options.afterpay_clearpay.capture_method`, and `OrderUpdateParams.payment.settings.payment_method_options.card.capture_method` - * Add support for `setup_future_usage` on `Order.payment.settings.payment_method_options.paypal`, `OrderCreateParams.payment.settings.payment_method_options.paypal`, `OrderUpdateParams.payment.settings.payment_method_options.paypal`, `PaymentIntent.payment_method_options.paypal`, `PaymentIntentConfirmParams.payment_method_options.paypal`, `PaymentIntentCreateParams.payment_method_options.paypal`, and `PaymentIntentUpdateParams.payment_method_options.paypal` - * Change `PaymentIntent.next_action.cashapp_handle_redirect_or_display_qr_code.hosted_instructions_url`, `PaymentIntent.next_action.cashapp_handle_redirect_or_display_qr_code.mobile_auth_url`, `PaymentIntent.next_action.cashapp_handle_redirect_or_display_qr_code.qr_code.expires_at`, `PaymentIntent.next_action.cashapp_handle_redirect_or_display_qr_code.qr_code.image_url_png`, `PaymentIntent.next_action.cashapp_handle_redirect_or_display_qr_code.qr_code.image_url_svg`, `PaymentIntent.next_action.cashapp_handle_redirect_or_display_qr_code.qr_code`, `SetupIntent.next_action.cashapp_handle_redirect_or_display_qr_code.hosted_instructions_url`, `SetupIntent.next_action.cashapp_handle_redirect_or_display_qr_code.mobile_auth_url`, `SetupIntent.next_action.cashapp_handle_redirect_or_display_qr_code.qr_code.expires_at`, `SetupIntent.next_action.cashapp_handle_redirect_or_display_qr_code.qr_code.image_url_png`, `SetupIntent.next_action.cashapp_handle_redirect_or_display_qr_code.qr_code.image_url_svg`, and `SetupIntent.next_action.cashapp_handle_redirect_or_display_qr_code.qr_code` to be required - * Remove support for `applies_to` on `QuotePreviewInvoiceLinesParams` - * Add support for `shipping_cost` on `Tax.Calculation`, `Tax.Transaction`, `TaxCalculationCreateParams`, and `TaxTransactionCreateReversalParams` - * Add support for `tax_breakdown` on `Tax.Calculation` - * Remove support for `tax_summary` on `Tax.Calculation` -* [#1715](https://github.com/stripe/stripe-node/pull/1715) Merge master into beta branch -* [#1711](https://github.com/stripe/stripe-node/pull/1711) Update generated code for beta (new) - * Remove support for resource `Capital.FinancingSummary` - * Remove support for `retrieve` method on resource `FinancingSummary` - * Remove support for `mark_delivered` method on resource `Capital.FinancingOffer` - * Add support for `cashapp` on `Checkout.Session.payment_method_options`, `CheckoutSessionCreateParams.payment_method_options`, and `SetupAttempt.payment_method_details` - * Add support for new value `cashapp` on enum `CheckoutSessionCreateParams.payment_method_types[]` - * Add support for new values `cashapp` and `paypal` on enums `Invoice.payment_settings.payment_method_types[]`, `InvoiceCreateParams.payment_settings.payment_method_types[]`, `InvoiceUpdateParams.payment_settings.payment_method_types[]`, `Subscription.payment_settings.payment_method_types[]`, `SubscriptionCreateParams.payment_settings.payment_method_types[]`, and `SubscriptionUpdateParams.payment_settings.payment_method_types[]` - * Change type of `Invoice.applies_to` from `QuotesResourceQuoteLinesAppliesTo | null` to `QuotesResourceQuoteLinesAppliesTo` - * Add support for `paypal` on `Mandate.payment_method_details`, `SetupAttempt.payment_method_details`, `SetupIntent.payment_method_options`, `SetupIntentConfirmParams.payment_method_options`, `SetupIntentCreateParams.payment_method_options`, and `SetupIntentUpdateParams.payment_method_options` - * Add support for `setup_future_usage` on `Order.payment.settings.payment_method_options.paypal`, `OrderCreateParams.payment.settings.payment_method_options.paypal`, `OrderUpdateParams.payment.settings.payment_method_options.paypal`, `PaymentIntent.payment_method_options.paypal`, `PaymentIntentConfirmParams.payment_method_options.paypal`, `PaymentIntentCreateParams.payment_method_options.paypal`, and `PaymentIntentUpdateParams.payment_method_options.paypal` - * Add support for `preferred_locale` on `PaymentIntent.payment_method_options.affirm`, `PaymentIntentConfirmParams.payment_method_options.affirm`, `PaymentIntentCreateParams.payment_method_options.affirm`, and `PaymentIntentUpdateParams.payment_method_options.affirm` - * Change `PaymentIntent.next_action.cashapp_handle_redirect_or_display_qr_code.hosted_instructions_url`, `PaymentIntent.next_action.cashapp_handle_redirect_or_display_qr_code.mobile_auth_url`, `PaymentIntent.next_action.cashapp_handle_redirect_or_display_qr_code.qr_code.expires_at`, `PaymentIntent.next_action.cashapp_handle_redirect_or_display_qr_code.qr_code.image_url_png`, `PaymentIntent.next_action.cashapp_handle_redirect_or_display_qr_code.qr_code.image_url_svg`, `PaymentIntent.next_action.cashapp_handle_redirect_or_display_qr_code.qr_code`, `SetupIntent.next_action.cashapp_handle_redirect_or_display_qr_code.hosted_instructions_url`, `SetupIntent.next_action.cashapp_handle_redirect_or_display_qr_code.mobile_auth_url`, `SetupIntent.next_action.cashapp_handle_redirect_or_display_qr_code.qr_code.expires_at`, `SetupIntent.next_action.cashapp_handle_redirect_or_display_qr_code.qr_code.image_url_png`, `SetupIntent.next_action.cashapp_handle_redirect_or_display_qr_code.qr_code.image_url_svg`, and `SetupIntent.next_action.cashapp_handle_redirect_or_display_qr_code.qr_code` to be required - * Add support for new value `cashapp` on enums `PaymentLink.payment_method_types[]`, `PaymentLinkCreateParams.payment_method_types[]`, and `PaymentLinkUpdateParams.payment_method_types[]` - * Remove support for `applies_to` on `QuotePreviewInvoiceLinesParams` - * Add support for new value `payout.reconciliation_completed` on enums `WebhookEndpointCreateParams.enabled_events[]` and `WebhookEndpointUpdateParams.enabled_events[]` -* [#1708](https://github.com/stripe/stripe-node/pull/1708) Merge origin/master into beta - ## 11.15.0-beta.1 - 2023-03-09 * [#1705](https://github.com/stripe/stripe-node/pull/1705) API Updates for beta branch * Updated stable APIs to the latest version diff --git a/VERSION b/VERSION index 1de22ec69e..9938fff2b6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -11.16.0-beta.1 +11.15.0-beta.1 diff --git a/package.json b/package.json index b00d20c26d..dbaaaa9f1a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "stripe", - "version": "11.16.0-beta.1", + "version": "11.15.0-beta.1", "description": "Stripe API wrapper", "keywords": [ "stripe", diff --git a/src/stripe.core.ts b/src/stripe.core.ts index 155efc73ff..a02d3f6133 100644 --- a/src/stripe.core.ts +++ b/src/stripe.core.ts @@ -48,7 +48,7 @@ export function createStripe( platformFunctions: PlatformFunctions, requestSender: RequestSenderFactory = defaultRequestSenderFactory ): typeof Stripe { - Stripe.PACKAGE_VERSION = '11.16.0-beta.1'; + Stripe.PACKAGE_VERSION = '11.15.0-beta.1'; Stripe.USER_AGENT = { bindings_version: Stripe.PACKAGE_VERSION, lang: 'node',