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

export const requestPayment : RequestPayment = function (options : RequestPaymentOptions) {
	const provider = UTSiOS.getExtApiProvider<UniPaymentProvider>("payment", options.provider)
	if(provider != null){
		provider!.requestPayment(options) 
	} else {
DCloud-yyl's avatar
DCloud-yyl 已提交
10
		const err = new RequestPaymentFailImpl(700716);
DCloud-yyl's avatar
DCloud-yyl 已提交
11 12 13 14
		options.fail?.(err) 
		options.complete?.(err)
	}
};