From 539de368cce37651dad931f4a1bc3ac5a0235506 Mon Sep 17 00:00:00 2001 From: Annie Li Date: Wed, 15 Feb 2023 17:00:40 -0800 Subject: [PATCH] Codegen for openapi v224 --- OPENAPI_VERSION | 2 +- lib/resources/Accounts.js | 68 +- lib/resources/ApplicationFees.js | 10 +- lib/resources/CreditNotes.js | 10 +- lib/resources/Customers.js | 106 +- lib/resources/Invoices.js | 10 +- lib/resources/Transfers.js | 10 +- src/resources/Accounts.js | 72 +- src/resources/ApplicationFees.js | 12 +- src/resources/CreditNotes.js | 12 +- src/resources/Customers.js | 116 +- src/resources/Invoices.js | 12 +- src/resources/Transfers.js | 12 +- .../resources/generated_examples_test.spec.js | 1127 +++++++++-------- types/Accounts.d.ts | 10 +- types/AccountsResource.d.ts | 574 +++++---- types/ApplicationFeesResource.d.ts | 41 +- types/BillingPortal/Sessions.d.ts | 2 +- types/BillingPortal/SessionsResource.d.ts | 2 +- types/Checkout/Sessions.d.ts | 7 +- types/CreditNotesResource.d.ts | 40 +- types/CustomersResource.d.ts | 662 +++++----- types/InvoiceItems.d.ts | 16 +- types/InvoiceLineItems.d.ts | 2 +- types/Invoices.d.ts | 2 +- types/InvoicesResource.d.ts | 40 +- types/Refunds.d.ts | 2 +- types/Reporting/ReportRuns.d.ts | 4 +- types/Subscriptions.d.ts | 4 +- types/TransfersResource.d.ts | 41 +- 30 files changed, 1548 insertions(+), 1480 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 4e134f2a95..6c06b023d9 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v223 \ No newline at end of file +v224 \ No newline at end of file diff --git a/lib/resources/Accounts.js b/lib/resources/Accounts.js index 1be3480640..9c327d8dac 100644 --- a/lib/resources/Accounts.js +++ b/lib/resources/Accounts.js @@ -41,67 +41,67 @@ module.exports = StripeResource.extend({ method: 'DELETE', fullPath: '/v1/accounts/{account}', }), - reject: stripeMethod({ + createExternalAccount: stripeMethod({ method: 'POST', - fullPath: '/v1/accounts/{account}/reject', + fullPath: '/v1/accounts/{account}/external_accounts', }), - retrieveCapability: stripeMethod({ - method: 'GET', - fullPath: '/v1/accounts/{account}/capabilities/{capability}', + createLoginLink: stripeMethod({ + method: 'POST', + fullPath: '/v1/accounts/{account}/login_links', }), - updateCapability: stripeMethod({ + createPerson: stripeMethod({ method: 'POST', - fullPath: '/v1/accounts/{account}/capabilities/{capability}', + 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', }), - createExternalAccount: stripeMethod({ - method: 'POST', + listExternalAccounts: stripeMethod({ + method: 'GET', fullPath: '/v1/accounts/{account}/external_accounts', + methodType: 'list', }), - retrieveExternalAccount: stripeMethod({ + listPersons: stripeMethod({ method: 'GET', - fullPath: '/v1/accounts/{account}/external_accounts/{id}', + fullPath: '/v1/accounts/{account}/persons', + methodType: 'list', }), - updateExternalAccount: stripeMethod({ + reject: stripeMethod({ method: 'POST', - fullPath: '/v1/accounts/{account}/external_accounts/{id}', + fullPath: '/v1/accounts/{account}/reject', }), - listExternalAccounts: stripeMethod({ + retrieveCapability: stripeMethod({ method: 'GET', - fullPath: '/v1/accounts/{account}/external_accounts', - methodType: 'list', + fullPath: '/v1/accounts/{account}/capabilities/{capability}', }), - deleteExternalAccount: stripeMethod({ - method: 'DELETE', + retrieveExternalAccount: stripeMethod({ + method: 'GET', fullPath: '/v1/accounts/{account}/external_accounts/{id}', }), - createLoginLink: stripeMethod({ - method: 'POST', - fullPath: '/v1/accounts/{account}/login_links', - }), - createPerson: stripeMethod({ - method: 'POST', - fullPath: '/v1/accounts/{account}/persons', - }), retrievePerson: stripeMethod({ method: 'GET', fullPath: '/v1/accounts/{account}/persons/{person}', }), - updatePerson: stripeMethod({ + updateCapability: stripeMethod({ method: 'POST', - fullPath: '/v1/accounts/{account}/persons/{person}', + fullPath: '/v1/accounts/{account}/capabilities/{capability}', }), - listPersons: stripeMethod({ - method: 'GET', - fullPath: '/v1/accounts/{account}/persons', - methodType: 'list', + updateExternalAccount: stripeMethod({ + method: 'POST', + fullPath: '/v1/accounts/{account}/external_accounts/{id}', }), - deletePerson: stripeMethod({ - method: 'DELETE', + updatePerson: stripeMethod({ + method: 'POST', fullPath: '/v1/accounts/{account}/persons/{person}', }), }); diff --git a/lib/resources/ApplicationFees.js b/lib/resources/ApplicationFees.js index c61a07964e..8bf5ac12ce 100644 --- a/lib/resources/ApplicationFees.js +++ b/lib/resources/ApplicationFees.js @@ -16,6 +16,11 @@ module.exports = StripeResource.extend({ 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}', @@ -24,9 +29,4 @@ module.exports = StripeResource.extend({ method: 'POST', fullPath: '/v1/application_fees/{fee}/refunds/{id}', }), - listRefunds: stripeMethod({ - method: 'GET', - fullPath: '/v1/application_fees/{id}/refunds', - methodType: 'list', - }), }); diff --git a/lib/resources/CreditNotes.js b/lib/resources/CreditNotes.js index 2b2f42f4c8..e9b1dfb0f6 100644 --- a/lib/resources/CreditNotes.js +++ b/lib/resources/CreditNotes.js @@ -20,6 +20,11 @@ module.exports = StripeResource.extend({ 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', @@ -33,9 +38,4 @@ module.exports = StripeResource.extend({ method: 'POST', fullPath: '/v1/credit_notes/{id}/void', }), - listLineItems: stripeMethod({ - method: 'GET', - fullPath: '/v1/credit_notes/{credit_note}/lines', - methodType: 'list', - }), }); diff --git a/lib/resources/Customers.js b/lib/resources/Customers.js index 5196f84898..76bca1e205 100644 --- a/lib/resources/Customers.js +++ b/lib/resources/Customers.js @@ -28,98 +28,98 @@ module.exports = StripeResource.extend({ 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', }), - retrievePaymentMethod: stripeMethod({ + listBalanceTransactions: stripeMethod({ method: 'GET', - fullPath: '/v1/customers/{customer}/payment_methods/{payment_method}', + fullPath: '/v1/customers/{customer}/balance_transactions', + methodType: 'list', }), - search: stripeMethod({ + listCashBalanceTransactions: stripeMethod({ method: 'GET', - fullPath: '/v1/customers/search', - methodType: 'search', + fullPath: '/v1/customers/{customer}/cash_balance_transactions', + methodType: 'list', }), - retrieveCashBalance: stripeMethod({ + listSources: stripeMethod({ method: 'GET', - fullPath: '/v1/customers/{customer}/cash_balance', + fullPath: '/v1/customers/{customer}/sources', + methodType: 'list', }), - updateCashBalance: stripeMethod({ - method: 'POST', - fullPath: '/v1/customers/{customer}/cash_balance', + listTaxIds: stripeMethod({ + method: 'GET', + fullPath: '/v1/customers/{customer}/tax_ids', + methodType: 'list', }), - createBalanceTransaction: stripeMethod({ - method: 'POST', - fullPath: '/v1/customers/{customer}/balance_transactions', + retrievePaymentMethod: stripeMethod({ + method: 'GET', + fullPath: '/v1/customers/{customer}/payment_methods/{payment_method}', }), retrieveBalanceTransaction: stripeMethod({ method: 'GET', fullPath: '/v1/customers/{customer}/balance_transactions/{transaction}', }), - updateBalanceTransaction: stripeMethod({ - method: 'POST', - fullPath: '/v1/customers/{customer}/balance_transactions/{transaction}', - }), - listBalanceTransactions: stripeMethod({ + retrieveCashBalance: stripeMethod({ method: 'GET', - fullPath: '/v1/customers/{customer}/balance_transactions', - methodType: 'list', + fullPath: '/v1/customers/{customer}/cash_balance', }), retrieveCashBalanceTransaction: stripeMethod({ method: 'GET', fullPath: '/v1/customers/{customer}/cash_balance_transactions/{transaction}', }), - listCashBalanceTransactions: stripeMethod({ + retrieveSource: stripeMethod({ method: 'GET', - fullPath: '/v1/customers/{customer}/cash_balance_transactions', - methodType: 'list', + fullPath: '/v1/customers/{customer}/sources/{id}', }), - createSource: stripeMethod({ - method: 'POST', - fullPath: '/v1/customers/{customer}/sources', + retrieveTaxId: stripeMethod({ + method: 'GET', + fullPath: '/v1/customers/{customer}/tax_ids/{id}', }), - retrieveSource: stripeMethod({ + search: stripeMethod({ method: 'GET', - fullPath: '/v1/customers/{customer}/sources/{id}', + fullPath: '/v1/customers/search', + methodType: 'search', }), - updateSource: stripeMethod({ + updateBalanceTransaction: stripeMethod({ method: 'POST', - fullPath: '/v1/customers/{customer}/sources/{id}', + fullPath: '/v1/customers/{customer}/balance_transactions/{transaction}', }), - listSources: stripeMethod({ - method: 'GET', - fullPath: '/v1/customers/{customer}/sources', - methodType: 'list', + updateCashBalance: stripeMethod({ + method: 'POST', + fullPath: '/v1/customers/{customer}/cash_balance', }), - deleteSource: stripeMethod({ - method: 'DELETE', + updateSource: stripeMethod({ + method: 'POST', fullPath: '/v1/customers/{customer}/sources/{id}', }), verifySource: stripeMethod({ method: 'POST', fullPath: '/v1/customers/{customer}/sources/{id}/verify', }), - createTaxId: stripeMethod({ - method: 'POST', - fullPath: '/v1/customers/{customer}/tax_ids', - }), - retrieveTaxId: stripeMethod({ - method: 'GET', - fullPath: '/v1/customers/{customer}/tax_ids/{id}', - }), - listTaxIds: stripeMethod({ - method: 'GET', - fullPath: '/v1/customers/{customer}/tax_ids', - methodType: 'list', - }), - deleteTaxId: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/customers/{customer}/tax_ids/{id}', - }), }); diff --git a/lib/resources/Invoices.js b/lib/resources/Invoices.js index 7516508fac..16d6a96d32 100644 --- a/lib/resources/Invoices.js +++ b/lib/resources/Invoices.js @@ -28,6 +28,11 @@ module.exports = StripeResource.extend({ 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', @@ -58,9 +63,4 @@ module.exports = StripeResource.extend({ method: 'POST', fullPath: '/v1/invoices/{invoice}/void', }), - listLineItems: stripeMethod({ - method: 'GET', - fullPath: '/v1/invoices/{invoice}/lines', - methodType: 'list', - }), }); diff --git a/lib/resources/Transfers.js b/lib/resources/Transfers.js index 6fb574d6f2..544d3d311f 100644 --- a/lib/resources/Transfers.js +++ b/lib/resources/Transfers.js @@ -24,6 +24,11 @@ module.exports = StripeResource.extend({ 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}', @@ -32,9 +37,4 @@ module.exports = StripeResource.extend({ method: 'POST', fullPath: '/v1/transfers/{transfer}/reversals/{id}', }), - listReversals: stripeMethod({ - method: 'GET', - fullPath: '/v1/transfers/{id}/reversals', - methodType: 'list', - }), }); diff --git a/src/resources/Accounts.js b/src/resources/Accounts.js index 9956629e30..e31178aefd 100644 --- a/src/resources/Accounts.js +++ b/src/resources/Accounts.js @@ -48,19 +48,29 @@ module.exports = StripeResource.extend({ fullPath: '/v1/accounts/{account}', }), - reject: stripeMethod({ + createExternalAccount: stripeMethod({ method: 'POST', - fullPath: '/v1/accounts/{account}/reject', + fullPath: '/v1/accounts/{account}/external_accounts', }), - retrieveCapability: stripeMethod({ - method: 'GET', - fullPath: '/v1/accounts/{account}/capabilities/{capability}', + createLoginLink: stripeMethod({ + method: 'POST', + fullPath: '/v1/accounts/{account}/login_links', }), - updateCapability: stripeMethod({ + createPerson: stripeMethod({ method: 'POST', - fullPath: '/v1/accounts/{account}/capabilities/{capability}', + 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({ @@ -69,60 +79,50 @@ module.exports = StripeResource.extend({ methodType: 'list', }), - createExternalAccount: stripeMethod({ - method: 'POST', + listExternalAccounts: stripeMethod({ + method: 'GET', fullPath: '/v1/accounts/{account}/external_accounts', + methodType: 'list', }), - retrieveExternalAccount: stripeMethod({ + listPersons: stripeMethod({ method: 'GET', - fullPath: '/v1/accounts/{account}/external_accounts/{id}', + fullPath: '/v1/accounts/{account}/persons', + methodType: 'list', }), - updateExternalAccount: stripeMethod({ + reject: stripeMethod({ method: 'POST', - fullPath: '/v1/accounts/{account}/external_accounts/{id}', + fullPath: '/v1/accounts/{account}/reject', }), - listExternalAccounts: stripeMethod({ + retrieveCapability: stripeMethod({ method: 'GET', - fullPath: '/v1/accounts/{account}/external_accounts', - methodType: 'list', + fullPath: '/v1/accounts/{account}/capabilities/{capability}', }), - deleteExternalAccount: stripeMethod({ - method: 'DELETE', + retrieveExternalAccount: stripeMethod({ + method: 'GET', fullPath: '/v1/accounts/{account}/external_accounts/{id}', }), - createLoginLink: stripeMethod({ - method: 'POST', - fullPath: '/v1/accounts/{account}/login_links', - }), - - createPerson: stripeMethod({ - method: 'POST', - fullPath: '/v1/accounts/{account}/persons', - }), - retrievePerson: stripeMethod({ method: 'GET', fullPath: '/v1/accounts/{account}/persons/{person}', }), - updatePerson: stripeMethod({ + updateCapability: stripeMethod({ method: 'POST', - fullPath: '/v1/accounts/{account}/persons/{person}', + fullPath: '/v1/accounts/{account}/capabilities/{capability}', }), - listPersons: stripeMethod({ - method: 'GET', - fullPath: '/v1/accounts/{account}/persons', - methodType: 'list', + updateExternalAccount: stripeMethod({ + method: 'POST', + fullPath: '/v1/accounts/{account}/external_accounts/{id}', }), - deletePerson: stripeMethod({ - method: 'DELETE', + updatePerson: stripeMethod({ + method: 'POST', fullPath: '/v1/accounts/{account}/persons/{person}', }), }); diff --git a/src/resources/ApplicationFees.js b/src/resources/ApplicationFees.js index 21affd640b..919cc718e0 100644 --- a/src/resources/ApplicationFees.js +++ b/src/resources/ApplicationFees.js @@ -22,6 +22,12 @@ module.exports = StripeResource.extend({ 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}', @@ -31,10 +37,4 @@ module.exports = StripeResource.extend({ method: 'POST', fullPath: '/v1/application_fees/{fee}/refunds/{id}', }), - - listRefunds: stripeMethod({ - method: 'GET', - fullPath: '/v1/application_fees/{id}/refunds', - methodType: 'list', - }), }); diff --git a/src/resources/CreditNotes.js b/src/resources/CreditNotes.js index eda7d9e29d..70340b08f9 100644 --- a/src/resources/CreditNotes.js +++ b/src/resources/CreditNotes.js @@ -27,6 +27,12 @@ module.exports = StripeResource.extend({ 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', @@ -42,10 +48,4 @@ module.exports = StripeResource.extend({ method: 'POST', fullPath: '/v1/credit_notes/{id}/void', }), - - listLineItems: stripeMethod({ - method: 'GET', - fullPath: '/v1/credit_notes/{credit_note}/lines', - methodType: 'list', - }), }); diff --git a/src/resources/Customers.js b/src/resources/Customers.js index 234e5573ba..f44166eff1 100644 --- a/src/resources/Customers.js +++ b/src/resources/Customers.js @@ -37,41 +37,69 @@ module.exports = StripeResource.extend({ 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', }), - retrievePaymentMethod: stripeMethod({ + listBalanceTransactions: stripeMethod({ method: 'GET', - fullPath: '/v1/customers/{customer}/payment_methods/{payment_method}', + fullPath: '/v1/customers/{customer}/balance_transactions', + methodType: 'list', }), - search: stripeMethod({ + listCashBalanceTransactions: stripeMethod({ method: 'GET', - fullPath: '/v1/customers/search', - methodType: 'search', + fullPath: '/v1/customers/{customer}/cash_balance_transactions', + methodType: 'list', }), - retrieveCashBalance: stripeMethod({ + listSources: stripeMethod({ method: 'GET', - fullPath: '/v1/customers/{customer}/cash_balance', + fullPath: '/v1/customers/{customer}/sources', + methodType: 'list', }), - updateCashBalance: stripeMethod({ - method: 'POST', - fullPath: '/v1/customers/{customer}/cash_balance', + listTaxIds: stripeMethod({ + method: 'GET', + fullPath: '/v1/customers/{customer}/tax_ids', + methodType: 'list', }), - createBalanceTransaction: stripeMethod({ - method: 'POST', - fullPath: '/v1/customers/{customer}/balance_transactions', + retrievePaymentMethod: stripeMethod({ + method: 'GET', + fullPath: '/v1/customers/{customer}/payment_methods/{payment_method}', }), retrieveBalanceTransaction: stripeMethod({ @@ -79,15 +107,9 @@ module.exports = StripeResource.extend({ fullPath: '/v1/customers/{customer}/balance_transactions/{transaction}', }), - updateBalanceTransaction: stripeMethod({ - method: 'POST', - fullPath: '/v1/customers/{customer}/balance_transactions/{transaction}', - }), - - listBalanceTransactions: stripeMethod({ + retrieveCashBalance: stripeMethod({ method: 'GET', - fullPath: '/v1/customers/{customer}/balance_transactions', - methodType: 'list', + fullPath: '/v1/customers/{customer}/cash_balance', }), retrieveCashBalanceTransaction: stripeMethod({ @@ -96,35 +118,34 @@ module.exports = StripeResource.extend({ '/v1/customers/{customer}/cash_balance_transactions/{transaction}', }), - listCashBalanceTransactions: stripeMethod({ + retrieveSource: stripeMethod({ method: 'GET', - fullPath: '/v1/customers/{customer}/cash_balance_transactions', - methodType: 'list', + fullPath: '/v1/customers/{customer}/sources/{id}', }), - createSource: stripeMethod({ - method: 'POST', - fullPath: '/v1/customers/{customer}/sources', + retrieveTaxId: stripeMethod({ + method: 'GET', + fullPath: '/v1/customers/{customer}/tax_ids/{id}', }), - retrieveSource: stripeMethod({ + search: stripeMethod({ method: 'GET', - fullPath: '/v1/customers/{customer}/sources/{id}', + fullPath: '/v1/customers/search', + methodType: 'search', }), - updateSource: stripeMethod({ + updateBalanceTransaction: stripeMethod({ method: 'POST', - fullPath: '/v1/customers/{customer}/sources/{id}', + fullPath: '/v1/customers/{customer}/balance_transactions/{transaction}', }), - listSources: stripeMethod({ - method: 'GET', - fullPath: '/v1/customers/{customer}/sources', - methodType: 'list', + updateCashBalance: stripeMethod({ + method: 'POST', + fullPath: '/v1/customers/{customer}/cash_balance', }), - deleteSource: stripeMethod({ - method: 'DELETE', + updateSource: stripeMethod({ + method: 'POST', fullPath: '/v1/customers/{customer}/sources/{id}', }), @@ -132,25 +153,4 @@ module.exports = StripeResource.extend({ method: 'POST', fullPath: '/v1/customers/{customer}/sources/{id}/verify', }), - - createTaxId: stripeMethod({ - method: 'POST', - fullPath: '/v1/customers/{customer}/tax_ids', - }), - - retrieveTaxId: stripeMethod({ - method: 'GET', - fullPath: '/v1/customers/{customer}/tax_ids/{id}', - }), - - listTaxIds: stripeMethod({ - method: 'GET', - fullPath: '/v1/customers/{customer}/tax_ids', - methodType: 'list', - }), - - deleteTaxId: stripeMethod({ - method: 'DELETE', - fullPath: '/v1/customers/{customer}/tax_ids/{id}', - }), }); diff --git a/src/resources/Invoices.js b/src/resources/Invoices.js index 4e1866f0ac..85b3fc5812 100644 --- a/src/resources/Invoices.js +++ b/src/resources/Invoices.js @@ -37,6 +37,12 @@ module.exports = StripeResource.extend({ 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', @@ -73,10 +79,4 @@ module.exports = StripeResource.extend({ method: 'POST', fullPath: '/v1/invoices/{invoice}/void', }), - - listLineItems: stripeMethod({ - method: 'GET', - fullPath: '/v1/invoices/{invoice}/lines', - methodType: 'list', - }), }); diff --git a/src/resources/Transfers.js b/src/resources/Transfers.js index 743c887335..5a36025701 100644 --- a/src/resources/Transfers.js +++ b/src/resources/Transfers.js @@ -32,6 +32,12 @@ module.exports = StripeResource.extend({ 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}', @@ -41,10 +47,4 @@ module.exports = StripeResource.extend({ method: 'POST', fullPath: '/v1/transfers/{transfer}/reversals/{id}', }), - - listReversals: stripeMethod({ - method: 'GET', - fullPath: '/v1/transfers/{id}/reversals', - methodType: 'list', - }), }); diff --git a/test/resources/generated_examples_test.spec.js b/test/resources/generated_examples_test.spec.js index a412b91444..8450ea0a30 100644 --- a/test/resources/generated_examples_test.spec.js +++ b/test/resources/generated_examples_test.spec.js @@ -2,9 +2,212 @@ 'use strict'; -const stripe = require('../../testUtils').getStripeMockClient(); +const testUtils = require('../../testUtils'); +const stripe = testUtils.getStripeMockClient(); const expect = require('chai').expect; +describe('Accounts', function() { + it('listExternalAccounts method', async function() { + const externalAccount = await stripe.accounts.listExternalAccounts( + 'acct_xxxxxxxxxxxxx', + {limit: 3} + ); + expect(externalAccount).not.to.be.null; + }); + + it('list method', async function() { + const accounts = await stripe.accounts.list({limit: 3}); + expect(accounts).not.to.be.null; + }); + + it('create method', async function() { + const account = await stripe.accounts.create({ + type: 'custom', + country: 'US', + email: 'jenny.rosen@example.com', + capabilities: { + card_payments: {requested: true}, + transfers: {requested: true}, + }, + }); + expect(account).not.to.be.null; + }); + + it('del method', async function() { + const deleted = await stripe.accounts.del('acct_xxxxxxxxxxxxx'); + expect(deleted).not.to.be.null; + }); + + it('retrieve method', async function() { + const account = await stripe.accounts.retrieve('acct_xxxxxxxxxxxxx'); + expect(account).not.to.be.null; + }); + + it('update method', async function() { + const account = await stripe.accounts.update('acct_xxxxxxxxxxxxx', { + metadata: {order_id: '6735'}, + }); + expect(account).not.to.be.null; + }); + + it('reject method', async function() { + const account = await stripe.accounts.reject('acct_xxxxxxxxxxxxx', { + reason: 'fraud', + }); + expect(account).not.to.be.null; + }); + + it('listCapabilities method', async function() { + const capabilities = await stripe.accounts.listCapabilities( + 'acct_xxxxxxxxxxxxx' + ); + expect(capabilities).not.to.be.null; + }); + + it('retrieveCapability method', async function() { + const capability = await stripe.accounts.retrieveCapability( + 'acct_xxxxxxxxxxxxx', + 'card_payments' + ); + expect(capability).not.to.be.null; + }); + + it('updateCapability method', async function() { + const capability = await stripe.accounts.updateCapability( + 'acct_xxxxxxxxxxxxx', + 'card_payments', + {requested: true} + ); + expect(capability).not.to.be.null; + }); + + it('createExternalAccount method', async function() { + const externalAccount = await stripe.accounts.createExternalAccount( + 'acct_xxxxxxxxxxxxx', + {external_account: 'btok_xxxxxxxxxxxxx'} + ); + expect(externalAccount).not.to.be.null; + }); + + it('createExternalAccount method', async function() { + const externalAccount = await stripe.accounts.createExternalAccount( + 'acct_xxxxxxxxxxxxx', + {external_account: 'tok_xxxx_debit'} + ); + expect(externalAccount).not.to.be.null; + }); + + it('deleteExternalAccount method', async function() { + const deletedExternalAccount = await stripe.accounts.deleteExternalAccount( + 'acct_xxxxxxxxxxxxx', + 'ba_xxxxxxxxxxxxx' + ); + expect(deletedExternalAccount).not.to.be.null; + }); + + it('deleteExternalAccount method', async function() { + const deletedExternalAccount = await stripe.accounts.deleteExternalAccount( + 'acct_xxxxxxxxxxxxx', + 'card_xxxxxxxxxxxxx' + ); + expect(deletedExternalAccount).not.to.be.null; + }); + + it('retrieveExternalAccount method', async function() { + const externalAccount = await stripe.accounts.retrieveExternalAccount( + 'acct_xxxxxxxxxxxxx', + 'ba_xxxxxxxxxxxxx' + ); + expect(externalAccount).not.to.be.null; + }); + + it('retrieveExternalAccount method', async function() { + const externalAccount = await stripe.accounts.retrieveExternalAccount( + 'acct_xxxxxxxxxxxxx', + 'card_xxxxxxxxxxxxx' + ); + expect(externalAccount).not.to.be.null; + }); + + it('updateExternalAccount method', async function() { + const externalAccount = await stripe.accounts.updateExternalAccount( + 'acct_xxxxxxxxxxxxx', + 'ba_xxxxxxxxxxxxx', + {metadata: {order_id: '6735'}} + ); + expect(externalAccount).not.to.be.null; + }); + + it('updateExternalAccount method', async function() { + const externalAccount = await stripe.accounts.updateExternalAccount( + 'acct_xxxxxxxxxxxxx', + 'card_xxxxxxxxxxxxx', + {metadata: {order_id: '6735'}} + ); + expect(externalAccount).not.to.be.null; + }); + + it('createLoginLink method', async function() { + const loginLink = await stripe.accounts.createLoginLink( + 'acct_xxxxxxxxxxxxx' + ); + expect(loginLink).not.to.be.null; + }); + + it('listPersons method', async function() { + const persons = await stripe.accounts.listPersons('acct_xxxxxxxxxxxxx', { + limit: 3, + }); + expect(persons).not.to.be.null; + }); + + it('createPerson method', async function() { + const person = await stripe.accounts.createPerson('acct_xxxxxxxxxxxxx', { + first_name: 'Jane', + last_name: 'Diaz', + }); + expect(person).not.to.be.null; + }); + + it('deletePerson method', async function() { + const deleted = await stripe.accounts.deletePerson( + 'acct_xxxxxxxxxxxxx', + 'person_xxxxxxxxxxxxx' + ); + expect(deleted).not.to.be.null; + }); + + it('retrievePerson method', async function() { + const person = await stripe.accounts.retrievePerson( + 'acct_xxxxxxxxxxxxx', + 'person_xxxxxxxxxxxxx' + ); + expect(person).not.to.be.null; + }); + + it('updatePerson method', async function() { + const person = await stripe.accounts.updatePerson( + 'acct_xxxxxxxxxxxxx', + 'person_xxxxxxxxxxxxx', + {metadata: {order_id: '6735'}} + ); + expect(person).not.to.be.null; + }); + + it('retrieve method', async function() { + const stripe = testUtils.createMockClient([ + { + method: 'GET', + path: '/v1/accounts/acc_123', + response: + '{"business_profile":{"mcc":"mcc","name":"name","product_description":"product_description","support_address":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state"},"support_email":"support_email","support_phone":"support_phone","support_url":"support_url","url":"url"},"business_type":"government_entity","capabilities":{"acss_debit_payments":"inactive","affirm_payments":"pending","afterpay_clearpay_payments":"inactive","au_becs_debit_payments":"active","bacs_debit_payments":"active","bancontact_payments":"inactive","bank_transfer_payments":"pending","blik_payments":"inactive","boleto_payments":"inactive","card_issuing":"active","card_payments":"active","cartes_bancaires_payments":"active","eps_payments":"inactive","fpx_payments":"active","giropay_payments":"active","grabpay_payments":"pending","ideal_payments":"inactive","india_international_payments":"inactive","jcb_payments":"inactive","klarna_payments":"active","konbini_payments":"active","legacy_payments":"active","link_payments":"inactive","oxxo_payments":"pending","p24_payments":"inactive","paynow_payments":"active","promptpay_payments":"active","sepa_debit_payments":"inactive","sofort_payments":"active","tax_reporting_us_1099_k":"inactive","tax_reporting_us_1099_misc":"pending","transfers":"inactive","treasury":"pending","us_bank_account_ach_payments":"pending"},"charges_enabled":true,"company":{"address":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state"},"address_kana":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state","town":"town"},"address_kanji":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state","town":"town"},"directors_provided":true,"executives_provided":true,"name":"name","name_kana":"name_kana","name_kanji":"name_kanji","owners_provided":true,"ownership_declaration":{"date":"3076014","ip":"ip","user_agent":"user_agent"},"phone":"phone","structure":"sole_establishment","tax_id_provided":true,"tax_id_registrar":"tax_id_registrar","vat_id_provided":true,"verification":{"document":{"back":{"created":"1028554472","expires_at":"833811170","filename":"filename","id":"obj_123","links":null,"object":"file","purpose":"finance_report_run","size":3530753,"title":"title","type":"type","url":"url"},"details":"details","details_code":"details_code","front":{"created":"1028554472","expires_at":"833811170","filename":"filename","id":"obj_123","links":null,"object":"file","purpose":"finance_report_run","size":3530753,"title":"title","type":"type","url":"url"}}}},"controller":{"is_controller":true,"type":"account"},"country":"country","created":"1028554472","default_currency":"default_currency","details_submitted":true,"email":"email","external_accounts":null,"future_requirements":{"alternatives":[{"alternative_fields_due":["alternative_fields_due"],"original_fields_due":["original_fields_due"]}],"current_deadline":"270965154","currently_due":["currently_due"],"disabled_reason":"disabled_reason","errors":[{"code":"verification_document_failed_copy","reason":"reason","requirement":"requirement"}],"eventually_due":["eventually_due"],"past_due":["past_due"],"pending_verification":["pending_verification"]},"id":"obj_123","individual":{"account":"account","address":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state"},"address_kana":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state","town":"town"},"address_kanji":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state","town":"town"},"created":"1028554472","dob":{"day":99228,"month":104080000,"year":3704893},"email":"email","first_name":"first_name","first_name_kana":"first_name_kana","first_name_kanji":"first_name_kanji","full_name_aliases":["full_name_aliases"],"future_requirements":{"alternatives":[{"alternative_fields_due":["alternative_fields_due"],"original_fields_due":["original_fields_due"]}],"currently_due":["currently_due"],"errors":[{"code":"verification_document_failed_copy","reason":"reason","requirement":"requirement"}],"eventually_due":["eventually_due"],"past_due":["past_due"],"pending_verification":["pending_verification"]},"gender":"gender","id":"obj_123","id_number_provided":true,"id_number_secondary_provided":true,"last_name":"last_name","last_name_kana":"last_name_kana","last_name_kanji":"last_name_kanji","maiden_name":"maiden_name","metadata":{"undefined":"metadata"},"nationality":"nationality","object":"person","phone":"phone","political_exposure":"none","registered_address":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state"},"relationship":{"director":true,"executive":true,"owner":true,"percent_ownership":760989685,"representative":true,"title":"title"},"requirements":{"alternatives":[{"alternative_fields_due":["alternative_fields_due"],"original_fields_due":["original_fields_due"]}],"currently_due":["currently_due"],"errors":[{"code":"verification_document_failed_copy","reason":"reason","requirement":"requirement"}],"eventually_due":["eventually_due"],"past_due":["past_due"],"pending_verification":["pending_verification"]},"ssn_last_4_provided":true,"verification":{"additional_document":{"back":{"created":"1028554472","expires_at":"833811170","filename":"filename","id":"obj_123","links":null,"object":"file","purpose":"finance_report_run","size":3530753,"title":"title","type":"type","url":"url"},"details":"details","details_code":"details_code","front":{"created":"1028554472","expires_at":"833811170","filename":"filename","id":"obj_123","links":null,"object":"file","purpose":"finance_report_run","size":3530753,"title":"title","type":"type","url":"url"}},"details":"details","details_code":"details_code","document":{"back":{"created":"1028554472","expires_at":"833811170","filename":"filename","id":"obj_123","links":null,"object":"file","purpose":"finance_report_run","size":3530753,"title":"title","type":"type","url":"url"},"details":"details","details_code":"details_code","front":{"created":"1028554472","expires_at":"833811170","filename":"filename","id":"obj_123","links":null,"object":"file","purpose":"finance_report_run","size":3530753,"title":"title","type":"type","url":"url"}},"status":"status"}},"metadata":{"undefined":"metadata"},"object":"account","payouts_enabled":true,"requirements":{"alternatives":[{"alternative_fields_due":["alternative_fields_due"],"original_fields_due":["original_fields_due"]}],"current_deadline":"270965154","currently_due":["currently_due"],"disabled_reason":"disabled_reason","errors":[{"code":"verification_document_failed_copy","reason":"reason","requirement":"requirement"}],"eventually_due":["eventually_due"],"past_due":["past_due"],"pending_verification":["pending_verification"]},"settings":{"bacs_debit_payments":{"display_name":"display_name"},"branding":{"icon":{"created":"1028554472","expires_at":"833811170","filename":"filename","id":"obj_123","links":null,"object":"file","purpose":"finance_report_run","size":3530753,"title":"title","type":"type","url":"url"},"logo":{"created":"1028554472","expires_at":"833811170","filename":"filename","id":"obj_123","links":null,"object":"file","purpose":"finance_report_run","size":3530753,"title":"title","type":"type","url":"url"},"primary_color":"primary_color","secondary_color":"secondary_color"},"card_issuing":{"tos_acceptance":{"date":3076014,"ip":"ip","user_agent":"user_agent"}},"card_payments":{"decline_on":{"avs_failure":true,"cvc_failure":true},"statement_descriptor_prefix":"statement_descriptor_prefix","statement_descriptor_prefix_kana":"statement_descriptor_prefix_kana","statement_descriptor_prefix_kanji":"statement_descriptor_prefix_kanji"},"dashboard":{"display_name":"display_name","timezone":"timezone"},"payments":{"statement_descriptor":"statement_descriptor","statement_descriptor_kana":"statement_descriptor_kana","statement_descriptor_kanji":"statement_descriptor_kanji","statement_descriptor_prefix_kana":"statement_descriptor_prefix_kana","statement_descriptor_prefix_kanji":"statement_descriptor_prefix_kanji"},"payouts":{"debit_negative_balances":true,"schedule":{"delay_days":1647351405,"interval":"interval","monthly_anchor":1920305369,"weekly_anchor":"weekly_anchor"},"statement_descriptor":"statement_descriptor"},"sepa_debit_payments":{"creditor_id":"creditor_id"},"treasury":{"tos_acceptance":{"date":3076014,"ip":"ip","user_agent":"user_agent"}}},"tos_acceptance":{"date":"3076014","ip":"ip","service_agreement":"service_agreement","user_agent":"user_agent"},"type":"custom"}', + }, + ]); + const account = await stripe.accounts.retrieve('acc_123'); + expect(account).not.to.be.null; + }); +}); + describe('Apps.Secrets', function() { it('list method', async function() { const secrets = await stripe.apps.secrets.list({ @@ -39,6 +242,14 @@ describe('Apps.Secrets', function() { expect(secret).not.to.be.null; }); + it('list method', async function() { + const secrets = await stripe.apps.secrets.list({ + scope: {type: 'account'}, + limit: 2, + }); + expect(secrets).not.to.be.null; + }); + it('create method', async function() { const secret = await stripe.apps.secrets.create({ name: 'my-api-key', @@ -89,7 +300,6 @@ describe('Checkout.Sessions', function() { it('create method', async function() { const session = await stripe.checkout.sessions.create({ success_url: 'https://example.com/success', - cancel_url: 'https://example.com/cancel', line_items: [{price: 'price_xxxxxxxxxxxxx', quantity: 2}], mode: 'payment', }); @@ -111,7 +321,7 @@ describe('Checkout.Sessions', function() { }); }); -describe('CashBalance', function() { +describe('Customers', function() { it('retrieveCashBalance method', async function() { const cashBalance = await stripe.customers.retrieveCashBalance('cus_123'); expect(cashBalance).not.to.be.null; @@ -123,9 +333,7 @@ describe('CashBalance', function() { }); expect(cashBalance).not.to.be.null; }); -}); -describe('Customers', function() { it('createFundingInstructions method', async function() { const fundingInstructions = await stripe.customers.createFundingInstructions( 'cus_123', @@ -149,6 +357,13 @@ describe('Customers', function() { expect(paymentMethods).not.to.be.null; }); + it('updateSource method', async function() { + const card = await stripe.customers.updateSource('cus_123', 'card_123', { + account_holder_name: 'Kamil', + }); + expect(card).not.to.be.null; + }); + it('list method', async function() { const customers = await stripe.customers.list({limit: 3}); expect(customers).not.to.be.null; @@ -161,7 +376,8 @@ describe('Customers', function() { it('create method', async function() { const customer = await stripe.customers.create({ - description: 'My First Test Customer (created for API docs)', + description: + 'My First Test Customer (created for API docs at https://www.stripe.com/docs/api)', }); expect(customer).not.to.be.null; }); @@ -183,45 +399,200 @@ describe('Customers', function() { expect(customer).not.to.be.null; }); - it('listPaymentMethods method', async function() { - const paymentMethods = await stripe.customers.listPaymentMethods( + it('listBalanceTransactions method', async function() { + const customerBalanceTransactions = await stripe.customers.listBalanceTransactions( 'cus_xxxxxxxxxxxxx', - {type: 'card'} + {limit: 3} ); - expect(paymentMethods).not.to.be.null; - }); - - it('search method', async function() { - const customers = await stripe.customers.search({ - query: "name:'fakename' AND metadata['foo']:'bar'", - }); - expect(customers).not.to.be.null; + expect(customerBalanceTransactions).not.to.be.null; }); - it('search method', async function() { - const customers = await stripe.customers.search({ - query: "name:'fakename' AND metadata['foo']:'bar'", - }); - expect(customers).not.to.be.null; + it('createBalanceTransaction method', async function() { + const customerBalanceTransaction = await stripe.customers.createBalanceTransaction( + 'cus_xxxxxxxxxxxxx', + {amount: -500, currency: 'usd'} + ); + expect(customerBalanceTransaction).not.to.be.null; }); -}); -describe('FinancialConnections.Accounts', function() { - it('list method', async function() { - const accounts = await stripe.financialConnections.accounts.list(); - expect(accounts).not.to.be.null; + it('retrieveBalanceTransaction method', async function() { + const customerBalanceTransaction = await stripe.customers.retrieveBalanceTransaction( + 'cus_xxxxxxxxxxxxx', + 'cbtxn_xxxxxxxxxxxxx' + ); + expect(customerBalanceTransaction).not.to.be.null; }); - it('retrieve method', async function() { - const account = await stripe.financialConnections.accounts.retrieve( - 'fca_xyz' + it('updateBalanceTransaction method', async function() { + const customerBalanceTransaction = await stripe.customers.updateBalanceTransaction( + 'cus_xxxxxxxxxxxxx', + 'cbtxn_xxxxxxxxxxxxx', + {metadata: {order_id: '6735'}} ); - expect(account).not.to.be.null; + expect(customerBalanceTransaction).not.to.be.null; }); - it('disconnect method', async function() { - const account = await stripe.financialConnections.accounts.disconnect( - 'fca_xyz' + it('listPaymentMethods method', async function() { + const paymentMethods = await stripe.customers.listPaymentMethods( + 'cus_xxxxxxxxxxxxx', + {type: 'card'} + ); + expect(paymentMethods).not.to.be.null; + }); + + it('listSources method', async function() { + const paymentSource = await stripe.customers.listSources( + 'cus_xxxxxxxxxxxxx', + {object: 'bank_account', limit: 3} + ); + expect(paymentSource).not.to.be.null; + }); + + it('listSources method', async function() { + const paymentSource = await stripe.customers.listSources( + 'cus_xxxxxxxxxxxxx', + {object: 'card', limit: 3} + ); + expect(paymentSource).not.to.be.null; + }); + + it('createSource method', async function() { + const paymentSource = await stripe.customers.createSource( + 'cus_xxxxxxxxxxxxx', + {source: 'btok_xxxxxxxxxxxxx'} + ); + expect(paymentSource).not.to.be.null; + }); + + it('createSource method', async function() { + const paymentSource = await stripe.customers.createSource( + 'cus_xxxxxxxxxxxxx', + {source: 'tok_xxxx'} + ); + expect(paymentSource).not.to.be.null; + }); + + it('deleteSource method', async function() { + const paymentSource = await stripe.customers.deleteSource( + 'cus_xxxxxxxxxxxxx', + 'ba_xxxxxxxxxxxxx' + ); + expect(paymentSource).not.to.be.null; + }); + + it('deleteSource method', async function() { + const paymentSource = await stripe.customers.deleteSource( + 'cus_xxxxxxxxxxxxx', + 'card_xxxxxxxxxxxxx' + ); + expect(paymentSource).not.to.be.null; + }); + + it('retrieveSource method', async function() { + const paymentSource = await stripe.customers.retrieveSource( + 'cus_xxxxxxxxxxxxx', + 'ba_xxxxxxxxxxxxx' + ); + expect(paymentSource).not.to.be.null; + }); + + it('retrieveSource method', async function() { + const paymentSource = await stripe.customers.retrieveSource( + 'cus_xxxxxxxxxxxxx', + 'card_xxxxxxxxxxxxx' + ); + expect(paymentSource).not.to.be.null; + }); + + it('updateSource method', async function() { + const card = await stripe.customers.updateSource( + 'cus_xxxxxxxxxxxxx', + 'ba_xxxxxxxxxxxxx', + {metadata: {order_id: '6735'}} + ); + expect(card).not.to.be.null; + }); + + it('updateSource method', async function() { + const card = await stripe.customers.updateSource( + 'cus_xxxxxxxxxxxxx', + 'card_xxxxxxxxxxxxx', + {name: 'Jenny Rosen'} + ); + expect(card).not.to.be.null; + }); + + it('verifySource method', async function() { + const bankAccount = await stripe.customers.verifySource( + 'cus_xxxxxxxxxxxxx', + 'ba_xxxxxxxxxxxxx', + {amounts: [32, 45]} + ); + expect(bankAccount).not.to.be.null; + }); + + it('listTaxIds method', async function() { + const taxIds = await stripe.customers.listTaxIds('cus_xxxxxxxxxxxxx', { + limit: 3, + }); + expect(taxIds).not.to.be.null; + }); + + it('createTaxId method', async function() { + const taxId = await stripe.customers.createTaxId('cus_xxxxxxxxxxxxx', { + type: 'eu_vat', + value: 'DE123456789', + }); + expect(taxId).not.to.be.null; + }); + + it('deleteTaxId method', async function() { + const deleted = await stripe.customers.deleteTaxId( + 'cus_xxxxxxxxxxxxx', + 'txi_xxxxxxxxxxxxx' + ); + expect(deleted).not.to.be.null; + }); + + it('retrieveTaxId method', async function() { + const taxId = await stripe.customers.retrieveTaxId( + 'cus_xxxxxxxxxxxxx', + 'txi_xxxxxxxxxxxxx' + ); + expect(taxId).not.to.be.null; + }); + + it('search method', async function() { + const customers = await stripe.customers.search({ + query: "name:'fakename' AND metadata['foo']:'bar'", + }); + expect(customers).not.to.be.null; + }); + + it('search method', async function() { + const customers = await stripe.customers.search({ + query: "name:'fakename' AND metadata['foo']:'bar'", + }); + expect(customers).not.to.be.null; + }); +}); + +describe('FinancialConnections.Accounts', function() { + it('list method', async function() { + const accounts = await stripe.financialConnections.accounts.list(); + expect(accounts).not.to.be.null; + }); + + it('retrieve method', async function() { + const account = await stripe.financialConnections.accounts.retrieve( + 'fca_xyz' + ); + expect(account).not.to.be.null; + }); + + it('disconnect method', async function() { + const account = await stripe.financialConnections.accounts.disconnect( + 'fca_xyz' ); expect(account).not.to.be.null; }); @@ -256,6 +627,13 @@ describe('FinancialConnections.Accounts', function() { expect(account).not.to.be.null; }); + it('disconnect method', async function() { + const account = await stripe.financialConnections.accounts.disconnect( + 'fca_xxxxxxxxxxxxx' + ); + expect(account).not.to.be.null; + }); + it('listOwners method', async function() { const accountOwners = await stripe.financialConnections.accounts.listOwners( 'fca_xxxxxxxxxxxxx', @@ -394,7 +772,7 @@ describe('PaymentIntents', function() { const paymentIntent = await stripe.paymentIntents.create({ amount: 2000, currency: 'usd', - payment_method_types: ['card'], + automatic_payment_methods: {enabled: true}, }); expect(paymentIntent).not.to.be.null; }); @@ -451,6 +829,14 @@ describe('PaymentIntents', function() { expect(paymentIntent).not.to.be.null; }); + it('verifyMicrodeposits method', async function() { + const paymentIntent = await stripe.paymentIntents.verifyMicrodeposits( + 'pi_xxxxxxxxxxxxx', + {amounts: [32, 45]} + ); + expect(paymentIntent).not.to.be.null; + }); + it('search method', async function() { const paymentIntents = await stripe.paymentIntents.search({ query: "status:'succeeded' AND metadata['order_id']:'6735'", @@ -611,6 +997,14 @@ describe('SetupIntents', function() { ); expect(setupIntent).not.to.be.null; }); + + it('verifyMicrodeposits method', async function() { + const setupIntent = await stripe.setupIntents.verifyMicrodeposits( + 'seti_xxxxxxxxxxxxx', + {amounts: [32, 45]} + ); + expect(setupIntent).not.to.be.null; + }); }); describe('ShippingRates', function() { @@ -825,7 +1219,7 @@ describe('TestHelpers.TestClocks', function() { it('advance method', async function() { const testClock = await stripe.testHelpers.testClocks.advance( 'clock_xxxxxxxxxxxxx', - {frozen_time: 1652390605} + {frozen_time: 1675552261} ); expect(testClock).not.to.be.null; }); @@ -867,418 +1261,121 @@ describe('TestHelpers.Treasury.OutboundTransfers', function() { const outboundTransfer = await stripe.testHelpers.treasury.outboundTransfers.post( 'obt_123' ); - expect(outboundTransfer).not.to.be.null; - }); - - it('returnOutboundTransfer method', async function() { - const outboundTransfer = await stripe.testHelpers.treasury.outboundTransfers.returnOutboundTransfer( - 'obt_123', - {returned_details: {code: 'account_closed'}} - ); - expect(outboundTransfer).not.to.be.null; - }); -}); - -describe('TestHelpers.Treasury.ReceivedCredits', function() { - it('create method', async function() { - const receivedCredit = await stripe.testHelpers.treasury.receivedCredits.create( - { - financial_account: 'fa_123', - network: 'ach', - amount: 1234, - currency: 'usd', - } - ); - expect(receivedCredit).not.to.be.null; - }); -}); - -describe('TestHelpers.Treasury.ReceivedDebits', function() { - it('create method', async function() { - const receivedDebit = await stripe.testHelpers.treasury.receivedDebits.create( - { - financial_account: 'fa_123', - network: 'ach', - amount: 1234, - currency: 'usd', - } - ); - expect(receivedDebit).not.to.be.null; - }); -}); - -describe('Tokens', function() { - it('create method', async function() { - const token = await stripe.tokens.create({ - card: { - number: '4242424242424242', - exp_month: '5', - exp_year: '2023', - cvc: '314', - }, - }); - expect(token).not.to.be.null; - }); - - it('create method', async function() { - const token = await stripe.tokens.create({ - bank_account: { - country: 'US', - currency: 'usd', - account_holder_name: 'Jenny Rosen', - account_holder_type: 'individual', - routing_number: '110000000', - account_number: '000123456789', - }, - }); - expect(token).not.to.be.null; - }); - - it('create method', async function() { - const token = await stripe.tokens.create({ - pii: {id_number: '000000000'}, - }); - expect(token).not.to.be.null; - }); - - it('create method', async function() { - const token = await stripe.tokens.create({ - account: { - individual: {first_name: 'Jane', last_name: 'Doe'}, - tos_shown_and_accepted: true, - }, - }); - expect(token).not.to.be.null; - }); - - it('create method', async function() { - const token = await stripe.tokens.create({ - person: { - first_name: 'Jane', - last_name: 'Doe', - relationship: {owner: true}, - }, - }); - expect(token).not.to.be.null; - }); - - it('create method', async function() { - const token = await stripe.tokens.create({cvc_update: {cvc: '123'}}); - expect(token).not.to.be.null; - }); - - it('retrieve method', async function() { - const token = await stripe.tokens.retrieve('tok_xxxx'); - expect(token).not.to.be.null; - }); -}); - -describe('AccountLinks', function() { - it('create method', async function() { - const accountLink = await stripe.accountLinks.create({ - account: 'acct_xxxxxxxxxxxxx', - refresh_url: 'https://example.com/reauth', - return_url: 'https://example.com/return', - type: 'account_onboarding', - }); - expect(accountLink).not.to.be.null; - }); -}); - -describe('Accounts', function() { - it('list method', async function() { - const accounts = await stripe.accounts.list({limit: 3}); - expect(accounts).not.to.be.null; - }); - - it('create method', async function() { - const account = await stripe.accounts.create({ - type: 'custom', - country: 'US', - email: 'jenny.rosen@example.com', - capabilities: { - card_payments: {requested: true}, - transfers: {requested: true}, - }, - }); - expect(account).not.to.be.null; - }); - - it('del method', async function() { - const deleted = await stripe.accounts.del('acct_xxxxxxxxxxxxx'); - expect(deleted).not.to.be.null; - }); - - it('retrieve method', async function() { - const account = await stripe.accounts.retrieve('acct_xxxxxxxxxxxxx'); - expect(account).not.to.be.null; - }); - - it('update method', async function() { - const account = await stripe.accounts.update('acct_xxxxxxxxxxxxx', { - metadata: {order_id: '6735'}, - }); - expect(account).not.to.be.null; - }); - - it('reject method', async function() { - const account = await stripe.accounts.reject('acct_xxxxxxxxxxxxx', { - reason: 'fraud', - }); - expect(account).not.to.be.null; - }); -}); - -describe('Capabilities', function() { - it('listCapabilities method', async function() { - const capabilities = await stripe.accounts.listCapabilities( - 'acct_xxxxxxxxxxxxx' - ); - expect(capabilities).not.to.be.null; - }); - - it('retrieveCapability method', async function() { - const capability = await stripe.accounts.retrieveCapability( - 'acct_xxxxxxxxxxxxx', - 'card_payments' - ); - expect(capability).not.to.be.null; - }); - - it('updateCapability method', async function() { - const capability = await stripe.accounts.updateCapability( - 'acct_xxxxxxxxxxxxx', - 'card_payments', - {requested: true} - ); - expect(capability).not.to.be.null; - }); -}); - -describe('ExternalAccounts', function() { - it('listExternalAccounts method', async function() { - const externalAccount = await stripe.accounts.listExternalAccounts( - 'acct_xxxxxxxxxxxxx', - {limit: 3} - ); - expect(externalAccount).not.to.be.null; - }); - - it('createExternalAccount method', async function() { - const externalAccount = await stripe.accounts.createExternalAccount( - 'acct_xxxxxxxxxxxxx', - {external_account: 'btok_xxxxxxxxxxxxx'} - ); - expect(externalAccount).not.to.be.null; - }); - - it('createExternalAccount method', async function() { - const externalAccount = await stripe.accounts.createExternalAccount( - 'acct_xxxxxxxxxxxxx', - {external_account: 'tok_xxxx_debit'} - ); - expect(externalAccount).not.to.be.null; - }); - - it('deleteExternalAccount method', async function() { - const deletedExternalAccount = await stripe.accounts.deleteExternalAccount( - 'acct_xxxxxxxxxxxxx', - 'ba_xxxxxxxxxxxxx' - ); - expect(deletedExternalAccount).not.to.be.null; - }); - - it('deleteExternalAccount method', async function() { - const deletedExternalAccount = await stripe.accounts.deleteExternalAccount( - 'acct_xxxxxxxxxxxxx', - 'card_xxxxxxxxxxxxx' - ); - expect(deletedExternalAccount).not.to.be.null; - }); - - it('retrieveExternalAccount method', async function() { - const externalAccount = await stripe.accounts.retrieveExternalAccount( - 'acct_xxxxxxxxxxxxx', - 'ba_xxxxxxxxxxxxx' - ); - expect(externalAccount).not.to.be.null; - }); - - it('retrieveExternalAccount method', async function() { - const externalAccount = await stripe.accounts.retrieveExternalAccount( - 'acct_xxxxxxxxxxxxx', - 'card_xxxxxxxxxxxxx' - ); - expect(externalAccount).not.to.be.null; - }); - - it('updateExternalAccount method', async function() { - const externalAccount = await stripe.accounts.updateExternalAccount( - 'acct_xxxxxxxxxxxxx', - 'ba_xxxxxxxxxxxxx', - {metadata: {order_id: '6735'}} - ); - expect(externalAccount).not.to.be.null; - }); - - it('updateExternalAccount method', async function() { - const externalAccount = await stripe.accounts.updateExternalAccount( - 'acct_xxxxxxxxxxxxx', - 'card_xxxxxxxxxxxxx', - {metadata: {order_id: '6735'}} - ); - expect(externalAccount).not.to.be.null; - }); -}); - -describe('CustomerSources', function() { - it('updateSource method', async function() { - const card = await stripe.customers.updateSource('cus_123', 'card_123', { - account_holder_name: 'Kamil', - }); - expect(card).not.to.be.null; - }); - - it('listSources method', async function() { - const paymentSource = await stripe.customers.listSources( - 'cus_xxxxxxxxxxxxx', - {object: 'bank_account', limit: 3} - ); - expect(paymentSource).not.to.be.null; - }); - - it('listSources method', async function() { - const paymentSource = await stripe.customers.listSources( - 'cus_xxxxxxxxxxxxx', - {object: 'card', limit: 3} - ); - expect(paymentSource).not.to.be.null; - }); - - it('createSource method', async function() { - const paymentSource = await stripe.customers.createSource( - 'cus_xxxxxxxxxxxxx', - {source: 'btok_xxxxxxxxxxxxx'} - ); - expect(paymentSource).not.to.be.null; - }); - - it('createSource method', async function() { - const paymentSource = await stripe.customers.createSource( - 'cus_xxxxxxxxxxxxx', - {source: 'tok_xxxx'} - ); - expect(paymentSource).not.to.be.null; - }); - - it('deleteSource method', async function() { - const paymentSource = await stripe.customers.deleteSource( - 'cus_xxxxxxxxxxxxx', - 'ba_xxxxxxxxxxxxx' - ); - expect(paymentSource).not.to.be.null; - }); - - it('deleteSource method', async function() { - const paymentSource = await stripe.customers.deleteSource( - 'cus_xxxxxxxxxxxxx', - 'card_xxxxxxxxxxxxx' - ); - expect(paymentSource).not.to.be.null; - }); - - it('retrieveSource method', async function() { - const paymentSource = await stripe.customers.retrieveSource( - 'cus_xxxxxxxxxxxxx', - 'ba_xxxxxxxxxxxxx' - ); - expect(paymentSource).not.to.be.null; - }); - - it('retrieveSource method', async function() { - const paymentSource = await stripe.customers.retrieveSource( - 'cus_xxxxxxxxxxxxx', - 'card_xxxxxxxxxxxxx' - ); - expect(paymentSource).not.to.be.null; + expect(outboundTransfer).not.to.be.null; }); - it('updateSource method', async function() { - const card = await stripe.customers.updateSource( - 'cus_xxxxxxxxxxxxx', - 'ba_xxxxxxxxxxxxx', - {metadata: {order_id: '6735'}} + it('returnOutboundTransfer method', async function() { + const outboundTransfer = await stripe.testHelpers.treasury.outboundTransfers.returnOutboundTransfer( + 'obt_123', + {returned_details: {code: 'account_closed'}} ); - expect(card).not.to.be.null; + expect(outboundTransfer).not.to.be.null; }); +}); - it('updateSource method', async function() { - const card = await stripe.customers.updateSource( - 'cus_xxxxxxxxxxxxx', - 'card_xxxxxxxxxxxxx', - {name: 'Jenny Rosen'} +describe('TestHelpers.Treasury.ReceivedCredits', function() { + it('create method', async function() { + const receivedCredit = await stripe.testHelpers.treasury.receivedCredits.create( + { + financial_account: 'fa_123', + network: 'ach', + amount: 1234, + currency: 'usd', + } ); - expect(card).not.to.be.null; + expect(receivedCredit).not.to.be.null; }); +}); - it('verifySource method', async function() { - const bankAccount = await stripe.customers.verifySource( - 'cus_xxxxxxxxxxxxx', - 'ba_xxxxxxxxxxxxx', - {amounts: [32, 45]} +describe('TestHelpers.Treasury.ReceivedDebits', function() { + it('create method', async function() { + const receivedDebit = await stripe.testHelpers.treasury.receivedDebits.create( + { + financial_account: 'fa_123', + network: 'ach', + amount: 1234, + currency: 'usd', + } ); - expect(bankAccount).not.to.be.null; + expect(receivedDebit).not.to.be.null; }); }); -describe('LoginLinks', function() { - it('createLoginLink method', async function() { - const loginLink = await stripe.accounts.createLoginLink( - 'acct_xxxxxxxxxxxxx' - ); - expect(loginLink).not.to.be.null; +describe('Tokens', function() { + it('create method', async function() { + const token = await stripe.tokens.create({ + card: { + number: '4242424242424242', + exp_month: '5', + exp_year: '2023', + cvc: '314', + }, + }); + expect(token).not.to.be.null; }); -}); -describe('Persons', function() { - it('listPersons method', async function() { - const persons = await stripe.accounts.listPersons('acct_xxxxxxxxxxxxx', { - limit: 3, + it('create method', async function() { + const token = await stripe.tokens.create({ + bank_account: { + country: 'US', + currency: 'usd', + account_holder_name: 'Jenny Rosen', + account_holder_type: 'individual', + routing_number: '110000000', + account_number: '000123456789', + }, }); - expect(persons).not.to.be.null; + expect(token).not.to.be.null; }); - it('createPerson method', async function() { - const person = await stripe.accounts.createPerson('acct_xxxxxxxxxxxxx', { - first_name: 'Jane', - last_name: 'Diaz', + it('create method', async function() { + const token = await stripe.tokens.create({ + pii: {id_number: '000000000'}, }); - expect(person).not.to.be.null; + expect(token).not.to.be.null; }); - it('deletePerson method', async function() { - const deleted = await stripe.accounts.deletePerson( - 'acct_xxxxxxxxxxxxx', - 'person_xxxxxxxxxxxxx' - ); - expect(deleted).not.to.be.null; + it('create method', async function() { + const token = await stripe.tokens.create({ + account: { + individual: {first_name: 'Jane', last_name: 'Doe'}, + tos_shown_and_accepted: true, + }, + }); + expect(token).not.to.be.null; }); - it('retrievePerson method', async function() { - const person = await stripe.accounts.retrievePerson( - 'acct_xxxxxxxxxxxxx', - 'person_xxxxxxxxxxxxx' - ); - expect(person).not.to.be.null; + it('create method', async function() { + const token = await stripe.tokens.create({ + person: { + first_name: 'Jane', + last_name: 'Doe', + relationship: {owner: true}, + }, + }); + expect(token).not.to.be.null; }); - it('updatePerson method', async function() { - const person = await stripe.accounts.updatePerson( - 'acct_xxxxxxxxxxxxx', - 'person_xxxxxxxxxxxxx', - {metadata: {order_id: '6735'}} - ); - expect(person).not.to.be.null; + it('create method', async function() { + const token = await stripe.tokens.create({cvc_update: {cvc: '123'}}); + expect(token).not.to.be.null; + }); + + it('retrieve method', async function() { + const token = await stripe.tokens.retrieve('tok_xxxx'); + expect(token).not.to.be.null; + }); +}); + +describe('AccountLinks', function() { + it('create method', async function() { + const accountLink = await stripe.accountLinks.create({ + account: 'acct_xxxxxxxxxxxxx', + refresh_url: 'https://example.com/reauth', + return_url: 'https://example.com/return', + type: 'account_onboarding', + }); + expect(accountLink).not.to.be.null; }); }); @@ -1294,39 +1391,37 @@ describe('ApplicationFees', function() { ); expect(applicationFee).not.to.be.null; }); -}); -describe('FeeRefunds', function() { it('listRefunds method', async function() { - const refunds = await stripe.applicationFees.listRefunds( + const feeRefunds = await stripe.applicationFees.listRefunds( 'fee_xxxxxxxxxxxxx', {limit: 3} ); - expect(refunds).not.to.be.null; + expect(feeRefunds).not.to.be.null; }); it('createRefund method', async function() { - const refund = await stripe.applicationFees.createRefund( + const feeRefund = await stripe.applicationFees.createRefund( 'fee_xxxxxxxxxxxxx' ); - expect(refund).not.to.be.null; + expect(feeRefund).not.to.be.null; }); it('retrieveRefund method', async function() { - const refund = await stripe.applicationFees.retrieveRefund( + const feeRefund = await stripe.applicationFees.retrieveRefund( 'fee_xxxxxxxxxxxxx', 'fr_xxxxxxxxxxxxx' ); - expect(refund).not.to.be.null; + expect(feeRefund).not.to.be.null; }); it('updateRefund method', async function() { - const refund = await stripe.applicationFees.updateRefund( + const feeRefund = await stripe.applicationFees.updateRefund( 'fee_xxxxxxxxxxxxx', 'fr_xxxxxxxxxxxxx', {metadata: {order_id: '6735'}} ); - expect(refund).not.to.be.null; + expect(feeRefund).not.to.be.null; }); }); @@ -1413,7 +1508,8 @@ describe('Charges', function() { amount: 2000, currency: 'usd', source: 'tok_xxxx', - description: 'My First Test Charge (created for API docs)', + description: + 'My First Test Charge (created for API docs at https://www.stripe.com/docs/api)', }); expect(charge).not.to.be.null; }); @@ -1515,6 +1611,14 @@ describe('CreditNotes', function() { expect(creditNote).not.to.be.null; }); + it('listLineItems method', async function() { + const creditNoteLineItems = await stripe.creditNotes.listLineItems( + 'cn_xxxxxxxxxxxxx', + {limit: 3} + ); + expect(creditNoteLineItems).not.to.be.null; + }); + it('preview method', async function() { const creditNote = await stripe.creditNotes.preview({ invoice: 'in_xxxxxxxxxxxxx', @@ -1530,84 +1634,6 @@ describe('CreditNotes', function() { }); }); -describe('CreditNoteLineItems', function() { - it('listLineItems method', async function() { - const lineItems = await stripe.creditNotes.listLineItems( - 'cn_xxxxxxxxxxxxx', - {limit: 3} - ); - expect(lineItems).not.to.be.null; - }); -}); - -describe('CustomerBalanceTransactions', function() { - it('listBalanceTransactions method', async function() { - const balanceTransactions = await stripe.customers.listBalanceTransactions( - 'cus_xxxxxxxxxxxxx', - {limit: 3} - ); - expect(balanceTransactions).not.to.be.null; - }); - - it('createBalanceTransaction method', async function() { - const balanceTransaction = await stripe.customers.createBalanceTransaction( - 'cus_xxxxxxxxxxxxx', - {amount: -500, currency: 'usd'} - ); - expect(balanceTransaction).not.to.be.null; - }); - - it('retrieveBalanceTransaction method', async function() { - const balanceTransaction = await stripe.customers.retrieveBalanceTransaction( - 'cus_xxxxxxxxxxxxx', - 'cbtxn_xxxxxxxxxxxxx' - ); - expect(balanceTransaction).not.to.be.null; - }); - - it('updateBalanceTransaction method', async function() { - const balanceTransaction = await stripe.customers.updateBalanceTransaction( - 'cus_xxxxxxxxxxxxx', - 'cbtxn_xxxxxxxxxxxxx', - {metadata: {order_id: '6735'}} - ); - expect(balanceTransaction).not.to.be.null; - }); -}); - -describe('TaxIds', function() { - it('listTaxIds method', async function() { - const taxIds = await stripe.customers.listTaxIds('cus_xxxxxxxxxxxxx', { - limit: 3, - }); - expect(taxIds).not.to.be.null; - }); - - it('createTaxId method', async function() { - const taxId = await stripe.customers.createTaxId('cus_xxxxxxxxxxxxx', { - type: 'eu_vat', - value: 'DE123456789', - }); - expect(taxId).not.to.be.null; - }); - - it('deleteTaxId method', async function() { - const deleted = await stripe.customers.deleteTaxId( - 'cus_xxxxxxxxxxxxx', - 'txi_xxxxxxxxxxxxx' - ); - expect(deleted).not.to.be.null; - }); - - it('retrieveTaxId method', async function() { - const taxId = await stripe.customers.retrieveTaxId( - 'cus_xxxxxxxxxxxxx', - 'txi_xxxxxxxxxxxxx' - ); - expect(taxId).not.to.be.null; - }); -}); - describe('Disputes', function() { it('list method', async function() { const disputes = await stripe.disputes.list({limit: 3}); @@ -1670,18 +1696,6 @@ describe('FileLinks', function() { }); }); -describe('Files', function() { - it('list method', async function() { - const files = await stripe.files.list({limit: 3}); - expect(files).not.to.be.null; - }); - - it('retrieve method', async function() { - const file = await stripe.files.retrieve('file_xxxxxxxxxxxxx'); - expect(file).not.to.be.null; - }); -}); - describe('Identity.VerificationReports', function() { it('list method', async function() { const verificationReports = await stripe.identity.verificationReports.list({ @@ -1953,8 +1967,8 @@ describe('PaymentMethods', function() { type: 'card', card: { number: '4242424242424242', - exp_month: 5, - exp_year: 2023, + exp_month: 8, + exp_year: 2024, cvc: '314', }, }); @@ -2407,9 +2421,7 @@ describe('SubscriptionItems', function() { ); expect(subscriptionItem).not.to.be.null; }); -}); -describe('UsageRecordSummaries', function() { it('listUsageRecordSummaries method', async function() { const usageRecordSummaries = await stripe.subscriptionItems.listUsageRecordSummaries( 'si_xxxxxxxxxxxxx', @@ -2417,9 +2429,7 @@ describe('UsageRecordSummaries', function() { ); expect(usageRecordSummaries).not.to.be.null; }); -}); -describe('UsageRecords', function() { it('createUsageRecord method', async function() { const usageRecord = await stripe.subscriptionItems.createUsageRecord( 'si_xxxxxxxxxxxxx', @@ -2440,7 +2450,7 @@ describe('SubscriptionSchedules', function() { it('create method', async function() { const subscriptionSchedule = await stripe.subscriptionSchedules.create({ customer: 'cus_xxxxxxxxxxxxx', - start_date: 1652909005, + start_date: 1676070661, end_behavior: 'release', phases: [ { @@ -2585,8 +2595,9 @@ describe('Terminal.Locations', function() { address: { line1: '1234 Main Street', city: 'San Francisco', - country: 'US', postal_code: '94111', + state: 'CA', + country: 'US', }, }); expect(location).not.to.be.null; @@ -2659,6 +2670,14 @@ describe('Terminal.Readers', function() { ); expect(reader).not.to.be.null; }); + + it('processSetupIntent method', async function() { + const reader = await stripe.terminal.readers.processSetupIntent( + 'tmr_xxxxxxxxxxxxx', + {setup_intent: 'seti_xxxxxxxxxxxxx', customer_consent_collected: true} + ); + expect(reader).not.to.be.null; + }); }); describe('Topups', function() { @@ -2722,38 +2741,38 @@ describe('Transfers', function() { }); expect(transfer).not.to.be.null; }); -}); -describe('TransferReversals', function() { it('listReversals method', async function() { - const reversals = await stripe.transfers.listReversals('tr_xxxxxxxxxxxxx', { - limit: 3, - }); - expect(reversals).not.to.be.null; + const transferReversals = await stripe.transfers.listReversals( + 'tr_xxxxxxxxxxxxx', + {limit: 3} + ); + expect(transferReversals).not.to.be.null; }); it('createReversal method', async function() { - const reversal = await stripe.transfers.createReversal('tr_xxxxxxxxxxxxx', { - amount: 100, - }); - expect(reversal).not.to.be.null; + const transferReversal = await stripe.transfers.createReversal( + 'tr_xxxxxxxxxxxxx', + {amount: 100} + ); + expect(transferReversal).not.to.be.null; }); it('retrieveReversal method', async function() { - const reversal = await stripe.transfers.retrieveReversal( + const transferReversal = await stripe.transfers.retrieveReversal( 'tr_xxxxxxxxxxxxx', 'trr_xxxxxxxxxxxxx' ); - expect(reversal).not.to.be.null; + expect(transferReversal).not.to.be.null; }); it('updateReversal method', async function() { - const reversal = await stripe.transfers.updateReversal( + const transferReversal = await stripe.transfers.updateReversal( 'tr_xxxxxxxxxxxxx', 'trr_xxxxxxxxxxxxx', {metadata: {order_id: '6735'}} ); - expect(reversal).not.to.be.null; + expect(transferReversal).not.to.be.null; }); }); @@ -2842,14 +2861,6 @@ describe('Treasury.FinancialAccounts', function() { ); expect(financialAccountFeatures).not.to.be.null; }); - - it('updateFeatures method', async function() { - const financialAccountFeatures = await stripe.treasury.financialAccounts.updateFeatures( - 'fa_xxxxxxxxxxxxx', - {card_issuing: {requested: false}} - ); - expect(financialAccountFeatures).not.to.be.null; - }); }); describe('Treasury.InboundTransfers', function() { @@ -2901,7 +2912,7 @@ describe('Treasury.OutboundPayments', function() { financial_account: 'fa_xxxxxxxxxxxxx', amount: 10000, currency: 'usd', - customer: 'cu_xxxxxxxxxxxxx', + customer: 'cus_xxxxxxxxxxxxx', destination_payment_method: 'pm_xxxxxxxxxxxxx', description: 'OutboundPayment to a 3rd party', }); @@ -2910,14 +2921,14 @@ describe('Treasury.OutboundPayments', function() { it('retrieve method', async function() { const outboundPayment = await stripe.treasury.outboundPayments.retrieve( - 'obp_xxxxxxxxxxxxx' + 'bot_xxxxxxxxxxxxx' ); expect(outboundPayment).not.to.be.null; }); it('cancel method', async function() { const outboundPayment = await stripe.treasury.outboundPayments.cancel( - 'obp_xxxxxxxxxxxxx' + 'bot_xxxxxxxxxxxxx' ); expect(outboundPayment).not.to.be.null; }); diff --git a/types/Accounts.d.ts b/types/Accounts.d.ts index 714e4a0e88..a92c212a91 100644 --- a/types/Accounts.d.ts +++ b/types/Accounts.d.ts @@ -4,11 +4,13 @@ declare module 'stripe' { namespace Stripe { /** * This is an object representing a Stripe account. You can retrieve it to see - * properties on the account like its current e-mail address or if the account is - * enabled yet to make live charges. + * properties on the account like its current requirements or if the account is + * enabled to make live charges or receive payouts. * - * Some properties, marked below, are available only to platforms that want to - * [create and manage Express or Custom accounts](https://stripe.com/docs/connect/accounts). + * For Custom accounts, the properties below are always returned. For other accounts, some properties are returned until that + * account has started to go through Connect Onboarding. Once you create an [Account Link](https://stripe.com/docs/api/account_links) + * for a Standard or Express account, some parameters are no longer returned. These are marked as **Custom Only** or **Custom and Express** + * below. Learn about the differences [between accounts](https://stripe.com/docs/connect/accounts). */ interface Account { /** diff --git a/types/AccountsResource.d.ts b/types/AccountsResource.d.ts index c0375dc4d4..1b00289dcc 100644 --- a/types/AccountsResource.d.ts +++ b/types/AccountsResource.d.ts @@ -2431,44 +2431,6 @@ declare module 'stripe' { interface AccountDeleteParams {} - interface AccountRejectParams { - /** - * The reason for rejecting the account. Can be `fraud`, `terms_of_service`, or `other`. - */ - reason: string; - - /** - * Specifies which fields in the response should be expanded. - */ - expand?: Array; - } - - interface CapabilityRetrieveParams { - /** - * Specifies which fields in the response should be expanded. - */ - expand?: Array; - } - - interface CapabilityUpdateParams { - /** - * Specifies which fields in the response should be expanded. - */ - expand?: Array; - - /** - * Passing true requests the capability for the account, if it is not already requested. A requested capability may not immediately become active. Any requirements to activate the capability are returned in the `requirements` arrays. - */ - requested?: boolean; - } - - interface CapabilityListParams { - /** - * Specifies which fields in the response should be expanded. - */ - expand?: Array; - } - interface ExternalAccountCreateParams { /** * Please refer to full [documentation](https://stripe.com/docs/api) instead. @@ -2491,113 +2453,6 @@ declare module 'stripe' { metadata?: Stripe.MetadataParam; } - interface ExternalAccountRetrieveParams { - /** - * Specifies which fields in the response should be expanded. - */ - expand?: Array; - } - - interface ExternalAccountUpdateParams { - /** - * The name of the person or business that owns the bank account. - */ - account_holder_name?: string; - - /** - * The type of entity that holds the account. This can be either `individual` or `company`. - */ - account_holder_type?: Stripe.Emptyable< - ExternalAccountUpdateParams.AccountHolderType - >; - - /** - * The bank account type. This can only be `checking` or `savings` in most countries. In Japan, this can only be `futsu` or `toza`. - */ - account_type?: ExternalAccountUpdateParams.AccountType; - - /** - * City/District/Suburb/Town/Village. - */ - address_city?: string; - - /** - * Billing address country, if provided when creating card. - */ - address_country?: string; - - /** - * Address line 1 (Street address/PO Box/Company name). - */ - address_line1?: string; - - /** - * Address line 2 (Apartment/Suite/Unit/Building). - */ - address_line2?: string; - - /** - * State/County/Province/Region. - */ - address_state?: string; - - /** - * ZIP or postal code. - */ - address_zip?: string; - - /** - * When set to true, this becomes the default external account for its currency. - */ - default_for_currency?: boolean; - - /** - * Two digit number representing the card's expiration month. - */ - exp_month?: string; - - /** - * Four digit number representing the card's expiration year. - */ - exp_year?: string; - - /** - * Specifies which fields in the response should be expanded. - */ - expand?: Array; - - /** - * Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`. - */ - metadata?: Stripe.Emptyable; - - /** - * Cardholder name. - */ - name?: string; - } - - namespace ExternalAccountUpdateParams { - type AccountHolderType = 'company' | 'individual'; - - type AccountType = 'checking' | 'futsu' | 'savings' | 'toza'; - } - - interface ExternalAccountListParams extends PaginationParams { - /** - * Specifies which fields in the response should be expanded. - */ - expand?: Array; - - object?: ExternalAccountListParams.Object; - } - - namespace ExternalAccountListParams { - type Object = 'bank_account' | 'card'; - } - - interface ExternalAccountDeleteParams {} - interface LoginLinkCreateParams { /** * Specifies which fields in the response should be expanded. @@ -2871,11 +2726,194 @@ declare module 'stripe' { } } - interface PersonRetrieveParams { + interface ExternalAccountDeleteParams {} + + interface PersonDeleteParams {} + + interface CapabilityListParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface ExternalAccountListParams extends PaginationParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + object?: ExternalAccountListParams.Object; + } + + namespace ExternalAccountListParams { + type Object = 'bank_account' | 'card'; + } + + interface PersonListParams extends PaginationParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Filters on the list of people returned based on the person's relationship to the account's company. + */ + relationship?: PersonListParams.Relationship; + } + + namespace PersonListParams { + interface Relationship { + /** + * A filter on the list of people returned based on whether these people are directors of the account's company. + */ + director?: boolean; + + /** + * A filter on the list of people returned based on whether these people are executives of the account's company. + */ + executive?: boolean; + + /** + * A filter on the list of people returned based on whether these people are owners of the account's company. + */ + owner?: boolean; + + /** + * A filter on the list of people returned based on whether these people are the representative of the account's company. + */ + representative?: boolean; + } + } + + interface AccountRejectParams { + /** + * The reason for rejecting the account. Can be `fraud`, `terms_of_service`, or `other`. + */ + reason: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface CapabilityRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface ExternalAccountRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface PersonRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface CapabilityUpdateParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Passing true requests the capability for the account, if it is not already requested. A requested capability may not immediately become active. Any requirements to activate the capability are returned in the `requirements` arrays. + */ + requested?: boolean; + } + + interface ExternalAccountUpdateParams { + /** + * The name of the person or business that owns the bank account. + */ + account_holder_name?: string; + + /** + * The type of entity that holds the account. This can be either `individual` or `company`. + */ + account_holder_type?: Stripe.Emptyable< + ExternalAccountUpdateParams.AccountHolderType + >; + + /** + * The bank account type. This can only be `checking` or `savings` in most countries. In Japan, this can only be `futsu` or `toza`. + */ + account_type?: ExternalAccountUpdateParams.AccountType; + + /** + * City/District/Suburb/Town/Village. + */ + address_city?: string; + + /** + * Billing address country, if provided when creating card. + */ + address_country?: string; + + /** + * Address line 1 (Street address/PO Box/Company name). + */ + address_line1?: string; + + /** + * Address line 2 (Apartment/Suite/Unit/Building). + */ + address_line2?: string; + + /** + * State/County/Province/Region. + */ + address_state?: string; + + /** + * ZIP or postal code. + */ + address_zip?: string; + + /** + * When set to true, this becomes the default external account for its currency. + */ + default_for_currency?: boolean; + + /** + * Two digit number representing the card's expiration month. + */ + exp_month?: string; + + /** + * Four digit number representing the card's expiration year. + */ + exp_year?: string; + /** * Specifies which fields in the response should be expanded. */ expand?: Array; + + /** + * Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`. + */ + metadata?: Stripe.Emptyable; + + /** + * Cardholder name. + */ + name?: string; + } + + namespace ExternalAccountUpdateParams { + type AccountHolderType = 'company' | 'individual'; + + type AccountType = 'checking' | 'futsu' | 'savings' | 'toza'; } interface PersonUpdateParams { @@ -3144,48 +3182,14 @@ declare module 'stripe' { } } - interface PersonListParams extends PaginationParams { - /** - * Specifies which fields in the response should be expanded. - */ - expand?: Array; - - /** - * Filters on the list of people returned based on the person's relationship to the account's company. - */ - relationship?: PersonListParams.Relationship; - } - - namespace PersonListParams { - interface Relationship { - /** - * A filter on the list of people returned based on whether these people are directors of the account's company. - */ - director?: boolean; - - /** - * A filter on the list of people returned based on whether these people are executives of the account's company. - */ - executive?: boolean; - - /** - * A filter on the list of people returned based on whether these people are owners of the account's company. - */ - owner?: boolean; - - /** - * A filter on the list of people returned based on whether these people are the representative of the account's company. - */ - representative?: boolean; - } - } - - interface PersonDeleteParams {} - class AccountsResource { /** * With [Connect](https://stripe.com/docs/connect), you can create Stripe accounts for your users. * To do this, you'll first need to [register your platform](https://dashboard.stripe.com/account/applications/settings). + * + * If you've already collected information for your connected accounts, you [can pre-fill that information](https://stripe.com/docs/connect/best-practices#onboarding) when + * creating the account. Connect Onboarding won't ask for the pre-filled information during account onboarding. + * You can pre-fill any information on the account. */ create( params?: AccountCreateParams, @@ -3220,9 +3224,16 @@ declare module 'stripe' { ): Promise>; /** - * Updates a [connected account](https://stripe.com/docs/connect/accounts) by setting the values of the parameters passed. Any parameters not provided are left unchanged. Most parameters can be changed only for Custom accounts. (These are marked Custom Only below.) Parameters marked Custom and Express are not supported for Standard accounts. + * Updates a [connected account](https://stripe.com/docs/connect/accounts) by setting the values of the parameters passed. Any parameters not provided are + * left unchanged. * - * To update your own account, use the [Dashboard](https://dashboard.stripe.com/account). Refer to our [Connect](https://stripe.com/docs/connect/updating-accounts) documentation to learn more about updating accounts. + * For Custom accounts, you can update any information on the account. For other accounts, you can update all information until that + * account has started to go through Connect Onboarding. Once you create an [Account Link](https://stripe.com/docs/api/account_links) + * for a Standard or Express account, some parameters can no longer be changed. These are marked as Custom Only or Custom and Express + * below. + * + * To update your own account, use the [Dashboard](https://dashboard.stripe.com/account). Refer to our + * [Connect](https://stripe.com/docs/connect/updating-accounts) documentation to learn more about updating accounts. */ update( id: string, @@ -3257,89 +3268,88 @@ declare module 'stripe' { ): Promise>; /** - * With [Connect](https://stripe.com/docs/connect), you may flag accounts as suspicious. - * - * Test-mode Custom and Express accounts can be rejected at any time. Accounts created using live-mode keys may only be rejected once all balances are zero. + * Create an external account for a given account. */ - reject( + createExternalAccount( id: string, - params: AccountRejectParams, + params: ExternalAccountCreateParams, options?: RequestOptions - ): Promise>; + ): Promise>; /** - * Retrieves information about the specified Account Capability. + * Creates a single-use login link for an Express account to access their Stripe dashboard. + * + * You may only create login links for [Express accounts](https://stripe.com/docs/connect/express-accounts) connected to your platform. */ - retrieveCapability( - accountId: string, - id: string, - params?: CapabilityRetrieveParams, - options?: RequestOptions - ): Promise>; - retrieveCapability( - accountId: string, + createLoginLink( id: string, + params?: LoginLinkCreateParams, options?: RequestOptions - ): Promise>; - - /** - * Updates an existing Account Capability. - */ - updateCapability( - accountId: string, + ): Promise>; + createLoginLink( id: string, - params?: CapabilityUpdateParams, options?: RequestOptions - ): Promise>; + ): Promise>; /** - * Returns a list of capabilities associated with the account. The capabilities are returned sorted by creation date, with the most recent capability appearing first. + * Creates a new person. */ - listCapabilities( + createPerson( id: string, - params?: CapabilityListParams, + params?: PersonCreateParams, options?: RequestOptions - ): ApiListPromise; - listCapabilities( + ): Promise>; + createPerson( id: string, options?: RequestOptions - ): ApiListPromise; + ): Promise>; /** - * Create an external account for a given account. + * Delete a specified external account for a given account. */ - createExternalAccount( + deleteExternalAccount( + accountId: string, id: string, - params: ExternalAccountCreateParams, + params?: ExternalAccountDeleteParams, options?: RequestOptions - ): Promise>; + ): Promise< + Stripe.Response + >; + deleteExternalAccount( + accountId: string, + id: string, + options?: RequestOptions + ): Promise< + Stripe.Response + >; /** - * Retrieve a specified external account for a given account. + * Deletes an existing person's relationship to the account's legal entity. Any person with a relationship for an account can be deleted through the API, except if the person is the account_opener. If your integration is using the executive parameter, you cannot delete the only verified executive on file. */ - retrieveExternalAccount( + deletePerson( accountId: string, id: string, - params?: ExternalAccountRetrieveParams, + params?: PersonDeleteParams, options?: RequestOptions - ): Promise>; - retrieveExternalAccount( + ): Promise>; + deletePerson( accountId: string, id: string, options?: RequestOptions - ): Promise>; + ): Promise>; /** - * Updates the metadata, account holder name, account holder type of a bank account belonging to a [Custom account](https://stripe.com/docs/connect/custom-accounts), and optionally sets it as the default for its currency. Other bank account details are not editable by design. - * - * You can re-enable a disabled bank account by performing an update call without providing any arguments or changes. + * Returns a list of capabilities associated with the account. The capabilities are returned sorted by creation date, with the most recent capability appearing first. */ - updateExternalAccount( - accountId: string, + listCapabilities( id: string, - params?: ExternalAccountUpdateParams, + params?: CapabilityListParams, options?: RequestOptions - ): Promise>; + ): ApiListPromise; + listCapabilities( + id: string, + options?: RequestOptions + ): ApiListPromise; /** * List external accounts for an account. @@ -3355,51 +3365,58 @@ declare module 'stripe' { ): ApiListPromise; /** - * Delete a specified external account for a given account. + * Returns a list of people associated with the account's legal entity. The people are returned sorted by creation date, with the most recent people appearing first. */ - deleteExternalAccount( - accountId: string, + listPersons( id: string, - params?: ExternalAccountDeleteParams, + params?: PersonListParams, options?: RequestOptions - ): Promise< - Stripe.Response - >; - deleteExternalAccount( - accountId: string, + ): ApiListPromise; + listPersons( id: string, options?: RequestOptions - ): Promise< - Stripe.Response - >; + ): ApiListPromise; /** - * Creates a single-use login link for an Express account to access their Stripe dashboard. + * With [Connect](https://stripe.com/docs/connect), you may flag accounts as suspicious. * - * You may only create login links for [Express accounts](https://stripe.com/docs/connect/express-accounts) connected to your platform. + * Test-mode Custom and Express accounts can be rejected at any time. Accounts created using live-mode keys may only be rejected once all balances are zero. */ - createLoginLink( + reject( id: string, - params?: LoginLinkCreateParams, + params: AccountRejectParams, options?: RequestOptions - ): Promise>; - createLoginLink( + ): Promise>; + + /** + * Retrieves information about the specified Account Capability. + */ + retrieveCapability( + accountId: string, id: string, + params?: CapabilityRetrieveParams, options?: RequestOptions - ): Promise>; + ): Promise>; + retrieveCapability( + accountId: string, + id: string, + options?: RequestOptions + ): Promise>; /** - * Creates a new person. + * Retrieve a specified external account for a given account. */ - createPerson( + retrieveExternalAccount( + accountId: string, id: string, - params?: PersonCreateParams, + params?: ExternalAccountRetrieveParams, options?: RequestOptions - ): Promise>; - createPerson( + ): Promise>; + retrieveExternalAccount( + accountId: string, id: string, options?: RequestOptions - ): Promise>; + ): Promise>; /** * Retrieves an existing person. @@ -3417,42 +3434,51 @@ declare module 'stripe' { ): Promise>; /** - * Updates an existing person. + * Updates an existing Account Capability. */ - updatePerson( + updateCapability( accountId: string, id: string, - params?: PersonUpdateParams, + params?: CapabilityUpdateParams, options?: RequestOptions - ): Promise>; + ): Promise>; + updateCapability( + accountId: string, + id: string, + options?: RequestOptions + ): Promise>; /** - * Returns a list of people associated with the account's legal entity. The people are returned sorted by creation date, with the most recent people appearing first. + * Updates the metadata, account holder name, account holder type of a bank account belonging to a [Custom account](https://stripe.com/docs/connect/custom-accounts), and optionally sets it as the default for its currency. Other bank account details are not editable by design. + * + * You can re-enable a disabled bank account by performing an update call without providing any arguments or changes. */ - listPersons( + updateExternalAccount( + accountId: string, id: string, - params?: PersonListParams, + params?: ExternalAccountUpdateParams, options?: RequestOptions - ): ApiListPromise; - listPersons( + ): Promise>; + updateExternalAccount( + accountId: string, id: string, options?: RequestOptions - ): ApiListPromise; + ): Promise>; /** - * Deletes an existing person's relationship to the account's legal entity. Any person with a relationship for an account can be deleted through the API, except if the person is the account_opener. If your integration is using the executive parameter, you cannot delete the only verified executive on file. + * Updates an existing person. */ - deletePerson( + updatePerson( accountId: string, id: string, - params?: PersonDeleteParams, + params?: PersonUpdateParams, options?: RequestOptions - ): Promise>; - deletePerson( + ): Promise>; + updatePerson( accountId: string, id: string, options?: RequestOptions - ): Promise>; + ): Promise>; } } } diff --git a/types/ApplicationFeesResource.d.ts b/types/ApplicationFeesResource.d.ts index 3216e6a8c9..0422dace47 100644 --- a/types/ApplicationFeesResource.d.ts +++ b/types/ApplicationFeesResource.d.ts @@ -40,6 +40,13 @@ declare module 'stripe' { metadata?: Stripe.MetadataParam; } + interface FeeRefundListParams extends PaginationParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + interface FeeRefundRetrieveParams { /** * Specifies which fields in the response should be expanded. @@ -59,13 +66,6 @@ declare module 'stripe' { metadata?: Stripe.Emptyable; } - interface FeeRefundListParams extends PaginationParams { - /** - * Specifies which fields in the response should be expanded. - */ - expand?: Array; - } - class ApplicationFeesResource { /** * Retrieves the details of an application fee that your account has collected. The same information is returned when refunding the application fee. @@ -110,6 +110,19 @@ declare module 'stripe' { options?: RequestOptions ): Promise>; + /** + * You can see a list of the refunds belonging to a specific application fee. Note that the 10 most recent refunds are always available by default on the application fee object. If you need more than those 10, you can use this API method and the limit and starting_after parameters to page through additional refunds. + */ + listRefunds( + id: string, + params?: FeeRefundListParams, + options?: RequestOptions + ): ApiListPromise; + listRefunds( + id: string, + options?: RequestOptions + ): ApiListPromise; + /** * By default, you can see the 10 most recent refunds stored directly on the application fee object, but you can also retrieve details about a specific refund stored on the application fee. */ @@ -136,19 +149,11 @@ declare module 'stripe' { params?: FeeRefundUpdateParams, options?: RequestOptions ): Promise>; - - /** - * You can see a list of the refunds belonging to a specific application fee. Note that the 10 most recent refunds are always available by default on the application fee object. If you need more than those 10, you can use this API method and the limit and starting_after parameters to page through additional refunds. - */ - listRefunds( - id: string, - params?: FeeRefundListParams, - options?: RequestOptions - ): ApiListPromise; - listRefunds( + updateRefund( + feeId: string, id: string, options?: RequestOptions - ): ApiListPromise; + ): Promise>; } } } diff --git a/types/BillingPortal/Sessions.d.ts b/types/BillingPortal/Sessions.d.ts index b2f72d0170..b920a6a39f 100644 --- a/types/BillingPortal/Sessions.d.ts +++ b/types/BillingPortal/Sessions.d.ts @@ -46,7 +46,7 @@ declare module 'stripe' { customer: string; /** - * Information about a specific flow for the customer to go through. + * Information about a specific flow for the customer to go through. See the [docs](https://stripe.com/docs/customer-management/portal-deep-links) to learn more about using customer portal deep links and flows. */ flow: Session.Flow | null; diff --git a/types/BillingPortal/SessionsResource.d.ts b/types/BillingPortal/SessionsResource.d.ts index 4fa9916d3f..7cf073c5bf 100644 --- a/types/BillingPortal/SessionsResource.d.ts +++ b/types/BillingPortal/SessionsResource.d.ts @@ -20,7 +20,7 @@ declare module 'stripe' { expand?: Array; /** - * Information about a specific flow for the customer to go through. + * Information about a specific flow for the customer to go through. See the [docs](https://stripe.com/docs/customer-management/portal-deep-links) to learn more about using customer portal deep links and flows. */ flow_data?: SessionCreateParams.FlowData; diff --git a/types/Checkout/Sessions.d.ts b/types/Checkout/Sessions.d.ts index 5dcae259ad..6f46911198 100644 --- a/types/Checkout/Sessions.d.ts +++ b/types/Checkout/Sessions.d.ts @@ -14,15 +14,14 @@ declare module 'stripe' { * [PaymentIntent](https://stripe.com/docs/api/payment_intents) or an active * [Subscription](https://stripe.com/docs/api/subscriptions). * - * You can create a Checkout Session on your server and pass its ID to the - * client to begin Checkout. + * You can create a Checkout Session on your server and redirect to its URL + * to begin Checkout. * * Related guide: [Checkout Quickstart](https://stripe.com/docs/checkout/quickstart). */ interface Session { /** - * Unique identifier for the object. Used to pass to `redirectToCheckout` - * in Stripe.js. + * Unique identifier for the object. */ id: string; diff --git a/types/CreditNotesResource.d.ts b/types/CreditNotesResource.d.ts index 42049d27e2..f2dc3d7496 100644 --- a/types/CreditNotesResource.d.ts +++ b/types/CreditNotesResource.d.ts @@ -166,6 +166,13 @@ declare module 'stripe' { invoice?: string; } + interface CreditNoteLineItemListParams extends PaginationParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + interface CreditNoteListPreviewLineItemsParams extends PaginationParams { /** * ID of the invoice. @@ -419,13 +426,6 @@ declare module 'stripe' { expand?: Array; } - interface CreditNoteLineItemListParams extends PaginationParams { - /** - * Specifies which fields in the response should be expanded. - */ - expand?: Array; - } - class CreditNotesResource { /** * Issue a credit note to adjust the amount of a finalized invoice. For a status=open invoice, a credit note reduces @@ -479,6 +479,19 @@ declare module 'stripe' { ): ApiListPromise; list(options?: RequestOptions): ApiListPromise; + /** + * When retrieving a credit note, you'll get a lines property containing the the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items. + */ + listLineItems( + id: string, + params?: CreditNoteLineItemListParams, + options?: RequestOptions + ): ApiListPromise; + listLineItems( + id: string, + options?: RequestOptions + ): ApiListPromise; + /** * When retrieving a credit note preview, you'll get a lines property containing the first handful of those items. This URL you can retrieve the full (paginated) list of line items. */ @@ -507,19 +520,6 @@ declare module 'stripe' { id: string, options?: RequestOptions ): Promise>; - - /** - * When retrieving a credit note, you'll get a lines property containing the the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items. - */ - listLineItems( - id: string, - params?: CreditNoteLineItemListParams, - options?: RequestOptions - ): ApiListPromise; - listLineItems( - id: string, - options?: RequestOptions - ): ApiListPromise; } } } diff --git a/types/CustomersResource.d.ts b/types/CustomersResource.d.ts index 284868a581..72624ba8ec 100644 --- a/types/CustomersResource.d.ts +++ b/types/CustomersResource.d.ts @@ -560,8 +560,135 @@ declare module 'stripe' { } } + interface CustomerBalanceTransactionCreateParams { + /** + * The integer amount in **cents (or local equivalent)** to apply to the customer's credit balance. + */ + amount: number; + + /** + * Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Specifies the [`invoice_credit_balance`](https://stripe.com/docs/api/customers/object#customer_object-invoice_credit_balance) that this transaction will apply to. If the customer's `currency` is not set, it will be updated to this value. + */ + currency: string; + + /** + * An arbitrary string attached to the object. Often useful for displaying to users. + */ + description?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`. + */ + metadata?: Stripe.Emptyable; + } + + interface CustomerSourceCreateParams { + /** + * Please refer to full [documentation](https://stripe.com/docs/api) instead. + */ + source: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`. + */ + metadata?: Stripe.MetadataParam; + + validate?: boolean; + } + + interface TaxIdCreateParams { + /** + * Type of the tax ID, one of `ae_trn`, `au_abn`, `au_arn`, `bg_uic`, `br_cnpj`, `br_cpf`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `ch_vat`, `cl_tin`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `hk_br`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kr_brn`, `li_uid`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `no_vat`, `nz_gst`, `ph_tin`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `th_vat`, `tr_tin`, `tw_vat`, `ua_vat`, `us_ein`, or `za_vat` + */ + type: TaxIdCreateParams.Type; + + /** + * Value of the tax ID. + */ + value: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + namespace TaxIdCreateParams { + type Type = + | 'ae_trn' + | 'au_abn' + | 'au_arn' + | 'bg_uic' + | 'br_cnpj' + | 'br_cpf' + | 'ca_bn' + | 'ca_gst_hst' + | 'ca_pst_bc' + | 'ca_pst_mb' + | 'ca_pst_sk' + | 'ca_qst' + | 'ch_vat' + | 'cl_tin' + | 'eg_tin' + | 'es_cif' + | 'eu_oss_vat' + | 'eu_vat' + | 'gb_vat' + | 'ge_vat' + | 'hk_br' + | 'hu_tin' + | 'id_npwp' + | 'il_vat' + | 'in_gst' + | 'is_vat' + | 'jp_cn' + | 'jp_rn' + | 'jp_trn' + | 'ke_pin' + | 'kr_brn' + | 'li_uid' + | 'mx_rfc' + | 'my_frp' + | 'my_itn' + | 'my_sst' + | 'no_vat' + | 'nz_gst' + | 'ph_tin' + | 'ru_inn' + | 'ru_kpp' + | 'sa_vat' + | 'sg_gst' + | 'sg_uen' + | 'si_tin' + | 'th_vat' + | 'tr_tin' + | 'tw_vat' + | 'ua_vat' + | 'us_ein' + | 'za_vat'; + } + interface CustomerDeleteDiscountParams {} + interface CustomerSourceDeleteParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface TaxIdDeleteParams {} + interface CustomerListPaymentMethodsParams extends PaginationParams { /** * Specifies which fields in the response should be expanded. @@ -607,106 +734,87 @@ declare module 'stripe' { | 'wechat_pay'; } - interface CustomerRetrievePaymentMethodParams { + interface CustomerBalanceTransactionListParams extends PaginationParams { /** * Specifies which fields in the response should be expanded. */ expand?: Array; } - interface CustomerSearchParams { - /** - * The search query string. See [search query language](https://stripe.com/docs/search#search-query-language) and the list of supported [query fields for customers](https://stripe.com/docs/search#query-fields-for-customers). - */ - query: string; - + interface CustomerCashBalanceTransactionListParams + extends PaginationParams { /** * Specifies which fields in the response should be expanded. */ expand?: Array; + } + interface CustomerSourceListParams extends PaginationParams { /** - * A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. + * Specifies which fields in the response should be expanded. */ - limit?: number; + expand?: Array; /** - * A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results. + * Filter sources according to a particular object type. */ - page?: string; + object?: string; } - interface CashBalanceRetrieveParams { + interface TaxIdListParams extends PaginationParams { /** * Specifies which fields in the response should be expanded. */ expand?: Array; } - interface CashBalanceUpdateParams { + interface CustomerRetrievePaymentMethodParams { /** * Specifies which fields in the response should be expanded. */ expand?: Array; - - /** - * A hash of settings for this cash balance. - */ - settings?: CashBalanceUpdateParams.Settings; - } - - namespace CashBalanceUpdateParams { - interface Settings { - /** - * Controls how funds transferred by the customer are applied to payment intents and invoices. Valid options are `automatic`, `manual`, or `merchant_default`. For more information about these reconciliation modes, see [Reconciliation](https://stripe.com/docs/payments/customer-balance/reconciliation). - */ - reconciliation_mode?: Settings.ReconciliationMode; - } - - namespace Settings { - type ReconciliationMode = 'automatic' | 'manual' | 'merchant_default'; - } } - interface CustomerBalanceTransactionCreateParams { - /** - * The integer amount in **cents (or local equivalent)** to apply to the customer's credit balance. - */ - amount: number; - + interface CustomerBalanceTransactionRetrieveParams { /** - * Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Specifies the [`invoice_credit_balance`](https://stripe.com/docs/api/customers/object#customer_object-invoice_credit_balance) that this transaction will apply to. If the customer's `currency` is not set, it will be updated to this value. + * Specifies which fields in the response should be expanded. */ - currency: string; + expand?: Array; + } + interface CashBalanceRetrieveParams { /** - * An arbitrary string attached to the object. Often useful for displaying to users. + * Specifies which fields in the response should be expanded. */ - description?: string; + expand?: Array; + } + interface CustomerCashBalanceTransactionRetrieveParams { /** * Specifies which fields in the response should be expanded. */ expand?: Array; + } + interface CustomerSourceRetrieveParams { /** - * Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`. + * Specifies which fields in the response should be expanded. */ - metadata?: Stripe.Emptyable; + expand?: Array; } - interface CustomerBalanceTransactionRetrieveParams { + interface TaxIdRetrieveParams { /** * Specifies which fields in the response should be expanded. */ expand?: Array; } - interface CustomerBalanceTransactionUpdateParams { + interface CustomerSearchParams { /** - * An arbitrary string attached to the object. Often useful for displaying to users. + * The search query string. See [search query language](https://stripe.com/docs/search#search-query-language) and the list of supported [query fields for customers](https://stripe.com/docs/search#query-fields-for-customers). */ - description?: string; + query: string; /** * Specifies which fields in the response should be expanded. @@ -714,57 +822,56 @@ declare module 'stripe' { expand?: Array; /** - * Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`. + * A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. */ - metadata?: Stripe.Emptyable; - } + limit?: number; - interface CustomerBalanceTransactionListParams extends PaginationParams { /** - * Specifies which fields in the response should be expanded. + * A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results. */ - expand?: Array; + page?: string; } - interface CustomerCashBalanceTransactionRetrieveParams { + interface CustomerBalanceTransactionUpdateParams { /** - * Specifies which fields in the response should be expanded. + * An arbitrary string attached to the object. Often useful for displaying to users. */ - expand?: Array; - } + description?: string; - interface CustomerCashBalanceTransactionListParams - extends PaginationParams { /** * Specifies which fields in the response should be expanded. */ expand?: Array; - } - interface CustomerSourceCreateParams { /** - * Please refer to full [documentation](https://stripe.com/docs/api) instead. + * Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`. */ - source: string; + metadata?: Stripe.Emptyable; + } + interface CashBalanceUpdateParams { /** * Specifies which fields in the response should be expanded. */ expand?: Array; /** - * Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`. + * A hash of settings for this cash balance. */ - metadata?: Stripe.MetadataParam; - - validate?: boolean; + settings?: CashBalanceUpdateParams.Settings; } - interface CustomerSourceRetrieveParams { - /** - * Specifies which fields in the response should be expanded. - */ - expand?: Array; + namespace CashBalanceUpdateParams { + interface Settings { + /** + * Controls how funds transferred by the customer are applied to payment intents and invoices. Valid options are `automatic`, `manual`, or `merchant_default`. For more information about these reconciliation modes, see [Reconciliation](https://stripe.com/docs/payments/customer-balance/reconciliation). + */ + reconciliation_mode?: Settings.ReconciliationMode; + } + + namespace Settings { + type ReconciliationMode = 'automatic' | 'manual' | 'merchant_default'; + } } interface CustomerSourceUpdateParams { @@ -862,28 +969,9 @@ declare module 'stripe' { } } - interface CustomerSourceListParams extends PaginationParams { + interface CustomerSourceVerifyParams { /** - * Specifies which fields in the response should be expanded. - */ - expand?: Array; - - /** - * Filter sources according to a particular object type. - */ - object?: string; - } - - interface CustomerSourceDeleteParams { - /** - * Specifies which fields in the response should be expanded. - */ - expand?: Array; - } - - interface CustomerSourceVerifyParams { - /** - * Two positive integers, in *cents*, equal to the values of the microdeposits sent to the bank account. + * Two positive integers, in *cents*, equal to the values of the microdeposits sent to the bank account. */ amounts?: Array; @@ -893,94 +981,6 @@ declare module 'stripe' { expand?: Array; } - interface TaxIdCreateParams { - /** - * Type of the tax ID, one of `ae_trn`, `au_abn`, `au_arn`, `bg_uic`, `br_cnpj`, `br_cpf`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `ch_vat`, `cl_tin`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `hk_br`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kr_brn`, `li_uid`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `no_vat`, `nz_gst`, `ph_tin`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `th_vat`, `tr_tin`, `tw_vat`, `ua_vat`, `us_ein`, or `za_vat` - */ - type: TaxIdCreateParams.Type; - - /** - * Value of the tax ID. - */ - value: string; - - /** - * Specifies which fields in the response should be expanded. - */ - expand?: Array; - } - - namespace TaxIdCreateParams { - type Type = - | 'ae_trn' - | 'au_abn' - | 'au_arn' - | 'bg_uic' - | 'br_cnpj' - | 'br_cpf' - | 'ca_bn' - | 'ca_gst_hst' - | 'ca_pst_bc' - | 'ca_pst_mb' - | 'ca_pst_sk' - | 'ca_qst' - | 'ch_vat' - | 'cl_tin' - | 'eg_tin' - | 'es_cif' - | 'eu_oss_vat' - | 'eu_vat' - | 'gb_vat' - | 'ge_vat' - | 'hk_br' - | 'hu_tin' - | 'id_npwp' - | 'il_vat' - | 'in_gst' - | 'is_vat' - | 'jp_cn' - | 'jp_rn' - | 'jp_trn' - | 'ke_pin' - | 'kr_brn' - | 'li_uid' - | 'mx_rfc' - | 'my_frp' - | 'my_itn' - | 'my_sst' - | 'no_vat' - | 'nz_gst' - | 'ph_tin' - | 'ru_inn' - | 'ru_kpp' - | 'sa_vat' - | 'sg_gst' - | 'sg_uen' - | 'si_tin' - | 'th_vat' - | 'tr_tin' - | 'tw_vat' - | 'ua_vat' - | 'us_ein' - | 'za_vat'; - } - - interface TaxIdRetrieveParams { - /** - * Specifies which fields in the response should be expanded. - */ - expand?: Array; - } - - interface TaxIdListParams extends PaginationParams { - /** - * Specifies which fields in the response should be expanded. - */ - expand?: Array; - } - - interface TaxIdDeleteParams {} - class CustomersResource { /** * Creates a new customer object. @@ -1050,6 +1050,37 @@ declare module 'stripe' { options?: RequestOptions ): Promise>; + /** + * Creates an immutable transaction that updates the customer's credit [balance](https://stripe.com/docs/billing/customer/balance). + */ + createBalanceTransaction( + id: string, + params: CustomerBalanceTransactionCreateParams, + options?: RequestOptions + ): Promise>; + + /** + * When you create a new credit card, you must specify a customer or recipient on which to create it. + * + * If the card's owner has no default card, then the new card will become the default. + * However, if the owner already has a default, then it will not change. + * To change the default, you should [update the customer](https://stripe.com/docs/api#update_customer) to have a new default_source. + */ + createSource( + id: string, + params: CustomerSourceCreateParams, + options?: RequestOptions + ): Promise>; + + /** + * Creates a new TaxID object for a customer. + */ + createTaxId( + id: string, + params: TaxIdCreateParams, + options?: RequestOptions + ): Promise>; + /** * Removes the currently applied discount on a customer. */ @@ -1063,6 +1094,44 @@ declare module 'stripe' { options?: RequestOptions ): Promise>; + /** + * Delete a specified source for a given customer. + */ + deleteSource( + customerId: string, + id: string, + params?: CustomerSourceDeleteParams, + options?: RequestOptions + ): Promise< + Stripe.Response< + Stripe.CustomerSource | Stripe.DeletedBankAccount | Stripe.DeletedCard + > + >; + deleteSource( + customerId: string, + id: string, + options?: RequestOptions + ): Promise< + Stripe.Response< + Stripe.CustomerSource | Stripe.DeletedBankAccount | Stripe.DeletedCard + > + >; + + /** + * Deletes an existing TaxID object. + */ + deleteTaxId( + customerId: string, + id: string, + params?: TaxIdDeleteParams, + options?: RequestOptions + ): Promise>; + deleteTaxId( + customerId: string, + id: string, + options?: RequestOptions + ): Promise>; + /** * Returns a list of PaymentMethods for a given Customer */ @@ -1077,61 +1146,71 @@ declare module 'stripe' { ): ApiListPromise; /** - * Retrieves a PaymentMethod object for a given Customer. + * Returns a list of transactions that updated the customer's [balances](https://stripe.com/docs/billing/customer/balance). */ - retrievePaymentMethod( - customerId: string, + listBalanceTransactions( id: string, - params?: CustomerRetrievePaymentMethodParams, + params?: CustomerBalanceTransactionListParams, options?: RequestOptions - ): Promise>; - retrievePaymentMethod( - customerId: string, + ): ApiListPromise; + listBalanceTransactions( id: string, options?: RequestOptions - ): Promise>; + ): ApiListPromise; /** - * Search for customers you've previously created using Stripe's [Search Query Language](https://stripe.com/docs/search#search-query-language). - * Don't use search in read-after-write flows where strict consistency is necessary. Under normal operating - * conditions, data is searchable in less than a minute. Occasionally, propagation of new or updated data can be up - * to an hour behind during outages. Search functionality is not available to merchants in India. + * Returns a list of transactions that modified the customer's [cash balance](https://stripe.com/docs/payments/customer-balance). */ - search( - params: CustomerSearchParams, + listCashBalanceTransactions( + id: string, + params?: CustomerCashBalanceTransactionListParams, options?: RequestOptions - ): ApiSearchResultPromise; + ): ApiListPromise; + listCashBalanceTransactions( + id: string, + options?: RequestOptions + ): ApiListPromise; /** - * Retrieves a customer's cash balance. + * List sources for a specified customer. */ - retrieveCashBalance( + listSources( id: string, - params?: CashBalanceRetrieveParams, + params?: CustomerSourceListParams, options?: RequestOptions - ): Promise>; - retrieveCashBalance( + ): ApiListPromise; + listSources( id: string, options?: RequestOptions - ): Promise>; + ): ApiListPromise; /** - * Changes the settings on a customer's cash balance. + * Returns a list of tax IDs for a customer. */ - updateCashBalance( + listTaxIds( id: string, - params?: CashBalanceUpdateParams, + params?: TaxIdListParams, options?: RequestOptions - ): Promise>; + ): ApiListPromise; + listTaxIds( + id: string, + options?: RequestOptions + ): ApiListPromise; /** - * Creates an immutable transaction that updates the customer's credit [balance](https://stripe.com/docs/billing/customer/balance). + * Retrieves a PaymentMethod object for a given Customer. */ - createBalanceTransaction( + retrievePaymentMethod( + customerId: string, id: string, - params: CustomerBalanceTransactionCreateParams, + params?: CustomerRetrievePaymentMethodParams, options?: RequestOptions - ): Promise>; + ): Promise>; + retrievePaymentMethod( + customerId: string, + id: string, + options?: RequestOptions + ): Promise>; /** * Retrieves a specific customer balance transaction that updated the customer's [balances](https://stripe.com/docs/billing/customer/balance). @@ -1149,27 +1228,17 @@ declare module 'stripe' { ): Promise>; /** - * Most credit balance transaction fields are immutable, but you may update its description and metadata. - */ - updateBalanceTransaction( - customerId: string, - id: string, - params?: CustomerBalanceTransactionUpdateParams, - options?: RequestOptions - ): Promise>; - - /** - * Returns a list of transactions that updated the customer's [balances](https://stripe.com/docs/billing/customer/balance). + * Retrieves a customer's cash balance. */ - listBalanceTransactions( + retrieveCashBalance( id: string, - params?: CustomerBalanceTransactionListParams, + params?: CashBalanceRetrieveParams, options?: RequestOptions - ): ApiListPromise; - listBalanceTransactions( + ): Promise>; + retrieveCashBalance( id: string, options?: RequestOptions - ): ApiListPromise; + ): Promise>; /** * Retrieves a specific cash balance transaction, which updated the customer's [cash balance](https://stripe.com/docs/payments/customer-balance). @@ -1186,32 +1255,6 @@ declare module 'stripe' { options?: RequestOptions ): Promise>; - /** - * Returns a list of transactions that modified the customer's [cash balance](https://stripe.com/docs/payments/customer-balance). - */ - listCashBalanceTransactions( - id: string, - params?: CustomerCashBalanceTransactionListParams, - options?: RequestOptions - ): ApiListPromise; - listCashBalanceTransactions( - id: string, - options?: RequestOptions - ): ApiListPromise; - - /** - * When you create a new credit card, you must specify a customer or recipient on which to create it. - * - * If the card's owner has no default card, then the new card will become the default. - * However, if the owner already has a default, then it will not change. - * To change the default, you should [update the customer](https://stripe.com/docs/api#update_customer) to have a new default_source. - */ - createSource( - id: string, - params: CustomerSourceCreateParams, - options?: RequestOptions - ): Promise>; - /** * Retrieve a specified source for a given customer. */ @@ -1228,119 +1271,92 @@ declare module 'stripe' { ): Promise>; /** - * Update a specified source for a given customer. + * Retrieves the TaxID object with the given identifier. */ - updateSource( + retrieveTaxId( customerId: string, id: string, - params?: CustomerSourceUpdateParams, - options?: RequestOptions - ): Promise< - Stripe.Response - >; - - /** - * List sources for a specified customer. - */ - listSources( - id: string, - params?: CustomerSourceListParams, + params?: TaxIdRetrieveParams, options?: RequestOptions - ): ApiListPromise; - listSources( + ): Promise>; + retrieveTaxId( + customerId: string, id: string, options?: RequestOptions - ): ApiListPromise; + ): Promise>; /** - * Delete a specified source for a given customer. + * Search for customers you've previously created using Stripe's [Search Query Language](https://stripe.com/docs/search#search-query-language). + * Don't use search in read-after-write flows where strict consistency is necessary. Under normal operating + * conditions, data is searchable in less than a minute. Occasionally, propagation of new or updated data can be up + * to an hour behind during outages. Search functionality is not available to merchants in India. */ - deleteSource( - customerId: string, - id: string, - params?: CustomerSourceDeleteParams, - options?: RequestOptions - ): Promise< - Stripe.Response< - Stripe.CustomerSource | Stripe.DeletedBankAccount | Stripe.DeletedCard - > - >; - deleteSource( - customerId: string, - id: string, + search( + params: CustomerSearchParams, options?: RequestOptions - ): Promise< - Stripe.Response< - Stripe.CustomerSource | Stripe.DeletedBankAccount | Stripe.DeletedCard - > - >; + ): ApiSearchResultPromise; /** - * Verify a specified bank account for a given customer. + * Most credit balance transaction fields are immutable, but you may update its description and metadata. */ - verifySource( + updateBalanceTransaction( customerId: string, id: string, - params?: CustomerSourceVerifyParams, + params?: CustomerBalanceTransactionUpdateParams, options?: RequestOptions - ): Promise>; - verifySource( + ): Promise>; + updateBalanceTransaction( customerId: string, id: string, options?: RequestOptions - ): Promise>; - - /** - * Creates a new TaxID object for a customer. - */ - createTaxId( - id: string, - params: TaxIdCreateParams, - options?: RequestOptions - ): Promise>; + ): Promise>; /** - * Retrieves the TaxID object with the given identifier. + * Changes the settings on a customer's cash balance. */ - retrieveTaxId( - customerId: string, + updateCashBalance( id: string, - params?: TaxIdRetrieveParams, + params?: CashBalanceUpdateParams, options?: RequestOptions - ): Promise>; - retrieveTaxId( - customerId: string, + ): Promise>; + updateCashBalance( id: string, options?: RequestOptions - ): Promise>; + ): Promise>; /** - * Returns a list of tax IDs for a customer. + * Update a specified source for a given customer. */ - listTaxIds( + updateSource( + customerId: string, id: string, - params?: TaxIdListParams, + params?: CustomerSourceUpdateParams, options?: RequestOptions - ): ApiListPromise; - listTaxIds( + ): Promise< + Stripe.Response + >; + updateSource( + customerId: string, id: string, options?: RequestOptions - ): ApiListPromise; + ): Promise< + Stripe.Response + >; /** - * Deletes an existing TaxID object. + * Verify a specified bank account for a given customer. */ - deleteTaxId( + verifySource( customerId: string, id: string, - params?: TaxIdDeleteParams, + params?: CustomerSourceVerifyParams, options?: RequestOptions - ): Promise>; - deleteTaxId( + ): Promise>; + verifySource( customerId: string, id: string, options?: RequestOptions - ): Promise>; + ): Promise>; } } } diff --git a/types/InvoiceItems.d.ts b/types/InvoiceItems.d.ts index 5b1cb6c990..7273dc7198 100644 --- a/types/InvoiceItems.d.ts +++ b/types/InvoiceItems.d.ts @@ -3,13 +3,17 @@ declare module 'stripe' { namespace Stripe { /** - * Sometimes you want to add a charge or credit to a customer, but actually - * charge or credit the customer's card only at the end of a regular billing - * cycle. This is useful for combining several charges (to minimize - * per-transaction fees), or for having Stripe tabulate your usage-based billing - * totals. + * Invoice Items represent the component lines of an [invoice](https://stripe.com/docs/api/invoices). An invoice item is added to an + * invoice by creating or updating it with an `invoice` field, at which point it will be included as + * [an invoice line item](https://stripe.com/docs/api/invoices/line_item) within + * [invoice.lines](https://stripe.com/docs/api/invoices/object#invoice_object-lines). * - * Related guide: [Subscription Invoices](https://stripe.com/docs/billing/invoices/subscription#adding-upcoming-invoice-items). + * Invoice Items can be created before you are ready to actually send the invoice. This can be particularly useful when combined + * with a [subscription](https://stripe.com/docs/api/subscriptions). Sometimes you want to add a charge or credit to a customer, but actually charge + * or credit the customer's card only at the end of a regular billing cycle. This is useful for combining several charges + * (to minimize per-transaction fees), or for having Stripe tabulate your usage-based billing totals. + * + * Related guides: [Integrate with the Invoicing API](https://stripe.com/docs/invoicing/integration), [Subscription Invoices](https://stripe.com/docs/billing/invoices/subscription#adding-upcoming-invoice-items). */ interface InvoiceItem { /** diff --git a/types/InvoiceLineItems.d.ts b/types/InvoiceLineItems.d.ts index 92a439444a..c89c43b06b 100644 --- a/types/InvoiceLineItems.d.ts +++ b/types/InvoiceLineItems.d.ts @@ -99,7 +99,7 @@ declare module 'stripe' { subscription: string | null; /** - * The subscription item that generated this invoice item. Left empty if the line item is not an explicit result of a subscription. + * The subscription item that generated this line item. Left empty if the line item is not an explicit result of a subscription. */ subscription_item?: string; diff --git a/types/Invoices.d.ts b/types/Invoices.d.ts index a84135e7e4..2a29671cd4 100644 --- a/types/Invoices.d.ts +++ b/types/Invoices.d.ts @@ -260,7 +260,7 @@ declare module 'stripe' { latest_revision: string | Stripe.Invoice | null; /** - * The individual line items that make up the invoice. `lines` is sorted as follows: invoice items in reverse chronological order, followed by the subscription, if any. + * The individual line items that make up the invoice. `lines` is sorted as follows: (1) pending invoice items (including prorations) in reverse chronological order, (2) subscription items in reverse chronological order, and (3) invoice items added after invoice creation in chronological order. */ lines: ApiList; diff --git a/types/InvoicesResource.d.ts b/types/InvoicesResource.d.ts index 92e086cc2d..cfc92ba14c 100644 --- a/types/InvoicesResource.d.ts +++ b/types/InvoicesResource.d.ts @@ -1250,6 +1250,13 @@ declare module 'stripe' { expand?: Array; } + interface InvoiceLineItemListParams extends PaginationParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + interface InvoiceListUpcomingLinesParams extends PaginationParams { /** * Settings for automatic tax lookup for this invoice preview. @@ -2380,13 +2387,6 @@ declare module 'stripe' { expand?: Array; } - interface InvoiceLineItemListParams extends PaginationParams { - /** - * Specifies which fields in the response should be expanded. - */ - expand?: Array; - } - class InvoicesResource { /** * This endpoint creates a draft invoice for a given customer. The invoice remains a draft until you [finalize the invoice, which allows you to [pay](#pay_invoice) or send](https://stripe.com/docs/api#finalize_invoice) the invoice to your customers. @@ -2461,6 +2461,19 @@ declare module 'stripe' { options?: RequestOptions ): Promise>; + /** + * When retrieving an invoice, you'll get a lines property containing the total count of line items and the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items. + */ + listLineItems( + id: string, + params?: InvoiceLineItemListParams, + options?: RequestOptions + ): ApiListPromise; + listLineItems( + id: string, + options?: RequestOptions + ): ApiListPromise; + /** * When retrieving an upcoming invoice, you'll get a lines property containing the total count of line items and the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items. */ @@ -2551,19 +2564,6 @@ declare module 'stripe' { id: string, options?: RequestOptions ): Promise>; - - /** - * When retrieving an invoice, you'll get a lines property containing the total count of line items and the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items. - */ - listLineItems( - id: string, - params?: InvoiceLineItemListParams, - options?: RequestOptions - ): ApiListPromise; - listLineItems( - id: string, - options?: RequestOptions - ): ApiListPromise; } } } diff --git a/types/Refunds.d.ts b/types/Refunds.d.ts index 7ddc7f095c..503663cac6 100644 --- a/types/Refunds.d.ts +++ b/types/Refunds.d.ts @@ -56,7 +56,7 @@ declare module 'stripe' { failure_balance_transaction?: string | Stripe.BalanceTransaction; /** - * If the refund failed, the reason for refund failure if known. Possible values are `lost_or_stolen_card`, `expired_or_canceled_card`, or `unknown`. + * If the refund failed, the reason for refund failure if known. Possible values are `lost_or_stolen_card`, `expired_or_canceled_card`, `charge_for_pending_refund_disputed`, `insufficient_funds`, `declined`, `merchant_request` or `unknown`. */ failure_reason?: string; diff --git a/types/Reporting/ReportRuns.d.ts b/types/Reporting/ReportRuns.d.ts index 8b9fd2d4a9..234ca825dd 100644 --- a/types/Reporting/ReportRuns.d.ts +++ b/types/Reporting/ReportRuns.d.ts @@ -85,12 +85,12 @@ declare module 'stripe' { currency?: string; /** - * Ending timestamp of data to be included in the report run (exclusive). + * Ending timestamp of data to be included in the report run. Can be any UTC timestamp between 1 second after the user specified `interval_start` and 1 second before this report's last `data_available_end` value. */ interval_end?: number; /** - * Starting timestamp of data to be included in the report run. + * Starting timestamp of data to be included in the report run. Can be any UTC timestamp between 1 second after this report's `data_available_start` and 1 second before the user specified `interval_end` value. */ interval_start?: number; diff --git a/types/Subscriptions.d.ts b/types/Subscriptions.d.ts index 0076a815dd..1cbb621ec1 100644 --- a/types/Subscriptions.d.ts +++ b/types/Subscriptions.d.ts @@ -220,7 +220,7 @@ declare module 'stripe' { /** * Settings related to subscription trials. */ - trial_settings?: Subscription.TrialSettings | null; + trial_settings: Subscription.TrialSettings | null; /** * If the subscription has a trial, the beginning of that trial. @@ -559,7 +559,7 @@ declare module 'stripe' { /** * Defines how a subscription behaves when a free trial ends. */ - end_behavior?: TrialSettings.EndBehavior; + end_behavior: TrialSettings.EndBehavior; } namespace TrialSettings { diff --git a/types/TransfersResource.d.ts b/types/TransfersResource.d.ts index 993822e6bc..706c41c063 100644 --- a/types/TransfersResource.d.ts +++ b/types/TransfersResource.d.ts @@ -123,6 +123,13 @@ declare module 'stripe' { refund_application_fee?: boolean; } + interface TransferReversalListParams extends PaginationParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + interface TransferReversalRetrieveParams { /** * Specifies which fields in the response should be expanded. @@ -142,13 +149,6 @@ declare module 'stripe' { metadata?: Stripe.Emptyable; } - interface TransferReversalListParams extends PaginationParams { - /** - * Specifies which fields in the response should be expanded. - */ - expand?: Array; - } - class TransfersResource { /** * To send funds from your Stripe account to a connected account, you create a new transfer object. Your [Stripe balance](https://stripe.com/docs/api#balance) must be able to cover the transfer amount, or you'll receive an “Insufficient Funds” error. @@ -208,6 +208,19 @@ declare module 'stripe' { options?: RequestOptions ): Promise>; + /** + * You can see a list of the reversals belonging to a specific transfer. Note that the 10 most recent reversals are always available by default on the transfer object. If you need more than those 10, you can use this API method and the limit and starting_after parameters to page through additional reversals. + */ + listReversals( + id: string, + params?: TransferReversalListParams, + options?: RequestOptions + ): ApiListPromise; + listReversals( + id: string, + options?: RequestOptions + ): ApiListPromise; + /** * By default, you can see the 10 most recent reversals stored directly on the transfer object, but you can also retrieve details about a specific reversal stored on the transfer. */ @@ -234,19 +247,11 @@ declare module 'stripe' { params?: TransferReversalUpdateParams, options?: RequestOptions ): Promise>; - - /** - * You can see a list of the reversals belonging to a specific transfer. Note that the 10 most recent reversals are always available by default on the transfer object. If you need more than those 10, you can use this API method and the limit and starting_after parameters to page through additional reversals. - */ - listReversals( - id: string, - params?: TransferReversalListParams, - options?: RequestOptions - ): ApiListPromise; - listReversals( + updateReversal( + transferId: string, id: string, options?: RequestOptions - ): ApiListPromise; + ): Promise>; } } }