mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
[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:
30
types/stripe-v3/index.d.ts
vendored
30
types/stripe-v3/index.d.ts
vendored
@@ -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?: {
|
||||
|
||||
@@ -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'],
|
||||
|
||||
Reference in New Issue
Block a user