card-io / card.io-Cordova-Plugin

card.io Cordova Plugin
Other
174 stars 146 forks source link

Ionic 2 card.io cordova plugin doesn't work #68

Open n2lose opened 7 years ago

n2lose commented 7 years ago

General information

IONIC INFO global packages: @ionic/cli-utils : 1.4.0 Cordova CLI : 7.0.1 Ionic CLI : 3.4.0 local packages: @ionic/app-scripts : 1.3.7 @ionic/cli-plugin-cordova : 1.4.0 @ionic/cli-plugin-ionic-angular : 1.3.1 Cordova Platforms : android 6.2.3 Ionic Framework : ionic-angular 3.2.1 System: Node : v6.10.3 OS : Windows 10 Xcode : not installed ios-deploy : not installed ios-sim : not installed npm : 3.10.10

Cordova Plugin Version: @ionic-native/card-io@3.12.1 Platform: Android Device OS Version and Device: Nexus 6P, Android version 6.0.1

Issue description

Hi, I followed all the instruction steps, installed the cordova plugin card.io as described in https://github.com/card-io/card.io-Cordova-Plugin.

Here is my code handle camera scan :

model = {
    cardType: '',
    cardNumber: '',
    cardholderName: '',
    expiryMonth: '',
    expiryYear: '',
    expireDate: ''
  }

  carNumber: string = '';
  expireDate: string = '';

  setCardData(data: any) {
    this.model.cardType = data.cardType;
    this.model.cardholderName = data.cardholderName;
    this.model.cardNumber = data.cardNumber;
    this.model.expiryMonth = data.expiryMonth;
    this.model.expiryYear = data.expiryYear;
    this.model.expireDate = data.expiryMonth +"/"+ data.expiryYear;
  }

  scanButton() {

    this.cardIO.canScan()
      .then(
        (res: boolean) => {
          if(res){
            let options = {
              requireExpiry: true,
              requireCardholderName: true,
              scanExpiry: true
            };
            return this.cardIO.scan(options);
          }
        }
      )
      .then(res => {
        console.log(res);
        this.setCardData(res);
      }, err => {
        alert(err);
      });
  }

I have tested on Samsung S7, but it doens't work. I click button scanButton, the camera started to scan the credit card, then nothing happens or any data response. Could someone take a look and help me please?

Regards, Lam

nickcom commented 7 years ago

if you got the camera to even respond that is more than I was able to achieve with iOS. I've spent hours trying to get it to work and I've come to the conclusion that maybe this doesn't work with the current versions of phonegap. If someone can prove me wrong I'll be very happy!

n2lose commented 7 years ago

I have re-test it with some variety cards, almost cards from banks in Vietnam don't have any response. But i tested with some cards in UK and AU, it works fine.

davorpeic commented 7 years ago

+1 I thought I was using old version, updated all and when I call scan I see black screen and the app just crashes (ios)

edit: I found the issue with my crash, you need to add permission message in *.plist as mentioned in CardIO readme.. yeah, I know.. :)

<key>NSCameraUsageDescription</key>
<string>To scan credit cards.</string>

Tested with latest Ionic 3.6.0 dp

carmo-evan commented 6 years ago

+1. Camera opens, but no matter what credit card I use, the scan method never fires a response.

uzbekjon commented 6 years ago

This seems like a very old issue (over a year). I am having the same problem. Everything seems to work (camera opens with card.io UI), except that the .scan() does not return anything. The card finder rectangle is all green for several seconds and nothing.

@evan1024 have you resolved this issue?

PS. Tested using IonicDev app (iOS & Android) and on physical Android devise (Samsung A5). Forgot the iPhone cable. Will test on physical iOS devise tonight.

uzbekjon commented 6 years ago

After some digging I noticed that Card.io is using OpenCV library and it hit me that the source of the problem might be in a badly trained computer vision model. I guess the model has either been overfitted or not trained on diverse enough card images which lead to recognizing only popular US bank cards (which it was trained on).

Anyhow, tried the same not working app from before on American Express card, worked like a charm. Returned the card details as expected.