import { RequestPaymentFailImpl as RequestPaymentFailImplement } from './unierror.uts' export type RequestPaymentFailImpl = RequestPaymentFailImplement export interface UniPaymentProvider extends 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": "4.18" * } * }, * "web": { * "uniVer": "x", * "unixVer": "x" * } * } */ requestPayment(options : RequestPaymentOptions) : void; } /** * 错误码 * - 700600 正在处理中,支付结果未知(有可能已经支付成功),请查询商家订单列表中订单的支付状态 * - 701100 订单支付失败。 * - 701110 重复请求。 * - 700601 用户中途取消。 * - 700602 网络连接出错。 * - 700603 支付结果未知(有可能已经支付成功),请查询商家订单列表中订单的支付状态。 * - 700000 其它支付错误。 * - 700604 微信没有安装。 * - 700800 没有配置对应的URL Scheme。 * - 700801 没有配置对应的universal Link。 */ export type RequestPaymentErrorCode = 700600 | 701100 | 701110 | 700601 | 700602 | 700603 | 700000 | 700604 | 700800 | 700801; 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 };