unierror.uts 1.6 KB
Newer Older
DCloud-yyl's avatar
DCloud-yyl 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14
import { RequestPaymentErrorCode, IRequestPaymentFail,errorCode } from "./interface.uts"

/**
 * 错误主题
 */
export const RequestPaymentUniErrorSubject = 'uni-requestPayment';
/**
 * 错误码
 * @UniError
 */
const RequestPaymentUniErrors : Map<RequestPaymentErrorCode, string> = new Map([
	/**
	 * 正在处理中,支付结果未知(有可能已经支付成功),请查询商家订单列表中订单的支付状态。
	 */
DCloud-yyl's avatar
DCloud-yyl 已提交
15
	[700710, 'The payment result is unknown (it may have been successfully paid). Please check the payment status of the order in the merchant order list.'],
DCloud-yyl's avatar
DCloud-yyl 已提交
16 17 18
	/**
	 * 订单支付失败。
	 */
DCloud-yyl's avatar
DCloud-yyl 已提交
19
	[700711, 'Order payment failure.'],
DCloud-yyl's avatar
DCloud-yyl 已提交
20 21 22
	/**
	 * 重复请求。
	 */
DCloud-yyl's avatar
DCloud-yyl 已提交
23
	[700712, 'Repeat the request.'],
DCloud-yyl's avatar
DCloud-yyl 已提交
24 25 26
	/**
	 * 用户中途取消。
	 */
DCloud-yyl's avatar
DCloud-yyl 已提交
27
	[700713, 'The user canceled midway.'],
DCloud-yyl's avatar
DCloud-yyl 已提交
28 29 30
	/**
	 * 网络连接出错。
	 */
DCloud-yyl's avatar
DCloud-yyl 已提交
31
	[700714, 'Network connection error.'],
DCloud-yyl's avatar
DCloud-yyl 已提交
32 33 34
	/**
	 * 支付结果未知(有可能已经支付成功),请查询商家订单列表中订单的支付状态。
	 */
DCloud-yyl's avatar
DCloud-yyl 已提交
35
	[700715, 'Payment result unknown (may have been successfully paid), please check the payment status of the order in the merchant order list.'],
DCloud-yyl's avatar
DCloud-yyl 已提交
36 37 38 39
	
	/**
	 * 其它支付错误。
	 */
DCloud-yyl's avatar
DCloud-yyl 已提交
40
	[700716, 'Other payment errors.'],
DCloud-yyl's avatar
DCloud-yyl 已提交
41 42 43
	/**
	 * 微信没有安装
	 */
DCloud-yyl's avatar
DCloud-yyl 已提交
44
	[700717, 'Wechat is not installed.']
DCloud-yyl's avatar
DCloud-yyl 已提交
45 46 47 48 49 50 51 52 53 54 55 56 57
	
]);

export class RequestPaymentFailImpl extends UniError implements IRequestPaymentFail {
	constructor(errCode : RequestPaymentErrorCode) {
		super();
		this.errSubject = RequestPaymentUniErrorSubject;
		this.errCode = errCode;
		this.errMsg = RequestPaymentUniErrors[errCode] ?? "";
	}
}