@finos_sdk/sdk-ekyc 1.2.2 → 1.2.8
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/LICENSE +13 -10
- package/README.md +41 -42
- package/android/build.gradle +42 -11
- package/android/gradle.properties +7 -1
- package/android/settings.gradle +53 -0
- package/android/src/main/java/finos/sdk/ekyc/EKYCModule.kt +778 -81
- package/dist/EKYCModule.d.ts +72 -0
- package/dist/EKYCModule.js +650 -71
- package/dist/finos_sdk-sdk-ekyc-1.2.8.tgz +0 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.js +5 -1
- package/dist/package.json +31 -21
- package/dist/src/modules/FinosEKYCModule.d.ts +144 -0
- package/dist/src/modules/FinosEKYCModule.js +468 -2
- package/dist/src/modules/FinosESignModule.d.ts +270 -0
- package/dist/src/modules/FinosESignModule.js +752 -0
- package/dist/src/types/ekycESignType.d.ts +67 -0
- package/dist/src/types/ekycESignType.js +2 -0
- package/dist/src/types/ekycSmsOtpType.d.ts +52 -0
- package/dist/src/types/ekycSmsOtpType.js +2 -0
- package/package.json +31 -21
- package/src/modules/FinosEKYCModule.ts +554 -2
- package/src/modules/FinosESignModule.ts +919 -0
- package/src/modules/README.md +3 -3
- package/src/types/ekycESignType.ts +76 -0
- package/src/types/ekycSmsOtpType.ts +59 -0
- package/android/SDKeKYC/finos/sdk/ekyc/c06/1.2.2/c06-1.2.2-sources.jar +0 -0
- package/android/SDKeKYC/finos/sdk/ekyc/c06/1.2.2/c06-1.2.2.aar +0 -0
- package/android/SDKeKYC/finos/sdk/ekyc/c06/1.2.2/c06-1.2.2.module +0 -110
- package/android/SDKeKYC/finos/sdk/ekyc/c06/1.2.2/c06-1.2.2.pom +0 -37
- package/android/SDKeKYC/finos/sdk/ekyc/c06/maven-metadata-local.xml +0 -13
- package/android/SDKeKYC/finos/sdk/ekyc/ekyc/1.2.2/ekyc-1.2.2-sources.jar +0 -0
- package/android/SDKeKYC/finos/sdk/ekyc/ekyc/1.2.2/ekyc-1.2.2.aar +0 -0
- package/android/SDKeKYC/finos/sdk/ekyc/ekyc/1.2.2/ekyc-1.2.2.module +0 -201
- package/android/SDKeKYC/finos/sdk/ekyc/ekyc/1.2.2/ekyc-1.2.2.pom +0 -73
- package/android/SDKeKYC/finos/sdk/ekyc/ekyc/maven-metadata-local.xml +0 -13
- package/android/SDKeKYC/finos/sdk/ekyc/ekycui/1.2.2/ekycui-1.2.2-sources.jar +0 -0
- package/android/SDKeKYC/finos/sdk/ekyc/ekycui/1.2.2/ekycui-1.2.2.aar +0 -0
- package/android/SDKeKYC/finos/sdk/ekyc/ekycui/1.2.2/ekycui-1.2.2.module +0 -131
- package/android/SDKeKYC/finos/sdk/ekyc/ekycui/1.2.2/ekycui-1.2.2.pom +0 -43
- package/android/SDKeKYC/finos/sdk/ekyc/ekycui/maven-metadata-local.xml +0 -13
- package/android/SDKeKYC/finos/sdk/ekyc/faceservice/1.2.2/faceservice-1.2.2-sources.jar +0 -0
- package/android/SDKeKYC/finos/sdk/ekyc/faceservice/1.2.2/faceservice-1.2.2.aar +0 -0
- package/android/SDKeKYC/finos/sdk/ekyc/faceservice/1.2.2/faceservice-1.2.2.module +0 -110
- package/android/SDKeKYC/finos/sdk/ekyc/faceservice/1.2.2/faceservice-1.2.2.pom +0 -37
- package/android/SDKeKYC/finos/sdk/ekyc/faceservice/maven-metadata-local.xml +0 -13
- package/android/SDKeKYC/finos/sdk/ekyc/liveness/1.2.2/liveness-1.2.2-sources.jar +0 -0
- package/android/SDKeKYC/finos/sdk/ekyc/liveness/1.2.2/liveness-1.2.2.aar +0 -0
- package/android/SDKeKYC/finos/sdk/ekyc/liveness/1.2.2/liveness-1.2.2.module +0 -138
- package/android/SDKeKYC/finos/sdk/ekyc/liveness/1.2.2/liveness-1.2.2.pom +0 -55
- package/android/SDKeKYC/finos/sdk/ekyc/liveness/maven-metadata-local.xml +0 -13
- package/android/SDKeKYC/finos/sdk/ekyc/nfc/1.2.2/nfc-1.2.2-sources.jar +0 -0
- package/android/SDKeKYC/finos/sdk/ekyc/nfc/1.2.2/nfc-1.2.2.aar +0 -0
- package/android/SDKeKYC/finos/sdk/ekyc/nfc/1.2.2/nfc-1.2.2.module +0 -131
- package/android/SDKeKYC/finos/sdk/ekyc/nfc/1.2.2/nfc-1.2.2.pom +0 -55
- package/android/SDKeKYC/finos/sdk/ekyc/nfc/maven-metadata-local.xml +0 -13
- package/android/SDKeKYC/finos/sdk/ekyc/ocr/1.2.2/ocr-1.2.2-sources.jar +0 -0
- package/android/SDKeKYC/finos/sdk/ekyc/ocr/1.2.2/ocr-1.2.2.aar +0 -0
- package/android/SDKeKYC/finos/sdk/ekyc/ocr/1.2.2/ocr-1.2.2.module +0 -124
- package/android/SDKeKYC/finos/sdk/ekyc/ocr/1.2.2/ocr-1.2.2.pom +0 -43
- package/android/SDKeKYC/finos/sdk/ekyc/ocr/maven-metadata-local.xml +0 -13
- package/android/SDKeKYC/finos/sdk/ekyc/qrcode/1.2.2/qrcode-1.2.2-sources.jar +0 -0
- package/android/SDKeKYC/finos/sdk/ekyc/qrcode/1.2.2/qrcode-1.2.2.aar +0 -0
- package/android/SDKeKYC/finos/sdk/ekyc/qrcode/1.2.2/qrcode-1.2.2.module +0 -138
- package/android/SDKeKYC/finos/sdk/ekyc/qrcode/1.2.2/qrcode-1.2.2.pom +0 -55
- package/android/SDKeKYC/finos/sdk/ekyc/qrcode/maven-metadata-local.xml +0 -13
- package/android/SDKeKYC/finos/sdk/ekyc/sdkcore/1.2.2/sdkcore-1.2.2-sources.jar +0 -0
- package/android/SDKeKYC/finos/sdk/ekyc/sdkcore/1.2.2/sdkcore-1.2.2.aar +0 -0
- package/android/SDKeKYC/finos/sdk/ekyc/sdkcore/1.2.2/sdkcore-1.2.2.module +0 -341
- package/android/SDKeKYC/finos/sdk/ekyc/sdkcore/1.2.2/sdkcore-1.2.2.pom +0 -139
- package/android/SDKeKYC/finos/sdk/ekyc/sdkcore/maven-metadata-local.xml +0 -13
- package/android/SDKeKYC/finos/sdk/ekyc/sdkcorecamera/1.2.2/sdkcorecamera-1.2.2-sources.jar +0 -0
- package/android/SDKeKYC/finos/sdk/ekyc/sdkcorecamera/1.2.2/sdkcorecamera-1.2.2.aar +0 -0
- package/android/SDKeKYC/finos/sdk/ekyc/sdkcorecamera/1.2.2/sdkcorecamera-1.2.2.module +0 -201
- package/android/SDKeKYC/finos/sdk/ekyc/sdkcorecamera/1.2.2/sdkcorecamera-1.2.2.pom +0 -85
- package/android/SDKeKYC/finos/sdk/ekyc/sdkcorecamera/maven-metadata-local.xml +0 -13
- package/android/SDKeKYC/finos/sdk/ekyc/sdkui/1.2.2/sdkui-1.2.2-sources.jar +0 -0
- package/android/SDKeKYC/finos/sdk/ekyc/sdkui/1.2.2/sdkui-1.2.2.aar +0 -0
- package/android/SDKeKYC/finos/sdk/ekyc/sdkui/1.2.2/sdkui-1.2.2.module +0 -208
- package/android/SDKeKYC/finos/sdk/ekyc/sdkui/1.2.2/sdkui-1.2.2.pom +0 -103
- package/android/SDKeKYC/finos/sdk/ekyc/sdkui/maven-metadata-local.xml +0 -13
- package/android/src/main/AndroidManifest.xml +0 -22
- package/android/src/main/build.gradle +0 -31
- package/dist/App.d.ts +0 -3
- package/dist/App.js +0 -497
- package/dist/finos_sdk-sdk-ekyc-1.2.2.tgz +0 -0
|
@@ -8,6 +8,7 @@ import com.facebook.react.bridge.Promise
|
|
|
8
8
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
9
9
|
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
10
10
|
import com.facebook.react.bridge.ReactMethod
|
|
11
|
+
import com.facebook.react.bridge.WritableArray
|
|
11
12
|
import com.facebook.react.bridge.WritableMap
|
|
12
13
|
import com.facebook.react.module.annotations.ReactModule
|
|
13
14
|
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
@@ -31,6 +32,11 @@ import finos.sdk.faceservice.SdkEkycFaceService
|
|
|
31
32
|
import finos.sdk.liveness.SdkEkycLiveness
|
|
32
33
|
import finos.sdk.nfc.SdkEkycNfc
|
|
33
34
|
import finos.sdk.ocr.SdkEkycOcr
|
|
35
|
+
import finos.sdk.smsotp.SdkSmsOtpService
|
|
36
|
+
import finos.sdk.core.model.sdk.config.SmsOtpConfig
|
|
37
|
+
import vn.softdreams.easyca.sdk.SdkeSign
|
|
38
|
+
import vn.softdreams.easyca.sdk.utils.UserEsignModel
|
|
39
|
+
import org.json.JSONObject
|
|
34
40
|
import java.io.File
|
|
35
41
|
import java.io.FileOutputStream
|
|
36
42
|
import java.util.Date
|
|
@@ -51,20 +57,50 @@ class EKYCModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaMo
|
|
|
51
57
|
.emit(eventName, params)
|
|
52
58
|
}
|
|
53
59
|
|
|
60
|
+
/**
|
|
61
|
+
* Helper function to create separate maps for event and promise to avoid "Map already consumed" error
|
|
62
|
+
* @param builder Lambda function to build the map content
|
|
63
|
+
* @return Pair of (eventMap, promiseMap)
|
|
64
|
+
*/
|
|
65
|
+
private fun createSeparateMaps(builder: (WritableMap) -> Unit): Pair<WritableMap, WritableMap> {
|
|
66
|
+
val eventMap = Arguments.createMap().apply(builder)
|
|
67
|
+
val promiseMap = Arguments.createMap().apply(builder)
|
|
68
|
+
return Pair(eventMap, promiseMap)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Helper function to create separate maps with array for event and promise
|
|
73
|
+
* @param arrayBuilder Lambda function to build the array content
|
|
74
|
+
* @param mapBuilder Lambda function to build the map with array
|
|
75
|
+
* @return Pair of (eventMap, promiseMap)
|
|
76
|
+
*/
|
|
77
|
+
private fun createSeparateMapsWithArray(
|
|
78
|
+
arrayBuilder: (WritableArray) -> Unit,
|
|
79
|
+
mapBuilder: (WritableMap, WritableArray) -> Unit
|
|
80
|
+
): Pair<WritableMap, WritableMap> {
|
|
81
|
+
val eventArray = Arguments.createArray().apply(arrayBuilder)
|
|
82
|
+
val promiseArray = Arguments.createArray().apply(arrayBuilder)
|
|
83
|
+
val eventMap = Arguments.createMap().apply { mapBuilder(this, eventArray) }
|
|
84
|
+
val promiseMap = Arguments.createMap().apply { mapBuilder(this, promiseArray) }
|
|
85
|
+
return Pair(eventMap, promiseMap)
|
|
86
|
+
}
|
|
87
|
+
|
|
54
88
|
@ReactMethod
|
|
55
89
|
fun initSdkEkyc(promise: Promise) {
|
|
90
|
+
Log.d(TAG, "▶️ initSdkEkyc() called")
|
|
56
91
|
try {
|
|
57
92
|
SdkEkyc.initSDKEkyc(reactApplicationContext) {
|
|
93
|
+
Log.d(TAG, "✅ initSdkEkyc() success")
|
|
58
94
|
val params =
|
|
59
95
|
Arguments.createMap().apply {
|
|
60
96
|
putString("status", "success")
|
|
61
97
|
putString("message", "SDK EKYC initialized successfully")
|
|
62
98
|
}
|
|
63
99
|
sendEvent("EKYCInitEvent", params)
|
|
64
|
-
//promise.resolve("SDK EKYC initialized successfully")
|
|
65
100
|
promise.resolve(true)
|
|
66
101
|
}
|
|
67
102
|
} catch (e: Exception) {
|
|
103
|
+
Log.e(TAG, "❌ initSdkEkyc() failed: ${e.message}", e)
|
|
68
104
|
promise.reject("INIT_ERROR", "Failed to initialize SDK EKYC: ${e.message}")
|
|
69
105
|
}
|
|
70
106
|
}
|
|
@@ -79,14 +115,14 @@ class EKYCModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaMo
|
|
|
79
115
|
facePathStorage: String?,
|
|
80
116
|
promise: Promise
|
|
81
117
|
) {
|
|
118
|
+
Log.d(TAG, "▶️ startNfcScan() called")
|
|
82
119
|
try {
|
|
83
|
-
Log.d(TAG, "startNfcScan:::0000")
|
|
84
120
|
val currentActivity = reactApplicationContext.currentActivity
|
|
85
121
|
if (currentActivity == null) {
|
|
122
|
+
Log.e(TAG, "❌ startNfcScan() failed: Activity not available")
|
|
86
123
|
promise.reject("NO_ACTIVITY", "Activity not available")
|
|
87
124
|
return
|
|
88
125
|
}
|
|
89
|
-
Log.d(TAG, "startNfcScan:::1111")
|
|
90
126
|
val nfcConfig = NfcConfig(
|
|
91
127
|
documentNumber = documentNumber,
|
|
92
128
|
birthDate = birthDate,
|
|
@@ -115,6 +151,7 @@ class EKYCModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaMo
|
|
|
115
151
|
}
|
|
116
152
|
|
|
117
153
|
EKYCEvent.SCAN_NFC_SUCCESS -> {
|
|
154
|
+
Log.d(TAG, "✅ startNfcScan() success")
|
|
118
155
|
val eventMap =
|
|
119
156
|
Arguments.createMap().apply {
|
|
120
157
|
putString("event", event.name.toString())
|
|
@@ -140,7 +177,7 @@ class EKYCModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaMo
|
|
|
140
177
|
}
|
|
141
178
|
},
|
|
142
179
|
callbackError = { event, message ->
|
|
143
|
-
Log.e(TAG, "
|
|
180
|
+
Log.e(TAG, "❌ startNfcScan() failed - Event: $event, Message: $message")
|
|
144
181
|
|
|
145
182
|
val errorMap =
|
|
146
183
|
Arguments.createMap().apply {
|
|
@@ -152,9 +189,8 @@ class EKYCModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaMo
|
|
|
152
189
|
promise.reject(event.name.toString(), message?.toString() ?: "Unknown NFC error")
|
|
153
190
|
}
|
|
154
191
|
)
|
|
155
|
-
Log.d(TAG, "startNfcScan:::222222")
|
|
156
192
|
} catch (e: Exception) {
|
|
157
|
-
Log.e(TAG, "
|
|
193
|
+
Log.e(TAG, "❌ startNfcScan() exception: ${e.message}", e)
|
|
158
194
|
promise.reject("NFC_EXCEPTION", e.message, e)
|
|
159
195
|
}
|
|
160
196
|
}
|
|
@@ -168,6 +204,7 @@ class EKYCModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaMo
|
|
|
168
204
|
transactionId: String?,
|
|
169
205
|
promise: Promise
|
|
170
206
|
) {
|
|
207
|
+
Log.d(TAG, "▶️ checkC06() called")
|
|
171
208
|
try {
|
|
172
209
|
val c06Config =
|
|
173
210
|
C06Config(
|
|
@@ -182,7 +219,7 @@ class EKYCModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaMo
|
|
|
182
219
|
SdkEkycC06.startEkyc(
|
|
183
220
|
ekycConfigSDK = ekycConfig,
|
|
184
221
|
callbackSuccess = { event, data ->
|
|
185
|
-
Log.d(TAG, "
|
|
222
|
+
Log.d(TAG, "✅ checkC06() success")
|
|
186
223
|
|
|
187
224
|
// Create separate maps for event and promise
|
|
188
225
|
val eventMap =
|
|
@@ -200,7 +237,7 @@ class EKYCModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaMo
|
|
|
200
237
|
promise.resolve(promiseMap)
|
|
201
238
|
},
|
|
202
239
|
callbackError = { event, message ->
|
|
203
|
-
Log.e(TAG, "
|
|
240
|
+
Log.e(TAG, "❌ checkC06() failed - Event: $event, Message: $message")
|
|
204
241
|
|
|
205
242
|
val errorMap =
|
|
206
243
|
Arguments.createMap().apply {
|
|
@@ -213,7 +250,7 @@ class EKYCModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaMo
|
|
|
213
250
|
}
|
|
214
251
|
)
|
|
215
252
|
} catch (e: Exception) {
|
|
216
|
-
Log.e(TAG, "
|
|
253
|
+
Log.e(TAG, "❌ checkC06() exception: ${e.message}", e)
|
|
217
254
|
promise.reject("C06_EXCEPTION", e.message, e)
|
|
218
255
|
}
|
|
219
256
|
}
|
|
@@ -226,9 +263,11 @@ class EKYCModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaMo
|
|
|
226
263
|
transactionId: String,
|
|
227
264
|
promise: Promise
|
|
228
265
|
) {
|
|
266
|
+
Log.d(TAG, "▶️ startOcr() called")
|
|
229
267
|
try {
|
|
230
268
|
val currentActivity = reactApplicationContext.currentActivity
|
|
231
269
|
if (currentActivity == null) {
|
|
270
|
+
Log.e(TAG, "❌ startOcr() failed: Activity not available")
|
|
232
271
|
promise.reject("NO_ACTIVITY", "Activity not available")
|
|
233
272
|
return
|
|
234
273
|
}
|
|
@@ -249,28 +288,16 @@ class EKYCModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaMo
|
|
|
249
288
|
SdkEkycOcr.startEkyc(
|
|
250
289
|
ekycConfigSDK = ekycConfig,
|
|
251
290
|
callbackSuccess = { event, data ->
|
|
252
|
-
Log.d(TAG, "
|
|
253
|
-
val
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
(data as SDKEkycResult).ocrResponse.toString()
|
|
259
|
-
)
|
|
260
|
-
}
|
|
261
|
-
sendEvent("onOcrSuccess", resultMap)
|
|
262
|
-
val promiseMap =
|
|
263
|
-
Arguments.createMap().apply {
|
|
264
|
-
putString("event", event.name.toString())
|
|
265
|
-
putString(
|
|
266
|
-
"data",
|
|
267
|
-
(data as SDKEkycResult).ocrResponse.toString()
|
|
268
|
-
)
|
|
269
|
-
}
|
|
291
|
+
Log.d(TAG, "✅ startOcr() success")
|
|
292
|
+
val (eventMap, promiseMap) = createSeparateMaps { map ->
|
|
293
|
+
map.putString("event", event.name.toString())
|
|
294
|
+
map.putString("data", (data as SDKEkycResult).ocrResponse.toString())
|
|
295
|
+
}
|
|
296
|
+
sendEvent("onOcrSuccess", eventMap)
|
|
270
297
|
promise.resolve(promiseMap)
|
|
271
298
|
},
|
|
272
299
|
callbackError = { event, message ->
|
|
273
|
-
Log.e(TAG, "
|
|
300
|
+
Log.e(TAG, "❌ startOcr() failed - Event: $event, Message: $message")
|
|
274
301
|
val errorMap =
|
|
275
302
|
Arguments.createMap().apply {
|
|
276
303
|
putString("event", event.name.toString())
|
|
@@ -281,7 +308,7 @@ class EKYCModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaMo
|
|
|
281
308
|
}
|
|
282
309
|
)
|
|
283
310
|
} catch (e: Exception) {
|
|
284
|
-
Log.e(TAG, "
|
|
311
|
+
Log.e(TAG, "❌ startOcr() exception: ${e.message}", e)
|
|
285
312
|
promise.reject("OCR_ERROR", e.message)
|
|
286
313
|
}
|
|
287
314
|
}
|
|
@@ -296,9 +323,11 @@ class EKYCModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaMo
|
|
|
296
323
|
switchFrontCamera: Boolean?,
|
|
297
324
|
promise: Promise
|
|
298
325
|
) {
|
|
326
|
+
Log.d(TAG, "▶️ startLiveness() called")
|
|
299
327
|
try {
|
|
300
328
|
val currentActivity = reactApplicationContext.currentActivity
|
|
301
329
|
if (currentActivity == null) {
|
|
330
|
+
Log.e(TAG, "❌ startLiveness() failed: Activity not available")
|
|
302
331
|
promise.reject("NO_ACTIVITY", "Activity not available")
|
|
303
332
|
return
|
|
304
333
|
}
|
|
@@ -325,28 +354,16 @@ class EKYCModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaMo
|
|
|
325
354
|
SdkEkycLiveness.startEkyc(
|
|
326
355
|
ekycConfigSDK = ekycConfig,
|
|
327
356
|
callbackSuccess = { event, data ->
|
|
328
|
-
Log.d(TAG, "
|
|
329
|
-
val
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
(data as SDKEkycResult).checkLivenessResponse.toString()
|
|
335
|
-
)
|
|
336
|
-
}
|
|
337
|
-
sendEvent("onLivenessSuccess", resultMap)
|
|
338
|
-
val promiseMap =
|
|
339
|
-
Arguments.createMap().apply {
|
|
340
|
-
putString("event", event.name.toString())
|
|
341
|
-
putString(
|
|
342
|
-
"data",
|
|
343
|
-
(data as SDKEkycResult).checkLivenessResponse.toString()
|
|
344
|
-
)
|
|
345
|
-
}
|
|
357
|
+
Log.d(TAG, "✅ startLiveness() success")
|
|
358
|
+
val (eventMap, promiseMap) = createSeparateMaps { map ->
|
|
359
|
+
map.putString("event", event.name.toString())
|
|
360
|
+
map.putString("data", (data as SDKEkycResult).checkLivenessResponse.toString())
|
|
361
|
+
}
|
|
362
|
+
sendEvent("onLivenessSuccess", eventMap)
|
|
346
363
|
promise.resolve(promiseMap)
|
|
347
364
|
},
|
|
348
365
|
callbackError = { event, message ->
|
|
349
|
-
Log.e(TAG, "
|
|
366
|
+
Log.e(TAG, "❌ startLiveness() failed - Event: $event, Message: $message")
|
|
350
367
|
val errorMap =
|
|
351
368
|
Arguments.createMap().apply {
|
|
352
369
|
putString("event", event.name.toString())
|
|
@@ -357,7 +374,7 @@ class EKYCModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaMo
|
|
|
357
374
|
}
|
|
358
375
|
)
|
|
359
376
|
} catch (e: Exception) {
|
|
360
|
-
Log.e(TAG, "
|
|
377
|
+
Log.e(TAG, "❌ startLiveness() exception: ${e.message}", e)
|
|
361
378
|
promise.reject("LIVENESS_ERROR", e.message)
|
|
362
379
|
}
|
|
363
380
|
}
|
|
@@ -370,9 +387,11 @@ class EKYCModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaMo
|
|
|
370
387
|
idImage: String,
|
|
371
388
|
promise: Promise
|
|
372
389
|
) {
|
|
390
|
+
Log.d(TAG, "▶️ startFaceCompare() called")
|
|
373
391
|
try {
|
|
374
392
|
val currentActivity = reactApplicationContext.currentActivity
|
|
375
393
|
if (currentActivity == null) {
|
|
394
|
+
Log.e(TAG, "❌ startFaceCompare() failed: Activity not available")
|
|
376
395
|
promise.reject("NO_ACTIVITY", "Activity not available")
|
|
377
396
|
return
|
|
378
397
|
}
|
|
@@ -393,22 +412,16 @@ class EKYCModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaMo
|
|
|
393
412
|
SdkEkycFaceService.startEkyc(
|
|
394
413
|
ekycConfigSDK = ekycConfig,
|
|
395
414
|
callbackSuccess = { event, data ->
|
|
396
|
-
Log.d(TAG, "
|
|
397
|
-
val
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
sendEvent("onFaceCompareSuccess", resultMap)
|
|
403
|
-
val promiseMap =
|
|
404
|
-
Arguments.createMap().apply {
|
|
405
|
-
putString("event", event.name.toString())
|
|
406
|
-
putString("data", data.toString())
|
|
407
|
-
}
|
|
415
|
+
Log.d(TAG, "✅ startFaceCompare() success")
|
|
416
|
+
val (eventMap, promiseMap) = createSeparateMaps { map ->
|
|
417
|
+
map.putString("event", event.name.toString())
|
|
418
|
+
map.putString("data", data.toString())
|
|
419
|
+
}
|
|
420
|
+
sendEvent("onFaceCompareSuccess", eventMap)
|
|
408
421
|
promise.resolve(promiseMap)
|
|
409
422
|
},
|
|
410
423
|
callbackError = { event, message ->
|
|
411
|
-
Log.e(TAG, "
|
|
424
|
+
Log.e(TAG, "❌ startFaceCompare() failed - Event: $event, Message: $message")
|
|
412
425
|
val errorMap =
|
|
413
426
|
Arguments.createMap().apply {
|
|
414
427
|
putString("event", event.name.toString())
|
|
@@ -419,7 +432,7 @@ class EKYCModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaMo
|
|
|
419
432
|
}
|
|
420
433
|
)
|
|
421
434
|
} catch (e: Exception) {
|
|
422
|
-
Log.e(TAG, "
|
|
435
|
+
Log.e(TAG, "❌ startFaceCompare() exception: ${e.message}", e)
|
|
423
436
|
promise.reject("FACE_COMPARE_ERROR", e.message)
|
|
424
437
|
}
|
|
425
438
|
}
|
|
@@ -489,15 +502,15 @@ class EKYCModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaMo
|
|
|
489
502
|
styleConfigJson: String, // JSON string for style config
|
|
490
503
|
promise: Promise
|
|
491
504
|
) {
|
|
505
|
+
Log.d(TAG, "▶️ startEkycUI() called")
|
|
492
506
|
try {
|
|
493
507
|
val currentActivity = currentActivity
|
|
494
508
|
if (currentActivity == null) {
|
|
509
|
+
Log.e(TAG, "❌ startEkycUI() failed: Activity not available")
|
|
495
510
|
promise.reject("NO_ACTIVITY", "Activity not available")
|
|
496
511
|
return
|
|
497
512
|
}
|
|
498
513
|
|
|
499
|
-
Log.d(TAG, "startEkycUI: appKey=$appKey, flowSDK=$flowSDK, language=$language, optionConfig=$optionConfigJson, appKeyConfig=$appKeyConfigJson, styleConfig=$styleConfigJson")
|
|
500
|
-
|
|
501
514
|
// Parse flowSDK JSON string to List<SDKType>
|
|
502
515
|
val flowList = parseFlowSDK(flowSDK)
|
|
503
516
|
|
|
@@ -535,29 +548,21 @@ class EKYCModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaMo
|
|
|
535
548
|
flowSDK = finalFlow
|
|
536
549
|
)
|
|
537
550
|
|
|
538
|
-
// Use actual SdkEkycUI.startEkyc like MainActivity.kt
|
|
539
|
-
Log.d(TAG, "Starting SdkEkycUI.startEkyc with config: $ekycConfigSDK")
|
|
540
|
-
|
|
541
551
|
SdkEkycUI.startEkyc(
|
|
542
552
|
activity = currentActivity,
|
|
543
553
|
ekycConfigSDK = ekycConfigSDK,
|
|
544
554
|
callbackSuccess = { event, data ->
|
|
545
|
-
Log.d(TAG, "
|
|
546
|
-
val
|
|
547
|
-
putString("status", "success")
|
|
548
|
-
putString("event", event.name.toString())
|
|
549
|
-
putString("data", data.toString())
|
|
550
|
-
}
|
|
551
|
-
val eventMap = Arguments.createMap().apply {
|
|
552
|
-
putString("status", "success")
|
|
553
|
-
putString("event", event.name.toString())
|
|
554
|
-
putString("data", data.toString())
|
|
555
|
+
Log.d(TAG, "✅ startEkycUI() success")
|
|
556
|
+
val (eventMap, promiseMap) = createSeparateMaps { map ->
|
|
557
|
+
map.putString("status", "success")
|
|
558
|
+
map.putString("event", event.name.toString())
|
|
559
|
+
map.putString("data", data.toString())
|
|
555
560
|
}
|
|
556
561
|
sendEvent("onEkycUISuccess", eventMap)
|
|
557
|
-
promise.resolve(
|
|
562
|
+
promise.resolve(promiseMap)
|
|
558
563
|
},
|
|
559
564
|
callbackError = { event, errorResult ->
|
|
560
|
-
Log.e(TAG, "
|
|
565
|
+
Log.e(TAG, "❌ startEkycUI() failed - Event: $event, Message: ${errorResult.message}")
|
|
561
566
|
val errorMap = Arguments.createMap().apply {
|
|
562
567
|
putString("status", "error")
|
|
563
568
|
putString("event", event.name.toString())
|
|
@@ -576,7 +581,7 @@ class EKYCModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaMo
|
|
|
576
581
|
)
|
|
577
582
|
|
|
578
583
|
} catch (e: Exception) {
|
|
579
|
-
Log.e(TAG, "
|
|
584
|
+
Log.e(TAG, "❌ startEkycUI() exception: ${e.message}", e)
|
|
580
585
|
promise.reject("EKYC_UI_EXCEPTION", e.message, e)
|
|
581
586
|
}
|
|
582
587
|
}
|
|
@@ -784,4 +789,696 @@ class EKYCModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaMo
|
|
|
784
789
|
}
|
|
785
790
|
}
|
|
786
791
|
|
|
792
|
+
// ==================== SMS OTP Methods ====================
|
|
793
|
+
|
|
794
|
+
@ReactMethod
|
|
795
|
+
fun sendOtp(
|
|
796
|
+
phoneNumber: String,
|
|
797
|
+
purpose: String?,
|
|
798
|
+
referenceId: String,
|
|
799
|
+
promise: Promise
|
|
800
|
+
) {
|
|
801
|
+
Log.d(TAG, "▶️ sendOtp() called")
|
|
802
|
+
Log.d(TAG, " 📱 Phone: $phoneNumber")
|
|
803
|
+
Log.d(TAG, " 🎯 Purpose: ${purpose ?: "transaction"}")
|
|
804
|
+
Log.d(TAG, " 🔖 ReferenceId: $referenceId")
|
|
805
|
+
try {
|
|
806
|
+
val smsOtpConfig = SmsOtpConfig(
|
|
807
|
+
phoneNumber = phoneNumber,
|
|
808
|
+
purpose = purpose ?: "transaction",
|
|
809
|
+
referenceId = referenceId
|
|
810
|
+
)
|
|
811
|
+
|
|
812
|
+
SdkSmsOtpService.sendOtp(
|
|
813
|
+
smsOtpConfig = smsOtpConfig,
|
|
814
|
+
callbackSuccess = { event, result ->
|
|
815
|
+
Log.d(TAG, "✅ sendOtp() success")
|
|
816
|
+
val (eventMap, promiseMap) = createSeparateMaps { map ->
|
|
817
|
+
map.putString("event", event.name.toString())
|
|
818
|
+
result?.let {
|
|
819
|
+
val dataMap = Arguments.createMap()
|
|
820
|
+
it.customData?.forEach { (key, value) ->
|
|
821
|
+
dataMap.putString(key, value.toString())
|
|
822
|
+
}
|
|
823
|
+
map.putMap("data", dataMap)
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
sendEvent("onSmsOtpSendSuccess", eventMap)
|
|
827
|
+
promise.resolve(promiseMap)
|
|
828
|
+
},
|
|
829
|
+
callbackError = { event, error ->
|
|
830
|
+
Log.e(TAG, "❌ sendOtp() failed - Event: $event, Message: ${error.message}")
|
|
831
|
+
Log.e(TAG, " 🔴 Error Code: ${error.code}")
|
|
832
|
+
Log.e(TAG, " 📱 Phone: $phoneNumber, Purpose: ${purpose ?: "transaction"}, RefId: $referenceId")
|
|
833
|
+
val errorMap = Arguments.createMap().apply {
|
|
834
|
+
putString("event", event.name.toString())
|
|
835
|
+
putString("message", error.message)
|
|
836
|
+
putString("code", error.code)
|
|
837
|
+
}
|
|
838
|
+
sendEvent("onSmsOtpError", errorMap)
|
|
839
|
+
promise.reject(event.name.toString(), error.message)
|
|
840
|
+
}
|
|
841
|
+
)
|
|
842
|
+
} catch (e: Exception) {
|
|
843
|
+
Log.e(TAG, "❌ sendOtp() exception: ${e.message}", e)
|
|
844
|
+
promise.reject("SMS_OTP_EXCEPTION", e.message, e)
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
@ReactMethod
|
|
849
|
+
fun verifyOtp(
|
|
850
|
+
phoneNumber: String,
|
|
851
|
+
purpose: String?,
|
|
852
|
+
referenceId: String,
|
|
853
|
+
requestId: String,
|
|
854
|
+
otpCode: String,
|
|
855
|
+
promise: Promise
|
|
856
|
+
) {
|
|
857
|
+
Log.d(TAG, "▶️ verifyOtp() called")
|
|
858
|
+
try {
|
|
859
|
+
val smsOtpConfig = SmsOtpConfig(
|
|
860
|
+
phoneNumber = phoneNumber,
|
|
861
|
+
purpose = purpose ?: "transaction",
|
|
862
|
+
referenceId = referenceId,
|
|
863
|
+
requestId = requestId
|
|
864
|
+
)
|
|
865
|
+
|
|
866
|
+
SdkSmsOtpService.verifyOtp(
|
|
867
|
+
smsOtpConfig = smsOtpConfig,
|
|
868
|
+
otpCode = otpCode,
|
|
869
|
+
callbackSuccess = { event, result ->
|
|
870
|
+
Log.d(TAG, "✅ verifyOtp() success")
|
|
871
|
+
val (eventMap, promiseMap) = createSeparateMaps { map ->
|
|
872
|
+
map.putString("event", event.name.toString())
|
|
873
|
+
result?.let {
|
|
874
|
+
val dataMap = Arguments.createMap()
|
|
875
|
+
it.customData?.forEach { (key, value) ->
|
|
876
|
+
dataMap.putString(key, value.toString())
|
|
877
|
+
}
|
|
878
|
+
map.putMap("data", dataMap)
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
sendEvent("onSmsOtpVerifySuccess", eventMap)
|
|
882
|
+
promise.resolve(promiseMap)
|
|
883
|
+
},
|
|
884
|
+
callbackError = { event, error ->
|
|
885
|
+
Log.e(TAG, "❌ verifyOtp() failed - Event: $event, Message: ${error.message}")
|
|
886
|
+
val errorMap = Arguments.createMap().apply {
|
|
887
|
+
putString("event", event.name.toString())
|
|
888
|
+
putString("message", error.message)
|
|
889
|
+
putString("code", error.code)
|
|
890
|
+
}
|
|
891
|
+
sendEvent("onSmsOtpError", errorMap)
|
|
892
|
+
promise.reject(event.name.toString(), error.message)
|
|
893
|
+
}
|
|
894
|
+
)
|
|
895
|
+
} catch (e: Exception) {
|
|
896
|
+
Log.e(TAG, "❌ verifyOtp() exception: ${e.message}", e)
|
|
897
|
+
promise.reject("SMS_OTP_EXCEPTION", e.message, e)
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
@ReactMethod
|
|
902
|
+
fun resendOtp(
|
|
903
|
+
phoneNumber: String,
|
|
904
|
+
purpose: String?,
|
|
905
|
+
referenceId: String,
|
|
906
|
+
requestId: String,
|
|
907
|
+
promise: Promise
|
|
908
|
+
) {
|
|
909
|
+
Log.d(TAG, "▶️ resendOtp() called")
|
|
910
|
+
try {
|
|
911
|
+
val smsOtpConfig = SmsOtpConfig(
|
|
912
|
+
phoneNumber = phoneNumber,
|
|
913
|
+
purpose = purpose ?: "transaction",
|
|
914
|
+
referenceId = referenceId,
|
|
915
|
+
requestId = requestId
|
|
916
|
+
)
|
|
917
|
+
|
|
918
|
+
SdkSmsOtpService.resendOtp(
|
|
919
|
+
smsOtpConfig = smsOtpConfig,
|
|
920
|
+
callbackSuccess = { event, result ->
|
|
921
|
+
Log.d(TAG, "✅ resendOtp() success")
|
|
922
|
+
val (eventMap, promiseMap) = createSeparateMaps { map ->
|
|
923
|
+
map.putString("event", event.name.toString())
|
|
924
|
+
result?.let {
|
|
925
|
+
val dataMap = Arguments.createMap()
|
|
926
|
+
it.customData?.forEach { (key, value) ->
|
|
927
|
+
dataMap.putString(key, value.toString())
|
|
928
|
+
}
|
|
929
|
+
map.putMap("data", dataMap)
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
sendEvent("onSmsOtpResendSuccess", eventMap)
|
|
933
|
+
promise.resolve(promiseMap)
|
|
934
|
+
},
|
|
935
|
+
callbackError = { event, error ->
|
|
936
|
+
Log.e(TAG, "❌ resendOtp() failed - Event: $event, Message: ${error.message}")
|
|
937
|
+
val errorMap = Arguments.createMap().apply {
|
|
938
|
+
putString("event", event.name.toString())
|
|
939
|
+
putString("message", error.message)
|
|
940
|
+
putString("code", error.code)
|
|
941
|
+
}
|
|
942
|
+
sendEvent("onSmsOtpError", errorMap)
|
|
943
|
+
promise.reject(event.name.toString(), error.message)
|
|
944
|
+
}
|
|
945
|
+
)
|
|
946
|
+
} catch (e: Exception) {
|
|
947
|
+
Log.e(TAG, "❌ resendOtp() exception: ${e.message}", e)
|
|
948
|
+
promise.reject("SMS_OTP_EXCEPTION", e.message, e)
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
// ==================== eSign Methods ====================
|
|
953
|
+
|
|
954
|
+
@ReactMethod
|
|
955
|
+
fun initializeESign(promise: Promise) {
|
|
956
|
+
Log.d(TAG, "▶️ initializeESign() called")
|
|
957
|
+
try {
|
|
958
|
+
val currentActivity = reactApplicationContext.currentActivity
|
|
959
|
+
if (currentActivity == null) {
|
|
960
|
+
Log.e(TAG, "❌ initializeESign() failed: Activity not available")
|
|
961
|
+
promise.reject("NO_ACTIVITY", "Activity not available")
|
|
962
|
+
return
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
SdkeSign.initializeESign(
|
|
966
|
+
context = currentActivity,
|
|
967
|
+
callbackSuccess = { code, message ->
|
|
968
|
+
Log.d(TAG, "✅ initializeESign() success")
|
|
969
|
+
val (eventMap, promiseMap) = createSeparateMaps { map ->
|
|
970
|
+
map.putString("code", code.toString())
|
|
971
|
+
map.putString("message", message)
|
|
972
|
+
}
|
|
973
|
+
sendEvent("onESignInitSuccess", eventMap)
|
|
974
|
+
promise.resolve(promiseMap)
|
|
975
|
+
},
|
|
976
|
+
callbackError = { event, error ->
|
|
977
|
+
Log.e(TAG, "❌ initializeESign() failed - Event: $event, Message: ${error.message}")
|
|
978
|
+
val errorMap = Arguments.createMap().apply {
|
|
979
|
+
putString("event", event.name.toString())
|
|
980
|
+
putString("message", error.message)
|
|
981
|
+
putString("code", error.code)
|
|
982
|
+
}
|
|
983
|
+
sendEvent("onESignError", errorMap)
|
|
984
|
+
promise.reject(event.name.toString(), error.message)
|
|
985
|
+
}
|
|
986
|
+
)
|
|
987
|
+
} catch (e: Exception) {
|
|
988
|
+
Log.e(TAG, "❌ initializeESign() exception: ${e.message}", e)
|
|
989
|
+
promise.reject("ESIGN_EXCEPTION", e.message, e)
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
@ReactMethod
|
|
994
|
+
fun openSessionId(
|
|
995
|
+
accessToken: String?,
|
|
996
|
+
username: String?,
|
|
997
|
+
rememberMe: Boolean?,
|
|
998
|
+
userEsignModelJson: String?,
|
|
999
|
+
privateKeyFilePath: String?,
|
|
1000
|
+
promise: Promise
|
|
1001
|
+
) {
|
|
1002
|
+
Log.d(TAG, "▶️ openSessionId() called")
|
|
1003
|
+
try {
|
|
1004
|
+
val currentActivity = reactApplicationContext.currentActivity
|
|
1005
|
+
if (currentActivity == null) {
|
|
1006
|
+
Log.e(TAG, "❌ openSessionId() failed: Activity not available")
|
|
1007
|
+
promise.reject("NO_ACTIVITY", "Activity not available")
|
|
1008
|
+
return
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
if (accessToken != null && accessToken.isNotEmpty()) {
|
|
1012
|
+
// Option 1: With existing JWT access token
|
|
1013
|
+
SdkeSign.openSessionId(
|
|
1014
|
+
context = currentActivity,
|
|
1015
|
+
accessToken = accessToken,
|
|
1016
|
+
username = username ?: "",
|
|
1017
|
+
rememberMe = rememberMe ?: false,
|
|
1018
|
+
callbackSuccess = { deviceState, code, message ->
|
|
1019
|
+
Log.d(TAG, "✅ openSessionId() success")
|
|
1020
|
+
val (eventMap, promiseMap) = createSeparateMaps { map ->
|
|
1021
|
+
map.putString("deviceState", deviceState)
|
|
1022
|
+
map.putString("code", code.toString())
|
|
1023
|
+
map.putString("message", message)
|
|
1024
|
+
}
|
|
1025
|
+
sendEvent("onESignOpenSessionSuccess", eventMap)
|
|
1026
|
+
promise.resolve(promiseMap)
|
|
1027
|
+
},
|
|
1028
|
+
callbackError = { event, error ->
|
|
1029
|
+
Log.e(TAG, "❌ openSessionId() failed - Event: $event, Message: ${error.message}")
|
|
1030
|
+
val errorMap = Arguments.createMap().apply {
|
|
1031
|
+
putString("event", event.name.toString())
|
|
1032
|
+
putString("message", error.message)
|
|
1033
|
+
putString("code", error.code)
|
|
1034
|
+
}
|
|
1035
|
+
sendEvent("onESignError", errorMap)
|
|
1036
|
+
promise.reject(event.name.toString(), error.message)
|
|
1037
|
+
}
|
|
1038
|
+
)
|
|
1039
|
+
} else if (userEsignModelJson != null && privateKeyFilePath != null) {
|
|
1040
|
+
// Option 2: Auto-create token from user info
|
|
1041
|
+
val json = JSONObject(userEsignModelJson)
|
|
1042
|
+
val userInfo = UserEsignModel(
|
|
1043
|
+
cccd = json.getString("cccd"),
|
|
1044
|
+
name = json.getString("name"),
|
|
1045
|
+
device = json.optString("device", "Android"),
|
|
1046
|
+
deviceId = json.optString("deviceId", android.provider.Settings.Secure.getString(
|
|
1047
|
+
reactApplicationContext.contentResolver,
|
|
1048
|
+
android.provider.Settings.Secure.ANDROID_ID
|
|
1049
|
+
) ?: "")
|
|
1050
|
+
)
|
|
1051
|
+
|
|
1052
|
+
SdkeSign.openSessionId(
|
|
1053
|
+
context = currentActivity,
|
|
1054
|
+
userEsignModel = userInfo,
|
|
1055
|
+
privateKeyFilePath = privateKeyFilePath,
|
|
1056
|
+
username = username ?: "",
|
|
1057
|
+
rememberMe = rememberMe ?: false,
|
|
1058
|
+
callbackSuccess = { deviceState, code, message ->
|
|
1059
|
+
Log.d(TAG, "✅ openSessionId() success")
|
|
1060
|
+
val (eventMap, promiseMap) = createSeparateMaps { map ->
|
|
1061
|
+
map.putString("deviceState", deviceState)
|
|
1062
|
+
map.putString("code", code.toString())
|
|
1063
|
+
map.putString("message", message)
|
|
1064
|
+
}
|
|
1065
|
+
sendEvent("onESignOpenSessionSuccess", eventMap)
|
|
1066
|
+
promise.resolve(promiseMap)
|
|
1067
|
+
},
|
|
1068
|
+
callbackError = { event, error ->
|
|
1069
|
+
Log.e(TAG, "❌ openSessionId() failed - Event: $event, Message: ${error.message}")
|
|
1070
|
+
val errorMap = Arguments.createMap().apply {
|
|
1071
|
+
putString("event", event.name.toString())
|
|
1072
|
+
putString("message", error.message)
|
|
1073
|
+
putString("code", error.code)
|
|
1074
|
+
}
|
|
1075
|
+
sendEvent("onESignError", errorMap)
|
|
1076
|
+
promise.reject(event.name.toString(), error.message)
|
|
1077
|
+
}
|
|
1078
|
+
)
|
|
1079
|
+
} else {
|
|
1080
|
+
Log.e(TAG, "❌ openSessionId() failed: Invalid parameters")
|
|
1081
|
+
promise.reject("INVALID_PARAMS", "Either accessToken or (userEsignModelJson + privateKeyFilePath) must be provided")
|
|
1082
|
+
}
|
|
1083
|
+
} catch (e: Exception) {
|
|
1084
|
+
Log.e(TAG, "❌ openSessionId() exception: ${e.message}", e)
|
|
1085
|
+
promise.reject("ESIGN_EXCEPTION", e.message, e)
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
@ReactMethod
|
|
1090
|
+
fun registerDevice(
|
|
1091
|
+
recoverCode: String,
|
|
1092
|
+
pinCode: String,
|
|
1093
|
+
fcmToken: String?,
|
|
1094
|
+
promise: Promise
|
|
1095
|
+
) {
|
|
1096
|
+
Log.d(TAG, "▶️ registerDevice() called")
|
|
1097
|
+
try {
|
|
1098
|
+
val currentActivity = reactApplicationContext.currentActivity
|
|
1099
|
+
if (currentActivity == null) {
|
|
1100
|
+
Log.e(TAG, "❌ registerDevice() failed: Activity not available")
|
|
1101
|
+
promise.reject("NO_ACTIVITY", "Activity not available")
|
|
1102
|
+
return
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
SdkeSign.registerDevice(
|
|
1106
|
+
context = currentActivity,
|
|
1107
|
+
recoverCode = recoverCode,
|
|
1108
|
+
pinCode = pinCode,
|
|
1109
|
+
fcmToken = fcmToken ?: "",
|
|
1110
|
+
callbackSuccess = { code, message ->
|
|
1111
|
+
Log.d(TAG, "✅ registerDevice() success")
|
|
1112
|
+
val (eventMap, promiseMap) = createSeparateMaps { map ->
|
|
1113
|
+
map.putString("code", code.toString())
|
|
1114
|
+
map.putString("message", message)
|
|
1115
|
+
}
|
|
1116
|
+
sendEvent("onESignRegisterDeviceSuccess", eventMap)
|
|
1117
|
+
promise.resolve(promiseMap)
|
|
1118
|
+
},
|
|
1119
|
+
callbackError = { event, error ->
|
|
1120
|
+
Log.e(TAG, "❌ registerDevice() failed - Event: $event, Message: ${error.message}")
|
|
1121
|
+
val errorMap = Arguments.createMap().apply {
|
|
1122
|
+
putString("event", event.name.toString())
|
|
1123
|
+
putString("message", error.message)
|
|
1124
|
+
putString("code", error.code)
|
|
1125
|
+
}
|
|
1126
|
+
sendEvent("onESignError", errorMap)
|
|
1127
|
+
promise.reject(event.name.toString(), error.message)
|
|
1128
|
+
}
|
|
1129
|
+
)
|
|
1130
|
+
} catch (e: Exception) {
|
|
1131
|
+
Log.e(TAG, "❌ registerDevice() exception: ${e.message}", e)
|
|
1132
|
+
promise.reject("ESIGN_EXCEPTION", e.message, e)
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
@ReactMethod
|
|
1137
|
+
fun listCerts(
|
|
1138
|
+
pageNumber: Int,
|
|
1139
|
+
pageSize: Int,
|
|
1140
|
+
promise: Promise
|
|
1141
|
+
) {
|
|
1142
|
+
Log.d(TAG, "▶️ listCerts() called")
|
|
1143
|
+
try {
|
|
1144
|
+
val currentActivity = reactApplicationContext.currentActivity
|
|
1145
|
+
if (currentActivity == null) {
|
|
1146
|
+
Log.e(TAG, "❌ listCerts() failed: Activity not available")
|
|
1147
|
+
promise.reject("NO_ACTIVITY", "Activity not available")
|
|
1148
|
+
return
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
SdkeSign.listCerts(
|
|
1152
|
+
context = currentActivity,
|
|
1153
|
+
pageNumber = pageNumber,
|
|
1154
|
+
pageSize = pageSize,
|
|
1155
|
+
callbackSuccess = { certs ->
|
|
1156
|
+
Log.d(TAG, "✅ listCerts() success - Count: ${certs.size}")
|
|
1157
|
+
val (eventMap, promiseMap) = createSeparateMapsWithArray(
|
|
1158
|
+
arrayBuilder = { array: WritableArray ->
|
|
1159
|
+
certs.forEach { cert ->
|
|
1160
|
+
val certMap = Arguments.createMap().apply {
|
|
1161
|
+
putString("serial", cert.serial)
|
|
1162
|
+
putString("subject", cert.subject)
|
|
1163
|
+
putString("validFrom", cert.validFrom)
|
|
1164
|
+
putString("validTo", cert.validTo)
|
|
1165
|
+
}
|
|
1166
|
+
array.pushMap(certMap)
|
|
1167
|
+
}
|
|
1168
|
+
},
|
|
1169
|
+
mapBuilder = { map: WritableMap, array: WritableArray -> map.putArray("certs", array) }
|
|
1170
|
+
)
|
|
1171
|
+
sendEvent("onESignListCertsSuccess", eventMap)
|
|
1172
|
+
promise.resolve(promiseMap)
|
|
1173
|
+
},
|
|
1174
|
+
callbackError = { event, error ->
|
|
1175
|
+
Log.e(TAG, "❌ listCerts() failed - Event: $event, Message: ${error.message}")
|
|
1176
|
+
val errorMap = Arguments.createMap().apply {
|
|
1177
|
+
putString("event", event.name.toString())
|
|
1178
|
+
putString("message", error.message)
|
|
1179
|
+
putString("code", error.code)
|
|
1180
|
+
}
|
|
1181
|
+
sendEvent("onESignError", errorMap)
|
|
1182
|
+
promise.reject(event.name.toString(), error.message)
|
|
1183
|
+
}
|
|
1184
|
+
)
|
|
1185
|
+
} catch (e: Exception) {
|
|
1186
|
+
Log.e(TAG, "❌ listCerts() exception: ${e.message}", e)
|
|
1187
|
+
promise.reject("ESIGN_EXCEPTION", e.message, e)
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
@ReactMethod
|
|
1192
|
+
fun verifyCert(
|
|
1193
|
+
serial: String,
|
|
1194
|
+
promise: Promise
|
|
1195
|
+
) {
|
|
1196
|
+
Log.d(TAG, "▶️ verifyCert() called")
|
|
1197
|
+
try {
|
|
1198
|
+
val currentActivity = reactApplicationContext.currentActivity
|
|
1199
|
+
if (currentActivity == null) {
|
|
1200
|
+
Log.e(TAG, "❌ verifyCert() failed: Activity not available")
|
|
1201
|
+
promise.reject("NO_ACTIVITY", "Activity not available")
|
|
1202
|
+
return
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1205
|
+
SdkeSign.verifyCert(
|
|
1206
|
+
context = currentActivity,
|
|
1207
|
+
serial = serial,
|
|
1208
|
+
callbackSuccess = { code, message ->
|
|
1209
|
+
Log.d(TAG, "✅ verifyCert() success")
|
|
1210
|
+
val (eventMap, promiseMap) = createSeparateMaps { map ->
|
|
1211
|
+
map.putString("code", code.toString())
|
|
1212
|
+
map.putString("message", message)
|
|
1213
|
+
}
|
|
1214
|
+
sendEvent("onESignVerifyCertSuccess", eventMap)
|
|
1215
|
+
promise.resolve(promiseMap)
|
|
1216
|
+
},
|
|
1217
|
+
callbackError = { event, error ->
|
|
1218
|
+
Log.e(TAG, "❌ verifyCert() failed - Event: $event, Message: ${error.message}")
|
|
1219
|
+
val errorMap = Arguments.createMap().apply {
|
|
1220
|
+
putString("event", event.name.toString())
|
|
1221
|
+
putString("message", error.message)
|
|
1222
|
+
putString("code", error.code)
|
|
1223
|
+
}
|
|
1224
|
+
sendEvent("onESignError", errorMap)
|
|
1225
|
+
promise.reject(event.name.toString(), error.message)
|
|
1226
|
+
}
|
|
1227
|
+
)
|
|
1228
|
+
} catch (e: Exception) {
|
|
1229
|
+
Log.e(TAG, "❌ verifyCert() exception: ${e.message}", e)
|
|
1230
|
+
promise.reject("ESIGN_EXCEPTION", e.message, e)
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
@ReactMethod
|
|
1235
|
+
fun listSignRequest(
|
|
1236
|
+
pageNumber: Int,
|
|
1237
|
+
pageSize: Int,
|
|
1238
|
+
promise: Promise
|
|
1239
|
+
) {
|
|
1240
|
+
Log.d(TAG, "▶️ listSignRequest() called")
|
|
1241
|
+
try {
|
|
1242
|
+
val currentActivity = reactApplicationContext.currentActivity
|
|
1243
|
+
if (currentActivity == null) {
|
|
1244
|
+
Log.e(TAG, "❌ listSignRequest() failed: Activity not available")
|
|
1245
|
+
promise.reject("NO_ACTIVITY", "Activity not available")
|
|
1246
|
+
return
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
SdkeSign.listSignRequest(
|
|
1250
|
+
context = currentActivity,
|
|
1251
|
+
pageNumber = pageNumber,
|
|
1252
|
+
pageSize = pageSize,
|
|
1253
|
+
callbackSuccess = { requests ->
|
|
1254
|
+
Log.d(TAG, "✅ listSignRequest() success - Count: ${requests.size}")
|
|
1255
|
+
val (eventMap, promiseMap) = createSeparateMapsWithArray(
|
|
1256
|
+
arrayBuilder = { array: WritableArray ->
|
|
1257
|
+
requests.forEach { request ->
|
|
1258
|
+
val requestMap = Arguments.createMap().apply {
|
|
1259
|
+
putString("requestId", request.requestId)
|
|
1260
|
+
putString("documentName", request.documentName)
|
|
1261
|
+
putString("status", request.status)
|
|
1262
|
+
}
|
|
1263
|
+
array.pushMap(requestMap)
|
|
1264
|
+
}
|
|
1265
|
+
},
|
|
1266
|
+
mapBuilder = { map: WritableMap, array: WritableArray -> map.putArray("requests", array) }
|
|
1267
|
+
)
|
|
1268
|
+
sendEvent("onESignListSignRequestSuccess", eventMap)
|
|
1269
|
+
promise.resolve(promiseMap)
|
|
1270
|
+
},
|
|
1271
|
+
callbackError = { event, error ->
|
|
1272
|
+
Log.e(TAG, "❌ listSignRequest() failed - Event: $event, Message: ${error.message}")
|
|
1273
|
+
val errorMap = Arguments.createMap().apply {
|
|
1274
|
+
putString("event", event.name.toString())
|
|
1275
|
+
putString("message", error.message)
|
|
1276
|
+
putString("code", error.code)
|
|
1277
|
+
}
|
|
1278
|
+
sendEvent("onESignError", errorMap)
|
|
1279
|
+
promise.reject(event.name.toString(), error.message)
|
|
1280
|
+
}
|
|
1281
|
+
)
|
|
1282
|
+
} catch (e: Exception) {
|
|
1283
|
+
Log.e(TAG, "❌ listSignRequest() exception: ${e.message}", e)
|
|
1284
|
+
promise.reject("ESIGN_EXCEPTION", e.message, e)
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
|
|
1288
|
+
@ReactMethod
|
|
1289
|
+
fun confirmSign(
|
|
1290
|
+
signRequestId: String,
|
|
1291
|
+
pinCode: String,
|
|
1292
|
+
authId: String?,
|
|
1293
|
+
authData: String?,
|
|
1294
|
+
confirm: Boolean,
|
|
1295
|
+
promise: Promise
|
|
1296
|
+
) {
|
|
1297
|
+
Log.d(TAG, "▶️ confirmSign() called")
|
|
1298
|
+
try {
|
|
1299
|
+
val currentActivity = reactApplicationContext.currentActivity
|
|
1300
|
+
if (currentActivity == null) {
|
|
1301
|
+
Log.e(TAG, "❌ confirmSign() failed: Activity not available")
|
|
1302
|
+
promise.reject("NO_ACTIVITY", "Activity not available")
|
|
1303
|
+
return
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1306
|
+
SdkeSign.confirmSign(
|
|
1307
|
+
context = currentActivity,
|
|
1308
|
+
signRequestId = signRequestId,
|
|
1309
|
+
pinCode = pinCode,
|
|
1310
|
+
authId = authId ?: "",
|
|
1311
|
+
authData = authData ?: "",
|
|
1312
|
+
confirm = confirm,
|
|
1313
|
+
callbackSuccess = { code, message ->
|
|
1314
|
+
Log.d(TAG, "✅ confirmSign() success")
|
|
1315
|
+
val (eventMap, promiseMap) = createSeparateMaps { map ->
|
|
1316
|
+
map.putString("code", code.toString())
|
|
1317
|
+
map.putString("message", message)
|
|
1318
|
+
}
|
|
1319
|
+
sendEvent("onESignConfirmSignSuccess", eventMap)
|
|
1320
|
+
promise.resolve(promiseMap)
|
|
1321
|
+
},
|
|
1322
|
+
callbackError = { event, error ->
|
|
1323
|
+
Log.e(TAG, "❌ confirmSign() failed - Event: $event, Message: ${error.message}")
|
|
1324
|
+
val errorMap = Arguments.createMap().apply {
|
|
1325
|
+
putString("event", event.name.toString())
|
|
1326
|
+
putString("message", error.message)
|
|
1327
|
+
putString("code", error.code)
|
|
1328
|
+
}
|
|
1329
|
+
sendEvent("onESignError", errorMap)
|
|
1330
|
+
promise.reject(event.name.toString(), error.message)
|
|
1331
|
+
}
|
|
1332
|
+
)
|
|
1333
|
+
} catch (e: Exception) {
|
|
1334
|
+
Log.e(TAG, "❌ confirmSign() exception: ${e.message}", e)
|
|
1335
|
+
promise.reject("ESIGN_EXCEPTION", e.message, e)
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
@ReactMethod
|
|
1340
|
+
fun authenticate(
|
|
1341
|
+
username: String,
|
|
1342
|
+
password: String,
|
|
1343
|
+
promise: Promise
|
|
1344
|
+
) {
|
|
1345
|
+
Log.d(TAG, "▶️ authenticate() called")
|
|
1346
|
+
try {
|
|
1347
|
+
SdkeSign.authenticate(
|
|
1348
|
+
username = username,
|
|
1349
|
+
password = password,
|
|
1350
|
+
callbackSuccess = { token, userId ->
|
|
1351
|
+
Log.d(TAG, "✅ authenticate() success")
|
|
1352
|
+
val (eventMap, promiseMap) = createSeparateMaps { map ->
|
|
1353
|
+
map.putString("token", token)
|
|
1354
|
+
map.putString("userId", userId.toString())
|
|
1355
|
+
}
|
|
1356
|
+
sendEvent("onESignAuthenticateSuccess", eventMap)
|
|
1357
|
+
promise.resolve(promiseMap)
|
|
1358
|
+
},
|
|
1359
|
+
callbackError = { event, error ->
|
|
1360
|
+
Log.e(TAG, "❌ authenticate() failed - Event: $event, Message: ${error.message}")
|
|
1361
|
+
val errorMap = Arguments.createMap().apply {
|
|
1362
|
+
putString("event", event.name.toString())
|
|
1363
|
+
putString("message", error.message)
|
|
1364
|
+
putString("code", error.code)
|
|
1365
|
+
}
|
|
1366
|
+
sendEvent("onESignError", errorMap)
|
|
1367
|
+
promise.reject(event.name.toString(), error.message)
|
|
1368
|
+
}
|
|
1369
|
+
)
|
|
1370
|
+
} catch (e: Exception) {
|
|
1371
|
+
Log.e(TAG, "❌ authenticate() exception: ${e.message}", e)
|
|
1372
|
+
promise.reject("ESIGN_EXCEPTION", e.message, e)
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
@ReactMethod
|
|
1377
|
+
fun registerRemoteSigning(
|
|
1378
|
+
accessToken: String,
|
|
1379
|
+
requestJson: String,
|
|
1380
|
+
promise: Promise
|
|
1381
|
+
) {
|
|
1382
|
+
Log.d(TAG, "▶️ registerRemoteSigning() called")
|
|
1383
|
+
try {
|
|
1384
|
+
SdkeSign.registerRemoteSigning(
|
|
1385
|
+
accessToken = accessToken,
|
|
1386
|
+
requestJson = requestJson,
|
|
1387
|
+
callbackSuccess = { rawResponse ->
|
|
1388
|
+
Log.d(TAG, "✅ registerRemoteSigning() success")
|
|
1389
|
+
val (eventMap, promiseMap) = createSeparateMaps { map ->
|
|
1390
|
+
map.putString("response", rawResponse)
|
|
1391
|
+
}
|
|
1392
|
+
sendEvent("onESignRegisterRemoteSigningSuccess", eventMap)
|
|
1393
|
+
promise.resolve(promiseMap)
|
|
1394
|
+
},
|
|
1395
|
+
callbackError = { event, error ->
|
|
1396
|
+
Log.e(TAG, "❌ registerRemoteSigning() failed - Event: $event, Message: ${error.message}")
|
|
1397
|
+
val errorMap = Arguments.createMap().apply {
|
|
1398
|
+
putString("event", event.name.toString())
|
|
1399
|
+
putString("message", error.message)
|
|
1400
|
+
putString("code", error.code)
|
|
1401
|
+
}
|
|
1402
|
+
sendEvent("onESignError", errorMap)
|
|
1403
|
+
promise.reject(event.name.toString(), error.message)
|
|
1404
|
+
}
|
|
1405
|
+
)
|
|
1406
|
+
} catch (e: Exception) {
|
|
1407
|
+
Log.e(TAG, "❌ registerRemoteSigning() exception: ${e.message}", e)
|
|
1408
|
+
promise.reject("ESIGN_EXCEPTION", e.message, e)
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
@ReactMethod
|
|
1413
|
+
fun signPdf(
|
|
1414
|
+
accessToken: String,
|
|
1415
|
+
requestJson: String,
|
|
1416
|
+
promise: Promise
|
|
1417
|
+
) {
|
|
1418
|
+
Log.d(TAG, "▶️ signPdf() called")
|
|
1419
|
+
try {
|
|
1420
|
+
SdkeSign.signPdf(
|
|
1421
|
+
accessToken = accessToken,
|
|
1422
|
+
requestJson = requestJson,
|
|
1423
|
+
callbackSuccess = { rawResponse ->
|
|
1424
|
+
Log.d(TAG, "✅ signPdf() success")
|
|
1425
|
+
val (eventMap, promiseMap) = createSeparateMaps { map ->
|
|
1426
|
+
map.putString("response", rawResponse)
|
|
1427
|
+
}
|
|
1428
|
+
sendEvent("onESignSignPdfSuccess", eventMap)
|
|
1429
|
+
promise.resolve(promiseMap)
|
|
1430
|
+
},
|
|
1431
|
+
callbackError = { event, error ->
|
|
1432
|
+
Log.e(TAG, "❌ signPdf() failed - Event: $event, Message: ${error.message}")
|
|
1433
|
+
val errorMap = Arguments.createMap().apply {
|
|
1434
|
+
putString("event", event.name.toString())
|
|
1435
|
+
putString("message", error.message)
|
|
1436
|
+
putString("code", error.code)
|
|
1437
|
+
}
|
|
1438
|
+
sendEvent("onESignError", errorMap)
|
|
1439
|
+
promise.reject(event.name.toString(), error.message)
|
|
1440
|
+
}
|
|
1441
|
+
)
|
|
1442
|
+
} catch (e: Exception) {
|
|
1443
|
+
Log.e(TAG, "❌ signPdf() exception: ${e.message}", e)
|
|
1444
|
+
promise.reject("ESIGN_EXCEPTION", e.message, e)
|
|
1445
|
+
}
|
|
1446
|
+
}
|
|
1447
|
+
|
|
1448
|
+
@ReactMethod
|
|
1449
|
+
fun sendConfirmationDocument(
|
|
1450
|
+
accessToken: String,
|
|
1451
|
+
requestJson: String,
|
|
1452
|
+
promise: Promise
|
|
1453
|
+
) {
|
|
1454
|
+
Log.d(TAG, "▶️ sendConfirmationDocument() called")
|
|
1455
|
+
try {
|
|
1456
|
+
SdkeSign.sendConfirmationDocument(
|
|
1457
|
+
accessToken = accessToken,
|
|
1458
|
+
requestJson = requestJson,
|
|
1459
|
+
callbackSuccess = { rawResponse ->
|
|
1460
|
+
Log.d(TAG, "✅ sendConfirmationDocument() success")
|
|
1461
|
+
val (eventMap, promiseMap) = createSeparateMaps { map ->
|
|
1462
|
+
map.putString("response", rawResponse)
|
|
1463
|
+
}
|
|
1464
|
+
sendEvent("onESignSendConfirmationDocumentSuccess", eventMap)
|
|
1465
|
+
promise.resolve(promiseMap)
|
|
1466
|
+
},
|
|
1467
|
+
callbackError = { event, error ->
|
|
1468
|
+
Log.e(TAG, "❌ sendConfirmationDocument() failed - Event: $event, Message: ${error.message}")
|
|
1469
|
+
val errorMap = Arguments.createMap().apply {
|
|
1470
|
+
putString("event", event.name.toString())
|
|
1471
|
+
putString("message", error.message)
|
|
1472
|
+
putString("code", error.code)
|
|
1473
|
+
}
|
|
1474
|
+
sendEvent("onESignError", errorMap)
|
|
1475
|
+
promise.reject(event.name.toString(), error.message)
|
|
1476
|
+
}
|
|
1477
|
+
)
|
|
1478
|
+
} catch (e: Exception) {
|
|
1479
|
+
Log.e(TAG, "❌ sendConfirmationDocument() exception: ${e.message}", e)
|
|
1480
|
+
promise.reject("ESIGN_EXCEPTION", e.message, e)
|
|
1481
|
+
}
|
|
1482
|
+
}
|
|
1483
|
+
|
|
787
1484
|
}
|