43 lines
2.0 KiB
TypeScript
43 lines
2.0 KiB
TypeScript
import { OpSchema as OpPay, Schema as Pay, UpdateOperationData as PayUpdateData } from "../../../oak-app-domain/Pay/Schema";
|
|
import PayClazz from "../../../types/PayClazz";
|
|
import { BRC } from "../../../types/RuntimeCxt";
|
|
import { WechatPay as WechatPaySDK } from 'wechat-pay-nodejs';
|
|
import { EntityDict } from "../../../oak-app-domain";
|
|
import { OpSchema as OpRefund, UpdateOperationData as RefundUpdateData, Schema as Refund } from "../../../oak-app-domain/Refund/Schema";
|
|
import { Schema as WpProduct } from '../../../oak-app-domain/WpProduct/Schema';
|
|
import WechatPayDebug from './WechatPay.debug';
|
|
export default class WechatPay extends WechatPayDebug implements PayClazz {
|
|
wechatPay: WechatPaySDK;
|
|
refundGapDays: number;
|
|
mchId: string;
|
|
publicKeyFilePath: string;
|
|
privateKeyFilePath: string;
|
|
apiV3Key: string;
|
|
payNotifyUrl: string;
|
|
refundNotifyUrl: string;
|
|
static MAX_REFUND_DAYS_GAP: number;
|
|
static MIN_REFUND_DAYS_GAP: number;
|
|
static DEFAULT_REFUND_DAYS_GAP: number;
|
|
constructor(wpProduct: WpProduct, appId: string);
|
|
refund(refund: Refund, context: BRC): Promise<RefundUpdateData | undefined>;
|
|
getRefundState(refund: OpRefund): Promise<[EntityDict['refund']['OpSchema']['iState'], RefundUpdateData | undefined]>;
|
|
private analyzeResult;
|
|
private caclRefundDeadline;
|
|
prepay(pay: Pay, data: PayUpdateData, context: BRC): Promise<void>;
|
|
getState(pay: OpPay): Promise<[EntityDict['pay']['OpSchema']['iState'], PayUpdateData]>;
|
|
close(pay: OpPay): Promise<void>;
|
|
decodePayNotification(params: Record<string, any>, body: any): Promise<{
|
|
payId: string;
|
|
iState: EntityDict['pay']['OpSchema']['iState'];
|
|
extra?: PayUpdateData;
|
|
}>;
|
|
decodeRefundNotification(params: Record<string, any>, body: any): Promise<{
|
|
refundId: string;
|
|
iState: EntityDict['refund']['OpSchema']['iState'];
|
|
extra?: RefundUpdateData | undefined;
|
|
price?: number | undefined;
|
|
}>;
|
|
getRefundableAt(successAt: number): number;
|
|
uploadShipInfo(pay: Pay): void;
|
|
}
|