123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317 |
- import EasySDKKernel;
- type @kernel = EasySDKKernel
- init(kernel: EasySDKKernel) {
- @kernel = kernel;
- }
- model AlipayPassTemplateAddResponse {
- httpBody: string(name='http_body', description='响应原始字符串'),
- code: string(name='code'),
- msg: string(name='msg'),
- subCode: string(name='sub_code'),
- subMsg: string(name='sub_msg'),
- success: boolean(name='success'),
- result: string(name='result')
- }
- model AlipayPassTemplateUpdateResponse {
- httpBody: string(name='http_body', description='响应原始字符串'),
- code: string(name='code'),
- msg: string(name='msg'),
- subCode: string(name='sub_code'),
- subMsg: string(name='sub_msg'),
- success: boolean(name='success'),
- result: string(name='result')
- }
- model AlipayPassInstanceAddResponse {
- httpBody: string(name='http_body', description='响应原始字符串'),
- code: string(name='code'),
- msg: string(name='msg'),
- subCode: string(name='sub_code'),
- subMsg: string(name='sub_msg'),
- success: boolean(name='success'),
- result: string(name='result')
- }
- model AlipayPassInstanceUpdateResponse {
- httpBody: string(name='http_body', description='响应原始字符串'),
- code: string(name='code'),
- msg: string(name='msg'),
- subCode: string(name='sub_code'),
- subMsg: string(name='sub_msg'),
- success: boolean(name='success'),
- result: string(name='result')
- }
- api createTemplate(uniqueId: string, tplContent: string): AlipayPassTemplateAddResponse {
- var systemParams: map[string]string = {
- method = 'alipay.pass.template.add',
- 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 = {
- unique_id = uniqueId,
- tpl_content = tplContent
- };
- var textParams: map[string]string = {
- };
- __request.protocol = @kernel.getConfig("protocol");
- __request.method = 'POST';
- __request.pathname = '/gateway.do';
- __request.headers = {
- host = @kernel.getConfig("gatewayHost"),
- content-type = 'application/x-www-form-urlencoded;charset=utf-8'
- };
- __request.query = @kernel.sortMap({
- sign = @kernel.sign(systemParams, bizParams, textParams, @kernel.getConfig("merchantPrivateKey")),
- ... systemParams,
- ... textParams
- });
- __request.body = @kernel.toUrlEncodedRequestBody(bizParams);
- } returns {
- var respMap: map[string]any = @kernel.readAsJson(__response, "alipay.pass.template.add");
- if (@kernel.isCertMode()) {
- if (@kernel.verify(respMap, @kernel.extractAlipayPublicKey(@kernel.getAlipayCertSN(respMap)))) {
- return @kernel.toRespModel(respMap);
- }
- } else {
- if (@kernel.verify(respMap, @kernel.getConfig("alipayPublicKey"))) {
- return @kernel.toRespModel(respMap);
- }
- }
-
- throw {
- message = '验签失败,请检查支付宝公钥设置是否正确。'
- }
-
- } runtime {
- ignoreSSL = @kernel.getConfig("ignoreSSL"),
- httpProxy = @kernel.getConfig("httpProxy"),
- connectTimeout = 15000,
- readTimeout = 15000,
- retry = {
- maxAttempts = 0
- }
- }
- api updateTemplate(tplId: string, tplContent: string): AlipayPassTemplateUpdateResponse {
- var systemParams: map[string]string = {
- method = 'alipay.pass.template.update',
- 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 = {
- tpl_id = tplId,
- tpl_content = tplContent
- };
- var textParams: map[string]string = {
- };
- __request.protocol = @kernel.getConfig("protocol");
- __request.method = 'POST';
- __request.pathname = '/gateway.do';
- __request.headers = {
- host = @kernel.getConfig("gatewayHost"),
- content-type = 'application/x-www-form-urlencoded;charset=utf-8'
- };
- __request.query = @kernel.sortMap({
- sign = @kernel.sign(systemParams, bizParams, textParams, @kernel.getConfig("merchantPrivateKey")),
- ... systemParams,
- ... textParams
- });
- __request.body = @kernel.toUrlEncodedRequestBody(bizParams);
- } returns {
- var respMap: map[string]any = @kernel.readAsJson(__response, "alipay.pass.template.update");
- if (@kernel.isCertMode()) {
- if (@kernel.verify(respMap, @kernel.extractAlipayPublicKey(@kernel.getAlipayCertSN(respMap)))) {
- return @kernel.toRespModel(respMap);
- }
- } else {
- if (@kernel.verify(respMap, @kernel.getConfig("alipayPublicKey"))) {
- return @kernel.toRespModel(respMap);
- }
- }
-
- throw {
- message = '验签失败,请检查支付宝公钥设置是否正确。'
- }
-
- } runtime {
- ignoreSSL = @kernel.getConfig("ignoreSSL"),
- httpProxy = @kernel.getConfig("httpProxy"),
- connectTimeout = 15000,
- readTimeout = 15000,
- retry = {
- maxAttempts = 0
- }
- }
- api addInstance(tplId: string, tplParams: string, recognitionType: string, recognitionInfo: string): AlipayPassInstanceAddResponse {
- var systemParams: map[string]string = {
- method = 'alipay.pass.instance.add',
- 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 = {
- tpl_id = tplId,
- tpl_params = tplParams,
- recognition_type = recognitionType,
- recognition_info = recognitionInfo
- };
- var textParams: map[string]string = {
- };
- __request.protocol = @kernel.getConfig("protocol");
- __request.method = 'POST';
- __request.pathname = '/gateway.do';
- __request.headers = {
- host = @kernel.getConfig("gatewayHost"),
- content-type = 'application/x-www-form-urlencoded;charset=utf-8'
- };
- __request.query = @kernel.sortMap({
- sign = @kernel.sign(systemParams, bizParams, textParams, @kernel.getConfig("merchantPrivateKey")),
- ... systemParams,
- ... textParams
- });
- __request.body = @kernel.toUrlEncodedRequestBody(bizParams);
- } returns {
- var respMap: map[string]any = @kernel.readAsJson(__response, "alipay.pass.instance.add");
- if (@kernel.isCertMode()) {
- if (@kernel.verify(respMap, @kernel.extractAlipayPublicKey(@kernel.getAlipayCertSN(respMap)))) {
- return @kernel.toRespModel(respMap);
- }
- } else {
- if (@kernel.verify(respMap, @kernel.getConfig("alipayPublicKey"))) {
- return @kernel.toRespModel(respMap);
- }
- }
-
- throw {
- message = '验签失败,请检查支付宝公钥设置是否正确。'
- }
-
- } runtime {
- ignoreSSL = @kernel.getConfig("ignoreSSL"),
- httpProxy = @kernel.getConfig("httpProxy"),
- connectTimeout = 15000,
- readTimeout = 15000,
- retry = {
- maxAttempts = 0
- }
- }
- api updateInstance(serialNumber: string, channelId: string, tplParams: string, status: string, verifyCode: string, verifyType: string): AlipayPassInstanceUpdateResponse {
- var systemParams: map[string]string = {
- method = 'alipay.pass.instance.update',
- 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 = {
- serial_number = serialNumber,
- channel_id = channelId,
- tpl_params = tplParams,
- status = status,
- verify_code = verifyCode,
- verify_type = verifyType
- };
- var textParams: map[string]string = {
- };
- __request.protocol = @kernel.getConfig("protocol");
- __request.method = 'POST';
- __request.pathname = '/gateway.do';
- __request.headers = {
- host = @kernel.getConfig("gatewayHost"),
- content-type = 'application/x-www-form-urlencoded;charset=utf-8'
- };
- __request.query = @kernel.sortMap({
- sign = @kernel.sign(systemParams, bizParams, textParams, @kernel.getConfig("merchantPrivateKey")),
- ... systemParams,
- ... textParams
- });
- __request.body = @kernel.toUrlEncodedRequestBody(bizParams);
- } returns {
- var respMap: map[string]any = @kernel.readAsJson(__response, "alipay.pass.instance.update");
- if (@kernel.isCertMode()) {
- if (@kernel.verify(respMap, @kernel.extractAlipayPublicKey(@kernel.getAlipayCertSN(respMap)))) {
- return @kernel.toRespModel(respMap);
- }
- } else {
- if (@kernel.verify(respMap, @kernel.getConfig("alipayPublicKey"))) {
- return @kernel.toRespModel(respMap);
- }
- }
-
- throw {
- message = '验签失败,请检查支付宝公钥设置是否正确。'
- }
-
- } runtime {
- ignoreSSL = @kernel.getConfig("ignoreSSL"),
- httpProxy = @kernel.getConfig("httpProxy"),
- connectTimeout = 15000,
- readTimeout = 15000,
- retry = {
- maxAttempts = 0
- }
- }
|