Commit fac15653 authored by jiacheng.mao's avatar jiacheng.mao

ios new_sdk 20231127删除旧版本插件

parent 574d6b39
{
"name": "cordova-plugin-hand-idcardplugin",
"version": "0.3.1",
"description": "",
"cordova": {
"id": "cordova-plugin-hand-idcardplugin",
"platforms": [
"ios",
"android"
]
},
"keywords": [
"ecosystem:cordova"
],
"author": "",
"license": "ISC"
}
<?xml version='1.0' encoding='utf-8'?>
<plugin id="cordova-plugin-hand-idcardplugin" version="0.3.1" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
<name>IdCardPlugin</name>
<js-module name="IdCardPlugin" src="www/IdCardPlugin.js">
<clobbers target="cordova.plugins.IdCardPlugin" />
</js-module>
<!-- android -->
<platform name="android">
<!-- 业务类指定 -->
<config-file target="res/xml/config.xml" parent="/*">
<feature name="IdCardIdentifyPlugin">
<param name="android-package" value="com.xg.idcard.IdCardIdentifyPlugin"/>
</feature>
</config-file>
<config-file target="config.xml" parent="/*">
<!-- QSign 支持的最低 SDK 版本是 21 -->
<preference name="android-minSdkVersion" value="21"/>
</config-file>
<!-- 需要的android权限 -->
<config-file target="AndroidManifest.xml" parent="/*">
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
</config-file>
<config-file target="AndroidManifest.xml" parent="/manifest/application">
<activity android:name="com.qsign.face.LivenessDetectActivity"/>
</config-file>
<!-- arr引用 -->
<resource-file src="src/android/lib/jsgzsdk.aar" target="libs/jsgzsdk.aar" />
<framework src="src/android/lib/idCard.gradle" custom="true" type="gradleReference" />
<source-file src="src/android/java/IdCardIdentifyPlugin.java" target-dir="src/com/xg/idcard/" />
<source-file src="src/android/lib/com.xcmg.app.dev-license.qsign-android" target-dir="assets/" />
<source-file src="src/android/lib/com.xcmg.app-license.qsign-android" target-dir="assets/" />
</platform>
<platform name="ios">
<config-file parent="/*" target="config.xml">
<feature name="IdCardIdentifyPlugin">
<param name="ios-package" value="IdCardIdentifyCordova"/>
</feature>
</config-file>
<!-- 第三方库依赖 -->
<config-file target="*-Info.plist" parent="NSCameraUsageDescription">
<string>亲,我们需要访问您的相机,用于拍摄人脸、身份证等照片</string>
</config-file>
<config-file target="*-Info.plist" parent="NSFaceIDUsageDescription">
<string>需要设备访问Face ID,用于校验权限</string>
</config-file>
<config-file target="*-Info.plist" parent="NSMicrophoneUsageDescription">
<string>亲,我们需要访问您的麦克风,用于录制视频</string>
</config-file>
<config-file target="*-Info.plist" parent="NSPhotoLibraryUsageDescription">
<string>亲,我们需要访问您的相册,用于提供图片素材</string>
</config-file>
<!-- <config-file target="*-Info.plist" parent="NSPhotoLibraryAddUsageDescription">
<string>亲,我们需要访问您的相册,用于提供图片素材</string>
</config-file> -->
<header-file src="src/ios/IdCardIdentifyCordova.h" target-dir="."/>
<source-file src="src/ios/IdCardIdentifyCordova.m" target-dir="."/>
<!-- <framework src="CoreBluetooth.framework" weak="true"/> -->
<framework src="src/ios/QsignSDK/QsignFaceSDK.framework" custom="true" embed="true" />
<framework src="src/ios/QsignSDK/QsignNotarySDK.framework" custom="true" embed="true"/>
<framework src="src/ios/QsignSDK/QsignSafeSDK.framework" custom="true" embed="true" />
<!-- <source-file src="src/ios/QsignSDK/com.xcmg.app-license.qsign-ios" target-dir="."/>
<source-file src="src/ios/QsignSDK/com.xcmg.app.dev-license.qsign-ios" target-dir="."/> -->
<resource-file src="src/ios/QsignSDK/com.xcmg.app-license.qsign-ios" target-dir="res/com.xcmg.app-license.qsign-ios"/>
<resource-file src="src/ios/QsignSDK/com.xcmg.app.dev-license.qsign-ios" target-dir="res/om.xcmg.app.dev-license.qsign-ios"/>
<resource-file src="src/ios/QsignSDK/com.cn.weslink.qsign.jsgzdemo-license.qsign-ios" target-dir="res/om.xcmg.app.dev-license.qsign-ios"/>
<!-- 3.0 4 required cordova 6.4.0
<framework src="src/ios/AFNetworking.framework" custom="true" embed="true" />
-->
<!-- 使用热更新插件中的 AFNetworkingFramwork.framework -->
<!-- 当单独使用时 放开 以下内容 -->
</platform>
</plugin>
var exec = require('cordova/exec');
/**
* SDK 返回的异常 Code 代码和含义:
*
* CANCELBACK,//中途返回退出
* FINGERERROR,//开启指纹错误
* NOUSER,//尚未注册
* FACEERROR,//人脸比对不通过
* PERSONREGISTER,//人工审核信息提交失败,请重新注册
* QRERROR,//二维码参数有误
* PARAMEERROR,//参数有误
* BIZNOERROR,//缺少业务编号
* FACETIMEOUT,//人脸检测超时
* PACKAGEERROR,//未授权的应用
* PERMISSIONERROR,//权限缺失 读写 摄像头 录音权限
* NOFINGERERROR,//尚无指纹请先设置
*/
/**
* SDK初始化方法,用于初始化插件。
*
* @param {Function} success - 成功回调方法(回调函数类型)。
* @param {Function} error - 失败回调方法(回调函数类型)。
* @param {string} license - 这个license是放在assets中的,根据应用ID供应商提供。
* @param {string} tag - 这个也是供应商提供。
* @param {boolean} isActive - 是否需要激活(true:需要激活,false:不需要激活)。
* @param {boolean} isProdEnv - 服务器环境(true:正式服务器环境,false:测试服务器环境)。
* @memberOf exports
*
* @example
* // 成功回调方法示例
* function onSuccess(res) {
* // res:
* {
* code: "SUCCESS",
* message: "初始化成功"
* }
* }
*
* function onError(err){
* // err:
* // 参数解析异常
* {
* code: "ERROR_CODE_PARAM",
* message: "参数错误:{异常信息}"
* }
*
* // SDK 初始化异常
* {
* code: "ERROR_CODE_INIT_SDK",
* message: "初始化失败,请检查参数等数据是否异常"
*
* }
* }
*
* // 调用init方法,并传入成功回调函数
* cordova.plugins.IdCardPlugin.init(onSuccess, onError,'cn.qsign.sdk.demo-license.qsign-android', 'hnsdk', true, false );
*/
exports.init = function (success, error,license, tag, isActive, isProdEnv) {
let arg = {
license: license,
tag: tag,
isActive: isActive,
isProdEnv: isProdEnv
};
exec(success, error, 'IdCardIdentifyPlugin', 'init', [arg]);
};
/**
* 实名认证并设置PIN接口 (需要开启读写、摄像头、录音权限)。
*
* @param {Function} success - 成功回调方法(回调函数类型)。
* @param {Function} error - 失败回调方法(回调函数类型)。
* @param {string} bizNo - 唯一编码 可以设置为身份证号,或唯一随机数。
* @param {string} name - 姓名。
* @param {string} IDNo - 身份证号。
* @param {boolean} disallowModify -是否不可修改(true:姓名和身份证不能修改并且不能为空,false:可以为空,但是不能不传)。
* @memberOf exports
*
* @example
* // 成功回调方法示例
* function onSuccess(res) {
* // res:
* {
* code: "NORMALREGISTER",
* message: "成功",
* data: {
* IDNo: "xxx", // 身份证号码
* name: "xxx", // 姓名
* phone: "xxx" // 手机号
* }
* }
* // 信息提交成功,等待人工审核:
* {
* code: "PERSONSERVICE",
* message: "信息提交成功,等待人工审核",
* data: {
* IDNo: "xxx", // 身份证号码
* name: "xxx", // 姓名
* phone: "xxx" // 手机号
* }
* }
* }
*
* function onError(err){
* // err:
* // 参数解析异常:
* {
* code: "ERROR_CODE_PARAM",
* message: "参数错误:{异常信息}"
* }
*
* // SDK 返回的异常:
* {
* code: "CANCELBACK",
* message: "{SDK返回的msg}"
* }
*
* // 权限异常:
* {
* code: "ERROR_PERMISSION_MISSING",
* message: "缺少权限:相机权限,读写存储权限,录音权限,",
* data: {
* missPermissions: [
* "读写存储权限", "相机权限", "录音权限" // 注意这些数量不一定,根据用户设置权限的情况
* ]
* }
* }
* }
*
* // 调用registerNotary方法,并传入成功回调函数
* cordova.plugins.IdCardPlugin.registerNotary( onSuccess, onError,'8888', '', '', false );
*/
exports.registerNotary = function (success, error, bizNo, name, IDNo, disallowModify ) {
let arg = {
bizNo: bizNo,
name: name,
IDNo: IDNo,
disallowModify: disallowModify
};
exec(success, error, 'IdCardIdentifyPlugin', 'registerNotary', [arg]);
};
/**
* 实名认证旧版本 (需要开启读写、摄像头、录音权限)。
*
* @param {Function} success - 成功回调方法(回调函数类型)。
* @param {Function} error - 失败回调方法(回调函数类型)。
* @param {string} name - 姓名。
* @param {string} IDNo - 身份证号。
* @param {string} phone - 手机号码。
* @memberOf exports
*
* @example
* // 成功回调方法示例
* function onSuccess(res) {
* // res:
* {
* code: "NORMALREGISTER",
* message: "成功",
* data: {
* IDNo: "xxx", // 身份证号码
* name: "xxx", // 姓名
* phone: "xxx" // 手机号
* }
* }
* // 信息提交成功,等待人工审核:
* {
* code: "PERSONSERVICE",
* message: "信息提交成功,等待人工审核",
* data: {
* IDNo: "xxx", // 身份证号码
* name: "xxx", // 姓名
* phone: "xxx" // 手机号
* }
* }
* }
*
* function onError(err){
* // err:
* // 参数解析异常:
* {
* code: "ERROR_CODE_PARAM",
* message: "参数错误:{异常信息}"
* }
*
* // SDK 返回的异常:
* {
* code: "CANCELBACK",
* message: "{SDK返回的msg}"
* }
*
* // 权限异常:
* {
* code: "ERROR_PERMISSION_MISSING",
* message: "缺少权限:相机权限,读写存储权限,录音权限,",
* data: {
* missPermissions: [
* "读写存储权限", "相机权限", "录音权限" // 注意这些数量不一定,根据用户设置权限的情况
* ]
* }
* }
* }
*
* // 调用identifyNotary方法,并传入成功回调函数
* cordova.plugins.IdCardPlugin.identifyNotary( onSuccess, onError,'章三', '64xxxx', '13579246810', false);
*/
exports.identifyNotary = function (success, error,name, IDNo, phone ) {
let arg = {
name: name,
IDNo: IDNo,
phone: phone
};
exec(success, error, 'IdCardIdentifyPlugin', 'identifyNotary', [arg]);
};
/**
* 查询是否有协同密钥。
*
* @param {Function} success - 成功回调方法(回调函数类型)。
* @param {Function} error - 失败回调方法(回调函数类型)。
* @param {string} bizNo - 唯一编码 可以设置为身份证号,或唯一随机数。
* @memberOf exports
*
* @example
* // 成功回调方法示例
* function onSuccess(res) {
* // res:
* {
* code: "SUCCESS",
* message: "成功",
* data: {
* haveUser: true
* }
* }
* }
*
* function onError(err){
* // err:
* // 参数解析异常
* {
* code: "ERROR_CODE_PARAM",
* message: "参数错误:{异常信息}"
* }
* }
*
* // 调用haveUser方法,并传入成功回调函数
* cordova.plugins.IdCardPlugin.haveUser(onSuccess, onError, '8888' );
*/
exports.haveUser = function (success, error,bizNo) {
let arg = {
bizNo: bizNo
};
exec(success, error, 'IdCardIdentifyPlugin', 'haveUser', [arg]);
};
/**
*
*
* @param {Function} success - 成功回调方法(回调函数类型)。
* @param {Function} error - 失败回调方法(回调函数类型)。
* @param {string} bizNo - 唯一编码 可以设置为身份证号,或唯一随机数。
* @memberOf exports
*
* @example
* // 成功回调方法示例
* function onSuccess(res) {
* // res:
* {
* code: "SUCCESS",
* message: "激活成功",
* data: {
* IDNo: "xxx", // 身份证号码
* name: "xxx", // 姓名
* phone: "xxx" // 手机号
* }
* }
* }
*
* function onError(err){
* // err:
* // 参数解析异常
* {
* code: "ERROR_CODE_PARAM",
* message: "参数错误:{异常信息}"
* }
*
* // SDK 返回的异常
* {
* code: "CANCELBACK",
* message: "{SDK返回的msg}"
* }
* }
*
* // 调用activeUserNotary方法,并传入成功回调函数
* cordova.plugins.IdCardPlugin.activeUserNotary(onSuccess, onError, '8888');
*/
exports.activeUserNotary = function (success, error, bizNo) {
let arg = {
bizNo: bizNo
};
exec(success, error, 'IdCardIdentifyPlugin', 'activeUserNotary', [arg]);
};
/**
* 实名认证
*
* @param {Function} success - 成功回调方法(回调函数类型)。
* @param {Function} error - 失败回调方法(回调函数类型)。
* @param {string} name - 姓名。
* @param {string} IDNo - 身份证号。
* @memberOf exports
*
* @example
* // 成功回调方法示例
* function onSuccess(res) {
* // res:
* {
* code: "SUCCESS",
* message: "操作成功",
* data: {
* faceImage: "/data/data/包名/QSign_Face/1600233451.jpg"
* }
* }
* }
*
* function onError(err){
* // err:
* // 参数解析异常
* {
* code: "ERROR_CODE_PARAM",
* message: "参数错误:{异常信息}"
* }
*
* // SDK 返回的异常
* {
* code: "CANCELBACK",
* message: "{SDK返回的msg}"
* }
* }
*
* // 调用qsignLivenessNotary方法,并传入成功回调函数
* cordova.plugins.IdCardPlugin.qsignLivenessNotary( onSuccess, onError,'章三', '511222*******');
*/
exports.qsignLivenessNotary = function (success, error, name, IDNo) {
let arg = {
name: name,
IDNo: IDNo
};
exec(success, error, 'IdCardIdentifyPlugin', 'qsignLivenessNotary', [arg]);
};
/**
* 设置手写签名接口
*
* @param {Function} success - 成功回调方法(回调函数类型)。
* @param {Function} error - 失败回调方法(回调函数类型)。
* @param {string} bizNo - 唯一编码 可以设置为身份证号,或唯一随机数。
* @memberOf exports
*
* @example
* // 成功回调方法示例
* function onSuccess(res) {
* // res:
* {
* code: "SUCCESS",
* message: "成功"
* }
* }
*
* function onError(err){
* // err:
* // 参数解析异常
* {
* code: "ERROR_CODE_PARAM",
* message: "参数错误:{异常信息}"
* }
*
* // SDK 返回的异常
* {
* code: "CANCELBACK",
* message: "{SDK返回的msg}"
* }
* }
*
* // 调用setWriteImgNotary方法,并传入成功回调函数
* cordova.plugins.IdCardPlugin.setWriteImgNotary( onSuccess, onError, '8888');
*/
exports.setWriteImgNotary = function (success, error, bizNo) {
let arg = {
bizNo: bizNo
};
exec(success, error, 'IdCardIdentifyPlugin', 'setWriteImgNotary', [arg]);
};
/**
* 开启/关闭指纹代替PIN接口
*
* @param {Function} success - 成功回调方法(回调函数类型)。
* @param {Function} error - 失败回调方法(回调函数类型)。
* @memberOf exports
*
* @example
* // 成功回调方法示例
* function onSuccess(res) {
* // res:
* {
* code: "SUCCESS",
* message: "成功",
* data: {
* isFingerOpened: true
* }
* }
* }
*
* function onError(err){
* // err:
* // SDK 返回的异常
* {
* code: "CANCELBACK",
* message: "{SDK返回的msg}"
* }
* }
*
* // 调用setFingerNotary方法,并传入成功回调函数
* cordova.plugins.IdCardPlugin.setFingerNotary(onSuccess, onError);
*/
exports.setFingerNotary = function (success, error) {
exec(success, error, 'IdCardIdentifyPlugin', 'setFingerNotary', []);
};
/**
* 忘记PIN接口。
*
* @param {Function} success - 成功回调方法(回调函数类型)。
* @param {Function} error - 失败回调方法(回调函数类型)。
* @memberOf exports
*
* @example
* // 成功回调方法示例
* function onSuccess(res) {
* // res:
* {
* code: "SUCCESS",
* message: "成功",
* data: {
* isFingerOpened: true
* }
* }
* }
*
* function onError(err){
* // err:
* // SDK 返回的异常
* {
* code: "CANCELBACK",
* message: "{SDK返回的msg}"
* }
* }
*
* // 调用forgetPINNotary方法,并传入成功回调函数
* cordova.plugins.IdCardPlugin.forgetPINNotary(onSuccess, onError);
*/
exports.forgetPINNotary = function (success, error) {
exec(success, error, 'IdCardIdentifyPlugin', 'forgetPINNotary', []);
};
/**
* 签署接口
*
* @param {Function} success - 成功回调方法(回调函数类型)。
* @param {Function} error - 失败回调方法(回调函数类型)。
* @param {string} url - 签署的http地址
* @memberOf exports
*
* @example
* // 成功回调方法示例
* function onSuccess(res) {
* // res:
* {
* code: "SUCCESS",
* message: "成功"
* }
* }
*
* function onError(err){
* // err:
* // 参数解析异常
* {
* code: "ERROR_CODE_PARAM",
* message: "参数错误:{异常信息}"
* }
*
* // SDK 返回的异常
* {
* code: "CANCELBACK",
* message: "{SDK返回的msg}"
* }
*
* }
*
* // 调用webSignNotary方法,并传入成功回调函数
* cordova.plugins.IdCardPlugin.webSignNotary( onSuccess, onError,'https://baidu.com');
*/
exports.webSignNotary = function (success, error, url) {
let arg = {
url: url
};
exec(success, error, 'IdCardIdentifyPlugin', 'webSignNotary', [arg]);
};
/**
* 是否开启指纹。
*
* @param {Function} success - 成功回调方法(回调函数类型)。
* @param {Function} error - 失败回调方法(回调函数类型)。
* @memberOf exports
*
* @example
* // 成功回调方法示例
* function onSuccess(res) {
* // res:
* {
* code: "SUCCESS",
* message: "成功",
* data: {
* isFingerOpened: false
* }
* }
* }
* function onError(err) {
* // err: 不会触发
* }
*
* // 调用getFingerOpened方法,并传入成功回调函数
* cordova.plugins.IdCardPlugin.getFingerOpened( onSuccess, onError);
*/
exports.getFingerOpened = function (success, error) {
exec(success, error, 'IdCardIdentifyPlugin', 'getFingerOpened', []);
};
/**
* 清除接口。
*
* @param {Function} success - 成功回调方法(回调函数类型)。
* @param {Function} error - 失败回调方法(回调函数类型)。
* @memberOf exports
*
* @example
* // 成功回调方法示例
* function onSuccess(res) {
* // res:
* {
* code: "SUCCESS",
* message: "成功"
* }
* }
* function onError(err) {
* // err: 不会触发
* }
*
* // 调用clearUser方法,并传入成功回调函数
* cordova.plugins.IdCardPlugin.clearUser(onSuccess, onError);
*/
exports.clearUser = function (success, error) {
exec(success, error, 'IdCardIdentifyPlugin', 'clearUser', []);
};
下列方法全部废弃,请参考www/IdCardPlugin.js中的调用示例:
1.初始化 已废弃
//prod
cordova.plugins.IdCardPlugin.idCardIdentify(’prod‘, function (success) {}, function (reason) {});
//dev
cordova.plugins.IdCardPlugin.idCardIdentify(’dev‘, function (success) {}, function (reason) {});
2.实名认证
cordova.plugins.IdCardPlugin.idCardIdentify({"idNum":"身份证号码","idName":"姓名","phoneNum":"手机号"}, function (success) {}, function (reason) {});
3.人脸对比 成功回调返回人脸照片路径
cordova.plugins.IdCardPlugin.faceContrast({"idNum":"身份证号码","idName":"姓名"}, function (success) {}, function (reason) {});
package com.xg.idcard;
import static com.cn.qsign.jsgzlibrary.utils.QsignNotaryApi.QSIGNREGISTERCODE.NORMALREGISTER;
import android.Manifest;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.util.Base64;
import android.util.Log;
import com.cn.qsign.jsgzlibrary.utils.QsignNotaryApi;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaInterface;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.CordovaWebView;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.File;
import java.io.FileOutputStream;
import java.util.HashSet;
import java.util.Set;
public class IdCardIdentifyPlugin extends CordovaPlugin {
private static final String ACTION_INIT = "init";
private static final String ACTION_REGISTER_NOTARY = "registerNotary";
private static final String ACTION_HAVE_USER = "haveUser";
private static final String ACTION_ACTIVE_USER_NOTARY = "activeUserNotary";
private static final String ACTION_SET_WRITE_IMG_NOTARY = "setWriteImgNotary";
private static final String ACTION_SET_FINGER_NOTARY = "setFingerNotary";
private static final String ACTION_FORGET_PIN_NOTARY = "forgetPINNotary";
private static final String ACTION_WEB_SIGN_NOTARY = "webSignNotary";
private static final String ACTION_GET_FINGER_OPENED = "getFingerOpened";
private static final String ACTION_QSIGN_LIVENESS_NOTARY = "qsignLivenessNotary";
private static final String ACTION_IDENTIFY_NOTARY = "identifyNotary";
private static final String ACTION_CLEAR_USER = "clearUser";
private static final String ERROR_CODE_PARAM = "ERROR_CODE_PARAM";
private static final String ERROR_CODE_INIT_SDK = "INIT_SDK_ERROR";
private static final String ERROR_CODE_PERMISSION_ERROR = "ERROR_PERMISSION_MISSING";
private static final String CODE_SUCCESS = "SUCCESS";
private static final int REQUEST_PERMISSION_CODE = 21;
private static final String[] PERMISSIONS = new String[]{
Manifest.permission.CAMERA,
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.RECORD_AUDIO
};
private CallbackContext globalCallbackContext = null;
private JSONArray globalArgs = null;
private String license = "";
private String tag = "xugong";
private boolean isActive = true;
private boolean isProdEnv = false;
@Override
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
super.initialize(cordova, webView);
String packageName = cordova.getActivity().getPackageName();
if ("com.xcmg.app.dev".equals(packageName)) {
license = "com.xcmg.app.dev-license.qsign-android";
isProdEnv = false;
} else {
license = "com.xcmg.app-license.qsign-android";
isProdEnv = true;
}
boolean result = QsignNotaryApi.getInstance().init(cordova.getActivity().getApplication(), license, tag, isActive, isProdEnv);
Log.d("IdCardIdentifyPlugin", "result = " + result);
}
@Override
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
if (ACTION_INIT.equals(action)) {
initSDK(args, callbackContext);
return true;
} else if (ACTION_REGISTER_NOTARY.equals(action)) {
registerNotary(args, callbackContext);
return true;
} else if (ACTION_HAVE_USER.equals(action)) {
haveUser(args, callbackContext);
return true;
} else if (ACTION_ACTIVE_USER_NOTARY.equals(action)) {
activeUserNotary(args, callbackContext);
return true;
} else if (ACTION_SET_WRITE_IMG_NOTARY.equals(action)) {
setWriteImgNotary(args, callbackContext);
return true;
} else if (ACTION_SET_FINGER_NOTARY.equals(action)) {
setFingerNotary(callbackContext);
return true;
} else if (ACTION_FORGET_PIN_NOTARY.equals(action)) {
forgetPINNotary(callbackContext);
return true;
} else if (ACTION_WEB_SIGN_NOTARY.equals(action)) {
webSignNotary(args, callbackContext);
return true;
} else if (ACTION_CLEAR_USER.equals(action)) {
clearUser(callbackContext);
return true;
} else if (ACTION_GET_FINGER_OPENED.equals(action)) {
getFingerOpened(callbackContext);
return true;
} else if (ACTION_QSIGN_LIVENESS_NOTARY.equals(action)) {
qsignLivenessNotary(args, callbackContext);
return true;
} else if (ACTION_IDENTIFY_NOTARY.equals(action)) {
identifyNotary(args, callbackContext);
return true;
}
return false;
}
private void qsignLivenessNotary(JSONArray args, final CallbackContext callbackContext) {
String name = "";
String IDNo = "";
try {
JSONObject params = args.getJSONObject(0);
name = params.getString("name");
IDNo = params.getString("IDNo");
} catch (JSONException e) {
callbackContext.error(getResult("参数错误:" + e, ERROR_CODE_PARAM));
return;
}
QsignNotaryApi.getInstance().qsignLivenessNotary(cordova.getActivity(), name, IDNo, new QsignNotaryApi.notaryCallbackListener() {
@Override
public void onSuccess() {
callbackContext.success(getResult("操作成功", CODE_SUCCESS));
}
@Override
public void onError(QsignNotaryApi.QSIGNERRORCODE code, String msg) {
callbackContext.error(getResult(msg, code.name(), null));
}
});
}
private void initSDK(JSONArray args, final CallbackContext callbackContext) {
String license = "";
String tag = "";
boolean isActive = true;
boolean isProdEnv = false;
try {
JSONObject params = args.getJSONObject(0);
license = params.getString("license");
tag = params.getString("tag");
isActive = params.getBoolean("isActive");
isProdEnv = params.getBoolean("isProdEnv");
} catch (JSONException e) {
callbackContext.error(getResult("参数错误:" + e, ERROR_CODE_PARAM));
return;
}
/*
参数2 license
参数3 tag
参数4 是否激活 true
参数5 服务器环境 true:正式服务器环境 false:测试服务器环境hnsdk
*/
boolean result = QsignNotaryApi.getInstance().init(cordova.getActivity().getApplication(),
license, tag,
isActive, isProdEnv);
if (result) {
callbackContext.success(getResult("初始化成功", CODE_SUCCESS));
} else {
callbackContext.error(getResult("初始化失败,请检查参数等数据是否异常", ERROR_CODE_INIT_SDK));
}
}
/**
* 实名注册并设置PIN接口
*/
private void registerNotary(JSONArray args, final CallbackContext callbackContext) {
String bizNo = "";
String name = "";
String IDNo = "";
boolean disallowModify = true;
try {
JSONObject params = args.getJSONObject(0);
bizNo = params.getString("bizNo");
name = params.getString("name");
IDNo = params.getString("IDNo");
disallowModify = params.getBoolean("disallowModify");
} catch (JSONException e) {
callbackContext.error(getResult("参数错误:" + e, ERROR_CODE_PARAM));
return;
}
Set<String> requiredPermissions = getRequiredPermissions();
if (requiredPermissions.size() > 0) {
String[] permissions = requiredPermissions.toArray(new String[]{});
globalCallbackContext = callbackContext;
globalArgs = args;
cordova.requestPermissions(this, REQUEST_PERMISSION_CODE, permissions);
return;
}
//实名注册 并生成协同密钥 并增加签署口令设置
/*
参数2:bizNO 唯一编码 可以设置为身份证号,或唯一随机数
参数3:姓名
参数4:身份证号
参数5:是否不可修改 为true,即姓名和身份证不能修改并且不能为空
*/
QsignNotaryApi.getInstance().registerNotary(cordova.getActivity(), bizNo, name, IDNo, disallowModify, new QsignNotaryApi.registerCallbackListener() {
@Override
public void onSuccess(QsignNotaryApi.QSIGNREGISTERCODE code, String idnumber, String name, String phone) {
JSONObject data = new JSONObject();
try {
data.put("IDNo", idnumber);
data.put("name", name);
data.put("phone", phone);
} catch (JSONException ignored) {
}
String message = code == NORMALREGISTER ? "成功" : "信息提交成功,等待人工审核";
callbackContext.success(getResult(message, code.name(), data));
}
@Override
public void onError(QsignNotaryApi.QSIGNERRORCODE code, String msg) {
callbackContext.error(getResult(msg, code.name(), null));
}
});
}
private void identifyNotary(JSONArray args, final CallbackContext callbackContext) {
String name = "";
String IDNo = "";
String phone = "";
try {
JSONObject params = args.getJSONObject(0);
name = params.getString("name");
IDNo = params.getString("IDNo");
phone = params.getString("phone");
} catch (JSONException e) {
callbackContext.error(getResult("参数错误:" + e, ERROR_CODE_PARAM));
return;
}
Set<String> requiredPermissions = getRequiredPermissions();
if (requiredPermissions.size() > 0) {
String[] permissions = requiredPermissions.toArray(new String[]{});
globalCallbackContext = callbackContext;
globalArgs = args;
cordova.requestPermissions(this, REQUEST_PERMISSION_CODE, permissions);
return;
}
//实名认证 并生成协同密钥
/*
参数2:bizNO 唯一编码 可以设置为身份证号,或唯一随机数
参数3:姓名
参数4:身份证号
参数5:是否不可修改 为true,即姓名和身份证不能修改并且不能为空
*/
QsignNotaryApi.getInstance().identifyNotary(cordova.getActivity(), name, IDNo, phone, new QsignNotaryApi.registerCallbackListener() {
@Override
public void onSuccess(QsignNotaryApi.QSIGNREGISTERCODE code, String idnumber, String name, String phone) {
JSONObject data = new JSONObject();
try {
data.put("IDNo", idnumber);
data.put("name", name);
data.put("phone", phone);
} catch (JSONException ignored) {
}
String message = code == NORMALREGISTER ? "成功" : "信息提交成功,等待人工审核";
callbackContext.success(getResult(message, code.name(), data));
}
@Override
public void onError(QsignNotaryApi.QSIGNERRORCODE code, String msg) {
callbackContext.error(getResult(msg, code.name(), null));
}
});
}
private void activeUserNotary(JSONArray args, final CallbackContext callbackContext) {
String bizNo = "";
try {
JSONObject params = args.getJSONObject(0);
bizNo = params.getString("bizNo");
} catch (JSONException e) {
callbackContext.error(getResult("参数错误:" + e, ERROR_CODE_PARAM));
return;
}
QsignNotaryApi.getInstance().activeUserNotary(cordova.getActivity(), bizNo, new QsignNotaryApi.activeCallbackListener() {
@Override
public void onSuccess(String idnumber, String name, String phone) {
JSONObject result = new JSONObject();
try {
result.put("IDNo", idnumber);
result.put("name", name);
result.put("phone", phone);
} catch (JSONException ignored) {
}
callbackContext.success(getResult("激活成功", CODE_SUCCESS, result));
}
@Override
public void onError(QsignNotaryApi.QSIGNERRORCODE code, String msg) {
callbackContext.error(getResult(msg, code.name()));
}
});
}
private void haveUser(JSONArray args, CallbackContext callbackContext) {
String bizNo = "";
try {
JSONObject params = args.getJSONObject(0);
bizNo = params.getString("bizNo");
} catch (JSONException e) {
callbackContext.error(getResult("参数错误:" + e, ERROR_CODE_PARAM));
return;
}
Boolean haveUser = QsignNotaryApi.getInstance().haveUser(cordova.getActivity(), bizNo);
JSONObject result = new JSONObject();
try {
result.put("haveUser", haveUser);
} catch (JSONException ignored) {
}
callbackContext.success(getResult("成功", CODE_SUCCESS, result));
}
private void setWriteImgNotary(JSONArray args, final CallbackContext callbackContext) {
String bizNo = "";
try {
JSONObject params = args.getJSONObject(0);
bizNo = params.getString("bizNo");
} catch (JSONException e) {
callbackContext.error(getResult("参数错误:" + e, ERROR_CODE_PARAM));
return;
}
QsignNotaryApi.getInstance().setWriteImgNotary(cordova.getActivity(), bizNo, new QsignNotaryApi.notaryCallbackListener() {
@Override
public void onSuccess() {
callbackContext.success(getResult("成功", CODE_SUCCESS));
}
@Override
public void onError(QsignNotaryApi.QSIGNERRORCODE code, String msg) {
callbackContext.error(getResult(msg, code.name()));
}
});
}
private void setFingerNotary(final CallbackContext callbackContext) {
QsignNotaryApi.getInstance().setFingerNotary(cordova.getActivity(), new QsignNotaryApi.notaryCallbackListener() {
@Override
public void onSuccess() {
JSONObject result = new JSONObject();
try {
result.put("isFingerOpened", QsignNotaryApi.getInstance().getFingerOpened(cordova.getActivity()));
} catch (JSONException ignored) {
}
callbackContext.success(getResult("成功", CODE_SUCCESS, result));
}
@Override
public void onError(QsignNotaryApi.QSIGNERRORCODE code, String msg) {
callbackContext.error(getResult(msg, code.name()));
}
});
}
private void forgetPINNotary(final CallbackContext callbackContext) {
QsignNotaryApi.getInstance().forgetPINNotary(cordova.getActivity(), new QsignNotaryApi.notaryCallbackListener() {
@Override
public void onSuccess() {
callbackContext.success(getResult("成功", CODE_SUCCESS));
}
@Override
public void onError(QsignNotaryApi.QSIGNERRORCODE code, String msg) {
callbackContext.error(getResult(msg, code.name()));
}
});
}
private void webSignNotary(JSONArray args, final CallbackContext callbackContext) {
String url = "";
try {
JSONObject params = args.getJSONObject(0);
url = params.getString("url");
} catch (JSONException e) {
callbackContext.error(getResult("参数错误:" + e, ERROR_CODE_PARAM));
return;
}
QsignNotaryApi.getInstance().webSignNotary(cordova.getActivity(), url, new QsignNotaryApi.notaryCallbackListener() {
@Override
public void onSuccess() {
callbackContext.success(getResult("成功", CODE_SUCCESS));
}
@Override
public void onError(QsignNotaryApi.QSIGNERRORCODE code, String msg) {
callbackContext.error(getResult(msg, code.name()));
}
});
}
private void clearUser(CallbackContext callbackContext) {
QsignNotaryApi.getInstance().ClearUser(cordova.getActivity());
callbackContext.success(getResult("清除成功", CODE_SUCCESS));
}
private void getFingerOpened(CallbackContext callbackContext) {
JSONObject result = new JSONObject();
try {
result.put("isFingerOpened", QsignNotaryApi.getInstance().getFingerOpened(cordova.getActivity()));
} catch (JSONException ignored) {
}
callbackContext.success(getResult("成功", CODE_SUCCESS, result));
}
private JSONObject getResult(String message, String code) {
return getResult(message, code, null);
}
private JSONObject getResult(String message, String code, JSONObject data) {
JSONObject out = new JSONObject();
try {
if (code != null) {
out.put("code", code);
}
out.put("message", message);
if (data != null) {
out.put("data", data);
}
} catch (JSONException ignored) {
}
return out;
}
@Override
public void onRequestPermissionResult(int requestCode, String[] permissions, int[] grantResults) throws JSONException {
super.onRequestPermissionResult(requestCode, permissions, grantResults);
if (requestCode == REQUEST_PERMISSION_CODE) {
Set<String> requiredPermissions = getRequiredPermissions();
if (requiredPermissions.size() == 0) {
registerNotary(globalArgs, globalCallbackContext);
} else {
StringBuilder sb = new StringBuilder();
boolean hasStorageTint = false;
JSONArray missPermissionsArray = new JSONArray();
for (String s : requiredPermissions) {
if (Manifest.permission.WRITE_EXTERNAL_STORAGE.equals(s) || Manifest.permission.READ_EXTERNAL_STORAGE.equals(s)) {
if (!hasStorageTint) {
sb.append("读写存储权限,");
missPermissionsArray.put("读写存储权限");
hasStorageTint = true;
}
}
if (Manifest.permission.CAMERA.equals(s)) {
sb.append("相机权限,");
missPermissionsArray.put("相机权限");
}
if (Manifest.permission.RECORD_AUDIO.equals(s)) {
missPermissionsArray.put("录音权限");
sb.append("录音权限,");
}
}
JSONObject result = new JSONObject();
result.put("missPermissions", missPermissionsArray);
globalCallbackContext.error(getResult("缺少权限:" + sb, ERROR_CODE_PERMISSION_ERROR, result));
}
}
}
private Set<String> getRequiredPermissions() {
Set<String> sets = new HashSet<String>();
for (String permission : IdCardIdentifyPlugin.PERMISSIONS) {
boolean b = cordova.hasPermission(permission);
if (!b) {
sets.add(permission);
}
}
return sets;
}
private String saveImage(String base64String) {
byte[] decode = Base64.decode(base64String, Base64.DEFAULT);
Bitmap bitmap = BitmapFactory.decodeByteArray(decode, 0, decode.length);
File appDir = new File(cordova.getActivity().getApplicationContext().getFilesDir(), "QSign_Face");
if (!appDir.exists()) {
appDir.mkdir();
}
String fileName = System.currentTimeMillis() + ".jpg";
File file = new File(appDir, fileName);
try {
FileOutputStream fos = new FileOutputStream(file);
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fos);
fos.flush();
fos.close();
} catch (Exception e) {
e.printStackTrace();
}
return file.getPath();
}
}
IyDl5pQS3o3fFUQeXbstDxTvBS/uVKYWHDf549PcITq+WrHoe4ubjzoizlu5olJs2qHqvqAW4N+tnywSWMbzhMRiQKpx2SGHy7c+egnXWl5VCA3LRVMjRPsx+XE1bUHbL9RzjSUq/BN9WVz2HEryxSmRf+YD+QAKuc2e01Ei7c8=
\ No newline at end of file
OoC6eFPZ052U9SUIKADVkMowQX8QUK6xZdzz3R8W/15nMXisPRHSccLFlLalaf5n0pYf+/A087BXOcLDOfDqlWr0d68z0S+hNbmjvovgd4Og0sJodxnBHailPIGbjJPiqPByiAzke+Z6qxN3fB3bpA1ViXilJKXBwg5/bgJPxuE=
\ No newline at end of file
repositories{
jcenter()
flatDir {
dirs 'libs'
}
}
dependencies {
compile(name:"jsgzsdk",ext: 'aar')
//必须添加如下依赖!!!
implementation 'com.android.support:appcompat-v7:28.+'
implementation 'com.android.support:support-v4:28.+'
implementation 'com.android.support:recyclerview-v7:28.+'
implementation 'com.android.support:design:28.+'
implementation 'com.google.code.gson:gson:2.8.0'
implementation 'com.alibaba:fastjson:1.2.31'
implementation 'com.tencent:mmkv:1.2.14'
implementation 'com.getkeepsafe.relinker:relinker:1.4.3'
implementation 'com.lzy.net:okgo:3.0.4'
implementation ('com.github.bumptech.glide:glide:4.8.0'){
exclude group:"com.android.support"
}
implementation 'com.github.lzyzsd:jsbridge:1.0.4'
implementation 'com.otaliastudios:cameraview:1.6.1'
implementation "com.android.support:exifinterface:28.+"
}
android {
packagingOptions {
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
}
aaptOptions {
noCompress "dat"
}
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '28.0.0'
}
}
}
}
cordova.define('IdCardPlugin.IdCardPlugin', function (require, exports, module) {
var exec = require('cordova/exec')
/**
* SDK 返回的异常 Code 代码和含义:
*
* CANCELBACK,//中途返回退出
* FINGERERROR,//开启指纹错误
* NOUSER,//尚未注册
* FACEERROR,//人脸比对不通过
* PERSONREGISTER,//人工审核信息提交失败,请重新注册
* QRERROR,//二维码参数有误
* PARAMEERROR,//参数有误
* BIZNOERROR,//缺少业务编号
* FACETIMEOUT,//人脸检测超时
* PACKAGEERROR,//未授权的应用
* PERMISSIONERROR,//权限缺失 读写 摄像头 录音权限
* NOFINGERERROR,//尚无指纹请先设置
*/
/**
* SDK初始化方法,用于初始化插件。
*
* @param {Function} success - 成功回调方法(回调函数类型)。
* @param {Function} error - 失败回调方法(回调函数类型)。
* @param {string} license - 这个license是放在assets中的,根据应用ID供应商提供。
* @param {string} tag - 这个也是供应商提供。
* @param {boolean} isActive - 是否需要激活(true:需要激活,false:不需要激活)。
* @param {boolean} isProdEnv - 服务器环境(true:正式服务器环境,false:测试服务器环境)。
* @memberOf exports
*
* @example
* // 成功回调方法示例
* function onSuccess(res) {
* // res:
* {
* code: "SUCCESS",
* message: "初始化成功"
* }
* }
*
* function onError(err){
* // err:
* // 参数解析异常
* {
* code: "ERROR_CODE_PARAM",
* message: "参数错误:{异常信息}"
* }
*
* // SDK 初始化异常
* {
* code: "ERROR_CODE_INIT_SDK",
* message: "初始化失败,请检查参数等数据是否异常"
*
* }
* }
*
* // 调用init方法,并传入成功回调函数
* cordova.plugins.IdCardPlugin.init(onSuccess, onError,'cn.qsign.sdk.demo-license.qsign-android', 'hnsdk', true, false );
*/
exports.init = function (success, error, license, tag, isActive, isProdEnv) {
let arg = {
license: license,
tag: tag,
isActive: isActive,
isProdEnv: isProdEnv,
}
exec(success, error, 'IdCardIdentifyPlugin', 'init', [arg])
}
/**
* 实名认证并设置PIN接口 (需要开启读写、摄像头、录音权限)。
*
* @param {Function} success - 成功回调方法(回调函数类型)。
* @param {Function} error - 失败回调方法(回调函数类型)。
* @param {string} bizNo - 唯一编码 可以设置为身份证号,或唯一随机数。
* @param {string} name - 姓名。
* @param {string} IDNo - 身份证号。
* @param {boolean} disallowModify -是否不可修改(true:姓名和身份证不能修改并且不能为空,false:可以为空,但是不能不传)。
* @memberOf exports
*
* @example
* // 成功回调方法示例
* function onSuccess(res) {
* // res:
* {
* code: "NORMALREGISTER",
* message: "成功",
* data: {
* IDNo: "xxx", // 身份证号码
* name: "xxx", // 姓名
* phone: "xxx" // 手机号
* }
* }
* // 信息提交成功,等待人工审核:
* {
* code: "PERSONSERVICE",
* message: "信息提交成功,等待人工审核",
* data: {
* IDNo: "xxx", // 身份证号码
* name: "xxx", // 姓名
* phone: "xxx" // 手机号
* }
* }
* }
*
* function onError(err){
* // err:
* // 参数解析异常:
* {
* code: "ERROR_CODE_PARAM",
* message: "参数错误:{异常信息}"
* }
*
* // SDK 返回的异常:
* {
* code: "CANCELBACK",
* message: "{SDK返回的msg}"
* }
*
* // 权限异常:
* {
* code: "ERROR_PERMISSION_MISSING",
* message: "缺少权限:相机权限,读写存储权限,录音权限,",
* data: {
* missPermissions: [
* "读写存储权限", "相机权限", "录音权限" // 注意这些数量不一定,根据用户设置权限的情况
* ]
* }
* }
* }
*
* // 调用registerNotary方法,并传入成功回调函数
* cordova.plugins.IdCardPlugin.registerNotary( onSuccess, onError,'8888', '', '', false );
*/
exports.registerNotary = function (success, error, bizNo, name, IDNo, disallowModify) {
let arg = {
bizNo: bizNo,
name: name,
IDNo: IDNo,
disallowModify: disallowModify,
}
exec(success, error, 'IdCardIdentifyPlugin', 'registerNotary', [arg])
}
/**
* 实名认证旧版本 (需要开启读写、摄像头、录音权限)。
*
* @param {Function} success - 成功回调方法(回调函数类型)。
* @param {Function} error - 失败回调方法(回调函数类型)。
* @param {string} name - 姓名。
* @param {string} IDNo - 身份证号。
* @param {string} phone - 手机号码。
* @memberOf exports
*
* @example
* // 成功回调方法示例
* function onSuccess(res) {
* // res:
* {
* code: "NORMALREGISTER",
* message: "成功",
* data: {
* IDNo: "xxx", // 身份证号码
* name: "xxx", // 姓名
* phone: "xxx" // 手机号
* }
* }
* // 信息提交成功,等待人工审核:
* {
* code: "PERSONSERVICE",
* message: "信息提交成功,等待人工审核",
* data: {
* IDNo: "xxx", // 身份证号码
* name: "xxx", // 姓名
* phone: "xxx" // 手机号
* }
* }
* }
*
* function onError(err){
* // err:
* // 参数解析异常:
* {
* code: "ERROR_CODE_PARAM",
* message: "参数错误:{异常信息}"
* }
*
* // SDK 返回的异常:
* {
* code: "CANCELBACK",
* message: "{SDK返回的msg}"
* }
*
* // 权限异常:
* {
* code: "ERROR_PERMISSION_MISSING",
* message: "缺少权限:相机权限,读写存储权限,录音权限,",
* data: {
* missPermissions: [
* "读写存储权限", "相机权限", "录音权限" // 注意这些数量不一定,根据用户设置权限的情况
* ]
* }
* }
* }
*
* // 调用identifyNotary方法,并传入成功回调函数
* cordova.plugins.IdCardPlugin.identifyNotary( onSuccess, onError,'章三', '64xxxx', '13579246810', false);
*/
exports.identifyNotary = function (success, error, name, IDNo, phone) {
let arg = {
name: name,
IDNo: IDNo,
phone: phone,
}
exec(success, error, 'IdCardIdentifyPlugin', 'identifyNotary', [arg])
}
/**
* 查询是否有协同密钥。
*
* @param {Function} success - 成功回调方法(回调函数类型)。
* @param {Function} error - 失败回调方法(回调函数类型)。
* @param {string} bizNo - 唯一编码 可以设置为身份证号,或唯一随机数。
* @memberOf exports
*
* @example
* // 成功回调方法示例
* function onSuccess(res) {
* // res:
* {
* code: "SUCCESS",
* message: "成功",
* data: {
* haveUser: true
* }
* }
* }
*
* function onError(err){
* // err:
* // 参数解析异常
* {
* code: "ERROR_CODE_PARAM",
* message: "参数错误:{异常信息}"
* }
* }
*
* // 调用haveUser方法,并传入成功回调函数
* cordova.plugins.IdCardPlugin.haveUser(onSuccess, onError, '8888' );
*/
exports.haveUser = function (success, error, bizNo) {
let arg = {
bizNo: bizNo,
}
exec(success, error, 'IdCardIdentifyPlugin', 'haveUser', [arg])
}
/**
*
*
* @param {Function} success - 成功回调方法(回调函数类型)。
* @param {Function} error - 失败回调方法(回调函数类型)。
* @param {string} bizNo - 唯一编码 可以设置为身份证号,或唯一随机数。
* @memberOf exports
*
* @example
* // 成功回调方法示例
* function onSuccess(res) {
* // res:
* {
* code: "SUCCESS",
* message: "激活成功",
* data: {
* IDNo: "xxx", // 身份证号码
* name: "xxx", // 姓名
* phone: "xxx" // 手机号
* }
* }
* }
*
* function onError(err){
* // err:
* // 参数解析异常
* {
* code: "ERROR_CODE_PARAM",
* message: "参数错误:{异常信息}"
* }
*
* // SDK 返回的异常
* {
* code: "CANCELBACK",
* message: "{SDK返回的msg}"
* }
* }
*
* // 调用activeUserNotary方法,并传入成功回调函数
* cordova.plugins.IdCardPlugin.activeUserNotary(onSuccess, onError, '8888');
*/
exports.activeUserNotary = function (success, error, bizNo) {
let arg = {
bizNo: bizNo,
}
exec(success, error, 'IdCardIdentifyPlugin', 'activeUserNotary', [arg])
}
/**
* 实名认证
*
* @param {Function} success - 成功回调方法(回调函数类型)。
* @param {Function} error - 失败回调方法(回调函数类型)。
* @param {string} name - 姓名。
* @param {string} IDNo - 身份证号。
* @memberOf exports
*
* @example
* // 成功回调方法示例
* function onSuccess(res) {
* // res:
* {
* code: "SUCCESS",
* message: "操作成功",
* data: {
* faceImage: "/data/data/包名/QSign_Face/1600233451.jpg"
* }
* }
* }
*
* function onError(err){
* // err:
* // 参数解析异常
* {
* code: "ERROR_CODE_PARAM",
* message: "参数错误:{异常信息}"
* }
*
* // SDK 返回的异常
* {
* code: "CANCELBACK",
* message: "{SDK返回的msg}"
* }
* }
*
* // 调用qsignLivenessNotary方法,并传入成功回调函数
* cordova.plugins.IdCardPlugin.qsignLivenessNotary( onSuccess, onError,'章三', '511222*******');
*/
exports.qsignLivenessNotary = function (success, error, name, IDNo) {
let arg = {
name: name,
IDNo: IDNo,
}
exec(success, error, 'IdCardIdentifyPlugin', 'qsignLivenessNotary', [arg])
}
/**
* 设置手写签名接口
*
* @param {Function} success - 成功回调方法(回调函数类型)。
* @param {Function} error - 失败回调方法(回调函数类型)。
* @param {string} bizNo - 唯一编码 可以设置为身份证号,或唯一随机数。
* @memberOf exports
*
* @example
* // 成功回调方法示例
* function onSuccess(res) {
* // res:
* {
* code: "SUCCESS",
* message: "成功"
* }
* }
*
* function onError(err){
* // err:
* // 参数解析异常
* {
* code: "ERROR_CODE_PARAM",
* message: "参数错误:{异常信息}"
* }
*
* // SDK 返回的异常
* {
* code: "CANCELBACK",
* message: "{SDK返回的msg}"
* }
* }
*
* // 调用setWriteImgNotary方法,并传入成功回调函数
* cordova.plugins.IdCardPlugin.setWriteImgNotary( onSuccess, onError, '8888');
*/
exports.setWriteImgNotary = function (success, error, bizNo) {
let arg = {
bizNo: bizNo,
}
exec(success, error, 'IdCardIdentifyPlugin', 'setWriteImgNotary', [arg])
}
/**
* 开启/关闭指纹代替PIN接口
*
* @param {Function} success - 成功回调方法(回调函数类型)。
* @param {Function} error - 失败回调方法(回调函数类型)。
* @memberOf exports
*
* @example
* // 成功回调方法示例
* function onSuccess(res) {
* // res:
* {
* code: "SUCCESS",
* message: "成功",
* data: {
* isFingerOpened: true
* }
* }
* }
*
* function onError(err){
* // err:
* // SDK 返回的异常
* {
* code: "CANCELBACK",
* message: "{SDK返回的msg}"
* }
* }
*
* // 调用setFingerNotary方法,并传入成功回调函数
* cordova.plugins.IdCardPlugin.setFingerNotary(onSuccess, onError);
*/
exports.setFingerNotary = function (success, error) {
exec(success, error, 'IdCardIdentifyPlugin', 'setFingerNotary', [])
}
/**
* 忘记PIN接口。
*
* @param {Function} success - 成功回调方法(回调函数类型)。
* @param {Function} error - 失败回调方法(回调函数类型)。
* @memberOf exports
*
* @example
* // 成功回调方法示例
* function onSuccess(res) {
* // res:
* {
* code: "SUCCESS",
* message: "成功",
* data: {
* isFingerOpened: true
* }
* }
* }
*
* function onError(err){
* // err:
* // SDK 返回的异常
* {
* code: "CANCELBACK",
* message: "{SDK返回的msg}"
* }
* }
*
* // 调用forgetPINNotary方法,并传入成功回调函数
* cordova.plugins.IdCardPlugin.forgetPINNotary(onSuccess, onError);
*/
exports.forgetPINNotary = function (success, error) {
exec(success, error, 'IdCardIdentifyPlugin', 'forgetPINNotary', [])
}
/**
* 签署接口
*
* @param {Function} success - 成功回调方法(回调函数类型)。
* @param {Function} error - 失败回调方法(回调函数类型)。
* @param {string} url - 签署的http地址
* @memberOf exports
*
* @example
* // 成功回调方法示例
* function onSuccess(res) {
* // res:
* {
* code: "SUCCESS",
* message: "成功"
* }
* }
*
* function onError(err){
* // err:
* // 参数解析异常
* {
* code: "ERROR_CODE_PARAM",
* message: "参数错误:{异常信息}"
* }
*
* // SDK 返回的异常
* {
* code: "CANCELBACK",
* message: "{SDK返回的msg}"
* }
*
* }
*
* // 调用webSignNotary方法,并传入成功回调函数
* cordova.plugins.IdCardPlugin.webSignNotary( onSuccess, onError,'https://baidu.com');
*/
exports.webSignNotary = function (success, error, url) {
let arg = {
url: url,
}
exec(success, error, 'IdCardIdentifyPlugin', 'webSignNotary', [arg])
}
/**
* 是否开启指纹。
*
* @param {Function} success - 成功回调方法(回调函数类型)。
* @param {Function} error - 失败回调方法(回调函数类型)。
* @memberOf exports
*
* @example
* // 成功回调方法示例
* function onSuccess(res) {
* // res:
* {
* code: "SUCCESS",
* message: "成功",
* data: {
* isFingerOpened: false
* }
* }
* }
* function onError(err) {
* // err: 不会触发
* }
*
* // 调用getFingerOpened方法,并传入成功回调函数
* cordova.plugins.IdCardPlugin.getFingerOpened( onSuccess, onError);
*/
exports.getFingerOpened = function (success, error) {
exec(success, error, 'IdCardIdentifyPlugin', 'getFingerOpened', [])
}
/**
* 清除接口。
*
* @param {Function} success - 成功回调方法(回调函数类型)。
* @param {Function} error - 失败回调方法(回调函数类型)。
* @memberOf exports
*
* @example
* // 成功回调方法示例
* function onSuccess(res) {
* // res:
* {
* code: "SUCCESS",
* message: "成功"
* }
* }
* function onError(err) {
* // err: 不会触发
* }
*
* // 调用clearUser方法,并传入成功回调函数
* cordova.plugins.IdCardPlugin.clearUser(onSuccess, onError);
*/
exports.clearUser = function (success, error) {
exec(success, error, 'IdCardIdentifyPlugin', 'clearUser', [])
}
})
{
"cordova-plugin-whitelist": {
"source": {
"type": "registry",
"id": "cordova-plugin-whitelist@1.3.2"
},
"is_top_level": true,
"variables": {}
},
"cordova-plugin-dialogs": {
"source": {
"type": "registry",
"id": "cordova-plugin-dialogs"
},
"is_top_level": true,
"variables": {}
},
"ionic-plugin-keyboard": {
"source": {
"type": "registry",
"id": "ionic-plugin-keyboard@2.2.0"
},
"is_top_level": true,
"variables": {}
},
"cordova-plugin-device": {
"source": {
"type": "registry",
"id": "cordova-plugin-device@2.0.2"
},
"is_top_level": true,
"variables": {}
},
"cordova-plugin-network-information": {
"source": {
"type": "registry",
"id": "cordova-plugin-network-information"
},
"is_top_level": true,
"variables": {}
},
"com.handmobile.cordovaplugin.hotpatch": {
"source": {
"type": "git",
"url": "https://github.com/nature2104/hls-cordova-plugin-hotpatch.git",
"subdir": "."
},
"is_top_level": true,
"variables": {}
},
"cordova-plugin-datepicker": {
"source": {
"type": "registry",
"id": "cordova-plugin-datepicker"
},
"is_top_level": true,
"variables": {}
},
"cordova-plugin-touch-id": {
"source": {
"type": "registry",
"id": "cordova-plugin-touch-id"
},
"is_top_level": true,
"variables": {
"FACEID_USAGE_DESCRIPTION": " "
}
},
"cordova-plugin-jcore": {
"source": {
"type": "registry",
"id": "cordova-plugin-jcore@1.1.12"
},
"is_top_level": true,
"variables": {}
},
"es6-promise-plugin": {
"source": {
"type": "registry",
"id": "es6-promise-plugin"
},
"is_top_level": false,
"variables": {}
},
"cordova-plugin-baidumaplocation": {
"source": {
"type": "registry",
"id": "cordova-plugin-baidumaplocation@3.2.0"
},
"is_top_level": true,
"variables": {
"ANDROID_KEY": "Y8gTWgN2GuDtvhBfiECaZiBtE6i0wQBG",
"IOS_KEY": "hhouKKwxALvC7MBZmnfwgSacHOfFOlNu",
"IOS_LOCATION_DESC": "请点击'好'以允许访问。"
}
},
"cordova-plugin-compat": {
"source": {
"type": "registry",
"id": "cordova-plugin-compat@^1.1.0"
},
"is_top_level": false,
"variables": {}
},
"cordova-plugin-statusbar": {
"source": {
"type": "registry",
"id": "cordova-plugin-statusbar@2.4.2"
},
"is_top_level": true,
"variables": {}
},
"cordova-plugin-splashscreen": {
"source": {
"type": "registry",
"id": "cordova-plugin-splashscreen@5.0.2"
},
"is_top_level": true,
"variables": {}
},
"cordova-plugin-hrms-faceidentify": {
"source": {
"type": "local",
"path": "/Users/think/Downloads/cordova-plugin-hrms-faceidentify"
},
"is_top_level": true,
"variables": {}
},
"cordova-plugin-camera": {
"source": {
"type": "registry",
"id": "cordova-plugin-camera@2.4.0"
},
"is_top_level": true,
"variables": {
"CAMERA_USAGE_DESCRIPTION": "我们将在拍照模块使用您的相机"
}
},
"jmessage-phonegap-plugin": {
"source": {
"type": "registry",
"id": "jmessage-phonegap-plugin@3.2.0"
},
"is_top_level": true,
"variables": {
"APP_KEY": "bef4fd44dcf54b79b8ab27c3"
}
},
"jpush-phonegap-plugin": {
"source": {
"type": "registry",
"id": "jpush-phonegap-plugin@3.3.2"
},
"is_top_level": true,
"variables": {
"APP_KEY": "bef4fd44dcf54b79b8ab27c3"
}
},
"cordova-plugin-inappbrowser": {
"source": {
"type": "registry",
"id": "cordova-plugin-inappbrowser@2.0.2"
},
"is_top_level": true,
"variables": {}
},
"cordova-plugin-media-capture": {
"source": {
"type": "local",
"path": "C:\\Users\\晓兵\\Desktop\\cordova-plugin-media-capture"
},
"is_top_level": true,
"variables": {
"CAMERA_USAGE_DESCRIPTION": " ",
"MICROPHONE_USAGE_DESCRIPTION": " ",
"PHOTOLIBRARY_USAGE_DESCRIPTION": " "
}
},
"cordova-plugin-file": {
"source": {
"type": "registry",
"id": "cordova-plugin-file@4.3.3"
},
"is_top_level": true,
"variables": {}
},
"cordova-plugin-file-transfer": {
"source": {
"type": "registry",
"id": "cordova-plugin-file-transfer@1.6.3"
},
"is_top_level": true,
"variables": {}
},
"cordova-plugin-ionic-webview": {
"source": {
"type": "local",
"path": "/Volumes/work/APP/xugon/cordova-plugin-ionic-webview"
},
"is_top_level": true,
"variables": {}
},
"cordova-plugin-image-picker": {
"source": {
"type": "local",
"path": "/Volumes/work/APP/xugon/cordova-plugin-image-picker"
},
"is_top_level": true,
"variables": {}
},
"IdCardPlugin": {
"source": {
"type": "local",
"path": "/Users/jeshi/Documents/徐工/hls-xcmg-vue-app/node_modules/IdCardPlugin"
},
"is_top_level": true,
"variables": {}
},
"cordova-plugin-crosswalk-webview": {
"source": {
"type": "registry",
"id": "cordova-plugin-crosswalk-webview@1.8.0"
},
"is_top_level": true,
"variables": {}
"cordova-plugin-whitelist": {
"source": {
"type": "registry",
"id": "cordova-plugin-whitelist@1.3.2"
},
"is_top_level": true,
"variables": {}
},
"cordova-plugin-dialogs": {
"source": {
"type": "registry",
"id": "cordova-plugin-dialogs"
},
"is_top_level": true,
"variables": {}
},
"ionic-plugin-keyboard": {
"source": {
"type": "registry",
"id": "ionic-plugin-keyboard@2.2.0"
},
"is_top_level": true,
"variables": {}
},
"cordova-plugin-device": {
"source": {
"type": "registry",
"id": "cordova-plugin-device@2.0.2"
},
"is_top_level": true,
"variables": {}
},
"cordova-plugin-network-information": {
"source": {
"type": "registry",
"id": "cordova-plugin-network-information"
},
"is_top_level": true,
"variables": {}
},
"com.handmobile.cordovaplugin.hotpatch": {
"source": {
"type": "git",
"url": "https://github.com/nature2104/hls-cordova-plugin-hotpatch.git",
"subdir": "."
},
"is_top_level": true,
"variables": {}
},
"cordova-plugin-datepicker": {
"source": {
"type": "registry",
"id": "cordova-plugin-datepicker"
},
"is_top_level": true,
"variables": {}
},
"cordova-plugin-touch-id": {
"source": {
"type": "registry",
"id": "cordova-plugin-touch-id"
},
"is_top_level": true,
"variables": {
"FACEID_USAGE_DESCRIPTION": " "
}
},
"cordova-plugin-jcore": {
"source": {
"type": "registry",
"id": "cordova-plugin-jcore@1.1.12"
},
"is_top_level": true,
"variables": {}
},
"es6-promise-plugin": {
"source": {
"type": "registry",
"id": "es6-promise-plugin"
},
"is_top_level": false,
"variables": {}
},
"cordova-plugin-baidumaplocation": {
"source": {
"type": "registry",
"id": "cordova-plugin-baidumaplocation@3.2.0"
},
"is_top_level": true,
"variables": {
"ANDROID_KEY": "Y8gTWgN2GuDtvhBfiECaZiBtE6i0wQBG",
"IOS_KEY": "hhouKKwxALvC7MBZmnfwgSacHOfFOlNu",
"IOS_LOCATION_DESC": "请点击'好'以允许访问。"
}
},
"cordova-plugin-compat": {
"source": {
"type": "registry",
"id": "cordova-plugin-compat@^1.1.0"
},
"is_top_level": false,
"variables": {}
},
"cordova-plugin-statusbar": {
"source": {
"type": "registry",
"id": "cordova-plugin-statusbar@2.4.2"
},
"is_top_level": true,
"variables": {}
},
"cordova-plugin-splashscreen": {
"source": {
"type": "registry",
"id": "cordova-plugin-splashscreen@5.0.2"
},
"is_top_level": true,
"variables": {}
},
"cordova-plugin-hrms-faceidentify": {
"source": {
"type": "local",
"path": "/Users/think/Downloads/cordova-plugin-hrms-faceidentify"
},
"is_top_level": true,
"variables": {}
},
"cordova-plugin-camera": {
"source": {
"type": "registry",
"id": "cordova-plugin-camera@2.4.0"
},
"is_top_level": true,
"variables": {
"CAMERA_USAGE_DESCRIPTION": "我们将在拍照模块使用您的相机"
}
},
"jmessage-phonegap-plugin": {
"source": {
"type": "registry",
"id": "jmessage-phonegap-plugin@3.2.0"
},
"is_top_level": true,
"variables": {
"APP_KEY": "bef4fd44dcf54b79b8ab27c3"
}
},
"jpush-phonegap-plugin": {
"source": {
"type": "registry",
"id": "jpush-phonegap-plugin@3.3.2"
},
"is_top_level": true,
"variables": {
"APP_KEY": "bef4fd44dcf54b79b8ab27c3"
}
},
"cordova-plugin-inappbrowser": {
"source": {
"type": "registry",
"id": "cordova-plugin-inappbrowser@2.0.2"
},
"is_top_level": true,
"variables": {}
},
"cordova-plugin-media-capture": {
"source": {
"type": "local",
"path": "C:\\Users\\晓兵\\Desktop\\cordova-plugin-media-capture"
},
"is_top_level": true,
"variables": {
"CAMERA_USAGE_DESCRIPTION": " ",
"MICROPHONE_USAGE_DESCRIPTION": " ",
"PHOTOLIBRARY_USAGE_DESCRIPTION": " "
}
},
"cordova-plugin-file": {
"source": {
"type": "registry",
"id": "cordova-plugin-file@4.3.3"
},
"is_top_level": true,
"variables": {}
},
"cordova-plugin-file-transfer": {
"source": {
"type": "registry",
"id": "cordova-plugin-file-transfer@1.6.3"
},
"is_top_level": true,
"variables": {}
},
"cordova-plugin-ionic-webview": {
"source": {
"type": "local",
"path": "/Volumes/work/APP/xugon/cordova-plugin-ionic-webview"
},
"is_top_level": true,
"variables": {}
},
"cordova-plugin-image-picker": {
"source": {
"type": "local",
"path": "/Volumes/work/APP/xugon/cordova-plugin-image-picker"
},
"is_top_level": true,
"variables": {}
},
"cordova-plugin-crosswalk-webview": {
"source": {
"type": "registry",
"id": "cordova-plugin-crosswalk-webview@1.8.0"
},
"is_top_level": true,
"variables": {}
},
"cordova-plugin-hand-idcardplugin": {
"source": {
"type": "local",
"path": "/Users/mjc/Desktop/workspace/xcmg/hls-xcmg-vue-app/node_modules/cordova-plugin-hand-idcardplugin"
},
"is_top_level": true,
"variables": {}
}
}
\ No newline at end of file
......@@ -20,6 +20,9 @@
"CAMERA_USAGE_DESCRIPTION": "我们将在拍照模块使用您的相机",
"PACKAGE_NAME": "com.xcmg.app"
},
"cordova-plugin-crosswalk-webview": {
"PACKAGE_NAME": "com.xcmg.app"
},
"cordova-plugin-datepicker": {
"PACKAGE_NAME": "com.xcmg.app"
},
......@@ -35,12 +38,18 @@
"cordova-plugin-file-transfer": {
"PACKAGE_NAME": "com.xcmg.app"
},
"cordova-plugin-hand-idcardplugin": {
"PACKAGE_NAME": "com.xcmg.app"
},
"cordova-plugin-hrms-faceidentify": {
"PACKAGE_NAME": "com.xcmg.app"
},
"cordova-plugin-image-picker": {
"PACKAGE_NAME": "com.xcmg.app"
},
"cordova-plugin-inappbrowser": {
"PACKAGE_NAME": "com.xcmg.app"
},
"cordova-plugin-ionic-webview": {
"PACKAGE_NAME": "com.xcmg.app"
},
......@@ -72,18 +81,9 @@
"ionic-plugin-keyboard": {
"PACKAGE_NAME": "com.xcmg.app"
},
"cordova-plugin-ionic-webview": {
"PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)"
},
"cordova-plugin-inappbrowser": {
"PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)"
},
"jpush-phonegap-plugin": {
"APP_KEY": "bef4fd44dcf54b79b8ab27c3",
"PACKAGE_NAME": "com.xcmg.app"
},
"IdCardPlugin": {
"PACKAGE_NAME": "com.xcmg.app"
}
},
"dependent_plugins": {
......@@ -110,4 +110,4 @@
"PACKAGE_NAME": "com.xcmg.app"
}
}
}
\ No newline at end of file
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment