Git Product home page Git Product logo

cordova-plugin-thai-id-card-ftr301's Introduction

cordova-plugin-thai-id-card-ftr301

This plugin is for reading and decoding data from Thai national id card (now for iOS only). It utilizes a smart card reader library from https://github.com/FeitianSmartcardReader/R301.

Tested devices

Installation

cordova plugin add https://github.com/rathapolk/cordova-plugin-thai-id-card-ftr301.git

Usage

Get plugin object

const idReader = window['ThaiIdCardCordovaPlugin'];

List readers

idReader.listReaders(function (readers) {
  // readers = [ 'reader name' ];
}, function (error) {
  console.error(error);
});

Read data

const options = {
  readerName: null, // if not specify, use first reader found.
  readCitizenId: true, // default true
  readPersonal: true, // default true
  readAddress: true, // default true
  readIssuedExpired: true, // default true
  readPhoto: true // default false
};

idReader.readData(options, function (data) {
  const citizenId = data['citizenId'];
  const titleTh = data['titleTh'];
  const firstNameTh = data['firstNameTh'];
  const middleNameTh = data['middleNameTh'];
  const lastNameTh = data['lastNameTh'];
  const titleEn = data['titleEn'];
  const firstNameEn = data['firstNameEn'];
  const middleNameEn = data['middleNameEn'];
  const lastNameEn = data['lastNameEn'];
  const birthDate = data['birthDate']; // format: 'yyyy-MM-dd'
  const sex = data['sex']; // '1' male, '2' female
  const issued = data['issued']; // format: 'yyyy-MM-dd'
  const expired = data['expired']; // format: 'yyyy-MM-dd'
  const addressLine = data['addressLine'];
  const houseNo = data['houseNo'];
  const village = data['village'];
  const lane = data['lane'];
  const road = data['road'];
  const subdistrict = data['subdistrict'];
  const district = data['district'];
  const province = data['province'];
  const photoBase64 = data['photoBase64'];
  ...
}, function (error) {
  console.error(error);
});

cordova-plugin-thai-id-card-ftr301's People

Contributors

rathapolk avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.