judokit-react-native 3.3.7 → 3.4.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.
@@ -29,6 +29,10 @@
29
29
  #import "NSDictionary+JudoConvert.h"
30
30
  #import "UIColor+RNAdditions.h"
31
31
 
32
+ static NSString *const kCardSchemeVISA = @"visa";
33
+ static NSString *const kCardSchemeMasterCard = @"mastercard";
34
+ static NSString *const kCardSchemeAMEX = @"amex";
35
+
32
36
  @implementation RNWrappers
33
37
 
34
38
  //---------------------------------------------------
@@ -36,50 +40,46 @@
36
40
  //---------------------------------------------------
37
41
 
38
42
  + (JudoKit *)judoSessionFromProperties:(NSDictionary *)properties {
39
-
40
- NSDictionary *authorizationDict = [properties dictionaryForKey:@"authorization"];
41
-
42
- NSString *token = [authorizationDict stringForKey:@"token"];
43
- NSString *secret = [authorizationDict optionalStringForKey:@"secret"];
44
- NSString *paymentSession = [authorizationDict optionalStringForKey:@"paymentSession"];
45
-
46
- JudoKit *judoKit;
47
-
48
- if (secret) {
49
- JPBasicAuthorization *authorization = [JPBasicAuthorization authorizationWithToken:token
50
- andSecret:secret];
51
- judoKit = [[JudoKit alloc] initWithAuthorization:authorization];
52
- } else {
53
- JPSessionAuthorization *authorization = [JPSessionAuthorization authorizationWithToken:token
54
- andPaymentSession:paymentSession];
55
- judoKit = [[JudoKit alloc] initWithAuthorization:authorization];
56
- }
57
-
58
- NSNumber *isSandboxed = [properties boolForKey:@"sandboxed"];
59
- judoKit.isSandboxed = isSandboxed.boolValue;
60
-
43
+ id<JPAuthorization> authorization = [RNWrappers authorizationFromProperties:properties];
44
+ JudoKit *judoKit = [[JudoKit alloc] initWithAuthorization:authorization];
45
+ judoKit.isSandboxed = [RNWrappers isSandboxedFromProperties:properties];
61
46
  return judoKit;
62
47
  }
63
48
 
64
49
  + (JPApiService *)apiServiceFromProperties:(NSDictionary *)properties {
50
+ BOOL isSandboxed = [RNWrappers isSandboxedFromProperties:properties];
51
+ id<JPAuthorization> authorization = [RNWrappers authorizationFromProperties:properties];
52
+
53
+ return [[JPApiService alloc] initWithAuthorization:authorization isSandboxed:isSandboxed];
54
+ }
65
55
 
56
+ + (id<JPAuthorization>)authorizationFromProperties:(NSDictionary *)properties {
66
57
  NSDictionary *authorizationDict = [properties dictionaryForKey:@"authorization"];
67
58
 
68
59
  NSString *token = [authorizationDict stringForKey:@"token"];
69
60
  NSString *secret = [authorizationDict optionalStringForKey:@"secret"];
70
61
  NSString *paymentSession = [authorizationDict optionalStringForKey:@"paymentSession"];
62
+
63
+ if (secret) {
64
+ return [JPBasicAuthorization authorizationWithToken:token andSecret:secret];
65
+ }
71
66
 
67
+ return [JPSessionAuthorization authorizationWithToken:token andPaymentSession:paymentSession];
68
+ }
69
+
70
+ + (BOOL)isSandboxedFromProperties:(NSDictionary *)properties {
72
71
  NSNumber *isSandboxed = [properties boolForKey:@"sandboxed"];
72
+ return isSandboxed.boolValue;
73
+ }
73
74
 
74
- if (secret) {
75
- JPBasicAuthorization *authorization = [JPBasicAuthorization authorizationWithToken:token
76
- andSecret:secret];
77
- return [[JPApiService alloc] initWithAuthorization:authorization isSandboxed:isSandboxed.boolValue];
78
- }
75
+ + (JPCardTransactionService *)cardTransactionServiceFromProperties:(NSDictionary *)properties {
76
+ BOOL isSandboxed = [RNWrappers isSandboxedFromProperties:properties];
77
+ id<JPAuthorization> authorization = [RNWrappers authorizationFromProperties:properties];
78
+ JPConfiguration *configuration = [RNWrappers configurationFromProperties:properties];
79
79
 
80
- JPSessionAuthorization *authorization = [JPSessionAuthorization authorizationWithToken:token
81
- andPaymentSession:paymentSession];
82
- return [[JPApiService alloc] initWithAuthorization:authorization isSandboxed:isSandboxed.boolValue];
80
+ return [[JPCardTransactionService alloc] initWithAuthorization:authorization
81
+ isSandboxed:isSandboxed
82
+ andConfiguration:configuration];
83
83
  }
