UNPKG

web-cardscan

Version:

This library provides payment card scanning and verification functionality for your web app.

126 lines (122 loc) 5.89 kB
// Generated by dts-bundle v0.7.3 declare module 'web-cardscan' { import { BouncerConfig } from "web-cardscan/config"; /** * Determine if the scan is supported by this device. */ export function isSupported(): boolean; /** * Start the card scanner. */ export function scanCard(apiKey: string, onScanComplete: (number: string, cardholderName: string, expiryMonth: string, expiryYear: string, verificationResults: string | null) => void, onScanCanceled: () => void, onScanError: (error: any) => boolean, onCannotScan?: () => void | null, requiredIin?: string | null, requiredLastFour?: string | null): void; export function cancelScan(): void; export function getConfig(): BouncerConfig; export function warmUp(): Promise<void>; export function setUpScan(): void; } declare module 'web-cardscan/config' { /** * General configuration for the scan. */ export class BouncerConfig { static isDebug: boolean; /** * Set to `true` to enable debug information. */ setDebug(isDebug: boolean): void; static apiKey: string | null; setApiKey(apiKey: string): void; static modelDownloadAttempts: number; setModelDownloadAttempts(attempts: number): void; static imageQualityOcr: number; static imageQualityFull: number; static imageQualityCenter: number; setImageQuality(ocr?: number, full?: number, center?: number): void; static imageSizeOcrWebpKb: number; static imageSizeOcrJpgKb: number; static imageSizeOcrPngKb: number; setImageSizeEstimates(webpKb?: number, jpgKb?: number, pngKb?: number): void; static useSandbox: boolean; setUseSandbox(useSandbox: boolean): void; static cardDetectDecayTimeMs: number; /** * Keep sending images for this long after a card is detected. */ setCardDetectDecay(decayMs: number): void; static maxErrorCorrectionTimeMs: number; /** * The maximum amount of time to run error correction for. */ setMaxErrorCorrectionTime(errorCorrectionTimeMs: number): void; static wrongCardDurationMs: number; /** * The amount of time to spend in the wrong card state. */ setWrongCardDuration(wrongCardDurationMs: number): void; static troubleScanningTimeoutMs: number; /** * The amount of time after a card has been seen to show the trouble scanning state. */ setTroubleScanningTimeout(troubleScanningTimeoutMs: number): void; static minimumMatchingPanCount: number; /** * Error correction minimum matching values */ setMinimumMatchingValues(pan?: number): void; static desiredMatchingPanCount: number; static desiredMatchingExpiryCount: number; static desiredMatchingCardholderNameCount: number; /** * Error correction desired matching values */ setDesiredMatchingValues(pan?: number, expiry?: number, cardholderName?: number): void; static maxSavedFrames: number; static maxVerificationResultsPerType: number; static maxVerificationResultsTotal: number; setMemoryUsage(maxSavedFrames?: number, maxVerificationResultsPerType?: number, maxVerificationResultsTotal?: number): void; static runVerifyPipeline: boolean; /** * If set to true, bouncer will run the verify pipeline once the scan has completed. */ setRunVerifyPipeline(runVerifyPipeline: boolean): void; static downloadUploadNetworkSpeedRatio: number; /** * Expected ratio of network download speed / network upload speed */ setDownloadUploadNetworkSpeedRatio(ratio: number): void; static networkQueueMaxSize: number; static networkQueueMinSize: number; /** * The amount of images to allow over the network in parallel. */ setNetworkQueueLimits(min?: number, max?: number): void; static instructionsLoadingString: string; static instructionsScanString: string; static instructionsReadingString: string; static instructionsCapturingImages: string; static instructionsProcessingString: string; static instructionsWrongCardString: string; static instructionsTroubleScanningString: string; static securityNotificationString: string; static networkErrorString: string; static cardDetailsString: string; static cannotScanString: string; localize(configuration: BouncerLocalizationConfiguration): void; static readonly appPackageName = "com.getbouncer.web"; static readonly version = "0.1.52"; static readonly scanStatsPayloadVersion = 2; } export type BouncerLocalizationConfiguration = { instructionsLoading: string | null; instructionsScan: string | null; instructionsReading: string | null; instructionsCapturing: string | null; instructionsProcessing: string | null; instructionsWrongCard: string | null; instructionsTroubleScanning: string | null; securityNotification: string | null; networkError: string | null; cardDetails: string | null; cannotScan: string | null; }; }