import { RequestPaymentFailImpl as RequestPaymentFailImplement } from './unierror.uts' export type RequestPaymentFailImpl = RequestPaymentFailImplement export type UniPaymentProvider = Uni export interface Uni { /** * @description 请求支付 * @param {RequestPaymentOptions} options * @example * ```typescript * uni.requestPayment({ * provider: "alipay", * orderInfo: "", * success: function (res) { * console.log("支付成功"+JSON.stringify(res)) * } * }); * ``` * @tutorial https://uniapp.dcloud.net.cn/api/plugins/payment.html * @uniPlatform { * "app": { * "android": { * "osVer": "5.0", * "uniVer": "√", * "unixVer": "4.02" * }, * "ios": { * "osVer": "9.0", * "uniVer": "√", * "unixVer": "x" * } * }, * "web": { * "uniVer": "x", * "unixVer": "x" * } * } */ requestPayment(options : RequestPaymentOptions) : void; } /** * 错误码 * - 700710 正在处理中,支付结果未知(有可能已经支付成功),请查询商家订单列表中订单的支付状态 * - 700711 订单支付失败。 * - 700712 重复请求。 * - 700713 用户中途取消。 * - 700714 网络连接出错。 * - 700715 支付结果未知(有可能已经支付成功),请查询商家订单列表中订单的支付状态。 * - 700716 其它支付错误。 */ export type RequestPaymentErrorCode = 700710 | 700711 | 700712 | 700713 | 700714 | 700715 | 700716; export type RequestPayment = (options : RequestPaymentOptions) => void; export type RequestPaymentSuccess = { data : object | null }; export type RequestPaymentSuccessCallback = (result : RequestPaymentSuccess) => void; export type RequestPaymentFail = IRequestPaymentFail; export type RequestPaymentFailCallback = (result : RequestPaymentFail) => void; export type RequestPaymentComplete = any export interface IRequestPaymentFail extends IUniError { errCode : RequestPaymentErrorCode }; export type RequestPaymentCompleteCallback = (result : RequestPaymentComplete) => void; export type RequestPaymentOptions = { /** * 支付服务提供商,通过 [uni.getProvider](https://doc.dcloud.net.cn/uni-app-x/api/get-provider.html) 获取,目前支持支付宝支付(alipay),微信支付(wxpay) */ provider : string, /** * 订单数据 */ orderInfo : string, /** * 接口调用成功的回调函数 */ success : RequestPaymentSuccessCallback | null, /** * 接口调用失败的回调函数 */ fail : RequestPaymentFailCallback | null, /** * 接口调用结束的回调函数(调用成功、失败都会执行) */ complete ?: RequestPaymentCompleteCallback | null };