84
84
 
85
85
  + (JPTransactionType)transactionTypeFromProperties:(NSDictionary *)properties {
@@ -107,6 +107,22 @@
107
107
  return availableModes[intType].intValue;
108
108
  }
109
109
 
110
+ + (JPNetworkTimeout *)networkTimeoutFromProperties:(NSDictionary *)properties {
111
+ NSDictionary *networkTimeout = [properties optionalDictionaryForKey:@"networkTimeout"];
112
+
113
+ if (!networkTimeout) {
114
+ return nil;
115
+ }
116
+
117
+ NSTimeInterval connectTimeout = [networkTimeout numberForKey:@"connectTimeout"].doubleValue;
118
+ NSTimeInterval readTimeout = [networkTimeout numberForKey:@"readTimeout"].doubleValue;
119
+ NSTimeInterval writeTimeout = [networkTimeout numberForKey:@"writeTimeout"].doubleValue;
120
+
121
+ return [[JPNetworkTimeout alloc] initWithConnectTimeout:connectTimeout
122
+ andReadTimeout:readTimeout
123
+ andWriteTimeout:writeTimeout];
124
+ }
125
+
110
126
  + (JPConfiguration *)configurationFromProperties:(NSDictionary *)properties {
111
127
 
112
128
  NSDictionary *configurationDict = [properties dictionaryForKey:@"configuration"];
@@ -129,7 +145,36 @@
129
145
  configuration.paymentMethods = [RNWrappers paymentMethodsFromConfiguration:configurationDict];
130
146
  configuration.applePayConfiguration = [RNApplePayWrappers applePayConfigurationFromConfiguration:configurationDict];
131
147
  configuration.pbbaConfiguration = [RNPBBAWrappers pbbaConfigurationFromConfiguration:configurationDict];
148
+ configuration.networkTimeout = [RNWrappers networkTimeoutFromProperties:configurationDict];
149
+
150
+ NSString *scaExemption = [configurationDict optionalStringForKey:@"scaExemption"];
151
+ NSString *challengeRequestIndicator = [configurationDict optionalStringForKey:@"challengeRequestIndicator"];
152
+ NSString *mobileNumber = [configurationDict optionalStringForKey:@"mobileNumber"];
153
+ NSString *emailAddress = [configurationDict optionalStringForKey:@"emailAddress"];
154
+ NSString *threeDSTwoMessageVersion = [configurationDict optionalStringForKey:@"threeDSTwoMessageVersion"];
155
+ NSNumber *threeDSTwoMaxTimeout = [configurationDict optionalNumberForKey:@"threeDSTwoMaxTimeout"];
156
+ NSString *phoneCountryCode = [configurationDict optionalStringForKey:@"phoneCountryCode"];
157
+
158
+ configuration.mobileNumber = mobileNumber;
159
+ configuration.emailAddress = emailAddress;
160
+ configuration.phoneCountryCode = phoneCountryCode;
161
+
162
+ if (scaExemption) {
163
+ configuration.scaExemption = scaExemption;
164
+ }
165
+
166
+ if (challengeRequestIndicator) {
167
+ configuration.challengeRequestIndicator = challengeRequestIndicator;
168
+ }
169
+
170
+ if (threeDSTwoMessageVersion) {
171
+ configuration.threeDSTwoMessageVersion = threeDSTwoMessageVersion;
172
+ }
132
173
 
174
+ if (threeDSTwoMaxTimeout) {
175
+ configuration.threeDSTwoMaxTimeout = threeDSTwoMaxTimeout.intValue;
176
+ }
177
+
133
178
  return configuration;
134
179
  }
135
180
 
@@ -186,10 +231,36 @@
186
231
  return [properties optionalStringForKey:@"cardToken"];
187
232
  }
188
233
 
234
+ + (NSString *)securityCodeFromProperties:(NSDictionary *)properties {
235
+ return [properties optionalStringForKey:@"securityCode"];
236
+ }
237
+
238
+ + (NSString *)cardholderNameFromProperties:(NSDictionary *)properties {
239
+ return [properties optionalStringForKey:@"cardholderName"];
240
+ }
241
+
189
242
  + (NSString *)receiptIdFromProperties:(NSDictionary *)properties {
190
243
  return [properties optionalStringForKey:@"receiptId"];
191
244
  }
