judokit-react-native 3.4.7 → 3.5.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.
@@ -128,13 +128,19 @@ RCT_REMAP_METHOD(fetchTransactionDetails,
128
128
  properties:(NSDictionary *)properties
129
129
  fetchTransactionDetailsWithResolver:(RCTPromiseResolveBlock)resolve
130
130
  rejecter:(RCTPromiseRejectBlock)reject) {
131
+ @try {
132
+ self.apiService = [RNWrappers apiServiceFromProperties:properties];
133
+ self.completionBlock = [self completionBlockWithResolve:resolve andReject:reject];
131
134
 
132
- self.apiService = [RNWrappers apiServiceFromProperties:properties];
133
- self.completionBlock = [self completionBlockWithResolve:resolve andReject:reject];
134
-
135
- NSString *receiptId = [RNWrappers receiptIdFromProperties:properties];
135
+ NSString *receiptId = [RNWrappers receiptIdFromProperties:properties];
136
136
 
137
- [self.apiService fetchTransactionWithReceiptId:receiptId completion:self.completionBlock];
137
+ [self.apiService fetchTransactionWithReceiptId:receiptId completion:self.completionBlock];
138
+ } @catch (NSException *exception) {
139
+ NSError *error = [[NSError alloc] initWithDomain:RNJudoErrorDomain
140
+ code:0
141
+ userInfo:exception.userInfo];
142
+ reject(kJudoPromiseRejectionCode, exception.reason, error);
143
+ }
138
144
  }
139
145
 
140
146
  //----------------------------------------------
@@ -204,7 +210,17 @@ RCT_REMAP_METHOD(fetchTransactionDetails,
204
210
  message = description;
205
211
  }
206
212
 
207
- reject(kJudoPromiseRejectionCode, message, error);
213
+ // TODO: RCTJSErrorFromCodeMessageAndNSError expects an NSError instane in userInfo[NSUnderlyingErrorKey]
214
+ // which in case of a 3DS SDK error is a NSString ('JP3DSSDKRuntimeException') - so it crashes
215
+ // ! this should be fixed in JudoKit-iOS, and the folowing workaround removed ASAP
216
+ NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithDictionary:error.userInfo];
217
+ [userInfo removeObjectForKey:NSUnderlyingErrorKey];
218
+ NSError *myError = [[NSError alloc] initWithDomain:error.domain
219
+ code:error.code
220
+ userInfo:[NSDictionary dictionaryWithDictionary:userInfo]];
221
+
222
+
223
+ reject(kJudoPromiseRejectionCode, message, myError);
208
224
  } else {
209
225
  NSDictionary *mappedResponse = [RNWrappers dictionaryFromResponse:response];
210
226
  resolve(mappedResponse);
@@ -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";
@@ -129,6 +130,7 @@ static NSString *const kCardSchemeAMEX = @"amex";
129
130
 
130
131
  NSString *judoId = [configurationDict stringForKey:@"judoId"];
131
132
  NSNumber *isInitialRecurringPayment = [configurationDict optionalBoolForKey:@"isInitialRecurringPayment"];
133
+ NSNumber *isDelayedAuthorisation = [configurationDict optionalBoolForKey:@"isDelayedAuthorisation"];
132
134
 
133
135
  JPAmount *amount = [RNWrappers amountFromConfiguration:configurationDict];
134
136
  JPReference *reference = [RNWrappers referenceFromConfiguration:configurationDict];
@@ -137,7 +139,14 @@ static NSString *const kCardSchemeAMEX = @"amex";
137
139
  amount:amount
138
140
  reference:reference];
139
141
 
140
- configuration.isInitialRecurringPayment = isInitialRecurringPayment;
142
+ if (isInitialRecurringPayment) {
143
+ configuration.isInitialRecurringPayment = isInitialRecurringPayment.boolValue;
144
+ }
145
+
146
+ if (isDelayedAuthorisation) {
147
+ configuration.isDelayedAuthorisation = isDelayedAuthorisation.boolValue;
148
+ }
149
+
141
150
  configuration.uiConfiguration = [RNWrappers uiConfigurationFromConfiguration:configurationDict];
142
151
  configuration.supportedCardNetworks = [RNWrappers cardNetworksFromConfiguration:configurationDict];
143
152
  configuration.primaryAccountDetails = [RNWrappers accountDetailsFromConfiguration:configurationDict];
