react-native-mdl-verification 1.0.6 → 1.0.9

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/README.md CHANGED
@@ -45,9 +45,14 @@ await MdlVerification.initialize('YOUR_LICENSE_KEY');
45
45
  ```javascript
46
46
  try {
47
47
  const result = await MdlVerification.startVerification({
48
+ command: 'VERIFY',
48
49
  stan: '000001',
49
50
  terminalId: 'TERMINAL_001',
50
- merchantId: 'MERCHANT_001'
51
+ merchantId: 'MERCHANT_001',
52
+ minAge: '18',
53
+ timeout: '60',
54
+ demoMode: false,
55
+ onlyVerified: true
51
56
  });
52
57
 
53
58
  if (result.isSuccessful) {
@@ -104,9 +109,16 @@ Initialize the MDL verification SDK with your license key.
104
109
  Start the MDL verification process.
105
110
 
106
111
  **Options:**
107
- - `stan` (string): Station number
108
- - `terminalId` (string): Terminal ID
109
- - `merchantId` (string): Merchant ID
112
+ - `command` (string, optional): Command type for verification
113
+ - `stan` (string, optional): Station number
114
+ - `terminalId` (string, optional): Terminal ID
115
+ - `merchantId` (string, optional): Merchant ID
116
+ - `testHostResponse` (string, optional): Test host response for testing purposes
117
+ - `minAge` (string, required): Minimum age requirement (default: '18')
118
+ - `mdlToken` (string, optional): MDL token for re-verification
119
+ - `timeout` (string, required): Timeout in seconds (default: '60')
120
+ - `demoMode` (boolean, optional): Enable demo mode
121
+ - `onlyVerified` (boolean, optional): Only accept verified documents
110
122
 
111
123
  **Returns:** `VerificationResponse` object
112
124
 
@@ -120,6 +132,23 @@ Add an event listener for verification events.
120
132
 
121
133
  ### Types
122
134
 
135
+ #### `VerificationOptions`
136
+
137
+ ```typescript
138
+ interface VerificationOptions {
139
+ command?: string; // Command type for verification
140
+ stan?: string; // Station number
141
+ terminalId?: string; // Terminal ID
142
+ merchantId?: string; // Merchant ID
143
+ testHostResponse?: string; // Test host response for testing
144
+ minAge: string; // Minimum age requirement (e.g., '18', '21')
145
+ mdlToken?: string; // MDL token for re-verification
146
+ timeout: string; // Timeout in seconds (e.g., '60')
147
+ demoMode?: boolean; // Enable demo mode
148
+ onlyVerified?: boolean; // Only accept verified documents
149
+ }
150
+ ```
151
+
123
152
  #### `VerificationResponse`
124
153
 
125
154
  ```typescript
@@ -128,18 +157,20 @@ interface VerificationResponse {
128
157
  stan?: string;
129
158
  terminalId?: string;
130
159
  merchantId?: string;
131
- success?: string;
132
- successMesg?: string;
133
- status?: number;
134
- mdlToken?: string;
135
- docType?: string;
136
- docValid?: string;
137
- authMethod?: string;
138
- authSuccess?: string;
139
- msoValid?: string;
140
- cert?: string;
141
- ica_cert?: string;
142
- isSuccessful?: boolean;
160
+ success?: string; // 'Y' for success, 'N' for failure
161
+ successMesg?: string; // Success or error message
162
+ status?: number; // Status code
163
+ mdlToken?: string; // Token for the verified MDL
164
+ docType?: string; // Document type (e.g., 'mDL')
165
+ docValid?: string; // Document validity status
166
+ authMethod?: string; // Authentication method used
167
+ authSuccess?: string; // Authentication success status
168
+ msoValid?: string; // MSO (Mobile Security Object) validity
169
+ cert?: string; // Certificate data
170
+ ica_cert?: string; // Intermediate CA certificate
171
+ isSuccessful?: boolean; // Convenience boolean (true if success === 'Y')
172
+ applicationId?: string; // Application ID (returned on license errors)
173
+ licenseKey?: string; // License key (returned on license errors)
143
174
  }
144
175
  ```
145
176
 
@@ -17,8 +17,8 @@ import androidx.activity.ComponentActivity
17
17
  class MdlVerificationBridge(reactContext: ReactApplicationContext) :
18
18
  ReactContextBaseJavaModule(reactContext) {
19
19
  private lateinit var coordinator: MdlVerificationCoordinator
20
- private local_licenseKey: String
21
- private local_applicationId: String
20
+ private var local_licenseKey: String = ""
21
+ private var local_applicationId: String = ""
22
22
 
23
23
 
24
24
  companion object {
@@ -54,9 +54,9 @@ class MdlVerificationBridge(reactContext: ReactApplicationContext) :
54
54
  map.putString("msoValid", response.msoValid ?: "")
55
55
  map.putString("cert", response.cert ?: "")
56
56
  map.putString("ica_cert", response.ica_cert ?: "")
57
- if (response?.successMesg?.indexOf(INVALID_LIC") >=0) {
58
- map.putString("licenseKey", response.licenseKey?: "")
59
- map.putString("applicationId", response.applicationId?: "")
57
+ if (response?.successMesg?.indexOf("INVALID_LIC")?:-1 >=0) {
58
+ map.putString("licenseKey", local_licenseKey?: "")
59
+ map.putString("applicationId", local_applicationId?: "")
60
60
  }
61
61
 
62
62
 
@@ -108,7 +108,7 @@ class MdlVerificationBridge(reactContext: ReactApplicationContext) :
108
108
  coordinator = MdlVerificationCoordinator(currentActivity)
109
109
  coordinator.initSDK(licenseKey)
110
110
  local_licenseKey = licenseKey;
111
- local_applicationId = currentActivity.getApplicationId();
111
+ local_applicationId = currentActivity.packageName;
112
112
 
113
113
  promise.resolve("SDK initialized successfully")
114
114
  Log.d(TAG, "SDK initialized successfully")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-mdl-verification",
3
- "version": "1.0.6",
3
+ "version": "1.0.9",
4
4
  "description": "React Native bridge for MDL (Mobile Driver's License) verification using CheckMDL SDK",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",