From 034f4b7343f3cd4818beffb4436ff16077edbedc Mon Sep 17 00:00:00 2001 From: Kensuke Hoshikawa Date: Wed, 3 Jan 2018 05:42:49 +0900 Subject: [PATCH] [stripe] Fix AccountCreation, TransferCreation, ChargeCreation options (#22534) * fix create charge options * fix transfer creation options * fix account creation options * add auther to me * fix test * v5.0 --- types/stripe/index.d.ts | 57 ++++++++++++++++++++---------------- types/stripe/stripe-tests.ts | 5 ++-- 2 files changed, 34 insertions(+), 28 deletions(-) diff --git a/types/stripe/index.d.ts b/types/stripe/index.d.ts index c8d228a612..49ba212f95 100644 --- a/types/stripe/index.d.ts +++ b/types/stripe/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for stripe 4.9 +// Type definitions for stripe 5.0 // Project: https://github.com/stripe/stripe-node/ // Definitions by: William Johnston // Peter Harris @@ -6,6 +6,7 @@ // Linus Unnebäck // Brannon Jones // Kyle Kamperschroer +// Kensuke Hoshikawa // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -158,6 +159,8 @@ declare namespace Stripe { * established in. For example, if you are in the United States and the * business you’re creating an account for is legally represented in Canada, * you would use “CA” as the country for the account being created. + * + * optional, default is your own country */ country?: string; @@ -166,18 +169,20 @@ declare namespace Stripe { * will email your user with instructions for how to set up their account. For * managed accounts, this is only to make the account easier to identify to * you: Stripe will never directly reach out to your users. + * + * required if type is "standard" */ - email: string; + email?: string; /** - * Whether you'd like to create a managed or standalone account. Managed + * Whether you'd like to create a Custom or Standard account. Custom * accounts have extra parameters available to them, and require that you, * the platform, handle all communication with the account holder. - * Standalone accounts are normal Stripe accounts: Stripe will email the + * Standard accounts are normal Stripe accounts: Stripe will email the * account holder to setup a username and password, and handle all account - * management directly with them. + * management directly with them. Possible values are custom and standard. */ - managed?: boolean; + type: 'custom' | 'standard'; } interface IAccountShared { @@ -924,6 +929,23 @@ declare namespace Stripe { */ destination?: string; + /** + * A string that identifies this transaction as part of a group. + * See the Connect documentation for details. + * + * Connect only. + */ + transfer_group?: string; + + /** + * The Stripe account ID that these funds are intended for. + * Automatically set if you use the destination parameter. + * See the Connect documentation for details. + * + * Connect only. + */ + on_behalf_of?: string; + /** * A set of key/value pairs that you can attach to a charge object. It can be * useful for storing additional information about the customer in a @@ -3565,12 +3587,6 @@ declare namespace Stripe { */ destination: string; - /** - * An arbitrary string which you can attach to a transfer object. It is - * displayed when in the web interface alongside the transfer. - */ - description?: string - /** * You can use this parameter to transfer funds from a charge (or * other transaction) before they are added to your available @@ -3581,21 +3597,10 @@ declare namespace Stripe { source_transaction?: string; /** - * A string to be displayed on the recipient's bank or card - * statement. This may be at most 22 characters. Attempting to use - * a statement_descriptor longer than 22 characters will return - * an error. Note: Most banks will truncate this information and/or - * display it inconsistently. Some may not display it at all. + * A string that identifies this transaction as part of a group. + * See the Connect documentation for details. */ - statement_descriptor?: string; - - /** - * The source balance to draw this transfer from. Balances for - * different payment sources are kept separately. You can find the - * amounts with the balances API. Valid options are: - * "alipay_account", "bank_account", "bitcoin_receiver", and "card". - */ - source_type?: SourceTypes; + transfer_group?: string; } interface ITransferUpdateOptions extends IDataOptionsWithMetadata { diff --git a/types/stripe/stripe-tests.ts b/types/stripe/stripe-tests.ts index 0df4ec257c..03f9baeb9a 100644 --- a/types/stripe/stripe-tests.ts +++ b/types/stripe/stripe-tests.ts @@ -557,13 +557,14 @@ stripe.customers.deleteSubscriptionDiscount("cus_5rfJKDJkuxzh5Q", "sub_5rfJxnBLG // ################################################################################## stripe.accounts.create({ - email: "" + email: "", + type: "standard" }, function (err, customer) { // asynchronously called } ); stripe.accounts.create({ - email: "" + type: "custom" }).then(function (customer) { // asynchronously called }