mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-03-26 07:01:14 +08:00
87 lines
1.9 KiB
TypeScript
87 lines
1.9 KiB
TypeScript
import { Cordova, Plugin } from './plugin';
|
|
|
|
|
|
/**
|
|
* @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({
|
|
pluginName: 'CardIO',
|
|
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']
|
|
})
|
|
export class CardIO {
|
|
/**
|
|
* Check whether card scanning is currently available. (May vary by
|
|
* device, OS version, network connectivity, etc.)
|
|
*
|
|
*/
|
|
@Cordova()
|
|
static canScan(): Promise<boolean> { return; }
|
|
|
|
/**
|
|
* Scan a credit card with card.io.
|
|
* @param {CardIOOptions} options Options for configuring the plugin
|
|
*/
|
|
@Cordova()
|
|
static scan(options?: CardIOOptions): Promise<CardIOResponse> { return; }
|
|
|
|
/**
|
|
* Retrieve the version of the card.io library. Useful when contacting support.
|
|
*/
|
|
@Cordova()
|
|
static version(): Promise<string> { return; }
|
|
|
|
}
|
|
|
|
export interface CardIOOptions {
|
|
requireExpiry?: boolean;
|
|
requireCVV?: 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;
|
|
}
|
|
|
|
export interface CardIOResponse {
|
|
cardType: string;
|
|
redactedCardNumber: string;
|
|
cardNumber: string;
|
|
expiryMonth: number;
|
|
expiryYear: number;
|
|
cvv: string;
|
|
postalCode: string;
|
|
cardholderName: string;
|
|
}
|