diff --git a/lib/resources.js b/lib/resources.js new file mode 100644 index 0000000000..44dc03574c --- /dev/null +++ b/lib/resources.js @@ -0,0 +1,79 @@ +'use strict'; + +const resourceNamespace = require('./ResourceNamespace'); + +module.exports = { + // Support Accounts for consistency, Account for backwards compatibility + Account: require('./resources/Accounts'), + Accounts: require('./resources/Accounts'), + AccountLinks: require('./resources/AccountLinks'), + ApplePayDomains: require('./resources/ApplePayDomains'), + ApplicationFees: require('./resources/ApplicationFees'), + Balance: require('./resources/Balance'), + BalanceTransactions: require('./resources/BalanceTransactions'), + BitcoinReceivers: require('./resources/BitcoinReceivers'), + Charges: require('./resources/Charges'), + CountrySpecs: require('./resources/CountrySpecs'), + Coupons: require('./resources/Coupons'), + CreditNotes: require('./resources/CreditNotes'), + Customers: require('./resources/Customers'), + Disputes: require('./resources/Disputes'), + EphemeralKeys: require('./resources/EphemeralKeys'), + Events: require('./resources/Events'), + ExchangeRates: require('./resources/ExchangeRates'), + Files: require('./resources/Files'), + FileLinks: require('./resources/FileLinks'), + InvoiceItems: require('./resources/InvoiceItems'), + Invoices: require('./resources/Invoices'), + IssuerFraudRecords: require('./resources/IssuerFraudRecords'), + OAuth: require('./resources/OAuth'), + OrderReturns: require('./resources/OrderReturns'), + Orders: require('./resources/Orders'), + PaymentIntents: require('./resources/PaymentIntents'), + PaymentMethods: require('./resources/PaymentMethods'), + Payouts: require('./resources/Payouts'), + Plans: require('./resources/Plans'), + Products: require('./resources/Products'), + Recipients: require('./resources/Recipients'), + Refunds: require('./resources/Refunds'), + Reviews: require('./resources/Reviews'), + Skus: require('./resources/SKUs'), + Sources: require('./resources/Sources'), + SubscriptionItems: require('./resources/SubscriptionItems'), + SubscriptionSchedules: require('./resources/SubscriptionSchedules'), + Subscriptions: require('./resources/Subscriptions'), + TaxRates: require('./resources/TaxRates'), + ThreeDSecure: require('./resources/ThreeDSecure'), + Tokens: require('./resources/Tokens'), + Topups: require('./resources/Topups'), + Transfers: require('./resources/Transfers'), + UsageRecords: require('./resources/UsageRecords'), + UsageRecordSummaries: require('./resources/UsageRecordSummaries'), + WebhookEndpoints: require('./resources/WebhookEndpoints'), + Checkout: resourceNamespace('checkout', { + Sessions: require('./resources/Checkout/Sessions'), + }), + Issuing: resourceNamespace('issuing', { + Authorizations: require('./resources/Issuing/Authorizations'), + Cardholders: require('./resources/Issuing/Cardholders'), + Cards: require('./resources/Issuing/Cards'), + Disputes: require('./resources/Issuing/Disputes'), + Transactions: require('./resources/Issuing/Transactions'), + }), + Radar: resourceNamespace('radar', { + ValueLists: require('./resources/Radar/ValueLists'), + ValueListItems: require('./resources/Radar/ValueListItems'), + }), + Reporting: resourceNamespace('reporting', { + ReportRuns: require('./resources/Reporting/ReportRuns'), + ReportTypes: require('./resources/Reporting/ReportTypes'), + }), + Sigma: resourceNamespace('sigma', { + ScheduledQueryRuns: require('./resources/Sigma/ScheduledQueryRuns'), + }), + Terminal: resourceNamespace('terminal', { + ConnectionTokens: require('./resources/Terminal/ConnectionTokens'), + Locations: require('./resources/Terminal/Locations'), + Readers: require('./resources/Terminal/Readers'), + }), +}; diff --git a/lib/stripe.js b/lib/stripe.js index 99777370ef..7a22138d8c 100644 --- a/lib/stripe.js +++ b/lib/stripe.js @@ -1,5 +1,7 @@ 'use strict'; +const resources = require('./resources'); + Stripe.DEFAULT_HOST = 'api.stripe.com'; Stripe.DEFAULT_PORT = '443'; Stripe.DEFAULT_BASE_PATH = '/v1/'; @@ -29,86 +31,6 @@ const APP_INFO_PROPERTIES = ['name', 'version', 'url', 'partner_id']; const EventEmitter = require('events').EventEmitter; const utils = require('./utils'); -const resourceNamespace = require('./ResourceNamespace'); - -const resources = { - // Support Accounts for consistency, Account for backwards compat - Account: require('./resources/Accounts'), - Accounts: require('./resources/Accounts'), - AccountLinks: require('./resources/AccountLinks'), - ApplePayDomains: require('./resources/ApplePayDomains'), - ApplicationFees: require('./resources/ApplicationFees'), - Balance: require('./resources/Balance'), - BalanceTransactions: require('./resources/BalanceTransactions'), - BitcoinReceivers: require('./resources/BitcoinReceivers'), - Charges: require('./resources/Charges'), - CountrySpecs: require('./resources/CountrySpecs'), - Coupons: require('./resources/Coupons'), - CreditNotes: require('./resources/CreditNotes'), - Customers: require('./resources/Customers'), - Disputes: require('./resources/Disputes'), - EphemeralKeys: require('./resources/EphemeralKeys'), - Events: require('./resources/Events'), - ExchangeRates: require('./resources/ExchangeRates'), - Files: require('./resources/Files'), - FileLinks: require('./resources/FileLinks'), - InvoiceItems: require('./resources/InvoiceItems'), - Invoices: require('./resources/Invoices'), - IssuerFraudRecords: require('./resources/IssuerFraudRecords'), - OAuth: require('./resources/OAuth'), - OrderReturns: require('./resources/OrderReturns'), - Orders: require('./resources/Orders'), - PaymentIntents: require('./resources/PaymentIntents'), - PaymentMethods: require('./resources/PaymentMethods'), - Payouts: require('./resources/Payouts'), - Plans: require('./resources/Plans'), - Products: require('./resources/Products'), - Recipients: require('./resources/Recipients'), - Refunds: require('./resources/Refunds'), - Reviews: require('./resources/Reviews'), - Skus: require('./resources/SKUs'), - Sources: require('./resources/Sources'), - SubscriptionItems: require('./resources/SubscriptionItems'), - SubscriptionSchedules: require('./resources/SubscriptionSchedules'), - Subscriptions: require('./resources/Subscriptions'), - TaxRates: require('./resources/TaxRates'), - ThreeDSecure: require('./resources/ThreeDSecure'), - Tokens: require('./resources/Tokens'), - Topups: require('./resources/Topups'), - Transfers: require('./resources/Transfers'), - UsageRecords: require('./resources/UsageRecords'), - UsageRecordSummaries: require('./resources/UsageRecordSummaries'), - WebhookEndpoints: require('./resources/WebhookEndpoints'), - - // Namespaced resources - Checkout: resourceNamespace('checkout', { - Sessions: require('./resources/Checkout/Sessions'), - }), - Issuing: resourceNamespace('issuing', { - Authorizations: require('./resources/Issuing/Authorizations'), - Cardholders: require('./resources/Issuing/Cardholders'), - Cards: require('./resources/Issuing/Cards'), - Disputes: require('./resources/Issuing/Disputes'), - Transactions: require('./resources/Issuing/Transactions'), - }), - Radar: resourceNamespace('radar', { - ValueLists: require('./resources/Radar/ValueLists'), - ValueListItems: require('./resources/Radar/ValueListItems'), - }), - Reporting: resourceNamespace('reporting', { - ReportRuns: require('./resources/Reporting/ReportRuns'), - ReportTypes: require('./resources/Reporting/ReportTypes'), - }), - Sigma: resourceNamespace('sigma', { - ScheduledQueryRuns: require('./resources/Sigma/ScheduledQueryRuns'), - }), - Terminal: resourceNamespace('terminal', { - ConnectionTokens: require('./resources/Terminal/ConnectionTokens'), - Locations: require('./resources/Terminal/Locations'), - Readers: require('./resources/Terminal/Readers'), - }), -}; - Stripe.StripeResource = require('./StripeResource'); Stripe.resources = resources;