react-native-hyperpay-sdk 0.22.0 → 0.23.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/ios/HyperPay.m CHANGED
@@ -10,7 +10,7 @@ NSString *shopperResultURL = @"";
10
10
  NSString *merchantIdentifier = @"";
11
11
  NSString *countryCode = @"";
12
12
  NSString *mode=@"TestMode";
13
-
13
+ NSArray *supportedNetworks;
14
14
  RCT_EXPORT_MODULE(HyperPay)
15
15
 
16
16
  -(instancetype)init
@@ -32,12 +32,14 @@ RCT_EXPORT_MODULE(HyperPay)
32
32
  */
33
33
 
34
34
 
35
- RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(setConfig: (NSDictionary*)options) {
35
+ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(setup: (NSDictionary*)options) {
36
36
  shopperResultURL=[options valueForKey:@"shopperResultURL"];
37
37
  if ([options valueForKey:@"merchantIdentifier"])
38
38
  merchantIdentifier=[options valueForKey:@"merchantIdentifier"];
39
39
  if ([options valueForKey:@"countryCode"])
40
40
  countryCode=[options valueForKey:@"countryCode"];
41
+ if ([options valueForKey:@"supportedNetworks"])
42
+ supportedNetworks=[options valueForKey:@"supportedNetworks"];
41
43
  if ([[options valueForKey:@"mode"] isEqual:@"LiveMode"])
42
44
  provider = [OPPPaymentProvider paymentProviderWithMode:OPPProviderModeLive];
43
45
  else
@@ -98,7 +100,7 @@ RCT_EXPORT_METHOD(applePay:(NSString*)checkoutID resolver:(RCTPromiseResolveBloc
98
100
 
99
101
  OPPCheckoutSettings *checkoutSettings = [[OPPCheckoutSettings alloc] init];
100
102
  PKPaymentRequest *paymentRequest = [OPPPaymentProvider paymentRequestWithMerchantIdentifier:merchantIdentifier countryCode:countryCode];
101
- paymentRequest.supportedNetworks = @ [PKPaymentNetworkMada,PKPaymentNetworkVisa,PKPaymentNetworkMasterCard];
103
+ paymentRequest.supportedNetworks = supportedNetworks;
102
104
  checkoutSettings.shopperResultURL=shopperResultURL;
103
105
  checkoutSettings.applePayPaymentRequest = paymentRequest;
104
106
  OPPCheckoutProvider *checkoutProvider = [OPPCheckoutProvider checkoutProviderWithPaymentProvider:provider
@@ -115,16 +117,7 @@ RCT_EXPORT_METHOD(applePay:(NSString*)checkoutID resolver:(RCTPromiseResolveBloc
115
117
  // reject(@"applePay",checkoutID,error);
116
118
  reject(@"applePay",error.localizedDescription, error);
117
119
  // See code attribute (OPPErrorCode) and NSLocalizedDescription to identify the reason of failure.
118
- } else {
119
- if (transaction.redirectURL) {
120
- resolve(transaction.redirectURL);
121
- // Shopper was redirected to the issuer web page.
122
- // Request payment status when shopper returns to the app using transaction.resourcePath or just checkout id.
123
- } else {
124
- resolve(transaction.resourcePath);
125
- // Request payment status for the synchronous transaction from your server using transactionPath.resourcePath or just checkout id.
126
- }
127
- }
120
+ } else {resolve(transaction); }
128
121
  } cancelHandler:^{
129
122
  reject(@"applePay",@"Executed if the shopper closes the payment page prematurely.",NULL);
130
123
  // Executed if the shopper closes the payment page prematurely.
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.HyperPay = { init, createPaymentTransaction, applePay };
7
+
8
+ var _reactNative = require("react-native");
9
+
10
+ const LINKING_ERROR = `The package 'react-native-hyperpay-sdk' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
11
+ ios: "- You have run 'pod install'\n",
12
+ default: ''
13
+ }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo managed workflow\n';
14
+ const HyperPaySDK = _reactNative.NativeModules.HyperpaySdk ? _reactNative.NativeModules.HyperpaySdk : new Proxy({}, {
15
+ get() {
16
+ throw new Error(LINKING_ERROR);
17
+ }
18
+
19
+ });
20
+
21
+ function init(params) {
22
+ return HyperPaySDK.setup(params);
23
+ }
24
+
25
+ function createPaymentTransaction(params) {
26
+ return HyperPaySDK.createPaymentTransaction(params);
27
+ }
28
+
29
+ function applePay(checkoutID) {
30
+ return HyperPaySDK.applePay(checkoutID)
31
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"names":["LINKING_ERROR","Platform","select","ios","default","HyperpaySdk","NativeModules","Proxy","get","Error","multiply","a","b"],"sources":["index.tsx"],"sourcesContent":["import { NativeModules, Platform } from 'react-native';\n\nconst LINKING_ERROR =\n `The package 'react-native-hyperpay-sdk' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst HyperpaySdk = NativeModules.HyperpaySdk ? NativeModules.HyperpaySdk : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nexport function multiply(a: number, b: number): Promise<number> {\n return HyperpaySdk.multiply(a, b);\n}\n"],"mappings":";;;;;;;AAAA;;AAEA,MAAMA,aAAa,GAChB,oFAAD,GACAC,qBAAA,CAASC,MAAT,CAAgB;EAAEC,GAAG,EAAE,gCAAP;EAAyCC,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJF;AAMA,MAAMC,WAAW,GAAGC,0BAAA,CAAcD,WAAd,GAA6BC,0BAAA,CAAcD,WAA3C,GAA0D,IAAIE,KAAJ,CACxE,EADwE,EAExE;EACEC,GAAG,GAAG;IACJ,MAAM,IAAIC,KAAJ,CAAUT,aAAV,CAAN;EACD;;AAHH,CAFwE,CAA9E;;AASO,SAASU,QAAT,CAAkBC,CAAlB,EAA6BC,CAA7B,EAAyD;EAC9D,OAAOP,WAAW,CAACK,QAAZ,CAAqBC,CAArB,EAAwBC,CAAxB,CAAP;AACD"}
@@ -0,0 +1,39 @@
1
+ import { NativeModules, Platform } from 'react-native';
2
+ import { getPaymentStatus } from './paymentStatus'
3
+
4
+ const LINKING_ERROR =
5
+ `The package 'react-native-hyperpay-sdk' doesn't seem to be linked. Make sure: \n\n` +
6
+ Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
7
+ '- You rebuilt the app after installing the package\n' +
8
+ '- You are not using Expo managed workflow\n';
9
+
10
+ const HyperPaySDK = NativeModules.HyperPay
11
+ ? NativeModules.HyperPay
12
+ : new Proxy(
13
+ {},
14
+ {
15
+ get() {
16
+ throw new Error(LINKING_ERROR);
17
+ },
18
+ }
19
+ );
20
+ export function init(params) {
21
+ return HyperPaySDK.setup(params);
22
+ }
23
+
24
+ export function createPaymentTransaction(params) {
25
+ return HyperPaySDK.createPaymentTransaction(params);
26
+ }
27
+
28
+ export function applePay(checkoutID) {
29
+ return HyperPaySDK.applePay(checkoutID);
30
+ }
31
+
32
+ const Hyperpay = {
33
+ init,
34
+ applePay,
35
+ createPaymentTransaction,
36
+ getPaymentStatus
37
+ }
38
+
39
+ export default Hyperpay
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","HyperpaySdk","Proxy","get","Error","multiply","a","b"],"sources":["index.tsx"],"sourcesContent":["import { NativeModules, Platform } from 'react-native';\n\nconst LINKING_ERROR =\n `The package 'react-native-hyperpay-sdk' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst HyperpaySdk = NativeModules.HyperpaySdk ? NativeModules.HyperpaySdk : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nexport function multiply(a: number, b: number): Promise<number> {\n return HyperpaySdk.multiply(a, b);\n}\n"],"mappings":"AAAA,SAASA,aAAT,EAAwBC,QAAxB,QAAwC,cAAxC;AAEA,MAAMC,aAAa,GAChB,oFAAD,GACAD,QAAQ,CAACE,MAAT,CAAgB;EAAEC,GAAG,EAAE,gCAAP;EAAyCC,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJF;AAMA,MAAMC,WAAW,GAAGN,aAAa,CAACM,WAAd,GAA6BN,aAAa,CAACM,WAA3C,GAA0D,IAAIC,KAAJ,CACxE,EADwE,EAExE;EACEC,GAAG,GAAG;IACJ,MAAM,IAAIC,KAAJ,CAAUP,aAAV,CAAN;EACD;;AAHH,CAFwE,CAA9E;AASA,OAAO,SAASQ,QAAT,CAAkBC,CAAlB,EAA6BC,CAA7B,EAAyD;EAC9D,OAAON,WAAW,CAACI,QAAZ,CAAqBC,CAArB,EAAwBC,CAAxB,CAAP;AACD"}
@@ -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
+ }
@@ -0,0 +1,35 @@
1
+
2
+
3
+ export type PaymentStatus = {
4
+ code: string,
5
+ description: string,
6
+ status: 'successfully' | 'rejected' | 'Chargeback' | 'pending' | 'error'
7
+ }
8
+
9
+ export type PaymentStatusesGroups = 'successfully' |
10
+ 'manuallyReviewed' |
11
+ 'pending' |
12
+ 'rejection3DsecureAndIntercardRiskChecks' |
13
+ 'rejectionsByTheExternalBank' |
14
+ 'rejectionsDueToCommunicationErrors' |
15
+ 'rejectionsDueToSystemErrors' |
16
+ 'rejectionsDueToErrorInAsynchonousWorkflow' |
17
+ 'softDeclines' |
18
+ 'rejectionsDueToChecksByExternalRiskSystems' |
19
+ 'rejectionsDueToAddressValidation' |
20
+ 'rejectionsDueTo3Dsecure' |
21
+ 'rejectionsDueToBlacklistValidation' |
22
+ 'rejectionsDueToRiskValidation' |
23
+ 'rejectionsDueToConfigurationValidation' |
24
+ 'rejectionsDueToRegistrationValidation' |
25
+ 'rejectionsDueToJobValidation' |
26
+ 'rejectionsDueToReferenceValidation' |
27
+ 'rejectionsDueToFormatValidation' |
28
+ 'rejectionsDueToAddressValidation' |
29
+ 'rejectionsDueToContactValidation' |
30
+ 'rejectionsDueToAccountValidation' |
31
+ 'rejectionsDueToAmountValidation' |
32
+ 'rejectionsDueToRiskManagement' |
33
+ 'chargebackRelatedResultCodes'
34
+
35
+
@@ -0,0 +1,29 @@
1
+
2
+ export type SupportedNetworks =
3
+ "mada" |
4
+ "Visa" |
5
+ "JCB" |
6
+ "Elo" |
7
+ "Mir" |
8
+ "Suica" |
9
+ "MasterCard" |
10
+ "iD" |
11
+ "CarteBancaires" |
12
+ "ChinaUnionPay" |
13
+ "AmEx" |
14
+ "WAON" |
15
+ "VPay" |
16
+ "Eftpos" |
17
+ "nanaco" |
18
+ "Barcode" |
19
+ "Dankort" |
20
+ "Interac" |
21
+ "Maestro" |
22
+ "Discover" |
23
+ "Electron" |
24
+ "girocard" |
25
+ "QUICPay" |
26
+ "PrivateLabel" |
27
+ "CartesBancaires" |
28
+ "CarteBancaire"
29
+
@@ -0,0 +1,93 @@
1
+ import type { CountryCodes } from './CountryCodes';
2
+ import { PaymentStatus } from './PaymentStatus';
3
+ import type { SupportedNetworks } from './SupportedNetworks';
4
+ export type CreateTransactionResponseType = {
5
+ status: 'pending' | 'rejected' | 'risk' | 'chargeback' | 'declines' | 'successfully',
6
+ checkoutId: string,
7
+ redirectURL: string
8
+ }
9
+ export interface Config {
10
+ shopperResultURL: string;
11
+ /**
12
+ * required for apple pay
13
+ */
14
+ countryCode?: keyof CountryCodes;
15
+ /**
16
+ * required for apple pay
17
+ */
18
+ merchantIdentifier?: string;
19
+
20
+ mode?: "TestMode" | "LiveMode";
21
+
22
+ /**
23
+ * set up supported payment networks for apple pay
24
+ * @Platform IOS Only
25
+ */
26
+ supportedNetworks?: Array<SupportedNetworks>
27
+
28
+ }
29
+
30
+ export type CreateTransactionParams = {
31
+ paymentBrand: string,
32
+ holderName: string,
33
+ cardNumber: string,
34
+ expiryYear: string,
35
+ expiryMonth: string,
36
+ cvv: string,
37
+ checkoutID: string,
38
+ shopperResultURL?: string,
39
+ }
40
+ export type ApplePayCallback = {
41
+ /** Shopper was redirected to the issuer web page.
42
+ Request payment status when shopper returns to the app using transaction.resourcePath or just checkout id.
43
+ */
44
+ redirectURL?: string;
45
+ /** Request payment status for the synchronous transaction from your server using transactionPath.resourcePath or just checkout id.*/
46
+ resourcePath?: string;
47
+ }
48
+ export default class HyperPay {
49
+ /**
50
+ * @param {string} shopperResultURL
51
+ * @param {CountryCodes} countryCode
52
+ * @param {string} merchantIdentifier
53
+ * @param {string} mode
54
+ * @param {SupportedNetworks[]} supportedNetworks
55
+ * @returns Config
56
+ */
57
+
58
+ static init(params: Config): Config
59
+
60
+ /**
61
+ * @param {string} checkoutID
62
+ * @returns ```Promise<{ redirectURL?: string,
63
+ resourcePath?: string}>```
64
+ */
65
+ static applePay(checkoutID: string): Promise<ApplePayCallback>;
66
+
67
+ /**
68
+ * @param {string} paymentBrand
69
+ * @param {string} holderName
70
+ * @param {string} cardNumber
71
+ * @param {string} expiryYear
72
+ * @param {string} expiryMonth
73
+ * @param {string} cvv
74
+ * @param {string} checkoutID
75
+ * @param {string} shopperResultURL
76
+ *
77
+ * @returns ```Promise<{ status: 'pending' | 'rejected' | 'risk' | 'chargeback' | 'declines' | 'successfully',
78
+ checkoutId: string,
79
+ redirectURL: string }>```
80
+ */
81
+
82
+ static createPaymentTransaction(params: CreateTransactionParams): Promise<CreateTransactionResponseType>;
83
+
84
+ /**
85
+ * @param {string} statusCode
86
+ * @returns```{ code: string, description: string, status: 'successfully' |
87
+ * 'rejected' | 'Chargeback' | 'pending' | 'error' }```
88
+ */
89
+
90
+ static getPaymentStatus(status: string): PaymentStatus
91
+
92
+ }
93
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-hyperpay-sdk",
3
- "version": "0.22.0",
3
+ "version": "0.23.0",
4
4
  "description": "hyperpay",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
package/src/index.tsx CHANGED
@@ -5,20 +5,19 @@ import {
5
5
  import type {
6
6
  CreateTransactionResponseType,
7
7
  CreateTransactionParams,
8
- ConfigType
8
+ Config,
9
9
  } from '../lib/typescript'
10
10
  import {
11
11
  getPaymentStatus
12
12
  } from './paymentStatus'
13
-
14
-
13
+ import type { ApplePayCallback } from '../'
15
14
  const LINKING_ERROR =
16
15
  `The package 'react-native-hyperpay-sdk' doesn't seem to be linked. Make sure: \n\n` +
17
16
  Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
18
17
  '- You rebuilt the app after installing the package\n' +
19
18
  '- You are not using Expo managed workflow\n';
20
19
 
21
- const HyperPay = NativeModules.HyperPay
20
+ const HyperPaySDK = NativeModules.HyperPay
22
21
  ? NativeModules.HyperPay
23
22
  : new Proxy(
24
23
  {},
@@ -28,25 +27,26 @@ const HyperPay = NativeModules.HyperPay
28
27
  },
29
28
  }
30
29
  );
31
-
30
+ export function init(params: Config): Config {
31
+ return HyperPaySDK.setup(params);
32
+ }
32
33
 
33
34
  export function createPaymentTransaction(params: CreateTransactionParams):
34
35
  Promise<CreateTransactionResponseType> {
35
- return HyperPay.createPaymentTransaction(params);
36
+ return HyperPaySDK.createPaymentTransaction(params);
36
37
  }
37
38
 
38
- export function setConfig(params: ConfigType): ConfigType {
39
- return HyperPay.setConfig(params);
40
- }
41
39
 
42
- export function applePay(checkoutID: string): Promise<any> {
43
- return HyperPay.applePay(checkoutID);
40
+ export function applePay(checkoutID: string): Promise<ApplePayCallback> {
41
+ return HyperPaySDK.applePay(checkoutID);
44
42
  }
45
43
 
46
- const hyperpay = {
44
+ const Hyperpay = {
45
+ init,
47
46
  applePay,
48
- setConfig,
49
47
  createPaymentTransaction,
50
48
  getPaymentStatus
51
49
  }
52
- export default hyperpay
50
+
51
+
52
+ export default Hyperpay