From 46438839ec5cc86e0586fffcf86e9838d25c9326 Mon Sep 17 00:00:00 2001 From: Richard Marmorstein Date: Fri, 8 Oct 2021 14:14:02 -0400 Subject: [PATCH] Codegen for openapi c2caca4 --- lib/resources/Customers.js | 6 +++ .../resources/generated_examples_test.spec.js | 5 +++ types/2020-08-27/Customers.d.ts | 44 +++++++++++++++++++ 3 files changed, 55 insertions(+) diff --git a/lib/resources/Customers.js b/lib/resources/Customers.js index 208f4a1342..2976bd3a20 100644 --- a/lib/resources/Customers.js +++ b/lib/resources/Customers.js @@ -39,6 +39,12 @@ module.exports = StripeResource.extend({ path: '/{customer}/discount', }), + listPaymentMethods: stripeMethod({ + method: 'GET', + path: '/{customer}/payment_methods', + methodType: 'list', + }), + createBalanceTransaction: stripeMethod({ method: 'POST', path: '/{customer}/balance_transactions', diff --git a/test/resources/generated_examples_test.spec.js b/test/resources/generated_examples_test.spec.js index 7f6d698c8c..cfcd5cbfa7 100644 --- a/test/resources/generated_examples_test.spec.js +++ b/test/resources/generated_examples_test.spec.js @@ -39,6 +39,11 @@ describe('Customer', function() { const customers = await stripe.customers.list({limit: 3}); expect(customers).not.to.be.null; }); + + it('listPaymentMethods method', async function() { + const paymentMethods = await stripe.customers.listPaymentMethods('cus_xyz'); + expect(paymentMethods).not.to.be.null; + }); }); describe('BalanceTransaction', function() { diff --git a/types/2020-08-27/Customers.d.ts b/types/2020-08-27/Customers.d.ts index ae53e1244b..1d39be886f 100644 --- a/types/2020-08-27/Customers.d.ts +++ b/types/2020-08-27/Customers.d.ts @@ -664,6 +664,41 @@ declare module 'stripe' { interface CustomerDeleteDiscountParams {} + interface CustomerListPaymentMethodsParams extends PaginationParams { + /** + * A required filter on the list, based on the object `type` field. + */ + type: CustomerListPaymentMethodsParams.Type; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + namespace CustomerListPaymentMethodsParams { + type Type = + | 'acss_debit' + | 'afterpay_clearpay' + | 'alipay' + | 'au_becs_debit' + | 'bacs_debit' + | 'bancontact' + | 'boleto' + | 'card' + | 'card_present' + | 'eps' + | 'fpx' + | 'giropay' + | 'grabpay' + | 'ideal' + | 'oxxo' + | 'p24' + | 'sepa_debit' + | 'sofort' + | 'wechat_pay'; + } + class CustomersResource { /** * Creates a new customer object. @@ -735,6 +770,15 @@ declare module 'stripe' { options?: RequestOptions ): Promise>; + /** + * Returns a list of PaymentMethods for a given Customer + */ + listPaymentMethods( + id: string, + params: CustomerListPaymentMethodsParams, + options?: RequestOptions + ): ApiListPromise; + /** * Creates an immutable transaction that updates the customer's credit [balance](https://stripe.com/docs/billing/customer/balance). */