index.uts 644 字节
Newer Older
DCloud-yyl's avatar
DCloud-yyl 已提交
1 2 3 4 5 6 7 8 9
import { UniPaymentProvider, RequestPaymentOptions, RequestPayment, RequestPaymentSuccessCallback } from "../interface.uts";
import { RequestPaymentFailImpl } from '../unierror.uts'

export const requestPayment : RequestPayment = function (options : RequestPaymentOptions) {
	//获取provider实例,hx自动生成,其中UniPaymentProvider为在interface中定义的接口
	const provider = UTSAndroid.getExtApiProvider<UniPaymentProvider>("payment", options.provider)
	if (provider != null) {
		provider.requestPayment(options)
	} else {
DCloud-yyl's avatar
DCloud-yyl 已提交
10
		let err = new RequestPaymentFailImpl(700716);
DCloud-yyl's avatar
DCloud-yyl 已提交
11 12 13 14
		options.fail?.(err)
		options.complete?.(err)
	}
};