Merge pull request #7233 from amritk/patch-4

Updated stripe.d.ts
This commit is contained in:
Masahiro Wakame
2015-12-27 11:50:06 +09:00

44
stripe/stripe.d.ts vendored
View File

@@ -1,6 +1,6 @@
// Type definitions for stripe
// Project: https://stripe.com/
// Definitions by: Andy Hawkins <https://github.com/a904guy/,http://a904guy.com>, Eric J. Smith <https://github.com/ejsmith/>
// Definitions by: Andy Hawkins <https://github.com/a904guy/,http://a904guy.com>, Eric J. Smith <https://github.com/ejsmith/>, Amrit Kahlon <https://github.com/amritk/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
interface StripeStatic {
@@ -11,7 +11,8 @@ interface StripeStatic {
cardType(cardNumber: string): string;
getToken(token: string, responseHandler: (status: number, response: StripeTokenResponse) => void): void;
card: StripeCardData;
createToken(data: StripeTokenData, responseHandler: (status: number, response: StripeTokenResponse) => void): void;
createToken(data: StripeTokenData, responseHandler: (status: number, response: StripeTokenResponse) => void): void;
bankAccount: StripeBankAccount;
}
interface StripeTokenData {
@@ -40,7 +41,10 @@ interface StripeTokenResponse {
}
interface StripeError {
type: string;
code: string;
message: string;
param?: string;
}
interface StripeCardData {
@@ -60,7 +64,41 @@ interface StripeCardData {
address_country?: string;
}
interface StripeBankAccount
{
createToken(params: StripeBankTokenParams, stripeResponseHandler: (status:number, response: StripeBankTokenResponse) => void): void;
validateRoutingNumber(routingNumber: number | string, countryCode: string): boolean;
validateAccountNumber(accountNumber: number | string, countryCode: string): boolean;
}
interface StripeBankTokenParams
{
country: string;
currency: string;
account_number: number | string;
routing_number?: number | string;
}
interface StripeBankTokenResponse
{
id: string;
bank_account: {
id: string;
country: string;
bank_name: string;
last4: number;
validated: boolean;
object: string;
};
created: number;
livemode: boolean;
type: string;
object: string;
used: boolean;
error: StripeError;
}
declare var Stripe: StripeStatic;
declare module "Stripe" {
export = StripeStatic;
export = StripeStatic;
}