cordova-plugin-meed-socure
v0.0.1
Published
This is the Native Cordova plugin for Socure Document Scan
Downloads
4
Maintainers
Readme
cordova-plugin-meed-socure
This is the Native Socure Document Scan iOS, & Android Cordova Plugin for MeedBankingClub App.
Supported Platform:
- [ ] iOS.
- [X] Android.
Changelog:
Testing Release.
Installation:
ionic cordova plugin add cordova-plugin-meed-socure
npm install @meed-native/socure
Permission Required:
// Android
<uses-permission android:name="android.permission.CAMERA"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>
Getting Start:
// app.module.ts
import { Socure } from '@meed-native/socure/ngx';
@NgModule({
...
providers: [
...
Socure
...
]
...
})
export class AppModule { }
🔐 Check Permissions
To check user permissions from user device. We can use
checkPermissions(permissions: Permissions)
method from plugins.
import { Component } from '@angular/core';
import { Socure, Permissions, PermissionStatus } from '@meed-native/socure/ngx';
@Component({
...
})
export class HomePage {
constructor(
private socure: Socure
) {}
checkPermissions() {
const permissions: Permissions[] = [Permissions.Camera, Permissions.Location]
this.socure.checkPermissions(permissions)
.then((status: PermissionStatus) => {
console.log(status);
})
.catch((error: any) => {
console.log(error)
});
}
}
📷 Scan License
To Scan user License Document from user device. We can use
scanLicense()
method from plugins.
import { Component } from '@angular/core';
import { Socure, LicenseScanResult } from '@meed-native/socure/ngx';
@Component({
...
})
export class HomePage {
constructor(
private socure: Socure
) {}
scanLicense() {
this.socure.scanLicense()
.then((result: LicenseScanResult) => {
console.log(result);
})
.catch((error: any) => {
console.log(error)
});
}
}
📷 Scan Passport
To Scan user Passport Document from user device. We can use
scanPassport()
method from plugins.
import { Component } from '@angular/core';
import { Socure, PassportScanResult } from '@meed-native/socure/ngx';
@Component({
...
})
export class HomePage {
constructor(
private socure: Socure
) {}
scanPassport() {
this.socure.scanPassport()
.then((result: LicenseScanResult) => {
console.log(result);
})
.catch((error: any) => {
console.log(error)
});
}
}
📷 Scan Selfie
To Scan user Selfie from user device. We can use
scanSelfie()
method from plugins.
import { Component } from '@angular/core';
import { Socure, SelfieScanResult } from '@meed-native/socure/ngx';
@Component({
...
})
export class HomePage {
constructor(
private socure: Socure
) {}
scanSelfie() {
this.socure.scanSelfie()
.then((result: SelfieScanResult) => {
console.log(result);
})
.catch((error: any) => {
console.log(error)
});
}
}
🔧 Open Setting
For manually allow Camera & Location Permission for go to setting menu. We can use
openSetting()
method from plugins.
import { Component } from '@angular/core';
import { Socure } from '@meed-native/socure/ngx';
@Component({
...
})
export class HomePage {
constructor(
private socure: Socure
) {}
openSetting() {
this.socure.openSetting()
.then((result: boolean) => {
console.log(result);
})
.catch((error: any) => {
console.log(error)
});
}
}
API
Enums
enum Permissions {
Camera = "camera",
Location = "location",
}
enum PermissionStatus {
Granted = 100,
DeniedOnce = 200,
DeniedAlways = 300,
}
Interfaces:
interface LicenseScanResult {
licenseFrontImage: string;
licenseBackImage: string;
}
interface PassportScanResult {
passportImage: string;
}
interface SelfieScanResult {
selfieImage: string;
}
Actions:
checkPermissions(permissions: string[]): Promise<PermissionStatus>;
scanLicense(): Promise<LicenseScanResult>;
scanPassport(): Promise<PassportScanResult>;
scanSelfie(): Promise<SelfieScanResult>;
openSetting(): Promise<boolean>;