192
245
 
246
+ + (JPCardNetworkType)cardTypeFromProperties:(NSDictionary *)properties {
247
+ NSString *cardScheme = [properties optionalStringForKey:@"cardScheme"].lowercaseString;
248
+
249
+ if ([kCardSchemeVISA isEqualToString:cardScheme]) {
250
+ return JPCardNetworkTypeVisa;
251
+ }
252
+
253
+ if ([kCardSchemeMasterCard isEqualToString:cardScheme]) {
254
+ return JPCardNetworkTypeMasterCard;
255
+ }
256
+
257
+ if ([kCardSchemeAMEX isEqualToString:cardScheme]) {
258
+ return JPCardNetworkTypeAMEX;
259
+ }
260
+
261
+ return JPCardNetworkTypeUnknown;
262
+ }
263
+
193
264
  //---------------------------------------------------
194
265
  // MARK: - Helper methods
195
266
  //---------------------------------------------------
@@ -251,13 +322,14 @@
251
322
  if (!addressDictionary) {
252
323
  return nil;
253
324
  }
254
-
255
- return [[JPAddress alloc] initWithLine1:[addressDictionary optionalStringForKey:@"line1"]
256
- line2:[addressDictionary optionalStringForKey:@"line2"]
257
- line3:[addressDictionary optionalStringForKey:@"line3"]
258
- town:[addressDictionary optionalStringForKey:@"town"]
259
- countryCode:[addressDictionary optionalNumberForKey:@"countryCode"]
260
- postCode:[addressDictionary optionalStringForKey:@"postCode"]];
325
+
326
+ return [[JPAddress alloc] initWithAddress1:[addressDictionary optionalStringForKey:@"line1"]
327
+ address2:[addressDictionary optionalStringForKey:@"line2"]
328
+ address3:[addressDictionary optionalStringForKey:@"line3"]
329
+ town:[addressDictionary optionalStringForKey:@"town"]
330
+ billingCountry:[addressDictionary optionalStringForKey:@"billingCountry"]
331
+ postCode:[addressDictionary optionalStringForKey:@"postCode"]
332
+ countryCode:[addressDictionary optionalNumberForKey:@"countryCode"]];
261
333
  }
262
334
 
