@paydock/client-sdk
Version:
Paydock client sdk
156 lines • 6.06 kB
TypeScript
/**
* List of available event's name in the Click To Pay checkout lifecycle
* @enum EVENT
*
* @type {object}
* @param {string} IFRAME_LOADED=iframeLoaded Initial event sent when IFrame is initially loaded.
* @param {string} CHECKOUT_READY=checkoutReady Event sent when checkout is loaded and ready to be used by customer. Leverage alongside [showCheckout](#SRC+showCheckout) and [hideCheckout](#SRC+hideCheckout).
* @param {string} CHECKOUT_POPUP_OPEN=checkoutPopupOpen Event sent when Click To Pay checkout flow is started, regardless of embedded or windowed mode.
* @param {string} CHECKOUT_POPUP_CLOSE=checkoutPopupClose Event sent when Click To Pay checkout flow is closed, regardless of embedded or windowed mode.
* @param {string} CHECKOUT_COMPLETED=checkoutCompleted Event sent on successful checkout by customer. Check [data](#EventDataCheckoutCompletedData) for more information.
* @param {string} CHECKOUT_ERROR=checkoutError Event sent on error checkout by customer. Check [data](#EventData) for more information.
*/
export declare enum EVENT {
IFRAME_LOADED = "iframeLoaded",
CHECKOUT_READY = "checkoutReady",
CHECKOUT_COMPLETED = "checkoutCompleted",
CHECKOUT_ERROR = "checkoutError",
CHECKOUT_POPUP_OPEN = "checkoutPopupOpen",
CHECKOUT_POPUP_CLOSE = "checkoutPopupClose"
}
export interface EventData {
type: EVENT_DATA_TYPE;
data?: string | EventDataCheckoutCompletedData | EventDataRecognitionTokenRequested;
}
/**
* List of available event data types
* @enum EVENT_DATA_TYPE
*
* @type {object}
* @param {string} CRITICAL_ERROR=CriticalError in this error scenario the checkout is understood to be in a non-recoverable state and should be closed by the merchant and give alternate payment options to the user
* @param {string} USER_ERROR=UserError in this error scenario the error in likely a user input error and the checkout is in a recoverable state, so the user will be kept within the checkout and can retry the flow
* @param {string} SUCCESS=Success
*/
export declare enum EVENT_DATA_TYPE {
CRITICAL_ERROR = "CriticalError",
USER_ERROR = "UserError",
SUCCESS = "Success"
}
interface EventDataRecognitionTokenRequested {
data: {
recognitionToken: string;
};
}
interface EventDataCheckoutCompletedData {
type: 'src' | 'manual';
token: string;
token_type: 'card' | 'card_scheme_token';
checkoutData?: {
card_number_bin?: string;
card_number_last4?: string;
card_scheme?: 'visa' | 'mastercard' | 'amex' | 'diners' | 'discover';
card_type?: 'credit' | 'debit' | 'prepaid' | 'combo' | 'flex';
address_line1?: string;
address_line2?: string;
address_line3?: string;
address_city?: string;
address_postcode?: string;
address_state?: string;
address_country?: string;
shipping?: {
address_line1?: string;
address_line2?: string;
address_line3?: string;
address_city?: string;
address_postcode?: string;
address_state?: string;
address_country?: string;
};
};
}
interface IBaseSRCMeta {
customizations?: IStyles;
dpa_data?: {
dpa_presentation_name?: string;
dpa_uri?: string;
};
dpa_transaction_options?: {
dpa_locale?: string;
dpa_accepted_billing_countries?: string[];
consumer_name_requested?: boolean;
consumer_email_address_requested?: boolean;
consumer_phone_number_requested?: boolean;
transaction_amount?: {
transaction_amount?: number;
transaction_currency_code?: string;
};
merchant_order_id?: string;
merchant_category_code?: string;
merchant_country_code?: string;
};
}
interface PhoneNumber {
country_code: string;
phone_number: string;
}
interface Customer {
email?: string;
phone?: {
country_code?: string;
phone?: string;
};
first_name?: string;
last_name?: string;
}
export interface IClickToPayMeta extends IBaseSRCMeta {
dpa_data?: IBaseSRCMeta['dpa_data'] & {
dpa_address?: string;
dpa_email_address?: string;
dpa_phone_number?: PhoneNumber;
dpa_logo_uri?: string;
dpa_supported_email_address?: string;
dpa_supported_phone_number?: PhoneNumber;
dpa_uri?: string;
dpa_support_uri?: string;
application_type?: 'WEB_BROWSER' | 'MOBILE_APP';
};
disable_summary_screen?: boolean;
co_brand_names?: string[];
checkout_experience?: 'WITHIN_CHECKOUT' | 'PAYMENT_SETTINGS';
services?: 'INLINE_CHECKOUT' | 'INLINE_INSTALLMENTS';
dpa_transaction_options?: IBaseSRCMeta['dpa_transaction_options'] & {
dpa_billing_preference?: MASTERCARD_DPA_SHIPPING_BILLING_PREFERENCE;
payment_options?: Array<{
dynamic_data_type?: string;
}>;
order_type?: MASTERCARD_ORDER_TYPE;
three_ds_preference?: string;
confirm_payment?: boolean;
};
customer?: Customer;
unaccepted_card_type?: 'CREDIT' | 'DEBIT';
recognition_token?: string;
}
export type MASTERCARD_DPA_SHIPPING_BILLING_PREFERENCE = 'FULL' | 'POSTAL_COUNTRY' | 'NONE';
export type DPA_DYNAMIC_DATA_TYPE = 'TAVV' | 'DTVV';
export type REVIEW_ACTION = 'pay' | 'continue';
export type TRANSACTION_TYPE = 'PURCHASE' | 'BILL_PAYMENT' | 'MONEY_TRANSFER';
export type MASTERCARD_ORDER_TYPE = 'SPLIT_SHIPMENT' | 'PREFERRED_CARD';
export interface IStyles {
primary_button_color?: string;
secondary_button_color?: string;
primary_button_text_color?: string;
secondary_button_text_color?: string;
font_family?: string;
enable_src_popup?: boolean;
}
export declare const STYLE: {
PRIMARY_BUTTON_COLOR: string;
SECONDARY_BUTTON_COLOR: string;
PRIMARY_BUTTON_TEXT_COLOR: string;
SECONDARY_BUTTON_TEXT_COLOR: string;
FONT_FAMILY: string;
ENABLE_SRC_POPUP: string;
};
export {};
//# sourceMappingURL=interfaces.d.ts.map