[stripe-v3] add missing mandate argument to createSource (#41924)

* [stripe-v3] add missing mandate argument to createSource

* [stripe-v3] Typo + test organization
This commit is contained in:
Kevin Sołtysiak
2020-02-25 23:01:14 +01:00
committed by GitHub
parent 2489dff03e
commit aa2969e512
2 changed files with 48 additions and 0 deletions

View File

@@ -13,6 +13,7 @@
// Krishna Pravin <https://github.com/KrishnaPravin>
// Hiroshi Ioka <https://github.com/hirochachacha>
// Austin Turner <https://github.com/paustint>
// Kevin Soltysiak <https://github.com/ksol>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare var Stripe: stripe.StripeStatic;
@@ -180,6 +181,34 @@ declare namespace stripe {
phone?: string;
}
interface OfflineAcceptanceMandate {
contact_email: string;
}
interface OnlineAcceptanceMandate {
date: number;
ip: string;
user_agent: string;
}
interface SourceMandateAcceptance {
date: number;
status: 'accepted' | 'refused';
ip?: string;
offline?: OfflineAcceptanceMandate;
online?: OnlineAcceptanceMandate;
type?: 'online'| 'offline';
user_agent?: string;
}
interface SourceMandate {
acceptance?: SourceMandateAcceptance;
amount?: number;
currency?: string;
interval?: 'one_time' | 'scheduled' | 'variable';
notification_method?: 'email' | 'manual' | 'none';
}
interface SourceOptions {
type: string;
flow?: 'redirect' | 'receiver' | 'code_verification' | 'none';
@@ -189,6 +218,7 @@ declare namespace stripe {
currency?: string;
amount?: number;
owner?: OwnerInfo;
mandate?: SourceMandate;
metadata?: {};
statement_descriptor?: string;
redirect?: {

View File

@@ -129,6 +129,24 @@ describe("Stripe elements", () => {
card.destroy();
});
it("should create an iban source with a mandate", () => {
const options: stripe.SourceOptions = {
type: 'sepa_debit',
sepa_debit: {
iban: 'some iban',
},
owner: {
name: 'some holder',
},
mandate: {
notification_method: 'email',
},
currency: 'eur',
};
stripe.createSource(options);
});
it("should create an iban element", () => {
const ibanElement = elements.create('iban', {
supportedCountries: ['SEPA'],