1.0.0 • Published 1 year ago

@fad-delivery/delivery-ng-fad-acuant v1.0.0

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

Getting started

Installation

npm install @fad-producto/ng-fad-acuant

Update

npm install @fad-producto/ng-fad-acuant@latest

Assets

Add into the assets array (angular.json) the next lines:

{
  "glob": "**/*",
  "input": "node_modules/@fad-producto/ng-fad-acuant/assets",
  "output": "./assets/"
}

Example:

"architect": {
  "build": {
    "options": {
      "assets": [
        "src/favicon.ico",
        "src/assets",
        {
          "glob": "**/*",
          "input": "node_modules/@fad-producto/ng-fad-acuant/assets",
          "output": "./assets/"
        }
      ],
    }
  }
}

Import

In the file necessary example.module.ts import the module.

In this case app.module.ts

import { NgFadAcuantModule } from '@fad-producto/ng-fad-acuant';
.
.
.
... imports: [
       ...,
       BrowserAnimationsModule 
       NgFadAcuantModule
    ]...

Note: BrowserAnimationsModule is required.

Usage

HTML

Add the selector inside some component and configure the output events:

<ng-fad-acuant
  [credentials]="credentials"
  [configuration]= "configuration"
  [side]=0
  [idData]=false
  [idPhoto]=false
  [forcePhoto]= false
  [imageQuality]= 1
  [documentInstance]="documentInstance"
  (onerror)="onerror($event)"
  (oncomplete)="oncomplete($event)">
</ng-fad-acuant>

Typescript

Listen to the events:

import { IAcuantConfiguration, AcuantCredentials, ResponseError, AcuantResult, ErrorCode, CONFIGURATION_DEFAULT } from '@fad-producto/ng-fad-acuant';

const CREDENTIALS : AcuantCredentials  = {
  passiveUsername: 'XXXXXXXXXXXXXXXXXXXXXXXXX',
  passivePassword: 'XXXXXXXXXXXXXXXXXXXXXXXXX',
  passiveSubscriptionId: 'XXXXXXXXXXXXXXXXXXXXXXXXX',
  acasEndpoint: 'XXXXXXXXXXXXXXXXXXXXXXXXX',
  livenessEndpoint: 'XXXXXXXXXXXXXXXXXXXXXXXXX',
  assureidEndpoint: 'XXXXXXXXXXXXXXXXXXXXXXXXX'
};



public configuration: IAcuantConfiguration = {
  customization: {
    moduleCustomization: {
      legends: {
        scan: {
          none: 'ENFOCA TU ID SOBRE LA GUÍA',
          smallDocument: 'ACERCATE MÁS',
          goodDocument: null,
          capturing: 'CAPTURANDO',
          tapToCapture: 'TOCA LA PANTALLA PARA CAPTURAR'
        },
        manualCapture: {
          instruction: 'Captura el frente de tu identificación',
          buttonNext: 'Continuar'
        }
      },
    },
  },
}
  
.
.
.

oncomplete(result: AcuantResult) {
  console.log(result)
}

onerror(error: ResponseError) {
   console.error(error);
    // if (error.code === ErrorCode.REQUIRED_CREDENTIALS) // do something
}

Inputs

NameTypeRequiredDefaultDescription
credentialsAcuantCredentialstruenullCredentials required for acuant to work
configurationIAcuantConfigurationfalseFAD_CUSTOMIZATION, MODULE_CUSTOMIZATION, CONFIGURATION_DEFAULTCustomizable properties like colors and legends
sidenumber (0 or 1)false0Side of image to capture 0 - Front 1 - Back
idDatabooleanfalsefalseadd OCR and OCR validation to the final response
idPhotobooleanfalsefalseImage of the face cutout, only works if idData is true
imageQualitynumber (0.1 to 1)false1Quality of the image result
forcePhotobooleanfalsefalseReturns the ID photo if the OCR is not required or if could not obtain the ID face crop
documentInstancestringfalsenullIs used to relate the front and back of the ID

Outputs

NameReturnDescription
oncompleteAcuantResultFires when the liveness ends successfully
onerrorResponseErrorIs called when an error happens