@@ -246,15 +255,15 @@ static NSString *const kCardSchemeAMEX = @"amex";
246
255
  + (JPCardNetworkType)cardTypeFromProperties:(NSDictionary *)properties {
247
256
  NSString *cardScheme = [properties optionalStringForKey:@"cardScheme"].lowercaseString;
248
257
 
249
- if ([kCardSchemeVISA isEqualToString:cardScheme]) {
258
+ if ([cardScheme containsString:kCardSchemeVISA]) {
250
259
  return JPCardNetworkTypeVisa;
251
260
  }
252
261
 
253
- if ([kCardSchemeMasterCard isEqualToString:cardScheme]) {
262
+ if ([cardScheme containsString:kCardSchemeMasterCard]) {
254
263
  return JPCardNetworkTypeMasterCard;
255
264
  }
256
265
 
257
- if ([kCardSchemeAMEX isEqualToString:cardScheme]) {
266
+ if ([cardScheme containsString:kCardSchemeAMEX]) {
258
267
  return JPCardNetworkTypeAMEX;
259
268
  }
260
269
 
@@ -328,7 +337,8 @@ static NSString *const kCardSchemeAMEX = @"amex";
328
337
  address3:[addressDictionary optionalStringForKey:@"line3"]
329
338
  town:[addressDictionary optionalStringForKey:@"town"]
330
339
  postCode:[addressDictionary optionalStringForKey:@"postCode"]
331
- countryCode:[addressDictionary optionalNumberForKey:@"countryCode"]];
340
+ countryCode:[addressDictionary optionalNumberForKey:@"countryCode"]
341
+ state:[addressDictionary optionalStringForKey:@"state"]];
332
342
  }
333
343
 
334
344
  + (JPUIConfiguration *)uiConfigurationFromConfiguration:(NSDictionary *)configuration {
@@ -341,26 +351,334 @@ static NSString *const kCardSchemeAMEX = @"amex";
341
351
  return uiConfiguration;
342
352
  }
343
353
 
344
- NSNumber *isAVSEnabled = [dictionary boolForKey:@"isAVSEnabled"];
345
- NSNumber *shouldDisplayAmount = [dictionary boolForKey:@"shouldPaymentMethodsDisplayAmount"];
346
- NSNumber *isPayButtonAmountVisible = [dictionary boolForKey:@"shouldPaymentButtonDisplayAmount"];
347
- NSNumber *isSecureCodeCheckEnabled = [dictionary boolForKey:@"shouldPaymentMethodsVerifySecurityCode"];
354
+ NSNumber *isAVSEnabled = [dictionary optionalBoolForKey:@"isAVSEnabled"];
355
+ NSNumber *shouldDisplayAmount = [dictionary optionalBoolForKey:@"shouldPaymentMethodsDisplayAmount"];
356
+ NSNumber *isPayButtonAmountVisible = [dictionary optionalBoolForKey:@"shouldPaymentButtonDisplayAmount"];
357
+ NSNumber *isSecureCodeCheckEnabled = [dictionary optionalBoolForKey:@"shouldPaymentMethodsVerifySecurityCode"];
348
358
  NSNumber *shouldAskForBillingInformation = [dictionary optionalBoolForKey:@"shouldAskForBillingInformation"];
349
359
 
350
- uiConfiguration.isAVSEnabled = isAVSEnabled.boolValue;
351
- uiConfiguration.shouldPaymentMethodsDisplayAmount = shouldDisplayAmount.boolValue;
352
- uiConfiguration.shouldPaymentButtonDisplayAmount = isPayButtonAmountVisible.boolValue;
353
- uiConfiguration.shouldPaymentMethodsVerifySecurityCode = isSecureCodeCheckEnabled.boolValue;
360
+ if (isAVSEnabled) {
361
+ uiConfiguration.isAVSEnabled = isAVSEnabled.boolValue;
362
+ }
363
+
364
+ if (shouldDisplayAmount) {
365
+ uiConfiguration.shouldPaymentMethodsDisplayAmount = shouldDisplayAmount.boolValue;
366
+ }
367
+
368
+ if (isPayButtonAmountVisible) {
369
+ uiConfiguration.shouldPaymentButtonDisplayAmount = isPayButtonAmountVisible.boolValue;
370
+ }
371
+
372
+ if (isSecureCodeCheckEnabled) {
373
+ uiConfiguration.shouldPaymentMethodsVerifySecurityCode = isSecureCodeCheckEnabled.boolValue;
374
+ }
354
375
 
355
376
  if (shouldAskForBillingInformation) {
356
377
  uiConfiguration.shouldAskForBillingInformation = shouldAskForBillingInformation.boolValue;
357
378
  }
358
379
 
359
380
  uiConfiguration.theme = [self themeFromUIConfiguration:dictionary];
381
+ uiConfiguration.threeDSUICustomization = [self threeDSUICustomization:dictionary];
360
382
 
361
383
  return uiConfiguration;
362
384
  }
