-
Notifications
You must be signed in to change notification settings - Fork 54
/
index.d.ts
114 lines (106 loc) · 2.28 KB
/
index.d.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
// TODO: Remove and update declaration of PayPalSupportedCurrency
export type paypalSupportedCurrencies =
'AUD' |
'BRL' |
'CAD' |
'CNY' |
'CZK' |
'DKK' |
'EUR' |
'HKD' |
'HUF' |
'INR' |
'ILS' |
'JPY' |
'MYR' |
'MXN' |
'TWD' |
'NZD' |
'NOK' |
'PHP' |
'PLN' |
'GBP' |
'RUB' |
'SGD' |
'SEK' |
'CHF' |
'THB' |
'USD'
// TODO: Remove and update declaration of PayPayLocaleCode
export type paypalLocalCodes =
'da_DK' |
'de_DE' |
'en_AU' |
'en_GB' |
'en_US' |
'es_ES' |
'es_XC' |
'fr_CA' |
'fr_FR' |
'fr_XC' |
'id_ID' |
'it_IT' |
'ja_JP' |
'ko_KR' |
'nl_NL' |
'no_NO' |
'pl_PL' |
'pt_BR' |
'pt_PT' |
'ru_RU' |
'sv_SE' |
'th_TH' |
'tr_TR' |
'zh_CN' |
'zh_HK' |
'zh_TW' |
'zh_XC'
export type PayPalSupportedCurrency = paypalSupportedCurrencies
export type PayPalLocaleCode = paypalLocalCodes
export interface PostalAddress {
recipientName: string | null,
streetAddress: string | null,
extendedAddress: string | null,
locality: string | null,
countryCodeAlpha2: string | null,
postalCode: string | null,
region: string | null
}
export interface PaypalResponse {
nonce: string,
payerId: string,
email: string,
firstName: string,
lastName: string,
phone: string,
billingAddress: PostalAddress,
shippingAddress: PostalAddress
}
export interface DeviceDataResponse {
deviceData: string
}
declare function requestOneTimePayment(token: string, {
amount,
currency,
localeCode,
shippingAddressRequired,
userAction,
intent,
}: {
amount: string,
currency ? : paypalSupportedCurrencies,
localeCode ? : paypalLocalCodes,
shippingAddressRequired ? : boolean,
userAction ? : 'commit' | 'continue',
intent ? : 'sale' | 'authorize' | 'order',
}): Promise <PaypalResponse> ;
declare function requestBillingAgreement(token: string, {
billingAgreementDescription,
currency,
localeCode
}: {
billingAgreementDescription: string,
currency ? : paypalSupportedCurrencies,
localeCode ? : paypalLocalCodes,
}): Promise <PaypalResponse> ;
declare function requestDeviceData(token: string): Promise <DeviceDataResponse> ;