react-native-hyperpay-sdk 0.5.0 → 0.8.0
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 +27 -6
- package/ios/HyperPay.m +59 -8
- package/lib/typescript/countryisCodes.d.ts +501 -0
- package/lib/typescript/index.d.ts +21 -1
- package/package.json +1 -1
- package/src/index.tsx +10 -4
package/README.md
CHANGED
|
@@ -1,21 +1,42 @@
|
|
|
1
|
-
# react-native-hyperpay
|
|
1
|
+
# react-native-hyperpay-sdk
|
|
2
2
|
|
|
3
3
|
hyperpay
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```sh
|
|
8
|
-
npm
|
|
8
|
+
npm i react-native-hyperpay-sdk
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
13
13
|
```js
|
|
14
|
-
import {
|
|
15
|
-
|
|
14
|
+
import { setConfig } from "react-native-hyperpay-sdk";
|
|
15
|
+
|
|
16
|
+
// the firt step , set default configiration
|
|
17
|
+
// 1- shopperResultURL to redirect to this url after the payment completed
|
|
18
|
+
// 2- select your country code from list
|
|
19
|
+
// 3- merchantIdentifier is for apply pay only
|
|
20
|
+
setConfig({
|
|
21
|
+
shopperResultURL:"shopperResultURL",
|
|
22
|
+
countryCode:"SA",
|
|
23
|
+
merchantIdentifier:"merchantIdentifier"
|
|
24
|
+
})
|
|
16
25
|
// ...
|
|
17
|
-
|
|
18
|
-
const result = await
|
|
26
|
+
// to pay with apple
|
|
27
|
+
const result = await applePay("CheckoutId")
|
|
28
|
+
|
|
29
|
+
// to pay with any brand
|
|
30
|
+
const result=await createPaymentTransaction(
|
|
31
|
+
{ paymentBrand: "VISA",
|
|
32
|
+
holderName: "Test Test",
|
|
33
|
+
cardNumber: '4111111111111111',
|
|
34
|
+
expiryYear: '2027',
|
|
35
|
+
expiryMonth: '12',
|
|
36
|
+
cvv: '123',
|
|
37
|
+
checkoutID: `${res.data?.checkout_id}`,
|
|
38
|
+
shopperResultURL: "[YOUR_APP_IDENTIFIER]://[URL_SCHEMES]"
|
|
39
|
+
})
|
|
19
40
|
```
|
|
20
41
|
|
|
21
42
|
## Contributing
|
package/ios/HyperPay.m
CHANGED
|
@@ -6,12 +6,18 @@
|
|
|
6
6
|
@implementation HyperPay
|
|
7
7
|
|
|
8
8
|
OPPPaymentProvider *provider;
|
|
9
|
+
NSString *shopperResultURL = @"";
|
|
10
|
+
NSString *merchantIdentifier = @"";
|
|
11
|
+
NSString *countryCode = @"";
|
|
9
12
|
|
|
10
13
|
|
|
11
14
|
RCT_EXPORT_MODULE(HyperPay)
|
|
12
15
|
|
|
13
16
|
-(instancetype)init
|
|
14
17
|
{
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
15
21
|
self = [super init];
|
|
16
22
|
if (self) {
|
|
17
23
|
#ifdef DEBUG
|
|
@@ -32,6 +38,17 @@ RCT_EXPORT_MODULE(HyperPay)
|
|
|
32
38
|
React Native functions
|
|
33
39
|
*/
|
|
34
40
|
|
|
41
|
+
|
|
42
|
+
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(setConfig: (NSDictionary*)options) {
|
|
43
|
+
shopperResultURL=[options valueForKey:@"shopperResultURL"];
|
|
44
|
+
if ([options valueForKey:@"merchantIdentifier"])
|
|
45
|
+
shopperResultURL=[options valueForKey:@"merchantIdentifier"];
|
|
46
|
+
if ([options valueForKey:@"countryCode"])
|
|
47
|
+
countryCode=[options valueForKey:@"countryCode"];
|
|
48
|
+
return options;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
|
|
35
52
|
RCT_EXPORT_METHOD(createPaymentTransaction: (NSDictionary*)options resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
|
|
36
53
|
NSError * _Nullable error;
|
|
37
54
|
|
|
@@ -49,7 +66,7 @@ RCT_EXPORT_METHOD(createPaymentTransaction: (NSDictionary*)options resolver:(RCT
|
|
|
49
66
|
reject(@"createTransaction",error.localizedDescription, error);
|
|
50
67
|
|
|
51
68
|
} else {
|
|
52
|
-
params.shopperResultURL =
|
|
69
|
+
params.shopperResultURL =shopperResultURL;
|
|
53
70
|
|
|
54
71
|
OPPTransaction *transaction = [OPPTransaction transactionWithPaymentParams:params];
|
|
55
72
|
|
|
@@ -78,16 +95,50 @@ RCT_EXPORT_METHOD(createPaymentTransaction: (NSDictionary*)options resolver:(RCT
|
|
|
78
95
|
}
|
|
79
96
|
}
|
|
80
97
|
|
|
81
|
-
RCT_REMAP_METHOD(multiply,
|
|
82
|
-
multiplyWithA:(nonnull NSNumber*)a withB:(nonnull NSNumber*)b
|
|
83
|
-
withResolver:(RCTPromiseResolveBlock)resolve
|
|
84
|
-
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
85
|
-
{
|
|
86
|
-
NSNumber *result = @([a floatValue] * [b floatValue]);
|
|
87
98
|
|
|
88
|
-
|
|
99
|
+
|
|
100
|
+
RCT_EXPORT_METHOD(applePay:(NSString*)checkoutID resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject){
|
|
101
|
+
|
|
102
|
+
OPPPaymentProvider *provider = [OPPPaymentProvider paymentProviderWithMode:OPPProviderModeTest];
|
|
103
|
+
OPPCheckoutSettings *checkoutSettings = [[OPPCheckoutSettings alloc] init];
|
|
104
|
+
PKPaymentRequest *paymentRequest = [OPPPaymentProvider paymentRequestWithMerchantIdentifier:merchantIdentifier countryCode:countryCode];
|
|
105
|
+
// paymentRequest.supportedNetworks=[@"mada",@"visa",@"masterCard"];
|
|
106
|
+
paymentRequest.supportedNetworks = @ [PKPaymentNetworkMada,PKPaymentNetworkVisa,PKPaymentNetworkMasterCard];
|
|
107
|
+
|
|
108
|
+
// paymentRequest.supportedCountries
|
|
109
|
+
checkoutSettings.applePayPaymentRequest = paymentRequest;
|
|
110
|
+
OPPCheckoutProvider *checkoutProvider = [OPPCheckoutProvider checkoutProviderWithPaymentProvider:provider
|
|
111
|
+
checkoutID:checkoutID
|
|
112
|
+
settings:checkoutSettings];
|
|
113
|
+
|
|
114
|
+
[checkoutProvider presentCheckoutWithPaymentBrand:@"APPLEPAY"
|
|
115
|
+
loadingHandler:^(BOOL inProgress) {
|
|
116
|
+
|
|
117
|
+
// Executed whenever SDK sends request to the server or receives the response.
|
|
118
|
+
// You can start or stop loading animation based on inProgress parameter.
|
|
119
|
+
} completionHandler:^(OPPTransaction * _Nullable transaction, NSError * _Nullable error) {
|
|
120
|
+
if (error) {
|
|
121
|
+
// reject(@"applePay",checkoutID,error);
|
|
122
|
+
reject(@"applePay",error.localizedDescription, error);
|
|
123
|
+
// See code attribute (OPPErrorCode) and NSLocalizedDescription to identify the reason of failure.
|
|
124
|
+
} else {
|
|
125
|
+
if (transaction.redirectURL) {
|
|
126
|
+
resolve(transaction.redirectURL);
|
|
127
|
+
// Shopper was redirected to the issuer web page.
|
|
128
|
+
// Request payment status when shopper returns to the app using transaction.resourcePath or just checkout id.
|
|
129
|
+
} else {
|
|
130
|
+
reject(@"applePay",@"Request payment status for the synchronous transaction from your server using transactionPath.resourcePath or just checkout id..",error);
|
|
131
|
+
// Request payment status for the synchronous transaction from your server using transactionPath.resourcePath or just checkout id.
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
} cancelHandler:^{
|
|
135
|
+
reject(@"applePay",@"Executed if the shopper closes the payment page prematurely.",NULL);
|
|
136
|
+
// Executed if the shopper closes the payment page prematurely.
|
|
137
|
+
}];
|
|
138
|
+
|
|
89
139
|
}
|
|
90
140
|
|
|
141
|
+
|
|
91
142
|
@end
|
|
92
143
|
|
|
93
144
|
|
|
@@ -0,0 +1,501 @@
|
|
|
1
|
+
export type CountryCodes = {
|
|
2
|
+
//Afghanistan
|
|
3
|
+
AF: "AF"
|
|
4
|
+
// Albania
|
|
5
|
+
AL: "AL"
|
|
6
|
+
// Algeria
|
|
7
|
+
DZ: "DZ"
|
|
8
|
+
// American Samoa
|
|
9
|
+
AS: "AS"
|
|
10
|
+
// Andorra
|
|
11
|
+
AD: "AD"
|
|
12
|
+
// Angola
|
|
13
|
+
AO: "AO"
|
|
14
|
+
// Anguilla
|
|
15
|
+
AI: "AI"
|
|
16
|
+
// Antarctica
|
|
17
|
+
AQ: "AQ"
|
|
18
|
+
// Antigua and Barbuda
|
|
19
|
+
AG: "AG"
|
|
20
|
+
// Argentina
|
|
21
|
+
AR: "AR"
|
|
22
|
+
// Armenia
|
|
23
|
+
AM: "AM"
|
|
24
|
+
// Aruba
|
|
25
|
+
AW: "AW"
|
|
26
|
+
// Australia
|
|
27
|
+
AU: "AU"
|
|
28
|
+
// Austria
|
|
29
|
+
AT: "AT"
|
|
30
|
+
// Azerbaijan
|
|
31
|
+
AZ: "AZ"
|
|
32
|
+
// Bahamas(the)
|
|
33
|
+
BS: "BS"
|
|
34
|
+
// Bahrain
|
|
35
|
+
BH: "BH"
|
|
36
|
+
// Bangladesh
|
|
37
|
+
BD: "BD"
|
|
38
|
+
// Barbados
|
|
39
|
+
BB: "BB"
|
|
40
|
+
// Belarus
|
|
41
|
+
BY: "BY"
|
|
42
|
+
// Belgium
|
|
43
|
+
BE: "BE"
|
|
44
|
+
// Belize
|
|
45
|
+
BZ: "BZ"
|
|
46
|
+
// Benin
|
|
47
|
+
BJ: "BJ"
|
|
48
|
+
// Bermuda
|
|
49
|
+
BM: "BM"
|
|
50
|
+
// Bhutan
|
|
51
|
+
BT: "BT"
|
|
52
|
+
// Bolivia(Plurinational State of)
|
|
53
|
+
BO: "BO"
|
|
54
|
+
// Bonaire, Sint Eustatius and Saba
|
|
55
|
+
BQ: "BQ"
|
|
56
|
+
// Bosnia and Herzegovina
|
|
57
|
+
BA: "BA"
|
|
58
|
+
// Botswana
|
|
59
|
+
BW: "BW"
|
|
60
|
+
// Bouvet Island
|
|
61
|
+
BV: "BV"
|
|
62
|
+
// Brazil
|
|
63
|
+
BR: "BR"
|
|
64
|
+
// British Indian Ocean Territory(the)
|
|
65
|
+
IO: "IO"
|
|
66
|
+
// Brunei Darussalam
|
|
67
|
+
BN: "BN"
|
|
68
|
+
// Bulgaria
|
|
69
|
+
BG: "BG"
|
|
70
|
+
// Burkina Faso
|
|
71
|
+
BF: "BF"
|
|
72
|
+
// Burundi
|
|
73
|
+
BI: "BI"
|
|
74
|
+
// Cabo Verde
|
|
75
|
+
CV: "CV"
|
|
76
|
+
// Cambodia
|
|
77
|
+
KH: "KH"
|
|
78
|
+
// Cameroon
|
|
79
|
+
CM: "CM"
|
|
80
|
+
// Canada
|
|
81
|
+
CA: "CA"
|
|
82
|
+
// Cayman Islands(the)
|
|
83
|
+
KY: "KY"
|
|
84
|
+
// Central African Republic(the)
|
|
85
|
+
CF: "CF"
|
|
86
|
+
// Chad
|
|
87
|
+
TD: "TD"
|
|
88
|
+
// Chile
|
|
89
|
+
CL: "CL"
|
|
90
|
+
// China
|
|
91
|
+
CN: "CN"
|
|
92
|
+
// Christmas Island
|
|
93
|
+
CX: "CX"
|
|
94
|
+
// Cocos(Keeling) Islands(the)
|
|
95
|
+
CC: "CC"
|
|
96
|
+
// Colombia
|
|
97
|
+
CO: "CO"
|
|
98
|
+
// Comoros(the)
|
|
99
|
+
KM: "KM"
|
|
100
|
+
// Congo(the Democratic Republic of the)
|
|
101
|
+
CD: "CD"
|
|
102
|
+
// Congo(the)
|
|
103
|
+
CG: "CG"
|
|
104
|
+
// Cook Islands(the)
|
|
105
|
+
CK: "CK"
|
|
106
|
+
// Costa Rica
|
|
107
|
+
CR: "CR"
|
|
108
|
+
// Croatia
|
|
109
|
+
HR: "HR"
|
|
110
|
+
// Cuba
|
|
111
|
+
CU: "CU"
|
|
112
|
+
// Curaçao
|
|
113
|
+
CW: "CW"
|
|
114
|
+
// Cyprus
|
|
115
|
+
CY: "CY"
|
|
116
|
+
// Czechia
|
|
117
|
+
CZ: "CZ"
|
|
118
|
+
// Côte d'Ivoire
|
|
119
|
+
CI: "CI"
|
|
120
|
+
// Denmark
|
|
121
|
+
DK: "DK"
|
|
122
|
+
// Djibouti
|
|
123
|
+
DJ: "DJ"
|
|
124
|
+
// Dominica
|
|
125
|
+
DM: "DM"
|
|
126
|
+
// Dominican Republic(the)
|
|
127
|
+
DO: "DO"
|
|
128
|
+
// Ecuador
|
|
129
|
+
EC: "EC"
|
|
130
|
+
// Egypt
|
|
131
|
+
EG: "EG"
|
|
132
|
+
// El Salvador
|
|
133
|
+
SV: "SV"
|
|
134
|
+
// Equatorial Guinea
|
|
135
|
+
GQ: "GQ"
|
|
136
|
+
// Eritrea
|
|
137
|
+
ER: "ER"
|
|
138
|
+
// Estonia
|
|
139
|
+
EE: "EE"
|
|
140
|
+
// Eswatini
|
|
141
|
+
SZ: "SZ"
|
|
142
|
+
// Ethiopia
|
|
143
|
+
ET: "ET"
|
|
144
|
+
// Falkland Islands(the)[Malvinas]
|
|
145
|
+
FK: "FK"
|
|
146
|
+
// Faroe Islands(the)
|
|
147
|
+
FO: "FO"
|
|
148
|
+
// Fiji
|
|
149
|
+
FJ: "FJ"
|
|
150
|
+
// Finland
|
|
151
|
+
FI: "FI"
|
|
152
|
+
// France
|
|
153
|
+
FR: "FR"
|
|
154
|
+
// French Guiana
|
|
155
|
+
GF: "GF"
|
|
156
|
+
// French Polynesia
|
|
157
|
+
PF: "PF"
|
|
158
|
+
// French Southern Territories(the)
|
|
159
|
+
TF: "TF"
|
|
160
|
+
// Gabon
|
|
161
|
+
GA: "GA"
|
|
162
|
+
// Gambia(the)
|
|
163
|
+
GM: "GM"
|
|
164
|
+
// Georgia
|
|
165
|
+
GE: "GE"
|
|
166
|
+
// Germany
|
|
167
|
+
DE: "DE"
|
|
168
|
+
// Ghana
|
|
169
|
+
GH: "GH"
|
|
170
|
+
// Gibraltar
|
|
171
|
+
GI: "GI"
|
|
172
|
+
// Greece
|
|
173
|
+
GR: "GR"
|
|
174
|
+
// Greenland
|
|
175
|
+
GL: "GL"
|
|
176
|
+
// Grenada
|
|
177
|
+
GD: "GD"
|
|
178
|
+
// Guadeloupe
|
|
179
|
+
GP: "GP"
|
|
180
|
+
// Guam
|
|
181
|
+
GU: "GU"
|
|
182
|
+
// Guatemala
|
|
183
|
+
GT: "GT"
|
|
184
|
+
// Guernsey
|
|
185
|
+
GG: "GG"
|
|
186
|
+
// Guinea
|
|
187
|
+
GN: "GN"
|
|
188
|
+
// Guinea - Bissau
|
|
189
|
+
GW: "GW"
|
|
190
|
+
// Guyana
|
|
191
|
+
GY: "GY"
|
|
192
|
+
// Haiti
|
|
193
|
+
HT: "HT"
|
|
194
|
+
// Heard Island and McDonald Islands
|
|
195
|
+
HM: "HM"
|
|
196
|
+
// Holy See(the)
|
|
197
|
+
VA: "VA"
|
|
198
|
+
// Honduras
|
|
199
|
+
HN: "HN"
|
|
200
|
+
// Hong Kong
|
|
201
|
+
HK: "HK"
|
|
202
|
+
// Hungary
|
|
203
|
+
HU: "HU"
|
|
204
|
+
// Iceland
|
|
205
|
+
IS: "IS"
|
|
206
|
+
// India
|
|
207
|
+
IN: "IN"
|
|
208
|
+
// Indonesia
|
|
209
|
+
ID: "ID"
|
|
210
|
+
// Iran(Islamic Republic of)
|
|
211
|
+
IR: "IR"
|
|
212
|
+
// Iraq
|
|
213
|
+
IQ: "IQ"
|
|
214
|
+
// Ireland
|
|
215
|
+
IE: "IE"
|
|
216
|
+
// Isle of Man
|
|
217
|
+
IM: "IM"
|
|
218
|
+
// Israel
|
|
219
|
+
IL: "IL"
|
|
220
|
+
// Italy
|
|
221
|
+
IT: "IT"
|
|
222
|
+
// Jamaica
|
|
223
|
+
JM: "JM"
|
|
224
|
+
// Japan
|
|
225
|
+
JP: "JP"
|
|
226
|
+
// Jersey
|
|
227
|
+
JE: "JE"
|
|
228
|
+
// Jordan
|
|
229
|
+
JO: "JO"
|
|
230
|
+
// Kazakhstan
|
|
231
|
+
KZ: "KZ"
|
|
232
|
+
// Kenya
|
|
233
|
+
KE: ""
|
|
234
|
+
// Kiribati
|
|
235
|
+
KI: "KI"
|
|
236
|
+
// Korea(the Democratic People's Republic of)
|
|
237
|
+
KP: "KP"
|
|
238
|
+
// Korea(the Republic of)
|
|
239
|
+
KR: "KR"
|
|
240
|
+
// Kuwait
|
|
241
|
+
KW: "KW"
|
|
242
|
+
// Kyrgyzstan
|
|
243
|
+
KG: "KG"
|
|
244
|
+
// Lao People's Democratic Republic (the)
|
|
245
|
+
LA: "LA"
|
|
246
|
+
// Latvia
|
|
247
|
+
LV: "LV"
|
|
248
|
+
// Lebanon
|
|
249
|
+
LB: "LB"
|
|
250
|
+
// Lesotho
|
|
251
|
+
LS: "LS"
|
|
252
|
+
// Liberia
|
|
253
|
+
LR: "LR"
|
|
254
|
+
// Libya
|
|
255
|
+
LY: "LY"
|
|
256
|
+
// Liechtenstein
|
|
257
|
+
LI: "LI"
|
|
258
|
+
// Lithuania
|
|
259
|
+
LT: "LT"
|
|
260
|
+
// Luxembourg
|
|
261
|
+
LU: "LU"
|
|
262
|
+
// Macao
|
|
263
|
+
MO: "MO"
|
|
264
|
+
// Madagascar
|
|
265
|
+
MG: "MG"
|
|
266
|
+
// Malawi
|
|
267
|
+
MW: "MW"
|
|
268
|
+
// Malaysia
|
|
269
|
+
MY: "MY"
|
|
270
|
+
// Maldives
|
|
271
|
+
MV: "MV"
|
|
272
|
+
// Mali
|
|
273
|
+
ML: "ML"
|
|
274
|
+
// Malta
|
|
275
|
+
MT: "MT"
|
|
276
|
+
// Marshall Islands(the)
|
|
277
|
+
MH: "MH"
|
|
278
|
+
// Martinique
|
|
279
|
+
MQ: "MQ"
|
|
280
|
+
// Mauritania
|
|
281
|
+
MR: "MR"
|
|
282
|
+
// Mauritius
|
|
283
|
+
MU: "MU"
|
|
284
|
+
// Mayotte
|
|
285
|
+
YT: "YT"
|
|
286
|
+
// Mexico
|
|
287
|
+
MX: "MX"
|
|
288
|
+
// Micronesia(Federated States of)
|
|
289
|
+
FM: "FM"
|
|
290
|
+
// Moldova(the Republic of)
|
|
291
|
+
MD: "MD"
|
|
292
|
+
// Monaco
|
|
293
|
+
MC: "MC"
|
|
294
|
+
// Mongolia
|
|
295
|
+
MN: "MN"
|
|
296
|
+
// Montenegro
|
|
297
|
+
ME: "ME"
|
|
298
|
+
// Montserrat
|
|
299
|
+
MS: "MS"
|
|
300
|
+
// Morocco
|
|
301
|
+
MA: "MA"
|
|
302
|
+
// Mozambique
|
|
303
|
+
MZ: "MZ"
|
|
304
|
+
// Myanmar
|
|
305
|
+
MM: "MM"
|
|
306
|
+
// Namibia
|
|
307
|
+
NA: "NA"
|
|
308
|
+
// Nauru
|
|
309
|
+
NR: "NR"
|
|
310
|
+
// Nepal
|
|
311
|
+
NP: "NP"
|
|
312
|
+
// Netherlands(the)
|
|
313
|
+
NL: "NL"
|
|
314
|
+
// New Caledonia
|
|
315
|
+
NC: "NC"
|
|
316
|
+
// New Zealand
|
|
317
|
+
NZ: "NZ"
|
|
318
|
+
// Nicaragua
|
|
319
|
+
NI: "NI"
|
|
320
|
+
// Niger(the)
|
|
321
|
+
NE: "NE"
|
|
322
|
+
// Nigeria
|
|
323
|
+
NG: "NG"
|
|
324
|
+
// Niue
|
|
325
|
+
NU: "NU"
|
|
326
|
+
// Norfolk Island
|
|
327
|
+
NF: "NF"
|
|
328
|
+
// Northern Mariana Islands(the)
|
|
329
|
+
MP: "MP"
|
|
330
|
+
// Norway
|
|
331
|
+
NO: "NO"
|
|
332
|
+
// Oman
|
|
333
|
+
OM: "OM"
|
|
334
|
+
// Pakistan
|
|
335
|
+
PK: "PK"
|
|
336
|
+
// Palau
|
|
337
|
+
PW: "PW"
|
|
338
|
+
// Palestine, State of
|
|
339
|
+
PS: "PS"
|
|
340
|
+
// Panama
|
|
341
|
+
PA: "PA"
|
|
342
|
+
// Papua New Guinea
|
|
343
|
+
PG: "PG"
|
|
344
|
+
// Paraguay
|
|
345
|
+
PY: "PY"
|
|
346
|
+
// Peru
|
|
347
|
+
PE: "PE"
|
|
348
|
+
// Philippines(the)
|
|
349
|
+
PH: "PH"
|
|
350
|
+
// Pitcairn
|
|
351
|
+
PN: "PN"
|
|
352
|
+
// Poland
|
|
353
|
+
PL: "PL"
|
|
354
|
+
// Portugal
|
|
355
|
+
PT: "PT"
|
|
356
|
+
|
|
357
|
+
// Puerto Rico
|
|
358
|
+
PR: "PR"
|
|
359
|
+
// Qatar
|
|
360
|
+
QA: "QA"
|
|
361
|
+
// Republic of North Macedonia
|
|
362
|
+
MK: "MK"
|
|
363
|
+
// Romania
|
|
364
|
+
RO: "RO"
|
|
365
|
+
// Russian Federation(the)
|
|
366
|
+
RU: "RU"
|
|
367
|
+
// Rwanda
|
|
368
|
+
RW: "RW"
|
|
369
|
+
// Réunion
|
|
370
|
+
RE: "RE"
|
|
371
|
+
// Saint Barthélemy
|
|
372
|
+
BL: "BL"
|
|
373
|
+
// Saint Helena, Ascension and Tristan da Cunha
|
|
374
|
+
SH: "SH"
|
|
375
|
+
// Saint Kitts and Nevis
|
|
376
|
+
KN: "KN"
|
|
377
|
+
// Saint Lucia
|
|
378
|
+
LC: "LC"
|
|
379
|
+
// Saint Martin(French part)
|
|
380
|
+
MF: "MF"
|
|
381
|
+
// Saint Pierre and Miquelon
|
|
382
|
+
PM: "PM"
|
|
383
|
+
// Saint Vincent and the Grenadines
|
|
384
|
+
VC: "VC"
|
|
385
|
+
// Samoa
|
|
386
|
+
WS: "WS"
|
|
387
|
+
// San Marino
|
|
388
|
+
SM: "SM"
|
|
389
|
+
// Sao Tome and Principe
|
|
390
|
+
ST: "ST"
|
|
391
|
+
// Saudi Arabia
|
|
392
|
+
SA: "SA"
|
|
393
|
+
// Senegal
|
|
394
|
+
SN: "SN"
|
|
395
|
+
// Serbia
|
|
396
|
+
RS: "RS"
|
|
397
|
+
// Seychelles
|
|
398
|
+
SC: "SC"
|
|
399
|
+
// Sierra Leone
|
|
400
|
+
SL: "SL"
|
|
401
|
+
// Singapore
|
|
402
|
+
SG: "SG"
|
|
403
|
+
// Sint Maarten(Dutch part)
|
|
404
|
+
SX: "SX"
|
|
405
|
+
// Slovakia
|
|
406
|
+
SK: "SK"
|
|
407
|
+
// Slovenia
|
|
408
|
+
SI: "SI"
|
|
409
|
+
// Solomon Islands
|
|
410
|
+
SB: "SB"
|
|
411
|
+
// Somalia
|
|
412
|
+
SO: "SO"
|
|
413
|
+
// South Africa
|
|
414
|
+
ZA: "ZA"
|
|
415
|
+
// South Georgia and the South Sandwich Islands
|
|
416
|
+
GS: "GS"
|
|
417
|
+
// South Sudan
|
|
418
|
+
SS: "SS"
|
|
419
|
+
// Spain
|
|
420
|
+
ES: "ES"
|
|
421
|
+
// Sri Lanka
|
|
422
|
+
LK: "LK"
|
|
423
|
+
// Sudan(the)
|
|
424
|
+
SD: "SD"
|
|
425
|
+
// Suriname
|
|
426
|
+
SR: "SR"
|
|
427
|
+
// Svalbard and Jan Mayen
|
|
428
|
+
SJ: "SJ"
|
|
429
|
+
// Sweden
|
|
430
|
+
SE: ""
|
|
431
|
+
// Switzerland
|
|
432
|
+
CH: "CH"
|
|
433
|
+
// Syrian Arab Republic
|
|
434
|
+
SY: "SY"
|
|
435
|
+
// Taiwan(Province of China)
|
|
436
|
+
TW: "TW"
|
|
437
|
+
// Tajikistan
|
|
438
|
+
TJ: "TJ"
|
|
439
|
+
// Tanzania, United Republic of
|
|
440
|
+
TZ: "TZ"
|
|
441
|
+
// Thailand
|
|
442
|
+
TH: "TH"
|
|
443
|
+
// Timor - Leste
|
|
444
|
+
TL: "TL"
|
|
445
|
+
// Togo
|
|
446
|
+
TG: "TG"
|
|
447
|
+
// Tokelau
|
|
448
|
+
TK: "TK"
|
|
449
|
+
// Tonga
|
|
450
|
+
TO: "TO"
|
|
451
|
+
// Trinidad and Tobago
|
|
452
|
+
TT: "TT"
|
|
453
|
+
// Tunisia
|
|
454
|
+
TN: "TN"
|
|
455
|
+
// Turkey
|
|
456
|
+
TR: "TR"
|
|
457
|
+
// Turkmenistan
|
|
458
|
+
TM: "TM"
|
|
459
|
+
// Turks and Caicos Islands(the)
|
|
460
|
+
TC: "TC"
|
|
461
|
+
// Tuvalu
|
|
462
|
+
TV: "TV"
|
|
463
|
+
// Uganda
|
|
464
|
+
UG: "UG"
|
|
465
|
+
// Ukraine
|
|
466
|
+
UA: "UA"
|
|
467
|
+
// United Arab Emirates(the)
|
|
468
|
+
AE: "AE"
|
|
469
|
+
// United Kingdom of Great Britain and Northern Ireland(the)
|
|
470
|
+
GB: "GB"
|
|
471
|
+
// United States Minor Outlying Islands(the)
|
|
472
|
+
UM: "UM"
|
|
473
|
+
// United States of America(the)
|
|
474
|
+
US: "US"
|
|
475
|
+
// Uruguay
|
|
476
|
+
UY: "UY"
|
|
477
|
+
// Uzbekistan
|
|
478
|
+
UZ: "UZ"
|
|
479
|
+
// Vanuatu
|
|
480
|
+
VU: "VU"
|
|
481
|
+
// Venezuela(Bolivarian Republic of)
|
|
482
|
+
VE: "VE"
|
|
483
|
+
// Viet Nam
|
|
484
|
+
VN: "VN"
|
|
485
|
+
// Virgin Islands(British)
|
|
486
|
+
VG: "VG"
|
|
487
|
+
// Virgin Islands(U.S.)
|
|
488
|
+
VI: "VI"
|
|
489
|
+
// Wallis and Futuna
|
|
490
|
+
WF: "WF"
|
|
491
|
+
// Western Sahara
|
|
492
|
+
EH: "EH"
|
|
493
|
+
// Yemen
|
|
494
|
+
YE: "YE"
|
|
495
|
+
// Zambia
|
|
496
|
+
ZM: "ZM"
|
|
497
|
+
// Zimbabwe
|
|
498
|
+
ZW: "ZW"
|
|
499
|
+
// Åland Islands
|
|
500
|
+
AX: "AX"
|
|
501
|
+
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import type {
|
|
2
|
+
CountryCodes
|
|
3
|
+
} from "./countryisCodes"
|
|
2
4
|
|
|
3
5
|
|
|
4
6
|
export type CreateTransactionResponseType = {
|
|
@@ -7,6 +9,19 @@ export type CreateTransactionResponseType = {
|
|
|
7
9
|
redirectURL: string
|
|
8
10
|
}
|
|
9
11
|
|
|
12
|
+
|
|
13
|
+
export type ConfigType = {
|
|
14
|
+
shopperResultURL: string
|
|
15
|
+
/**
|
|
16
|
+
* required for apple pay
|
|
17
|
+
*/
|
|
18
|
+
countryCode?: keyof CountryCodes
|
|
19
|
+
/**
|
|
20
|
+
* required for apple pay
|
|
21
|
+
*/
|
|
22
|
+
merchantIdentifier?: string
|
|
23
|
+
}
|
|
24
|
+
|
|
10
25
|
export type CreateTransactionParams = {
|
|
11
26
|
paymentBrand: string,
|
|
12
27
|
holderName: string,
|
|
@@ -22,3 +37,8 @@ export declare function
|
|
|
22
37
|
createPaymentTransaction(params: CreateTransactionParams):
|
|
23
38
|
Promise<CreateTransactionResponseType>;
|
|
24
39
|
|
|
40
|
+
|
|
41
|
+
export declare function setConfig(params: ConfigType): ConfigType
|
|
42
|
+
|
|
43
|
+
export declare function applePay(checkoutID: string): Promise<any>;
|
|
44
|
+
|
package/package.json
CHANGED
package/src/index.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NativeModules, Platform } from 'react-native';
|
|
2
|
-
import { CreateTransactionResponseType, CreateTransactionParams } from '../lib/typescript'
|
|
2
|
+
import type { CreateTransactionResponseType, CreateTransactionParams, ConfigType } from '../lib/typescript'
|
|
3
3
|
const LINKING_ERROR =
|
|
4
4
|
`The package 'react-native-hyperpay' doesn't seem to be linked. Make sure: \n\n` +
|
|
5
5
|
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
@@ -17,10 +17,16 @@ const HyperPay = NativeModules.HyperPay
|
|
|
17
17
|
}
|
|
18
18
|
);
|
|
19
19
|
|
|
20
|
-
export function multiply(a: number, b: number): Promise<number> {
|
|
21
|
-
return HyperPay.multiply(a, b);
|
|
22
|
-
}
|
|
23
20
|
|
|
24
21
|
export function createPaymentTransaction(params: CreateTransactionParams): Promise<CreateTransactionResponseType> {
|
|
25
22
|
return HyperPay.createPaymentTransaction(params);
|
|
26
23
|
}
|
|
24
|
+
|
|
25
|
+
export function setConfig(params: ConfigType): ConfigType {
|
|
26
|
+
return HyperPay.setConfig(params);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
export function applePay(checkoutID: string): Promise<any> {
|
|
31
|
+
return HyperPay.applePay(checkoutID);
|
|
32
|
+
}
|