BlinkID / blinkid-cordova

ID scanning for cross-platform apps built with Cordova and Phonegap.
48 stars 34 forks source link

Cant run plugin #117

Closed hitmacreed closed 4 years ago

hitmacreed commented 4 years ago

When i try to run this code it crahs and say this

ERROR TypeError: this.blinkId.BlinkCardOverlaySettings is not a constructor

import { BlinkId, RecognizerResultState } from '@ionic-native/blinkid/ngx';
constructor(private blinkId: BlinkId) {}

scan(){

const overlaySettings = new this.blinkId.BlinkCardOverlaySettings();
const recognizer = new this.blinkId.BlinkCardRecognizer();
recognizer.returnFullDocumentImage = false;
recognizer.detectGlare = true;
recognizer.extractCvv = true;
recognizer.extractValidThru = true;
recognizer.extractOwner = true;

const recognizerCollection =  new this.blinkId.RecognizerCollection([recognizer]);
const canceled = this.blinkId.scanWithCamera(
  overlaySettings,
  recognizerCollection,
  {
    ios: 'my key', //iOS License Key
    android: my key' //Android License Key
  },
);

  if (!canceled) {
    if (recognizer.result.resultState === RecognizerResultState.valid) {
      const results = recognizer.result;

      if (results.resultState === RecognizerResultState.valid) {
        const ccInfo = {
          cardNumber: Number(results.cardNumber),
          expirationMonth: Number(results.validThru.month),
          expirationYear: Number(results.validThru.year),
          cvv: Number(results.cvv)
        };
        console.log("TCL: scan -> ccInfo", ccInfo)
      }
    }
    }
}
culoi commented 4 years ago

Hi @hitmacreed

Since version 5.0, release only includes Document and BlinkIdOverlay and following reconizers:

In our new sample project, index.js is set on this way: https://github.com/BlinkID/blinkid-phonegap/blob/master/www/js/index.js

We are now distributing full version with all recognizer and overlays included trough our dashboard: https://microblink.com/login

Simply log in and verify your email and we will enable you full SDK version.

You can always reach us directly to support@microblink.com

Best regards