72 lines
2.1 KiB
TypeScript
72 lines
2.1 KiB
TypeScript
import type AMSCheckout from '../../core/instance';
|
|
import type { IcreatePaymentParams, eventPayload } from '../../types';
|
|
export default class CheckoutApp {
|
|
app: any;
|
|
paymentMethodsResult: any;
|
|
appDomain: string;
|
|
AMSSDK: AMSCheckout;
|
|
private _render;
|
|
private _selector;
|
|
private _version;
|
|
constructor();
|
|
/**
|
|
* @description When SDK registers plug-ins, it is a required function to receive SDK instances
|
|
*/
|
|
applyPlugin(AMSSDK: AMSCheckout): void;
|
|
/**
|
|
* @description Set the rendering capability of the cashier plug-in. Different technology stacks have some differences in the packaging and use of rendering functions
|
|
*/
|
|
setRender(createIframeNode: any): void;
|
|
/**
|
|
* @description High order function of rendering capability
|
|
*/
|
|
render(renderParams: IcreatePaymentParams): Promise<void>;
|
|
/**
|
|
* @description Cancel listening and destroy the dom
|
|
*/
|
|
logoutPlugin(): void;
|
|
/**
|
|
* @description Create app
|
|
*/
|
|
private _createApp;
|
|
private _getIframeUrl;
|
|
/**
|
|
* @description Create iframe
|
|
*/
|
|
private _createIframe;
|
|
/**
|
|
* @description Get iftame id
|
|
*/
|
|
private _getIframeId;
|
|
_listener(e: any): void;
|
|
/**
|
|
* @description Initialize subscription iframe message
|
|
*/
|
|
_addEventListener(): void;
|
|
_removeEventListener(): void;
|
|
/**
|
|
* @description Processing messages from iframe
|
|
*/
|
|
_handleAppMessage(data: eventPayload): void;
|
|
/**
|
|
* @description Send message to SDK
|
|
*/
|
|
_dispatchToSDK(data: eventPayload): void;
|
|
/**
|
|
* @description Send message to iframe
|
|
*/
|
|
_dispatchToApp(data: eventPayload): void;
|
|
/**
|
|
* @description Subscribe to messages from SDK
|
|
*/
|
|
_subscribeFromSDK(): void;
|
|
/**
|
|
* @description Send rendering events to iframe
|
|
*/
|
|
_renderPaymentMethods(paymentResult: any): void;
|
|
/**
|
|
* @description Send the post submission processing event, and the cashier applies the consumption result
|
|
*/
|
|
_handleRequestPayment(data: eventPayload): void;
|
|
}
|