oak-pay-business/es/utils/payClazz/Offline.d.ts

32 lines
1.7 KiB
TypeScript

import { OpSchema as RefundOpSchema, UpdateOperationData } from "../../oak-app-domain/Refund/Schema";
import { OpSchema as PayOpSchema, UpdateOperationData as PayUpdateData } from "../../oak-app-domain/Pay/Schema";
import PayClazz from "../../types/PayClazz";
import { BRC } from "../../types/RuntimeCxt";
import { EntityDict } from "../../oak-app-domain";
export default class Offline implements PayClazz {
offlineAccount: EntityDict['offlineAccount']['OpSchema'];
constructor(offlineAccount: EntityDict['offlineAccount']['OpSchema']);
getAccountEntity(): [string, string];
getAccountAmount(context: BRC): Promise<number>;
calcTransferTax(price: number): [number, string, string];
calcRefundTax(price: number): [number, string, string];
calcPayTax(price: number): [number, string, string];
getRefundableAt(successTime: number): number;
refund(refund: RefundOpSchema): Promise<UpdateOperationData | undefined>;
getRefundState(refund: RefundOpSchema): Promise<[PayOpSchema['iState'], PayUpdateData | undefined]>;
decodePayNotification(params: Record<string, any>, body: any): Promise<{
payId: string;
iState: EntityDict['pay']['OpSchema']['iState'];
extra?: PayUpdateData | undefined;
}>;
decodeRefundNotification(params: Record<string, any>, body: any): Promise<{
refundId: string;
iState: EntityDict['refund']['OpSchema']['iState'];
extra?: EntityDict['refund']['Update']['data'] | undefined;
price?: number | undefined;
}>;
prepay(pay: PayOpSchema, data: PayUpdateData, context: BRC): Promise<void>;
getState(pay: PayOpSchema): Promise<[string, PayUpdateData]>;
close(pay: PayOpSchema): Promise<void>;
}