31 lines
1.6 KiB
TypeScript
31 lines
1.6 KiB
TypeScript
import { EntityDict } from '../oak-app-domain';
|
|
import { BRC } from '../types/RuntimeCxt';
|
|
type IState = EntityDict['pay']['OpSchema']['iState'];
|
|
type RefundIState = EntityDict['refund']['OpSchema']['iState'];
|
|
export default interface PayClazz {
|
|
getAccountEntity(): [string, string];
|
|
getAccountAmount(context: BRC): Promise<number>;
|
|
calcTransferTax(price: number): [number, string, string];
|
|
calcPayTax(price: number): [number, string, string];
|
|
calcRefundTax(price: number): [number, string, string];
|
|
prepay(pay: EntityDict['pay']['Schema'], data: EntityDict['pay']['Update']['data'], context: BRC): Promise<void>;
|
|
getState(pay: EntityDict['pay']['OpSchema']): Promise<[IState, EntityDict['pay']['Update']['data']]>;
|
|
close(pay: EntityDict['pay']['OpSchema']): Promise<void>;
|
|
decodePayNotification(params: Record<string, any>, body: any): Promise<{
|
|
payId: string;
|
|
iState: IState;
|
|
extra?: EntityDict['pay']['Update']['data'];
|
|
price?: number;
|
|
}>;
|
|
decodeRefundNotification(params: Record<string, any>, body: any): Promise<{
|
|
refundId: string;
|
|
iState: RefundIState;
|
|
extra?: EntityDict['refund']['Update']['data'];
|
|
price?: number;
|
|
}>;
|
|
refund(refund: EntityDict['refund']['Schema'], context: BRC): Promise<EntityDict['refund']['Update']['data'] | undefined>;
|
|
getRefundableAt(successAt: number): number;
|
|
getRefundState(refund: EntityDict['refund']['OpSchema']): Promise<[EntityDict['refund']['OpSchema']['iState'], EntityDict['refund']['Update']['data'] | undefined]>;
|
|
}
|
|
export {};
|