judokit-react-native 3.5.0 → 4.0.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 +9 -19
- package/RNJudopay.podspec +1 -1
- package/android/build.gradle +113 -124
- package/android/src/main/java/com/reactlibrary/Helpers.kt +51 -16
- package/ios/.xcode.env +11 -0
- package/ios/Classes/Wrappers/RNWrappers.m +16 -34
- package/ios/Podfile +28 -58
- package/ios/Podfile.lock +418 -209
- package/ios/RNJudo.xcodeproj/project.pbxproj +21 -16
- package/ios/RNJudo.xcodeproj/xcshareddata/xcschemes/RNJudo.xcscheme +1 -1
- package/package.json +29 -25
- package/types/JudoTypes.tsx +9 -6
package/JudoPay.tsx
CHANGED
|
@@ -181,15 +181,15 @@ class JudoPay {
|
|
|
181
181
|
cardholderName: string | undefined | null,
|
|
182
182
|
cardScheme: string
|
|
183
183
|
): Promise<JudoResponse> {
|
|
184
|
-
const params =
|
|
185
|
-
mode,
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
184
|
+
const params = {
|
|
185
|
+
...this.generateTransactionModeParameters(mode, configuration),
|
|
186
|
+
...{
|
|
187
|
+
cardToken,
|
|
188
|
+
securityCode,
|
|
189
|
+
cardholderName,
|
|
190
|
+
cardScheme
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
193
|
return NativeModules.RNJudo.performTokenTransaction(params)
|
|
194
194
|
}
|
|
195
195
|
|
|
@@ -307,16 +307,6 @@ class JudoPay {
|
|
|
307
307
|
}
|
|
308
308
|
}
|
|
309
309
|
|
|
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
310
|
private readonly generateAuthorizationParameters = (): Record<
|
|
321
311
|
string,
|
|
322
312
|
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.1.
|
|
18
|
+
s.dependency "JudoKit-iOS", "3.1.11"
|
|
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.0.1'
|
|
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
|
|
|
@@ -21,6 +21,41 @@ import com.judopay.judokit.android.model.googlepay.GooglePayBillingAddressParame
|
|
|
21
21
|
import com.judopay.judokit.android.model.googlepay.GooglePayEnvironment
|
|
22
22
|
import com.judopay.judokit.android.model.googlepay.GooglePayShippingAddressParameters
|
|
23
23
|
|
|
24
|
+
// For consistency with:
|
|
25
|
+
// https://github.com/Judopay/JudoKit-iOS/blob/master/Source/Models/Response/JPResponse.m#L36
|
|
26
|
+
private const val TRANSACTION_TYPE_PAYMENT = "payment"
|
|
27
|
+
private const val TRANSACTION_TYPE_PRE_AUTH = "preauth"
|
|
28
|
+
private const val TRANSACTION_TYPE_REGISTER = "register"
|
|
29
|
+
private const val TRANSACTION_TYPE_REGISTER_CARD = "registercard"
|
|
30
|
+
private const val TRANSACTION_TYPE_SAVE_CARD = "save"
|
|
31
|
+
private const val TRANSACTION_TYPE_CHECK_CARD = "checkcard"
|
|
32
|
+
|
|
33
|
+
// For consistency with:
|
|
34
|
+
// https://github.com/Judopay/JudoKit-iOS/blob/master/Source/Models/Transaction/JPTransactionType.h#L30
|
|
35
|
+
private enum class TransactionType(val value: Int, val typeAsStrings: List<String>? = null) {
|
|
36
|
+
PAYMENT(1, listOf(TRANSACTION_TYPE_PAYMENT)),
|
|
37
|
+
PRE_AUTH(2, listOf(TRANSACTION_TYPE_PRE_AUTH)),
|
|
38
|
+
REGISTER_CARD(3, listOf(TRANSACTION_TYPE_REGISTER, TRANSACTION_TYPE_REGISTER_CARD)),
|
|
39
|
+
CHECK_CARD(4, listOf(TRANSACTION_TYPE_CHECK_CARD)),
|
|
40
|
+
SAVE_CARD(5, listOf(TRANSACTION_TYPE_SAVE_CARD)),
|
|
41
|
+
UNKNOWN(-1)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// For consistency with:
|
|
45
|
+
// https://github.com/Judopay/JudoKit-iOS/blob/master/Source/Models/Response/JPResponse.m#L32
|
|
46
|
+
private const val STATUS_DECLINED = "declined"
|
|
47
|
+
private const val STATUS_SUCCESS = "success"
|
|
48
|
+
private const val STATUS_ERROR = "error"
|
|
49
|
+
|
|
50
|
+
// For consistency with:
|
|
51
|
+
// https://github.com/Judopay/JudoKit-iOS/blob/abd34bbfe4784fb5f074ed30f93d6743ba295622/Source/Models/Transaction/JPTransactionResult.h#L27
|
|
52
|
+
private enum class TransactionResult(val value: Int, val status: String? = null) {
|
|
53
|
+
ERROR(0, STATUS_ERROR),
|
|
54
|
+
SUCCESS(1, STATUS_SUCCESS),
|
|
55
|
+
DECLINED(2, STATUS_DECLINED),
|
|
56
|
+
UNKNOWN(-1)
|
|
57
|
+
}
|
|
58
|
+
|
|
24
59
|
internal fun getTransactionConfiguration(options: ReadableMap): Judo {
|
|
25
60
|
val widgetType = getTransactionTypeWidget(options)
|
|
26
61
|
return getJudoConfiguration(widgetType, options)
|
|
@@ -50,20 +85,19 @@ internal fun getPaymentMethodsConfiguration(options: ReadableMap): Judo {
|
|
|
50
85
|
}
|
|
51
86
|
|
|
52
87
|
internal fun getMappedType(type: String?): Int {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
"Save" -> 4
|
|
58
|
-
else -> 0
|
|
59
|
-
}
|
|
88
|
+
val typeInLowercase = type?.lowercase()
|
|
89
|
+
val typeValue = TransactionType.values().firstOrNull { it.typeAsStrings?.contains(typeInLowercase) ?: false }
|
|
90
|
+
|
|
91
|
+
return typeValue?.value ?: TransactionType.UNKNOWN.value
|
|
60
92
|
}
|
|
61
93
|
|
|
94
|
+
// consistent with:
|
|
95
|
+
// https://github.com/Judopay/JudoKit-iOS/blob/master/Source/Models/Response/JPResponse.m#L125
|
|
62
96
|
internal fun getMappedResult(result: String?): Int {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
97
|
+
val resultInLowercase = result?.lowercase()
|
|
98
|
+
val resultValue = TransactionResult.values().firstOrNull { it.status == resultInLowercase }
|
|
99
|
+
|
|
100
|
+
return resultValue?.value ?: TransactionResult.UNKNOWN.value
|
|
67
101
|
}
|
|
68
102
|
|
|
69
103
|
internal fun getMappedResult(result: JudoResult?): WritableMap {
|
|
@@ -219,11 +253,12 @@ internal fun getAuthorization(options: ReadableMap): Authorization {
|
|
|
219
253
|
}
|
|
220
254
|
|
|
221
255
|
internal fun getTransactionTypeWidget(options: ReadableMap) = when (options.getInt("transactionType")) {
|
|
222
|
-
1 -> PaymentWidgetType.
|
|
223
|
-
2 -> PaymentWidgetType.
|
|
224
|
-
3 -> PaymentWidgetType.
|
|
225
|
-
4 -> PaymentWidgetType.
|
|
226
|
-
|
|
256
|
+
1 -> PaymentWidgetType.CARD_PAYMENT
|
|
257
|
+
2 -> PaymentWidgetType.PRE_AUTH
|
|
258
|
+
3 -> PaymentWidgetType.REGISTER_CARD
|
|
259
|
+
4 -> PaymentWidgetType.CHECK_CARD
|
|
260
|
+
5 -> PaymentWidgetType.CREATE_CARD_TOKEN
|
|
261
|
+
else -> throw IllegalArgumentException("Unknown transaction type")
|
|
227
262
|
}
|
|
228
263
|
|
|
229
264
|
internal fun getTransactionModeWidget(options: ReadableMap) = when (options.getInt("transactionMode")) {
|
package/ios/.xcode.env
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# This `.xcode.env` file is versioned and is used to source the environment
|
|
2
|
+
# used when running script phases inside Xcode.
|
|
3
|
+
# To customize your local environment, you can create an `.xcode.env.local`
|
|
4
|
+
# file that is not versioned.
|
|
5
|
+
|
|
6
|
+
# NODE_BINARY variable contains the PATH to the node executable.
|
|
7
|
+
#
|
|
8
|
+
# Customize the NODE_BINARY variable here.
|
|
9
|
+
# For example, to use nvm with brew, add the following line
|
|
10
|
+
# . "$(brew --prefix nvm)/nvm.sh" --no-use
|
|
11
|
+
export NODE_BINARY=$(command -v node)
|
|
@@ -86,15 +86,20 @@ static NSString *const kCardSchemeAMEX = @"amex";
|
|
|
86
86
|
+ (JPTransactionType)transactionTypeFromProperties:(NSDictionary *)properties {
|
|
87
87
|
int type = [properties numberForKey:@"transactionType"].intValue;
|
|
88
88
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
89
|
+
switch (type) {
|
|
90
|
+
case 1:
|
|
91
|
+
return JPTransactionTypePayment;
|
|
92
|
+
case 2:
|
|
93
|
+
return JPTransactionTypePreAuth;
|
|
94
|
+
case 3:
|
|
95
|
+
return JPTransactionTypeRegisterCard;
|
|
96
|
+
case 4:
|
|
97
|
+
return JPTransactionTypeCheckCard;
|
|
98
|
+
case 5:
|
|
99
|
+
return JPTransactionTypeSaveCard;
|
|
100
|
+
default:
|
|
101
|
+
return JPTransactionTypeUnknown;
|
|
102
|
+
}
|
|
98
103
|
}
|
|
99
104
|
|
|
100
105
|
+ (JPTransactionMode)transactionModeFromProperties:(NSDictionary *)properties {
|
|
@@ -745,35 +750,12 @@ static NSString *const kCardSchemeAMEX = @"amex";
|
|
|
745
750
|
+ (NSDictionary *)dictionaryFromResponse:(JPResponse *)response {
|
|
746
751
|
|
|
747
752
|
NSMutableDictionary *mappedResponse = [NSMutableDictionary new];
|
|
748
|
-
|
|
749
|
-
// TODO: remove this ASAP when this https://github.com/Judopay/JudoKit-ReactNative/pull/138
|
|
750
|
-
// will go to master (mimics the android wrapper behaviour: https://github.com/Judopay/JudoKit-ReactNative/blob/master/android/src/main/java/com/reactlibrary/Helpers.kt#L57)
|
|
751
|
-
NSNumber *result = @0;
|
|
752
|
-
if (response.result == JPTransactionResultDeclined) {
|
|
753
|
-
result = @1;
|
|
754
|
-
}
|
|
755
|
-
|
|
756
|
-
NSNumber *type = @0;
|
|
757
|
-
|
|
758
|
-
switch (response.type) {
|
|
759
|
-
case JPTransactionTypePreAuth:
|
|
760
|
-
type = @1;
|
|
761
|
-
break;
|
|
762
|
-
case JPTransactionTypeCheckCard:
|
|
763
|
-
type = @3;
|
|
764
|
-
break;
|
|
765
|
-
case JPTransactionTypeSaveCard:
|
|
766
|
-
type = @4;
|
|
767
|
-
break;
|
|
768
|
-
default:
|
|
769
|
-
break;
|
|
770
|
-
}
|
|
771
753
|
|
|
772
754
|
[mappedResponse setValue:response.receiptId forKey:@"receiptId"];
|
|
773
755
|
[mappedResponse setValue:response.paymentReference forKey:@"yourPaymentReference"];
|
|
774
|
-
[mappedResponse setValue
|
|
756
|
+
[mappedResponse setValue:@(response.type) forKey:@"type"];
|
|
775
757
|
[mappedResponse setValue:response.createdAt forKey:@"createdAt"];
|
|
776
|
-
[mappedResponse setValue
|
|
758
|
+
[mappedResponse setValue:@(response.result) forKey:@"result"];
|
|
777
759
|
[mappedResponse setValue:response.message forKey:@"message"];
|
|
778
760
|
[mappedResponse setValue:response.judoId forKey:@"judoId"];
|
|
779
761
|
[mappedResponse setValue:response.merchantName forKey:@"merchantName"];
|
package/ios/Podfile
CHANGED
|
@@ -1,74 +1,44 @@
|
|
|
1
|
+
require_relative '../node_modules/react-native/scripts/react_native_pods'
|
|
1
2
|
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
|
|
2
|
-
platform :ios, '11.0'
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
find = "_currentFrame.CGImage;"
|
|
7
|
-
replace = "_currentFrame.CGImage ;} else { [super displayLayer:layer];"
|
|
8
|
-
op = `sed -ie "s/#{find}/#{replace}/" ../node_modules/react-native/Libraries/Image/RCTUIImageViewAnimated.m`
|
|
9
|
-
puts("Image fix for ios14 done")
|
|
4
|
+
platform :ios, '12.4'
|
|
5
|
+
install! 'cocoapods', :deterministic_uuids => false
|
|
10
6
|
|
|
11
|
-
|
|
12
|
-
find_and_replace("../node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm",
|
|
13
|
-
"_initializeModules:(NSArray<id<RCTBridgeModule>> *)modules", "_initializeModules:(NSArray<Class> *)modules")
|
|
14
|
-
find_and_replace("../node_modules/react-native/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm",
|
|
15
|
-
"RCTBridgeModuleNameForClass(module))", "RCTBridgeModuleNameForClass(Class(module)))")
|
|
16
|
-
end
|
|
7
|
+
production = ENV["PRODUCTION"] == "1"
|
|
17
8
|
|
|
18
9
|
target 'RNJudo' do
|
|
19
|
-
|
|
10
|
+
config = use_native_modules!
|
|
11
|
+
|
|
12
|
+
# Flags change depending on the env values.
|
|
13
|
+
flags = get_default_flags()
|
|
14
|
+
|
|
15
|
+
use_react_native!(
|
|
16
|
+
:path => config[:reactNativePath],
|
|
17
|
+
# to enable hermes on iOS, change `false` to `true` and then install pods
|
|
18
|
+
:production => production,
|
|
19
|
+
:hermes_enabled => flags[:hermes_enabled],
|
|
20
|
+
:fabric_enabled => flags[:fabric_enabled],
|
|
21
|
+
:flipper_configuration => FlipperConfiguration.enabled,
|
|
22
|
+
# An absolute path to your application root.
|
|
23
|
+
:app_path => "#{Pod::Config.instance.installation_root}/.."
|
|
24
|
+
)
|
|
20
25
|
|
|
21
26
|
# Pods for RNJudo
|
|
22
|
-
pod "JudoKit-iOS", "3.1.
|
|
23
|
-
pod "Judo3DS2_iOS", "1.1.3"
|
|
24
|
-
|
|
25
|
-
pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
|
|
26
|
-
pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
|
|
27
|
-
pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
|
|
28
|
-
pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
|
|
29
|
-
pod 'React', :path => '../node_modules/react-native/'
|
|
30
|
-
pod 'React-Core', :path => '../node_modules/react-native/'
|
|
31
|
-
pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
|
|
32
|
-
pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
|
|
33
|
-
pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
|
|
34
|
-
pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
|
|
35
|
-
pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
|
|
36
|
-
pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
|
|
37
|
-
pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
|
|
38
|
-
pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
|
|
39
|
-
pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
|
|
40
|
-
pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
|
|
41
|
-
pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
|
|
42
|
-
pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'
|
|
43
|
-
|
|
44
|
-
pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
|
|
45
|
-
pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
|
|
46
|
-
pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
|
|
47
|
-
pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
|
|
48
|
-
pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
|
|
49
|
-
pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
|
|
50
|
-
pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
|
|
51
|
-
pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
|
|
52
|
-
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
|
|
53
|
-
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
|
|
27
|
+
pod "JudoKit-iOS", "3.1.11"
|
|
54
28
|
|
|
55
29
|
target 'RNJudoTests' do
|
|
30
|
+
inherit! :complete
|
|
31
|
+
requires_app_host = true
|
|
56
32
|
# Pods for testing
|
|
57
33
|
end
|
|
58
34
|
|
|
59
|
-
|
|
60
|
-
|
|
35
|
+
post_install do |installer|
|
|
36
|
+
react_native_post_install(installer)
|
|
37
|
+
__apply_Xcode_12_5_M1_post_install_workaround(installer)
|
|
61
38
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
text = File.read(name)
|
|
66
|
-
replace = text.gsub(findstr,replacestr)
|
|
67
|
-
if text != replace
|
|
68
|
-
puts "Fix: " + name
|
|
69
|
-
File.open(name, "w") { |file| file.puts replace }
|
|
70
|
-
STDOUT.flush
|
|
39
|
+
installer.pods_project.build_configurations.each do |config|
|
|
40
|
+
# https://khushwanttanwar.medium.com/xcode-12-compilation-errors-while-running-with-ios-14-simulators-5731c91326e9
|
|
41
|
+
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
|
|
71
42
|
end
|
|
72
43
|
end
|
|
73
|
-
Dir[dir + '*/'].each(&method(:find_and_replace))
|
|
74
44
|
end
|