/
SetupIntent.ts
83 lines (71 loc) · 1.99 KB
/
SetupIntent.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import type { Nullable, StripeError } from '.';
import type { AuBECSDebitFormComponent } from './components/AuBECSDebitForm';
import type { PaymentMethod, PaymentMethods } from './PaymentMethods';
export interface SetupIntent {
id: string;
clientSecret: string;
lastSetupError: Nullable<ConfirmSetupIntent.LastPaymentError>;
created: Nullable<string>;
livemode: boolean;
paymentMethodId: Nullable<string>;
status: SetupIntents.Status;
paymentMethodTypes: PaymentMethods.Types[];
usage: SetupIntents.FutureUsage;
description: Nullable<string>;
}
export namespace ConfirmSetupIntent {
export type LastPaymentError = StripeError<string> & {
paymentMethod: PaymentMethod;
};
export type Params =
| CardParams
| IdealParams
| BancontactParams
| SofortParams
| AuBecsDebitParams
| SepaParams;
export interface Options {}
export interface BaseParams {
billingDetails?: PaymentMethods.BillingDetails;
}
export interface CardParams extends BaseParams {
type: 'Card';
}
export interface IdealParams extends BaseParams {
type: 'Ideal';
bankName?: string;
}
export interface SofortParams extends BaseParams {
type: 'Sofort';
country: string;
}
export interface BancontactParams extends Required<BaseParams> {
type: 'Bancontact';
}
export interface SepaParams extends Required<BaseParams> {
type: 'SepaDebit';
iban: string;
}
export interface AuBecsDebitParams {
type: 'AuBecsDebit';
formDetails: AuBECSDebitFormComponent.FormDetails;
}
}
export namespace SetupIntents {
export type FutureUsage =
| 'Unknown'
| 'None'
| 'OnSession'
| 'OffSession'
| 'OneTime';
export enum Status {
Succeeded = 'Succeeded',
RequiresPaymentMethod = 'RequiresPaymentMethod',
RequiresConfirmation = 'RequiresConfirmation',
Canceled = 'Canceled',
Processing = 'Processing',
RequiresAction = 'RequiresAction',
RequiresCapture = 'RequiresCapture',
Unknown = 'Unknown',
}
}