43 lines
1.8 KiB
TypeScript
43 lines
1.8 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]; // [转账的税费, 渠道账户对象,渠道账户对象id]
|
||
|
||
calcPayTax(price: number): [number, string, string]; // [支付的税费, 渠道账户对象,渠道账户对象id];
|
||
|
||
calcRefundTax(price: number): [number, string, string]; // [退款的税费(可能是负,如果渠道退款不计手续费的话), 渠道账户对象,账户对象id];
|
||
|
||
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(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]>;
|
||
} |