Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Updates #1266

Merged
merged 1 commit into from
Oct 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/resources/Customers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
5 changes: 5 additions & 0 deletions test/resources/generated_examples_test.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
44 changes: 44 additions & 0 deletions types/2020-08-27/Customers.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string>;
}

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.
Expand Down Expand Up @@ -735,6 +770,15 @@ declare module 'stripe' {
options?: RequestOptions
): Promise<Stripe.Response<Stripe.DeletedDiscount>>;

/**
* Returns a list of PaymentMethods for a given Customer
*/
listPaymentMethods(
id: string,
params: CustomerListPaymentMethodsParams,
options?: RequestOptions
): ApiListPromise<Stripe.PaymentMethod>;

/**
* Creates an immutable transaction that updates the customer's credit [balance](https://stripe.com/docs/billing/customer/balance).
*/
Expand Down