///
import * as crypto from 'crypto';
import { PayStatic } from '../base';
export declare class Sign {
/**
* 随机字符串
* 随机字符串,不长于32位。推荐随机数生成算法
* example: 5K8264ILTKCH16CQ2502SI8ZNMTM67VS
*/
nonce_str?: string;
/**
* 签名
* 签名,详见签名生成算法
* example: C380BEC2BFD727A4B6845133519F3AD6
*/
sign: string;
/**
* 签名类型
* 签名类型,目前支持HMAC-SHA256和MD5,默认为MD5
* example: HMAC-SHA256
*/
sign_type?: string;
}
export declare class Request {
/**
* 公众账号ID
* 微信分配的公众账号ID(企业号corpid即为此appId)
* example: wx8888888888888888
*/
appid?: string;
}
export declare class ResponseBase {
/**
* 返回状态码
* SUCCESS/FAIL
* 此字段是接口通信情况标识,非交易成功与否的标识
* example: SUCCESS
*/
return_code: string;
/**
* 返回信息
* 当return_code为FAIL时返回信息为错误原因 ,例如
* 签名失败
* 参数格式校验错误
* example: OK
*/
return_msg: string;
}
export declare class SuccessResponse extends ResponseBase {
/**
* 业务结果
* SUCCESS/FAIL
* example: SUCCESS
*/
result_code?: string;
/**
* 业务结果描述
* 对业务结果的补充说明
* example: OK
*/
result_msg?: string;
/**
* 错误代码
* 详细参见错误列表
* example: SYSTEMERROR
*/
err_code?: string;
/**
* 错误代码描述
* 错误返回的信息描述
* example: 系统错误
*/
err_code_des?: string;
/**
* 随机字符串
* 微信返回的随机字符串
* example: 5K8264ILTKCH16CQ2502SI8ZNMTM67VS
*/
nonce_str: string;
/**
* 签名
* 微信返回的签名,详见签名生成算法
* example: C380BEC2BFD727A4B6845133519F3AD6
*/
sign: string;
}
export declare class Response extends SuccessResponse {
/**
* 公众账号ID
* 调用接口提交的公众账号ID
* example: wx8888888888888888
*/
appid: string;
/**
* 商户号
* 调用接口提交的商户号
* example: 1900000109
*/
mch_id: string;
}
export declare class MchResponse extends SuccessResponse {
/**
* 商户appid
* 申请商户号的appid或商户号绑定的appid(企业号corpid即为此appId)
* example: wx8888888888888888
*/
mch_appid: string;
/**
* 商户号
* 微信支付分配的商户号
* example: 1900000109
*/
mchid: string;
}
export declare const Path: {
getSignKey: string;
unifiedOrder: string;
orderQuery: string;
closeOrder: string;
refund: string;
refundQuery: string;
downloadBill: string;
report: string;
shortUrl: string;
microPay: string;
reverse: string;
authCodeToOpenid: string;
batchQueryComment: string;
downloadFundflow: string;
transfers: string;
getTransferInfo: string;
};
export declare class WxPaySignOption {
mch_id: string;
appid: string;
key: string;
}
export declare class WxPayBase extends WxPaySignOption {
pfxPath?: string;
pfx?: any;
payNotifyUrl: string;
}
declare type SignOptions = {
key?: string;
encrypt?: string;
};
export declare class WxPayStatic extends PayStatic {
static success: string;
static host: string;
static sandboxHost: string;
static sandboxFee: number;
static buildXml(data: any, root?: boolean): string;
static parseXml(xml: string, root?: boolean): Promise;
static request(opt: {
data: any;
host?: string;
path: string;
method?: string;
agent?: {
pfx: string;
passphrase: string;
};
notThrowErr?: boolean;
originalResult?: boolean;
}): Promise;
static errorHandler(rs: Response): void;
static getsignkey(data: {
mch_id: string;
}, opt: SignOptions): Promise;
static createSign(signObj: any, opt?: SignOptions): any;
static stringify(signObj: any, key: any): string;
static getSignObj(data: any, opt: WxPaySignOption & {
mch?: boolean;
}): Promise;
static encrypt(str: string, type: string, key?: string): any;
static signVerify(str: string, sign: string, type: string, key?: string): boolean;
static decrypt(key: any, crypted: any, iv?: string, to?: crypto.HexBase64BinaryEncoding): string;
}
export declare const TradeType: {
JsApi: string;
Native: string;
App: string;
H5: string;
};
export declare const SignType: {
MD5: string;
HMAC_SHA256: string;
};
export declare const BillType: {
所有: string;
成功: string;
退款: string;
充值退款: string;
};
export declare const CheckName: {
不校验: string;
强校验: string;
};
export {};