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.
46 lines
1.3 KiB
46 lines
1.3 KiB
5 months ago
|
import EasySDKKernel;
|
||
|
|
||
|
type @kernel = EasySDKKernel
|
||
|
|
||
|
init(kernel: EasySDKKernel) {
|
||
|
@kernel = kernel;
|
||
|
}
|
||
|
|
||
|
model AlipayTradeWapPayResponse {
|
||
|
body: string(name='body', description='订单信息,Form表单形式')
|
||
|
}
|
||
|
|
||
|
function pay(subject: string, outTradeNo: string, totalAmount: string, quitUrl: string, returnUrl: string): AlipayTradeWapPayResponse {
|
||
|
var systemParams: map[string]string = {
|
||
|
method = 'alipay.trade.wap.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,
|
||
|
quit_url = quitUrl,
|
||
|
product_code = 'QUICK_WAP_WAY'
|
||
|
};
|
||
|
|
||
|
var textParams: map[string]string = {
|
||
|
return_url = returnUrl
|
||
|
};
|
||
|
|
||
|
var sign = @kernel.sign(systemParams, bizParams, textParams, @kernel.getConfig('merchantPrivateKey'));
|
||
|
|
||
|
var response: map[string]string = {
|
||
|
body = @kernel.generatePage('POST', systemParams, bizParams, textParams, sign)
|
||
|
};
|
||
|
return response;
|
||
|
}
|