judokit-react-native 3.3.6 → 3.3.9

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 CHANGED
@@ -107,6 +107,18 @@ class JudoPay {
107
107
  return NativeModules.RNJudo.isBankingAppAvailable()
108
108
  }
109
109
 
110
+ /**
111
+ * A method used to verify if ApplePay is supported for given configuration object
112
+ *
113
+ * This needs to be invoked before invoking ApplePay transactions.
114
+ *
115
+ * @returns an asynchronous boolean value that indicates if ApplePay is available.
116
+ */
117
+ public isApplePayAvailableWithConfiguration(configuration: JudoConfiguration): Promise<boolean> {
118
+ const params = this.generateJudoParameters(configuration)
119
+ return NativeModules.RNJudo.isApplePayAvailableWithConfiguration(params)
120
+ }
121
+
110
122
  /**
111
123
  * A method for invoking the Judo UI for card transactions.
112
124
  * Supported operations - payments, pre-auths, register card, save card, check card.
@@ -201,7 +213,7 @@ class JudoPay {
201
213
  public async invokePayByBankApp(
202
214
  configuration: JudoConfiguration
203
215
  ): Promise<JudoResponse> {
204
- const params = this.generatePayByBankAppParameters(configuration)
216
+ const params = this.generateJudoParameters(configuration)
205
217
  return NativeModules.RNJudo.invokePayByBankApp(params)
206
218
  }
207
219
 
@@ -229,7 +241,7 @@ class JudoPay {
229
241
  // Private helper methods
230
242
  //------------------------------------------------------------------
231
243
 
232
- private readonly generatePayByBankAppParameters = (
244
+ private readonly generateJudoParameters = (
233
245
  configuration: JudoConfiguration
234
246
  ): Record<string, any> => {
235
247
  return {
package/README.md CHANGED
@@ -46,15 +46,23 @@ JudoPay's React Native module and sample app. This module is a wrapper around th
46
46
  }
47
47
  ```
48
48
 
49
+ - Make sure that you use Android Gradle plugin version 4.0.1+ in your `android/build.gradle`:
50
+
51
+ ```
52
+ dependencies {
53
+ classpath 'com.android.tools.build:gradle:4.0.1'
54
+ }
55
+ ```
56
+
49
57
  - Add the Judopay maven repository to `allprojects / repositories` in your `android/build.gradle`:
50
58
 
51
59
  ```
52
60
  allprojects {
53
61
  repositories {
54
62
  mavenLocal()
63
+
64
+ mavenCentral()
55
65
  google()
56
- jcenter()
57
- maven { url 'https://jitpack.io' }
58
66
  maven {
59
67
  // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
60
68
  url("$rootDir/../node_modules/react-native/android")
package/RNJudopay.podspec CHANGED
@@ -15,7 +15,7 @@ Pod::Spec.new do |s|
15
15
  s.source_files = "ios/Classes/**/*.{h,m}"
16
16
  s.requires_arc = true
17
17
  s.dependency "React"
18
- s.dependency "JudoKit-iOS", "2.4.3"
18
+ s.dependency "JudoKit-iOS", "2.4.6"
19
19
 
20
20
  s.test_spec 'RNJudoTests' do |test_spec|
21
21
  test_spec.source_files = 'ios/RNJudoTests/**/*.{h,m}'
@@ -7,37 +7,32 @@ apply plugin: 'de.mannodermaus.android-junit5'
7
7
 
8
8
  import groovy.json.JsonSlurper
9
9
 
10
- def DEFAULT_COMPILE_SDK_VERSION = 29
11
- def DEFAULT_BUILD_TOOLS_VERSION = "29.0.3"
10
+ def DEFAULT_COMPILE_SDK_VERSION = 31
11
+ def DEFAULT_BUILD_TOOLS_VERSION = "30.0.3"
12
12
  def DEFAULT_MIN_SDK_VERSION = 19
13
- def DEFAULT_TARGET_SDK_VERSION = 29
13
+ def DEFAULT_TARGET_SDK_VERSION = 31
14
14
 
15
15
  def safeExtGet(prop, fallback) {
16
16
  rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
17
17
  }
18
18
 
19
19
  buildscript {
20
- ext.kotlin_version = '1.3.72'
20
+ ext.kotlin_version = '1.6.10'
21
21
  ext.junit5_version = '5.7.0'
22
22
 
23
23
  repositories {
24
+ maven { url 'https://plugins.gradle.org/m2/' }
25
+
26
+ mavenCentral()
24
27
  google()
25
- jcenter()
26
28
  }
27
29
 
28
30
  dependencies {
29
- classpath 'com.android.tools.build:gradle:3.5.2'
31
+ classpath 'com.android.tools.build:gradle:3.5.4'
30
32
  classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
31
33
  classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
32
- classpath 'de.mannodermaus.gradle.plugins:android-junit5:1.7.0.0'
33
- }
34
-
35
- allprojects {
36
- repositories {
37
- maven { url "http://pay.cards/maven" }
38
- }
34
+ classpath 'de.mannodermaus.gradle.plugins:android-junit5:1.7.1.1'
39
35
  }
40
-
41
36
  }