363
385
 
386
+ + (JP3DSUICustomization *)threeDSUICustomization:(NSDictionary *)uiCustomization {
387
+ NSDictionary *dictionary = [uiCustomization optionalDictionaryForKey:@"threeDSUIConfiguration"];
388
+
389
+ if (!dictionary) {
390
+ return nil;
391
+ }
392
+
393
+ NSDictionary *buttonCustomizations = [dictionary optionalDictionaryForKey:@"buttonCustomizations"];
394
+ NSDictionary *toolbarCustomizations = [dictionary optionalDictionaryForKey:@"toolbarCustomization"];
395
+ NSDictionary *labelCustomizations = [dictionary optionalDictionaryForKey:@"labelCustomization"];
396
+ NSDictionary *textBoxCustomizations = [dictionary optionalDictionaryForKey:@"textBoxCustomization"];
397
+
398
+ JP3DSUICustomization *customization = [JP3DSUICustomization new];
399
+
400
+ if (buttonCustomizations) {
401
+ NSDictionary *submitButtonCustomization = [buttonCustomizations optionalDictionaryForKey:@"SUBMIT"];
402
+ NSDictionary *continueButtonCustomization = [buttonCustomizations optionalDictionaryForKey:@"CONTINUE"];
403
+ NSDictionary *nextButtonCustomization = [buttonCustomizations optionalDictionaryForKey:@"NEXT"];
404
+ NSDictionary *cancelButtonCustomization = [buttonCustomizations optionalDictionaryForKey:@"CANCEL"];
405
+ NSDictionary *resendButtonCustomization = [buttonCustomizations optionalDictionaryForKey:@"RESEND"];
406
+
407
+ if (submitButtonCustomization) {
408
+ JP3DSButtonCustomization *submitCustomization = [JP3DSButtonCustomization new];
409
+
410
+ NSString *textFontName = [submitButtonCustomization optionalStringForKey:@"textFontName"];
411
+ NSString *textColor = [submitButtonCustomization optionalStringForKey:@"textColor"];
412
+ NSString *backgroundColor = [submitButtonCustomization optionalStringForKey:@"backgroundColor"];
413
+ NSNumber *cornerRadius = [submitButtonCustomization optionalNumberForKey:@"cornerRadius"];
414
+ NSNumber *textFontSize = [submitButtonCustomization optionalNumberForKey:@"textFontSize"];
415
+
416
+ if (textFontName) {
417
+ [submitCustomization setTextFontName:textFontName];
418
+ }
419
+
420
+ if (textColor) {
421
+ [submitCustomization setTextColor:textColor];
422
+ }
423
+
424
+ if (backgroundColor) {
425
+ [submitCustomization setBackgroundColor:backgroundColor];
426
+ }
427
+
428
+ if (cornerRadius) {
429
+ [submitCustomization setCornerRadius:cornerRadius.integerValue];
430
+ }
431
+
432
+ if (textFontSize) {
433
+ [submitCustomization setTextFontSize:textFontSize.integerValue];
434
+ }
435
+
436
+ [customization setButtonCustomization:submitCustomization ofType:JP3DSButtonTypeSubmit];
437
+ }
438
+
439
+ if (continueButtonCustomization) {
440
+ JP3DSButtonCustomization *continueCustomization = [JP3DSButtonCustomization new];
441
+
442
+ NSString *textFontName = [continueButtonCustomization optionalStringForKey:@"textFontName"];
443
+ NSString *textColor = [continueButtonCustomization optionalStringForKey:@"textColor"];
444
+ NSString *backgroundColor = [continueButtonCustomization optionalStringForKey:@"backgroundColor"];
445
+ NSNumber *cornerRadius = [continueButtonCustomization optionalNumberForKey:@"cornerRadius"];
446
+ NSNumber *textFontSize = [continueButtonCustomization optionalNumberForKey:@"textFontSize"];
447
+
448
+ if (textFontName) {
449
+ [continueCustomization setTextFontName:textFontName];
450
+ }
451
+
452
+ if (textColor) {
453
+ [continueCustomization setTextColor:textColor];
454
+ }
455
+
456
+ if (backgroundColor) {
457
+ [continueCustomization setBackgroundColor:backgroundColor];
458
+ }
459
+
460
+ if (cornerRadius) {
461
+ [continueCustomization setCornerRadius:cornerRadius.integerValue];
462
+ }
463
+
464
+ if (textFontSize) {
465
+ [continueCustomization setTextFontSize:textFontSize.integerValue];
466
+ }
467
+
468
+ [customization setButtonCustomization:continueCustomization ofType:JP3DSButtonTypeContinue];
469
+ }
470
+
471
+ if (nextButtonCustomization) {
472
+ JP3DSButtonCustomization *nextCustomization = [JP3DSButtonCustomization new];
473
+
474
+ NSString *textFontName = [nextButtonCustomization optionalStringForKey:@"textFontName"];
475
+ NSString *textColor = [nextButtonCustomization optionalStringForKey:@"textColor"];
476
+ NSString *backgroundColor = [nextButtonCustomization optionalStringForKey:@"backgroundColor"];
477
+ NSNumber *cornerRadius = [nextButtonCustomization optionalNumberForKey:@"cornerRadius"];
478
+ NSNumber *textFontSize = [nextButtonCustomization optionalNumberForKey:@"textFontSize"];
479
+
480
+ if (textFontName) {
481
+ [nextCustomization setTextFontName:textFontName];
482
+ }
483
+
484
+ if (textColor) {
485
+ [nextCustomization setTextColor:textColor];
486
+ }
487
+
488
+ if (backgroundColor) {
489
+ [nextCustomization setBackgroundColor:backgroundColor];
490
+ }
491
+
492
+ if (cornerRadius) {
493
+ [nextCustomization setCornerRadius:cornerRadius.integerValue];
494
+ }
495
+
496
+ if (textFontSize) {
497
+ [nextCustomization setTextFontSize:textFontSize.integerValue];
498
+ }
499
+
500
+ [customization setButtonCustomization:nextCustomization ofType:JP3DSButtonTypeNext];
501
+ }
502
+
503
+ if (cancelButtonCustomization) {
504
+ JP3DSButtonCustomization *cancelCustomization = [JP3DSButtonCustomization new];
505
+
506
+ NSString *textFontName = [cancelButtonCustomization optionalStringForKey:@"textFontName"];
507
+ NSString *textColor = [cancelButtonCustomization optionalStringForKey:@"textColor"];
508
+ NSString *backgroundColor = [cancelButtonCustomization optionalStringForKey:@"backgroundColor"];
509
+ NSNumber *cornerRadius = [cancelButtonCustomization optionalNumberForKey:@"cornerRadius"];
510
+ NSNumber *textFontSize = [cancelButtonCustomization optionalNumberForKey:@"textFontSize"];
511
+
512
+ if (textFontName) {
513
+ [cancelCustomization setTextFontName:textFontName];
514
+ }
515
+
516
+ if (textColor) {
517
+ [cancelCustomization setTextColor:textColor];
518
+ }
519
+
520
+ if (backgroundColor) {
521
+ [cancelCustomization setBackgroundColor:backgroundColor];
522
+ }
523
+
524
+ if (cornerRadius) {
525
+ [cancelCustomization setCornerRadius:cornerRadius.integerValue];
526
+ }
527
+
528
+ if (textFontSize) {
529
+ [cancelCustomization setTextFontSize:textFontSize.integerValue];
530
+ }
531
+
532
+ [customization setButtonCustomization:cancelCustomization ofType:JP3DSButtonTypeCancel];
533
+ }
534
+
535
+ if (resendButtonCustomization) {
536
+ JP3DSButtonCustomization *resendCustomization = [JP3DSButtonCustomization new];
537
+
538
+ NSString *textFontName = [resendButtonCustomization optionalStringForKey:@"textFontName"];
539
+ NSString *textColor = [resendButtonCustomization optionalStringForKey:@"textColor"];
540
+ NSString *backgroundColor = [resendButtonCustomization optionalStringForKey:@"backgroundColor"];
541
+ NSNumber *cornerRadius = [resendButtonCustomization optionalNumberForKey:@"cornerRadius"];
542
+ NSNumber *textFontSize = [resendButtonCustomization optionalNumberForKey:@"textFontSize"];
543
+
544
+ if (textFontName) {
545
+ [resendCustomization setTextFontName:textFontName];
546
+ }
547
+
548
+ if (textColor) {
549
+ [resendCustomization setTextColor:textColor];
550
+ }
551
+
552
+ if (backgroundColor) {
553
+ [resendCustomization setBackgroundColor:backgroundColor];
554
+ }
555
+
556
+ if (cornerRadius) {
557
+ [resendCustomization setCornerRadius:cornerRadius.integerValue];
558
+ }
559
+
560
+ if (textFontSize) {
561
+ [resendCustomization setTextFontSize:textFontSize.integerValue];
562
+ }
563
+
564
+ [customization setButtonCustomization:resendCustomization ofType:JP3DSButtonTypeResend];
565
+ }
566
+ }
567
+
568
+ if (labelCustomizations) {
569
+ JP3DSLabelCustomization *labelCustomization = [JP3DSLabelCustomization new];
570
+
571
+ NSString *textFontName = [labelCustomizations optionalStringForKey:@"textFontName"];
572
+ NSString *textColor = [labelCustomizations optionalStringForKey:@"textColor"];
573
+ NSString *headingTextFontName = [labelCustomizations optionalStringForKey:@"headingTextFontName"];
574
+ NSString *headingTextColor = [labelCustomizations optionalStringForKey:@"headingTextColor"];
575
+ NSNumber *headingTextFontSize = [labelCustomizations optionalNumberForKey:@"headingTextFontSize"];
576
+ NSNumber *textFontSize = [labelCustomizations optionalNumberForKey:@"textFontSize"];
577
+
578
+ if (textFontName) {
579
+ [labelCustomization setTextFontName:textFontName];
580
+ }
581
+
582
+ if (textColor) {
583
+ [labelCustomization setTextColor:textColor];
584
+ }
585
+
586
+ if (headingTextFontName) {
587
+ [labelCustomization setHeadingTextFontName:headingTextFontName];
588
+ }
589
+
590
+ if (headingTextColor) {
591
+ [labelCustomization setHeadingTextColor:headingTextColor];
592
+ }
593
+
594
+ if (headingTextFontSize) {
595
+ [labelCustomization setHeadingTextFontSize:headingTextFontSize.integerValue];
596
+ }
597
+
598
+ if (textFontSize) {
599
+ [labelCustomization setTextFontSize:textFontSize.integerValue];
600
+ }
601
+
602
+ [customization setLabelCustomization:labelCustomization];
603
+ }
604
+
605
+ if (toolbarCustomizations) {
606
+ JP3DSToolbarCustomization *toolbarCustomization = [JP3DSToolbarCustomization new];
607
+
608
+ NSNumber *textFontSize = [toolbarCustomizations optionalNumberForKey:@"textFontSize"];
609
+ NSString *textFontName = [toolbarCustomizations optionalStringForKey:@"textFontName"];
610
+ NSString *textColor = [toolbarCustomizations optionalStringForKey:@"textColor"];
611
+ NSString *backgroundColor = [toolbarCustomizations optionalStringForKey:@"backgroundColor"];
612
+ NSString *headerText = [toolbarCustomizations optionalStringForKey:@"headerText"];
613
+ NSString *buttonText = [toolbarCustomizations optionalStringForKey:@"buttonText"];
614
+
615
+ if (textFontName) {
616
+ [toolbarCustomization setTextFontName:textFontName];
617
+ }
618
+
619
+ if (textColor) {
620
+ [toolbarCustomization setTextColor:textColor];
621
+ }
622
+
623
+ if (backgroundColor) {
624
+ [toolbarCustomization setBackgroundColor:backgroundColor];
625
+ }
626
+
627
+ if (headerText) {
628
+ [toolbarCustomization setHeaderText:headerText];
629
+ }
630
+
631
+ if (buttonText) {
632
+ [toolbarCustomization setButtonText:buttonText];
633
+ }
634
+
635
+ if (textFontSize) {
636
+ [toolbarCustomization setTextFontSize:textFontSize.integerValue];
637
+ }
638
+
639
+ [customization setToolbarCustomization:toolbarCustomization];
640
+ }
641
+
642
+ if (textBoxCustomizations) {
643
+ JP3DSTextBoxCustomization *textBoxCustomization = [JP3DSTextBoxCustomization new];
644
+
645
+ NSString *textFontName = [textBoxCustomizations optionalStringForKey:@"textFontName"];
646
+ NSString *textColor = [textBoxCustomizations optionalStringForKey:@"textColor"];
647
+ NSString *borderColor = [textBoxCustomizations optionalStringForKey:@"borderColor"];
648
+ NSNumber *borderWidth = [textBoxCustomizations optionalNumberForKey:@"borderWidth"];
649
+ NSNumber *cornerRadius = [textBoxCustomizations optionalNumberForKey:@"cornerRadius"];
650
+ NSNumber *textFontSize = [textBoxCustomizations optionalNumberForKey:@"textFontSize"];
651
+
652
+ if (textFontName) {
653
+ [textBoxCustomization setTextFontName:textFontName];
654
+ }
655
+
656
+ if (textColor) {
657
+ [textBoxCustomization setTextColor:textColor];
658
+ }
659
+
660
+ if (borderColor) {
661
+ [textBoxCustomization setBorderColor:borderColor];
662
+ }
663
+
664
+ if (borderWidth) {
665
+ [textBoxCustomization setBorderWidth:borderWidth.integerValue];
666
+ }
667
+
668
+ if (cornerRadius) {
669
+ [textBoxCustomization setCornerRadius:cornerRadius.integerValue];
670
+ }
671
+
672
+ if (textFontSize) {
673
+ [textBoxCustomization setTextFontSize:textFontSize.integerValue];
674
+ }
675
+
676
+ [customization setTextBoxCustomization:textBoxCustomization];
677
+ }
678
+
679
+ return customization;
680
+ }
681
+
364
682
  + (JPTheme *)themeFromUIConfiguration:(NSDictionary *)uiConfiguration {
365
683
  JPTheme *theme = [JPTheme new];
366
684
 
@@ -462,38 +780,108 @@ static NSString *const kCardSchemeAMEX = @"amex";
462
780
  [mappedResponse setValue:response.appearsOnStatementAs forKey:@"appearsOnStatementAs"];
463
781
  [mappedResponse setValue:response.originalAmount forKey:@"originalAmount"];
464
782
  [mappedResponse setValue:response.netAmount forKey:@"netAmount"];
465
- [mappedResponse setValue:response.amount.amount forKey:@"amount"];
466
- [mappedResponse setValue:response.amount.currency forKey:@"currency"];
467
-
468
- NSMutableDictionary *cardDetailsResponse = [NSMutableDictionary new];
469
- [cardDetailsResponse setValue:response.cardDetails.cardLastFour forKey:@"cardLastFour"];
470
- [cardDetailsResponse setValue:response.cardDetails.endDate forKey:@"endDate"];
471
- [cardDetailsResponse setValue:response.cardDetails.cardToken forKey:@"cardToken"];
472
- [cardDetailsResponse setValue:@(response.cardDetails.cardNetwork) forKey:@"cardNetwork"];
473
- [cardDetailsResponse setValue:response.cardDetails.bank forKey:@"bank"];
474
- [cardDetailsResponse setValue:response.cardDetails.cardCategory forKey:@"cardCategory"];
475
- [cardDetailsResponse setValue:response.cardDetails.cardCountry forKey:@"cardCountry"];
476
- [cardDetailsResponse setValue:response.cardDetails.cardFunding forKey:@"cardFunding"];
477
- [cardDetailsResponse setValue:response.cardDetails.cardScheme forKey:@"cardScheme"];
478
-
479
- [mappedResponse setValue:cardDetailsResponse forKey:@"cardDetails"];
480
-
481
- NSMutableDictionary *consumerResponse = [NSMutableDictionary new];
482
- [consumerResponse setValue:response.consumer.consumerToken forKey:@"consumerToken"];
483
- [consumerResponse setValue:response.consumer.consumerReference forKey:@"consumerReference"];
484
-
485
- [mappedResponse setValue:consumerResponse forKey:@"consumerResponse"];
486
-
487
- NSMutableDictionary *orderDetailsResponse = [NSMutableDictionary new];
488
- [orderDetailsResponse setValue:response.orderDetails.orderId forKey:@"orderId"];
489
- [orderDetailsResponse setValue:response.orderDetails.orderStatus forKey:@"orderStatus"];
490
- [orderDetailsResponse setValue:response.orderDetails.orderFailureReason forKey:@"orderFailureReason"];
491
- [orderDetailsResponse setValue:response.orderDetails.timestamp forKey:@"timestamp"];
492
- [orderDetailsResponse setValue:@(response.orderDetails.amount) forKey:@"amount"];
493
-
494
- [mappedResponse setValue:orderDetailsResponse forKey:@"orderDetails"];
495
-
496
- return mappedResponse;
497
- }
783
+
784
+ JPAmount *amount = response.amount;
785
+
786
+ if (amount) {
787
+ [mappedResponse setValue:amount.amount forKey:@"amount"];
788
+ [mappedResponse setValue:amount.currency forKey:@"currency"];
789
+ }
790
+
791
+ JPCardDetails *cardDetails = response.cardDetails;
792
+
793
+ if (cardDetails) {
794
+ NSMutableDictionary *cardDetailsDictionary = [NSMutableDictionary new];
795
+
796
+ if (cardDetails.cardLastFour) {
797
+ cardDetailsDictionary[@"cardLastFour"] = cardDetails.cardLastFour;
798
+ }
799
+
800
+ if (cardDetails.endDate) {
801
+ cardDetailsDictionary[@"endDate"] = cardDetails.endDate;
802
+ }
803
+
804
+ if (cardDetails.cardToken) {
805
+ cardDetailsDictionary[@"cardToken"] = cardDetails.cardToken;
806
+ }
807
+
808
+ cardDetailsDictionary[@"cardNetwork"] = @(cardDetails.cardNetwork);
809
+
810
+ if (cardDetails.bank) {
811
+ cardDetailsDictionary[@"bank"] = cardDetails.bank;
812
+ }
813
+
814
+ if (cardDetails.cardCategory) {
815
+ cardDetailsDictionary[@"cardCategory"] = cardDetails.cardCategory;
816
+ }
817
+
818
+ if (cardDetails.cardCountry) {
819
+ cardDetailsDictionary[@"cardCountry"] = cardDetails.cardCountry;
820
+ }
821
+
822
+ if (cardDetails.cardFunding) {
823
+ cardDetailsDictionary[@"cardFunding"] = cardDetails.cardFunding;
824
+ }
825
+
826
+ if (cardDetails.cardScheme) {
827
+ cardDetailsDictionary[@"cardScheme"] = cardDetails.cardScheme;
828
+ }
829
+
830
+ if (cardDetails.cardHolderName) {
831
+ cardDetailsDictionary[@"cardHolderName"] = cardDetails.cardHolderName;
832
+ }
833
+
834
+ [mappedResponse setValue:[NSDictionary dictionaryWithDictionary:cardDetailsDictionary]
835
+ forKey:@"cardDetails"];
836
+ }
837
+
838
+ JPConsumer *consumer = response.consumer;
839
+
840
+ if (consumer) {
841
+ NSMutableDictionary *consumerDictionary = [NSMutableDictionary new];
842
+
843
+ if (consumer.consumerToken) {
844
+ consumerDictionary[@"consumerToken"] = consumer.consumerToken;
845
+ }
846
+
847
+ if (consumer.consumerReference) {
848
+ consumerDictionary[@"consumerReference"] = consumer.consumerReference;
849
+ }
850
+
851
+ if (consumerDictionary.count > 0) {
852
+ [mappedResponse setValue:[NSDictionary dictionaryWithDictionary:consumerDictionary]
853
+ forKey:@"consumerResponse"];
854
+ }
855
+ }
856
+
857
+ JPOrderDetails *orderDetails = response.orderDetails;
858
+
859
+ if (orderDetails) {
860
+ NSMutableDictionary *orderDetailsDictionary = [NSMutableDictionary new];
861
+
862
+ if (orderDetails.orderId) {
863
+ orderDetailsDictionary[@"orderId"] = orderDetails.orderId;
864
+ }
865
+
866
+ if (orderDetails.orderStatus) {
867
+ orderDetailsDictionary[@"orderStatus"] = orderDetails.orderStatus;
868
+ }
869
+
870
+ if (orderDetails.orderFailureReason) {
871
+ orderDetailsDictionary[@"orderFailureReason"] = orderDetails.orderFailureReason;
872
+ }
873
+
874
+ if (orderDetails.timestamp) {
875
+ orderDetailsDictionary[@"timestamp"] = orderDetails.timestamp;
876
+ }
877
+
878
+ orderDetailsDictionary[@"amount"] = @(orderDetails.amount);
879
+
880
+ [mappedResponse setValue:[NSDictionary dictionaryWithDictionary:orderDetailsDictionary]
881
+ forKey:@"orderDetails"];
882
+ }
883
+
884
+ return [NSDictionary dictionaryWithDictionary:mappedResponse];
885
+ }
498
886
 
