diff --git a/README.md b/README.md index 644ba55..e241f3c 100644 --- a/README.md +++ b/README.md @@ -17,14 +17,14 @@ cordova create MyProject com.my.project "MyProject" cd MyProject cordova platform add ios cordova platform add android -cordova plugin add https://github.com/Jumio/mobile-cordova.git#v2.10.0 +cordova plugin add https://github.com/Jumio/mobile-cordova.git#v2.11.0 ``` ## Integration ### iOS -Manual integration or dependency management via cocoapods possible, please see [the official documentation of the Jumio Mobile SDK for iOS](https://github.com/Jumio/mobile-sdk-ios/tree/v2.10.0#basic-setup) +Manual integration or dependency management via cocoapods possible, please see [the official documentation of the Jumio Mobile SDK for iOS](https://github.com/Jumio/mobile-sdk-ios/tree/v2.11.0#basic-setup) ### Android @@ -32,7 +32,7 @@ Add the Jumio repository: ``` repositories { - maven { url 'https://mobile-sdk.jumio.com' } + maven { url 'http://mobile-sdk.jumio.com' } maven { url 'https://maven.google.com/' } } ``` @@ -41,17 +41,17 @@ Add a parameter for your SDK_VERSION into the ext-section: ``` ext { - SDK_VERSION = "2.10.0" + SDK_VERSION = "2.11.0" } ``` -Add required permissions for the products as described in chapter [Permissions](https://github.com/Jumio/mobile-sdk-android/blob/v2.10.0/README.md#permissions) +Add required permissions for the products as described in chapter [Permissions](https://github.com/Jumio/mobile-sdk-android/blob/v2.11.0/README.md#permissions) Open the android project of your cordova project located in */platforms/android* and insert the dependencies from the products you require to your **build.gradle** file. (Module: android) -* [Netverify & Fastfill](https://github.com/Jumio/mobile-sdk-android/blob/v2.10.0/docs/integration_netverify-fastfill.md#dependencies) -* [Document Verification](https://github.com/Jumio/mobile-sdk-android/blob/v2.10.0/docs/integration_document-verification.md#dependencies) -* [BAM Checkout](https://github.com/Jumio/mobile-sdk-android/blob/v2.10.0/docs/integration_bam-checkout.md#dependencies) +* [Netverify & Fastfill](https://github.com/Jumio/mobile-sdk-android/blob/v2.11.0/docs/integration_netverify-fastfill.md#dependencies) +* [Document Verification](https://github.com/Jumio/mobile-sdk-android/blob/v2.11.0/docs/integration_document-verification.md#dependencies) +* [BAM Checkout](https://github.com/Jumio/mobile-sdk-android/blob/v2.11.0/docs/integration_bam-checkout.md#dependencies) __Note:__ If you are using Netverify, make sure to add the Google vision meta-data to you **AndroidManifest.xml** accordingly: @@ -295,13 +295,13 @@ Jumio.startBAM(function(cardInformation) { ### Android #### Netverify -The Netverify SDK can be customized to the respective needs by following this [customization chapter](https://github.com/Jumio/mobile-sdk-android/blob/v2.10.0/docs/integration_netverify-fastfill.md#customization). +The Netverify SDK can be customized to the respective needs by following this [customization chapter](https://github.com/Jumio/mobile-sdk-android/blob/v2.11.0/docs/integration_netverify-fastfill.md#customization). #### BAM Checkout -The Netverify SDK can be customized to the respective needs by following this [customization chapter](https://github.com/Jumio/mobile-sdk-android/blob/v2.10.0/docs/integration_bam-checkout.md#customization). +The Netverify SDK can be customized to the respective needs by following this [customization chapter](https://github.com/Jumio/mobile-sdk-android/blob/v2.11.0/docs/integration_bam-checkout.md#customization). #### Document Verification -The Netverify SDK can be customized to the respective needs by following this [customization chapter](https://github.com/Jumio/mobile-sdk-android/blob/v2.10.0/docs/integration_document-verification.md#customization). +The Netverify SDK can be customized to the respective needs by following this [customization chapter](https://github.com/Jumio/mobile-sdk-android/blob/v2.11.0/docs/integration_document-verification.md#customization). ### iOS The SDK can be customized to the respective needs. You can pass the following customization options to the initializer: @@ -372,7 +372,7 @@ The JSONObject with all the extracted data that is returned for the specific pro | firstName | String | 100 | First name of the customer| | middleName | String | 100 | Middle name of the customer | | dob | Date | | Date of birth | -| gender | String | 1| m or f | +| gender | String | 1| m, f or x | | originatingCountry | String | 3|Country of origin as ([ISO 3166-1 alpha-3](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3)) country code | | addressLine | String | 64 | Street name | | city | String | 64 | City | diff --git a/demo/config.xml b/demo/config.xml index ed5b7d9..0d2612c 100644 --- a/demo/config.xml +++ b/demo/config.xml @@ -1,5 +1,5 @@ - + DemoApp A sample Apache Cordova application that responds to the deviceready event. @@ -23,7 +23,7 @@ - + diff --git a/demo/node_modules/cordova-plugin-jumio-mobilesdk/package.json b/demo/node_modules/cordova-plugin-jumio-mobilesdk/package.json index a839bfb..ab23890 100644 --- a/demo/node_modules/cordova-plugin-jumio-mobilesdk/package.json +++ b/demo/node_modules/cordova-plugin-jumio-mobilesdk/package.json @@ -2,47 +2,47 @@ "_args": [ [ { - "raw": "https://github.com/Jumio/mobile-cordova.git#v2.10.0", + "raw": "https://github.com/Jumio/mobile-cordova.git#v2.11.0", "scope": null, "escapedName": null, "name": null, - "rawSpec": "https://github.com/Jumio/mobile-cordova.git#v2.10.0", - "spec": "git+https://github.com/Jumio/mobile-cordova.git#v2.10.0", + "rawSpec": "https://github.com/Jumio/mobile-cordova.git#v2.11.0", + "spec": "git+https://github.com/Jumio/mobile-cordova.git#v2.11.0", "type": "hosted", "hosted": { "type": "github", - "ssh": "git@github.com:Jumio/mobile-cordova.git#v2.10.0", - "sshUrl": "git+ssh://git@github.com/Jumio/mobile-cordova.git#v2.10.0", - "httpsUrl": "git+https://github.com/Jumio/mobile-cordova.git#v2.10.0", - "gitUrl": "git://github.com/Jumio/mobile-cordova.git#v2.10.0", - "shortcut": "github:Jumio/mobile-cordova#v2.10.0", - "directUrl": "https://raw.githubusercontent.com/Jumio/mobile-cordova/v2.10.0/package.json" + "ssh": "git@github.com:Jumio/mobile-cordova.git#v2.11.0", + "sshUrl": "git+ssh://git@github.com/Jumio/mobile-cordova.git#v2.11.0", + "httpsUrl": "git+https://github.com/Jumio/mobile-cordova.git#v2.11.0", + "gitUrl": "git://github.com/Jumio/mobile-cordova.git#v2.11.0", + "shortcut": "github:Jumio/mobile-cordova#v2.11.0", + "directUrl": "https://raw.githubusercontent.com/Jumio/mobile-cordova/v2.11.0/package.json" } }, "C:\\Users\\pkoller\\Documents\\Github\\mobile-cordova-pilot\\demo" ] ], - "_from": "git+https://github.com/Jumio/mobile-cordova.git#v2.10.0", - "_id": "cordova-plugin-jumio-mobilesdk@2.10.0", + "_from": "git+https://github.com/Jumio/mobile-cordova.git#v2.11.0", + "_id": "cordova-plugin-jumio-mobilesdk@2.11.0", "_inCache": true, "_location": "/cordova-plugin-jumio-mobilesdk", "_phantomChildren": {}, "_requested": { - "raw": "https://github.com/Jumio/mobile-cordova.git#v2.10.0", + "raw": "https://github.com/Jumio/mobile-cordova.git#v2.11.0", "scope": null, "escapedName": null, "name": null, - "rawSpec": "https://github.com/Jumio/mobile-cordova.git#v2.10.0", - "spec": "git+https://github.com/Jumio/mobile-cordova.git#v2.10.0", + "rawSpec": "https://github.com/Jumio/mobile-cordova.git#v2.11.0", + "spec": "git+https://github.com/Jumio/mobile-cordova.git#v2.11.0", "type": "hosted", "hosted": { "type": "github", - "ssh": "git@github.com:Jumio/mobile-cordova.git#v2.10.0", - "sshUrl": "git+ssh://git@github.com/Jumio/mobile-cordova.git#v2.10.0", - "httpsUrl": "git+https://github.com/Jumio/mobile-cordova.git#v2.10.0", - "gitUrl": "git://github.com/Jumio/mobile-cordova.git#v2.10.0", - "shortcut": "github:Jumio/mobile-cordova#v2.10.0", - "directUrl": "https://raw.githubusercontent.com/Jumio/mobile-cordova/v2.10.0/package.json" + "ssh": "git@github.com:Jumio/mobile-cordova.git#v2.11.0", + "sshUrl": "git+ssh://git@github.com/Jumio/mobile-cordova.git#v2.11.0", + "httpsUrl": "git+https://github.com/Jumio/mobile-cordova.git#v2.11.0", + "gitUrl": "git://github.com/Jumio/mobile-cordova.git#v2.11.0", + "shortcut": "github:Jumio/mobile-cordova#v2.11.0", + "directUrl": "https://raw.githubusercontent.com/Jumio/mobile-cordova/v2.11.0/package.json" } }, "_requiredBy": [ @@ -52,7 +52,7 @@ "_resolved": "git+https://github.com/Jumio/mobile-cordova.git#606cec5199aabc486cb6a99a04683d5125e0bf1d", "_shasum": "286bdf880d386ff38d291890411f99496b15628b", "_shrinkwrap": null, - "_spec": "https://github.com/Jumio/mobile-cordova.git#v2.10.0", + "_spec": "https://github.com/Jumio/mobile-cordova.git#v2.11.0", "_where": "C:\\Users\\pkoller\\Documents\\Github\\mobile-cordova-pilot\\demo", "author": { "name": "Jumio Corporation" @@ -80,11 +80,11 @@ "license": "ISC", "name": "cordova-plugin-jumio-mobilesdk", "optionalDependencies": {}, - "readme": "# Plugin for Apache Cordova\r\n\r\nOfficial Jumio Mobile SDK plugin for Apache Cordova\r\n\r\n## Compatibility\r\nWith this release, we only ensure compatibility with the latest Cordova versions and plugins.\r\nAt the time of this release, the following minimum versions are supported:\r\n* Cordova: 7.1.0\r\n* Cordova Android: 6.3.0\r\n* Cordova iOS: 4.5.3\r\n\r\n## Setup\r\n\r\nCreate Cordova project and add our plugin\r\n```\r\ncordova create MyProject com.my.project \"MyProject\"\r\ncd MyProject\r\ncordova platform add ios\r\ncordova platform add android\r\ncordova plugin add https://github.com/Jumio/mobile-cordova.git#v2.10.0\r\n```\r\n\r\n## Integration\r\n\r\n### iOS\r\n\r\nManual integration or dependency management via cocoapods possible, please see [the official documentation of the Jumio Mobile SDK for iOS](https://github.com/Jumio/mobile-sdk-ios/tree/v2.10.0#basic-setup)\r\n\r\n### Android\r\n\r\nAdd the Jumio repository:\r\n\r\n```\r\nrepositories {\r\n maven { url 'http://mobile-sdk.jumio.com' }\r\n maven { url 'https://maven.google.com/' }\r\n}\r\n```\r\n\r\nAdd a parameter for your SDK_VERSION into the ext-section:\r\n\r\n```\r\next {\r\n SDK_VERSION = \"2.10.0\"\r\n}\r\n```\r\n\r\nAdd required permissions for the products as described in chapter [Permissions](https://github.com/Jumio/mobile-sdk-android/blob/v2.10.0/README.md#permissions)\r\n\r\nOpen the android project of your cordova project located in */platforms/android* and insert the dependencies from the products you require to your **build.gradle** file. (Module: android)\r\n\r\n* [Netverify & Fastfill](https://github.com/Jumio/mobile-sdk-android/blob/v2.10.0/docs/integration_netverify-fastfill.md#dependencies)\r\n* [Document Verification](https://github.com/Jumio/mobile-sdk-android/blob/v2.10.0/docs/integration_document-verification.md#dependencies)\r\n* [BAM Checkout](https://github.com/Jumio/mobile-sdk-android/blob/v2.10.0/docs/integration_bam-checkout.md#dependencies)\r\n\r\n__Note:__ If you are using Netverify, make sure to add the Google vision meta-data to you **AndroidManifest.xml** accordingly:\r\n\r\n```\r\n\r\n```\r\n\r\n## Usage\r\n\r\n\r\n### Netverify / Fastfill\r\n\r\nTo initialize the SDK, perform the following call.\r\n\r\n```javascript\r\nJumio.initNetverify(, , , {configuration});\r\n```\r\n\r\nDatacenter can either be **US** or **EU**.\r\n\r\n\r\n\r\nConfigure the SDK with the *configuration*-Object.\r\n\r\n| Configuration | Datatype | Description |\r\n| ------ | -------- | ----------- |\r\n| requireVerification | Boolean | Enable ID verification |\r\n| callbackUrl | String | Specify an URL for individual transactions |\r\n| requireFaceMatch | Boolean | Enable face match during the ID verification for a specific transaction |\r\n| preselectedCountry | Boolean | Specify the issuing country (ISO 3166-1 alpha-3 country code) |\r\n| merchantScanReference | String | Allows you to identify the scan (max. 100 characters) |\r\n| merchantReportingCriteria | String | Use this option to identify the scan in your reports (max. 100 characters) |\r\n| customerId | String | Set a customer identifier (max. 100 characters) |\r\n| additionalInformation | String | Add additional paramter (max. 255 characters) |\r\n| sendDebugInfoToJumio | Boolean | Send debug information to Jumio. |\r\n| dataExtractionOnMobileOnly | Boolean | Limit data extraction to be done on device only |\r\n| cameraPosition | String | Which camera is used by default. Can be **FRONT** or **BACK**. |\r\n| preselectedDocumentVariant | String | Which types of document variants are available. Can be **PAPER** or **PLASTIC** |\r\n| documentTypes | String-Array | An array of accepted document types: Available document types: **PASSPORT**, **DRIVER_LICENSE**, **IDENTITY_CARD**, **VISA** |\r\n\r\n\r\nInitialization example with configuration.\r\n\r\n```javascript\r\nJumio.initNetverify(\"API_TOKEN\", \"API_SECRET\", \"US\", {\r\n requireVerification: false,\r\n customerId: \"CUSTOMERID\",\r\n preselectedCountry: \"USA\",\r\n cameraPosition: \"BACK\",\r\n documentTypes: [\"DRIVER_LICENSE\", \"PASSPORT\", \"IDENTITY_CARD\", \"VISA\"]\r\n});\r\n```\r\n\r\n***Android eMRTD scanning***\r\n\r\nIf you are using eMRTD scanning, following lines are needed in your Manifest file:\r\n\r\n```javascript\r\n-keep class net.sf.scuba.smartcards.IsoDepCardService {*;}\r\n-keep class org.jmrtd.** { *; }\r\n-keep class net.sf.scuba.** {*;}\r\n-keep class org.spongycastle.** {*;}\r\n-keep class org.ejbca.** {*;}\r\n\r\n-dontwarn java.nio.**\r\n-dontwarn org.codehaus.**\r\n-dontwarn org.ejbca.**\r\n-dontwarn org.spongycastle.**\r\n```\r\n\r\nAdd the needed dependencies following [this chapter](https://github.com/Jumio/mobile-sdk-android/blob/master/docs/integration_netverify-fastfill.md#dependencies) of the android integration guide.\r\n\r\nEnable eMRTD by using the following method in your native android code:\r\n\r\n```javascript\r\nnetverifySDK.setEnableEMRTD(true);\r\n```\r\n\r\n\r\nAs soon as the sdk is initialized, the sdk is started by the following call.\r\n\r\n```javascript\r\nJumio.startNetverify(successCallback, errorCallback);\r\n```\r\n\r\nExample\r\n\r\n```javascript\r\nJumio.startNetverify(function(documentData) {\r\n // YOUR CODE\r\n}, function(error) {\r\n // YOUR CODE\r\n});\r\n```\r\n\r\n### Document Verification\r\n\r\nTo initialize the SDK, perform the following call.\r\n\r\n```javascript\r\nJumio.initDocumentVerification(, , , {configuration});\r\n```\r\n\r\nDatacenter can either be **US** or **EU**.\r\n\r\nConfigure the SDK with the *configuration*-Object. **(configuration marked with * are mandatory)**\r\n\r\n| Configuration | Datatype | Description |\r\n| ------ | -------- | ----------- |\r\n| **type*** | String | See the list below |\r\n| **customerId*** | String | Set a customer identifier (max. 100 characters) |\r\n| **country*** | String | Set the country (ISO-3166-1 alpha-3 code) |\r\n| **merchantScanReference*** | String | Allows you to identify the scan (max. 100 characters) |\r\n| merchantReportingCriteria | String | Use this option to identify the scan in your reports (max. 100 characters) |\r\n| callbackUrl | String | Specify an URL for individual transactions |\r\n| additionalInformation | String | Add additional paramter (max. 255 characters) |\r\n| documentName | String | Override the document label on the help screen |\r\n| customDocumentCode | String | Set your custom document code (set in the merchant backend under \"Settings\" - \"Multi Documents\" - \"Custom\" |\r\n| cameraPosition | String | Which camera is used by default. Can be **FRONT** or **BACK**. |\r\n\r\nPossible types:\r\n\r\n* BS (Bank statement)\r\n* IC (Insurance card)\r\n* UB (Utility bill, front side)\r\n* CAAP (Cash advance application)\r\n* CRC (Corporate resolution certificate)\r\n* CCS (Credit card statement)\r\n* LAG (Lease agreement)\r\n* LOAP (Loan application)\r\n* MOAP (Mortgage application)\r\n* TR (Tax return)\r\n* VT (Vehicle title)\r\n* VC (Voided check)\r\n* STUC (Student card)\r\n* HCC (Health care card)\r\n* CB (Council bill)\r\n* SENC (Seniors card)\r\n* MEDC (Medicare card)\r\n* BC (Birth certificate)\r\n* WWCC (Working with children check)\r\n* SS (Superannuation statement)\r\n* TAC (Trade association card)\r\n* SEL (School enrolment letter)\r\n* PB (Phone bill)\r\n* USSS (US social security card)\r\n* SSC (Social security card)\r\n* CUSTOM (Custom document type)\r\n\r\nInitialization example with configuration.\r\n\r\n```javascript\r\nJumio.initDocumentVerification(\"API_TOKEN\", \"API_SECRET\", \"US\", {\r\n type: \"BC\",\r\n customerId: \"CUSTOMER ID\",\r\n country: \"USA\",\r\n merchantScanReference: \"YOURSCANREFERENCE\",\r\n cameraPosition: \"BACK\"\r\n});\r\n```\r\n\r\nAs soon as the SDK is initialized, the SDK is started by the following call.\r\n\r\n```javascript\r\nJumio.startDocumentVerification(successCallback, errorCallback);\r\n```\r\n\r\nExample\r\n\r\n```javascript\r\nJumio.startDocumentVerification(function(documentData) {\r\n // YOUR CODE\r\n}, function(error) {\r\n // YOUR CODE\r\n});\r\n```\r\n\r\n### BAM Checkout\r\n\r\nTo Initialize the SDK, perform the following call.\r\n\r\n```javascript\r\nJumio.initBAM(, , , {configuration});\r\n```\r\n\r\nDatacenter can either be **US** or **EU**.\r\n\r\n\r\n\r\nConfigure the SDK with the *configuration*-Object.\r\n\r\n| Configuration | Datatype | Description |\r\n| ------ | -------- | ----------- |\r\n| cardHolderNameRequired | Boolean |\r\n| sortCodeAndAccountNumberRequired | Boolean |\r\n| expiryRequired | Boolean |\r\n| cvvRequired | Boolean |\r\n| expiryEditable | Boolean |\r\n| cardHolderNameEditable | Boolean |\r\n| merchantReportingCriteria | String | Overwrite your specified reporting criteria to identify each scan attempt in your reports (max. 100 characters)\r\n| vibrationEffectEnabled | Boolean |\r\n| enableFlashOnScanStart | Boolean |\r\n| cardNumberMaskingEnabled | Boolean |\r\n| offlineToken | String | In your Jumio merchant backend on the \"Settings\" page under \"API credentials\" you can find your Offline token. In case you use your offline token, you must not set the API token and secret|\r\n| cameraPosition | String | Which camera is used by default. Can be **FRONT** or **BACK**. |\r\n| cardTypes | String-Array | An array of accepted card types. Available card types: **VISA**, **MASTER_CARD**, **AMERICAN_EXPRESS**, **CHINA_UNIONPAY**, **DINERS_CLUB**, **DISCOVER**, **JCB**, **STARBUCKS** |\r\n\r\nInitialization example with configuration.\r\n\r\n```javascript\r\nJumio.initBAM(\"API_TOKEN\", \"API_SECRET\", \"US\", {\r\n cardHolderNameRequired: false,\r\n cvvRequired: true,\r\n cameraPosition: \"BACK\",\r\n cardTypes: [\"VISA\", \"MASTER_CARD\"]\r\n});\r\n```\r\n\r\n\r\nAs soon as the sdk is initialized, the sdk is started by the following call.\r\n\r\n```javascript\r\nJumio.startBAM(successCallback, errorCallback);\r\n```\r\n\r\nExample\r\n\r\n```javascript\r\nJumio.startBAM(function(cardInformation) {\r\n // YOUR CODE\r\n}, function(error) {\r\n // YOUR CODE\r\n});\r\n```\r\n\r\n## Customization\r\n\r\n### Android\r\nThe Netverify SDK can be customized to the respective needs by following this [customization chapter](https://github.com/Jumio/mobile-sdk-android/blob/v2.10.0/docs/integration_netverify-fastfill.md#customization).\r\n\r\n### iOS\r\nThe SDK can be customized to the respective needs. You can pass the following customization options to the initializer:\r\n\r\n| Customization key | Type | Description |\r\n|:------------------|:-----|:------------|\r\n| disableBlur | BOOL | Deactivate the blur effect |\r\n| backgroundColor | STRING | Change base view's background color |\r\n| foregroundColor | STRING | Change base view's foreground color |\r\n| tintColor | STRING | Change the tint color of the navigation bar |\r\n| barTintColor | STRING | Change the bar tint color of the navigation bar |\r\n| textTitleColor | STRING | Change the text title color of the navigation bar |\r\n| documentSelectionHeaderBackgroundColor | STRING | Change the background color of the document selection header |\r\n| documentSelectionHeaderTitleColor | STRING | Change the title color of the document selection header |\r\n| documentSelectionHeaderIconColor | STRING | Change the icon color of the document selection header |\r\n| documentSelectionButtonBackgroundColor | STRING | Change the background color of the document selection button |\r\n| documentSelectionButtonTitleColor | STRING | Change the title color of the document selection button |\r\n| documentSelectionButtonIconColor | STRING | Change the icon color of the document selection button |\r\n| fallbackButtonBackgroundColor | STRING | Change the background color of the fallback button |\r\n| fallbackButtonBorderColor | STRING | Change the border color of the fallback button |\r\n| fallbackButtonTitleColor | STRING | Change the title color of the fallback button |\r\n| positiveButtonBackgroundColor | STRING | Change the background color of the positive button |\r\n| positiveButtonBorderColor | STRING | Change the border color of the positive button |\r\n| positiveButtonTitleColor | STRING | Change the title color of the positive button |\r\n| negativeButtonBackgroundColor | STRING | Change the background color of the negative button |\r\n| negativeButtonBorderColor | STRING | Change the border color of the negative button |\r\n| negativeButtonTitleColor | STRING | Change the title color of the negative button |\r\n| scanOverlayStandardColor (NV only) | STRING | Change the standard color of the scan overlay |\r\n| scanOverlayValidColor (NV only) | STRING | Change the valid color of the scan overlay |\r\n| scanOverlayInvalidColor (NV only) | STRING | Change the invalid color of the scan overlay |\r\n| scanOverlayTextColor (BAM only) | STRING | Change the text color of the scan overlay |\r\n| scanOverlayBorderColor (BAM only) | STRING | Change the border color of the scan overlay |\r\n\r\nAll colors are provided with a HEX string with the following format: #ff00ff.\r\n\r\n**Customization example**\r\n```javascript\r\nJumio.initNetverify(\"API_TOKEN\", \"API_SECRET\", \"US\", {\r\n requireVerification: false,\r\n ...\r\n}, {\r\n disableBlur: true,\r\n backgroundColor: \"#ff00ff\",\r\n barTintColor: \"#ff1298\"\r\n);\r\n```\r\n\r\n## Callback\r\n\r\nTo get information about callbacks, Netverify Retrieval API, Netverify Delete API and Global Netverify settings and more, please read our [page with server related information](https://github.com/Jumio/implementation-guides/blob/master/netverify/callback.md).\r\n\r\nThe JSONObject with all the extracted data that is returned for the specific products is described in the following subchapters:\r\n\r\n### Netverify & Fastfill\r\n\r\n*NetverifyDocumentData:*\r\n\r\n| Parameter | Type | Max. length | Description |\r\n|:-------------------|:----------- \t|:-------------|:-----------------|\r\n| selectedCountry | String| 3| [ISO 3166-1 alpha-3](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-3) country code as provided or selected |\r\n| selectedDocumentType | String | 16| PASSPORT, DRIVER_LICENSE, IDENTITY_CARD or VISA |\r\n| idNumber | String | 100 | Identification number of the document |\r\n| personalNumber | String | 14| Personal number of the document|\r\n| issuingDate | Date | | Date of issue |\r\n| expiryDate | Date | | Date of expiry |\r\n| issuingCountry | String | 3 | Country of issue as ([ISO 3166-1 alpha-3](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3)) country code |\r\n| lastName | String | 100 | Last name of the customer|\r\n| firstName | String | 100 | First name of the customer|\r\n| middleName | String | 100 | Middle name of the customer |\r\n| dob | Date | | Date of birth |\r\n| gender | String | 1| m or f |\r\n| originatingCountry | String | 3|Country of origin as ([ISO 3166-1 alpha-3](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3)) country code |\r\n| addressLine | String | 64 | Street name\t|\r\n| city | String | 64 | City |\r\n| subdivision | String | 3 | Last three characters of [ISO 3166-2:US](http://en.wikipedia.org/wiki/ISO_3166-2:US) state code\t|\r\n| postCode | String | 15 | Postal code |\r\n| mrzData | MRZ-DATA | | MRZ data, see table below |\r\n| optionalData1 | String | 50 | Optional field of MRZ line 1 |\r\n| optionalData2 | String | 50 | Optional field of MRZ line 2 |\r\n| placeOfBirth | String | 255 | Place of Birth |\r\n| extractionMethod | String | 12| MRZ, OCR, BARCODE, BARCODE_OCR or NONE |\r\n\r\n*MRZ-Data*\r\n\r\n| Parameter |Type | Max. length | Description |\r\n|:---------------|:------------- |:-------------|:-----------------|\r\n| format | String | 8| MRP, TD1, TD2, CNIS, MRVA, MRVB or UNKNOWN |\r\n| line1 | String | 50 | MRZ line 1 |\r\n| line2 | String | 50 | MRZ line 2 |\r\n| line3 | String | 50| MRZ line 3 |\r\n| idNumberValid | BOOL| | True if ID number check digit is valid, otherwise false |\r\n| dobValid | BOOL | | True if date of birth check digit is valid, otherwise false |\r\n| expiryDateValid |\tBOOL| |\tTrue if date of expiry check digit is valid or not available, otherwise false|\r\n| personalNumberValid | BOOL | | True if personal number check digit is valid or not available, otherwise false |\r\n| compositeValid | BOOL | | True if composite check digit is valid, otherwise false |\r\n\r\n### BAM Checkout\r\n\r\n*BAMCardInformation*\r\n\r\n|Parameter | Type | Max. length | Description |\r\n|:---------------------------- \t|:-------------|:-----------------|:-------------|\r\n| cardType | String | 16| VISA, MASTER_CARD, AMERICAN_EXPRESS, CHINA_UNIONPAY, DINERS_CLUB, DISCOVER, JCB or STARBUCKS |\r\n| cardNumber | String | 16 | Full credit card number |\r\n| cardNumberGrouped | String | 19 | Grouped credit card number |\r\n| cardNumberMasked | String | 19 | First 6 and last 4 digits of the grouped credit card number, other digits are masked with \"X\" |\r\n| cardExpiryMonth | String | 2 | Month card expires if enabled and readable |\r\n| CardExpiryYear | String | 2 | Year card expires if enabled and readable |\r\n| cardExpiryDate | String | 5 | Date card expires in the format MM/yy if enabled and readable |\r\n| cardCVV | String | 4 | Entered CVV if enabled |\r\n| cardHolderName | String | 100 | Name of the card holder in capital letters if enabled and readable, or as entered if editable |\r\n| cardSortCode | String | 8 | Sort code in the format xx-xx-xx or xxxxxx if enabled, available and readable |\r\n| cardAccountNumber | String | 8 | Account number if enabled, available and readable |\r\n| cardSortCodeValid | BOOL | | True if sort code valid, otherwise false |\r\n| cardAccountNumberValid | BOOL | | True if account number code valid, otherwise false |\r\n\r\n### Document Verification\r\n\r\nNo data returned.\r\n\r\n# Support\r\n\r\n## Contact\r\n\r\nIf you have any questions regarding our implementation guide please contact Jumio Customer Service at support@jumio.com or https://support.jumio.com. The Jumio online helpdesk contains a wealth of information regarding our service including demo videos, product descriptions, FAQs and other things that may help to get you started with Jumio. Check it out at: https://support.jumio.com.\r\n\r\n## Copyright\r\n\r\n© Jumio Corp. 268 Lambert Avenue, Palo Alto, CA 94306\r\n", + "readme": "# Plugin for Apache Cordova\r\n\r\nOfficial Jumio Mobile SDK plugin for Apache Cordova\r\n\r\n## Compatibility\r\nWith this release, we only ensure compatibility with the latest Cordova versions and plugins.\r\nAt the time of this release, the following minimum versions are supported:\r\n* Cordova: 7.1.0\r\n* Cordova Android: 6.3.0\r\n* Cordova iOS: 4.5.3\r\n\r\n## Setup\r\n\r\nCreate Cordova project and add our plugin\r\n```\r\ncordova create MyProject com.my.project \"MyProject\"\r\ncd MyProject\r\ncordova platform add ios\r\ncordova platform add android\r\ncordova plugin add https://github.com/Jumio/mobile-cordova.git#v2.11.0\r\n```\r\n\r\n## Integration\r\n\r\n### iOS\r\n\r\nManual integration or dependency management via cocoapods possible, please see [the official documentation of the Jumio Mobile SDK for iOS](https://github.com/Jumio/mobile-sdk-ios/tree/v2.11.0#basic-setup)\r\n\r\n### Android\r\n\r\nAdd the Jumio repository:\r\n\r\n```\r\nrepositories {\r\n maven { url 'http://mobile-sdk.jumio.com' }\r\n maven { url 'https://maven.google.com/' }\r\n}\r\n```\r\n\r\nAdd a parameter for your SDK_VERSION into the ext-section:\r\n\r\n```\r\next {\r\n SDK_VERSION = \"2.11.0\"\r\n}\r\n```\r\n\r\nAdd required permissions for the products as described in chapter [Permissions](https://github.com/Jumio/mobile-sdk-android/blob/v2.11.0/README.md#permissions)\r\n\r\nOpen the android project of your cordova project located in */platforms/android* and insert the dependencies from the products you require to your **build.gradle** file. (Module: android)\r\n\r\n* [Netverify & Fastfill](https://github.com/Jumio/mobile-sdk-android/blob/v2.11.0/docs/integration_netverify-fastfill.md#dependencies)\r\n* [Document Verification](https://github.com/Jumio/mobile-sdk-android/blob/v2.11.0/docs/integration_document-verification.md#dependencies)\r\n* [BAM Checkout](https://github.com/Jumio/mobile-sdk-android/blob/v2.11.0/docs/integration_bam-checkout.md#dependencies)\r\n\r\n__Note:__ If you are using Netverify, make sure to add the Google vision meta-data to you **AndroidManifest.xml** accordingly:\r\n\r\n```\r\n\r\n```\r\n\r\n## Usage\r\n\r\n\r\n### Netverify / Fastfill\r\n\r\nTo initialize the SDK, perform the following call.\r\n\r\n```javascript\r\nJumio.initNetverify(, , , {configuration});\r\n```\r\n\r\nDatacenter can either be **US** or **EU**.\r\n\r\n\r\n\r\nConfigure the SDK with the *configuration*-Object.\r\n\r\n| Configuration | Datatype | Description |\r\n| ------ | -------- | ----------- |\r\n| requireVerification | Boolean | Enable ID verification |\r\n| callbackUrl | String | Specify an URL for individual transactions |\r\n| requireFaceMatch | Boolean | Enable face match during the ID verification for a specific transaction |\r\n| preselectedCountry | Boolean | Specify the issuing country (ISO 3166-1 alpha-3 country code) |\r\n| merchantScanReference | String | Allows you to identify the scan (max. 100 characters) |\r\n| merchantReportingCriteria | String | Use this option to identify the scan in your reports (max. 100 characters) |\r\n| customerId | String | Set a customer identifier (max. 100 characters) |\r\n| additionalInformation | String | Add additional paramter (max. 255 characters) |\r\n| sendDebugInfoToJumio | Boolean | Send debug information to Jumio. |\r\n| dataExtractionOnMobileOnly | Boolean | Limit data extraction to be done on device only |\r\n| cameraPosition | String | Which camera is used by default. Can be **FRONT** or **BACK**. |\r\n| preselectedDocumentVariant | String | Which types of document variants are available. Can be **PAPER** or **PLASTIC** |\r\n| documentTypes | String-Array | An array of accepted document types: Available document types: **PASSPORT**, **DRIVER_LICENSE**, **IDENTITY_CARD**, **VISA** |\r\n\r\n\r\nInitialization example with configuration.\r\n\r\n```javascript\r\nJumio.initNetverify(\"API_TOKEN\", \"API_SECRET\", \"US\", {\r\n requireVerification: false,\r\n customerId: \"CUSTOMERID\",\r\n preselectedCountry: \"USA\",\r\n cameraPosition: \"BACK\",\r\n documentTypes: [\"DRIVER_LICENSE\", \"PASSPORT\", \"IDENTITY_CARD\", \"VISA\"]\r\n});\r\n```\r\n\r\n***Android eMRTD scanning***\r\n\r\nIf you are using eMRTD scanning, following lines are needed in your Manifest file:\r\n\r\n```javascript\r\n-keep class net.sf.scuba.smartcards.IsoDepCardService {*;}\r\n-keep class org.jmrtd.** { *; }\r\n-keep class net.sf.scuba.** {*;}\r\n-keep class org.spongycastle.** {*;}\r\n-keep class org.ejbca.** {*;}\r\n\r\n-dontwarn java.nio.**\r\n-dontwarn org.codehaus.**\r\n-dontwarn org.ejbca.**\r\n-dontwarn org.spongycastle.**\r\n```\r\n\r\nAdd the needed dependencies following [this chapter](https://github.com/Jumio/mobile-sdk-android/blob/master/docs/integration_netverify-fastfill.md#dependencies) of the android integration guide.\r\n\r\nEnable eMRTD by using the following method in your native android code:\r\n\r\n```javascript\r\nnetverifySDK.setEnableEMRTD(true);\r\n```\r\n\r\n\r\nAs soon as the sdk is initialized, the sdk is started by the following call.\r\n\r\n```javascript\r\nJumio.startNetverify(successCallback, errorCallback);\r\n```\r\n\r\nExample\r\n\r\n```javascript\r\nJumio.startNetverify(function(documentData) {\r\n // YOUR CODE\r\n}, function(error) {\r\n // YOUR CODE\r\n});\r\n```\r\n\r\n### Document Verification\r\n\r\nTo initialize the SDK, perform the following call.\r\n\r\n```javascript\r\nJumio.initDocumentVerification(, , , {configuration});\r\n```\r\n\r\nDatacenter can either be **US** or **EU**.\r\n\r\nConfigure the SDK with the *configuration*-Object. **(configuration marked with * are mandatory)**\r\n\r\n| Configuration | Datatype | Description |\r\n| ------ | -------- | ----------- |\r\n| **type*** | String | See the list below |\r\n| **customerId*** | String | Set a customer identifier (max. 100 characters) |\r\n| **country*** | String | Set the country (ISO-3166-1 alpha-3 code) |\r\n| **merchantScanReference*** | String | Allows you to identify the scan (max. 100 characters) |\r\n| merchantReportingCriteria | String | Use this option to identify the scan in your reports (max. 100 characters) |\r\n| callbackUrl | String | Specify an URL for individual transactions |\r\n| additionalInformation | String | Add additional paramter (max. 255 characters) |\r\n| documentName | String | Override the document label on the help screen |\r\n| customDocumentCode | String | Set your custom document code (set in the merchant backend under \"Settings\" - \"Multi Documents\" - \"Custom\" |\r\n| cameraPosition | String | Which camera is used by default. Can be **FRONT** or **BACK**. |\r\n\r\nPossible types:\r\n\r\n* BS (Bank statement)\r\n* IC (Insurance card)\r\n* UB (Utility bill, front side)\r\n* CAAP (Cash advance application)\r\n* CRC (Corporate resolution certificate)\r\n* CCS (Credit card statement)\r\n* LAG (Lease agreement)\r\n* LOAP (Loan application)\r\n* MOAP (Mortgage application)\r\n* TR (Tax return)\r\n* VT (Vehicle title)\r\n* VC (Voided check)\r\n* STUC (Student card)\r\n* HCC (Health care card)\r\n* CB (Council bill)\r\n* SENC (Seniors card)\r\n* MEDC (Medicare card)\r\n* BC (Birth certificate)\r\n* WWCC (Working with children check)\r\n* SS (Superannuation statement)\r\n* TAC (Trade association card)\r\n* SEL (School enrolment letter)\r\n* PB (Phone bill)\r\n* USSS (US social security card)\r\n* SSC (Social security card)\r\n* CUSTOM (Custom document type)\r\n\r\nInitialization example with configuration.\r\n\r\n```javascript\r\nJumio.initDocumentVerification(\"API_TOKEN\", \"API_SECRET\", \"US\", {\r\n type: \"BC\",\r\n customerId: \"CUSTOMER ID\",\r\n country: \"USA\",\r\n merchantScanReference: \"YOURSCANREFERENCE\",\r\n cameraPosition: \"BACK\"\r\n});\r\n```\r\n\r\nAs soon as the SDK is initialized, the SDK is started by the following call.\r\n\r\n```javascript\r\nJumio.startDocumentVerification(successCallback, errorCallback);\r\n```\r\n\r\nExample\r\n\r\n```javascript\r\nJumio.startDocumentVerification(function(documentData) {\r\n // YOUR CODE\r\n}, function(error) {\r\n // YOUR CODE\r\n});\r\n```\r\n\r\n### BAM Checkout\r\n\r\nTo Initialize the SDK, perform the following call.\r\n\r\n```javascript\r\nJumio.initBAM(, , , {configuration});\r\n```\r\n\r\nDatacenter can either be **US** or **EU**.\r\n\r\n\r\n\r\nConfigure the SDK with the *configuration*-Object.\r\n\r\n| Configuration | Datatype | Description |\r\n| ------ | -------- | ----------- |\r\n| cardHolderNameRequired | Boolean |\r\n| sortCodeAndAccountNumberRequired | Boolean |\r\n| expiryRequired | Boolean |\r\n| cvvRequired | Boolean |\r\n| expiryEditable | Boolean |\r\n| cardHolderNameEditable | Boolean |\r\n| merchantReportingCriteria | String | Overwrite your specified reporting criteria to identify each scan attempt in your reports (max. 100 characters)\r\n| vibrationEffectEnabled | Boolean |\r\n| enableFlashOnScanStart | Boolean |\r\n| cardNumberMaskingEnabled | Boolean |\r\n| offlineToken | String | In your Jumio merchant backend on the \"Settings\" page under \"API credentials\" you can find your Offline token. In case you use your offline token, you must not set the API token and secret|\r\n| cameraPosition | String | Which camera is used by default. Can be **FRONT** or **BACK**. |\r\n| cardTypes | String-Array | An array of accepted card types. Available card types: **VISA**, **MASTER_CARD**, **AMERICAN_EXPRESS**, **CHINA_UNIONPAY**, **DINERS_CLUB**, **DISCOVER**, **JCB**, **STARBUCKS** |\r\n\r\nInitialization example with configuration.\r\n\r\n```javascript\r\nJumio.initBAM(\"API_TOKEN\", \"API_SECRET\", \"US\", {\r\n cardHolderNameRequired: false,\r\n cvvRequired: true,\r\n cameraPosition: \"BACK\",\r\n cardTypes: [\"VISA\", \"MASTER_CARD\"]\r\n});\r\n```\r\n\r\n\r\nAs soon as the sdk is initialized, the sdk is started by the following call.\r\n\r\n```javascript\r\nJumio.startBAM(successCallback, errorCallback);\r\n```\r\n\r\nExample\r\n\r\n```javascript\r\nJumio.startBAM(function(cardInformation) {\r\n // YOUR CODE\r\n}, function(error) {\r\n // YOUR CODE\r\n});\r\n```\r\n\r\n## Customization\r\n\r\n### Android\r\nThe Netverify SDK can be customized to the respective needs by following this [customization chapter](https://github.com/Jumio/mobile-sdk-android/blob/v2.11.0/docs/integration_netverify-fastfill.md#customization).\r\n\r\n### iOS\r\nThe SDK can be customized to the respective needs. You can pass the following customization options to the initializer:\r\n\r\n| Customization key | Type | Description |\r\n|:------------------|:-----|:------------|\r\n| disableBlur | BOOL | Deactivate the blur effect |\r\n| backgroundColor | STRING | Change base view's background color |\r\n| foregroundColor | STRING | Change base view's foreground color |\r\n| tintColor | STRING | Change the tint color of the navigation bar |\r\n| barTintColor | STRING | Change the bar tint color of the navigation bar |\r\n| textTitleColor | STRING | Change the text title color of the navigation bar |\r\n| documentSelectionHeaderBackgroundColor | STRING | Change the background color of the document selection header |\r\n| documentSelectionHeaderTitleColor | STRING | Change the title color of the document selection header |\r\n| documentSelectionHeaderIconColor | STRING | Change the icon color of the document selection header |\r\n| documentSelectionButtonBackgroundColor | STRING | Change the background color of the document selection button |\r\n| documentSelectionButtonTitleColor | STRING | Change the title color of the document selection button |\r\n| documentSelectionButtonIconColor | STRING | Change the icon color of the document selection button |\r\n| fallbackButtonBackgroundColor | STRING | Change the background color of the fallback button |\r\n| fallbackButtonBorderColor | STRING | Change the border color of the fallback button |\r\n| fallbackButtonTitleColor | STRING | Change the title color of the fallback button |\r\n| positiveButtonBackgroundColor | STRING | Change the background color of the positive button |\r\n| positiveButtonBorderColor | STRING | Change the border color of the positive button |\r\n| positiveButtonTitleColor | STRING | Change the title color of the positive button |\r\n| negativeButtonBackgroundColor | STRING | Change the background color of the negative button |\r\n| negativeButtonBorderColor | STRING | Change the border color of the negative button |\r\n| negativeButtonTitleColor | STRING | Change the title color of the negative button |\r\n| scanOverlayStandardColor (NV only) | STRING | Change the standard color of the scan overlay |\r\n| scanOverlayValidColor (NV only) | STRING | Change the valid color of the scan overlay |\r\n| scanOverlayInvalidColor (NV only) | STRING | Change the invalid color of the scan overlay |\r\n| scanOverlayTextColor (BAM only) | STRING | Change the text color of the scan overlay |\r\n| scanOverlayBorderColor (BAM only) | STRING | Change the border color of the scan overlay |\r\n\r\nAll colors are provided with a HEX string with the following format: #ff00ff.\r\n\r\n**Customization example**\r\n```javascript\r\nJumio.initNetverify(\"API_TOKEN\", \"API_SECRET\", \"US\", {\r\n requireVerification: false,\r\n ...\r\n}, {\r\n disableBlur: true,\r\n backgroundColor: \"#ff00ff\",\r\n barTintColor: \"#ff1298\"\r\n);\r\n```\r\n\r\n## Callback\r\n\r\nTo get information about callbacks, Netverify Retrieval API, Netverify Delete API and Global Netverify settings and more, please read our [page with server related information](https://github.com/Jumio/implementation-guides/blob/master/netverify/callback.md).\r\n\r\nThe JSONObject with all the extracted data that is returned for the specific products is described in the following subchapters:\r\n\r\n### Netverify & Fastfill\r\n\r\n*NetverifyDocumentData:*\r\n\r\n| Parameter | Type | Max. length | Description |\r\n|:-------------------|:----------- \t|:-------------|:-----------------|\r\n| selectedCountry | String| 3| [ISO 3166-1 alpha-3](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-3) country code as provided or selected |\r\n| selectedDocumentType | String | 16| PASSPORT, DRIVER_LICENSE, IDENTITY_CARD or VISA |\r\n| idNumber | String | 100 | Identification number of the document |\r\n| personalNumber | String | 14| Personal number of the document|\r\n| issuingDate | Date | | Date of issue |\r\n| expiryDate | Date | | Date of expiry |\r\n| issuingCountry | String | 3 | Country of issue as ([ISO 3166-1 alpha-3](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3)) country code |\r\n| lastName | String | 100 | Last name of the customer|\r\n| firstName | String | 100 | First name of the customer|\r\n| middleName | String | 100 | Middle name of the customer |\r\n| dob | Date | | Date of birth |\r\n| gender | String | 1| m or f |\r\n| originatingCountry | String | 3|Country of origin as ([ISO 3166-1 alpha-3](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3)) country code |\r\n| addressLine | String | 64 | Street name\t|\r\n| city | String | 64 | City |\r\n| subdivision | String | 3 | Last three characters of [ISO 3166-2:US](http://en.wikipedia.org/wiki/ISO_3166-2:US) state code\t|\r\n| postCode | String | 15 | Postal code |\r\n| mrzData | MRZ-DATA | | MRZ data, see table below |\r\n| optionalData1 | String | 50 | Optional field of MRZ line 1 |\r\n| optionalData2 | String | 50 | Optional field of MRZ line 2 |\r\n| placeOfBirth | String | 255 | Place of Birth |\r\n| extractionMethod | String | 12| MRZ, OCR, BARCODE, BARCODE_OCR or NONE |\r\n\r\n*MRZ-Data*\r\n\r\n| Parameter |Type | Max. length | Description |\r\n|:---------------|:------------- |:-------------|:-----------------|\r\n| format | String | 8| MRP, TD1, TD2, CNIS, MRVA, MRVB or UNKNOWN |\r\n| line1 | String | 50 | MRZ line 1 |\r\n| line2 | String | 50 | MRZ line 2 |\r\n| line3 | String | 50| MRZ line 3 |\r\n| idNumberValid | BOOL| | True if ID number check digit is valid, otherwise false |\r\n| dobValid | BOOL | | True if date of birth check digit is valid, otherwise false |\r\n| expiryDateValid |\tBOOL| |\tTrue if date of expiry check digit is valid or not available, otherwise false|\r\n| personalNumberValid | BOOL | | True if personal number check digit is valid or not available, otherwise false |\r\n| compositeValid | BOOL | | True if composite check digit is valid, otherwise false |\r\n\r\n### BAM Checkout\r\n\r\n*BAMCardInformation*\r\n\r\n|Parameter | Type | Max. length | Description |\r\n|:---------------------------- \t|:-------------|:-----------------|:-------------|\r\n| cardType | String | 16| VISA, MASTER_CARD, AMERICAN_EXPRESS, CHINA_UNIONPAY, DINERS_CLUB, DISCOVER, JCB or STARBUCKS |\r\n| cardNumber | String | 16 | Full credit card number |\r\n| cardNumberGrouped | String | 19 | Grouped credit card number |\r\n| cardNumberMasked | String | 19 | First 6 and last 4 digits of the grouped credit card number, other digits are masked with \"X\" |\r\n| cardExpiryMonth | String | 2 | Month card expires if enabled and readable |\r\n| CardExpiryYear | String | 2 | Year card expires if enabled and readable |\r\n| cardExpiryDate | String | 5 | Date card expires in the format MM/yy if enabled and readable |\r\n| cardCVV | String | 4 | Entered CVV if enabled |\r\n| cardHolderName | String | 100 | Name of the card holder in capital letters if enabled and readable, or as entered if editable |\r\n| cardSortCode | String | 8 | Sort code in the format xx-xx-xx or xxxxxx if enabled, available and readable |\r\n| cardAccountNumber | String | 8 | Account number if enabled, available and readable |\r\n| cardSortCodeValid | BOOL | | True if sort code valid, otherwise false |\r\n| cardAccountNumberValid | BOOL | | True if account number code valid, otherwise false |\r\n\r\n### Document Verification\r\n\r\nNo data returned.\r\n\r\n# Support\r\n\r\n## Contact\r\n\r\nIf you have any questions regarding our implementation guide please contact Jumio Customer Service at support@jumio.com or https://support.jumio.com. The Jumio online helpdesk contains a wealth of information regarding our service including demo videos, product descriptions, FAQs and other things that may help to get you started with Jumio. Check it out at: https://support.jumio.com.\r\n\r\n## Copyright\r\n\r\n© Jumio Corp. 268 Lambert Avenue, Palo Alto, CA 94306\r\n", "readmeFilename": "README.md", "repository": { "type": "git", "url": "git+https://github.com/Jumio/mobile-cordova.git" }, - "version": "2.10.0" + "version": "2.11.0" } diff --git a/demo/node_modules/cordova-plugin-jumio-mobilesdk/plugin.xml b/demo/node_modules/cordova-plugin-jumio-mobilesdk/plugin.xml index 1acaaaa..b648e0a 100644 --- a/demo/node_modules/cordova-plugin-jumio-mobilesdk/plugin.xml +++ b/demo/node_modules/cordova-plugin-jumio-mobilesdk/plugin.xml @@ -1,5 +1,5 @@ - + JumioMobileSDK @@ -23,9 +23,8 @@ - - + diff --git a/demo/node_modules/cordova-plugin-jumio-mobilesdk/src/android/JumioMobileSDK.java b/demo/node_modules/cordova-plugin-jumio-mobilesdk/src/android/JumioMobileSDK.java index d19be68..e783dd2 100644 --- a/demo/node_modules/cordova-plugin-jumio-mobilesdk/src/android/JumioMobileSDK.java +++ b/demo/node_modules/cordova-plugin-jumio-mobilesdk/src/android/JumioMobileSDK.java @@ -5,14 +5,6 @@ package com.jumio.mobilesdk; -import org.apache.cordova.CallbackContext; -import org.apache.cordova.CordovaPlugin; -import org.apache.cordova.PluginResult; -import org.apache.cordova.PluginResult.Status; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; - import android.app.Activity; import android.content.Intent; import android.content.pm.PackageManager; @@ -21,569 +13,611 @@ import com.jumio.MobileSDK; import com.jumio.bam.*; -import com.jumio.bam.custom.*; import com.jumio.bam.enums.CreditCardType; -import com.jumio.commons.json.JSON; import com.jumio.core.enums.*; import com.jumio.core.exceptions.*; import com.jumio.dv.DocumentVerificationSDK; import com.jumio.nv.*; -import com.jumio.nv.data.document.NVDocumentType; -import com.jumio.nv.data.document.NVDocumentVariant; +import com.jumio.nv.data.document.*; import com.jumio.sdk.SDKExpiredException; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; +import org.apache.cordova.*; +import org.apache.cordova.PluginResult.Status; +import org.json.*; + +import java.util.*; public class JumioMobileSDK extends CordovaPlugin { - - private static String TAG = "JumioMobileSDK"; - private static final int PERMISSION_REQUEST_CODE_BAM = 300; - private static final int PERMISSION_REQUEST_CODE_NETVERIFY = 301; - private static final int PERMISSION_REQUEST_CODE_DOCUMENT_VERIFICATION = 303; - - private static final String ACTION_BAM_INIT = "initBAM"; - private static final String ACTION_BAM_START = "startBAM"; - private static final String ACTION_NV_INIT = "initNetverify"; - private static final String ACTION_NV_START = "startNetverify"; - private static final String ACTION_DV_INIT = "initDocumentVerification"; - private static final String ACTION_DV_START = "startDocumentVerification"; - - private BamSDK bamSDK; - private NetverifySDK netverifySDK; - private DocumentVerificationSDK documentVerificationSDK; - private CallbackContext callbackContext; - private String errorMsg; - - @Override - public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { - PluginResult result = null; - this.callbackContext = callbackContext; - - if (action.equals(ACTION_BAM_INIT)) { - initBAM(args); - result = new PluginResult(Status.NO_RESULT); - result.setKeepCallback(false); - return true; - } else if (action.equals(ACTION_BAM_START)) { - startBAM(args); - result = new PluginResult(Status.NO_RESULT); - result.setKeepCallback(true); - return true; - } else if (action.equals(ACTION_NV_INIT)) { - initNetverify(args); - result = new PluginResult(Status.NO_RESULT); - result.setKeepCallback(false); - return true; - } else if (action.equals(ACTION_NV_START)) { - startNetverify(args); - result = new PluginResult(Status.NO_RESULT); - result.setKeepCallback(true); - return true; - } else if (action.equals(ACTION_DV_INIT)) { - initDocumentVerification(args); - result = new PluginResult(Status.NO_RESULT); - result.setKeepCallback(false); - return true; - } else if (action.equals(ACTION_DV_START)) { - startDocumentVerification(args); - result = new PluginResult(Status.NO_RESULT); - result.setKeepCallback(true); - return true; - } else { - result = new PluginResult(Status.INVALID_ACTION); - callbackContext.error("Invalid Action"); - return false; - } - } - - // BAM Checkout - - private void initBAM(JSONArray data) { - if (BamSDK.isRooted(cordova.getActivity().getApplicationContext())) { - showErrorMessage("The BAM SDK can't run on a rooted device."); - return; - } - - if (!BamSDK.isSupportedPlatform(cordova.getActivity())) { - showErrorMessage("This platform is not supported."); - return; - } - - try { - JSONObject options = data.getJSONObject(3); - if (options.has("offlineToken")) { - String offlineToken = options.getString("offlineToken"); - bamSDK = BamSDK.create(cordova.getActivity(), offlineToken); - } else { - if (data.isNull(0) || data.isNull(1) || data.isNull(2)) { - showErrorMessage("Missing required parameters apiToken, apiSecret or dataCenter."); - return; - } - - String apiToken = data.getString(0); - String apiSecret = data.getString(1); - JumioDataCenter dataCenter = (data.getString(2).toLowerCase().equals("us")) ? JumioDataCenter.US : JumioDataCenter.EU; - - bamSDK = BamSDK.create(cordova.getActivity(), apiToken, apiSecret, dataCenter); - } - - // Configuration options - if (!data.isNull(3)) { - options = data.getJSONObject(3); - Iterator keys = options.keys(); - while (keys.hasNext()) { - String key = keys.next(); - - if (key.equals("cardHolderNameRequired")) { - bamSDK.setCardHolderNameRequired(options.getBoolean(key)); - } else if (key.equals("sortCodeAndAccountNumberRequired")) { - bamSDK.setSortCodeAndAccountNumberRequired(options.getBoolean(key)); - } else if (key.equals("expiryRequired")) { - bamSDK.setExpiryRequired(options.getBoolean(key)); - } else if (key.equals("cvvRequired")) { - bamSDK.setCvvRequired(options.getBoolean(key)); - } else if (key.equals("expiryEditable")) { - bamSDK.setExpiryEditable(options.getBoolean(key)); - } else if (key.equals("cardHolderNameEditable")) { - bamSDK.setCardHolderNameEditable(options.getBoolean(key)); - } else if (key.equals("merchantReportingCriteria")) { - bamSDK.setMerchantReportingCriteria(options.getString(key)); - } else if (key.equals("vibrationEffectEnabled")) { - bamSDK.setVibrationEffectEnabled(options.getBoolean(key)); - } else if (key.equals("enableFlashOnScanStart")) { - bamSDK.setEnableFlashOnScanStart(options.getBoolean(key)); - } else if (key.equals("cardNumberMaskingEnabled")) { - bamSDK.setCardNumberMaskingEnabled(options.getBoolean(key)); - } else if (key.equals("cameraPosition")) { - JumioCameraPosition cameraPosition = (options.getString(key).toLowerCase().equals("front")) ? JumioCameraPosition.FRONT : JumioCameraPosition.BACK; - bamSDK.setCameraPosition(cameraPosition); - } else if (key.equals("cardTypes")) { - JSONArray jsonTypes = options.getJSONArray(key); - ArrayList types = new ArrayList(); - if (jsonTypes != null) { - int len = jsonTypes.length(); - for (int i=0;i creditCardTypes = new ArrayList(); - for (String type : types) { - if (type.toLowerCase().equals("visa")) { - creditCardTypes.add(CreditCardType.VISA); - } else if (type.toLowerCase().equals("master_card")) { - creditCardTypes.add(CreditCardType.MASTER_CARD); - } else if (type.toLowerCase().equals("american_express")) { - creditCardTypes.add(CreditCardType.AMERICAN_EXPRESS); - } else if (type.toLowerCase().equals("china_unionpay")) { - creditCardTypes.add(CreditCardType.CHINA_UNIONPAY); - } else if (type.toLowerCase().equals("diners_club")) { - creditCardTypes.add(CreditCardType.DINERS_CLUB); - } else if (type.toLowerCase().equals("discover")) { - creditCardTypes.add(CreditCardType.DISCOVER); - } else if (type.toLowerCase().equals("jcb")) { - creditCardTypes.add(CreditCardType.JCB); - } else if (type.toLowerCase().equals("starbucks")) { - creditCardTypes.add(CreditCardType.STARBUCKS); - } - } - - bamSDK.setSupportedCreditCardTypes(creditCardTypes); - } - } - } - } catch (JSONException e) { - showErrorMessage("Invalid parameters: " + e.getLocalizedMessage()); - } catch (PlatformNotSupportedException e) { - showErrorMessage("Error initializing the BAM SDK: " + e.getLocalizedMessage()); - } catch (SDKExpiredException e) { - showErrorMessage("Error initializing the BAM SDK: " + e.getLocalizedMessage()); - } - } - - private void startBAM(JSONArray data) { - if (bamSDK == null) { - showErrorMessage("The BAM SDK is not initialized yet. Call initBAM() first."); - return; - } - - Runnable runnable = new Runnable() { - @Override - public void run() { - try { - checkPermissionsAndStart(bamSDK); - } catch (Exception e) { - showErrorMessage("Error starting the BAM SDK: " + e.getLocalizedMessage()); - } - } - }; - - this.cordova.setActivityResultCallback(this); - this.cordova.getActivity().runOnUiThread(runnable); - } - - // Netverify - - private void initNetverify(JSONArray data) { - if (!NetverifySDK.isSupportedPlatform(cordova.getActivity())) { - showErrorMessage("This platform is not supported."); - return; - } - - try { - if (data.isNull(0) || data.isNull(1) || data.isNull(2)) { - showErrorMessage("Missing required parameters apiToken, apiSecret or dataCenter."); - return; - } - - String apiToken = data.getString(0); - String apiSecret = data.getString(1); - JumioDataCenter dataCenter = (data.getString(2).toLowerCase().equals("us")) ? JumioDataCenter.US : JumioDataCenter.EU; - - netverifySDK = NetverifySDK.create(cordova.getActivity(), apiToken, apiSecret, dataCenter); - - // Configuration options - if (!data.isNull(3)) { - JSONObject options = data.getJSONObject(3); - Iterator keys = options.keys(); - while (keys.hasNext()) { - String key = keys.next(); - - if (key.equals("requireVerification")) { - netverifySDK.setRequireVerification(options.getBoolean(key)); - } else if (key.equals("callbackUrl")) { - netverifySDK.setCallbackUrl(options.getString(key)); - } else if (key.equals("requireFaceMatch")) { - netverifySDK.setRequireFaceMatch(options.getBoolean(key)); - } else if (key.equals("preselectedCountry")) { - netverifySDK.setPreselectedCountry(options.getString(key)); - } else if (key.equals("merchantScanReference")) { - netverifySDK.setMerchantScanReference(options.getString(key)); - } else if (key.equals("merchantReportingCriteria")) { - netverifySDK.setMerchantReportingCriteria(options.getString(key)); - } else if (key.equals("customerID")) { - netverifySDK.setCustomerId(options.getString(key)); - } else if (key.equals("additionalInformation")) { - netverifySDK.setAdditionalInformation(options.getString(key)); - } else if (key.equals("enableEpassport")) { - netverifySDK.setEnableEMRTD(options.getBoolean(key)); - } else if (key.equals("sendDebugInfoToJumio")) { - netverifySDK.sendDebugInfoToJumio(options.getBoolean(key)); - } else if (key.equals("dataExtractionOnMobileOnly")) { - netverifySDK.setDataExtractionOnMobileOnly(options.getBoolean(key)); - } else if (key.equals("cameraPosition")) { - JumioCameraPosition cameraPosition = (options.getString(key).toLowerCase().equals("front")) ? JumioCameraPosition.FRONT : JumioCameraPosition.BACK; - netverifySDK.setCameraPosition(cameraPosition); - } else if (key.equals("preselectedDocumentVariant")) { - NVDocumentVariant variant = (options.getString(key).toLowerCase().equals("paper")) ? NVDocumentVariant.PAPER : NVDocumentVariant.PLASTIC; - netverifySDK.setPreselectedDocumentVariant(variant); - } else if (key.equals("documentTypes")) { - JSONArray jsonTypes = options.getJSONArray(key); - ArrayList types = new ArrayList(); - if (jsonTypes != null) { - int len = jsonTypes.length(); - for (int i=0;i documentTypes = new ArrayList(); - for (String type : types) { - if (type.toLowerCase().equals("passport")) { - documentTypes.add(NVDocumentType.PASSPORT); - } else if (type.toLowerCase().equals("driver_license")) { - documentTypes.add(NVDocumentType.DRIVER_LICENSE); - } else if (type.toLowerCase().equals("identity_card")) { - documentTypes.add(NVDocumentType.IDENTITY_CARD); - } else if (type.toLowerCase().equals("visa")) { - documentTypes.add(NVDocumentType.VISA); - } - } - - netverifySDK.setPreselectedDocumentTypes(documentTypes); - } - } - } - } catch (JSONException e) { - showErrorMessage("Invalid parameters: " + e.getLocalizedMessage()); - } catch (PlatformNotSupportedException e) { - showErrorMessage("Error initializing the Netverify SDK: " + e.getLocalizedMessage()); - } - } - - private void startNetverify(JSONArray data) { - if (netverifySDK == null) { - showErrorMessage("The Netverify SDK is not initialized yet. Call initNetverify() first."); - return; - } - - Runnable runnable = new Runnable() { - @Override - public void run() { - try { - checkPermissionsAndStart(netverifySDK); - } catch (Exception e) { - showErrorMessage("Error starting the Netverify SDK: " + e.getLocalizedMessage()); - } - } - }; - - this.cordova.setActivityResultCallback(this); - this.cordova.getActivity().runOnUiThread(runnable); - } - - // Document Verification - - private void initDocumentVerification(JSONArray data) { - if (!DocumentVerificationSDK.isSupportedPlatform(cordova.getActivity())) { - showErrorMessage("This platform is not supported."); - return; - } - - try { - if (data.isNull(0) || data.isNull(1) || data.isNull(2)) { - showErrorMessage("Missing required parameters apiToken, apiSecret or dataCenter."); - return; - } - - String apiToken = data.getString(0); - String apiSecret = data.getString(1); - JumioDataCenter dataCenter = (data.getString(2).toLowerCase().equals("us")) ? JumioDataCenter.US : JumioDataCenter.EU; - - documentVerificationSDK = DocumentVerificationSDK.create(cordova.getActivity(), apiToken, apiSecret, dataCenter); - - // Configuration options - if (!data.isNull(3)) { - JSONObject options = data.getJSONObject(3); - Iterator keys = options.keys(); - while (keys.hasNext()) { - String key = keys.next(); - - if (key.equals("type")) { - documentVerificationSDK.setType(options.getString(key)); - } else if (key.equals("customDocumentCode")) { - documentVerificationSDK.setCustomDocumentCode(options.getString(key)); - } else if (key.equals("country")) { - documentVerificationSDK.setCountry(options.getString(key)); - } else if (key.equals("merchantReportingCriteria")) { - documentVerificationSDK.setMerchantReportingCriteria(options.getString(key)); - } else if (key.equals("callbackUrl")) { - documentVerificationSDK.setCallbackUrl(options.getString(key)); - } else if (key.equals("additionalInformation")) { - documentVerificationSDK.setAdditionalInformation(options.getString(key)); - } else if (key.equals("merchantScanReference")) { - documentVerificationSDK.setMerchantScanReference(options.getString(key)); - } else if (key.equals("customerId")) { - documentVerificationSDK.setCustomerId(options.getString(key)); - } else if (key.equals("documentName")) { - documentVerificationSDK.setDocumentName(options.getString(key)); - } else if (key.equals("cameraPosition")) { - JumioCameraPosition cameraPosition = (options.getString(key).toLowerCase().equals("front")) ? JumioCameraPosition.FRONT : JumioCameraPosition.BACK; - documentVerificationSDK.setCameraPosition(cameraPosition); - } - } - } - - // Configuration options - if (!data.isNull(3)) { - JSONObject options = data.getJSONObject(3); - Iterator keys = options.keys(); - while (keys.hasNext()) { - String key = keys.next(); - - // ... - } - } - } catch (JSONException e) { - showErrorMessage("Invalid parameters: " + e.getLocalizedMessage()); - } catch (PlatformNotSupportedException e) { - showErrorMessage("Error initializing the Document Verification SDK: " + e.getLocalizedMessage()); - } - } - - private void startDocumentVerification(JSONArray data) { - if (documentVerificationSDK == null) { - showErrorMessage("The Document Verification SDK is not initialized yet. Call initDocumentVerification() first."); - return; - } - - Runnable runnable = new Runnable() { - @Override - public void run() { - try { - checkPermissionsAndStart(documentVerificationSDK); - } catch (Exception e) { - showErrorMessage("Error starting the Document Verification SDK: " + e.getLocalizedMessage()); - } - } - }; - - this.cordova.setActivityResultCallback(this); - this.cordova.getActivity().runOnUiThread(runnable); - } - - - // Permissions - - private void checkPermissionsAndStart(MobileSDK sdk) { - if (!MobileSDK.hasAllRequiredPermissions(cordova.getActivity().getApplicationContext())) { - //Acquire missing permissions. - String[] mp = MobileSDK.getMissingPermissions(cordova.getActivity().getApplicationContext()); - - int code; - if (sdk instanceof BamSDK) - code = PERMISSION_REQUEST_CODE_BAM; - else if (sdk instanceof NetverifySDK) - code = PERMISSION_REQUEST_CODE_NETVERIFY; - else if (sdk instanceof DocumentVerificationSDK) - code = PERMISSION_REQUEST_CODE_DOCUMENT_VERIFICATION; - else { - showErrorMessage("Invalid SDK instance"); - return; - } - - cordova.requestPermissions(this, code, mp); - } else { - this.startSdk(sdk); - } - } - - @Override - public void onRequestPermissionResult(int requestCode, String[] permissions, int[] grantResults) throws JSONException { - boolean allGranted = true; - for (int grantResult : grantResults) { - if (grantResult != PackageManager.PERMISSION_GRANTED) { - allGranted = false; - break; - } - } - - if (allGranted) { - if (requestCode == JumioMobileSDK.PERMISSION_REQUEST_CODE_BAM) { - startSdk(this.bamSDK); - } else if (requestCode == JumioMobileSDK.PERMISSION_REQUEST_CODE_NETVERIFY) { - startSdk(this.netverifySDK); - } else if (requestCode == JumioMobileSDK.PERMISSION_REQUEST_CODE_DOCUMENT_VERIFICATION) { - startSdk(this.documentVerificationSDK); - } - } else { - showErrorMessage("You need to grant all required permissions to start the Jumio SDK."); - super.onRequestPermissionResult(requestCode, permissions, grantResults); - } - } - - // SDK Result - - @Override - public void onActivityResult(int requestCode, int resultCode, Intent intent) { - // BAM Checkout Results - if (requestCode == BamSDK.REQUEST_CODE) { - if (resultCode == Activity.RESULT_OK) { - BamCardInformation cardInformation = intent.getParcelableExtra(BamSDK.EXTRA_CARD_INFORMATION); - - JSONObject result = new JSONObject(); - try { - result.put("cardType", cardInformation.getCardType()); - result.put("cardNumber", String.valueOf(cardInformation.getCardNumber())); - result.put("cardNumberGrouped", String.valueOf(cardInformation.getCardNumberGrouped())); - result.put("cardNumberMasked", String.valueOf(cardInformation.getCardNumberMasked())); - result.put("cardExpiryMonth", String.valueOf(cardInformation.getCardExpiryDateMonth())); - result.put("cardExpiryYear", String.valueOf(cardInformation.getCardExpiryDateYear())); - result.put("cardExpiryDate", String.valueOf(cardInformation.getCardExpiryDateYear())); - result.put("cardCVV", String.valueOf(cardInformation.getCardCvvCode())); - result.put("cardHolderName", String.valueOf(cardInformation.getCardHolderName())); - result.put("cardSortCode", String.valueOf(cardInformation.getCardSortCode())); - result.put("cardAccountNumber", String.valueOf(cardInformation.getCardAccountNumber())); - result.put("cardSortCodeValid", cardInformation.isCardSortCodeValid()); - result.put("cardAccountNumberValid", cardInformation.isCardAccountNumberValid()); - - callbackContext.success(result); - cardInformation.clear(); - } catch (JSONException e) { - showErrorMessage("Result could not be sent. Try again."); - } - } else if (resultCode == Activity.RESULT_CANCELED) { - int errorCode = intent.getIntExtra(BamSDK.EXTRA_ERROR_CODE, 0); - String errorMsg = intent.getStringExtra(BamSDK.EXTRA_ERROR_MESSAGE); - showErrorMessage("Cancelled with error code: " + errorCode + ": " + errorMsg); - } - // Netverify Results - } else if (requestCode == NetverifySDK.REQUEST_CODE) { - if (resultCode == Activity.RESULT_OK) { - NetverifyDocumentData documentData = intent.getParcelableExtra(NetverifySDK.EXTRA_SCAN_DATA); - JSONObject result = new JSONObject(); - try { - result.put("selectedCountry", documentData.getSelectedCountry()); - result.put("selectedDocumentType", documentData.getSelectedDocumentType()); - result.put("idNumber", documentData.getIdNumber()); - result.put("personalNumber", documentData.getPersonalNumber()); - result.put("issuingDate", documentData.getIssuingDate()); - result.put("expiryDate", documentData.getExpiryDate()); - result.put("issuingCountry", documentData.getIssuingCountry()); - result.put("lastName", documentData.getLastName()); - result.put("firstName", documentData.getFirstName()); - result.put("middleName", documentData.getMiddleName()); - result.put("dob", documentData.getDob()); - result.put("gender", documentData.getGender()); - result.put("originatingCountry", documentData.getOriginatingCountry()); - result.put("addressLine", documentData.getAddressLine()); - result.put("city", documentData.getCity()); - result.put("subdivision", documentData.getSubdivision()); - result.put("postCode", documentData.getPostCode()); - result.put("optionalData1", documentData.getOptionalData1()); - result.put("optionalData2", documentData.getOptionalData2()); - result.put("placeOfBirth", documentData.getPlaceOfBirth()); - result.put("extractionMethod", documentData.getExtractionMethod()); - - // MRZ data if available - if (documentData.getMrzData() != null) { - JSONObject mrzData = new JSONObject(); - mrzData.put("format", documentData.getMrzData().getFormat()); - mrzData.put("line1", documentData.getMrzData().getMrzLine1()); - mrzData.put("line2", documentData.getMrzData().getMrzLine2()); - mrzData.put("line3", documentData.getMrzData().getMrzLine3()); - mrzData.put("idNumberValid", documentData.getMrzData().idNumberValid()); - mrzData.put("dobValid", documentData.getMrzData().dobValid()); - mrzData.put("expiryDateValid", documentData.getMrzData().expiryDateValid()); - mrzData.put("personalNumberValid", documentData.getMrzData().personalNumberValid()); - mrzData.put("compositeValid", documentData.getMrzData().compositeValid()); - result.put("mrzData", mrzData); - } - - callbackContext.success(result); - } catch (JSONException e) { - showErrorMessage("Result could not be sent: " + e.getLocalizedMessage()); - } - } else if (resultCode == Activity.RESULT_CANCELED) { - int errorCode = intent.getIntExtra(NetverifySDK.EXTRA_ERROR_CODE, 0); - String errorMsg = intent.getStringExtra(NetverifySDK.EXTRA_ERROR_MESSAGE); - showErrorMessage("Cancelled with error code: " + errorCode + ": " + errorMsg); - } - } else if (requestCode == DocumentVerificationSDK.REQUEST_CODE) { - if (resultCode == Activity.RESULT_OK) { - callbackContext.success("Document-Verification finished successfully."); - } else if (resultCode == Activity.RESULT_CANCELED) { - int errorCode = intent.getIntExtra(DocumentVerificationSDK.EXTRA_ERROR_CODE, 0); - String errorMsg = intent.getStringExtra(DocumentVerificationSDK.EXTRA_ERROR_MESSAGE); - showErrorMessage("Cancelled with error code: " + errorCode + ": " + errorMsg); - } - } - } - - // Helper methods - - private void startSdk(MobileSDK sdk) { - try { - sdk.start(); - } catch (MissingPermissionException e) { - Toast.makeText(cordova.getActivity(), e.getMessage(), Toast.LENGTH_LONG).show(); - } - } - - private void showErrorMessage(String msg) { - Log.e(TAG, msg); - callbackContext.error(msg); - } + + private static String TAG = "JumioMobileSDK"; + private static final int PERMISSION_REQUEST_CODE_BAM = 300; + private static final int PERMISSION_REQUEST_CODE_NETVERIFY = 301; + private static final int PERMISSION_REQUEST_CODE_DOCUMENT_VERIFICATION = 303; + + private static final String ACTION_BAM_INIT = "initBAM"; + private static final String ACTION_BAM_START = "startBAM"; + private static final String ACTION_NV_INIT = "initNetverify"; + private static final String ACTION_NV_START = "startNetverify"; + private static final String ACTION_DV_INIT = "initDocumentVerification"; + private static final String ACTION_DV_START = "startDocumentVerification"; + + private BamSDK bamSDK; + private NetverifySDK netverifySDK; + private DocumentVerificationSDK documentVerificationSDK; + private CallbackContext callbackContext; + + @Override + public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { + PluginResult result = null; + this.callbackContext = callbackContext; + + if (action.equals(ACTION_BAM_INIT)) { + initBAM(args); + result = new PluginResult(Status.NO_RESULT); + result.setKeepCallback(false); + return true; + } else if (action.equals(ACTION_BAM_START)) { + startBAM(args); + result = new PluginResult(Status.NO_RESULT); + result.setKeepCallback(true); + return true; + } else if (action.equals(ACTION_NV_INIT)) { + initNetverify(args); + result = new PluginResult(Status.NO_RESULT); + result.setKeepCallback(false); + return true; + } else if (action.equals(ACTION_NV_START)) { + startNetverify(args); + result = new PluginResult(Status.NO_RESULT); + result.setKeepCallback(true); + return true; + } else if (action.equals(ACTION_DV_INIT)) { + initDocumentVerification(args); + result = new PluginResult(Status.NO_RESULT); + result.setKeepCallback(false); + return true; + } else if (action.equals(ACTION_DV_START)) { + startDocumentVerification(args); + result = new PluginResult(Status.NO_RESULT); + result.setKeepCallback(true); + return true; + } else { + result = new PluginResult(Status.INVALID_ACTION); + callbackContext.error("Invalid Action"); + return false; + } + } + + // BAM Checkout + + private void initBAM(JSONArray data) { + if (BamSDK.isRooted(cordova.getActivity().getApplicationContext())) { + showErrorMessage("The BAM SDK can't run on a rooted device."); + return; + } + + if (!BamSDK.isSupportedPlatform(cordova.getActivity())) { + showErrorMessage("This platform is not supported."); + return; + } + + try { + JSONObject options = data.getJSONObject(3); + if (options.has("offlineToken")) { + String offlineToken = options.getString("offlineToken"); + bamSDK = BamSDK.create(cordova.getActivity(), offlineToken); + } else { + if (data.isNull(0) || data.isNull(1) || data.isNull(2)) { + showErrorMessage("Missing required parameters apiToken, apiSecret or dataCenter."); + return; + } + + String apiToken = data.getString(0); + String apiSecret = data.getString(1); + JumioDataCenter dataCenter = (data.getString(2).toLowerCase().equalsIgnoreCase("us")) ? JumioDataCenter.US : JumioDataCenter.EU; + + bamSDK = BamSDK.create(cordova.getActivity(), apiToken, apiSecret, dataCenter); + } + + // Configuration options + if (!data.isNull(3)) { + options = data.getJSONObject(3); + Iterator keys = options.keys(); + while (keys.hasNext()) { + String key = keys.next(); + + if (key.equalsIgnoreCase("cardHolderNameRequired")) { + bamSDK.setCardHolderNameRequired(options.getBoolean(key)); + } else if (key.equalsIgnoreCase("sortCodeAndAccountNumberRequired")) { + bamSDK.setSortCodeAndAccountNumberRequired(options.getBoolean(key)); + } else if (key.equalsIgnoreCase("expiryRequired")) { + bamSDK.setExpiryRequired(options.getBoolean(key)); + } else if (key.equalsIgnoreCase("cvvRequired")) { + bamSDK.setCvvRequired(options.getBoolean(key)); + } else if (key.equalsIgnoreCase("expiryEditable")) { + bamSDK.setExpiryEditable(options.getBoolean(key)); + } else if (key.equalsIgnoreCase("cardHolderNameEditable")) { + bamSDK.setCardHolderNameEditable(options.getBoolean(key)); + } else if (key.equalsIgnoreCase("merchantReportingCriteria")) { + bamSDK.setMerchantReportingCriteria(options.getString(key)); + } else if (key.equalsIgnoreCase("vibrationEffectEnabled")) { + bamSDK.setVibrationEffectEnabled(options.getBoolean(key)); + } else if (key.equalsIgnoreCase("enableFlashOnScanStart")) { + bamSDK.setEnableFlashOnScanStart(options.getBoolean(key)); + } else if (key.equalsIgnoreCase("cardNumberMaskingEnabled")) { + bamSDK.setCardNumberMaskingEnabled(options.getBoolean(key)); + } else if (key.equalsIgnoreCase("cameraPosition")) { + JumioCameraPosition cameraPosition = (options.getString(key).toLowerCase().equals("front")) ? JumioCameraPosition.FRONT : JumioCameraPosition.BACK; + bamSDK.setCameraPosition(cameraPosition); + } else if (key.equalsIgnoreCase("cardTypes")) { + JSONArray jsonTypes = options.getJSONArray(key); + ArrayList types = new ArrayList(); + if (jsonTypes != null) { + int len = jsonTypes.length(); + for (int i = 0; i < len; i++) { + types.add(jsonTypes.get(i).toString()); + } + } + + ArrayList creditCardTypes = new ArrayList(); + for (String type : types) { + if (type.toLowerCase().equals("visa")) { + creditCardTypes.add(CreditCardType.VISA); + } else if (type.toLowerCase().equals("master_card")) { + creditCardTypes.add(CreditCardType.MASTER_CARD); + } else if (type.toLowerCase().equals("american_express")) { + creditCardTypes.add(CreditCardType.AMERICAN_EXPRESS); + } else if (type.toLowerCase().equals("china_unionpay")) { + creditCardTypes.add(CreditCardType.CHINA_UNIONPAY); + } else if (type.toLowerCase().equals("diners_club")) { + creditCardTypes.add(CreditCardType.DINERS_CLUB); + } else if (type.toLowerCase().equals("discover")) { + creditCardTypes.add(CreditCardType.DISCOVER); + } else if (type.toLowerCase().equals("jcb")) { + creditCardTypes.add(CreditCardType.JCB); + } + } + + bamSDK.setSupportedCreditCardTypes(creditCardTypes); + } + } + } + } catch (JSONException e) { + showErrorMessage("Invalid parameters: " + e.getLocalizedMessage()); + } catch (PlatformNotSupportedException e) { + showErrorMessage("Error initializing the BAM SDK: " + e.getLocalizedMessage()); + } catch (SDKExpiredException e) { + showErrorMessage("Error initializing the BAM SDK: " + e.getLocalizedMessage()); + } + } + + private void startBAM(JSONArray data) { + if (bamSDK == null) { + showErrorMessage("The BAM SDK is not initialized yet. Call initBAM() first."); + return; + } + + Runnable runnable = new Runnable() { + @Override + public void run() { + try { + checkPermissionsAndStart(bamSDK); + } catch (Exception e) { + showErrorMessage("Error starting the BAM SDK: " + e.getLocalizedMessage()); + } + } + }; + + this.cordova.setActivityResultCallback(this); + this.cordova.getActivity().runOnUiThread(runnable); + } + + // Netverify + + private void initNetverify(JSONArray data) { + if (!NetverifySDK.isSupportedPlatform(cordova.getActivity())) { + showErrorMessage("This platform is not supported."); + return; + } + + try { + if (data.isNull(0) || data.isNull(1) || data.isNull(2)) { + showErrorMessage("Missing required parameters apiToken, apiSecret or dataCenter."); + return; + } + + String apiToken = data.getString(0); + String apiSecret = data.getString(1); + JumioDataCenter dataCenter = (data.getString(2).toLowerCase().equalsIgnoreCase("us")) ? JumioDataCenter.US : JumioDataCenter.EU; + + netverifySDK = NetverifySDK.create(cordova.getActivity(), apiToken, apiSecret, dataCenter); + + // Configuration options + if (!data.isNull(3)) { + JSONObject options = data.getJSONObject(3); + Iterator keys = options.keys(); + while (keys.hasNext()) { + String key = keys.next(); + + if (key.equalsIgnoreCase("requireVerification")) { + netverifySDK.setRequireVerification(options.getBoolean(key)); + } else if (key.equalsIgnoreCase("callbackUrl")) { + netverifySDK.setCallbackUrl(options.getString(key)); + } else if (key.equalsIgnoreCase("requireFaceMatch")) { + netverifySDK.setRequireFaceMatch(options.getBoolean(key)); + } else if (key.equalsIgnoreCase("preselectedCountry")) { + netverifySDK.setPreselectedCountry(options.getString(key)); + } else if (key.equalsIgnoreCase("merchantScanReference")) { + netverifySDK.setMerchantScanReference(options.getString(key)); + } else if (key.equalsIgnoreCase("merchantReportingCriteria")) { + netverifySDK.setMerchantReportingCriteria(options.getString(key)); + } else if (key.equalsIgnoreCase("customerID")) { + netverifySDK.setCustomerId(options.getString(key)); + } else if (key.equalsIgnoreCase("additionalInformation")) { + netverifySDK.setAdditionalInformation(options.getString(key)); + } else if (key.equalsIgnoreCase("enableEpassport")) { + netverifySDK.setEnableEMRTD(options.getBoolean(key)); + } else if (key.equalsIgnoreCase("sendDebugInfoToJumio")) { + netverifySDK.sendDebugInfoToJumio(options.getBoolean(key)); + } else if (key.equalsIgnoreCase("dataExtractionOnMobileOnly")) { + netverifySDK.setDataExtractionOnMobileOnly(options.getBoolean(key)); + } else if (key.equalsIgnoreCase("cameraPosition")) { + JumioCameraPosition cameraPosition = (options.getString(key).toLowerCase().equals("front")) ? JumioCameraPosition.FRONT : JumioCameraPosition.BACK; + netverifySDK.setCameraPosition(cameraPosition); + } else if (key.equalsIgnoreCase("preselectedDocumentVariant")) { + NVDocumentVariant variant = (options.getString(key).toLowerCase().equals("paper")) ? NVDocumentVariant.PAPER : NVDocumentVariant.PLASTIC; + netverifySDK.setPreselectedDocumentVariant(variant); + } else if (key.equalsIgnoreCase("documentTypes")) { + JSONArray jsonTypes = options.getJSONArray(key); + ArrayList types = new ArrayList(); + if (jsonTypes != null) { + int len = jsonTypes.length(); + for (int i = 0; i < len; i++) { + types.add(jsonTypes.get(i).toString()); + } + } + + ArrayList documentTypes = new ArrayList(); + for (String type : types) { + if (type.toLowerCase().equals("passport")) { + documentTypes.add(NVDocumentType.PASSPORT); + } else if (type.toLowerCase().equals("driver_license")) { + documentTypes.add(NVDocumentType.DRIVER_LICENSE); + } else if (type.toLowerCase().equals("identity_card")) { + documentTypes.add(NVDocumentType.IDENTITY_CARD); + } else if (type.toLowerCase().equals("visa")) { + documentTypes.add(NVDocumentType.VISA); + } + } + + netverifySDK.setPreselectedDocumentTypes(documentTypes); + } + } + } + } catch (JSONException e) { + showErrorMessage("Invalid parameters: " + e.getLocalizedMessage()); + } catch (PlatformNotSupportedException e) { + showErrorMessage("Error initializing the Netverify SDK: " + e.getLocalizedMessage()); + } + } + + private void startNetverify(JSONArray data) { + if (netverifySDK == null) { + showErrorMessage("The Netverify SDK is not initialized yet. Call initNetverify() first."); + return; + } + + Runnable runnable = new Runnable() { + @Override + public void run() { + try { + checkPermissionsAndStart(netverifySDK); + } catch (Exception e) { + showErrorMessage("Error starting the Netverify SDK: " + e.getLocalizedMessage()); + } + } + }; + + this.cordova.setActivityResultCallback(this); + this.cordova.getActivity().runOnUiThread(runnable); + } + + // Document Verification + + private void initDocumentVerification(JSONArray data) { + if (!DocumentVerificationSDK.isSupportedPlatform(cordova.getActivity())) { + showErrorMessage("This platform is not supported."); + return; + } + + try { + if (data.isNull(0) || data.isNull(1) || data.isNull(2)) { + showErrorMessage("Missing required parameters apiToken, apiSecret or dataCenter."); + return; + } + + String apiToken = data.getString(0); + String apiSecret = data.getString(1); + JumioDataCenter dataCenter = (data.getString(2).toLowerCase().equalsIgnoreCase("us")) ? JumioDataCenter.US : JumioDataCenter.EU; + + documentVerificationSDK = DocumentVerificationSDK.create(cordova.getActivity(), apiToken, apiSecret, dataCenter); + + // Configuration options + if (!data.isNull(3)) { + JSONObject options = data.getJSONObject(3); + Iterator keys = options.keys(); + while (keys.hasNext()) { + String key = keys.next(); + + if (key.equalsIgnoreCase("type")) { + documentVerificationSDK.setType(options.getString(key)); + } else if (key.equalsIgnoreCase("customDocumentCode")) { + documentVerificationSDK.setCustomDocumentCode(options.getString(key)); + } else if (key.equalsIgnoreCase("country")) { + documentVerificationSDK.setCountry(options.getString(key)); + } else if (key.equalsIgnoreCase("merchantReportingCriteria")) { + documentVerificationSDK.setMerchantReportingCriteria(options.getString(key)); + } else if (key.equalsIgnoreCase("callbackUrl")) { + documentVerificationSDK.setCallbackUrl(options.getString(key)); + } else if (key.equalsIgnoreCase("additionalInformation")) { + documentVerificationSDK.setAdditionalInformation(options.getString(key)); + } else if (key.equalsIgnoreCase("merchantScanReference")) { + documentVerificationSDK.setMerchantScanReference(options.getString(key)); + } else if (key.equalsIgnoreCase("customerId")) { + documentVerificationSDK.setCustomerId(options.getString(key)); + } else if (key.equalsIgnoreCase("documentName")) { + documentVerificationSDK.setDocumentName(options.getString(key)); + } else if (key.equalsIgnoreCase("cameraPosition")) { + JumioCameraPosition cameraPosition = (options.getString(key).toLowerCase().equals("front")) ? JumioCameraPosition.FRONT : JumioCameraPosition.BACK; + documentVerificationSDK.setCameraPosition(cameraPosition); + } + } + } + + // Configuration options + if (!data.isNull(3)) { + JSONObject options = data.getJSONObject(3); + Iterator keys = options.keys(); + while (keys.hasNext()) { + String key = keys.next(); + + // ... + } + } + } catch (JSONException e) { + showErrorMessage("Invalid parameters: " + e.getLocalizedMessage()); + } catch (PlatformNotSupportedException e) { + showErrorMessage("Error initializing the Document Verification SDK: " + e.getLocalizedMessage()); + } + } + + private void startDocumentVerification(JSONArray data) { + if (documentVerificationSDK == null) { + showErrorMessage("The Document Verification SDK is not initialized yet. Call initDocumentVerification() first."); + return; + } + + Runnable runnable = new Runnable() { + @Override + public void run() { + try { + checkPermissionsAndStart(documentVerificationSDK); + } catch (Exception e) { + showErrorMessage("Error starting the Document Verification SDK: " + e.getLocalizedMessage()); + } + } + }; + + this.cordova.setActivityResultCallback(this); + this.cordova.getActivity().runOnUiThread(runnable); + } + + + // Permissions + + private void checkPermissionsAndStart(MobileSDK sdk) { + if (!MobileSDK.hasAllRequiredPermissions(cordova.getActivity().getApplicationContext())) { + //Acquire missing permissions. + String[] mp = MobileSDK.getMissingPermissions(cordova.getActivity().getApplicationContext()); + + int code; + if (sdk instanceof BamSDK) + code = PERMISSION_REQUEST_CODE_BAM; + else if (sdk instanceof NetverifySDK) + code = PERMISSION_REQUEST_CODE_NETVERIFY; + else if (sdk instanceof DocumentVerificationSDK) + code = PERMISSION_REQUEST_CODE_DOCUMENT_VERIFICATION; + else { + showErrorMessage("Invalid SDK instance"); + return; + } + + cordova.requestPermissions(this, code, mp); + } else { + this.startSdk(sdk); + } + } + + @Override + public void onRequestPermissionResult(int requestCode, String[] permissions, int[] grantResults) throws JSONException { + boolean allGranted = true; + for (int grantResult : grantResults) { + if (grantResult != PackageManager.PERMISSION_GRANTED) { + allGranted = false; + break; + } + } + + if (allGranted) { + if (requestCode == JumioMobileSDK.PERMISSION_REQUEST_CODE_BAM) { + startSdk(this.bamSDK); + } else if (requestCode == JumioMobileSDK.PERMISSION_REQUEST_CODE_NETVERIFY) { + startSdk(this.netverifySDK); + } else if (requestCode == JumioMobileSDK.PERMISSION_REQUEST_CODE_DOCUMENT_VERIFICATION) { + startSdk(this.documentVerificationSDK); + } + } else { + showErrorMessage("You need to grant all required permissions to start the Jumio SDK."); + super.onRequestPermissionResult(requestCode, permissions, grantResults); + } + } + + // SDK Result + + @Override + public void onActivityResult(int requestCode, int resultCode, Intent intent) { + // BAM Checkout Results + if (requestCode == BamSDK.REQUEST_CODE) { + if (intent == null) { + return; + } + if (resultCode == Activity.RESULT_OK) { + BamCardInformation cardInformation = intent.getParcelableExtra(BamSDK.EXTRA_CARD_INFORMATION); + + JSONObject result = new JSONObject(); + try { + result.put("cardType", cardInformation.getCardType()); + result.put("cardNumber", String.valueOf(cardInformation.getCardNumber())); + result.put("cardNumberGrouped", String.valueOf(cardInformation.getCardNumberGrouped())); + result.put("cardNumberMasked", String.valueOf(cardInformation.getCardNumberMasked())); + result.put("cardExpiryMonth", String.valueOf(cardInformation.getCardExpiryDateMonth())); + result.put("cardExpiryYear", String.valueOf(cardInformation.getCardExpiryDateYear())); + result.put("cardExpiryDate", String.valueOf(cardInformation.getCardExpiryDateYear())); + result.put("cardCVV", String.valueOf(cardInformation.getCardCvvCode())); + result.put("cardHolderName", String.valueOf(cardInformation.getCardHolderName())); + result.put("cardSortCode", String.valueOf(cardInformation.getCardSortCode())); + result.put("cardAccountNumber", String.valueOf(cardInformation.getCardAccountNumber())); + result.put("cardSortCodeValid", cardInformation.isCardSortCodeValid()); + result.put("cardAccountNumberValid", cardInformation.isCardAccountNumberValid()); + + ArrayList scanReferenceList = intent.getStringArrayListExtra(BamSDK.EXTRA_SCAN_ATTEMPTS); + if (scanReferenceList != null && scanReferenceList.size() > 0) { + for (int i = scanReferenceList.size() - 1; i >= 0; i--) { + result.put(String.format(Locale.getDefault(), "Scan reference %d", i), scanReferenceList.get(i)); + } + } else { + result.put("Scan reference 0", "N/A"); + } + + callbackContext.success(result); + cardInformation.clear(); + } catch (JSONException e) { + showErrorMessage("Result could not be sent. Try again."); + } + } else if (resultCode == Activity.RESULT_CANCELED) { + String errorCode = intent.getStringExtra(BamSDK.EXTRA_ERROR_CODE); + String errorMsg = intent.getStringExtra(BamSDK.EXTRA_ERROR_MESSAGE); + sendErrorObject(errorCode, errorMsg, ""); + } + // Netverify Results + } else if (requestCode == NetverifySDK.REQUEST_CODE) { + if (intent == null) { + return; + } + String scanReference = intent.getStringExtra(NetverifySDK.EXTRA_SCAN_REFERENCE) != null ? intent.getStringExtra(NetverifySDK.EXTRA_SCAN_REFERENCE) : ""; + + if (resultCode == Activity.RESULT_OK) { + NetverifyDocumentData documentData = intent.getParcelableExtra(NetverifySDK.EXTRA_SCAN_DATA); + JSONObject result = new JSONObject(); + try { + result.put("scanReference", scanReference); + result.put("selectedCountry", documentData.getSelectedCountry()); + result.put("selectedDocumentType", documentData.getSelectedDocumentType()); + result.put("idNumber", documentData.getIdNumber()); + result.put("personalNumber", documentData.getPersonalNumber()); + result.put("issuingDate", documentData.getIssuingDate()); + result.put("expiryDate", documentData.getExpiryDate()); + result.put("issuingCountry", documentData.getIssuingCountry()); + result.put("lastName", documentData.getLastName()); + result.put("firstName", documentData.getFirstName()); + result.put("middleName", documentData.getMiddleName()); + result.put("dob", documentData.getDob()); + result.put("gender", documentData.getGender()); + result.put("originatingCountry", documentData.getOriginatingCountry()); + result.put("addressLine", documentData.getAddressLine()); + result.put("city", documentData.getCity()); + result.put("subdivision", documentData.getSubdivision()); + result.put("postCode", documentData.getPostCode()); + result.put("optionalData1", documentData.getOptionalData1()); + result.put("optionalData2", documentData.getOptionalData2()); + result.put("placeOfBirth", documentData.getPlaceOfBirth()); + result.put("extractionMethod", documentData.getExtractionMethod()); + + // MRZ data if available + if (documentData.getMrzData() != null) { + JSONObject mrzData = new JSONObject(); + mrzData.put("format", documentData.getMrzData().getFormat()); + mrzData.put("line1", documentData.getMrzData().getMrzLine1()); + mrzData.put("line2", documentData.getMrzData().getMrzLine2()); + mrzData.put("line3", documentData.getMrzData().getMrzLine3()); + mrzData.put("idNumberValid", documentData.getMrzData().idNumberValid()); + mrzData.put("dobValid", documentData.getMrzData().dobValid()); + mrzData.put("expiryDateValid", documentData.getMrzData().expiryDateValid()); + mrzData.put("personalNumberValid", documentData.getMrzData().personalNumberValid()); + mrzData.put("compositeValid", documentData.getMrzData().compositeValid()); + result.put("mrzData", mrzData); + } + + callbackContext.success(result); + } catch (JSONException e) { + showErrorMessage("Result could not be sent: " + e.getLocalizedMessage()); + } + } else if (resultCode == Activity.RESULT_CANCELED) { + String errorCode = intent.getStringExtra(NetverifySDK.EXTRA_ERROR_CODE); + String errorMsg = intent.getStringExtra(NetverifySDK.EXTRA_ERROR_MESSAGE); + sendErrorObject(errorCode, errorMsg, scanReference); + } + } else if (requestCode == DocumentVerificationSDK.REQUEST_CODE) { + String scanReference = intent.getStringExtra(NetverifySDK.EXTRA_SCAN_REFERENCE) != null ? intent.getStringExtra(NetverifySDK.EXTRA_SCAN_REFERENCE) : ""; + + if (resultCode == Activity.RESULT_OK) { + try { + JSONObject result = new JSONObject(); + result.put("successMessage", "Document-Verification finished successfully."); + result.put("scanReference", scanReference); + callbackContext.success(result); + } catch (JSONException e) { + showErrorMessage("Result could not be sent: " + e.getLocalizedMessage()); + } + } else if (resultCode == Activity.RESULT_CANCELED) { + String errorCode = intent.getStringExtra(DocumentVerificationSDK.EXTRA_ERROR_CODE); + String errorMsg = intent.getStringExtra(DocumentVerificationSDK.EXTRA_ERROR_MESSAGE); + Log.e(TAG, errorMsg); + sendErrorObject(errorCode, errorMsg, scanReference); + } + } + } + + // Helper methods + + private void startSdk(MobileSDK sdk) { + try { + sdk.start(); + } catch (MissingPermissionException e) { + Toast.makeText(cordova.getActivity(), e.getMessage(), Toast.LENGTH_LONG).show(); + } + } + + private void showErrorMessage(String msg) { + Log.e(TAG, msg); + try{ + JSONObject errorResult = new JSONObject(); + errorResult.put("errorMessage", msg != null ? msg : ""); + callbackContext.error(errorResult); + }catch (JSONException e) { + Log.e(TAG, e.getLocalizedMessage()); + } + } + + private void sendErrorObject(String errorCode, String errorMsg, String scanReference) { + try { + JSONObject errorResult = new JSONObject(); + errorResult.put("errorCode", errorMsg != null ? errorCode : ""); + errorResult.put("errorMessage", errorMsg != null ? errorMsg : ""); + errorResult.put("scanReference", scanReference != null ? scanReference : ""); + callbackContext.error(errorResult); + } catch (JSONException e) { + showErrorMessage("Result could not be sent: " + e.getLocalizedMessage()); + } + } } diff --git a/demo/node_modules/cordova-plugin-jumio-mobilesdk/src/ios/JumioMobileSDK.m b/demo/node_modules/cordova-plugin-jumio-mobilesdk/src/ios/JumioMobileSDK.m index 8be49bf..684d476 100644 --- a/demo/node_modules/cordova-plugin-jumio-mobilesdk/src/ios/JumioMobileSDK.m +++ b/demo/node_modules/cordova-plugin-jumio-mobilesdk/src/ios/JumioMobileSDK.m @@ -507,6 +507,8 @@ - (void)netverifyViewController:(NetverifyViewController *)netverifyViewControll [result setValue: @"m" forKey: @"gender"]; } else if (documentData.gender == NetverifyGenderF) { [result setValue: @"f" forKey: @"gender"]; + } else if (documentData.gender == NetverifyGenderX) { + [result setValue: @"x" forKey: @"gender"]; } [result setValue: documentData.originatingCountry forKey: @"originatingCountry"]; [result setValue: documentData.addressLine forKey: @"addressLine"]; @@ -564,14 +566,14 @@ - (void)netverifyViewController:(NetverifyViewController *)netverifyViewControll [self.viewController dismissViewControllerAnimated: YES completion: nil]; } -- (void)netverifyViewController:(NetverifyViewController *)netverifyViewController didFinishInitializingWithError:(NSError *)error { +- (void)netverifyViewController:(NetverifyViewController *)netverifyViewController didFinishInitializingWithError:(NetverifyError *)error { if (error != nil) { - [self sendError: error scanReference: nil]; + [self sendNetverifyError: error scanReference: nil]; } } -- (void)netverifyViewController:(NetverifyViewController *)netverifyViewController didCancelWithError:(NSError *)error scanReference:(NSString *)scanReference { - [self sendError: error scanReference: scanReference]; +- (void)netverifyViewController:(NetverifyViewController *)netverifyViewController didCancelWithError:(NetverifyError *)error scanReference:(NSString *)scanReference { + [self sendNetverifyError: error scanReference: scanReference]; [self.viewController dismissViewControllerAnimated: YES completion: nil]; } @@ -584,8 +586,8 @@ - (void) documentVerificationViewController:(DocumentVerificationViewController [self.viewController dismissViewControllerAnimated: YES completion: nil]; } -- (void) documentVerificationViewController:(DocumentVerificationViewController *)documentVerificationViewController didFinishWithError:(NSError *)error { - [self sendError: error scanReference: nil]; +- (void) documentVerificationViewController:(DocumentVerificationViewController *)documentVerificationViewController didFinishWithError:(DocumentVerificationError *)error { + [self sendDocumentVerificationError: error scanReference: nil]; [self.viewController dismissViewControllerAnimated: YES completion: nil]; } @@ -612,6 +614,32 @@ - (void)sendError:(NSError *)error scanReference:(NSString *)scanReference { [self.commandDelegate sendPluginResult: pluginResult callbackId: self.callbackId]; [self.viewController dismissViewControllerAnimated: YES completion: nil]; } + +- (void)sendNetverifyError:(NetverifyError *)error scanReference:(NSString *)scanReference { + NSMutableDictionary *result = [[NSMutableDictionary alloc] init]; + [result setValue: error.code forKey: @"errorCode"]; + [result setValue: error.message forKey: @"errorMessage"]; + if (scanReference) { + [result setValue: scanReference forKey: @"scanReference"]; + } + + CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsDictionary: result]; + [self.commandDelegate sendPluginResult: pluginResult callbackId: self.callbackId]; + [self.viewController dismissViewControllerAnimated: YES completion: nil]; +} + +- (void)sendDocumentVerificationError:(DocumentVerificationError *)error scanReference:(NSString *)scanReference { + NSMutableDictionary *result = [[NSMutableDictionary alloc] init]; + [result setValue: error.code forKey: @"errorCode"]; + [result setValue: error.message forKey: @"errorMessage"]; + if (scanReference) { + [result setValue: scanReference forKey: @"scanReference"]; + } + + CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsDictionary: result]; + [self.commandDelegate sendPluginResult: pluginResult callbackId: self.callbackId]; + [self.viewController dismissViewControllerAnimated: YES completion: nil]; +} - (BOOL) getBoolValue:(NSObject *)value { if (value && [value isKindOfClass: [NSNumber class]]) { diff --git a/demo/package.json b/demo/package.json index 2385a4f..1671930 100644 --- a/demo/package.json +++ b/demo/package.json @@ -1,7 +1,7 @@ { "name": "com.jumio.cordova.demo", "displayName": "DemoApp", - "version": "2.10.0", + "version": "2.11.0", "description": "A sample Apache Cordova application that responds to the deviceready event.", "main": "index.js", "scripts": { @@ -13,7 +13,7 @@ "cordova-android": "^6.4.0", "cordova-ios": "^4.5.3", "cordova-plugin-cocoapod-support": "^1.3.0", - "cordova-plugin-jumio-mobilesdk": "git+https://github.com/Jumio/mobile-cordova.git#v2.10.0", + "cordova-plugin-jumio-mobilesdk": "git+https://github.com/Jumio/mobile-cordova.git#v2.11.0", "cordova-plugin-whitelist": "^1.3.2" }, "cordova": { diff --git a/demo/platforms/android/.idea/libraries/android_android_26.xml b/demo/platforms/android/.idea/libraries/android_android_26.xml deleted file mode 100644 index cbfd9ea..0000000 --- a/demo/platforms/android/.idea/libraries/android_android_26.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/demo/platforms/android/.idea/misc.xml b/demo/platforms/android/.idea/misc.xml deleted file mode 100644 index 73c5549..0000000 --- a/demo/platforms/android/.idea/misc.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/demo/platforms/android/.idea/workspace.xml b/demo/platforms/android/.idea/workspace.xml deleted file mode 100644 index f315f06..0000000 --- a/demo/platforms/android/.idea/workspace.xml +++ /dev/null @@ -1,3104 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - equals - start - init - jumio - vi - compile - equals( - customerID - toLowerCase - N - vision - initNetverify - CordovaPlugin - cordovaPlugin - e - hasClass - a - analy - analyt - analyti - analyticxs - analyticx - analytic - analytics - debugInfo - - - equalsIgnoreCase( - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1500897388203 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/demo/platforms/android/CordovaLib/build.gradle b/demo/platforms/android/CordovaLib/build.gradle index ffdd95e..6a62a48 100644 --- a/demo/platforms/android/CordovaLib/build.gradle +++ b/demo/platforms/android/CordovaLib/build.gradle @@ -28,10 +28,11 @@ buildscript { maven { url "https://maven.google.com" } - } + google() + } dependencies { - classpath 'com.android.tools.build:gradle:3.0.1' + classpath 'com.android.tools.build:gradle:3.1.0' classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3' } @@ -49,6 +50,11 @@ android { buildToolsVersion cdvBuildToolsVersion publishNonDefault true + defaultConfig { + // Enabling multidex support. + multiDexEnabled true + } + compileOptions { sourceCompatibility JavaVersion.VERSION_1_6 targetCompatibility JavaVersion.VERSION_1_6 diff --git a/demo/platforms/android/build.gradle b/demo/platforms/android/build.gradle index c10bee8..447a7d4 100644 --- a/demo/platforms/android/build.gradle +++ b/demo/platforms/android/build.gradle @@ -23,14 +23,15 @@ buildscript { maven { url "https://maven.google.com" } - } + google() + } // Switch the Android Gradle plugin version requirement depending on the // installed version of Gradle. This dependency is documented at // http://tools.android.com/tech-docs/new-build-system/version-compatibility // and https://issues.apache.org/jira/browse/CB-8143 dependencies { - classpath 'com.android.tools.build:gradle:3.0.1' + classpath 'com.android.tools.build:gradle:3.1.0' } } @@ -96,7 +97,7 @@ repositories { } ext { - SDK_VERSION = "2.10.0" + SDK_VERSION = "2.11.0" } dependencies { @@ -112,13 +113,13 @@ dependencies { implementation "com.jumio.android:dv:${SDK_VERSION}@aar" //for core: - implementation "com.android.support:support-v4:27.0.2" - api "com.android.support:appcompat-v7:27.0.2" + implementation "com.android.support:support-v4:27.1.0" + api "com.android.support:appcompat-v7:27.1.0" //for nv: - implementation "com.android.support:design:27.0.2" - implementation "com.android.support:cardview-v7:27.0.2" - implementation "com.google.android.gms:play-services-vision:11.8.0" + implementation "com.android.support:design:27.1.0" + implementation "com.android.support:cardview-v7:27.1.0" + implementation "com.google.android.gms:play-services-vision:12.0.0" //only for nv-nfc implementation "com.madgag.spongycastle:prov:1.58.0.0" @@ -205,6 +206,8 @@ android { versionCode cdvVersionCode ?: new BigInteger("" + privateHelpers.extractIntFromManifest("versionCode")) applicationId privateHelpers.extractStringFromManifest("package") + multiDexEnabled true + if (cdvMinSdkVersion != null) { minSdkVersion cdvMinSdkVersion } diff --git a/demo/platforms/android/src/com/jumio/mobilesdk/JumioMobileSDK.java b/demo/platforms/android/src/com/jumio/mobilesdk/JumioMobileSDK.java index 2b7c6d9..a31a013 100644 --- a/demo/platforms/android/src/com/jumio/mobilesdk/JumioMobileSDK.java +++ b/demo/platforms/android/src/com/jumio/mobilesdk/JumioMobileSDK.java @@ -45,7 +45,6 @@ public class JumioMobileSDK extends CordovaPlugin { private NetverifySDK netverifySDK; private DocumentVerificationSDK documentVerificationSDK; private CallbackContext callbackContext; - private String errorMsg; @Override public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { @@ -506,9 +505,19 @@ public void onActivityResult(int requestCode, int resultCode, Intent intent) { showErrorMessage("Result could not be sent. Try again."); } } else if (resultCode == Activity.RESULT_CANCELED) { - int errorCode = intent.getIntExtra(BamSDK.EXTRA_ERROR_CODE, 0); + String errorCode = intent.getStringExtra(BamSDK.EXTRA_ERROR_CODE); String errorMsg = intent.getStringExtra(BamSDK.EXTRA_ERROR_MESSAGE); - sendErrorObject(errorCode, errorMsg, ""); + ArrayList scanReferenceList = intent.getStringArrayListExtra(BamSDK.EXTRA_SCAN_ATTEMPTS); + String scanRef = null; + if (scanReferenceList != null && scanReferenceList.size() > 0) { + scanRef = scanReferenceList.get(0); + } + sendErrorObject(errorCode, errorMsg, scanRef != null ? scanRef : ""); + } + + if (bamSDK != null) { + bamSDK.destroy(); + bamSDK = null; } // Netverify Results } else if (requestCode == NetverifySDK.REQUEST_CODE) { @@ -564,12 +573,18 @@ public void onActivityResult(int requestCode, int resultCode, Intent intent) { showErrorMessage("Result could not be sent: " + e.getLocalizedMessage()); } } else if (resultCode == Activity.RESULT_CANCELED) { - int errorCode = intent.getIntExtra(NetverifySDK.EXTRA_ERROR_CODE, 0); + String errorCode = intent.getStringExtra(NetverifySDK.EXTRA_ERROR_CODE); String errorMsg = intent.getStringExtra(NetverifySDK.EXTRA_ERROR_MESSAGE); sendErrorObject(errorCode, errorMsg, scanReference); } + + if (netverifySDK != null) { + netverifySDK.destroy(); + netverifySDK = null; + } + // Document Verification Results } else if (requestCode == DocumentVerificationSDK.REQUEST_CODE) { - String scanReference = intent.getStringExtra(NetverifySDK.EXTRA_SCAN_REFERENCE) != null ? intent.getStringExtra(NetverifySDK.EXTRA_SCAN_REFERENCE) : ""; + String scanReference = intent.getStringExtra(DocumentVerificationSDK.EXTRA_SCAN_REFERENCE) != null ? intent.getStringExtra(DocumentVerificationSDK.EXTRA_SCAN_REFERENCE) : ""; if (resultCode == Activity.RESULT_OK) { try { @@ -581,11 +596,16 @@ public void onActivityResult(int requestCode, int resultCode, Intent intent) { showErrorMessage("Result could not be sent: " + e.getLocalizedMessage()); } } else if (resultCode == Activity.RESULT_CANCELED) { - int errorCode = intent.getIntExtra(DocumentVerificationSDK.EXTRA_ERROR_CODE, 0); + String errorCode = intent.getStringExtra(DocumentVerificationSDK.EXTRA_ERROR_CODE); String errorMsg = intent.getStringExtra(DocumentVerificationSDK.EXTRA_ERROR_MESSAGE); Log.e(TAG, errorMsg); sendErrorObject(errorCode, errorMsg, scanReference); } + + if (documentVerificationSDK != null) { + documentVerificationSDK.destroy(); + documentVerificationSDK = null; + } } } @@ -610,10 +630,10 @@ private void showErrorMessage(String msg) { } } - private void sendErrorObject(int errorCode, String errorMsg, String scanReference) { + private void sendErrorObject(String errorCode, String errorMsg, String scanReference) { try { JSONObject errorResult = new JSONObject(); - errorResult.put("errorCode", String.valueOf(errorCode)); + errorResult.put("errorCode", errorMsg != null ? errorCode : ""); errorResult.put("errorMessage", errorMsg != null ? errorMsg : ""); errorResult.put("scanReference", scanReference != null ? scanReference : ""); callbackContext.error(errorResult); diff --git a/demo/platforms/ios/.pods.json b/demo/platforms/ios/.pods.json index 70d251f..1817cc6 100644 --- a/demo/platforms/ios/.pods.json +++ b/demo/platforms/ios/.pods.json @@ -2,7 +2,7 @@ "pods": { "JumioMobileSDK": { "name": "JumioMobileSDK", - "version": "2.10.0", + "version": "2.11.0", "configurations": "release,debug" } }, diff --git a/demo/platforms/ios/DemoApp/DemoApp-Info.plist b/demo/platforms/ios/DemoApp/DemoApp-Info.plist index bb6d0db..75ccdbf 100644 --- a/demo/platforms/ios/DemoApp/DemoApp-Info.plist +++ b/demo/platforms/ios/DemoApp/DemoApp-Info.plist @@ -21,11 +21,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 2.10.0 + 2.11.0 CFBundleSignature ???? CFBundleVersion - 2.10.0 + 2.11.0 LSRequiresIPhoneOS NSAppTransportSecurity diff --git a/demo/platforms/ios/DemoApp/Plugins/cordova-plugin-jumio-mobilesdk/JumioMobileSDK.m b/demo/platforms/ios/DemoApp/Plugins/cordova-plugin-jumio-mobilesdk/JumioMobileSDK.m index 8be49bf..684d476 100644 --- a/demo/platforms/ios/DemoApp/Plugins/cordova-plugin-jumio-mobilesdk/JumioMobileSDK.m +++ b/demo/platforms/ios/DemoApp/Plugins/cordova-plugin-jumio-mobilesdk/JumioMobileSDK.m @@ -507,6 +507,8 @@ - (void)netverifyViewController:(NetverifyViewController *)netverifyViewControll [result setValue: @"m" forKey: @"gender"]; } else if (documentData.gender == NetverifyGenderF) { [result setValue: @"f" forKey: @"gender"]; + } else if (documentData.gender == NetverifyGenderX) { + [result setValue: @"x" forKey: @"gender"]; } [result setValue: documentData.originatingCountry forKey: @"originatingCountry"]; [result setValue: documentData.addressLine forKey: @"addressLine"]; @@ -564,14 +566,14 @@ - (void)netverifyViewController:(NetverifyViewController *)netverifyViewControll [self.viewController dismissViewControllerAnimated: YES completion: nil]; } -- (void)netverifyViewController:(NetverifyViewController *)netverifyViewController didFinishInitializingWithError:(NSError *)error { +- (void)netverifyViewController:(NetverifyViewController *)netverifyViewController didFinishInitializingWithError:(NetverifyError *)error { if (error != nil) { - [self sendError: error scanReference: nil]; + [self sendNetverifyError: error scanReference: nil]; } } -- (void)netverifyViewController:(NetverifyViewController *)netverifyViewController didCancelWithError:(NSError *)error scanReference:(NSString *)scanReference { - [self sendError: error scanReference: scanReference]; +- (void)netverifyViewController:(NetverifyViewController *)netverifyViewController didCancelWithError:(NetverifyError *)error scanReference:(NSString *)scanReference { + [self sendNetverifyError: error scanReference: scanReference]; [self.viewController dismissViewControllerAnimated: YES completion: nil]; } @@ -584,8 +586,8 @@ - (void) documentVerificationViewController:(DocumentVerificationViewController [self.viewController dismissViewControllerAnimated: YES completion: nil]; } -- (void) documentVerificationViewController:(DocumentVerificationViewController *)documentVerificationViewController didFinishWithError:(NSError *)error { - [self sendError: error scanReference: nil]; +- (void) documentVerificationViewController:(DocumentVerificationViewController *)documentVerificationViewController didFinishWithError:(DocumentVerificationError *)error { + [self sendDocumentVerificationError: error scanReference: nil]; [self.viewController dismissViewControllerAnimated: YES completion: nil]; } @@ -612,6 +614,32 @@ - (void)sendError:(NSError *)error scanReference:(NSString *)scanReference { [self.commandDelegate sendPluginResult: pluginResult callbackId: self.callbackId]; [self.viewController dismissViewControllerAnimated: YES completion: nil]; } + +- (void)sendNetverifyError:(NetverifyError *)error scanReference:(NSString *)scanReference { + NSMutableDictionary *result = [[NSMutableDictionary alloc] init]; + [result setValue: error.code forKey: @"errorCode"]; + [result setValue: error.message forKey: @"errorMessage"]; + if (scanReference) { + [result setValue: scanReference forKey: @"scanReference"]; + } + + CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsDictionary: result]; + [self.commandDelegate sendPluginResult: pluginResult callbackId: self.callbackId]; + [self.viewController dismissViewControllerAnimated: YES completion: nil]; +} + +- (void)sendDocumentVerificationError:(DocumentVerificationError *)error scanReference:(NSString *)scanReference { + NSMutableDictionary *result = [[NSMutableDictionary alloc] init]; + [result setValue: error.code forKey: @"errorCode"]; + [result setValue: error.message forKey: @"errorMessage"]; + if (scanReference) { + [result setValue: scanReference forKey: @"scanReference"]; + } + + CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsDictionary: result]; + [self.commandDelegate sendPluginResult: pluginResult callbackId: self.callbackId]; + [self.viewController dismissViewControllerAnimated: YES completion: nil]; +} - (BOOL) getBoolValue:(NSObject *)value { if (value && [value isKindOfClass: [NSNumber class]]) { diff --git a/demo/platforms/ios/DemoApp/config.xml b/demo/platforms/ios/DemoApp/config.xml index 60d980c..47ab342 100755 --- a/demo/platforms/ios/DemoApp/config.xml +++ b/demo/platforms/ios/DemoApp/config.xml @@ -1,5 +1,5 @@ - + diff --git a/demo/platforms/ios/Podfile b/demo/platforms/ios/Podfile index 631e1cf..870ad91 100644 --- a/demo/platforms/ios/Podfile +++ b/demo/platforms/ios/Podfile @@ -2,5 +2,5 @@ platform :ios, '9.0' use_frameworks! source 'https://github.com/CocoaPods/Specs.git' target 'DemoApp' do - pod 'JumioMobileSDK', '2.10.0' + pod 'JumioMobileSDK', '2.11.0' end \ No newline at end of file diff --git a/demo/plugins/cordova-plugin-jumio-mobilesdk/package.json b/demo/plugins/cordova-plugin-jumio-mobilesdk/package.json index a839bfb..ab23890 100644 --- a/demo/plugins/cordova-plugin-jumio-mobilesdk/package.json +++ b/demo/plugins/cordova-plugin-jumio-mobilesdk/package.json @@ -2,47 +2,47 @@ "_args": [ [ { - "raw": "https://github.com/Jumio/mobile-cordova.git#v2.10.0", + "raw": "https://github.com/Jumio/mobile-cordova.git#v2.11.0", "scope": null, "escapedName": null, "name": null, - "rawSpec": "https://github.com/Jumio/mobile-cordova.git#v2.10.0", - "spec": "git+https://github.com/Jumio/mobile-cordova.git#v2.10.0", + "rawSpec": "https://github.com/Jumio/mobile-cordova.git#v2.11.0", + "spec": "git+https://github.com/Jumio/mobile-cordova.git#v2.11.0", "type": "hosted", "hosted": { "type": "github", - "ssh": "git@github.com:Jumio/mobile-cordova.git#v2.10.0", - "sshUrl": "git+ssh://git@github.com/Jumio/mobile-cordova.git#v2.10.0", - "httpsUrl": "git+https://github.com/Jumio/mobile-cordova.git#v2.10.0", - "gitUrl": "git://github.com/Jumio/mobile-cordova.git#v2.10.0", - "shortcut": "github:Jumio/mobile-cordova#v2.10.0", - "directUrl": "https://raw.githubusercontent.com/Jumio/mobile-cordova/v2.10.0/package.json" + "ssh": "git@github.com:Jumio/mobile-cordova.git#v2.11.0", + "sshUrl": "git+ssh://git@github.com/Jumio/mobile-cordova.git#v2.11.0", + "httpsUrl": "git+https://github.com/Jumio/mobile-cordova.git#v2.11.0", + "gitUrl": "git://github.com/Jumio/mobile-cordova.git#v2.11.0", + "shortcut": "github:Jumio/mobile-cordova#v2.11.0", + "directUrl": "https://raw.githubusercontent.com/Jumio/mobile-cordova/v2.11.0/package.json" } }, "C:\\Users\\pkoller\\Documents\\Github\\mobile-cordova-pilot\\demo" ] ], - "_from": "git+https://github.com/Jumio/mobile-cordova.git#v2.10.0", - "_id": "cordova-plugin-jumio-mobilesdk@2.10.0", + "_from": "git+https://github.com/Jumio/mobile-cordova.git#v2.11.0", + "_id": "cordova-plugin-jumio-mobilesdk@2.11.0", "_inCache": true, "_location": "/cordova-plugin-jumio-mobilesdk", "_phantomChildren": {}, "_requested": { - "raw": "https://github.com/Jumio/mobile-cordova.git#v2.10.0", + "raw": "https://github.com/Jumio/mobile-cordova.git#v2.11.0", "scope": null, "escapedName": null, "name": null, - "rawSpec": "https://github.com/Jumio/mobile-cordova.git#v2.10.0", - "spec": "git+https://github.com/Jumio/mobile-cordova.git#v2.10.0", + "rawSpec": "https://github.com/Jumio/mobile-cordova.git#v2.11.0", + "spec": "git+https://github.com/Jumio/mobile-cordova.git#v2.11.0", "type": "hosted", "hosted": { "type": "github", - "ssh": "git@github.com:Jumio/mobile-cordova.git#v2.10.0", - "sshUrl": "git+ssh://git@github.com/Jumio/mobile-cordova.git#v2.10.0", - "httpsUrl": "git+https://github.com/Jumio/mobile-cordova.git#v2.10.0", - "gitUrl": "git://github.com/Jumio/mobile-cordova.git#v2.10.0", - "shortcut": "github:Jumio/mobile-cordova#v2.10.0", - "directUrl": "https://raw.githubusercontent.com/Jumio/mobile-cordova/v2.10.0/package.json" + "ssh": "git@github.com:Jumio/mobile-cordova.git#v2.11.0", + "sshUrl": "git+ssh://git@github.com/Jumio/mobile-cordova.git#v2.11.0", + "httpsUrl": "git+https://github.com/Jumio/mobile-cordova.git#v2.11.0", + "gitUrl": "git://github.com/Jumio/mobile-cordova.git#v2.11.0", + "shortcut": "github:Jumio/mobile-cordova#v2.11.0", + "directUrl": "https://raw.githubusercontent.com/Jumio/mobile-cordova/v2.11.0/package.json" } }, "_requiredBy": [ @@ -52,7 +52,7 @@ "_resolved": "git+https://github.com/Jumio/mobile-cordova.git#606cec5199aabc486cb6a99a04683d5125e0bf1d", "_shasum": "286bdf880d386ff38d291890411f99496b15628b", "_shrinkwrap": null, - "_spec": "https://github.com/Jumio/mobile-cordova.git#v2.10.0", + "_spec": "https://github.com/Jumio/mobile-cordova.git#v2.11.0", "_where": "C:\\Users\\pkoller\\Documents\\Github\\mobile-cordova-pilot\\demo", "author": { "name": "Jumio Corporation" @@ -80,11 +80,11 @@ "license": "ISC", "name": "cordova-plugin-jumio-mobilesdk", "optionalDependencies": {}, - "readme": "# Plugin for Apache Cordova\r\n\r\nOfficial Jumio Mobile SDK plugin for Apache Cordova\r\n\r\n## Compatibility\r\nWith this release, we only ensure compatibility with the latest Cordova versions and plugins.\r\nAt the time of this release, the following minimum versions are supported:\r\n* Cordova: 7.1.0\r\n* Cordova Android: 6.3.0\r\n* Cordova iOS: 4.5.3\r\n\r\n## Setup\r\n\r\nCreate Cordova project and add our plugin\r\n```\r\ncordova create MyProject com.my.project \"MyProject\"\r\ncd MyProject\r\ncordova platform add ios\r\ncordova platform add android\r\ncordova plugin add https://github.com/Jumio/mobile-cordova.git#v2.10.0\r\n```\r\n\r\n## Integration\r\n\r\n### iOS\r\n\r\nManual integration or dependency management via cocoapods possible, please see [the official documentation of the Jumio Mobile SDK for iOS](https://github.com/Jumio/mobile-sdk-ios/tree/v2.10.0#basic-setup)\r\n\r\n### Android\r\n\r\nAdd the Jumio repository:\r\n\r\n```\r\nrepositories {\r\n maven { url 'http://mobile-sdk.jumio.com' }\r\n maven { url 'https://maven.google.com/' }\r\n}\r\n```\r\n\r\nAdd a parameter for your SDK_VERSION into the ext-section:\r\n\r\n```\r\next {\r\n SDK_VERSION = \"2.10.0\"\r\n}\r\n```\r\n\r\nAdd required permissions for the products as described in chapter [Permissions](https://github.com/Jumio/mobile-sdk-android/blob/v2.10.0/README.md#permissions)\r\n\r\nOpen the android project of your cordova project located in */platforms/android* and insert the dependencies from the products you require to your **build.gradle** file. (Module: android)\r\n\r\n* [Netverify & Fastfill](https://github.com/Jumio/mobile-sdk-android/blob/v2.10.0/docs/integration_netverify-fastfill.md#dependencies)\r\n* [Document Verification](https://github.com/Jumio/mobile-sdk-android/blob/v2.10.0/docs/integration_document-verification.md#dependencies)\r\n* [BAM Checkout](https://github.com/Jumio/mobile-sdk-android/blob/v2.10.0/docs/integration_bam-checkout.md#dependencies)\r\n\r\n__Note:__ If you are using Netverify, make sure to add the Google vision meta-data to you **AndroidManifest.xml** accordingly:\r\n\r\n```\r\n\r\n```\r\n\r\n## Usage\r\n\r\n\r\n### Netverify / Fastfill\r\n\r\nTo initialize the SDK, perform the following call.\r\n\r\n```javascript\r\nJumio.initNetverify(, , , {configuration});\r\n```\r\n\r\nDatacenter can either be **US** or **EU**.\r\n\r\n\r\n\r\nConfigure the SDK with the *configuration*-Object.\r\n\r\n| Configuration | Datatype | Description |\r\n| ------ | -------- | ----------- |\r\n| requireVerification | Boolean | Enable ID verification |\r\n| callbackUrl | String | Specify an URL for individual transactions |\r\n| requireFaceMatch | Boolean | Enable face match during the ID verification for a specific transaction |\r\n| preselectedCountry | Boolean | Specify the issuing country (ISO 3166-1 alpha-3 country code) |\r\n| merchantScanReference | String | Allows you to identify the scan (max. 100 characters) |\r\n| merchantReportingCriteria | String | Use this option to identify the scan in your reports (max. 100 characters) |\r\n| customerId | String | Set a customer identifier (max. 100 characters) |\r\n| additionalInformation | String | Add additional paramter (max. 255 characters) |\r\n| sendDebugInfoToJumio | Boolean | Send debug information to Jumio. |\r\n| dataExtractionOnMobileOnly | Boolean | Limit data extraction to be done on device only |\r\n| cameraPosition | String | Which camera is used by default. Can be **FRONT** or **BACK**. |\r\n| preselectedDocumentVariant | String | Which types of document variants are available. Can be **PAPER** or **PLASTIC** |\r\n| documentTypes | String-Array | An array of accepted document types: Available document types: **PASSPORT**, **DRIVER_LICENSE**, **IDENTITY_CARD**, **VISA** |\r\n\r\n\r\nInitialization example with configuration.\r\n\r\n```javascript\r\nJumio.initNetverify(\"API_TOKEN\", \"API_SECRET\", \"US\", {\r\n requireVerification: false,\r\n customerId: \"CUSTOMERID\",\r\n preselectedCountry: \"USA\",\r\n cameraPosition: \"BACK\",\r\n documentTypes: [\"DRIVER_LICENSE\", \"PASSPORT\", \"IDENTITY_CARD\", \"VISA\"]\r\n});\r\n```\r\n\r\n***Android eMRTD scanning***\r\n\r\nIf you are using eMRTD scanning, following lines are needed in your Manifest file:\r\n\r\n```javascript\r\n-keep class net.sf.scuba.smartcards.IsoDepCardService {*;}\r\n-keep class org.jmrtd.** { *; }\r\n-keep class net.sf.scuba.** {*;}\r\n-keep class org.spongycastle.** {*;}\r\n-keep class org.ejbca.** {*;}\r\n\r\n-dontwarn java.nio.**\r\n-dontwarn org.codehaus.**\r\n-dontwarn org.ejbca.**\r\n-dontwarn org.spongycastle.**\r\n```\r\n\r\nAdd the needed dependencies following [this chapter](https://github.com/Jumio/mobile-sdk-android/blob/master/docs/integration_netverify-fastfill.md#dependencies) of the android integration guide.\r\n\r\nEnable eMRTD by using the following method in your native android code:\r\n\r\n```javascript\r\nnetverifySDK.setEnableEMRTD(true);\r\n```\r\n\r\n\r\nAs soon as the sdk is initialized, the sdk is started by the following call.\r\n\r\n```javascript\r\nJumio.startNetverify(successCallback, errorCallback);\r\n```\r\n\r\nExample\r\n\r\n```javascript\r\nJumio.startNetverify(function(documentData) {\r\n // YOUR CODE\r\n}, function(error) {\r\n // YOUR CODE\r\n});\r\n```\r\n\r\n### Document Verification\r\n\r\nTo initialize the SDK, perform the following call.\r\n\r\n```javascript\r\nJumio.initDocumentVerification(, , , {configuration});\r\n```\r\n\r\nDatacenter can either be **US** or **EU**.\r\n\r\nConfigure the SDK with the *configuration*-Object. **(configuration marked with * are mandatory)**\r\n\r\n| Configuration | Datatype | Description |\r\n| ------ | -------- | ----------- |\r\n| **type*** | String | See the list below |\r\n| **customerId*** | String | Set a customer identifier (max. 100 characters) |\r\n| **country*** | String | Set the country (ISO-3166-1 alpha-3 code) |\r\n| **merchantScanReference*** | String | Allows you to identify the scan (max. 100 characters) |\r\n| merchantReportingCriteria | String | Use this option to identify the scan in your reports (max. 100 characters) |\r\n| callbackUrl | String | Specify an URL for individual transactions |\r\n| additionalInformation | String | Add additional paramter (max. 255 characters) |\r\n| documentName | String | Override the document label on the help screen |\r\n| customDocumentCode | String | Set your custom document code (set in the merchant backend under \"Settings\" - \"Multi Documents\" - \"Custom\" |\r\n| cameraPosition | String | Which camera is used by default. Can be **FRONT** or **BACK**. |\r\n\r\nPossible types:\r\n\r\n* BS (Bank statement)\r\n* IC (Insurance card)\r\n* UB (Utility bill, front side)\r\n* CAAP (Cash advance application)\r\n* CRC (Corporate resolution certificate)\r\n* CCS (Credit card statement)\r\n* LAG (Lease agreement)\r\n* LOAP (Loan application)\r\n* MOAP (Mortgage application)\r\n* TR (Tax return)\r\n* VT (Vehicle title)\r\n* VC (Voided check)\r\n* STUC (Student card)\r\n* HCC (Health care card)\r\n* CB (Council bill)\r\n* SENC (Seniors card)\r\n* MEDC (Medicare card)\r\n* BC (Birth certificate)\r\n* WWCC (Working with children check)\r\n* SS (Superannuation statement)\r\n* TAC (Trade association card)\r\n* SEL (School enrolment letter)\r\n* PB (Phone bill)\r\n* USSS (US social security card)\r\n* SSC (Social security card)\r\n* CUSTOM (Custom document type)\r\n\r\nInitialization example with configuration.\r\n\r\n```javascript\r\nJumio.initDocumentVerification(\"API_TOKEN\", \"API_SECRET\", \"US\", {\r\n type: \"BC\",\r\n customerId: \"CUSTOMER ID\",\r\n country: \"USA\",\r\n merchantScanReference: \"YOURSCANREFERENCE\",\r\n cameraPosition: \"BACK\"\r\n});\r\n```\r\n\r\nAs soon as the SDK is initialized, the SDK is started by the following call.\r\n\r\n```javascript\r\nJumio.startDocumentVerification(successCallback, errorCallback);\r\n```\r\n\r\nExample\r\n\r\n```javascript\r\nJumio.startDocumentVerification(function(documentData) {\r\n // YOUR CODE\r\n}, function(error) {\r\n // YOUR CODE\r\n});\r\n```\r\n\r\n### BAM Checkout\r\n\r\nTo Initialize the SDK, perform the following call.\r\n\r\n```javascript\r\nJumio.initBAM(, , , {configuration});\r\n```\r\n\r\nDatacenter can either be **US** or **EU**.\r\n\r\n\r\n\r\nConfigure the SDK with the *configuration*-Object.\r\n\r\n| Configuration | Datatype | Description |\r\n| ------ | -------- | ----------- |\r\n| cardHolderNameRequired | Boolean |\r\n| sortCodeAndAccountNumberRequired | Boolean |\r\n| expiryRequired | Boolean |\r\n| cvvRequired | Boolean |\r\n| expiryEditable | Boolean |\r\n| cardHolderNameEditable | Boolean |\r\n| merchantReportingCriteria | String | Overwrite your specified reporting criteria to identify each scan attempt in your reports (max. 100 characters)\r\n| vibrationEffectEnabled | Boolean |\r\n| enableFlashOnScanStart | Boolean |\r\n| cardNumberMaskingEnabled | Boolean |\r\n| offlineToken | String | In your Jumio merchant backend on the \"Settings\" page under \"API credentials\" you can find your Offline token. In case you use your offline token, you must not set the API token and secret|\r\n| cameraPosition | String | Which camera is used by default. Can be **FRONT** or **BACK**. |\r\n| cardTypes | String-Array | An array of accepted card types. Available card types: **VISA**, **MASTER_CARD**, **AMERICAN_EXPRESS**, **CHINA_UNIONPAY**, **DINERS_CLUB**, **DISCOVER**, **JCB**, **STARBUCKS** |\r\n\r\nInitialization example with configuration.\r\n\r\n```javascript\r\nJumio.initBAM(\"API_TOKEN\", \"API_SECRET\", \"US\", {\r\n cardHolderNameRequired: false,\r\n cvvRequired: true,\r\n cameraPosition: \"BACK\",\r\n cardTypes: [\"VISA\", \"MASTER_CARD\"]\r\n});\r\n```\r\n\r\n\r\nAs soon as the sdk is initialized, the sdk is started by the following call.\r\n\r\n```javascript\r\nJumio.startBAM(successCallback, errorCallback);\r\n```\r\n\r\nExample\r\n\r\n```javascript\r\nJumio.startBAM(function(cardInformation) {\r\n // YOUR CODE\r\n}, function(error) {\r\n // YOUR CODE\r\n});\r\n```\r\n\r\n## Customization\r\n\r\n### Android\r\nThe Netverify SDK can be customized to the respective needs by following this [customization chapter](https://github.com/Jumio/mobile-sdk-android/blob/v2.10.0/docs/integration_netverify-fastfill.md#customization).\r\n\r\n### iOS\r\nThe SDK can be customized to the respective needs. You can pass the following customization options to the initializer:\r\n\r\n| Customization key | Type | Description |\r\n|:------------------|:-----|:------------|\r\n| disableBlur | BOOL | Deactivate the blur effect |\r\n| backgroundColor | STRING | Change base view's background color |\r\n| foregroundColor | STRING | Change base view's foreground color |\r\n| tintColor | STRING | Change the tint color of the navigation bar |\r\n| barTintColor | STRING | Change the bar tint color of the navigation bar |\r\n| textTitleColor | STRING | Change the text title color of the navigation bar |\r\n| documentSelectionHeaderBackgroundColor | STRING | Change the background color of the document selection header |\r\n| documentSelectionHeaderTitleColor | STRING | Change the title color of the document selection header |\r\n| documentSelectionHeaderIconColor | STRING | Change the icon color of the document selection header |\r\n| documentSelectionButtonBackgroundColor | STRING | Change the background color of the document selection button |\r\n| documentSelectionButtonTitleColor | STRING | Change the title color of the document selection button |\r\n| documentSelectionButtonIconColor | STRING | Change the icon color of the document selection button |\r\n| fallbackButtonBackgroundColor | STRING | Change the background color of the fallback button |\r\n| fallbackButtonBorderColor | STRING | Change the border color of the fallback button |\r\n| fallbackButtonTitleColor | STRING | Change the title color of the fallback button |\r\n| positiveButtonBackgroundColor | STRING | Change the background color of the positive button |\r\n| positiveButtonBorderColor | STRING | Change the border color of the positive button |\r\n| positiveButtonTitleColor | STRING | Change the title color of the positive button |\r\n| negativeButtonBackgroundColor | STRING | Change the background color of the negative button |\r\n| negativeButtonBorderColor | STRING | Change the border color of the negative button |\r\n| negativeButtonTitleColor | STRING | Change the title color of the negative button |\r\n| scanOverlayStandardColor (NV only) | STRING | Change the standard color of the scan overlay |\r\n| scanOverlayValidColor (NV only) | STRING | Change the valid color of the scan overlay |\r\n| scanOverlayInvalidColor (NV only) | STRING | Change the invalid color of the scan overlay |\r\n| scanOverlayTextColor (BAM only) | STRING | Change the text color of the scan overlay |\r\n| scanOverlayBorderColor (BAM only) | STRING | Change the border color of the scan overlay |\r\n\r\nAll colors are provided with a HEX string with the following format: #ff00ff.\r\n\r\n**Customization example**\r\n```javascript\r\nJumio.initNetverify(\"API_TOKEN\", \"API_SECRET\", \"US\", {\r\n requireVerification: false,\r\n ...\r\n}, {\r\n disableBlur: true,\r\n backgroundColor: \"#ff00ff\",\r\n barTintColor: \"#ff1298\"\r\n);\r\n```\r\n\r\n## Callback\r\n\r\nTo get information about callbacks, Netverify Retrieval API, Netverify Delete API and Global Netverify settings and more, please read our [page with server related information](https://github.com/Jumio/implementation-guides/blob/master/netverify/callback.md).\r\n\r\nThe JSONObject with all the extracted data that is returned for the specific products is described in the following subchapters:\r\n\r\n### Netverify & Fastfill\r\n\r\n*NetverifyDocumentData:*\r\n\r\n| Parameter | Type | Max. length | Description |\r\n|:-------------------|:----------- \t|:-------------|:-----------------|\r\n| selectedCountry | String| 3| [ISO 3166-1 alpha-3](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-3) country code as provided or selected |\r\n| selectedDocumentType | String | 16| PASSPORT, DRIVER_LICENSE, IDENTITY_CARD or VISA |\r\n| idNumber | String | 100 | Identification number of the document |\r\n| personalNumber | String | 14| Personal number of the document|\r\n| issuingDate | Date | | Date of issue |\r\n| expiryDate | Date | | Date of expiry |\r\n| issuingCountry | String | 3 | Country of issue as ([ISO 3166-1 alpha-3](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3)) country code |\r\n| lastName | String | 100 | Last name of the customer|\r\n| firstName | String | 100 | First name of the customer|\r\n| middleName | String | 100 | Middle name of the customer |\r\n| dob | Date | | Date of birth |\r\n| gender | String | 1| m or f |\r\n| originatingCountry | String | 3|Country of origin as ([ISO 3166-1 alpha-3](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3)) country code |\r\n| addressLine | String | 64 | Street name\t|\r\n| city | String | 64 | City |\r\n| subdivision | String | 3 | Last three characters of [ISO 3166-2:US](http://en.wikipedia.org/wiki/ISO_3166-2:US) state code\t|\r\n| postCode | String | 15 | Postal code |\r\n| mrzData | MRZ-DATA | | MRZ data, see table below |\r\n| optionalData1 | String | 50 | Optional field of MRZ line 1 |\r\n| optionalData2 | String | 50 | Optional field of MRZ line 2 |\r\n| placeOfBirth | String | 255 | Place of Birth |\r\n| extractionMethod | String | 12| MRZ, OCR, BARCODE, BARCODE_OCR or NONE |\r\n\r\n*MRZ-Data*\r\n\r\n| Parameter |Type | Max. length | Description |\r\n|:---------------|:------------- |:-------------|:-----------------|\r\n| format | String | 8| MRP, TD1, TD2, CNIS, MRVA, MRVB or UNKNOWN |\r\n| line1 | String | 50 | MRZ line 1 |\r\n| line2 | String | 50 | MRZ line 2 |\r\n| line3 | String | 50| MRZ line 3 |\r\n| idNumberValid | BOOL| | True if ID number check digit is valid, otherwise false |\r\n| dobValid | BOOL | | True if date of birth check digit is valid, otherwise false |\r\n| expiryDateValid |\tBOOL| |\tTrue if date of expiry check digit is valid or not available, otherwise false|\r\n| personalNumberValid | BOOL | | True if personal number check digit is valid or not available, otherwise false |\r\n| compositeValid | BOOL | | True if composite check digit is valid, otherwise false |\r\n\r\n### BAM Checkout\r\n\r\n*BAMCardInformation*\r\n\r\n|Parameter | Type | Max. length | Description |\r\n|:---------------------------- \t|:-------------|:-----------------|:-------------|\r\n| cardType | String | 16| VISA, MASTER_CARD, AMERICAN_EXPRESS, CHINA_UNIONPAY, DINERS_CLUB, DISCOVER, JCB or STARBUCKS |\r\n| cardNumber | String | 16 | Full credit card number |\r\n| cardNumberGrouped | String | 19 | Grouped credit card number |\r\n| cardNumberMasked | String | 19 | First 6 and last 4 digits of the grouped credit card number, other digits are masked with \"X\" |\r\n| cardExpiryMonth | String | 2 | Month card expires if enabled and readable |\r\n| CardExpiryYear | String | 2 | Year card expires if enabled and readable |\r\n| cardExpiryDate | String | 5 | Date card expires in the format MM/yy if enabled and readable |\r\n| cardCVV | String | 4 | Entered CVV if enabled |\r\n| cardHolderName | String | 100 | Name of the card holder in capital letters if enabled and readable, or as entered if editable |\r\n| cardSortCode | String | 8 | Sort code in the format xx-xx-xx or xxxxxx if enabled, available and readable |\r\n| cardAccountNumber | String | 8 | Account number if enabled, available and readable |\r\n| cardSortCodeValid | BOOL | | True if sort code valid, otherwise false |\r\n| cardAccountNumberValid | BOOL | | True if account number code valid, otherwise false |\r\n\r\n### Document Verification\r\n\r\nNo data returned.\r\n\r\n# Support\r\n\r\n## Contact\r\n\r\nIf you have any questions regarding our implementation guide please contact Jumio Customer Service at support@jumio.com or https://support.jumio.com. The Jumio online helpdesk contains a wealth of information regarding our service including demo videos, product descriptions, FAQs and other things that may help to get you started with Jumio. Check it out at: https://support.jumio.com.\r\n\r\n## Copyright\r\n\r\n© Jumio Corp. 268 Lambert Avenue, Palo Alto, CA 94306\r\n", + "readme": "# Plugin for Apache Cordova\r\n\r\nOfficial Jumio Mobile SDK plugin for Apache Cordova\r\n\r\n## Compatibility\r\nWith this release, we only ensure compatibility with the latest Cordova versions and plugins.\r\nAt the time of this release, the following minimum versions are supported:\r\n* Cordova: 7.1.0\r\n* Cordova Android: 6.3.0\r\n* Cordova iOS: 4.5.3\r\n\r\n## Setup\r\n\r\nCreate Cordova project and add our plugin\r\n```\r\ncordova create MyProject com.my.project \"MyProject\"\r\ncd MyProject\r\ncordova platform add ios\r\ncordova platform add android\r\ncordova plugin add https://github.com/Jumio/mobile-cordova.git#v2.11.0\r\n```\r\n\r\n## Integration\r\n\r\n### iOS\r\n\r\nManual integration or dependency management via cocoapods possible, please see [the official documentation of the Jumio Mobile SDK for iOS](https://github.com/Jumio/mobile-sdk-ios/tree/v2.11.0#basic-setup)\r\n\r\n### Android\r\n\r\nAdd the Jumio repository:\r\n\r\n```\r\nrepositories {\r\n maven { url 'http://mobile-sdk.jumio.com' }\r\n maven { url 'https://maven.google.com/' }\r\n}\r\n```\r\n\r\nAdd a parameter for your SDK_VERSION into the ext-section:\r\n\r\n```\r\next {\r\n SDK_VERSION = \"2.11.0\"\r\n}\r\n```\r\n\r\nAdd required permissions for the products as described in chapter [Permissions](https://github.com/Jumio/mobile-sdk-android/blob/v2.11.0/README.md#permissions)\r\n\r\nOpen the android project of your cordova project located in */platforms/android* and insert the dependencies from the products you require to your **build.gradle** file. (Module: android)\r\n\r\n* [Netverify & Fastfill](https://github.com/Jumio/mobile-sdk-android/blob/v2.11.0/docs/integration_netverify-fastfill.md#dependencies)\r\n* [Document Verification](https://github.com/Jumio/mobile-sdk-android/blob/v2.11.0/docs/integration_document-verification.md#dependencies)\r\n* [BAM Checkout](https://github.com/Jumio/mobile-sdk-android/blob/v2.11.0/docs/integration_bam-checkout.md#dependencies)\r\n\r\n__Note:__ If you are using Netverify, make sure to add the Google vision meta-data to you **AndroidManifest.xml** accordingly:\r\n\r\n```\r\n\r\n```\r\n\r\n## Usage\r\n\r\n\r\n### Netverify / Fastfill\r\n\r\nTo initialize the SDK, perform the following call.\r\n\r\n```javascript\r\nJumio.initNetverify(, , , {configuration});\r\n```\r\n\r\nDatacenter can either be **US** or **EU**.\r\n\r\n\r\n\r\nConfigure the SDK with the *configuration*-Object.\r\n\r\n| Configuration | Datatype | Description |\r\n| ------ | -------- | ----------- |\r\n| requireVerification | Boolean | Enable ID verification |\r\n| callbackUrl | String | Specify an URL for individual transactions |\r\n| requireFaceMatch | Boolean | Enable face match during the ID verification for a specific transaction |\r\n| preselectedCountry | Boolean | Specify the issuing country (ISO 3166-1 alpha-3 country code) |\r\n| merchantScanReference | String | Allows you to identify the scan (max. 100 characters) |\r\n| merchantReportingCriteria | String | Use this option to identify the scan in your reports (max. 100 characters) |\r\n| customerId | String | Set a customer identifier (max. 100 characters) |\r\n| additionalInformation | String | Add additional paramter (max. 255 characters) |\r\n| sendDebugInfoToJumio | Boolean | Send debug information to Jumio. |\r\n| dataExtractionOnMobileOnly | Boolean | Limit data extraction to be done on device only |\r\n| cameraPosition | String | Which camera is used by default. Can be **FRONT** or **BACK**. |\r\n| preselectedDocumentVariant | String | Which types of document variants are available. Can be **PAPER** or **PLASTIC** |\r\n| documentTypes | String-Array | An array of accepted document types: Available document types: **PASSPORT**, **DRIVER_LICENSE**, **IDENTITY_CARD**, **VISA** |\r\n\r\n\r\nInitialization example with configuration.\r\n\r\n```javascript\r\nJumio.initNetverify(\"API_TOKEN\", \"API_SECRET\", \"US\", {\r\n requireVerification: false,\r\n customerId: \"CUSTOMERID\",\r\n preselectedCountry: \"USA\",\r\n cameraPosition: \"BACK\",\r\n documentTypes: [\"DRIVER_LICENSE\", \"PASSPORT\", \"IDENTITY_CARD\", \"VISA\"]\r\n});\r\n```\r\n\r\n***Android eMRTD scanning***\r\n\r\nIf you are using eMRTD scanning, following lines are needed in your Manifest file:\r\n\r\n```javascript\r\n-keep class net.sf.scuba.smartcards.IsoDepCardService {*;}\r\n-keep class org.jmrtd.** { *; }\r\n-keep class net.sf.scuba.** {*;}\r\n-keep class org.spongycastle.** {*;}\r\n-keep class org.ejbca.** {*;}\r\n\r\n-dontwarn java.nio.**\r\n-dontwarn org.codehaus.**\r\n-dontwarn org.ejbca.**\r\n-dontwarn org.spongycastle.**\r\n```\r\n\r\nAdd the needed dependencies following [this chapter](https://github.com/Jumio/mobile-sdk-android/blob/master/docs/integration_netverify-fastfill.md#dependencies) of the android integration guide.\r\n\r\nEnable eMRTD by using the following method in your native android code:\r\n\r\n```javascript\r\nnetverifySDK.setEnableEMRTD(true);\r\n```\r\n\r\n\r\nAs soon as the sdk is initialized, the sdk is started by the following call.\r\n\r\n```javascript\r\nJumio.startNetverify(successCallback, errorCallback);\r\n```\r\n\r\nExample\r\n\r\n```javascript\r\nJumio.startNetverify(function(documentData) {\r\n // YOUR CODE\r\n}, function(error) {\r\n // YOUR CODE\r\n});\r\n```\r\n\r\n### Document Verification\r\n\r\nTo initialize the SDK, perform the following call.\r\n\r\n```javascript\r\nJumio.initDocumentVerification(, , , {configuration});\r\n```\r\n\r\nDatacenter can either be **US** or **EU**.\r\n\r\nConfigure the SDK with the *configuration*-Object. **(configuration marked with * are mandatory)**\r\n\r\n| Configuration | Datatype | Description |\r\n| ------ | -------- | ----------- |\r\n| **type*** | String | See the list below |\r\n| **customerId*** | String | Set a customer identifier (max. 100 characters) |\r\n| **country*** | String | Set the country (ISO-3166-1 alpha-3 code) |\r\n| **merchantScanReference*** | String | Allows you to identify the scan (max. 100 characters) |\r\n| merchantReportingCriteria | String | Use this option to identify the scan in your reports (max. 100 characters) |\r\n| callbackUrl | String | Specify an URL for individual transactions |\r\n| additionalInformation | String | Add additional paramter (max. 255 characters) |\r\n| documentName | String | Override the document label on the help screen |\r\n| customDocumentCode | String | Set your custom document code (set in the merchant backend under \"Settings\" - \"Multi Documents\" - \"Custom\" |\r\n| cameraPosition | String | Which camera is used by default. Can be **FRONT** or **BACK**. |\r\n\r\nPossible types:\r\n\r\n* BS (Bank statement)\r\n* IC (Insurance card)\r\n* UB (Utility bill, front side)\r\n* CAAP (Cash advance application)\r\n* CRC (Corporate resolution certificate)\r\n* CCS (Credit card statement)\r\n* LAG (Lease agreement)\r\n* LOAP (Loan application)\r\n* MOAP (Mortgage application)\r\n* TR (Tax return)\r\n* VT (Vehicle title)\r\n* VC (Voided check)\r\n* STUC (Student card)\r\n* HCC (Health care card)\r\n* CB (Council bill)\r\n* SENC (Seniors card)\r\n* MEDC (Medicare card)\r\n* BC (Birth certificate)\r\n* WWCC (Working with children check)\r\n* SS (Superannuation statement)\r\n* TAC (Trade association card)\r\n* SEL (School enrolment letter)\r\n* PB (Phone bill)\r\n* USSS (US social security card)\r\n* SSC (Social security card)\r\n* CUSTOM (Custom document type)\r\n\r\nInitialization example with configuration.\r\n\r\n```javascript\r\nJumio.initDocumentVerification(\"API_TOKEN\", \"API_SECRET\", \"US\", {\r\n type: \"BC\",\r\n customerId: \"CUSTOMER ID\",\r\n country: \"USA\",\r\n merchantScanReference: \"YOURSCANREFERENCE\",\r\n cameraPosition: \"BACK\"\r\n});\r\n```\r\n\r\nAs soon as the SDK is initialized, the SDK is started by the following call.\r\n\r\n```javascript\r\nJumio.startDocumentVerification(successCallback, errorCallback);\r\n```\r\n\r\nExample\r\n\r\n```javascript\r\nJumio.startDocumentVerification(function(documentData) {\r\n // YOUR CODE\r\n}, function(error) {\r\n // YOUR CODE\r\n});\r\n```\r\n\r\n### BAM Checkout\r\n\r\nTo Initialize the SDK, perform the following call.\r\n\r\n```javascript\r\nJumio.initBAM(, , , {configuration});\r\n```\r\n\r\nDatacenter can either be **US** or **EU**.\r\n\r\n\r\n\r\nConfigure the SDK with the *configuration*-Object.\r\n\r\n| Configuration | Datatype | Description |\r\n| ------ | -------- | ----------- |\r\n| cardHolderNameRequired | Boolean |\r\n| sortCodeAndAccountNumberRequired | Boolean |\r\n| expiryRequired | Boolean |\r\n| cvvRequired | Boolean |\r\n| expiryEditable | Boolean |\r\n| cardHolderNameEditable | Boolean |\r\n| merchantReportingCriteria | String | Overwrite your specified reporting criteria to identify each scan attempt in your reports (max. 100 characters)\r\n| vibrationEffectEnabled | Boolean |\r\n| enableFlashOnScanStart | Boolean |\r\n| cardNumberMaskingEnabled | Boolean |\r\n| offlineToken | String | In your Jumio merchant backend on the \"Settings\" page under \"API credentials\" you can find your Offline token. In case you use your offline token, you must not set the API token and secret|\r\n| cameraPosition | String | Which camera is used by default. Can be **FRONT** or **BACK**. |\r\n| cardTypes | String-Array | An array of accepted card types. Available card types: **VISA**, **MASTER_CARD**, **AMERICAN_EXPRESS**, **CHINA_UNIONPAY**, **DINERS_CLUB**, **DISCOVER**, **JCB**, **STARBUCKS** |\r\n\r\nInitialization example with configuration.\r\n\r\n```javascript\r\nJumio.initBAM(\"API_TOKEN\", \"API_SECRET\", \"US\", {\r\n cardHolderNameRequired: false,\r\n cvvRequired: true,\r\n cameraPosition: \"BACK\",\r\n cardTypes: [\"VISA\", \"MASTER_CARD\"]\r\n});\r\n```\r\n\r\n\r\nAs soon as the sdk is initialized, the sdk is started by the following call.\r\n\r\n```javascript\r\nJumio.startBAM(successCallback, errorCallback);\r\n```\r\n\r\nExample\r\n\r\n```javascript\r\nJumio.startBAM(function(cardInformation) {\r\n // YOUR CODE\r\n}, function(error) {\r\n // YOUR CODE\r\n});\r\n```\r\n\r\n## Customization\r\n\r\n### Android\r\nThe Netverify SDK can be customized to the respective needs by following this [customization chapter](https://github.com/Jumio/mobile-sdk-android/blob/v2.11.0/docs/integration_netverify-fastfill.md#customization).\r\n\r\n### iOS\r\nThe SDK can be customized to the respective needs. You can pass the following customization options to the initializer:\r\n\r\n| Customization key | Type | Description |\r\n|:------------------|:-----|:------------|\r\n| disableBlur | BOOL | Deactivate the blur effect |\r\n| backgroundColor | STRING | Change base view's background color |\r\n| foregroundColor | STRING | Change base view's foreground color |\r\n| tintColor | STRING | Change the tint color of the navigation bar |\r\n| barTintColor | STRING | Change the bar tint color of the navigation bar |\r\n| textTitleColor | STRING | Change the text title color of the navigation bar |\r\n| documentSelectionHeaderBackgroundColor | STRING | Change the background color of the document selection header |\r\n| documentSelectionHeaderTitleColor | STRING | Change the title color of the document selection header |\r\n| documentSelectionHeaderIconColor | STRING | Change the icon color of the document selection header |\r\n| documentSelectionButtonBackgroundColor | STRING | Change the background color of the document selection button |\r\n| documentSelectionButtonTitleColor | STRING | Change the title color of the document selection button |\r\n| documentSelectionButtonIconColor | STRING | Change the icon color of the document selection button |\r\n| fallbackButtonBackgroundColor | STRING | Change the background color of the fallback button |\r\n| fallbackButtonBorderColor | STRING | Change the border color of the fallback button |\r\n| fallbackButtonTitleColor | STRING | Change the title color of the fallback button |\r\n| positiveButtonBackgroundColor | STRING | Change the background color of the positive button |\r\n| positiveButtonBorderColor | STRING | Change the border color of the positive button |\r\n| positiveButtonTitleColor | STRING | Change the title color of the positive button |\r\n| negativeButtonBackgroundColor | STRING | Change the background color of the negative button |\r\n| negativeButtonBorderColor | STRING | Change the border color of the negative button |\r\n| negativeButtonTitleColor | STRING | Change the title color of the negative button |\r\n| scanOverlayStandardColor (NV only) | STRING | Change the standard color of the scan overlay |\r\n| scanOverlayValidColor (NV only) | STRING | Change the valid color of the scan overlay |\r\n| scanOverlayInvalidColor (NV only) | STRING | Change the invalid color of the scan overlay |\r\n| scanOverlayTextColor (BAM only) | STRING | Change the text color of the scan overlay |\r\n| scanOverlayBorderColor (BAM only) | STRING | Change the border color of the scan overlay |\r\n\r\nAll colors are provided with a HEX string with the following format: #ff00ff.\r\n\r\n**Customization example**\r\n```javascript\r\nJumio.initNetverify(\"API_TOKEN\", \"API_SECRET\", \"US\", {\r\n requireVerification: false,\r\n ...\r\n}, {\r\n disableBlur: true,\r\n backgroundColor: \"#ff00ff\",\r\n barTintColor: \"#ff1298\"\r\n);\r\n```\r\n\r\n## Callback\r\n\r\nTo get information about callbacks, Netverify Retrieval API, Netverify Delete API and Global Netverify settings and more, please read our [page with server related information](https://github.com/Jumio/implementation-guides/blob/master/netverify/callback.md).\r\n\r\nThe JSONObject with all the extracted data that is returned for the specific products is described in the following subchapters:\r\n\r\n### Netverify & Fastfill\r\n\r\n*NetverifyDocumentData:*\r\n\r\n| Parameter | Type | Max. length | Description |\r\n|:-------------------|:----------- \t|:-------------|:-----------------|\r\n| selectedCountry | String| 3| [ISO 3166-1 alpha-3](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-3) country code as provided or selected |\r\n| selectedDocumentType | String | 16| PASSPORT, DRIVER_LICENSE, IDENTITY_CARD or VISA |\r\n| idNumber | String | 100 | Identification number of the document |\r\n| personalNumber | String | 14| Personal number of the document|\r\n| issuingDate | Date | | Date of issue |\r\n| expiryDate | Date | | Date of expiry |\r\n| issuingCountry | String | 3 | Country of issue as ([ISO 3166-1 alpha-3](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3)) country code |\r\n| lastName | String | 100 | Last name of the customer|\r\n| firstName | String | 100 | First name of the customer|\r\n| middleName | String | 100 | Middle name of the customer |\r\n| dob | Date | | Date of birth |\r\n| gender | String | 1| m or f |\r\n| originatingCountry | String | 3|Country of origin as ([ISO 3166-1 alpha-3](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3)) country code |\r\n| addressLine | String | 64 | Street name\t|\r\n| city | String | 64 | City |\r\n| subdivision | String | 3 | Last three characters of [ISO 3166-2:US](http://en.wikipedia.org/wiki/ISO_3166-2:US) state code\t|\r\n| postCode | String | 15 | Postal code |\r\n| mrzData | MRZ-DATA | | MRZ data, see table below |\r\n| optionalData1 | String | 50 | Optional field of MRZ line 1 |\r\n| optionalData2 | String | 50 | Optional field of MRZ line 2 |\r\n| placeOfBirth | String | 255 | Place of Birth |\r\n| extractionMethod | String | 12| MRZ, OCR, BARCODE, BARCODE_OCR or NONE |\r\n\r\n*MRZ-Data*\r\n\r\n| Parameter |Type | Max. length | Description |\r\n|:---------------|:------------- |:-------------|:-----------------|\r\n| format | String | 8| MRP, TD1, TD2, CNIS, MRVA, MRVB or UNKNOWN |\r\n| line1 | String | 50 | MRZ line 1 |\r\n| line2 | String | 50 | MRZ line 2 |\r\n| line3 | String | 50| MRZ line 3 |\r\n| idNumberValid | BOOL| | True if ID number check digit is valid, otherwise false |\r\n| dobValid | BOOL | | True if date of birth check digit is valid, otherwise false |\r\n| expiryDateValid |\tBOOL| |\tTrue if date of expiry check digit is valid or not available, otherwise false|\r\n| personalNumberValid | BOOL | | True if personal number check digit is valid or not available, otherwise false |\r\n| compositeValid | BOOL | | True if composite check digit is valid, otherwise false |\r\n\r\n### BAM Checkout\r\n\r\n*BAMCardInformation*\r\n\r\n|Parameter | Type | Max. length | Description |\r\n|:---------------------------- \t|:-------------|:-----------------|:-------------|\r\n| cardType | String | 16| VISA, MASTER_CARD, AMERICAN_EXPRESS, CHINA_UNIONPAY, DINERS_CLUB, DISCOVER, JCB or STARBUCKS |\r\n| cardNumber | String | 16 | Full credit card number |\r\n| cardNumberGrouped | String | 19 | Grouped credit card number |\r\n| cardNumberMasked | String | 19 | First 6 and last 4 digits of the grouped credit card number, other digits are masked with \"X\" |\r\n| cardExpiryMonth | String | 2 | Month card expires if enabled and readable |\r\n| CardExpiryYear | String | 2 | Year card expires if enabled and readable |\r\n| cardExpiryDate | String | 5 | Date card expires in the format MM/yy if enabled and readable |\r\n| cardCVV | String | 4 | Entered CVV if enabled |\r\n| cardHolderName | String | 100 | Name of the card holder in capital letters if enabled and readable, or as entered if editable |\r\n| cardSortCode | String | 8 | Sort code in the format xx-xx-xx or xxxxxx if enabled, available and readable |\r\n| cardAccountNumber | String | 8 | Account number if enabled, available and readable |\r\n| cardSortCodeValid | BOOL | | True if sort code valid, otherwise false |\r\n| cardAccountNumberValid | BOOL | | True if account number code valid, otherwise false |\r\n\r\n### Document Verification\r\n\r\nNo data returned.\r\n\r\n# Support\r\n\r\n## Contact\r\n\r\nIf you have any questions regarding our implementation guide please contact Jumio Customer Service at support@jumio.com or https://support.jumio.com. The Jumio online helpdesk contains a wealth of information regarding our service including demo videos, product descriptions, FAQs and other things that may help to get you started with Jumio. Check it out at: https://support.jumio.com.\r\n\r\n## Copyright\r\n\r\n© Jumio Corp. 268 Lambert Avenue, Palo Alto, CA 94306\r\n", "readmeFilename": "README.md", "repository": { "type": "git", "url": "git+https://github.com/Jumio/mobile-cordova.git" }, - "version": "2.10.0" + "version": "2.11.0" } diff --git a/demo/plugins/cordova-plugin-jumio-mobilesdk/plugin.xml b/demo/plugins/cordova-plugin-jumio-mobilesdk/plugin.xml index 1acaaaa..b648e0a 100644 --- a/demo/plugins/cordova-plugin-jumio-mobilesdk/plugin.xml +++ b/demo/plugins/cordova-plugin-jumio-mobilesdk/plugin.xml @@ -1,5 +1,5 @@ - + JumioMobileSDK @@ -23,9 +23,8 @@ - - + diff --git a/demo/plugins/cordova-plugin-jumio-mobilesdk/src/ios/JumioMobileSDK.m b/demo/plugins/cordova-plugin-jumio-mobilesdk/src/ios/JumioMobileSDK.m index 8be49bf..684d476 100644 --- a/demo/plugins/cordova-plugin-jumio-mobilesdk/src/ios/JumioMobileSDK.m +++ b/demo/plugins/cordova-plugin-jumio-mobilesdk/src/ios/JumioMobileSDK.m @@ -507,6 +507,8 @@ - (void)netverifyViewController:(NetverifyViewController *)netverifyViewControll [result setValue: @"m" forKey: @"gender"]; } else if (documentData.gender == NetverifyGenderF) { [result setValue: @"f" forKey: @"gender"]; + } else if (documentData.gender == NetverifyGenderX) { + [result setValue: @"x" forKey: @"gender"]; } [result setValue: documentData.originatingCountry forKey: @"originatingCountry"]; [result setValue: documentData.addressLine forKey: @"addressLine"]; @@ -564,14 +566,14 @@ - (void)netverifyViewController:(NetverifyViewController *)netverifyViewControll [self.viewController dismissViewControllerAnimated: YES completion: nil]; } -- (void)netverifyViewController:(NetverifyViewController *)netverifyViewController didFinishInitializingWithError:(NSError *)error { +- (void)netverifyViewController:(NetverifyViewController *)netverifyViewController didFinishInitializingWithError:(NetverifyError *)error { if (error != nil) { - [self sendError: error scanReference: nil]; + [self sendNetverifyError: error scanReference: nil]; } } -- (void)netverifyViewController:(NetverifyViewController *)netverifyViewController didCancelWithError:(NSError *)error scanReference:(NSString *)scanReference { - [self sendError: error scanReference: scanReference]; +- (void)netverifyViewController:(NetverifyViewController *)netverifyViewController didCancelWithError:(NetverifyError *)error scanReference:(NSString *)scanReference { + [self sendNetverifyError: error scanReference: scanReference]; [self.viewController dismissViewControllerAnimated: YES completion: nil]; } @@ -584,8 +586,8 @@ - (void) documentVerificationViewController:(DocumentVerificationViewController [self.viewController dismissViewControllerAnimated: YES completion: nil]; } -- (void) documentVerificationViewController:(DocumentVerificationViewController *)documentVerificationViewController didFinishWithError:(NSError *)error { - [self sendError: error scanReference: nil]; +- (void) documentVerificationViewController:(DocumentVerificationViewController *)documentVerificationViewController didFinishWithError:(DocumentVerificationError *)error { + [self sendDocumentVerificationError: error scanReference: nil]; [self.viewController dismissViewControllerAnimated: YES completion: nil]; } @@ -612,6 +614,32 @@ - (void)sendError:(NSError *)error scanReference:(NSString *)scanReference { [self.commandDelegate sendPluginResult: pluginResult callbackId: self.callbackId]; [self.viewController dismissViewControllerAnimated: YES completion: nil]; } + +- (void)sendNetverifyError:(NetverifyError *)error scanReference:(NSString *)scanReference { + NSMutableDictionary *result = [[NSMutableDictionary alloc] init]; + [result setValue: error.code forKey: @"errorCode"]; + [result setValue: error.message forKey: @"errorMessage"]; + if (scanReference) { + [result setValue: scanReference forKey: @"scanReference"]; + } + + CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsDictionary: result]; + [self.commandDelegate sendPluginResult: pluginResult callbackId: self.callbackId]; + [self.viewController dismissViewControllerAnimated: YES completion: nil]; +} + +- (void)sendDocumentVerificationError:(DocumentVerificationError *)error scanReference:(NSString *)scanReference { + NSMutableDictionary *result = [[NSMutableDictionary alloc] init]; + [result setValue: error.code forKey: @"errorCode"]; + [result setValue: error.message forKey: @"errorMessage"]; + if (scanReference) { + [result setValue: scanReference forKey: @"scanReference"]; + } + + CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsDictionary: result]; + [self.commandDelegate sendPluginResult: pluginResult callbackId: self.callbackId]; + [self.viewController dismissViewControllerAnimated: YES completion: nil]; +} - (BOOL) getBoolValue:(NSObject *)value { if (value && [value isKindOfClass: [NSNumber class]]) { diff --git a/package.json b/package.json index 1691659..d63c4a6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-plugin-jumio-mobilesdk", - "version": "2.10.0", + "version": "2.11.0", "description": "Jumio Mobile SDK Plugin for Cordova", "cordova": { "id": "cordova-plugin-jumio-mobilesdk", diff --git a/plugin.xml b/plugin.xml index 1acaaaa..b648e0a 100644 --- a/plugin.xml +++ b/plugin.xml @@ -1,5 +1,5 @@ - + JumioMobileSDK @@ -23,9 +23,8 @@ - - + diff --git a/src/android/JumioMobileSDK.java b/src/android/JumioMobileSDK.java index 2b7c6d9..a31a013 100644 --- a/src/android/JumioMobileSDK.java +++ b/src/android/JumioMobileSDK.java @@ -45,7 +45,6 @@ public class JumioMobileSDK extends CordovaPlugin { private NetverifySDK netverifySDK; private DocumentVerificationSDK documentVerificationSDK; private CallbackContext callbackContext; - private String errorMsg; @Override public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { @@ -506,9 +505,19 @@ public void onActivityResult(int requestCode, int resultCode, Intent intent) { showErrorMessage("Result could not be sent. Try again."); } } else if (resultCode == Activity.RESULT_CANCELED) { - int errorCode = intent.getIntExtra(BamSDK.EXTRA_ERROR_CODE, 0); + String errorCode = intent.getStringExtra(BamSDK.EXTRA_ERROR_CODE); String errorMsg = intent.getStringExtra(BamSDK.EXTRA_ERROR_MESSAGE); - sendErrorObject(errorCode, errorMsg, ""); + ArrayList scanReferenceList = intent.getStringArrayListExtra(BamSDK.EXTRA_SCAN_ATTEMPTS); + String scanRef = null; + if (scanReferenceList != null && scanReferenceList.size() > 0) { + scanRef = scanReferenceList.get(0); + } + sendErrorObject(errorCode, errorMsg, scanRef != null ? scanRef : ""); + } + + if (bamSDK != null) { + bamSDK.destroy(); + bamSDK = null; } // Netverify Results } else if (requestCode == NetverifySDK.REQUEST_CODE) { @@ -564,12 +573,18 @@ public void onActivityResult(int requestCode, int resultCode, Intent intent) { showErrorMessage("Result could not be sent: " + e.getLocalizedMessage()); } } else if (resultCode == Activity.RESULT_CANCELED) { - int errorCode = intent.getIntExtra(NetverifySDK.EXTRA_ERROR_CODE, 0); + String errorCode = intent.getStringExtra(NetverifySDK.EXTRA_ERROR_CODE); String errorMsg = intent.getStringExtra(NetverifySDK.EXTRA_ERROR_MESSAGE); sendErrorObject(errorCode, errorMsg, scanReference); } + + if (netverifySDK != null) { + netverifySDK.destroy(); + netverifySDK = null; + } + // Document Verification Results } else if (requestCode == DocumentVerificationSDK.REQUEST_CODE) { - String scanReference = intent.getStringExtra(NetverifySDK.EXTRA_SCAN_REFERENCE) != null ? intent.getStringExtra(NetverifySDK.EXTRA_SCAN_REFERENCE) : ""; + String scanReference = intent.getStringExtra(DocumentVerificationSDK.EXTRA_SCAN_REFERENCE) != null ? intent.getStringExtra(DocumentVerificationSDK.EXTRA_SCAN_REFERENCE) : ""; if (resultCode == Activity.RESULT_OK) { try { @@ -581,11 +596,16 @@ public void onActivityResult(int requestCode, int resultCode, Intent intent) { showErrorMessage("Result could not be sent: " + e.getLocalizedMessage()); } } else if (resultCode == Activity.RESULT_CANCELED) { - int errorCode = intent.getIntExtra(DocumentVerificationSDK.EXTRA_ERROR_CODE, 0); + String errorCode = intent.getStringExtra(DocumentVerificationSDK.EXTRA_ERROR_CODE); String errorMsg = intent.getStringExtra(DocumentVerificationSDK.EXTRA_ERROR_MESSAGE); Log.e(TAG, errorMsg); sendErrorObject(errorCode, errorMsg, scanReference); } + + if (documentVerificationSDK != null) { + documentVerificationSDK.destroy(); + documentVerificationSDK = null; + } } } @@ -610,10 +630,10 @@ private void showErrorMessage(String msg) { } } - private void sendErrorObject(int errorCode, String errorMsg, String scanReference) { + private void sendErrorObject(String errorCode, String errorMsg, String scanReference) { try { JSONObject errorResult = new JSONObject(); - errorResult.put("errorCode", String.valueOf(errorCode)); + errorResult.put("errorCode", errorMsg != null ? errorCode : ""); errorResult.put("errorMessage", errorMsg != null ? errorMsg : ""); errorResult.put("scanReference", scanReference != null ? scanReference : ""); callbackContext.error(errorResult); diff --git a/src/ios/JumioMobileSDK.m b/src/ios/JumioMobileSDK.m index 8be49bf..684d476 100644 --- a/src/ios/JumioMobileSDK.m +++ b/src/ios/JumioMobileSDK.m @@ -507,6 +507,8 @@ - (void)netverifyViewController:(NetverifyViewController *)netverifyViewControll [result setValue: @"m" forKey: @"gender"]; } else if (documentData.gender == NetverifyGenderF) { [result setValue: @"f" forKey: @"gender"]; + } else if (documentData.gender == NetverifyGenderX) { + [result setValue: @"x" forKey: @"gender"]; } [result setValue: documentData.originatingCountry forKey: @"originatingCountry"]; [result setValue: documentData.addressLine forKey: @"addressLine"]; @@ -564,14 +566,14 @@ - (void)netverifyViewController:(NetverifyViewController *)netverifyViewControll [self.viewController dismissViewControllerAnimated: YES completion: nil]; } -- (void)netverifyViewController:(NetverifyViewController *)netverifyViewController didFinishInitializingWithError:(NSError *)error { +- (void)netverifyViewController:(NetverifyViewController *)netverifyViewController didFinishInitializingWithError:(NetverifyError *)error { if (error != nil) { - [self sendError: error scanReference: nil]; + [self sendNetverifyError: error scanReference: nil]; } } -- (void)netverifyViewController:(NetverifyViewController *)netverifyViewController didCancelWithError:(NSError *)error scanReference:(NSString *)scanReference { - [self sendError: error scanReference: scanReference]; +- (void)netverifyViewController:(NetverifyViewController *)netverifyViewController didCancelWithError:(NetverifyError *)error scanReference:(NSString *)scanReference { + [self sendNetverifyError: error scanReference: scanReference]; [self.viewController dismissViewControllerAnimated: YES completion: nil]; } @@ -584,8 +586,8 @@ - (void) documentVerificationViewController:(DocumentVerificationViewController [self.viewController dismissViewControllerAnimated: YES completion: nil]; } -- (void) documentVerificationViewController:(DocumentVerificationViewController *)documentVerificationViewController didFinishWithError:(NSError *)error { - [self sendError: error scanReference: nil]; +- (void) documentVerificationViewController:(DocumentVerificationViewController *)documentVerificationViewController didFinishWithError:(DocumentVerificationError *)error { + [self sendDocumentVerificationError: error scanReference: nil]; [self.viewController dismissViewControllerAnimated: YES completion: nil]; } @@ -612,6 +614,32 @@ - (void)sendError:(NSError *)error scanReference:(NSString *)scanReference { [self.commandDelegate sendPluginResult: pluginResult callbackId: self.callbackId]; [self.viewController dismissViewControllerAnimated: YES completion: nil]; } + +- (void)sendNetverifyError:(NetverifyError *)error scanReference:(NSString *)scanReference { + NSMutableDictionary *result = [[NSMutableDictionary alloc] init]; + [result setValue: error.code forKey: @"errorCode"]; + [result setValue: error.message forKey: @"errorMessage"]; + if (scanReference) { + [result setValue: scanReference forKey: @"scanReference"]; + } + + CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsDictionary: result]; + [self.commandDelegate sendPluginResult: pluginResult callbackId: self.callbackId]; + [self.viewController dismissViewControllerAnimated: YES completion: nil]; +} + +- (void)sendDocumentVerificationError:(DocumentVerificationError *)error scanReference:(NSString *)scanReference { + NSMutableDictionary *result = [[NSMutableDictionary alloc] init]; + [result setValue: error.code forKey: @"errorCode"]; + [result setValue: error.message forKey: @"errorMessage"]; + if (scanReference) { + [result setValue: scanReference forKey: @"scanReference"]; + } + + CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsDictionary: result]; + [self.commandDelegate sendPluginResult: pluginResult callbackId: self.callbackId]; + [self.viewController dismissViewControllerAnimated: YES completion: nil]; +} - (BOOL) getBoolValue:(NSObject *)value { if (value && [value isKindOfClass: [NSNumber class]]) {