index.uts 644 字节
Newer Older
DCloud-yyl's avatar
DCloud-yyl 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14
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 {
		let err = new RequestPaymentFailImpl(700000);
		options.fail?.(err)
		options.complete?.(err)
	}
};