You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
yanzong/vendor/alipaysdk/easysdk/tea/payment/app/main.tea

43 lines
1.1 KiB

5 months ago
import EasySDKKernel;
type @kernel = EasySDKKernel
init(kernel: EasySDKKernel) {
@kernel = kernel;
}
model AlipayTradeAppPayResponse {
body: string(name='body', description='订单信息字符串形式')
}
function pay(subject: string, outTradeNo: string, totalAmount: string): AlipayTradeAppPayResponse {
var systemParams: map[string]string = {
method = 'alipay.trade.app.pay',
app_id = @kernel.getConfig("appId"),
timestamp = @kernel.getTimestamp(),
format = 'json',
version = '1.0',
alipay_sdk = @kernel.getSdkVersion(),
charset = 'UTF-8',
sign_type = @kernel.getConfig("signType"),
app_cert_sn = @kernel.getMerchantCertSN(),
alipay_root_cert_sn = @kernel.getAlipayRootCertSN()
};
var bizParams: map[string]any = {
subject = subject,
out_trade_no = outTradeNo,
total_amount = totalAmount
};
var textParams: map[string]string = {
};
var sign = @kernel.sign(systemParams, bizParams, textParams, @kernel.getConfig('merchantPrivateKey'));
var response: map[string]string = {
body = @kernel.generateOrderString(systemParams, bizParams, textParams, sign)
};
return response;
}