@qore-id/react-native-qoreid-sdk 1.1.1 → 1.1.3
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/android/build.gradle
CHANGED
|
@@ -92,7 +92,7 @@ dependencies {
|
|
|
92
92
|
// For < 0.71, this will be from the local maven repo
|
|
93
93
|
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
|
|
94
94
|
//noinspection GradleDynamicVersion
|
|
95
|
-
implementation 'com.qoreid:qoreid-sdk
|
|
95
|
+
implementation 'com.qoreid:qoreid-sdk:+'
|
|
96
96
|
// implementation 'com.qoreid:qoreid-sdk-dev-min:1.1.43'
|
|
97
97
|
implementation "com.facebook.react:react-native:+"
|
|
98
98
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
package com.qoreidsdk
|
|
2
2
|
|
|
3
|
-
|
|
4
3
|
import android.app.Activity
|
|
5
4
|
import android.content.Intent
|
|
6
5
|
import android.os.Build
|
|
@@ -18,49 +17,49 @@ import com.qoreid.sdk.core.models.QoreIDResult
|
|
|
18
17
|
import com.qoreid.sdk.core.models.SuccessResult
|
|
19
18
|
import java.util.HashMap
|
|
20
19
|
|
|
21
|
-
|
|
22
20
|
class QoreidSdkModule(val reactContext: ReactApplicationContext) :
|
|
23
|
-
|
|
21
|
+
ReactContextBaseJavaModule(reactContext) {
|
|
24
22
|
private var qoreIdResult: QoreIDResult? = null
|
|
25
23
|
|
|
26
24
|
private val activityEventListener =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
25
|
+
object : BaseActivityEventListener() {
|
|
26
|
+
override fun onActivityResult(
|
|
27
|
+
activity: Activity?,
|
|
28
|
+
requestCode: Int,
|
|
29
|
+
resultCode: Int,
|
|
30
|
+
intent: Intent?
|
|
31
|
+
) {
|
|
32
|
+
|
|
33
|
+
if (resultCode == QORE_ID_RESULT_CODE && intent != null) {
|
|
34
|
+
qoreIdResult =
|
|
35
|
+
if (Build.VERSION.SDK_INT < 33) {
|
|
36
|
+
intent.extras?.getSerializable(QORE_ID_RESULT_EXTRA_KEY) as
|
|
37
|
+
QoreIDResult
|
|
38
|
+
} else {
|
|
39
|
+
intent.extras?.getSerializable(
|
|
40
|
+
QORE_ID_RESULT_EXTRA_KEY,
|
|
41
|
+
QoreIDResult::class.java
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
processQoreIDResult(reactContext, qoreIdResult!!)
|
|
43
45
|
}
|
|
44
|
-
processQoreIDResult(reactContext, qoreIdResult!!)
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
48
|
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
49
|
init {
|
|
52
50
|
reactContext.addActivityEventListener(activityEventListener)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
51
|
+
QoreIDSdk.Callbacks.onFlowRequestId {
|
|
52
|
+
Log.i("QORE_ID", it.toString())
|
|
53
|
+
|
|
54
|
+
val event =
|
|
55
|
+
Arguments.createMap().apply {
|
|
56
|
+
putString("data", it.toString())
|
|
57
|
+
putString("message", "QOREID SDK INITIALIZED")
|
|
58
|
+
putString("event", "SESSION_RESULT")
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
sendEvent(reactContext, "onResult", event)
|
|
62
|
+
}
|
|
64
63
|
}
|
|
65
64
|
|
|
66
65
|
override fun getName(): String {
|
|
@@ -72,87 +71,89 @@ class QoreidSdkModule(val reactContext: ReactApplicationContext) :
|
|
|
72
71
|
val data = readableData.toHashMap()
|
|
73
72
|
|
|
74
73
|
if (currentActivity == null) {
|
|
75
|
-
Log.e("Error", "No current activity")
|
|
74
|
+
Log.e("Error", "No current activity")
|
|
76
75
|
return
|
|
77
76
|
}
|
|
78
77
|
|
|
79
78
|
val config = data?.get("config") as? HashMap<*, *>
|
|
80
79
|
val apD = data?.get("applicantData") as? HashMap<*, *>
|
|
81
|
-
val applicantData =
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
80
|
+
val applicantData =
|
|
81
|
+
ApplicantData(
|
|
82
|
+
apD?.get("firstName") as String,
|
|
83
|
+
apD?.get("lastName") as String,
|
|
84
|
+
apD?.get("phoneNumber") as String?,
|
|
85
|
+
apD?.get("middleName") as String?,
|
|
86
|
+
apD?.get("dob") as String?,
|
|
87
|
+
apD?.get("email") as String?,
|
|
88
|
+
apD?.get("gender") as String?
|
|
89
|
+
)
|
|
90
90
|
|
|
91
91
|
val adD = data?.get("addressData") as? HashMap<*, *>
|
|
92
|
-
val addressData =
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
92
|
+
val addressData =
|
|
93
|
+
AddressData(
|
|
94
|
+
adD?.get("address") as String?,
|
|
95
|
+
adD?.get("city") as String?,
|
|
96
|
+
adD?.get("lga") as String?,
|
|
97
|
+
adD?.get("state") as String?,
|
|
98
|
+
)
|
|
98
99
|
val flowId = config?.get("flowId") as? Double
|
|
99
100
|
|
|
100
|
-
val qoreIDParams =
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
101
|
+
val qoreIDParams =
|
|
102
|
+
if (flowId?.toLong() != 0L) {
|
|
103
|
+
QoreIDParams()
|
|
104
|
+
.clientId(config?.get("clientId") as String)
|
|
105
|
+
.customerReference(config?.get("customerReference") as String)
|
|
106
|
+
.inputData(applicantData, addressData)
|
|
107
|
+
.ocrAcceptedDocuments(data?.get("acceptedDocuments") as List<String>)
|
|
108
|
+
.workflow(flowId!!.toLong())
|
|
109
|
+
// .workflowDefaultIdentity(config?.get("defaultIdType") as
|
|
110
|
+
// String)
|
|
111
|
+
} else {
|
|
112
|
+
QoreIDParams()
|
|
113
|
+
.clientId(config?.get("clientId") as String)
|
|
114
|
+
.customerReference(config?.get("customerReference") as String)
|
|
115
|
+
.inputData(applicantData, addressData)
|
|
116
|
+
.ocrAcceptedDocuments(data?.get("acceptedDocuments") as List<String>)
|
|
117
|
+
.collection(config?.get("productCode") as String)
|
|
118
|
+
}
|
|
116
119
|
|
|
117
|
-
QoreIDSdk.s(BuildConfig.s)
|
|
120
|
+
QoreIDSdk.s(BuildConfig.s)
|
|
118
121
|
QoreIDSdk.params(qoreIDParams)
|
|
119
122
|
QoreIDSdk.launch(requireNotNull(currentActivity))
|
|
120
|
-
|
|
121
123
|
}
|
|
122
124
|
|
|
123
125
|
fun processQoreIDResult(context: ReactContext, qoreIdResult: QoreIDResult) {
|
|
124
126
|
when (qoreIdResult) {
|
|
125
127
|
is ErrorResult -> {
|
|
126
128
|
// Handle error.
|
|
127
|
-
val event =
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
129
|
+
val event =
|
|
130
|
+
Arguments.createMap().apply {
|
|
131
|
+
putString("code", qoreIdResult.code.toString())
|
|
132
|
+
putString("data", qoreIdResult.data.toString())
|
|
133
|
+
putString("message", qoreIdResult.message)
|
|
134
|
+
putString("event", "ERROR_RESULT")
|
|
135
|
+
}
|
|
133
136
|
|
|
134
137
|
sendEvent(context, "onResult", event)
|
|
135
|
-
|
|
136
138
|
}
|
|
137
|
-
|
|
138
139
|
is SuccessResult -> {
|
|
139
140
|
// Handle success.
|
|
140
|
-
val event =
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
141
|
+
val event =
|
|
142
|
+
Arguments.createMap().apply {
|
|
143
|
+
putString("data", qoreIdResult.data.toString())
|
|
144
|
+
putString("message", qoreIdResult.message)
|
|
145
|
+
putString("event", "SUCCESS_RESULT")
|
|
146
|
+
}
|
|
145
147
|
|
|
146
148
|
sendEvent(context, "onResult", event)
|
|
147
149
|
}
|
|
148
150
|
}
|
|
149
151
|
}
|
|
150
152
|
|
|
151
|
-
|
|
152
153
|
private fun sendEvent(reactContext: ReactContext, eventName: String, params: WritableMap?) {
|
|
153
154
|
reactContext
|
|
154
|
-
|
|
155
|
-
|
|
155
|
+
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
156
|
+
.emit(eventName, params)
|
|
156
157
|
}
|
|
157
158
|
|
|
158
159
|
companion object {
|
|
@@ -160,7 +161,7 @@ class QoreidSdkModule(val reactContext: ReactApplicationContext) :
|
|
|
160
161
|
|
|
161
162
|
@JvmStatic
|
|
162
163
|
fun initialize(activity: Activity) {
|
|
163
|
-
QoreIDSdk.initialize(activity)
|
|
164
|
+
QoreIDSdk.initialize(activity)
|
|
164
165
|
}
|
|
165
166
|
}
|
|
166
167
|
}
|
package/ios/QoreidSdk.swift
CHANGED
|
@@ -27,7 +27,9 @@ class QoreidSdk: RCTEventEmitter {
|
|
|
27
27
|
firstname:_applicant?["firstName"] as? String,
|
|
28
28
|
lastname:_applicant?["lastName"] as? String,
|
|
29
29
|
phone: _applicant?["phoneNumber"] as? String,
|
|
30
|
-
middlename: _applicant?["middleName"] as? String
|
|
30
|
+
middlename: _applicant?["middleName"] as? String,
|
|
31
|
+
dob: _applicant?["dob"] as? String,
|
|
32
|
+
email: _applicant?["email"] as? String
|
|
31
33
|
)
|
|
32
34
|
|
|
33
35
|
let addressData = AddressData(
|
|
@@ -69,7 +71,7 @@ class QoreidSdk: RCTEventEmitter {
|
|
|
69
71
|
if let params = param {
|
|
70
72
|
DispatchQueue.main.async {
|
|
71
73
|
let vc = ViewController()
|
|
72
|
-
vc.param =
|
|
74
|
+
vc.param = params
|
|
73
75
|
vc.onQoreIdResult = { [weak self] result in
|
|
74
76
|
self?.onQoreIdResultReceived(result: result)
|
|
75
77
|
}
|
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
|
|
|
16
16
|
|
|
17
17
|
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
18
18
|
s.dependency "React-Core"
|
|
19
|
-
s.dependency 'QoreIDSDK'
|
|
19
|
+
s.dependency 'QoreIDSDK'
|
|
20
20
|
|
|
21
21
|
# Don't install the dependencies when we run `pod install` in the old architecture.
|
|
22
22
|
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
|