499
887
  @end
package/ios/Podfile CHANGED
@@ -19,7 +19,9 @@ target 'RNJudo' do
19
19
  # use_frameworks!
20
20
 
21
21
  # Pods for RNJudo
22
- pod "JudoKit-iOS", "3.1.6"
22
+ pod "JudoKit-iOS", "3.1.10"
23
+ pod "Judo3DS2_iOS", "1.1.3"
24
+
23
25
  pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
24
26
  pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
25
27
  pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
package/ios/Podfile.lock CHANGED
@@ -21,13 +21,13 @@ PODS:
21
21
  - DoubleConversion
22
22
  - glog
23
23
  - glog (0.3.5)
24
- - Judo3DS2_iOS (1.1.2)
25
- - JudoKit-iOS (3.1.6):
24
+ - Judo3DS2_iOS (1.1.3)
25
+ - JudoKit-iOS (3.1.10):
26
26
  - DeviceDNA (~> 2.0.0)
27
- - Judo3DS2_iOS (~> 1.1.2)
27
+ - Judo3DS2_iOS (~> 1.1.3)
28
28
  - TrustKit
29
29
  - ZappMerchantLib
30
- - OpenSSL-Universal (1.1.1700)
30
+ - OpenSSL-Universal (1.1.1900)
31
31
  - RCTRequired (0.61.5)
