2016-07-08 06:43:33 +08:00
|
|
|
import { Cordova, Plugin } from './plugin';
|
2016-06-09 22:17:08 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @name CardIO
|
|
|
|
* @description
|
|
|
|
* @usage
|
|
|
|
* ```
|
|
|
|
* import {CardIO} from 'ionic-native';
|
|
|
|
*
|
|
|
|
* ...
|
|
|
|
*
|
|
|
|
* CardIO.canScan()
|
|
|
|
* .then(
|
|
|
|
* (res: boolean) => {
|
|
|
|
* if(res){
|
|
|
|
* let options = {
|
|
|
|
* requireExpiry: true,
|
|
|
|
* requireCCV: false,
|
|
|
|
* requirePostalCode: false
|
|
|
|
* };
|
|
|
|
* CardIO.scan(options);
|
|
|
|
* }
|
|
|
|
* }
|
|
|
|
* );
|
|
|
|
* ```
|
|
|
|
*/
|
|
|
|
@Plugin({
|
2016-07-08 06:43:33 +08:00
|
|
|
plugin: 'https://github.com/card-io/card.io-Cordova-Plugin',
|
|
|
|
pluginRef: 'CardIO',
|
|
|
|
repo: 'https://github.com/card-io/card.io-Cordova-Plugin',
|
|
|
|
platforms: ['iOS', 'Android']
|
2016-06-09 22:17:08 +08:00
|
|
|
})
|
|
|
|
export class CardIO {
|
2016-07-08 06:43:33 +08:00
|
|
|
/**
|
|
|
|
* Check whether card scanning is currently available. (May vary by
|
|
|
|
* device, OS version, network connectivity, etc.)
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
@Cordova()
|
|
|
|
static canScan(): Promise<boolean> { return; }
|
2016-06-09 22:17:08 +08:00
|
|
|
|
2016-07-08 06:43:33 +08:00
|
|
|
/**
|
|
|
|
* Scan a credit card with card.io.
|
2016-07-18 01:44:19 +08:00
|
|
|
* @param {CardIOOptions} options Options for configuring the plugin
|
2016-07-08 06:43:33 +08:00
|
|
|
*/
|
|
|
|
@Cordova()
|
|
|
|
static scan(options?: CardIOOptions): Promise<any> { return; }
|
2016-06-09 22:17:08 +08:00
|
|
|
|
2016-07-08 06:43:33 +08:00
|
|
|
/**
|
|
|
|
* Retrieve the version of the card.io library. Useful when contacting support.
|
|
|
|
*/
|
|
|
|
@Cordova()
|
|
|
|
static version(): Promise<string> { return; }
|
2016-06-09 22:17:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface CardIOOptions {
|
2016-07-08 06:43:33 +08:00
|
|
|
requireExpiry?: boolean;
|
|
|
|
requireCCV?: boolean;
|
|
|
|
requirePostalCode?: boolean;
|
|
|
|
supressManual?: boolean;
|
|
|
|
restrictPostalCodeToNumericOnly?: boolean;
|
|
|
|
keepApplicationTheme?: boolean;
|
|
|
|
requireCardholderName?: boolean;
|
|
|
|
scanInstructions?: string;
|
|
|
|
noCamera?: boolean;
|
|
|
|
scanExpiry?: boolean;
|
|
|
|
languageOrLocale?: string;
|
|
|
|
guideColor?: string;
|
|
|
|
supressConfirmation?: boolean;
|
|
|
|
hideCardIOLogo?: boolean;
|
|
|
|
useCardIOLogo?: boolean;
|
|
|
|
supressScan?: boolean;
|
|
|
|
}
|