@paydock/client-sdk
Version:
Paydock client sdk
181 lines (180 loc) • 6.01 kB
TypeScript
import { PaymentSourceWidget } from "./payment-source-widget";
import { Container } from "../components/container";
import { IFrame } from "../components/iframe";
import { IEventData, IFrameEvent } from "../components/iframe-event";
export interface IEventSelectData extends IEventData {
customer_id: string;
payment_source_id: string;
gateway_id: string;
primary: boolean;
card_number_last4?: string;
card_scheme?: string;
checkout_email?: string;
gateway_type?: string;
payment_source_type: string;
account_name?: string;
account_number?: string;
}
export interface IEventPaginationData extends IEventData {
total_item: number;
skip: number;
limit: number;
}
export interface IEventAfterLoadData extends IEventData {
total_item: number;
skip: number;
limit: number;
}
export interface IEventSizeData extends IEventData {
height: number;
width: number;
}
export interface IEventFinishData extends IEventData {
}
/**
* Interface of data from event.
*
* @interface IEventSelectData
*
* @param {string} event
* @param {string} purpose
* @param {string} message_source
* @param {string} [ref_id]
* @param {string} customer_id
* @param {string} payment_source_id
* @param {string} gateway_id
* @param {boolean} primary
* @param {string} [widget_id]
* @param {string} [card_number_last4]
* @param {string} [card_scheme]
* @param {string} gateway_type
* @param {string} [checkout_email]
* @param {string} payment_source_type
* @param {string} [account_name]
* @param {string} [account_number]
* */
/**
* Interface of data from event.
*
* @interface IEventPaginationData
*
* @param {string} event
* @param {string} purpose
* @param {string} message_source
* @param {string} [ref_id]
* @param {number} total_item
* @param {number} skip
* @param {number} limit
* */
/**
* Interface of data from event.
*
* @interface IEventAfterLoadData
*
* @param {string} event The name of the event.
* @param {string} purpose A system variable that states the purpose of the event.
* @param {string} message_source A system variable that identifies the event source.
* @param {string} [ref_id] Custom unique value that identifies result of processed operation.
* @param {number} total_item Pagination param. Total item count
* @param {number} skip Pagination param. Skip items from first item
* @param {number} limit Pagination param. Query limit
* */
/**
* Interface of data from event.
* @interface IEventFinishData
*
* @param {string} event The name of the event.
* @param {string} purpose A system variable that states the purpose of the event.
* @param {string} message_source A system variable that identifies the event source.
* @param {string} [ref_id] Custom unique value that identifies result of processed operation.
* */
/**
* Interface of data from event.
* @interface IEventSizeData
*
* @param {number} event The name of the event.
* @param {number} purpose A system variable that states the purpose of the event.
* @param {string} message_source A system variable that identifies the event source.
* @param {string} [ref_id] Custom unique value that identifies result of processed operation.
* @param {number} height Height of iFrame
* @param {number} width Width of iFrame
* */
/**
* List of available event's name
*
* @const EVENT
*
* @type {object}
* @param {string} AFTER_LOAD=afterLoad
* @param {string} SYSTEM_ERROR=systemError
* @param {string} SELECT=select
* @param {string} UNSELECT=unselect
* @param {string} NEXT=next
* @param {string} PREV=prev
* @param {string} META_CHANGE=metaChange
* @param {string} RESIZE=resize
*/
/**
* Class HtmlPaymentSourceWidget include method for working on html
* @constructor
* @extends PaymentSourceWidget
*
* @param {string} selector - Selector of html element. Container for widget
* @param {string} publicKey - PayDock users public key
* @param {string} queryToken - PayDock's query token that represents params to search customer by id or reference
* @example
* * var widget = new HtmlPaymentSourceWidget('#widget', 'publicKey','queryToken');
*/
declare class HtmlPaymentSourceWidget extends PaymentSourceWidget {
protected container: Container;
protected iFrame: IFrame;
protected event: IFrameEvent;
/** @constructs */ constructor(selector: string, publicKey: string, queryToken: string);
/**
* The final method to beginning, the load process of widget to html
*
*/
load(): void;
/**
* This callback will be called for each event in payment source widget
*
* @callback listener--PaymentSourceWidget
* @param {IEventData | IEventSelectData | IEventPaginationData | IEventAfterLoadData} response
*/
/**
* Listen to events of widget
*
* @example
*
* widget.on('select', function (data) {
* console.log(data);
* });
* @param {string} eventName - Available event names [EVENT]{@link EVENT}
* @param {listener--PaymentSourceWidget} cb
*/
on(eventName: string, cb: (data: IEventData | IEventSelectData | IEventPaginationData | IEventAfterLoadData | IEventSizeData) => void): void;
/**
* Using this method you can hide widget after load
* @param {boolean} [saveSize=false] - using this param you can save iframe's size
*/
hide(saveSize: boolean): void;
/**
* Using this method you can show widget after using hide method
*
*/
show(): void;
/**
* Using this method you can reload widget
*
*/
reload(): void;
/**
* After select event of widget, data (dataType) will be insert to input (selector)
*
* @param {string} selector - css selector . [] #
* @param {string} dataType - data type of [IEventSelectData]{@link IEventSelectData}.
*/
onSelectInsert(selector: string, dataType: string): void;
}
export { HtmlPaymentSourceWidget };
//# sourceMappingURL=html-payment-source-widget.d.ts.map