interface.uts 2.3 KB
Newer Older
DCloud-yyl's avatar
DCloud-yyl 已提交
1
export type GetProviderSuccess = {
DCloud-yyl's avatar
DCloud-yyl 已提交
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
	/**
	 * 服务类型
	 * - payment: 支付
	 * @type 'payment'
	 */
	service : 'payment',
	/**
	 * 得到的服务供应商
	 * @type PlusShareShareService['id'][] | PlusPushClientInfo['id'][] | PlusOauthAuthService['id'][] | PlusPaymentPaymentChannel['id'][]
	 */
	provider : string[],
	/**
	 * 得到的服务供应商服务对象
     * @uniPlatform {
     *  "app": {
     *    "android": {
     *      "osVer": "5.0",
     *      "uniVer": "√",
     *      "unixVer": "4.18"
     *    },
     *    "ios": {
     *      "osVer": "9.0",
     *      "uniVer": "√",
     *      "unixVer": "4.18"
     *    }
     *  },
     *  "web": {
     *    "uniVer": "x",
     *    "unixVer": "x"
     *  }
     * }
	 */
	providers : UniProvider[],
	/**
	 * 错误信息
	 */
	errMsg : string   
DCloud-yyl's avatar
DCloud-yyl 已提交
39
};
DCloud-yyl's avatar
DCloud-yyl 已提交
40
export type GetProviderSuccessCallback = (result : GetProviderSuccess) => void;
DCloud-yyl's avatar
DCloud-yyl 已提交
41
export type GetProviderFail = UniError;
DCloud-yyl's avatar
DCloud-yyl 已提交
42
export type GetProviderFailCallback = (result : GetProviderFail) => void;
DCloud-yyl's avatar
DCloud-yyl 已提交
43
export type GetProviderComplete = any;
DCloud-yyl's avatar
DCloud-yyl 已提交
44
export type GetProviderCompleteCallback = (result : GetProviderComplete) => void;
DCloud-yyl's avatar
DCloud-yyl 已提交
45
export type GetProviderOptions = {
DCloud-yyl's avatar
DCloud-yyl 已提交
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
	/**
	 * 服务类型,可取值“payment”
	 * - payment: 支付 (Alipay、Wxpay)
	 * @type 'payment'
	 */
	service : 'payment',
	/**
	 * 接口调用成功的回调
	 */
	success ?: GetProviderSuccessCallback | null,
	/**
	 * 接口调用失败的回调函数
	 */
	fail ?: GetProviderFailCallback | null,
	/**
	 * 接口调用结束的回调函数(调用成功、失败都会执行)
	 */
	complete ?: GetProviderCompleteCallback | null
DCloud-yyl's avatar
DCloud-yyl 已提交
64 65
};

DCloud-yyl's avatar
DCloud-yyl 已提交
66
export type GetProvider = (options : GetProviderOptions) => void;
DCloud-yyl's avatar
DCloud-yyl 已提交
67 68

export interface Uni {
DCloud-yyl's avatar
DCloud-yyl 已提交
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
	/**
	 * 获取服务供应商
	 * @param {GetProviderOptions} options
	 * @return {void}
	 * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/get-provider.html
	 * @uniPlatform {
	 *  "app": {
	 *    "android": {
	 *      "osVer": "5.0",
	 *      "uniVer": "√",
	 *      "unixVer": "4.11"
	 *    },
	 *    "ios": {
	 *      "osVer": "9.0",
	 *      "uniVer": "√",
	 *      "unixVer": "4.18"
	 *    }
	 *  },
	 *  "web": {
	 *    "uniVer": "x",
	 *    "unixVer": "x"
	 *  }
	 * }
	 * @example
	  ```typescript
		uni.getProvider({service: ''})
	  ```
	 */
	getProvider(options : GetProviderOptions) : void;
DCloud-yyl's avatar
DCloud-yyl 已提交
98
}