judokit-react-native 3.4.9 → 4.0.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/JudoPay.tsx +41 -26
- package/RNJudopay.podspec +1 -1
- package/android/build.gradle +113 -124
- package/android/src/main/java/com/reactlibrary/Extensions.kt +187 -5
- package/android/src/main/java/com/reactlibrary/Helpers.kt +177 -16
- package/android/src/main/java/com/reactlibrary/JudoReactNativeModule.kt +54 -1
- package/ios/.xcode.env +11 -0
- package/ios/Classes/RNJudo.m +22 -6
- package/ios/Classes/Wrappers/RNWrappers.m +448 -79
- package/ios/Podfile +28 -56
- package/ios/Podfile.lock +418 -208
- package/ios/RNJudo.xcodeproj/project.pbxproj +21 -16
- package/ios/RNJudo.xcodeproj/xcshareddata/xcschemes/RNJudo.xcscheme +1 -1
- package/package.json +31 -25
- package/types/JudoTypes.tsx +80 -23
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
#import "RNTypes.h"
|
|
29
29
|
#import "NSDictionary+JudoConvert.h"
|
|
30
30
|
#import "UIColor+RNAdditions.h"
|
|
31
|
+
#import <Judo3DS2_iOS/Judo3DS2_iOS.h>
|
|
31
32
|
|
|
32
33
|
static NSString *const kCardSchemeVISA = @"visa";
|
|
33
34
|
static NSString *const kCardSchemeMasterCard = @"mastercard";
|
|
@@ -85,15 +86,20 @@ static NSString *const kCardSchemeAMEX = @"amex";
|
|
|
85
86
|
+ (JPTransactionType)transactionTypeFromProperties:(NSDictionary *)properties {
|
|
86
87
|
int type = [properties numberForKey:@"transactionType"].intValue;
|
|
87
88
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
89
|
+
switch (type) {
|
|
90
|
+
case 1:
|
|
91
|
+
return JPTransactionTypePayment;
|
|
92
|
+
case 2:
|
|
93
|
+
return JPTransactionTypePreAuth;
|
|
94
|
+
case 3:
|
|
95
|
+
return JPTransactionTypeRegisterCard;
|
|
96
|
+
case 4:
|
|
97
|
+
return JPTransactionTypeCheckCard;
|
|
98
|
+
case 5:
|
|
99
|
+
return JPTransactionTypeSaveCard;
|
|
100
|
+
default:
|
|
101
|
+
return JPTransactionTypeUnknown;
|
|
102
|
+
}
|
|
97
103
|
}
|
|
98
104
|
|
|
99
105
|
+ (JPTransactionMode)transactionModeFromProperties:(NSDictionary *)properties {
|
|
@@ -129,6 +135,7 @@ static NSString *const kCardSchemeAMEX = @"amex";
|
|
|
129
135
|
|
|
130
136
|
NSString *judoId = [configurationDict stringForKey:@"judoId"];
|
|
131
137
|
NSNumber *isInitialRecurringPayment = [configurationDict optionalBoolForKey:@"isInitialRecurringPayment"];
|
|
138
|
+
NSNumber *isDelayedAuthorisation = [configurationDict optionalBoolForKey:@"isDelayedAuthorisation"];
|
|
132
139
|
|
|
133
140
|
JPAmount *amount = [RNWrappers amountFromConfiguration:configurationDict];
|
|
134
141
|
JPReference *reference = [RNWrappers referenceFromConfiguration:configurationDict];
|
|
@@ -137,7 +144,14 @@ static NSString *const kCardSchemeAMEX = @"amex";
|
|
|
137
144
|
amount:amount
|
|
138
145
|
reference:reference];
|
|
139
146
|
|
|
140
|
-
|
|
147
|
+
if (isInitialRecurringPayment) {
|
|
148
|
+
configuration.isInitialRecurringPayment = isInitialRecurringPayment.boolValue;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (isDelayedAuthorisation) {
|
|
152
|
+
configuration.isDelayedAuthorisation = isDelayedAuthorisation.boolValue;
|
|
153
|
+
}
|
|
154
|
+
|
|
141
155
|
configuration.uiConfiguration = [RNWrappers uiConfigurationFromConfiguration:configurationDict];
|
|
142
156
|
configuration.supportedCardNetworks = [RNWrappers cardNetworksFromConfiguration:configurationDict];
|
|
143
157
|
configuration.primaryAccountDetails = [RNWrappers accountDetailsFromConfiguration:configurationDict];
|
|
@@ -246,15 +260,15 @@ static NSString *const kCardSchemeAMEX = @"amex";
|
|
|
246
260
|
+ (JPCardNetworkType)cardTypeFromProperties:(NSDictionary *)properties {
|
|
247
261
|
NSString *cardScheme = [properties optionalStringForKey:@"cardScheme"].lowercaseString;
|
|
248
262
|
|
|
249
|
-
if ([
|
|
263
|
+
if ([cardScheme containsString:kCardSchemeVISA]) {
|
|
250
264
|
return JPCardNetworkTypeVisa;
|
|
251
265
|
}
|
|
252
266
|
|
|
253
|
-
if ([
|
|
267
|
+
if ([cardScheme containsString:kCardSchemeMasterCard]) {
|
|
254
268
|
return JPCardNetworkTypeMasterCard;
|
|
255
269
|
}
|
|
256
270
|
|
|
257
|
-
if ([
|
|
271
|
+
if ([cardScheme containsString:kCardSchemeAMEX]) {
|
|
258
272
|
return JPCardNetworkTypeAMEX;
|
|
259
273
|
}
|
|
260
274
|
|
|
@@ -342,26 +356,334 @@ static NSString *const kCardSchemeAMEX = @"amex";
|
|
|
342
356
|
return uiConfiguration;
|
|
343
357
|
}
|
|
344
358
|
|
|
345
|
-
NSNumber *isAVSEnabled = [dictionary
|
|
346
|
-
NSNumber *shouldDisplayAmount = [dictionary
|
|
347
|
-
NSNumber *isPayButtonAmountVisible = [dictionary
|
|
348
|
-
NSNumber *isSecureCodeCheckEnabled = [dictionary
|
|
359
|
+
NSNumber *isAVSEnabled = [dictionary optionalBoolForKey:@"isAVSEnabled"];
|
|
360
|
+
NSNumber *shouldDisplayAmount = [dictionary optionalBoolForKey:@"shouldPaymentMethodsDisplayAmount"];
|
|
361
|
+
NSNumber *isPayButtonAmountVisible = [dictionary optionalBoolForKey:@"shouldPaymentButtonDisplayAmount"];
|
|
362
|
+
NSNumber *isSecureCodeCheckEnabled = [dictionary optionalBoolForKey:@"shouldPaymentMethodsVerifySecurityCode"];
|
|
349
363
|
NSNumber *shouldAskForBillingInformation = [dictionary optionalBoolForKey:@"shouldAskForBillingInformation"];
|
|
350
364
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
365
|
+
if (isAVSEnabled) {
|
|
366
|
+
uiConfiguration.isAVSEnabled = isAVSEnabled.boolValue;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
if (shouldDisplayAmount) {
|
|
370
|
+
uiConfiguration.shouldPaymentMethodsDisplayAmount = shouldDisplayAmount.boolValue;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
if (isPayButtonAmountVisible) {
|
|
374
|
+
uiConfiguration.shouldPaymentButtonDisplayAmount = isPayButtonAmountVisible.boolValue;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
if (isSecureCodeCheckEnabled) {
|
|
378
|
+
uiConfiguration.shouldPaymentMethodsVerifySecurityCode = isSecureCodeCheckEnabled.boolValue;
|
|
379
|
+
}
|
|
355
380
|
|
|
356
381
|
if (shouldAskForBillingInformation) {
|
|
357
382
|
uiConfiguration.shouldAskForBillingInformation = shouldAskForBillingInformation.boolValue;
|
|
358
383
|
}
|
|
359
384
|
|
|
360
385
|
uiConfiguration.theme = [self themeFromUIConfiguration:dictionary];
|
|
386
|
+
uiConfiguration.threeDSUICustomization = [self threeDSUICustomization:dictionary];
|
|
361
387
|
|
|
362
388
|
return uiConfiguration;
|
|
363
389
|
}
|
|
364
390
|
|
|
391
|
+
+ (JP3DSUICustomization *)threeDSUICustomization:(NSDictionary *)uiCustomization {
|
|
392
|
+
NSDictionary *dictionary = [uiCustomization optionalDictionaryForKey:@"threeDSUIConfiguration"];
|
|
393
|
+
|
|
394
|
+
if (!dictionary) {
|
|
395
|
+
return nil;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
NSDictionary *buttonCustomizations = [dictionary optionalDictionaryForKey:@"buttonCustomizations"];
|
|
399
|
+
NSDictionary *toolbarCustomizations = [dictionary optionalDictionaryForKey:@"toolbarCustomization"];
|
|
400
|
+
NSDictionary *labelCustomizations = [dictionary optionalDictionaryForKey:@"labelCustomization"];
|
|
401
|
+
NSDictionary *textBoxCustomizations = [dictionary optionalDictionaryForKey:@"textBoxCustomization"];
|
|
402
|
+
|
|
403
|
+
JP3DSUICustomization *customization = [JP3DSUICustomization new];
|
|
404
|
+
|
|
405
|
+
if (buttonCustomizations) {
|
|
406
|
+
NSDictionary *submitButtonCustomization = [buttonCustomizations optionalDictionaryForKey:@"SUBMIT"];
|
|
407
|
+
NSDictionary *continueButtonCustomization = [buttonCustomizations optionalDictionaryForKey:@"CONTINUE"];
|
|
408
|
+
NSDictionary *nextButtonCustomization = [buttonCustomizations optionalDictionaryForKey:@"NEXT"];
|
|
409
|
+
NSDictionary *cancelButtonCustomization = [buttonCustomizations optionalDictionaryForKey:@"CANCEL"];
|
|
410
|
+
NSDictionary *resendButtonCustomization = [buttonCustomizations optionalDictionaryForKey:@"RESEND"];
|
|
411
|
+
|
|
412
|
+
if (submitButtonCustomization) {
|
|
413
|
+
JP3DSButtonCustomization *submitCustomization = [JP3DSButtonCustomization new];
|
|
414
|
+
|
|
415
|
+
NSString *textFontName = [submitButtonCustomization optionalStringForKey:@"textFontName"];
|
|
416
|
+
NSString *textColor = [submitButtonCustomization optionalStringForKey:@"textColor"];
|
|
417
|
+
NSString *backgroundColor = [submitButtonCustomization optionalStringForKey:@"backgroundColor"];
|
|
418
|
+
NSNumber *cornerRadius = [submitButtonCustomization optionalNumberForKey:@"cornerRadius"];
|
|
419
|
+
NSNumber *textFontSize = [submitButtonCustomization optionalNumberForKey:@"textFontSize"];
|
|
420
|
+
|
|
421
|
+
if (textFontName) {
|
|
422
|
+
[submitCustomization setTextFontName:textFontName];
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
if (textColor) {
|
|
426
|
+
[submitCustomization setTextColor:textColor];
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
if (backgroundColor) {
|
|
430
|
+
[submitCustomization setBackgroundColor:backgroundColor];
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
if (cornerRadius) {
|
|
434
|
+
[submitCustomization setCornerRadius:cornerRadius.integerValue];
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
if (textFontSize) {
|
|
438
|
+
[submitCustomization setTextFontSize:textFontSize.integerValue];
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
[customization setButtonCustomization:submitCustomization ofType:JP3DSButtonTypeSubmit];
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
if (continueButtonCustomization) {
|
|
445
|
+
JP3DSButtonCustomization *continueCustomization = [JP3DSButtonCustomization new];
|
|
446
|
+
|
|
447
|
+
NSString *textFontName = [continueButtonCustomization optionalStringForKey:@"textFontName"];
|
|
448
|
+
NSString *textColor = [continueButtonCustomization optionalStringForKey:@"textColor"];
|
|
449
|
+
NSString *backgroundColor = [continueButtonCustomization optionalStringForKey:@"backgroundColor"];
|
|
450
|
+
NSNumber *cornerRadius = [continueButtonCustomization optionalNumberForKey:@"cornerRadius"];
|
|
451
|
+
NSNumber *textFontSize = [continueButtonCustomization optionalNumberForKey:@"textFontSize"];
|
|
452
|
+
|
|
453
|
+
if (textFontName) {
|
|
454
|
+
[continueCustomization setTextFontName:textFontName];
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
if (textColor) {
|
|
458
|
+
[continueCustomization setTextColor:textColor];
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
if (backgroundColor) {
|
|
462
|
+
[continueCustomization setBackgroundColor:backgroundColor];
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
if (cornerRadius) {
|
|
466
|
+
[continueCustomization setCornerRadius:cornerRadius.integerValue];
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
if (textFontSize) {
|
|
470
|
+
[continueCustomization setTextFontSize:textFontSize.integerValue];
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
[customization setButtonCustomization:continueCustomization ofType:JP3DSButtonTypeContinue];
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
if (nextButtonCustomization) {
|
|
477
|
+
JP3DSButtonCustomization *nextCustomization = [JP3DSButtonCustomization new];
|
|
478
|
+
|
|
479
|
+
NSString *textFontName = [nextButtonCustomization optionalStringForKey:@"textFontName"];
|
|
480
|
+
NSString *textColor = [nextButtonCustomization optionalStringForKey:@"textColor"];
|
|
481
|
+
NSString *backgroundColor = [nextButtonCustomization optionalStringForKey:@"backgroundColor"];
|
|
482
|
+
NSNumber *cornerRadius = [nextButtonCustomization optionalNumberForKey:@"cornerRadius"];
|
|
483
|
+
NSNumber *textFontSize = [nextButtonCustomization optionalNumberForKey:@"textFontSize"];
|
|
484
|
+
|
|
485
|
+
if (textFontName) {
|
|
486
|
+
[nextCustomization setTextFontName:textFontName];
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
if (textColor) {
|
|
490
|
+
[nextCustomization setTextColor:textColor];
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
if (backgroundColor) {
|
|
494
|
+
[nextCustomization setBackgroundColor:backgroundColor];
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
if (cornerRadius) {
|
|
498
|
+
[nextCustomization setCornerRadius:cornerRadius.integerValue];
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
if (textFontSize) {
|
|
502
|
+
[nextCustomization setTextFontSize:textFontSize.integerValue];
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
[customization setButtonCustomization:nextCustomization ofType:JP3DSButtonTypeNext];
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
if (cancelButtonCustomization) {
|
|
509
|
+
JP3DSButtonCustomization *cancelCustomization = [JP3DSButtonCustomization new];
|
|
510
|
+
|
|
511
|
+
NSString *textFontName = [cancelButtonCustomization optionalStringForKey:@"textFontName"];
|
|
512
|
+
NSString *textColor = [cancelButtonCustomization optionalStringForKey:@"textColor"];
|
|
513
|
+
NSString *backgroundColor = [cancelButtonCustomization optionalStringForKey:@"backgroundColor"];
|
|
514
|
+
NSNumber *cornerRadius = [cancelButtonCustomization optionalNumberForKey:@"cornerRadius"];
|
|
515
|
+
NSNumber *textFontSize = [cancelButtonCustomization optionalNumberForKey:@"textFontSize"];
|
|
516
|
+
|
|
517
|
+
if (textFontName) {
|
|
518
|
+
[cancelCustomization setTextFontName:textFontName];
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
if (textColor) {
|
|
522
|
+
[cancelCustomization setTextColor:textColor];
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
if (backgroundColor) {
|
|
526
|
+
[cancelCustomization setBackgroundColor:backgroundColor];
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
if (cornerRadius) {
|
|
530
|
+
[cancelCustomization setCornerRadius:cornerRadius.integerValue];
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
if (textFontSize) {
|
|
534
|
+
[cancelCustomization setTextFontSize:textFontSize.integerValue];
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
[customization setButtonCustomization:cancelCustomization ofType:JP3DSButtonTypeCancel];
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
if (resendButtonCustomization) {
|
|
541
|
+
JP3DSButtonCustomization *resendCustomization = [JP3DSButtonCustomization new];
|
|
542
|
+
|
|
543
|
+
NSString *textFontName = [resendButtonCustomization optionalStringForKey:@"textFontName"];
|
|
544
|
+
NSString *textColor = [resendButtonCustomization optionalStringForKey:@"textColor"];
|
|
545
|
+
NSString *backgroundColor = [resendButtonCustomization optionalStringForKey:@"backgroundColor"];
|
|
546
|
+
NSNumber *cornerRadius = [resendButtonCustomization optionalNumberForKey:@"cornerRadius"];
|
|
547
|
+
NSNumber *textFontSize = [resendButtonCustomization optionalNumberForKey:@"textFontSize"];
|
|
548
|
+
|
|
549
|
+
if (textFontName) {
|
|
550
|
+
[resendCustomization setTextFontName:textFontName];
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
if (textColor) {
|
|
554
|
+
[resendCustomization setTextColor:textColor];
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
if (backgroundColor) {
|
|
558
|
+
[resendCustomization setBackgroundColor:backgroundColor];
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
if (cornerRadius) {
|
|
562
|
+
[resendCustomization setCornerRadius:cornerRadius.integerValue];
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
if (textFontSize) {
|
|
566
|
+
[resendCustomization setTextFontSize:textFontSize.integerValue];
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
[customization setButtonCustomization:resendCustomization ofType:JP3DSButtonTypeResend];
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
if (labelCustomizations) {
|
|
574
|
+
JP3DSLabelCustomization *labelCustomization = [JP3DSLabelCustomization new];
|
|
575
|
+
|
|
576
|
+
NSString *textFontName = [labelCustomizations optionalStringForKey:@"textFontName"];
|
|
577
|
+
NSString *textColor = [labelCustomizations optionalStringForKey:@"textColor"];
|
|
578
|
+
NSString *headingTextFontName = [labelCustomizations optionalStringForKey:@"headingTextFontName"];
|
|
579
|
+
NSString *headingTextColor = [labelCustomizations optionalStringForKey:@"headingTextColor"];
|
|
580
|
+
NSNumber *headingTextFontSize = [labelCustomizations optionalNumberForKey:@"headingTextFontSize"];
|
|
581
|
+
NSNumber *textFontSize = [labelCustomizations optionalNumberForKey:@"textFontSize"];
|
|
582
|
+
|
|
583
|
+
if (textFontName) {
|
|
584
|
+
[labelCustomization setTextFontName:textFontName];
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
if (textColor) {
|
|
588
|
+
[labelCustomization setTextColor:textColor];
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
if (headingTextFontName) {
|
|
592
|
+
[labelCustomization setHeadingTextFontName:headingTextFontName];
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
if (headingTextColor) {
|
|
596
|
+
[labelCustomization setHeadingTextColor:headingTextColor];
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
if (headingTextFontSize) {
|
|
600
|
+
[labelCustomization setHeadingTextFontSize:headingTextFontSize.integerValue];
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
if (textFontSize) {
|
|
604
|
+
[labelCustomization setTextFontSize:textFontSize.integerValue];
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
[customization setLabelCustomization:labelCustomization];
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
if (toolbarCustomizations) {
|
|
611
|
+
JP3DSToolbarCustomization *toolbarCustomization = [JP3DSToolbarCustomization new];
|
|
612
|
+
|
|
613
|
+
NSNumber *textFontSize = [toolbarCustomizations optionalNumberForKey:@"textFontSize"];
|
|
614
|
+
NSString *textFontName = [toolbarCustomizations optionalStringForKey:@"textFontName"];
|
|
615
|
+
NSString *textColor = [toolbarCustomizations optionalStringForKey:@"textColor"];
|
|
616
|
+
NSString *backgroundColor = [toolbarCustomizations optionalStringForKey:@"backgroundColor"];
|
|
617
|
+
NSString *headerText = [toolbarCustomizations optionalStringForKey:@"headerText"];
|
|
618
|
+
NSString *buttonText = [toolbarCustomizations optionalStringForKey:@"buttonText"];
|
|
619
|
+
|
|
620
|
+
if (textFontName) {
|
|
621
|
+
[toolbarCustomization setTextFontName:textFontName];
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
if (textColor) {
|
|
625
|
+
[toolbarCustomization setTextColor:textColor];
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
if (backgroundColor) {
|
|
629
|
+
[toolbarCustomization setBackgroundColor:backgroundColor];
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
if (headerText) {
|
|
633
|
+
[toolbarCustomization setHeaderText:headerText];
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
if (buttonText) {
|
|
637
|
+
[toolbarCustomization setButtonText:buttonText];
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
if (textFontSize) {
|
|
641
|
+
[toolbarCustomization setTextFontSize:textFontSize.integerValue];
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
[customization setToolbarCustomization:toolbarCustomization];
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
if (textBoxCustomizations) {
|
|
648
|
+
JP3DSTextBoxCustomization *textBoxCustomization = [JP3DSTextBoxCustomization new];
|
|
649
|
+
|
|
650
|
+
NSString *textFontName = [textBoxCustomizations optionalStringForKey:@"textFontName"];
|
|
651
|
+
NSString *textColor = [textBoxCustomizations optionalStringForKey:@"textColor"];
|
|
652
|
+
NSString *borderColor = [textBoxCustomizations optionalStringForKey:@"borderColor"];
|
|
653
|
+
NSNumber *borderWidth = [textBoxCustomizations optionalNumberForKey:@"borderWidth"];
|
|
654
|
+
NSNumber *cornerRadius = [textBoxCustomizations optionalNumberForKey:@"cornerRadius"];
|
|
655
|
+
NSNumber *textFontSize = [textBoxCustomizations optionalNumberForKey:@"textFontSize"];
|
|
656
|
+
|
|
657
|
+
if (textFontName) {
|
|
658
|
+
[textBoxCustomization setTextFontName:textFontName];
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
if (textColor) {
|
|
662
|
+
[textBoxCustomization setTextColor:textColor];
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
if (borderColor) {
|
|
666
|
+
[textBoxCustomization setBorderColor:borderColor];
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
if (borderWidth) {
|
|
670
|
+
[textBoxCustomization setBorderWidth:borderWidth.integerValue];
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
if (cornerRadius) {
|
|
674
|
+
[textBoxCustomization setCornerRadius:cornerRadius.integerValue];
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
if (textFontSize) {
|
|
678
|
+
[textBoxCustomization setTextFontSize:textFontSize.integerValue];
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
[customization setTextBoxCustomization:textBoxCustomization];
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
return customization;
|
|
685
|
+
}
|
|
686
|
+
|
|
365
687
|
+ (JPTheme *)themeFromUIConfiguration:(NSDictionary *)uiConfiguration {
|
|
366
688
|
JPTheme *theme = [JPTheme new];
|
|
367
689
|
|
|
@@ -428,73 +750,120 @@ static NSString *const kCardSchemeAMEX = @"amex";
|
|
|
428
750
|
+ (NSDictionary *)dictionaryFromResponse:(JPResponse *)response {
|
|
429
751
|
|
|
430
752
|
NSMutableDictionary *mappedResponse = [NSMutableDictionary new];
|
|
431
|
-
|
|
432
|
-
// TODO: remove this ASAP when this https://github.com/Judopay/JudoKit-ReactNative/pull/138
|
|
433
|
-
// will go to master (mimics the android wrapper behaviour: https://github.com/Judopay/JudoKit-ReactNative/blob/master/android/src/main/java/com/reactlibrary/Helpers.kt#L57)
|
|
434
|
-
NSNumber *result = @0;
|
|
435
|
-
if (response.result == JPTransactionResultDeclined) {
|
|
436
|
-
result = @1;
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
NSNumber *type = @0;
|
|
440
|
-
|
|
441
|
-
switch (response.type) {
|
|
442
|
-
case JPTransactionTypePreAuth:
|
|
443
|
-
type = @1;
|
|
444
|
-
break;
|
|
445
|
-
case JPTransactionTypeCheckCard:
|
|
446
|
-
type = @3;
|
|
447
|
-
break;
|
|
448
|
-
case JPTransactionTypeSaveCard:
|
|
449
|
-
type = @4;
|
|
450
|
-
break;
|
|
451
|
-
default:
|
|
452
|
-
break;
|
|
453
|
-
}
|
|
454
753
|
|
|
455
754
|
[mappedResponse setValue:response.receiptId forKey:@"receiptId"];
|
|
456
755
|
[mappedResponse setValue:response.paymentReference forKey:@"yourPaymentReference"];
|
|
457
|
-
[mappedResponse setValue
|
|
756
|
+
[mappedResponse setValue:@(response.type) forKey:@"type"];
|
|
458
757
|
[mappedResponse setValue:response.createdAt forKey:@"createdAt"];
|
|
459
|
-
[mappedResponse setValue
|
|
758
|
+
[mappedResponse setValue:@(response.result) forKey:@"result"];
|
|
460
759
|
[mappedResponse setValue:response.message forKey:@"message"];
|
|
461
760
|
[mappedResponse setValue:response.judoId forKey:@"judoId"];
|
|
462
761
|
[mappedResponse setValue:response.merchantName forKey:@"merchantName"];
|
|
463
762
|
[mappedResponse setValue:response.appearsOnStatementAs forKey:@"appearsOnStatementAs"];
|
|
464
763
|
[mappedResponse setValue:response.originalAmount forKey:@"originalAmount"];
|
|
465
764
|
[mappedResponse setValue:response.netAmount forKey:@"netAmount"];
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
765
|
+
|
|
766
|
+
JPAmount *amount = response.amount;
|
|
767
|
+
|
|
768
|
+
if (amount) {
|
|
769
|
+
[mappedResponse setValue:amount.amount forKey:@"amount"];
|
|
770
|
+
[mappedResponse setValue:amount.currency forKey:@"currency"];
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
JPCardDetails *cardDetails = response.cardDetails;
|
|
774
|
+
|
|
775
|
+
if (cardDetails) {
|
|
776
|
+
NSMutableDictionary *cardDetailsDictionary = [NSMutableDictionary new];
|
|
777
|
+
|
|
778
|
+
if (cardDetails.cardLastFour) {
|
|
779
|
+
cardDetailsDictionary[@"cardLastFour"] = cardDetails.cardLastFour;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
if (cardDetails.endDate) {
|
|
783
|
+
cardDetailsDictionary[@"endDate"] = cardDetails.endDate;
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
if (cardDetails.cardToken) {
|
|
787
|
+
cardDetailsDictionary[@"cardToken"] = cardDetails.cardToken;
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
cardDetailsDictionary[@"cardNetwork"] = @(cardDetails.cardNetwork);
|
|
791
|
+
|
|
792
|
+
if (cardDetails.bank) {
|
|
793
|
+
cardDetailsDictionary[@"bank"] = cardDetails.bank;
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
if (cardDetails.cardCategory) {
|
|
797
|
+
cardDetailsDictionary[@"cardCategory"] = cardDetails.cardCategory;
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
if (cardDetails.cardCountry) {
|
|
801
|
+
cardDetailsDictionary[@"cardCountry"] = cardDetails.cardCountry;
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
if (cardDetails.cardFunding) {
|
|
805
|
+
cardDetailsDictionary[@"cardFunding"] = cardDetails.cardFunding;
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
if (cardDetails.cardScheme) {
|
|
809
|
+
cardDetailsDictionary[@"cardScheme"] = cardDetails.cardScheme;
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
if (cardDetails.cardHolderName) {
|
|
813
|
+
cardDetailsDictionary[@"cardHolderName"] = cardDetails.cardHolderName;
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
[mappedResponse setValue:[NSDictionary dictionaryWithDictionary:cardDetailsDictionary]
|
|
817
|
+
forKey:@"cardDetails"];
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
JPConsumer *consumer = response.consumer;
|
|
821
|
+
|
|
822
|
+
if (consumer) {
|
|
823
|
+
NSMutableDictionary *consumerDictionary = [NSMutableDictionary new];
|
|
824
|
+
|
|
825
|
+
if (consumer.consumerToken) {
|
|
826
|
+
consumerDictionary[@"consumerToken"] = consumer.consumerToken;
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
if (consumer.consumerReference) {
|
|
830
|
+
consumerDictionary[@"consumerReference"] = consumer.consumerReference;
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
if (consumerDictionary.count > 0) {
|
|
834
|
+
[mappedResponse setValue:[NSDictionary dictionaryWithDictionary:consumerDictionary]
|
|
835
|
+
forKey:@"consumerResponse"];
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
JPOrderDetails *orderDetails = response.orderDetails;
|
|
840
|
+
|
|
841
|
+
if (orderDetails) {
|
|
842
|
+
NSMutableDictionary *orderDetailsDictionary = [NSMutableDictionary new];
|
|
843
|
+
|
|
844
|
+
if (orderDetails.orderId) {
|
|
845
|
+
orderDetailsDictionary[@"orderId"] = orderDetails.orderId;
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
if (orderDetails.orderStatus) {
|
|
849
|
+
orderDetailsDictionary[@"orderStatus"] = orderDetails.orderStatus;
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
if (orderDetails.orderFailureReason) {
|
|
853
|
+
orderDetailsDictionary[@"orderFailureReason"] = orderDetails.orderFailureReason;
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
if (orderDetails.timestamp) {
|
|
857
|
+
orderDetailsDictionary[@"timestamp"] = orderDetails.timestamp;
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
orderDetailsDictionary[@"amount"] = @(orderDetails.amount);
|
|
861
|
+
|
|
862
|
+
[mappedResponse setValue:[NSDictionary dictionaryWithDictionary:orderDetailsDictionary]
|
|
863
|
+
forKey:@"orderDetails"];
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
return [NSDictionary dictionaryWithDictionary:mappedResponse];
|
|
867
|
+
}
|
|
499
868
|
|
|
500
869
|
@end
|