263
335
  + (JPUIConfiguration *)uiConfigurationFromConfiguration:(NSDictionary *)configuration {
@@ -274,12 +346,17 @@
274
346
  NSNumber *shouldDisplayAmount = [dictionary boolForKey:@"shouldPaymentMethodsDisplayAmount"];
275
347
  NSNumber *isPayButtonAmountVisible = [dictionary boolForKey:@"shouldPaymentButtonDisplayAmount"];
276
348
  NSNumber *isSecureCodeCheckEnabled = [dictionary boolForKey:@"shouldPaymentMethodsVerifySecurityCode"];
277
-
349
+ NSNumber *shouldAskForBillingInformation = [dictionary optionalBoolForKey:@"shouldAskForBillingInformation"];
350
+
278
351
  uiConfiguration.isAVSEnabled = isAVSEnabled.boolValue;
279
352
  uiConfiguration.shouldPaymentMethodsDisplayAmount = shouldDisplayAmount.boolValue;
280
353
  uiConfiguration.shouldPaymentButtonDisplayAmount = isPayButtonAmountVisible.boolValue;
281
354
  uiConfiguration.shouldPaymentMethodsVerifySecurityCode = isSecureCodeCheckEnabled.boolValue;
282
-
355
+
356
+ if (shouldAskForBillingInformation) {
357
+ uiConfiguration.shouldAskForBillingInformation = shouldAskForBillingInformation.boolValue;
358
+ }
359
+
283
360
  uiConfiguration.theme = [self themeFromUIConfiguration:dictionary];
284
361
 
285
362
  return uiConfiguration;
package/ios/Podfile CHANGED
@@ -16,10 +16,10 @@ pre_install do |installer|
16
16
  end
17
17
 
18
18
  target 'RNJudo' do
19
- use_frameworks!
19
+ # use_frameworks!
20
20
 
21
21
  # Pods for RNJudo
22
- pod "JudoKit-iOS", "2.4.6"
22
+ pod "JudoKit-iOS", "3.0.2"
23
23
  pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
24
24
  pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
25
25
  pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
package/ios/Podfile.lock CHANGED
@@ -1,6 +1,7 @@
1
1
  PODS:
2
2
  - boost-for-react-native (1.63.0)
3
- - DeviceDNA (1.1.3)
3
+ - DeviceDNA (2.0.0):
4
+ - OpenSSL-Universal (~> 1.1.180)
4
5
  - DoubleConversion (1.1.6)
5
6
  - FBLazyVector (0.61.5)
6
7
  - FBReactNativeSpec (0.61.5):
@@ -20,10 +21,13 @@ PODS:
20
21
  - DoubleConversion
21
22
  - glog
22
23
  - glog (0.3.5)
23
- - JudoKit-iOS (2.4.1):
24
- - DeviceDNA
24
+ - Judo3DS2_iOS (1.0.1)
25
+ - JudoKit-iOS (3.0.2):
26
+ - DeviceDNA (~> 2.0.0)
27
+ - Judo3DS2_iOS (~> 1.0.1)
25
28
  - TrustKit
26
29
  - ZappMerchantLib
30
+ - OpenSSL-Universal (1.1.1700)
27
31
  - RCTRequired (0.61.5)
28
32
  - RCTTypeSafety (0.61.5):
29
33
  - FBLazyVector (= 0.61.5)
@@ -232,7 +236,7 @@ DEPENDENCIES:
232
236
  - FBReactNativeSpec (from `../node_modules/react-native/Libraries/FBReactNativeSpec`)
233
237
  - Folly (from `../node_modules/react-native/third-party-podspecs/Folly.podspec`)
234
238
  - glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`)
235
- - JudoKit-iOS (= 2.4.1)
239
+ - JudoKit-iOS (= 3.0.2)
236
240
  - RCTRequired (from `../node_modules/react-native/Libraries/RCTRequired`)
237
241
  - RCTTypeSafety (from `../node_modules/react-native/Libraries/TypeSafety`)
238
242
  - React (from `../node_modules/react-native/`)
@@ -261,7 +265,9 @@ SPEC REPOS:
261
265
  trunk:
262
266
  - boost-for-react-native
263
267
  - DeviceDNA
268
+ - Judo3DS2_iOS
264
269
  - JudoKit-iOS
270
+ - OpenSSL-Universal
265
271
  - TrustKit
266
272
  - ZappMerchantLib
267
273
 
@@ -319,13 +325,15 @@ EXTERNAL SOURCES:
319
325
 
320
326
  SPEC CHECKSUMS:
321
327
  boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c
322
- DeviceDNA: c3d7ba1669cebf7965407e7022769e5a5eda8c35
328
+ DeviceDNA: 9ff289d1fb983937754b324fa0adade2081210c4
323
329
  DoubleConversion: 5805e889d232975c086db112ece9ed034df7a0b2
324
330
  FBLazyVector: aaeaf388755e4f29cd74acbc9e3b8da6d807c37f
325
331
  FBReactNativeSpec: 118d0d177724c2d67f08a59136eb29ef5943ec75
326
332
  Folly: 30e7936e1c45c08d884aa59369ed951a8e68cf51
327
333
  glog: 1f3da668190260b06b429bb211bfbee5cd790c28
328
- JudoKit-iOS: 434ac818c35ce0fbc7bdd00b93516295d668b496
334
+ Judo3DS2_iOS: c1ccf49ecacddb4559a73fb7eae6e680e2355b21
335
+ JudoKit-iOS: 4a96c63d4cfb45bb1a68a1891b2ebaeaa8a46be1
336
+ OpenSSL-Universal: ee0a7a25f2042782e2df405e66db3e429198e392
329
337
  RCTRequired: b153add4da6e7dbc44aebf93f3cf4fcae392ddf1
330
338
  RCTTypeSafety: 9aa1b91d7f9310fc6eadc3cf95126ffe818af320
331
339
  React: b6a59ef847b2b40bb6e0180a97d0ca716969ac78
@@ -349,6 +357,6 @@ SPEC CHECKSUMS:
349
357
  Yoga: f2a7cd4280bfe2cca5a7aed98ba0eb3d1310f18b
350
358
  ZappMerchantLib: b14bc5814840426d351190309250347ca9b0983d
351
359
 
352
- PODFILE CHECKSUM: 526e525b881d62f956cd5e564abc0967fde91796
360
+ PODFILE CHECKSUM: bd8176c4a34cb7668ac5120fb4a4145962a52c2c
353
361
 
354
- COCOAPODS: 1.10.1
362
+ COCOAPODS: 1.11.3