@socure-inc/docv-react-native 5.0.8 → 5.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/android/build.gradle
CHANGED
|
@@ -136,7 +136,7 @@ dependencies {
|
|
|
136
136
|
//noinspection GradleDynamicVersion
|
|
137
137
|
implementation "com.facebook.react:react-native:+"
|
|
138
138
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
139
|
-
implementation "com.socure.android:docv-capture:5.2.
|
|
139
|
+
implementation "com.socure.android:docv-capture:5.2.8"
|
|
140
140
|
|
|
141
141
|
def retrofit_version = "2.9.0"
|
|
142
142
|
implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
|
|
@@ -1,85 +1,75 @@
|
|
|
1
1
|
import SocureDocV
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
3
|
+
@objc(SocureDocVReactNative)
|
|
4
|
+
class SocureDocVReactNative: NSObject, RCTBridgeModule {
|
|
5
|
+
|
|
6
|
+
@objc(launchSocureDocV:socureApiKey:useSocureGov:onSuccess:onError:)
|
|
7
|
+
func launchSocureDocV(docVTransactionToken: String,
|
|
8
|
+
socureApiKey: String,
|
|
9
|
+
useSocureGov: Bool,
|
|
10
|
+
onSuccess: @escaping RCTResponseSenderBlock,
|
|
11
|
+
onError: @escaping RCTResponseSenderBlock) -> Void {
|
|
12
|
+
|
|
13
|
+
DispatchQueue.main.async {
|
|
14
|
+
guard let root = RCTPresentedViewController() else {
|
|
15
|
+
onError([["error": "Failed to get the root view controller"]])
|
|
16
|
+
return
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
let options = SocureDocVOptions(
|
|
20
|
+
publicKey: socureApiKey,
|
|
21
|
+
docvTransactionToken: docVTransactionToken,
|
|
22
|
+
presentingViewController: root,
|
|
23
|
+
useSocureGov: useSocureGov
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
SocureDocVSDK.launch(options) { result in
|
|
27
|
+
DispatchQueue.main.async {
|
|
28
|
+
switch result {
|
|
29
|
+
case .success(let success):
|
|
30
|
+
onSuccess([["deviceSessionToken": success.deviceSessionToken]])
|
|
31
|
+
case .failure(let failure):
|
|
32
|
+
let errorMessage = self.getErrorMessage(from: failure.error)
|
|
33
|
+
onError([["error": errorMessage,
|
|
34
|
+
"deviceSessionToken": failure.deviceSessionToken]])
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
static func requiresMainQueueSetup() -> Bool {
|
|
42
|
+
return true
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
static func moduleName() -> String! {
|
|
46
|
+
return "SocureDocVReactNative"
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
func getErrorMessage(from error: SocureDocVError) -> String {
|
|
50
|
+
switch error {
|
|
51
|
+
case .noInternetConnection:
|
|
52
|
+
return "No internet connection"
|
|
53
|
+
case .sessionInitiationFailure:
|
|
54
|
+
return "Failed to initiate the session"
|
|
55
|
+
case .cameraPermissionDeclined:
|
|
56
|
+
return "Permissions to open the camera declined by the user"
|
|
57
|
+
case .consentDeclined:
|
|
58
|
+
return "Consent declined by the user"
|
|
59
|
+
case .documentUploadFailure:
|
|
60
|
+
return "Failed to upload the documents"
|
|
61
|
+
case .invalidDocvTransactionToken:
|
|
62
|
+
return "Invalid transaction token"
|
|
63
|
+
case .invalidPublicKey:
|
|
64
|
+
return "Invalid or missing SDK key"
|
|
65
|
+
case .sessionExpired:
|
|
66
|
+
return "Session expired"
|
|
67
|
+
case .userCanceled:
|
|
68
|
+
return "Scan canceled by the user"
|
|
69
|
+
case .unknown:
|
|
70
|
+
fallthrough
|
|
71
|
+
@unknown default:
|
|
72
|
+
return "Unknown error"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@socure-inc/docv-react-native",
|
|
3
|
-
"version": "5.0
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"description": "The Predictive Document Verification (DocV) SDK React Native bridge allows you to use the DocV SDK v4 for Android and iOS in your React Native application.",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|