32
32
  - RCTTypeSafety (0.61.5):
33
33
  - FBLazyVector (= 0.61.5)
@@ -236,7 +236,8 @@ DEPENDENCIES:
236
236
  - FBReactNativeSpec (from `../node_modules/react-native/Libraries/FBReactNativeSpec`)
237
237
  - Folly (from `../node_modules/react-native/third-party-podspecs/Folly.podspec`)
238
238
  - glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`)
239
- - JudoKit-iOS (= 3.1.6)
239
+ - Judo3DS2_iOS (= 1.1.3)
240
+ - JudoKit-iOS (= 3.1.10)
240
241
  - RCTRequired (from `../node_modules/react-native/Libraries/RCTRequired`)
241
242
  - RCTTypeSafety (from `../node_modules/react-native/Libraries/TypeSafety`)
242
243
  - React (from `../node_modules/react-native/`)
@@ -331,9 +332,9 @@ SPEC CHECKSUMS:
331
332
  FBReactNativeSpec: 118d0d177724c2d67f08a59136eb29ef5943ec75
332
333
  Folly: 30e7936e1c45c08d884aa59369ed951a8e68cf51
333
334
  glog: 1f3da668190260b06b429bb211bfbee5cd790c28
334
- Judo3DS2_iOS: 90b820a50035cb08ccc1b2e22900b856132c79a5
335
- JudoKit-iOS: eabd569f41993ddd46273a63aa5c255cef473308
336
- OpenSSL-Universal: ee0a7a25f2042782e2df405e66db3e429198e392
335
+ Judo3DS2_iOS: b2396a1f0aa3e8d428fdd887c8b6eae5d3aa4f79
336
+ JudoKit-iOS: c45f288b94eef55d779b4e61028b9bf04aa334b2
337
+ OpenSSL-Universal: 84efb8a29841f2764ac5403e0c4119a28b713346
337
338
  RCTRequired: b153add4da6e7dbc44aebf93f3cf4fcae392ddf1
338
339
  RCTTypeSafety: 9aa1b91d7f9310fc6eadc3cf95126ffe818af320
339
340
  React: b6a59ef847b2b40bb6e0180a97d0ca716969ac78
@@ -357,6 +358,6 @@ SPEC CHECKSUMS:
357
358
  Yoga: f2a7cd4280bfe2cca5a7aed98ba0eb3d1310f18b
358
359
  ZappMerchantLib: b14bc5814840426d351190309250347ca9b0983d
359
360
 
360
- PODFILE CHECKSUM: 697d0d38cedb02c077c830bd5d3dab848ad81c11
361
+ PODFILE CHECKSUM: f04f2f5cb9ebec38d61aa9e7bdf575cf58376fdd
361
362
 
362
363
  COCOAPODS: 1.11.3
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "judokit-react-native",
3
3
  "title": "Judopay React Native Module",
4
- "version": "3.4.7",
4
+ "version": "3.5.0",
5
5
  "description": "A React Native module for the Judopay native SDKs to take payments on iOS and Android.",
6
6
  "main": "JudoPay.tsx",
7
7
  "scripts": {
8
8
  "test": "jest --coverage",
9
- "lint": "tsc && eslint '*/**/*.{js,ts,tsx}' --quiet"
9
+ "lint": "tsc && eslint '*/**/*.{ts,tsx}' --quiet",
10
+ "format": "prettier --write \"**/*.+(tsx|ts)\""
10
11
  },
11
12
  "files": [
12
13
  "JudoPay.tsx",
@@ -52,6 +53,7 @@
52
53
  "eslint-plugin-react": "^7.19.0",
53
54
  "eslint-plugin-react-hooks": "^2.5.0",
54
55
  "jest": "^25.3.0",
56
+ "prettier": "^2.7.1",
55
57
  "react": "16.9.0",
56
58
  "react-native": "0.61.5"
57
59
  },