90 lines
2.0 KiB
TypeScript
Raw Normal View History

2016-07-08 00:43:33 +02:00
import { Cordova, Plugin } from './plugin';
2016-06-09 10:17:08 -04:00
2016-06-09 10:17:08 -04:00
/**
* @name CardIO
* @description
* @usage
* ```
* import { CardIO } from 'ionic-native';
2016-06-09 10:17:08 -04:00
*
*
* CardIO.canScan()
* .then(
* (res: boolean) => {
* if(res){
* let options = {
* requireExpiry: true,
* requireCCV: false,
* requirePostalCode: false
* };
* CardIO.scan(options);
* }
* }
* );
* ```
*/
@Plugin({
pluginName: 'CardIO',
2016-07-08 00:43:33 +02: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 10:17:08 -04:00
})
export class CardIO {
2016-07-08 00:43:33 +02:00
/**
* Check whether card scanning is currently available. (May vary by
* device, OS version, network connectivity, etc.)
*
* @returns {Promise<boolean>}
2016-07-08 00:43:33 +02:00
*/
@Cordova()
static canScan(): Promise<boolean> { return; }
2016-06-09 10:17:08 -04:00
2016-07-08 00:43:33 +02:00
/**
* Scan a credit card with card.io.
2016-07-17 19:44:19 +02:00
* @param {CardIOOptions} options Options for configuring the plugin
* @returns {Promise<any>}
2016-07-08 00:43:33 +02:00
*/
@Cordova()
2016-12-01 18:45:02 -05:00
static scan(options?: CardIOOptions): Promise<CardIOResponse> { return; }
2016-06-09 10:17:08 -04:00
2016-07-08 00:43:33 +02:00
/**
* Retrieve the version of the card.io library. Useful when contacting support.
* @returns {Promise<string>}
2016-07-08 00:43:33 +02:00
*/
@Cordova()
static version(): Promise<string> { return; }
2016-06-09 10:17:08 -04:00
}
export interface CardIOOptions {
2016-07-08 00:43:33 +02:00
requireExpiry?: boolean;
2016-12-01 18:37:00 -05:00
requireCVV?: boolean;
2016-07-08 00:43:33 +02:00
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;
}
2016-12-01 18:45:02 -05:00
export interface CardIOResponse {
cardType: string;
redactedCardNumber: string;
cardNumber: string;
expiryMonth: number;
expiryYear: number;
cvv: string;
postalCode: string;
cardholderName: string;
}