@qore-id/react-native-qoreid-sdk 1.2.2 → 1.2.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.
|
@@ -22,6 +22,7 @@ import com.qoreid.sdk.core.models.AddressData
|
|
|
22
22
|
import com.qoreid.sdk.core.models.ApplicantData
|
|
23
23
|
import com.qoreid.sdk.core.models.ErrorResult
|
|
24
24
|
import com.qoreid.sdk.core.models.QoreIDResult
|
|
25
|
+
import com.qoreid.sdk.core.models.ResultData
|
|
25
26
|
import com.qoreid.sdk.core.models.SuccessResult
|
|
26
27
|
import com.qoreid.sdk.core.models.VerificationExtraData
|
|
27
28
|
|
|
@@ -155,7 +156,7 @@ class QoreidSdkModule(context: ReactApplicationContext) :
|
|
|
155
156
|
val event =
|
|
156
157
|
Arguments.createMap().apply {
|
|
157
158
|
putString("code", qoreIdResult.code.toString())
|
|
158
|
-
|
|
159
|
+
putMap("data", parseData(qoreIdResult.data))
|
|
159
160
|
putString("message", qoreIdResult.message)
|
|
160
161
|
putString("event", "ERROR_RESULT")
|
|
161
162
|
}
|
|
@@ -167,7 +168,7 @@ class QoreidSdkModule(context: ReactApplicationContext) :
|
|
|
167
168
|
// Handle success.
|
|
168
169
|
val event =
|
|
169
170
|
Arguments.createMap().apply {
|
|
170
|
-
|
|
171
|
+
putMap("data", parseData(qoreIdResult.data))
|
|
171
172
|
putString("message", qoreIdResult.message)
|
|
172
173
|
putString("event", "SUCCESS_RESULT")
|
|
173
174
|
}
|
|
@@ -177,6 +178,28 @@ class QoreidSdkModule(context: ReactApplicationContext) :
|
|
|
177
178
|
}
|
|
178
179
|
}
|
|
179
180
|
|
|
181
|
+
private fun parseData(data: ResultData?): ReadableMap {
|
|
182
|
+
val dataMap = Arguments.createMap()
|
|
183
|
+
|
|
184
|
+
// Adding verification object
|
|
185
|
+
val verificationMap = Arguments.createMap().apply {
|
|
186
|
+
putString("id", data?.verification?.id.toString())
|
|
187
|
+
putString("status", data?.verification?.status?.state)
|
|
188
|
+
putString("state", data?.verification?.status?.state)
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// Populating the main map
|
|
192
|
+
dataMap.apply {
|
|
193
|
+
putString("customerReference", data?.customerReference)
|
|
194
|
+
putString("productCode", data?.productCode)
|
|
195
|
+
putString("flowId", data?.flowId.toString())
|
|
196
|
+
putMap("verification", verificationMap) // Nested map
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
return dataMap
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
|
|
180
203
|
private fun sendEvent(
|
|
181
204
|
reactContext: ReactApplicationContext,
|
|
182
205
|
eventName: String,
|