42
37
 
43
38
  android {
@@ -86,9 +81,10 @@ android {
86
81
  }
87
82
 
88
83
  repositories {
84
+ mavenLocal()
85
+
89
86
  mavenCentral()
90
87
  google()
91
- jcenter()
92
88
 
93
89
  maven { url "$projectDir/../node_modules/react-native/android" }
94
90
  }
@@ -96,14 +92,14 @@ repositories {
96
92
  dependencies {
97
93
  //noinspection GradleDynamicVersion
98
94
  implementation 'com.facebook.react:react-native:+'
99
- implementation 'androidx.appcompat:appcompat:1.1.0'
100
- implementation 'androidx.appcompat:appcompat-resources:1.1.0'
95
+ implementation 'androidx.appcompat:appcompat:1.4.1'
96
+ implementation 'androidx.appcompat:appcompat-resources:1.4.1'
101
97
  implementation 'com.google.android.gms:play-services-wallet:18.0.0'
102
- implementation 'androidx.core:core-ktx:1.3.0'
98
+ implementation 'androidx.core:core-ktx:1.7.0'
103
99
  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
104
- implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
100
+ implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0'
105
101
 
106
- implementation 'com.judopay:judokit-android:2.1.5'
102
+ implementation 'com.judopay:judokit-android:2.1.10'
107
103
 
108
104
  //JUnit 5
109
105
  testImplementation "org.junit.jupiter:junit-jupiter-api:$junit5_version"
@@ -111,7 +107,7 @@ dependencies {
111
107
  testImplementation "org.junit.jupiter:junit-jupiter-params:$junit5_version"
112
108
  testRuntimeOnly "org.junit.vintage:junit-vintage-engine:$junit5_version"
113
109
 
114
- testImplementation 'androidx.test:core:1.2.0'
110
+ testImplementation 'androidx.test:core:1.4.0'
115
111
  testImplementation 'io.mockk:mockk:1.10.0'
116
112
  testImplementation 'android.arch.core:core-testing:1.1.1'
117
113
  }
@@ -174,8 +170,8 @@ afterEvaluate { project ->
174
170
 
175
171
  android.libraryVariants.all { variant ->
176
172
  def name = variant.name.capitalize()
177
- task "jar${name}"(type: Jar, dependsOn: variant.javaCompile) {
178
- from variant.javaCompile.destinationDir
173
+ task "jar${name}"(type: Jar, dependsOn: variant.javaCompileProvider.get()) {
174
+ from variant.javaCompileProvider.get().destinationDir
179
175
  }
180
176
  }
181
177
 
@@ -1,6 +1,7 @@
1
1
  package com.reactlibrary
2
2
 
3
3
  import android.app.Activity
4
+ import android.app.Activity.RESULT_CANCELED
4
5
  import android.content.Intent
5
6
  import com.facebook.react.bridge.BaseActivityEventListener
6
7
  import com.facebook.react.bridge.Promise
@@ -17,25 +18,29 @@ class JudoReactNativeActivityEventListener : BaseActivityEventListener() {
17
18
  internal var transactionPromise: Promise? = null
18
19
 
19
20
  override fun onActivityResult(
20
- activity: Activity,
21
+ activity: Activity?,
21
22
  requestCode: Int,
22
23
  resultCode: Int,
23
- data: Intent
24
+ data: Intent?
24
25
  ) {
25
26
 
26
- if (requestCode != JUDO_PAYMENT_WIDGET_REQUEST_CODE) {
27
+ if (data == null || resultCode == RESULT_CANCELED || requestCode != JUDO_PAYMENT_WIDGET_REQUEST_CODE) {
27
28
  return
28
29
  }
29
30
 
30
- when (resultCode) {
31
- PAYMENT_ERROR, PAYMENT_CANCELLED -> {
32
- val error = data.getParcelableExtra<JudoError>(JUDO_ERROR)
33
- transactionPromise?.reject(JUDO_PROMISE_REJECTION_CODE, error?.message)
34
- }
35
- PAYMENT_SUCCESS -> {
36
- val result = data.getParcelableExtra<JudoResult>(JUDO_RESULT)
37
- transactionPromise?.resolve(getMappedResult(result))
31
+ try {
32
+ when (resultCode) {
33
+ PAYMENT_ERROR, PAYMENT_CANCELLED -> {
34
+ val error = data.getParcelableExtra<JudoError>(JUDO_ERROR)
35
+ transactionPromise?.reject(JUDO_PROMISE_REJECTION_CODE, error?.message)
36
+ }
37
+ PAYMENT_SUCCESS -> {
38
+ val result = data.getParcelableExtra<JudoResult>(JUDO_RESULT)
39
+ transactionPromise?.resolve(getMappedResult(result))
40
+ }
38
41
  }
42
+ } catch (throwable: Throwable) {
43
+ transactionPromise?.reject(JUDO_PROMISE_REJECTION_CODE, throwable.message)
39
44
  }
40
45
 
41
46
  transactionPromise = null
@@ -29,7 +29,7 @@ import retrofit2.Call
29
29
  import retrofit2.Callback
30
30
  import retrofit2.Response
31
31
 
32
- const val JUDO_PAYMENT_WIDGET_REQUEST_CODE = 1
32
+ const val JUDO_PAYMENT_WIDGET_REQUEST_CODE = 65520
33
33
  const val JUDO_PROMISE_REJECTION_CODE = "JUDO_ERROR"
34
34
 
35
35
  class JudoReactNativeModule internal constructor(val context: ReactApplicationContext) :
@@ -144,6 +144,9 @@ class JudoReactNativeModule internal constructor(val context: ReactApplicationCo
144
144
  is JudoPaymentResult.Error -> {
145
145
  promise.reject(JUDO_PROMISE_REJECTION_CODE, data.error.message)
146
146
  }
147
+ else -> {
148
+ // noop
149
+ }
147
150
  }
148
151
  }
149
152
  }
@@ -1,17 +1,17 @@
1
1
  package com.reactlibrary
2
2
 
3
+ import android.widget.Button
3
4
  import com.facebook.react.uimanager.SimpleViewManager
4
5
  import com.facebook.react.uimanager.ThemedReactContext
5
- import com.judopay.judokit.android.ui.common.PayByBankButton
6
6
 
7
- class JudoReactNativePBBAManager: SimpleViewManager<PayByBankButton>() {
7
+ class JudoReactNativePBBAManager: SimpleViewManager<Button>() {
8
8
 
9
9
  override fun getName(): String {
10
10
  return "RNPBBAButton"
11
11
  }
12
12
 
13
- override fun createViewInstance(reactContext: ThemedReactContext): PayByBankButton {
14
- return PayByBankButton(reactContext)
13
+ override fun createViewInstance(reactContext: ThemedReactContext): Button {
14
+ return Button(reactContext)
15
15
  }
16
16
 
17
17
  }
@@ -62,6 +62,15 @@ RCT_REMAP_METHOD(isBankingAppAvailable,
62
62
  resolve(boolValue);
63
63
  }
64
64
 
65
+ RCT_REMAP_METHOD(isApplePayAvailableWithConfiguration,
66
+ properties:(NSDictionary *)properties
67
+ isApplePayAvailableWithResolver:(RCTPromiseResolveBlock)resolve
68
+ rejecter:(RCTPromiseRejectBlock)reject) {
69
+ JPConfiguration *configuration = [RNWrappers configurationFromProperties:properties];
70
+ NSNumber *boolValue = [NSNumber numberWithBool:[JudoKit isApplePayAvailableWithConfiguration:configuration]];
71
+ resolve(boolValue);
72
+ }
73
+
65
74
  RCT_REMAP_METHOD(invokeTransaction,
66
75
  properties:(NSDictionary *)properties
67
76
  invokePaymentWithResolver:(RCTPromiseResolveBlock)resolve
package/ios/Podfile CHANGED
@@ -7,7 +7,7 @@ pre_install do |installer|
7
7
  replace = "_currentFrame.CGImage ;} else { [super displayLayer:layer];"
8
8
  op = `sed -ie "s/#{find}/#{replace}/" ../node_modules/react-native/Libraries/Image/RCTUIImageViewAnimated.m`
9
9
  puts("Image fix for ios14 done")
10
-
10
+
11
11
  ## Fix for XCode 12.5
12
12
  find_and_replace("../node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm",
13
13
  "_initializeModules:(NSArray<id<RCTBridgeModule>> *)modules", "_initializeModules:(NSArray<Class> *)modules")
@@ -19,7 +19,7 @@ target 'RNJudo' do
19
19
  use_frameworks!
20
20
 
21
21
  # Pods for RNJudo
22
- pod "JudoKit-iOS", "2.4.1"
22
+ pod "JudoKit-iOS", "2.4.6"
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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "judokit-react-native",
3
3
  "title": "Judopay React Native Module",
4
- "version": "3.3.6",
4
+ "version": "3.3.9",
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": {