@tap-payments/apple-pay-button 1.0.1 → 1.0.4
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/LICENSE +21 -21
- package/README.md +194 -194
- package/build/@types/index.d.ts +82 -73
- package/build/@types/index.js +1 -1
- package/build/api/app.service.d.ts +23 -11
- package/build/api/app.service.js +253 -217
- package/build/api/base.d.ts +9 -9
- package/build/api/base.js +45 -45
- package/build/api/httpClient.d.ts +8 -2
- package/build/api/httpClient.js +33 -16
- package/build/constants/index.d.ts +51 -26
- package/build/constants/index.js +51 -26
- package/build/features/ApplePayButton/ApplePayButton.css +10 -40
- package/build/features/ApplePayButton/ApplePayButton.d.ts +6 -6
- package/build/features/ApplePayButton/ApplePayButton.js +80 -51
- package/build/features/ApplePayButton/index.d.ts +3 -3
- package/build/features/ApplePayButton/index.js +2 -2
- package/build/hooks/index.d.ts +1 -1
- package/build/hooks/index.js +1 -1
- package/build/hooks/useApplePay.d.ts +9 -9
- package/build/hooks/useApplePay.js +243 -197
- package/build/hooks/useScript.d.ts +1 -1
- package/build/hooks/useScript.js +39 -39
- package/build/index.d.ts +4 -4
- package/build/index.js +10 -9
- package/build/utils/config.d.ts +11 -9
- package/build/utils/config.js +72 -54
- package/build/utils/html.d.ts +1 -1
- package/build/utils/html.js +9 -9
- package/build/utils/index.d.ts +1 -1
- package/build/utils/index.js +1 -1
- package/package.json +3 -1
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2022 Tap Payments
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Tap Payments
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,194 +1,194 @@
|
|
|
1
|
-
# apple-pay-button
|
|
2
|
-
|
|
3
|
-
Handling Apple Pay button in React and vanilla JS
|
|
4
|
-
|
|
5
|
-
## Install
|
|
6
|
-
|
|
7
|
-
This is a [React](https://reactjs.org/) module available through the
|
|
8
|
-
[npm registry](https://www.npmjs.com/). Installation is done using the
|
|
9
|
-
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
|
10
|
-
|
|
11
|
-
```console
|
|
12
|
-
npm install @tap-payments/apple-pay-button
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
---------------------------- OR -------------------------
|
|
16
|
-
|
|
17
|
-
```console
|
|
18
|
-
yarn add @tap-payments/apple-pay-button
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## Examples
|
|
22
|
-
|
|
23
|
-
### ES6
|
|
24
|
-
|
|
25
|
-
```javascript
|
|
26
|
-
import React from 'react'
|
|
27
|
-
import { ApplePayButton, ButtonStyle, SupportedNetworks, Scope } from '@tap-payments/apple-pay-button'
|
|
28
|
-
|
|
29
|
-
const App = () => {
|
|
30
|
-
return (
|
|
31
|
-
<ApplePayButton
|
|
32
|
-
// required (The public Key provided by Tap)
|
|
33
|
-
publicKey={'pk_test_xxxxxxxxxxxxxxxzh'}
|
|
34
|
-
// required
|
|
35
|
-
merchant={{
|
|
36
|
-
// required (The merchant domain name)
|
|
37
|
-
domain: 'example.com',
|
|
38
|
-
// optional (The merchant identifier provided by Tap)
|
|
39
|
-
id: '1xxxxx8'
|
|
40
|
-
}}
|
|
41
|
-
// required
|
|
42
|
-
transaction={{
|
|
43
|
-
// required (The amount to be charged)
|
|
44
|
-
amount: '12',
|
|
45
|
-
// required (The currency of the amount)
|
|
46
|
-
currency: 'KWD'
|
|
47
|
-
}}
|
|
48
|
-
// optional (The scope of the SDK and it can be one of these scopes:
|
|
49
|
-
// [TapToken,AppleToken], by default it is TapToken)
|
|
50
|
-
scope={Scope.TapToken}
|
|
51
|
-
// optional (The supported networks for the Apple Pay button and it
|
|
52
|
-
// can be one of these networks: [Mada,Visa,MasterCard], by default
|
|
53
|
-
// we bring all the supported networks from tap merchant configuration)
|
|
54
|
-
supportedNetworks={[SupportedNetworks.Mada, SupportedNetworks.Visa, SupportedNetworks.MasterCard]}
|
|
55
|
-
// optional (The style of the Apple Pay button and it can be one of
|
|
56
|
-
// these styles: [White,WhiteOutline,Black], by default it is WhiteOutline)
|
|
57
|
-
buttonStyle={ButtonStyle.WhiteOutline}
|
|
58
|
-
// optional (The billing contact information)
|
|
59
|
-
billingContact={{
|
|
60
|
-
// required
|
|
61
|
-
email: {
|
|
62
|
-
// required
|
|
63
|
-
address: 'test@gmail.com'
|
|
64
|
-
},
|
|
65
|
-
// required
|
|
66
|
-
name: {
|
|
67
|
-
// required
|
|
68
|
-
first: 'test',
|
|
69
|
-
// required
|
|
70
|
-
last: 'tester',
|
|
71
|
-
// optional
|
|
72
|
-
middle: 'test'
|
|
73
|
-
},
|
|
74
|
-
// required
|
|
75
|
-
phone: {
|
|
76
|
-
number: '10XXXXXX56',
|
|
77
|
-
code: '+20'
|
|
78
|
-
}
|
|
79
|
-
}}
|
|
80
|
-
// optional (A callback function that will be called when you cancel
|
|
81
|
-
// the payment process)
|
|
82
|
-
onCancel={() => console.log('cancelled')}
|
|
83
|
-
// optional (A callback function that will be called when you have an error)
|
|
84
|
-
onError={(err) => console.error(err)}
|
|
85
|
-
// optional (A async function that will be called after creating the token
|
|
86
|
-
// successfully)
|
|
87
|
-
onSuccess={async (token) => {
|
|
88
|
-
// do your stuff here...
|
|
89
|
-
console.log(token)
|
|
90
|
-
}}
|
|
91
|
-
/>
|
|
92
|
-
)
|
|
93
|
-
}
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
### Vanilla JS
|
|
97
|
-
|
|
98
|
-
```html
|
|
99
|
-
<!DOCTYPE html>
|
|
100
|
-
<html lang="en">
|
|
101
|
-
<head>
|
|
102
|
-
<meta charset="UTF-8" />
|
|
103
|
-
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
104
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
105
|
-
<title>apple pay button</title>
|
|
106
|
-
<link rel="stylesheet" href="https://apple-pay-button.b-cdn.net/build-
|
|
107
|
-
<script src="https://apple-pay-button.b-cdn.net/build-
|
|
108
|
-
</head>
|
|
109
|
-
<body>
|
|
110
|
-
<div id="apple-pay-button"></div>
|
|
111
|
-
<script type="text/javascript">
|
|
112
|
-
const { renderApplePayButton, ButtonStyle, Scope, SupportedNetworks } = window.TapSDKs
|
|
113
|
-
renderApplePayButton(
|
|
114
|
-
{
|
|
115
|
-
// required
|
|
116
|
-
publicKey: 'pk_test_xxxxxxxxxxxxxxxzh',
|
|
117
|
-
// required
|
|
118
|
-
merchant: {
|
|
119
|
-
// required
|
|
120
|
-
domain: 'example.com'
|
|
121
|
-
// optional
|
|
122
|
-
// id: '123...'
|
|
123
|
-
},
|
|
124
|
-
// required
|
|
125
|
-
transaction: {
|
|
126
|
-
// required
|
|
127
|
-
currency: 'USD',
|
|
128
|
-
// required
|
|
129
|
-
amount: '100'
|
|
130
|
-
},
|
|
131
|
-
// optional
|
|
132
|
-
scope: Scope.TapToken,
|
|
133
|
-
// optional
|
|
134
|
-
buttonStyle: ButtonStyle.WhiteOutline,
|
|
135
|
-
// optional
|
|
136
|
-
supportedNetworks: [SupportedNetworks.Visa, SupportedNetworks.MasterCard],
|
|
137
|
-
// optional (The billing contact information)
|
|
138
|
-
billingContact: {
|
|
139
|
-
// required
|
|
140
|
-
email: {
|
|
141
|
-
// required
|
|
142
|
-
address: 'test@gmail.com'
|
|
143
|
-
},
|
|
144
|
-
// required
|
|
145
|
-
name: {
|
|
146
|
-
// required
|
|
147
|
-
first: 'test',
|
|
148
|
-
// required
|
|
149
|
-
last: 'tester',
|
|
150
|
-
// optional
|
|
151
|
-
middle: 'test'
|
|
152
|
-
},
|
|
153
|
-
// required
|
|
154
|
-
phone: {
|
|
155
|
-
number: '10XXXXXX56',
|
|
156
|
-
code: '+20'
|
|
157
|
-
}
|
|
158
|
-
},
|
|
159
|
-
// optional
|
|
160
|
-
onCancel: () => {
|
|
161
|
-
console.log('onCancel')
|
|
162
|
-
},
|
|
163
|
-
// optional
|
|
164
|
-
onError: (error) => {
|
|
165
|
-
console.log('onError', error)
|
|
166
|
-
},
|
|
167
|
-
// optional
|
|
168
|
-
onSuccess: async (data) => {
|
|
169
|
-
console.log('onSuccess', data)
|
|
170
|
-
}
|
|
171
|
-
},
|
|
172
|
-
'apple-pay-button'
|
|
173
|
-
)
|
|
174
|
-
</script>
|
|
175
|
-
</body>
|
|
176
|
-
</html>
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
## Configurations
|
|
180
|
-
|
|
181
|
-
| Name | Type | R/O | Description |
|
|
182
|
-
| -------------------- | --------------------- | ---------- | -------------------------------------------------------------------------- |
|
|
183
|
-
| publicKey | `string` | `required` | The public Key provided by Tap |
|
|
184
|
-
| merchant.id | `string` | `optional` | The merchant identifier provided by Tap |
|
|
185
|
-
| merchant.domain | `string` | `required` | The merchant domain name |
|
|
186
|
-
| transaction.amount | `string` | `required` | The amount to be charged |
|
|
187
|
-
| transaction.currency | `string` | `required` | The currency of the amount |
|
|
188
|
-
| scope | `Scope` | `optional` | The scope of the SDK |
|
|
189
|
-
| supportedNetworks | `SupportedNetworks[]` | `optional` | The supported networks for the Apple Pay button |
|
|
190
|
-
| buttonStyle | `ButtonStyle` | `optional` | The style of the Apple Pay button |
|
|
191
|
-
| billingContact | `BillingContact` | `optional` | The billing contact information |
|
|
192
|
-
| onCancel | `function` | `optional` | A callback function that will be called when you cancel the process |
|
|
193
|
-
| onError | `function` | `optional` | A callback function that will be called when you have an error |
|
|
194
|
-
| onSuccess | `function` | `optional` | A async function that will be called after creating the token successfully |
|
|
1
|
+
# apple-pay-button
|
|
2
|
+
|
|
3
|
+
Handling Apple Pay button in React and vanilla JS
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
This is a [React](https://reactjs.org/) module available through the
|
|
8
|
+
[npm registry](https://www.npmjs.com/). Installation is done using the
|
|
9
|
+
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
|
10
|
+
|
|
11
|
+
```console
|
|
12
|
+
npm install @tap-payments/apple-pay-button
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
---------------------------- OR -------------------------
|
|
16
|
+
|
|
17
|
+
```console
|
|
18
|
+
yarn add @tap-payments/apple-pay-button
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Examples
|
|
22
|
+
|
|
23
|
+
### ES6
|
|
24
|
+
|
|
25
|
+
```javascript
|
|
26
|
+
import React from 'react'
|
|
27
|
+
import { ApplePayButton, ButtonStyle, SupportedNetworks, Scope } from '@tap-payments/apple-pay-button'
|
|
28
|
+
|
|
29
|
+
const App = () => {
|
|
30
|
+
return (
|
|
31
|
+
<ApplePayButton
|
|
32
|
+
// required (The public Key provided by Tap)
|
|
33
|
+
publicKey={'pk_test_xxxxxxxxxxxxxxxzh'}
|
|
34
|
+
// required
|
|
35
|
+
merchant={{
|
|
36
|
+
// required (The merchant domain name)
|
|
37
|
+
domain: 'example.com',
|
|
38
|
+
// optional (The merchant identifier provided by Tap)
|
|
39
|
+
id: '1xxxxx8'
|
|
40
|
+
}}
|
|
41
|
+
// required
|
|
42
|
+
transaction={{
|
|
43
|
+
// required (The amount to be charged)
|
|
44
|
+
amount: '12',
|
|
45
|
+
// required (The currency of the amount)
|
|
46
|
+
currency: 'KWD'
|
|
47
|
+
}}
|
|
48
|
+
// optional (The scope of the SDK and it can be one of these scopes:
|
|
49
|
+
// [TapToken,AppleToken], by default it is TapToken)
|
|
50
|
+
scope={Scope.TapToken}
|
|
51
|
+
// optional (The supported networks for the Apple Pay button and it
|
|
52
|
+
// can be one of these networks: [Mada,Visa,MasterCard], by default
|
|
53
|
+
// we bring all the supported networks from tap merchant configuration)
|
|
54
|
+
supportedNetworks={[SupportedNetworks.Mada, SupportedNetworks.Visa, SupportedNetworks.MasterCard]}
|
|
55
|
+
// optional (The style of the Apple Pay button and it can be one of
|
|
56
|
+
// these styles: [White,WhiteOutline,Black], by default it is WhiteOutline)
|
|
57
|
+
buttonStyle={ButtonStyle.WhiteOutline}
|
|
58
|
+
// optional (The billing contact information)
|
|
59
|
+
billingContact={{
|
|
60
|
+
// required
|
|
61
|
+
email: {
|
|
62
|
+
// required
|
|
63
|
+
address: 'test@gmail.com'
|
|
64
|
+
},
|
|
65
|
+
// required
|
|
66
|
+
name: {
|
|
67
|
+
// required
|
|
68
|
+
first: 'test',
|
|
69
|
+
// required
|
|
70
|
+
last: 'tester',
|
|
71
|
+
// optional
|
|
72
|
+
middle: 'test'
|
|
73
|
+
},
|
|
74
|
+
// required
|
|
75
|
+
phone: {
|
|
76
|
+
number: '10XXXXXX56',
|
|
77
|
+
code: '+20'
|
|
78
|
+
}
|
|
79
|
+
}}
|
|
80
|
+
// optional (A callback function that will be called when you cancel
|
|
81
|
+
// the payment process)
|
|
82
|
+
onCancel={() => console.log('cancelled')}
|
|
83
|
+
// optional (A callback function that will be called when you have an error)
|
|
84
|
+
onError={(err) => console.error(err)}
|
|
85
|
+
// optional (A async function that will be called after creating the token
|
|
86
|
+
// successfully)
|
|
87
|
+
onSuccess={async (token) => {
|
|
88
|
+
// do your stuff here...
|
|
89
|
+
console.log(token)
|
|
90
|
+
}}
|
|
91
|
+
/>
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Vanilla JS
|
|
97
|
+
|
|
98
|
+
```html
|
|
99
|
+
<!DOCTYPE html>
|
|
100
|
+
<html lang="en">
|
|
101
|
+
<head>
|
|
102
|
+
<meta charset="UTF-8" />
|
|
103
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
104
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
105
|
+
<title>apple pay button</title>
|
|
106
|
+
<link rel="stylesheet" href="https://apple-pay-button.b-cdn.net/build-0.0.8-test/main.css" />
|
|
107
|
+
<script src="https://apple-pay-button.b-cdn.net/build-0.0.8-test/main.js"></script>
|
|
108
|
+
</head>
|
|
109
|
+
<body>
|
|
110
|
+
<div id="apple-pay-button"></div>
|
|
111
|
+
<script type="text/javascript">
|
|
112
|
+
const { renderApplePayButton, ButtonStyle, Scope, SupportedNetworks } = window.TapSDKs
|
|
113
|
+
renderApplePayButton(
|
|
114
|
+
{
|
|
115
|
+
// required
|
|
116
|
+
publicKey: 'pk_test_xxxxxxxxxxxxxxxzh',
|
|
117
|
+
// required
|
|
118
|
+
merchant: {
|
|
119
|
+
// required
|
|
120
|
+
domain: 'example.com'
|
|
121
|
+
// optional
|
|
122
|
+
// id: '123...'
|
|
123
|
+
},
|
|
124
|
+
// required
|
|
125
|
+
transaction: {
|
|
126
|
+
// required
|
|
127
|
+
currency: 'USD',
|
|
128
|
+
// required
|
|
129
|
+
amount: '100'
|
|
130
|
+
},
|
|
131
|
+
// optional
|
|
132
|
+
scope: Scope.TapToken,
|
|
133
|
+
// optional
|
|
134
|
+
buttonStyle: ButtonStyle.WhiteOutline,
|
|
135
|
+
// optional
|
|
136
|
+
supportedNetworks: [SupportedNetworks.Visa, SupportedNetworks.MasterCard],
|
|
137
|
+
// optional (The billing contact information)
|
|
138
|
+
billingContact: {
|
|
139
|
+
// required
|
|
140
|
+
email: {
|
|
141
|
+
// required
|
|
142
|
+
address: 'test@gmail.com'
|
|
143
|
+
},
|
|
144
|
+
// required
|
|
145
|
+
name: {
|
|
146
|
+
// required
|
|
147
|
+
first: 'test',
|
|
148
|
+
// required
|
|
149
|
+
last: 'tester',
|
|
150
|
+
// optional
|
|
151
|
+
middle: 'test'
|
|
152
|
+
},
|
|
153
|
+
// required
|
|
154
|
+
phone: {
|
|
155
|
+
number: '10XXXXXX56',
|
|
156
|
+
code: '+20'
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
// optional
|
|
160
|
+
onCancel: () => {
|
|
161
|
+
console.log('onCancel')
|
|
162
|
+
},
|
|
163
|
+
// optional
|
|
164
|
+
onError: (error) => {
|
|
165
|
+
console.log('onError', error)
|
|
166
|
+
},
|
|
167
|
+
// optional
|
|
168
|
+
onSuccess: async (data) => {
|
|
169
|
+
console.log('onSuccess', data)
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
'apple-pay-button'
|
|
173
|
+
)
|
|
174
|
+
</script>
|
|
175
|
+
</body>
|
|
176
|
+
</html>
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## Configurations
|
|
180
|
+
|
|
181
|
+
| Name | Type | R/O | Description |
|
|
182
|
+
| -------------------- | --------------------- | ---------- | -------------------------------------------------------------------------- |
|
|
183
|
+
| publicKey | `string` | `required` | The public Key provided by Tap |
|
|
184
|
+
| merchant.id | `string` | `optional` | The merchant identifier provided by Tap |
|
|
185
|
+
| merchant.domain | `string` | `required` | The merchant domain name |
|
|
186
|
+
| transaction.amount | `string` | `required` | The amount to be charged |
|
|
187
|
+
| transaction.currency | `string` | `required` | The currency of the amount |
|
|
188
|
+
| scope | `Scope` | `optional` | The scope of the SDK |
|
|
189
|
+
| supportedNetworks | `SupportedNetworks[]` | `optional` | The supported networks for the Apple Pay button |
|
|
190
|
+
| buttonStyle | `ButtonStyle` | `optional` | The style of the Apple Pay button |
|
|
191
|
+
| billingContact | `BillingContact` | `optional` | The billing contact information |
|
|
192
|
+
| onCancel | `function` | `optional` | A callback function that will be called when you cancel the process |
|
|
193
|
+
| onError | `function` | `optional` | A callback function that will be called when you have an error |
|
|
194
|
+
| onSuccess | `function` | `optional` | A async function that will be called after creating the token successfully |
|
package/build/@types/index.d.ts
CHANGED
|
@@ -1,73 +1,82 @@
|
|
|
1
|
-
import { Scope, ButtonStyle, MerchantCapabilities, SupportedNetworks } from '../constants';
|
|
2
|
-
export interface ApplePayRequestData {
|
|
3
|
-
countryCode: string;
|
|
4
|
-
currencyCode: string;
|
|
5
|
-
merchantCapabilities: Array<typeof MerchantCapabilities[keyof typeof MerchantCapabilities]>;
|
|
6
|
-
supportedNetworks: Array<typeof SupportedNetworks[keyof typeof SupportedNetworks]>;
|
|
7
|
-
billingContact?: {
|
|
8
|
-
phoneNumber: string;
|
|
9
|
-
emailAddress: string;
|
|
10
|
-
givenName: string;
|
|
11
|
-
familyName: string;
|
|
12
|
-
};
|
|
13
|
-
total: {
|
|
14
|
-
label: string;
|
|
15
|
-
amount: number;
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
export interface ApplePayButtonProps {
|
|
19
|
-
publicKey: string;
|
|
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
|
-
name: string;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
export interface
|
|
65
|
-
id: string;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
1
|
+
import { Scope, ButtonStyle, MerchantCapabilities, SupportedNetworks, ButtonType, Locale, Environment } from '../constants';
|
|
2
|
+
export interface ApplePayRequestData {
|
|
3
|
+
countryCode: string;
|
|
4
|
+
currencyCode: string;
|
|
5
|
+
merchantCapabilities: Array<typeof MerchantCapabilities[keyof typeof MerchantCapabilities]>;
|
|
6
|
+
supportedNetworks: Array<typeof SupportedNetworks[keyof typeof SupportedNetworks]>;
|
|
7
|
+
billingContact?: {
|
|
8
|
+
phoneNumber: string;
|
|
9
|
+
emailAddress: string;
|
|
10
|
+
givenName: string;
|
|
11
|
+
familyName: string;
|
|
12
|
+
};
|
|
13
|
+
total: {
|
|
14
|
+
label: string;
|
|
15
|
+
amount: number;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export interface ApplePayButtonProps {
|
|
19
|
+
publicKey: string;
|
|
20
|
+
environment: typeof Environment[keyof typeof Environment];
|
|
21
|
+
merchantIdentifier: string;
|
|
22
|
+
merchant: {
|
|
23
|
+
id?: string;
|
|
24
|
+
domain: string;
|
|
25
|
+
};
|
|
26
|
+
scope?: typeof Scope[keyof typeof Scope];
|
|
27
|
+
supportedNetworks?: Array<typeof SupportedNetworks[keyof typeof SupportedNetworks]>;
|
|
28
|
+
buttonStyle?: typeof ButtonStyle[keyof typeof ButtonStyle];
|
|
29
|
+
billingContact?: {
|
|
30
|
+
name: {
|
|
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
|
+
};
|
|
47
|
+
onCancel?: () => void;
|
|
48
|
+
onError?: (error: any) => void;
|
|
49
|
+
onSuccess?: (data: Record<string, any>) => Promise<void>;
|
|
50
|
+
onClick?: () => void;
|
|
51
|
+
onReady?: () => void;
|
|
52
|
+
metaData?: MetaData;
|
|
53
|
+
type?: typeof ButtonType[keyof typeof ButtonType];
|
|
54
|
+
locale?: typeof Locale[keyof typeof Locale];
|
|
55
|
+
debug?: boolean;
|
|
56
|
+
}
|
|
57
|
+
export interface MerchantResponse {
|
|
58
|
+
id: string;
|
|
59
|
+
name: string;
|
|
60
|
+
country_code: string;
|
|
61
|
+
session_token: string;
|
|
62
|
+
[other: string]: string;
|
|
63
|
+
}
|
|
64
|
+
export interface PaymentMethod {
|
|
65
|
+
id: string;
|
|
66
|
+
image: string;
|
|
67
|
+
name: string;
|
|
68
|
+
payment_type: string;
|
|
69
|
+
supported_card_brands: Array<typeof SupportedNetworks[keyof typeof SupportedNetworks]>;
|
|
70
|
+
supported_currencies: string[];
|
|
71
|
+
}
|
|
72
|
+
export interface PaymentOptionsResponse {
|
|
73
|
+
id: string;
|
|
74
|
+
country: string;
|
|
75
|
+
currency: string;
|
|
76
|
+
payment_methods: PaymentMethod[];
|
|
77
|
+
}
|
|
78
|
+
export interface MetaData {
|
|
79
|
+
merchant: MerchantResponse;
|
|
80
|
+
payment_options: PaymentOptionsResponse;
|
|
81
|
+
headers: Record<string, string>;
|
|
82
|
+
}
|
package/build/@types/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1,11 +1,23 @@
|
|
|
1
|
-
import { MerchantResponse,
|
|
2
|
-
import BaseService from './base';
|
|
3
|
-
declare class APPService extends BaseService {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { MerchantResponse, ApplePayButtonProps } from '../@types';
|
|
2
|
+
import BaseService from './base';
|
|
3
|
+
declare class APPService extends BaseService {
|
|
4
|
+
private baseUrl;
|
|
5
|
+
private env;
|
|
6
|
+
constructor();
|
|
7
|
+
setEnv(env: ApplePayButtonProps['environment']): void;
|
|
8
|
+
setBaseUrl(): void;
|
|
9
|
+
getHeaderPublicKey(): "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC8AX++RtxPZFtns4XzXFlDIxPBh0umN4qRXZaKDIlb6a3MknaB7psJWmf2l+e4Cfh9b5tey/+rZqpQ065eXTZfGCAuBLt+fYLQBhLfjRpk8S6hlIzc1Kdjg65uqzMwcTd0p7I4KLwHk1I0oXzuEu53fU1LSZhWp4Mnd6wjVgXAsQIDAQAB\n-----END PUBLIC KEY-----" | "" | "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC9hSRms7Ir1HmzdZxGXFYgmpi3\nez7VBFje0f8wwrxYS9oVoBtN4iAt0DOs3DbeuqtueI31wtpFVUMGg8W7R0SbtkZd\nGzszQNqt/wyqxpDC9q+97XdXwkWQFA72s76ud7eMXQlsWKsvgwhY+Ywzt0KlpNC3\nHj+N6UWFOYK98Xi+sQIDAQAB\n-----END PUBLIC KEY-----" | "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCi9W5jyTvA4Iwv3V5sfNQ7VdSz\n7WqwBbnWFbIUL/GjaaE93mvDv4zbgRSznHaHQPH6pxrMhMh0tV58njkvjHvQ/tvg\npwM8SemNPKEEAPl69tnMvCrJRPh2dWL3OHY8yCW4c38Hyx4fy56Zd5cdoVWfCReu\njCsvASLGz+cfRrj2swIDAQAB\n-----END PUBLIC KEY-----";
|
|
10
|
+
setBrowserHeaders({ locale, pk, domain }: {
|
|
11
|
+
locale: string;
|
|
12
|
+
pk: string;
|
|
13
|
+
domain: string;
|
|
14
|
+
}): Promise<void>;
|
|
15
|
+
checkoutProfile(merchantId?: string): Promise<{
|
|
16
|
+
merchant: any;
|
|
17
|
+
payment_options: any;
|
|
18
|
+
}>;
|
|
19
|
+
appleSession(merchant: MerchantResponse, validationURL: string, merchantRegisteredDomain: string, merchantIdentifier: string): Promise<any>;
|
|
20
|
+
tapTokenization(applePaymentData: Record<string, string>): Promise<any>;
|
|
21
|
+
}
|
|
22
|
+
declare const appService: APPService;
|
|
23
|
+
export default appService;
|