judokit-react-native 5.0.0 → 5.0.2

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.
@@ -15,7 +15,7 @@ Pod::Spec.new do |s|
15
15
  s.source = { :git => "https://github.com/Judopay/JudoKit-ReactNative.git", :tag => "#{s.version}" }
16
16
 
17
17
  s.source_files = "ios/**/*.{h,m,mm}"
18
- s.dependency "JudoKit-iOS", "5.0.2"
18
+ s.dependency "JudoKit-iOS", "5.0.3"
19
19
 
20
20
  # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
21
21
  # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
package/README.md CHANGED
@@ -29,7 +29,7 @@ judoKit
29
29
  .invokeTransaction(JudoTransactionType.Payment, {
30
30
  judoId: '123456',
31
31
  amount: {
32
- value: '1.5',
32
+ value: '1.50',
33
33
  currency: 'GBP',
34
34
  },
35
35
  reference: {
@@ -69,7 +69,7 @@ const judoKit = new JudoPay(authorization);
69
69
 
70
70
  function App(): React.JSX.Element {
71
71
  const invokeJudoKit = () => {
72
- const amount: JudoAmount = {value: '1.5', currency: 'GBP'};
72
+ const amount: JudoAmount = {value: '1.50', currency: 'GBP'};
73
73
  const reference: JudoReference = {
74
74
  paymentReference: 'your-payment-reference',
75
75
  consumerReference: 'your-consumer-reference',
@@ -3,4 +3,4 @@ JudoKitReactNative_minSdkVersion=24
3
3
  JudoKitReactNative_targetSdkVersion=35
4
4
  JudoKitReactNative_compileSdkVersion=35
5
5
  JudoKitReactNative_ndkversion=27.1.12297006
6
- JudoKitReactNative_judoKitAndroidVersion=5.0.2
6
+ JudoKitReactNative_judoKitAndroidVersion=5.0.3
@@ -45,10 +45,14 @@ import com.judopay.judokit.android.model.typeId
45
45
  private const val TRANSACTION_TYPE_PAYMENT = "payment"
46
46
  private const val TRANSACTION_TYPE_PRE_AUTH = "preauth"
47
47
 
48
- @Deprecated("Register Card functionality has been deprecated. Please use Check Card feature instead.")
48
+ @Deprecated(
49
+ "Register Card functionality has been deprecated. Please use Check Card feature instead.",
50
+ )
49
51
  private const val TRANSACTION_TYPE_REGISTER = "register"
50
52
 
51
- @Deprecated("Register Card functionality has been deprecated. Please use Check Card feature instead.")
53
+ @Deprecated(
54
+ "Register Card functionality has been deprecated. Please use Check Card feature instead.",
55
+ )
52
56
  private const val TRANSACTION_TYPE_REGISTER_CARD = "registercard"
53
57
  private const val TRANSACTION_TYPE_SAVE_CARD = "save"
54
58
  private const val TRANSACTION_TYPE_CHECK_CARD = "checkcard"
@@ -123,7 +127,9 @@ internal fun getPaymentMethodsConfiguration(options: ReadableMap): Judo {
123
127
  internal fun getMappedType(type: String?): Int {
124
128
  val typeInLowercase = type?.lowercase()
125
129
  val typeValue =
126
- TransactionType.values().firstOrNull { it.typeAsStrings?.contains(typeInLowercase) ?: false }
130
+ TransactionType.values().firstOrNull {
131
+ it.typeAsStrings?.contains(typeInLowercase) ?: false
132
+ }
127
133
 
128
134
  return typeValue?.value ?: TransactionType.UNKNOWN.value
129
135
  }
@@ -187,11 +193,7 @@ internal fun getJudoConfigurationForApiService(options: ReadableMap): Judo {
187
193
  .setCurrency(Currency.GBP)
188
194
  .build()
189
195
 
190
- val reference =
191
- Reference
192
- .Builder()
193
- .setConsumerReference("reference")
194
- .build()
196
+ val reference = Reference.Builder().setConsumerReference("reference").build()
195
197
 
196
198
  return Judo
197
199
  .Builder(PaymentWidgetType.CARD_PAYMENT)
@@ -231,7 +233,6 @@ internal fun getJudoConfiguration(
231
233
  .setReference(reference)
232
234
  .setSupportedCardNetworks(cardNetworks)
233
235
  .setPaymentMethods(paymentMethods)
234
- .setUiConfiguration(uiConfiguration)
235
236
  .setPrimaryAccountDetails(primaryAccountDetails)
236
237
  .setGooglePayConfiguration(googlePayConfiguration)
237
238
  .setInitialRecurringPayment(options.isInitialRecurringPayment)
@@ -248,6 +249,10 @@ internal fun getJudoConfiguration(
248
249
  .setAddress(address)
249
250
  .setSubProductInfo(getSubProductInfo(options))
250
251
 
252
+ if (uiConfiguration != null) {
253
+ builder.setUiConfiguration(uiConfiguration)
254
+ }
255
+
251
256
  if (type.isTokenPayment) {
252
257
  val cardHolderName = options.cardholderName?.ifBlank { null }
253
258
  val securityCode = options.securityCode?.ifBlank { null }
@@ -273,7 +278,9 @@ internal fun getJudoConfiguration(
273
278
  }
274
279
 
275
280
  internal fun getRecommendationConfiguration(options: ReadableMap): RecommendationConfiguration? =
276
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1 && options.recommendationConfiguration != null) {
281
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1 &&
282
+ options.recommendationConfiguration != null
283
+ ) {
277
284
  RecommendationConfiguration
278
285
  .Builder()
279
286
  .setUrl(options.recommendationURL)
@@ -315,7 +322,9 @@ internal fun getNetworkTimeout(options: ReadableMap): NetworkTimeout? {
315
322
  }
316
323
 
317
324
  internal fun getChallengeRequestIndicator(options: ReadableMap): ChallengeRequestIndicator? =
318
- ChallengeRequestIndicator.values().firstOrNull { it.value == options.challengeRequestIndicator }
325
+ ChallengeRequestIndicator.values().firstOrNull {
326
+ it.value == options.challengeRequestIndicator
327
+ }
319
328
 
320
329
  internal fun getScaExemption(options: ReadableMap): ScaExemption? = ScaExemption.values().firstOrNull { it.value == options.scaExemption }
321
330
 
@@ -385,9 +394,7 @@ internal fun getReference(options: ReadableMap): Reference? {
385
394
  val metadataMap = options.metadata
386
395
  metadataMap?.let {
387
396
  val bundle = Bundle()
388
- metadataMap.toHashMap().forEach {
389
- bundle.putString(it.key, it.value.toString())
390
- }
397
+ metadataMap.toHashMap().forEach { bundle.putString(it.key, it.value.toString()) }
391
398
  builder = builder.setMetaData(bundle)
392
399
  }
393
400
 
@@ -493,7 +500,9 @@ internal fun getUIConfiguration(options: ReadableMap): UiConfiguration? {
493
500
  options.isAVSEnabled?.let { setAvsEnabled(it) }
494
501
  options.shouldPaymentMethodsDisplayAmount?.let { setShouldPaymentMethodsDisplayAmount(it) }
495
502
  options.shouldPaymentButtonDisplayAmount?.let { setShouldPaymentButtonDisplayAmount(it) }
496
- options.shouldPaymentMethodsVerifySecurityCode?.let { setShouldPaymentMethodsVerifySecurityCode(it) }
503
+ options.shouldPaymentMethodsVerifySecurityCode?.let {
504
+ setShouldPaymentMethodsVerifySecurityCode(it)
505
+ }
497
506
  }
498
507
 
499
508
  return builder.build()
@@ -0,0 +1,13 @@
1
+ package com.judopay.judokit.reactnative
2
+
3
+ import com.facebook.react.ReactPackage
4
+ import com.facebook.react.bridge.NativeModule
5
+ import com.facebook.react.bridge.ReactApplicationContext
6
+ import com.facebook.react.uimanager.ViewManager
7
+
8
+ class JudoKitReactNativePackage : ReactPackage {
9
+ override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> =
10
+ listOf(JudoKitReactNativeModule(reactContext))
11
+
12
+ override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> = emptyList()
13
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "judokit-react-native",
3
- "version": "5.0.0",
3
+ "version": "5.0.2",
4
4
  "description": "A React Native module for the Judopay native SDKs to process payments on iOS and Android.",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -86,7 +86,7 @@
86
86
  "workspaces": [
87
87
  "example"
88
88
  ],
89
- "packageManager": "yarn@4.9.2",
89
+ "packageManager": "yarn@4.9.4",
90
90
  "engines": {
91
91
  "node": ">= 18.0.0"
92
92
  },