judokit-react-native 3.5.0 → 4.1.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 +33 -37
- package/RNJudopay.podspec +1 -1
- package/android/build.gradle +113 -124
- package/android/src/main/java/com/reactlibrary/Extensions.kt +153 -386
- package/android/src/main/java/com/reactlibrary/Helpers.kt +79 -21
- package/ios/.xcode.env +11 -0
- package/ios/Classes/RNJudo.m +1 -1
- package/ios/Classes/Wrappers/RNWrappers.m +23 -34
- package/ios/Podfile +28 -58
- package/ios/Podfile.lock +419 -210
- package/ios/RNJudo.xcodeproj/project.pbxproj +21 -22
- package/ios/RNJudo.xcodeproj/xcshareddata/xcschemes/RNJudo.xcscheme +1 -1
- package/package.json +29 -25
- package/types/JudoGooglePayTypes.tsx +21 -3
- package/types/JudoTypes.tsx +10 -6
package/JudoPay.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { NativeModules } from 'react-native'
|
|
2
2
|
import JudoPBBAButton from './components/JudoPBBAButton'
|
|
3
|
+
import { version as packageVersion } from './package.json'
|
|
3
4
|
|
|
4
5
|
import {
|
|
5
6
|
JudoConfiguration,
|
|
@@ -142,10 +143,10 @@ class JudoPay {
|
|
|
142
143
|
type: JudoTransactionType,
|
|
143
144
|
configuration: JudoConfiguration
|
|
144
145
|
): Promise<JudoResponse> {
|
|
145
|
-
const params =
|
|
146
|
-
type,
|
|
147
|
-
|
|
148
|
-
|
|
146
|
+
const params = {
|
|
147
|
+
...this.generateTransactionTypeParameters(type, configuration),
|
|
148
|
+
packageVersion
|
|
149
|
+
}
|
|
149
150
|
return NativeModules.RNJudo.invokeTransaction(params)
|
|
150
151
|
}
|
|
151
152
|
|
|
@@ -155,7 +156,8 @@ class JudoPay {
|
|
|
155
156
|
const params = {
|
|
156
157
|
authorization: this.generateAuthorizationParameters(),
|
|
157
158
|
sandboxed: this.isSandboxed,
|
|
158
|
-
receiptId
|
|
159
|
+
receiptId,
|
|
160
|
+
packageVersion
|
|
159
161
|
}
|
|
160
162
|
|
|
161
163
|
return NativeModules.RNJudo.fetchTransactionDetails(params)
|
|
@@ -181,15 +183,16 @@ class JudoPay {
|
|
|
181
183
|
cardholderName: string | undefined | null,
|
|
182
184
|
cardScheme: string
|
|
183
185
|
): Promise<JudoResponse> {
|
|
184
|
-
const params =
|
|
185
|
-
mode,
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
186
|
+
const params = {
|
|
187
|
+
...this.generateTransactionModeParameters(mode, configuration),
|
|
188
|
+
...{
|
|
189
|
+
cardToken,
|
|
190
|
+
securityCode,
|
|
191
|
+
cardholderName,
|
|
192
|
+
cardScheme
|
|
193
|
+
},
|
|
194
|
+
packageVersion
|
|
195
|
+
}
|
|
193
196
|
return NativeModules.RNJudo.performTokenTransaction(params)
|
|
194
197
|
}
|
|
195
198
|
|
|
@@ -207,10 +210,10 @@ class JudoPay {
|
|
|
207
210
|
mode: JudoTransactionMode,
|
|
208
211
|
configuration: JudoConfiguration
|
|
209
212
|
): Promise<JudoResponse> {
|
|
210
|
-
const params =
|
|
211
|
-
mode,
|
|
212
|
-
|
|
213
|
-
|
|
213
|
+
const params = {
|
|
214
|
+
...this.generateTransactionModeParameters(mode, configuration),
|
|
215
|
+
packageVersion
|
|
216
|
+
}
|
|
214
217
|
return NativeModules.RNJudo.invokeApplePay(params)
|
|
215
218
|
}
|
|
216
219
|
|
|
@@ -228,10 +231,10 @@ class JudoPay {
|
|
|
228
231
|
mode: JudoTransactionMode,
|
|
229
232
|
configuration: JudoConfiguration
|
|
230
233
|
): Promise<JudoResponse> {
|
|
231
|
-
const params =
|
|
232
|
-
mode,
|
|
233
|
-
|
|
234
|
-
|
|
234
|
+
const params = {
|
|
235
|
+
...this.generateTransactionModeParameters(mode, configuration),
|
|
236
|
+
packageVersion
|
|
237
|
+
}
|
|
235
238
|
return NativeModules.RNJudo.invokeGooglePay(params)
|
|
236
239
|
}
|
|
237
240
|
|
|
@@ -245,7 +248,10 @@ class JudoPay {
|
|
|
245
248
|
public async invokePayByBankApp(
|
|
246
249
|
configuration: JudoConfiguration
|
|
247
250
|
): Promise<JudoResponse> {
|
|
248
|
-
const params =
|
|
251
|
+
const params = {
|
|
252
|
+
...this.generateJudoParameters(configuration),
|
|
253
|
+
packageVersion
|
|
254
|
+
}
|
|
249
255
|
return NativeModules.RNJudo.invokePayByBankApp(params)
|
|
250
256
|
}
|
|
251
257
|
|
|
@@ -262,10 +268,10 @@ class JudoPay {
|
|
|
262
268
|
mode: JudoTransactionMode,
|
|
263
269
|
configuration: JudoConfiguration
|
|
264
270
|
): Promise<JudoResponse> {
|
|
265
|
-
const params =
|
|
266
|
-
mode,
|
|
267
|
-
|
|
268
|
-
|
|
271
|
+
const params = {
|
|
272
|
+
...this.generateTransactionModeParameters(mode, configuration),
|
|
273
|
+
packageVersion
|
|
274
|
+
}
|
|
269
275
|
return NativeModules.RNJudo.invokePaymentMethodScreen(params)
|
|
270
276
|
}
|
|
271
277
|
|
|
@@ -307,16 +313,6 @@ class JudoPay {
|
|
|
307
313
|
}
|
|
308
314
|
}
|
|
309
315
|
|
|
310
|
-
private readonly generateTransactionDetailsParameters = (
|
|
311
|
-
receiptId: string
|
|
312
|
-
): Record<string, any> => {
|
|
313
|
-
return {
|
|
314
|
-
authorization: this.generateAuthorizationParameters(),
|
|
315
|
-
sandboxed: this.isSandboxed,
|
|
316
|
-
receiptId: receiptId
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
|
|
320
316
|
private readonly generateAuthorizationParameters = (): Record<
|
|
321
317
|
string,
|
|
322
318
|
any
|
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", "3.
|
|
18
|
+
s.dependency "JudoKit-iOS", "3.2.2"
|
|
19
19
|
|
|
20
20
|
s.test_spec 'RNJudoTests' do |test_spec|
|
|
21
21
|
test_spec.source_files = 'ios/RNJudoTests/**/*.{h,m}'
|
package/android/build.gradle
CHANGED
|
@@ -1,76 +1,65 @@
|
|
|
1
1
|
apply plugin: 'com.android.library'
|
|
2
|
-
apply plugin: 'jacoco'
|
|
3
|
-
apply plugin: 'maven'
|
|
4
2
|
apply plugin: 'kotlin-android'
|
|
5
|
-
apply plugin: 'kotlin-android-extensions'
|
|
6
3
|
apply plugin: 'de.mannodermaus.android-junit5'
|
|
4
|
+
apply plugin: 'jacoco'
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
def DEFAULT_COMPILE_SDK_VERSION = 31
|
|
11
|
-
def DEFAULT_BUILD_TOOLS_VERSION = "30.0.3"
|
|
6
|
+
def DEFAULT_COMPILE_SDK_VERSION = 33
|
|
12
7
|
def DEFAULT_MIN_SDK_VERSION = 21
|
|
13
|
-
def DEFAULT_TARGET_SDK_VERSION =
|
|
8
|
+
def DEFAULT_TARGET_SDK_VERSION = 33
|
|
9
|
+
|
|
10
|
+
def isNewArchitectureEnabled() {
|
|
11
|
+
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
|
|
12
|
+
}
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
if (isNewArchitectureEnabled()) {
|
|
15
|
+
apply plugin: 'com.facebook.react'
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
def getExtOrIntegerDefault(name, fallback) {
|
|
19
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (fallback).toInteger()
|
|
17
20
|
}
|
|
18
21
|
|
|
19
22
|
buildscript {
|
|
20
|
-
ext.kotlin_version = '1.
|
|
21
|
-
ext.junit5_version = '5.
|
|
23
|
+
ext.kotlin_version = '1.7.20'
|
|
24
|
+
ext.junit5_version = '5.9.1'
|
|
22
25
|
|
|
23
26
|
repositories {
|
|
24
27
|
maven { url 'https://plugins.gradle.org/m2/' }
|
|
25
|
-
|
|
26
|
-
mavenCentral()
|
|
27
28
|
google()
|
|
29
|
+
mavenCentral()
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
dependencies {
|
|
31
|
-
classpath 'com.android.tools.build:gradle:3.
|
|
33
|
+
classpath 'com.android.tools.build:gradle:7.3.1'
|
|
32
34
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
33
|
-
classpath
|
|
34
|
-
classpath 'de.mannodermaus.gradle.plugins:android-junit5:1.7.1.1'
|
|
35
|
+
classpath 'de.mannodermaus.gradle.plugins:android-junit5:1.8.2.1'
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
android {
|
|
39
|
-
compileSdkVersion
|
|
40
|
-
buildToolsVersion safeExtGet('buildToolsVersion', DEFAULT_BUILD_TOOLS_VERSION)
|
|
41
|
-
|
|
42
|
-
compileOptions {
|
|
43
|
-
sourceCompatibility JavaVersion.VERSION_1_8
|
|
44
|
-
targetCompatibility JavaVersion.VERSION_1_8
|
|
45
|
-
}
|
|
40
|
+
compileSdkVersion getExtOrIntegerDefault('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
|
|
46
41
|
|
|
47
42
|
defaultConfig {
|
|
48
|
-
minSdkVersion
|
|
49
|
-
targetSdkVersion
|
|
50
|
-
|
|
51
|
-
versionName "1.0"
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
lintOptions {
|
|
55
|
-
abortOnError false
|
|
43
|
+
minSdkVersion getExtOrIntegerDefault('minSdkVersion', DEFAULT_MIN_SDK_VERSION)
|
|
44
|
+
targetSdkVersion getExtOrIntegerDefault('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION)
|
|
45
|
+
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
|
56
46
|
}
|
|
57
|
-
|
|
58
|
-
testOptions {
|
|
59
|
-
unitTests.returnDefaultValues = true
|
|
60
|
-
}
|
|
61
|
-
packagingOptions {
|
|
62
|
-
exclude 'META-INF/AL2.0'
|
|
63
|
-
exclude 'META-INF/LGPL2.1'
|
|
64
|
-
}
|
|
65
|
-
|
|
66
47
|
buildTypes {
|
|
48
|
+
release {
|
|
49
|
+
minifyEnabled false
|
|
50
|
+
}
|
|
67
51
|
debug {
|
|
68
52
|
testCoverageEnabled true
|
|
69
53
|
}
|
|
70
54
|
}
|
|
71
|
-
|
|
55
|
+
|
|
56
|
+
lintOptions {
|
|
57
|
+
disable 'GradleCompatible'
|
|
58
|
+
}
|
|
59
|
+
|
|
72
60
|
testOptions {
|
|
73
61
|
animationsDisabled = true
|
|
62
|
+
unitTests.returnDefaultValues = true
|
|
74
63
|
unitTests.all {
|
|
75
64
|
jacoco {
|
|
76
65
|
includeNoLocationClasses = true
|
|
@@ -82,26 +71,89 @@ android {
|
|
|
82
71
|
|
|
83
72
|
repositories {
|
|
84
73
|
mavenLocal()
|
|
85
|
-
|
|
86
74
|
mavenCentral()
|
|
87
75
|
google()
|
|
88
76
|
|
|
89
77
|
maven { url 'https://vocalinkzapp.jfrog.io/artifactory/merchant-library-maven/' }
|
|
90
78
|
|
|
91
|
-
|
|
79
|
+
def found = false
|
|
80
|
+
def defaultDir = null
|
|
81
|
+
def androidSourcesName = 'React Native sources'
|
|
82
|
+
|
|
83
|
+
if (rootProject.ext.has('reactNativeAndroidRoot')) {
|
|
84
|
+
defaultDir = rootProject.ext.get('reactNativeAndroidRoot')
|
|
85
|
+
} else {
|
|
86
|
+
defaultDir = new File(
|
|
87
|
+
projectDir,
|
|
88
|
+
'/../../../node_modules/react-native/android'
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (defaultDir.exists()) {
|
|
93
|
+
maven {
|
|
94
|
+
url defaultDir.toString()
|
|
95
|
+
name androidSourcesName
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
logger.info(":${project.name}:reactNativeAndroidRoot ${defaultDir.canonicalPath}")
|
|
99
|
+
found = true
|
|
100
|
+
} else {
|
|
101
|
+
def parentDir = rootProject.projectDir
|
|
102
|
+
|
|
103
|
+
1.upto(5, {
|
|
104
|
+
if (found) return true
|
|
105
|
+
parentDir = parentDir.parentFile
|
|
106
|
+
|
|
107
|
+
def androidSourcesDir = new File(
|
|
108
|
+
parentDir,
|
|
109
|
+
'node_modules/react-native'
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
def androidPrebuiltBinaryDir = new File(
|
|
113
|
+
parentDir,
|
|
114
|
+
'node_modules/react-native/android'
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
if (androidPrebuiltBinaryDir.exists()) {
|
|
118
|
+
maven {
|
|
119
|
+
url androidPrebuiltBinaryDir.toString()
|
|
120
|
+
name androidSourcesName
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
logger.info(":${project.name}:reactNativeAndroidRoot ${androidPrebuiltBinaryDir.canonicalPath}")
|
|
124
|
+
found = true
|
|
125
|
+
} else if (androidSourcesDir.exists()) {
|
|
126
|
+
maven {
|
|
127
|
+
url androidSourcesDir.toString()
|
|
128
|
+
name androidSourcesName
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
logger.info(":${project.name}:reactNativeAndroidRoot ${androidSourcesDir.canonicalPath}")
|
|
132
|
+
found = true
|
|
133
|
+
}
|
|
134
|
+
})
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (!found) {
|
|
138
|
+
throw new GradleException(
|
|
139
|
+
"${project.name}: unable to locate React Native android sources. " +
|
|
140
|
+
"Ensure you have you installed React Native as a dependency in your project and try again."
|
|
141
|
+
)
|
|
142
|
+
}
|
|
92
143
|
}
|
|
93
144
|
|
|
94
145
|
dependencies {
|
|
95
146
|
//noinspection GradleDynamicVersion
|
|
96
147
|
implementation 'com.facebook.react:react-native:+'
|
|
97
|
-
implementation
|
|
98
|
-
|
|
99
|
-
implementation '
|
|
100
|
-
implementation 'androidx.
|
|
101
|
-
implementation
|
|
148
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
149
|
+
|
|
150
|
+
implementation 'androidx.appcompat:appcompat:1.5.1'
|
|
151
|
+
implementation 'androidx.appcompat:appcompat-resources:1.5.1'
|
|
152
|
+
implementation 'com.google.android.gms:play-services-wallet:19.1.0'
|
|
153
|
+
implementation 'androidx.core:core-ktx:1.9.0'
|
|
102
154
|
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0'
|
|
103
155
|
|
|
104
|
-
implementation 'com.judopay:judokit-android:
|
|
156
|
+
implementation 'com.judopay:judokit-android:4.1.0'
|
|
105
157
|
|
|
106
158
|
//JUnit 5
|
|
107
159
|
testImplementation "org.junit.jupiter:junit-jupiter-api:$junit5_version"
|
|
@@ -109,11 +161,19 @@ dependencies {
|
|
|
109
161
|
testImplementation "org.junit.jupiter:junit-jupiter-params:$junit5_version"
|
|
110
162
|
testRuntimeOnly "org.junit.vintage:junit-vintage-engine:$junit5_version"
|
|
111
163
|
|
|
112
|
-
testImplementation 'androidx.test:core:1.
|
|
113
|
-
testImplementation 'io.mockk:mockk:1.
|
|
164
|
+
testImplementation 'androidx.test:core:1.5.0'
|
|
165
|
+
testImplementation 'io.mockk:mockk:1.13.3'
|
|
114
166
|
testImplementation 'android.arch.core:core-testing:1.1.1'
|
|
115
167
|
}
|
|
116
168
|
|
|
169
|
+
if (isNewArchitectureEnabled()) {
|
|
170
|
+
react {
|
|
171
|
+
jsRootDir = file("../src/")
|
|
172
|
+
libraryName = "JudoKit-ReactNative"
|
|
173
|
+
codegenJavaPackageName = "com.reactlibrary"
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
117
177
|
task generateCodeAnalysisReport {
|
|
118
178
|
group 'Reporting'
|
|
119
179
|
description 'Start reporting code analysis tasks (Jacoco)'
|
|
@@ -122,77 +182,6 @@ task generateCodeAnalysisReport {
|
|
|
122
182
|
|
|
123
183
|
task jacocoTestReport(type: JacocoReport, group: 'verification', description: 'Generate Jacoco Reports for all android variants')
|
|
124
184
|
|
|
125
|
-
def configureReactNativePom(def pom) {
|
|
126
|
-
def packageJson = new JsonSlurper().parseText(file('../package.json').text)
|
|
127
|
-
|
|
128
|
-
pom.project {
|
|
129
|
-
name packageJson.title
|
|
130
|
-
artifactId packageJson.name
|
|
131
|
-
version = packageJson.version
|
|
132
|
-
group = "com.reactlibrary"
|
|
133
|
-
description packageJson.description
|
|
134
|
-
url packageJson.repository.baseUrl
|
|
135
|
-
|
|
136
|
-
licenses {
|
|
137
|
-
license {
|
|
138
|
-
name packageJson.license
|
|
139
|
-
url packageJson.repository.baseUrl + '/blob/master/' + packageJson.licenseFilename
|
|
140
|
-
distribution 'repo'
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
developers {
|
|
145
|
-
developer {
|
|
146
|
-
id packageJson.author.username
|
|
147
|
-
name packageJson.author.name
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
afterEvaluate { project ->
|
|
154
|
-
|
|
155
|
-
task androidJavadoc(type: Javadoc) {
|
|
156
|
-
source = android.sourceSets.main.java.srcDirs
|
|
157
|
-
classpath += files(android.bootClasspath)
|
|
158
|
-
classpath += files(project.getConfigurations().getByName('compile').asList())
|
|
159
|
-
include '**/*.java'
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) {
|
|
163
|
-
classifier = 'javadoc'
|
|
164
|
-
from androidJavadoc.destinationDir
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
task androidSourcesJar(type: Jar) {
|
|
168
|
-
classifier = 'sources'
|
|
169
|
-
from android.sourceSets.main.java.srcDirs
|
|
170
|
-
include '**/*.java'
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
android.libraryVariants.all { variant ->
|
|
174
|
-
def name = variant.name.capitalize()
|
|
175
|
-
task "jar${name}"(type: Jar, dependsOn: variant.javaCompileProvider.get()) {
|
|
176
|
-
from variant.javaCompileProvider.get().destinationDir
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
artifacts {
|
|
181
|
-
archives androidSourcesJar
|
|
182
|
-
archives androidJavadocJar
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
task installArchives(type: Upload) {
|
|
186
|
-
configuration = configurations.archives
|
|
187
|
-
repositories.mavenDeployer {
|
|
188
|
-
// Deploy to react-native-event-bridge/maven, ready to publish to npm
|
|
189
|
-
repository url: "file://${projectDir}/../android/maven"
|
|
190
|
-
|
|
191
|
-
configureReactNativePom pom
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
185
|
project.afterEvaluate {
|
|
197
186
|
def variants = android.hasProperty('libraryVariants') ? android.libraryVariants : android.applicationVariants
|
|
198
187
|
variants.forEach {
|
|
@@ -235,7 +224,7 @@ def addJacocoTask(variant) {
|
|
|
235
224
|
sourceDirectories.from(files(variant.sourceSets.kotlin.srcDirs.flatten()))
|
|
236
225
|
def kotlinTask = tasks.getByName("compile${variantName}Kotlin")
|
|
237
226
|
if (kotlinTask) {
|
|
238
|
-
classDirectories += fileTree(dir: kotlinTask.
|
|
227
|
+
classDirectories += fileTree(dir: kotlinTask.destinationDirectory, excludes: excludedFiles)
|
|
239
228
|
}
|
|
240
229
|
}
|
|
241
230
|
|