@tap-payments/apple-pay-button 1.0.6 → 1.0.7-test
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +168 -154
- package/build/@types/ApplePaySession.d.ts +110 -0
- package/build/@types/ApplePaySession.js +1 -0
- package/build/@types/index.d.ts +98 -40
- package/build/@types/index.js +1 -1
- package/build/api/app.service.d.ts +3 -3
- package/build/api/app.service.js +3 -3
- package/build/api/httpClient.d.ts +1 -1
- package/build/api/httpClient.js +1 -1
- package/build/constants/index.d.ts +10 -2
- package/build/constants/index.js +10 -2
- package/build/features/ApplePayButton/ApplePayButton.d.ts +2 -1
- package/build/features/ApplePayButton/ApplePayButton.js +24 -39
- package/build/features/ApplePayButton/index.d.ts +2 -2
- package/build/features/ApplePayButton/index.js +2 -2
- package/build/hooks/useApplePay.d.ts +3 -2
- package/build/hooks/useApplePay.js +140 -16
- package/build/hooks/useGetEvents.d.ts +4 -0
- package/build/hooks/useGetEvents.js +15 -0
- package/build/hooks/useScript.d.ts +1 -1
- package/build/index.d.ts +3 -3
- package/build/index.js +10 -7
- package/build/utils/config.d.ts +5 -3
- package/build/utils/config.js +28 -9
- package/build/utils/defaultValues.d.ts +34 -0
- package/build/utils/defaultValues.js +48 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -25,89 +25,109 @@ yarn add @tap-payments/apple-pay-button
|
|
|
25
25
|
```javascript
|
|
26
26
|
import React from 'react'
|
|
27
27
|
import {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
ApplePayButton,
|
|
29
|
+
ThemeMode,
|
|
30
|
+
SupportedNetworks,
|
|
31
|
+
Scope,
|
|
32
|
+
Environment,
|
|
33
|
+
Locale,
|
|
34
|
+
ButtonType,
|
|
35
|
+
Edges
|
|
35
36
|
} from '@tap-payments/apple-pay-button'
|
|
36
37
|
|
|
37
38
|
const App = () => {
|
|
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
|
-
|
|
39
|
+
return (
|
|
40
|
+
<ApplePayButton
|
|
41
|
+
// The public Key provided by Tap
|
|
42
|
+
publicKey={'pk_test_xxxxxxxxxxxxxxxzh'}
|
|
43
|
+
//The environment of the SDK and it can be one of these environments
|
|
44
|
+
environment={Environment.Development}
|
|
45
|
+
//to enable the debug mode
|
|
46
|
+
debug
|
|
47
|
+
merchant={{
|
|
48
|
+
// The merchant domain name
|
|
49
|
+
domain: 'example.com',
|
|
50
|
+
// The merchant identifier provided by Tap
|
|
51
|
+
id: '1xxxxx8'
|
|
52
|
+
}}
|
|
53
|
+
transaction={{
|
|
54
|
+
// The amount to be charged
|
|
55
|
+
amount: '12',
|
|
56
|
+
// The currency of the amount
|
|
57
|
+
currency: 'KWD'
|
|
58
|
+
}}
|
|
59
|
+
// The scope of the SDK and it can be one of these scopes:
|
|
60
|
+
// [TapToken,AppleToken], by default it is TapToken)
|
|
61
|
+
scope={Scope.TapToken}
|
|
62
|
+
acceptance={{
|
|
63
|
+
// The supported networks for the Apple Pay button and it
|
|
64
|
+
// can be one of these networks: [Mada,Visa,MasterCard], by default
|
|
65
|
+
// we bring all the supported networks from tap merchant configuration
|
|
66
|
+
supportedBrands: [SupportedNetworks.Mada, SupportedNetworks.Visa, SupportedNetworks.MasterCard]
|
|
67
|
+
supportedCards : ["DEBIT","CREDIT"],
|
|
68
|
+
supportedCardsWithAuthentications : ["3DS","EMV"]
|
|
69
|
+
}}
|
|
70
|
+
// The billing contact information
|
|
71
|
+
customer={{
|
|
72
|
+
id: 'cus_xxx',
|
|
73
|
+
name: [
|
|
74
|
+
{
|
|
75
|
+
//"en or ar",
|
|
76
|
+
lang: Locale.EN,
|
|
77
|
+
// "First name of the customer.",
|
|
78
|
+
first: 'test',
|
|
79
|
+
//"Last name of the customer.",
|
|
80
|
+
last: 'tester',
|
|
81
|
+
// "Middle name of the customer.",
|
|
82
|
+
middle: 'test'
|
|
83
|
+
}
|
|
84
|
+
],
|
|
85
|
+
// Defines the contact details for the customer & to be used in creating the billing contact info in Apple pay request
|
|
86
|
+
contact: {
|
|
87
|
+
//"The customer's email",
|
|
88
|
+
email: 'test@gmail.com',
|
|
89
|
+
//"The customer's phone number"
|
|
90
|
+
phone: {
|
|
91
|
+
//"The customer's country code",
|
|
92
|
+
countryCode: '+20',
|
|
93
|
+
//"The customer's phone number
|
|
94
|
+
number: '10XXXXXX56'
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}}
|
|
98
|
+
//for styling button
|
|
99
|
+
interface={{
|
|
100
|
+
//The locale of the Apple Pay button and it can be one of these locales:[EN,AR]
|
|
101
|
+
locale: Locale.EN,
|
|
102
|
+
// The theme of the Apple Pay button and it can be one of
|
|
103
|
+
// these values : [light,Dark], by default it is detected from user device
|
|
104
|
+
theme: ThemeMode.DARK,
|
|
105
|
+
// The type of the Apple Pay
|
|
106
|
+
type: ButtonType.BUY,
|
|
107
|
+
// The border of the Apple Pay button and it can be one of these values:[curved,straight]
|
|
108
|
+
edges: Edges.CURVED
|
|
109
|
+
}}
|
|
110
|
+
// optional (A callback function that will be called when you cancel
|
|
111
|
+
// the payment process)
|
|
112
|
+
onCancel={() => console.log('cancelled')}
|
|
113
|
+
// optional (A callback function that will be called when you have an error)
|
|
114
|
+
onError={(err) => console.error(err)}
|
|
115
|
+
// optional (A async function that will be called after creating the token
|
|
116
|
+
// successfully)
|
|
117
|
+
onSuccess={async (token) => {
|
|
118
|
+
// do your stuff here...
|
|
119
|
+
console.log(token)
|
|
120
|
+
}}
|
|
121
|
+
// optional (A callback function that will be called when you button is clickable)
|
|
122
|
+
onReady={() => {
|
|
123
|
+
console.log('Ready')
|
|
124
|
+
}}
|
|
125
|
+
// optional (A callback function that will be called when the button clicked)
|
|
126
|
+
onClick={() => {
|
|
127
|
+
console.log('Clicked')
|
|
128
|
+
}}
|
|
129
|
+
/>
|
|
130
|
+
)
|
|
111
131
|
}
|
|
112
132
|
```
|
|
113
133
|
|
|
@@ -121,79 +141,69 @@ const App = () => {
|
|
|
121
141
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
122
142
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
123
143
|
<title>apple pay button</title>
|
|
124
|
-
<link rel="stylesheet" href="https://
|
|
125
|
-
<script src="https://
|
|
144
|
+
<link rel="stylesheet" href="https://tap-sdks.b-cdn.net/apple-pay/build-1.0.19/main.css" />
|
|
145
|
+
<script src="https://tap-sdks.b-cdn.net/apple-pay/build-1.0.19/main.js"></script>
|
|
126
146
|
</head>
|
|
147
|
+
|
|
127
148
|
<body>
|
|
128
149
|
<div id="apple-pay-button"></div>
|
|
129
150
|
<script type="text/javascript">
|
|
130
|
-
const {
|
|
131
|
-
|
|
151
|
+
const { render, ThemeMode, SupportedNetworks, Scope, Environment, Locale, ButtonType, Edges } =
|
|
152
|
+
window.TapApplepaySDK
|
|
153
|
+
render(
|
|
132
154
|
{
|
|
133
|
-
|
|
134
|
-
publicKey: 'pk_test_xxxxxxxxxxxxxxxzh',
|
|
135
|
-
// optional (The environment of the SDK and it can be one of these Environment)
|
|
155
|
+
publicKey: 'pk_test_7xxxxxxxxx',
|
|
136
156
|
environment: Environment.Development,
|
|
137
|
-
|
|
138
|
-
debug: true,
|
|
139
|
-
// required (The merchant identifier provided by Tap)
|
|
140
|
-
merchantIdentifier: 'merchant.tap.applepay.test',
|
|
157
|
+
scope: Scope.TapToken,
|
|
141
158
|
merchant: {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
// optional
|
|
145
|
-
// id: '123...'
|
|
159
|
+
domain: window.location.hostname,
|
|
160
|
+
id: 'merchant_xxxxxxxxxx'
|
|
146
161
|
},
|
|
147
|
-
// required
|
|
148
162
|
transaction: {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
// required
|
|
152
|
-
amount: '100'
|
|
163
|
+
currency: 'SAR',
|
|
164
|
+
amount: '3'
|
|
153
165
|
},
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
last: 'tester',
|
|
177
|
-
// optional
|
|
178
|
-
middle: 'test'
|
|
179
|
-
},
|
|
180
|
-
// required
|
|
181
|
-
phone: {
|
|
182
|
-
number: '10XXXXXX56',
|
|
183
|
-
code: '+20'
|
|
166
|
+
acceptance: {
|
|
167
|
+
supportedBrands: [SupportedNetworks.Mada, SupportedNetworks.Visa, SupportedNetworks.MasterCard],
|
|
168
|
+
supportedCards: ['DEBIT', 'CREDIT'],
|
|
169
|
+
supportedCardsWithAuthentications: ['3DS', 'EMV']
|
|
170
|
+
},
|
|
171
|
+
|
|
172
|
+
customer: {
|
|
173
|
+
id: 'cus_xxx',
|
|
174
|
+
name: [
|
|
175
|
+
{
|
|
176
|
+
locale: 'en',
|
|
177
|
+
first: 'test',
|
|
178
|
+
last: 'tester',
|
|
179
|
+
middle: 'test'
|
|
180
|
+
}
|
|
181
|
+
],
|
|
182
|
+
contact: {
|
|
183
|
+
email: 'test@gmail.com',
|
|
184
|
+
phone: {
|
|
185
|
+
number: '10XXXXXX56',
|
|
186
|
+
countryCode: '+20'
|
|
187
|
+
}
|
|
184
188
|
}
|
|
185
189
|
},
|
|
186
|
-
|
|
187
|
-
|
|
190
|
+
interface: {
|
|
191
|
+
locale: Locale.EN,
|
|
192
|
+
theme: ThemeMode.DARK,
|
|
193
|
+
type: ButtonType.BUY,
|
|
194
|
+
edges: Edges.CURVED
|
|
195
|
+
},
|
|
196
|
+
onCancel: async () => {
|
|
188
197
|
console.log('onCancel')
|
|
189
198
|
},
|
|
190
|
-
|
|
191
|
-
onError: (error) => {
|
|
199
|
+
onError: async (error) => {
|
|
192
200
|
console.log('onError', error)
|
|
193
201
|
},
|
|
194
|
-
// optional
|
|
195
202
|
onSuccess: async (data) => {
|
|
196
203
|
console.log('onSuccess', data)
|
|
204
|
+
},
|
|
205
|
+
onReady: async () => {
|
|
206
|
+
console.log('onReady')
|
|
197
207
|
}
|
|
198
208
|
},
|
|
199
209
|
'apple-pay-button'
|
|
@@ -205,22 +215,26 @@ const App = () => {
|
|
|
205
215
|
|
|
206
216
|
## Configurations
|
|
207
217
|
|
|
208
|
-
| Name
|
|
209
|
-
|
|
|
210
|
-
| publicKey
|
|
211
|
-
| environment
|
|
212
|
-
| debug
|
|
213
|
-
|
|
|
214
|
-
| merchant.
|
|
215
|
-
|
|
|
216
|
-
| transaction.
|
|
217
|
-
|
|
|
218
|
-
|
|
|
219
|
-
|
|
|
220
|
-
|
|
|
221
|
-
|
|
|
222
|
-
|
|
|
223
|
-
|
|
|
224
|
-
|
|
|
225
|
-
|
|
|
226
|
-
|
|
|
218
|
+
| Name | Type | R/O | Description |
|
|
219
|
+
| -------------------------------------------- | ------------ | ---------- | ---------------------------------------------------------------------------------------------------------- |
|
|
220
|
+
| publicKey | `string` | `required` | The public Key provided by Tap |
|
|
221
|
+
| environment | `enum` | `optional` | The environment of the SDK and it can be one of these environments `Environment`: [Development,Production] |
|
|
222
|
+
| debug | `boolean` | `optional` | To enable the debug mode |
|
|
223
|
+
| merchant.id | `string` | `required` | The merchant identifier provided by Tap |
|
|
224
|
+
| merchant.domain | `string` | `required` | The merchant domain name |
|
|
225
|
+
| transaction.amount | `string` | `required` | The amount to be charged |
|
|
226
|
+
| transaction.currency | `string` | `required` | The currency of the amount |
|
|
227
|
+
| scope | `enum` | `optional` | The scope of the SDK |
|
|
228
|
+
| acceptance.supportedBrands | `array` | `optional` | The supported networks for the Apple Pay button |
|
|
229
|
+
| acceptance.supportedCards | `array` | `optional` | The supported cards for the Apple Pay button |
|
|
230
|
+
| acceptance.supportedCardsWithAuthentications | `array` | `optional` | The supported cards with authentications for the Apple Pay button |
|
|
231
|
+
| interface.theme | `enum` | `optional` | The theme of the Apple Pay button |
|
|
232
|
+
| interface.locale | `Locale` | `optional` | The locale of the Apple Pay button |
|
|
233
|
+
| interface.type | `ButtonType` | `optional` | The type of the Apple Pay button |
|
|
234
|
+
| interface.edges | `ButtonType` | `optional` | The border of the Apple Pay button |
|
|
235
|
+
| customer | `object` | `optional` | The Customer details information |
|
|
236
|
+
| onCancel | `function` | `optional` | A callback function that will be called when you cancel the process |
|
|
237
|
+
| onError | `function` | `optional` | A callback function that will be called when you have an error |
|
|
238
|
+
| onSuccess | `function` | `optional` | A async function that will be called after creating the token successfully |
|
|
239
|
+
| onClick | `function` | `optional` | A callback function that will be called when the button clicked |
|
|
240
|
+
| onReady | `function` | `optional` | A callback function that will be called when you button is clickable |
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { MerchantCapabilities, SupportedNetworks } from '../constants';
|
|
2
|
+
export declare type RequiredShippingContactField = 'postalAddress' | 'name' | 'phoneticName' | 'phone' | 'email';
|
|
3
|
+
export declare type ApplePayPaymentMethodType = 'debit' | 'credit' | 'prepaid' | 'store';
|
|
4
|
+
export interface ApplePayShippingMethod {
|
|
5
|
+
label: string;
|
|
6
|
+
detail: string;
|
|
7
|
+
amount: string;
|
|
8
|
+
identifier: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ApplePayPaymentContact {
|
|
11
|
+
phoneNumber?: string;
|
|
12
|
+
emailAddress?: string;
|
|
13
|
+
givenName?: string;
|
|
14
|
+
familyName?: string;
|
|
15
|
+
phoneticGivenName?: string;
|
|
16
|
+
phoneticFamilyName?: string;
|
|
17
|
+
addressLines?: string[];
|
|
18
|
+
subLocality?: string;
|
|
19
|
+
locality?: string;
|
|
20
|
+
postalCode?: string;
|
|
21
|
+
subAdministrativeArea?: string;
|
|
22
|
+
administrativeArea?: string;
|
|
23
|
+
country?: string;
|
|
24
|
+
countryCode?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface ApplePayPaymentTokenContext {
|
|
27
|
+
merchantIdentifier: string;
|
|
28
|
+
externalIdentifier: string;
|
|
29
|
+
merchantName: string;
|
|
30
|
+
merchantDomain?: string;
|
|
31
|
+
amount: string;
|
|
32
|
+
}
|
|
33
|
+
export interface ApplePayPaymentMethod {
|
|
34
|
+
displayName?: string;
|
|
35
|
+
network?: string;
|
|
36
|
+
type?: ApplePayPaymentMethodType;
|
|
37
|
+
billingContact?: ApplePayPaymentContact;
|
|
38
|
+
}
|
|
39
|
+
export interface ApplePayAutomaticReloadPaymentRequest {
|
|
40
|
+
paymentDescription: string;
|
|
41
|
+
automaticReloadBilling: ApplePayLineItem;
|
|
42
|
+
billingAgreement?: string;
|
|
43
|
+
managementURL: string;
|
|
44
|
+
tokenNotificationURL?: string;
|
|
45
|
+
}
|
|
46
|
+
export interface ApplePayRecurringPaymentRequest {
|
|
47
|
+
paymentDescription: string;
|
|
48
|
+
regularBilling: ApplePayLineItem;
|
|
49
|
+
trialBilling?: ApplePayLineItem;
|
|
50
|
+
billingAgreement?: string;
|
|
51
|
+
managementURL: string;
|
|
52
|
+
tokenNotificationURL?: string;
|
|
53
|
+
}
|
|
54
|
+
export interface ApplePayDeferredPaymentRequest {
|
|
55
|
+
billingAgreement?: string;
|
|
56
|
+
deferredBilling: ApplePayLineItem;
|
|
57
|
+
freeCancellationDate?: Date;
|
|
58
|
+
freeCancellationDateTimeZone?: string;
|
|
59
|
+
managementURL: string;
|
|
60
|
+
paymentDescription: string;
|
|
61
|
+
tokenNotificationURL?: string;
|
|
62
|
+
}
|
|
63
|
+
export interface ApplePayError {
|
|
64
|
+
code: string;
|
|
65
|
+
contactField: string;
|
|
66
|
+
message: string;
|
|
67
|
+
}
|
|
68
|
+
export interface ApplePayLineItem {
|
|
69
|
+
type?: 'final' | 'pending';
|
|
70
|
+
label?: string;
|
|
71
|
+
amount?: string;
|
|
72
|
+
paymentTiming?: 'immediate' | 'recurring' | 'deferred' | 'automaticReload';
|
|
73
|
+
recurringPaymentStartDate?: Date;
|
|
74
|
+
recurringPaymentIntervalUnit?: 'year' | 'month' | 'day' | 'hour' | 'minute';
|
|
75
|
+
recurringPaymentIntervalCount?: number;
|
|
76
|
+
recurringPaymentEndDate?: Date;
|
|
77
|
+
deferredPaymentDate?: Date;
|
|
78
|
+
automaticReloadPaymentThresholdAmount?: string;
|
|
79
|
+
}
|
|
80
|
+
export interface ApplePayUpdateData {
|
|
81
|
+
newTotal: ApplePayLineItem;
|
|
82
|
+
newLineItems?: ApplePayLineItem[];
|
|
83
|
+
newMultiTokenContexts?: ApplePayPaymentTokenContext[];
|
|
84
|
+
newAutomaticReloadPaymentRequest?: ApplePayAutomaticReloadPaymentRequest;
|
|
85
|
+
newRecurringPaymentRequest?: ApplePayRecurringPaymentRequest;
|
|
86
|
+
newDeferredPaymentRequest?: ApplePayDeferredPaymentRequest;
|
|
87
|
+
errors?: ApplePayError[];
|
|
88
|
+
newShippingMethods?: ApplePayShippingMethod[];
|
|
89
|
+
}
|
|
90
|
+
export interface ApplePayRequestData {
|
|
91
|
+
countryCode: string;
|
|
92
|
+
currencyCode: string;
|
|
93
|
+
merchantCapabilities: Array<typeof MerchantCapabilities[keyof typeof MerchantCapabilities]>;
|
|
94
|
+
supportedNetworks: Array<typeof SupportedNetworks[keyof typeof SupportedNetworks]>;
|
|
95
|
+
billingContact?: {
|
|
96
|
+
phoneNumber?: string;
|
|
97
|
+
emailAddress?: string;
|
|
98
|
+
givenName: string;
|
|
99
|
+
familyName: string;
|
|
100
|
+
};
|
|
101
|
+
total: {
|
|
102
|
+
label: string;
|
|
103
|
+
amount: number;
|
|
104
|
+
};
|
|
105
|
+
requiredShippingContactFields?: Array<RequiredShippingContactField>;
|
|
106
|
+
supportsCouponCode?: boolean;
|
|
107
|
+
couponCode?: string;
|
|
108
|
+
shippingMethods?: ApplePayShippingMethod[];
|
|
109
|
+
lineItems?: ApplePayLineItem[];
|
|
110
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/build/@types/index.d.ts
CHANGED
|
@@ -1,57 +1,86 @@
|
|
|
1
|
-
import { Scope,
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { Scope, SupportedNetworks, ButtonType, Locale, Environment, ThemeMode, Edges } from '../constants';
|
|
2
|
+
import { ApplePayPaymentContact, ApplePayPaymentMethod, ApplePayShippingMethod, ApplePayUpdateData, RequiredShippingContactField } from './ApplePaySession';
|
|
3
|
+
export * from './ApplePaySession';
|
|
4
|
+
export interface Interface {
|
|
5
|
+
locale?: typeof Locale[keyof typeof Locale];
|
|
6
|
+
theme?: typeof ThemeMode[keyof typeof ThemeMode];
|
|
7
|
+
edges?: typeof Edges[keyof typeof Edges];
|
|
8
|
+
type?: typeof ButtonType[keyof typeof ButtonType];
|
|
9
|
+
}
|
|
10
|
+
export interface Customer {
|
|
11
|
+
id?: string;
|
|
12
|
+
name?: {
|
|
13
|
+
lang: typeof Locale[keyof typeof Locale];
|
|
14
|
+
first: string;
|
|
15
|
+
last: string;
|
|
16
|
+
middle?: string;
|
|
17
|
+
}[];
|
|
18
|
+
contact?: {
|
|
19
|
+
email?: string;
|
|
20
|
+
phone?: {
|
|
21
|
+
countryCode: string;
|
|
22
|
+
number: string;
|
|
23
|
+
};
|
|
16
24
|
};
|
|
17
25
|
}
|
|
26
|
+
export interface Acceptance {
|
|
27
|
+
supportedBrands?: Array<typeof SupportedNetworks[keyof typeof SupportedNetworks]>;
|
|
28
|
+
supportedCards?: Array<string>;
|
|
29
|
+
supportedCardsWithAuthentications?: Array<string>;
|
|
30
|
+
}
|
|
31
|
+
export interface Transaction {
|
|
32
|
+
amount: string;
|
|
33
|
+
currency: string;
|
|
34
|
+
couponCode?: string;
|
|
35
|
+
shipping?: ApplePayShippingMethod[];
|
|
36
|
+
items?: Array<{
|
|
37
|
+
type?: 'final' | 'pending';
|
|
38
|
+
label?: string;
|
|
39
|
+
amount?: string;
|
|
40
|
+
paymentTiming?: 'immediate' | 'recurring' | 'deferred' | 'automaticReload';
|
|
41
|
+
scheduledPayment?: {
|
|
42
|
+
recurringStartDate?: Date;
|
|
43
|
+
recurringEndDate?: Date;
|
|
44
|
+
recurringIntervalUnit?: 'year' | 'month' | 'day' | 'hour' | 'minute';
|
|
45
|
+
recurringIntervalCount?: number;
|
|
46
|
+
};
|
|
47
|
+
deferredPayment?: {
|
|
48
|
+
deferredPaymentDate?: Date;
|
|
49
|
+
};
|
|
50
|
+
automaticReloadPayment?: {
|
|
51
|
+
thresholdAmount?: string;
|
|
52
|
+
};
|
|
53
|
+
}>;
|
|
54
|
+
}
|
|
55
|
+
export interface Features {
|
|
56
|
+
shippingContactFields?: Array<RequiredShippingContactField>;
|
|
57
|
+
supportsCouponCode?: boolean;
|
|
58
|
+
}
|
|
18
59
|
export interface ApplePayButtonProps {
|
|
60
|
+
scope?: typeof Scope[keyof typeof Scope];
|
|
19
61
|
publicKey: string;
|
|
20
62
|
environment: typeof Environment[keyof typeof Environment];
|
|
21
|
-
merchantIdentifier: string;
|
|
22
63
|
merchant: {
|
|
23
|
-
id
|
|
64
|
+
id: string;
|
|
24
65
|
domain: string;
|
|
66
|
+
identifier?: string;
|
|
25
67
|
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
first: string;
|
|
32
|
-
middle?: string;
|
|
33
|
-
last: string;
|
|
34
|
-
};
|
|
35
|
-
email: {
|
|
36
|
-
address: string;
|
|
37
|
-
};
|
|
38
|
-
phone: {
|
|
39
|
-
code: string;
|
|
40
|
-
number: string;
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
transaction: {
|
|
44
|
-
amount: string;
|
|
45
|
-
currency: string;
|
|
46
|
-
};
|
|
68
|
+
interface?: Interface;
|
|
69
|
+
customer?: Customer;
|
|
70
|
+
acceptance: Acceptance;
|
|
71
|
+
transaction: Transaction;
|
|
72
|
+
features: Features;
|
|
47
73
|
onCancel?: () => void;
|
|
48
74
|
onError?: (error: any) => void;
|
|
49
75
|
onSuccess?: (data: Record<string, any>) => Promise<void>;
|
|
50
76
|
onClick?: () => void;
|
|
51
77
|
onReady?: () => void;
|
|
78
|
+
onMerchantValidation?: (status: 'initiated' | 'completed' | 'error') => void;
|
|
79
|
+
onShippingMethodSelected?: (shippingMethod: ApplePayShippingMethod) => Promise<ApplePayUpdateData>;
|
|
80
|
+
onShippingContactSelected?: (shippingContact: ApplePayPaymentContact) => Promise<ApplePayUpdateData>;
|
|
81
|
+
onPaymentMethodSelected?: (paymentMethod: ApplePayPaymentMethod) => Promise<ApplePayUpdateData>;
|
|
82
|
+
onCouponChanged?: (couponCode: string) => Promise<ApplePayUpdateData>;
|
|
52
83
|
metaData?: MetaData;
|
|
53
|
-
type?: typeof ButtonType[keyof typeof ButtonType];
|
|
54
|
-
locale?: typeof Locale[keyof typeof Locale];
|
|
55
84
|
debug?: boolean;
|
|
56
85
|
}
|
|
57
86
|
export interface MerchantResponse {
|
|
@@ -80,3 +109,32 @@ export interface MetaData {
|
|
|
80
109
|
payment_options: PaymentOptionsResponse;
|
|
81
110
|
headers: Record<string, string>;
|
|
82
111
|
}
|
|
112
|
+
export interface CheckoutProfileRequest {
|
|
113
|
+
currency: string;
|
|
114
|
+
merchant_id: string;
|
|
115
|
+
total_amount: number;
|
|
116
|
+
order: {
|
|
117
|
+
amount: number;
|
|
118
|
+
currency: string;
|
|
119
|
+
customer?: {
|
|
120
|
+
id?: string;
|
|
121
|
+
email?: string;
|
|
122
|
+
first_name?: string;
|
|
123
|
+
last_name?: string;
|
|
124
|
+
phone?: {
|
|
125
|
+
country_code: string;
|
|
126
|
+
number: string;
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
items: {
|
|
130
|
+
quantity: number;
|
|
131
|
+
amount: number;
|
|
132
|
+
currency: string;
|
|
133
|
+
name: string;
|
|
134
|
+
requiresShipping: string;
|
|
135
|
+
}[];
|
|
136
|
+
merchant: {
|
|
137
|
+
id: string;
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
}
|
package/build/@types/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from './ApplePaySession';
|