51 lines
2.2 KiB
TypeScript
51 lines
2.2 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 { AlipaySdk } from 'alipay-sdk';
|
|
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 ApProduct } from '../../../oak-app-domain/ApProduct/Schema';
|
|
import AliPayDebug from './AliPay.debug';
|
|
export default class AliPay extends AliPayDebug implements PayClazz {
|
|
alipaySdk: AlipaySdk;
|
|
refundGapDays: number;
|
|
mchId: string;
|
|
appId: string;
|
|
publicKeyPath: string;
|
|
privateKeyPath: string;
|
|
payNotifyUrl: string;
|
|
refundNotifyUrl?: string;
|
|
mode: "publicKey" | "certificate";
|
|
keyType: "PKCS1" | "PKCS8";
|
|
gateway: string;
|
|
alipayRootCertPath: string;
|
|
alipayPublicCertPath: string;
|
|
appCertPath: string;
|
|
encryptKey: string;
|
|
needEncrypt: boolean;
|
|
static MAX_REFUND_DAYS_GAP: number;
|
|
static MIN_REFUND_DAYS_GAP: number;
|
|
static DEFAULT_REFUND_DAYS_GAP: number;
|
|
constructor(apProduct: ApProduct);
|
|
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;
|
|
}
|