From 171ff2c37719df41f502568e4e81fc223ced0a9d Mon Sep 17 00:00:00 2001 From: Troy Zarger Date: Tue, 24 Jul 2018 13:15:22 -0400 Subject: [PATCH] Added customers.ICustomerListOptions to accurately implement stripe-node (#27517) --- types/stripe/index.d.ts | 14 +++++++++++--- types/stripe/stripe-tests.ts | 4 ++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/types/stripe/index.d.ts b/types/stripe/index.d.ts index 0704eef970..bf359012d1 100644 --- a/types/stripe/index.d.ts +++ b/types/stripe/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for stripe 5.0 +// Type definitions for stripe 5.0.19 // Project: https://github.com/stripe/stripe-node/ // Definitions by: William Johnston // Peter Harris @@ -11,6 +11,7 @@ // Gal Talmor // Hunter Tunnicliff // Tyler Jones +// Troy Zarger // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -1469,6 +1470,13 @@ declare namespace Stripe { source?: sources.ISourceCreationOptionsExtended; } + interface ICustomerListOptions extends IListOptionsCreated { + /** + * A filter on the list based on the customer’s email field. The value must be a string. + */ + email?: string; + } + interface ICustomerSourceCreationOptions extends IDataOptionsWithMetadata { /** * When adding a card to a customer, the parameter name is source. When @@ -5855,8 +5863,8 @@ declare namespace Stripe { * * @param data Allows you to filter the customers you want. */ - list(data: IListOptionsCreated, options: HeaderOptions, response?: IResponseFn>): Promise>; - list(data: IListOptionsCreated, response?: IResponseFn>): Promise>; + list(data: customers.ICustomerListOptions, options: HeaderOptions, response?: IResponseFn>): Promise>; + list(data: customers.ICustomerListOptions, response?: IResponseFn>): Promise>; list(options: HeaderOptions, response?: IResponseFn>): Promise>; list(response?: IResponseFn>): Promise>; diff --git a/types/stripe/stripe-tests.ts b/types/stripe/stripe-tests.ts index b6583c09f2..ef30b621b2 100644 --- a/types/stripe/stripe-tests.ts +++ b/types/stripe/stripe-tests.ts @@ -364,6 +364,10 @@ stripe.customers.list({ limit: 3 }).then(function (customers) { // asynchronously called }); +stripe.customers.list({ email: "test@example.com" }).then(function (customers) { + // asynchronously called +}); + stripe.customers.createCard( "cus_5rfJKDJkuxzh5Q", { card: "tok_15V2YhEe31JkLCeQy9iUgsJX" },