main.tea 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636
  1. import EasySDKKernel;
  2. type @kernel = EasySDKKernel
  3. init(kernel: EasySDKKernel) {
  4. @kernel = kernel;
  5. }
  6. model RefundRoyaltyResult{
  7. refundAmount: string(name='refund_amount'),
  8. royaltyType: string(name='royalty_type'),
  9. resultCode: string(name='result_code'),
  10. transOut: string(name='trans_out'),
  11. transOutEmail: string(name='trans_out_email'),
  12. transIn: string(name='trans_in'),
  13. transInEmail: string(name='trans_in_email'),
  14. }
  15. model TradeFundBill {
  16. fundChannel: string(name='fund_channel'),
  17. bankCode: string(name='bank_code'),
  18. amount: string(name='amount'),
  19. realAmount: string(name='real_amount'),
  20. fundType: string(name='fund_type')
  21. }
  22. model TradeSettleDetail {
  23. operationType: string(name='operation_type'),
  24. operationSerial_no: string(name='operation_serial_no'),
  25. operationDt: string(name='operation_dt'),
  26. transOut: string(name='trans_out'),
  27. transIn: string(name='trans_in'),
  28. amount: string(name='amount')
  29. }
  30. model TradeSettleInfo {
  31. tradeSettleDetailList: [ TradeSettleDetail ](name='trade_settle_detail_list')
  32. }
  33. model PresetPayToolInfo {
  34. amount: [ string ](name='amount'),
  35. assertTypeCode: string(name='assert_type_code')
  36. }
  37. model AlipayTradeCreateResponse {
  38. httpBody: string(name='http_body', description='响应原始字符串'),
  39. code: string(name='code'),
  40. msg: string(name='msg'),
  41. subCode: string(name='sub_code'),
  42. subMsg: string(name='sub_msg'),
  43. outTradeNo: string(name='out_trade_no'),
  44. tradeNo: string(name='trade_no')
  45. }
  46. model AlipayTradeQueryResponse {
  47. httpBody: string(name='http_body', description='响应原始字符串'),
  48. code: string(name='code'),
  49. msg: string(name='msg'),
  50. subCode: string(name='sub_code'),
  51. subMsg: string(name='sub_msg'),
  52. tradeNo: string(name='trade_no'),
  53. outTradeNo: string(name='out_trade_no'),
  54. buyerLogonId: string(name='buyer_logon_id'),
  55. tradeStatus: string(name='trade_status'),
  56. totalAmount: string(name='total_amount'),
  57. transCurrency: string(name='trans_currency'),
  58. settleCurrency: string(name='settle_currency'),
  59. settleAmount: string(name='settle_amount'),
  60. payCurrency: string(name='pay_currency'),
  61. payAmount: string(name='pay_amount'),
  62. settleTransRate: string(name='settle_trans_rate'),
  63. transPayRate: string(name='trans_pay_rate'),
  64. buyerPayAmount: string(name='buyer_pay_amount'),
  65. pointAmount: string(name='point_amount'),
  66. invoiceAmount: string(name='invoice_amount'),
  67. sendPayDate: string(name='send_pay_date'),
  68. receiptAmount: string(name='receipt_amount'),
  69. storeId: string(name='store_id'),
  70. terminalId: string(name='terminal_id'),
  71. fundBillList: [ TradeFundBill ](name='fund_bill_list'),
  72. storeName: string(name='store_name'),
  73. buyerUserId: string(name='buyer_user_id'),
  74. chargeAmount: string(name='charge_amount'),
  75. chargeFlags: string(name='charge_flags'),
  76. settlementId: string(name='settlement_id'),
  77. tradeSettleInfo: [ TradeSettleInfo ](name='trade_settle_info'),
  78. authTradePayMode: string(name='auth_trade_pay_mode'),
  79. buyerUserType: string(name='buyer_user_type'),
  80. mdiscountAmount: string(name='mdiscount_amount'),
  81. discountAmount: string(name='discount_amount'),
  82. buyerUserName: string(name='buyer_user_name'),
  83. subject: string(name='subject'),
  84. body: string(name='body'),
  85. alipaySubMerchantId: string(name='alipay_sub_merchant_id'),
  86. extInfos: string(name='ext_infos')
  87. }
  88. model AlipayTradeRefundResponse {
  89. httpBody: string(name='http_body', description='响应原始字符串'),
  90. code: string(name='code'),
  91. msg: string(name='msg'),
  92. subCode: string(name='sub_code'),
  93. subMsg: string(name='sub_msg'),
  94. tradeNo: string(name='trade_no'),
  95. outTradeNo: string(name='out_trade_no'),
  96. buyerLogonId: string(name='buyer_logon_id'),
  97. fundChange: string(name='fund_change'),
  98. refundFee: string(name='refund_fee'),
  99. refundCurrency: string(name='refund_currency'),
  100. gmtRefundPay: string(name='gmt_refund_pay'),
  101. refundDetailItemList: [ TradeFundBill ](name='refund_detail_item_list'),
  102. storeName: string(name='store_name'),
  103. buyerUserId: string(name='buyer_user_id'),
  104. refundPresetPaytoolList: [ PresetPayToolInfo ](name='refund_preset_paytool_list'),
  105. refundSettlementId: string(name='refund_settlement_id'),
  106. presentRefundBuyerAmount: string(name='present_refund_buyer_amount'),
  107. presentRefundDiscountAmount: string(name='present_refund_discount_amount'),
  108. presentRefundMdiscountAmount: string(name='present_refund_mdiscount_amount'),
  109. }
  110. model AlipayTradeCloseResponse {
  111. httpBody: string(name='http_body', description='响应原始字符串'),
  112. code: string(name='code'),
  113. msg: string(name='msg'),
  114. subCode: string(name='sub_code'),
  115. subMsg: string(name='sub_msg'),
  116. tradeNo: string(name='trade_no'),
  117. outTradeNo: string(name='out_trade_no')
  118. }
  119. model AlipayTradeCancelResponse {
  120. httpBody: string(name='http_body', description='响应原始字符串'),
  121. code: string(name='code'),
  122. msg: string(name='msg'),
  123. subCode: string(name='sub_code'),
  124. subMsg: string(name='sub_msg'),
  125. tradeNo: string(name='trade_no'),
  126. outTradeNo: string(name='out_trade_no'),
  127. retryFlag: string(name='retry_flag'),
  128. action: string(name='action'),
  129. gmtRefundPay: string(name='gmt_refund_pay'),
  130. refundSettlementId: string(name='refund_settlement_id')
  131. }
  132. model AlipayTradeFastpayRefundQueryResponse {
  133. httpBody: string(name='http_body', description='响应原始字符串'),
  134. code: string(name='code'),
  135. msg: string(name='msg'),
  136. subCode: string(name='sub_code'),
  137. subMsg: string(name='sub_msg'),
  138. errorCode: string(name='error_code'),
  139. gmtRefundPay: string(name='gmt_refund_pay'),
  140. industrySepcDetail: string(name='industry_sepc_detail'),
  141. outRequestNo: string(name='out_request_no'),
  142. outTradeNo: string(name='out_trade_no'),
  143. presentRefundBuyerAmount: string(name='present_refund_buyer_amount'),
  144. presentRefundDiscountAmount: string(name='present_refund_discount_amount'),
  145. presentRefundMdiscountAmount: string(name='present_refund_mdiscount_amount'),
  146. refundAmount: string(name='refund_amount'),
  147. refundChargeAmount: string(name='refund_charge_amount'),
  148. refundDetailItemList: [ TradeFundBill ](name='refund_detail_item_list'),
  149. refundReason: string(name='refund_reason'),
  150. refundRoyaltys: [ RefundRoyaltyResult ](name='refund_royaltys'),
  151. refundSettlementId: string(name='refund_settlement_id'),
  152. refundStatus: string(name='refund_status'),
  153. sendBackFee: string(name='send_back_fee'),
  154. totalAmount: string(name='total_amount'),
  155. tradeNo: string(name='trade_no')
  156. }
  157. model AlipayDataDataserviceBillDownloadurlQueryResponse{
  158. httpBody: string(name='http_body', description='响应原始字符串'),
  159. code: string(name='code'),
  160. msg: string(name='msg'),
  161. subCode: string(name='sub_code'),
  162. subMsg: string(name='sub_msg'),
  163. billDownloadUrl: string(name='bill_download_url'),
  164. }
  165. api create(subject: string, outTradeNo: string, totalAmount: string, buyerId: string): AlipayTradeCreateResponse {
  166. var systemParams: map[string]string = {
  167. method = 'alipay.trade.create',
  168. app_id = @kernel.getConfig("appId"),
  169. timestamp = @kernel.getTimestamp(),
  170. format = 'json',
  171. version = '1.0',
  172. alipay_sdk = @kernel.getSdkVersion(),
  173. charset = 'UTF-8',
  174. sign_type = @kernel.getConfig("signType"),
  175. app_cert_sn = @kernel.getMerchantCertSN(),
  176. alipay_root_cert_sn = @kernel.getAlipayRootCertSN()
  177. };
  178. var bizParams: map[string]any = {
  179. subject = subject,
  180. out_trade_no = outTradeNo,
  181. total_amount = totalAmount,
  182. buyer_id = buyerId
  183. };
  184. var textParams: map[string]string = {
  185. };
  186. __request.protocol = @kernel.getConfig("protocol");
  187. __request.method = 'POST';
  188. __request.pathname = '/gateway.do';
  189. __request.headers = {
  190. host = @kernel.getConfig("gatewayHost"),
  191. content-type = 'application/x-www-form-urlencoded;charset=utf-8'
  192. };
  193. __request.query = @kernel.sortMap({
  194. sign = @kernel.sign(systemParams, bizParams, textParams, @kernel.getConfig("merchantPrivateKey")),
  195. ... systemParams,
  196. ... textParams
  197. });
  198. __request.body = @kernel.toUrlEncodedRequestBody(bizParams);
  199. } returns {
  200. var respMap: map[string]any = @kernel.readAsJson(__response, "alipay.trade.create");
  201. if (@kernel.isCertMode()) {
  202. if (@kernel.verify(respMap, @kernel.extractAlipayPublicKey(@kernel.getAlipayCertSN(respMap)))) {
  203. return @kernel.toRespModel(respMap);
  204. }
  205. } else {
  206. if (@kernel.verify(respMap, @kernel.getConfig("alipayPublicKey"))) {
  207. return @kernel.toRespModel(respMap);
  208. }
  209. }
  210. throw {
  211. message = '验签失败,请检查支付宝公钥设置是否正确。'
  212. }
  213. } runtime {
  214. connectTimeout = 15000,
  215. readTimeout = 15000,
  216. retry = {
  217. maxAttempts = 0
  218. }
  219. }
  220. api query(outTradeNo: string): AlipayTradeQueryResponse {
  221. var systemParams: map[string]string = {
  222. method = 'alipay.trade.query',
  223. app_id = @kernel.getConfig("appId"),
  224. timestamp = @kernel.getTimestamp(),
  225. format = 'json',
  226. version = '1.0',
  227. alipay_sdk = @kernel.getSdkVersion(),
  228. charset = 'UTF-8',
  229. sign_type = @kernel.getConfig("signType"),
  230. app_cert_sn = @kernel.getMerchantCertSN(),
  231. alipay_root_cert_sn = @kernel.getAlipayRootCertSN()
  232. };
  233. var bizParams: map[string]any = {
  234. out_trade_no = outTradeNo
  235. };
  236. var textParams: map[string]string = {
  237. };
  238. __request.protocol = @kernel.getConfig("protocol");
  239. __request.method = 'POST';
  240. __request.pathname = '/gateway.do';
  241. __request.headers = {
  242. host = @kernel.getConfig("gatewayHost"),
  243. content-type = 'application/x-www-form-urlencoded;charset=utf-8'
  244. };
  245. __request.query = @kernel.sortMap({
  246. sign = @kernel.sign(systemParams, bizParams, textParams, @kernel.getConfig("merchantPrivateKey")),
  247. ... systemParams,
  248. ... textParams
  249. });
  250. __request.body = @kernel.toUrlEncodedRequestBody(bizParams);
  251. } returns {
  252. var respMap: map[string]any = @kernel.readAsJson(__response, "alipay.trade.query");
  253. if (@kernel.isCertMode()) {
  254. if (@kernel.verify(respMap, @kernel.extractAlipayPublicKey(@kernel.getAlipayCertSN(respMap)))) {
  255. return @kernel.toRespModel(respMap);
  256. }
  257. } else {
  258. if (@kernel.verify(respMap, @kernel.getConfig("alipayPublicKey"))) {
  259. return @kernel.toRespModel(respMap);
  260. }
  261. }
  262. throw {
  263. message = '验签失败,请检查支付宝公钥设置是否正确。'
  264. }
  265. } runtime {
  266. connectTimeout = 15000,
  267. readTimeout = 15000,
  268. retry = {
  269. maxAttempts = 0
  270. }
  271. }
  272. api refund(outTradeNo: string, refundAmount: string): AlipayTradeRefundResponse {
  273. var systemParams: map[string]string = {
  274. method = 'alipay.trade.refund',
  275. app_id = @kernel.getConfig("appId"),
  276. timestamp = @kernel.getTimestamp(),
  277. format = 'json',
  278. version = '1.0',
  279. alipay_sdk = @kernel.getSdkVersion(),
  280. charset = 'UTF-8',
  281. sign_type = @kernel.getConfig("signType"),
  282. app_cert_sn = @kernel.getMerchantCertSN(),
  283. alipay_root_cert_sn = @kernel.getAlipayRootCertSN()
  284. };
  285. var bizParams: map[string]any = {
  286. out_trade_no = outTradeNo,
  287. refund_amount = refundAmount
  288. };
  289. var textParams: map[string]string = {
  290. };
  291. __request.protocol = @kernel.getConfig("protocol");
  292. __request.method = 'POST';
  293. __request.pathname = '/gateway.do';
  294. __request.headers = {
  295. host = @kernel.getConfig("gatewayHost"),
  296. content-type = 'application/x-www-form-urlencoded;charset=utf-8'
  297. };
  298. __request.query = @kernel.sortMap({
  299. sign = @kernel.sign(systemParams, bizParams, textParams, @kernel.getConfig("merchantPrivateKey")),
  300. ... systemParams,
  301. ... textParams
  302. });
  303. __request.body = @kernel.toUrlEncodedRequestBody(bizParams);
  304. } returns {
  305. var respMap: map[string]any = @kernel.readAsJson(__response, "alipay.trade.refund");
  306. if (@kernel.isCertMode()) {
  307. if (@kernel.verify(respMap, @kernel.extractAlipayPublicKey(@kernel.getAlipayCertSN(respMap)))) {
  308. return @kernel.toRespModel(respMap);
  309. }
  310. } else {
  311. if (@kernel.verify(respMap, @kernel.getConfig("alipayPublicKey"))) {
  312. return @kernel.toRespModel(respMap);
  313. }
  314. }
  315. throw {
  316. message = '验签失败,请检查支付宝公钥设置是否正确。'
  317. }
  318. } runtime {
  319. connectTimeout = 15000,
  320. readTimeout = 15000,
  321. retry = {
  322. maxAttempts = 0
  323. }
  324. }
  325. api close(outTradeNo: string): AlipayTradeCloseResponse {
  326. var systemParams: map[string]string = {
  327. method = 'alipay.trade.close',
  328. app_id = @kernel.getConfig("appId"),
  329. timestamp = @kernel.getTimestamp(),
  330. format = 'json',
  331. version = '1.0',
  332. alipay_sdk = @kernel.getSdkVersion(),
  333. charset = 'UTF-8',
  334. sign_type = @kernel.getConfig("signType"),
  335. app_cert_sn = @kernel.getMerchantCertSN(),
  336. alipay_root_cert_sn = @kernel.getAlipayRootCertSN()
  337. };
  338. var bizParams: map[string]any = {
  339. out_trade_no = outTradeNo
  340. };
  341. var textParams: map[string]string = {
  342. };
  343. __request.protocol = @kernel.getConfig("protocol");
  344. __request.method = 'POST';
  345. __request.pathname = '/gateway.do';
  346. __request.headers = {
  347. host = @kernel.getConfig("gatewayHost"),
  348. content-type = 'application/x-www-form-urlencoded;charset=utf-8'
  349. };
  350. __request.query = @kernel.sortMap({
  351. sign = @kernel.sign(systemParams, bizParams, textParams, @kernel.getConfig("merchantPrivateKey")),
  352. ... systemParams,
  353. ... textParams
  354. });
  355. __request.body = @kernel.toUrlEncodedRequestBody(bizParams);
  356. } returns {
  357. var respMap: map[string]any = @kernel.readAsJson(__response, "alipay.trade.close");
  358. if (@kernel.isCertMode()) {
  359. if (@kernel.verify(respMap, @kernel.extractAlipayPublicKey(@kernel.getAlipayCertSN(respMap)))) {
  360. return @kernel.toRespModel(respMap);
  361. }
  362. } else {
  363. if (@kernel.verify(respMap, @kernel.getConfig("alipayPublicKey"))) {
  364. return @kernel.toRespModel(respMap);
  365. }
  366. }
  367. throw {
  368. message = '验签失败,请检查支付宝公钥设置是否正确。'
  369. }
  370. } runtime {
  371. connectTimeout = 15000,
  372. readTimeout = 15000,
  373. retry = {
  374. maxAttempts = 0
  375. }
  376. }
  377. api cancel(outTradeNo: string): AlipayTradeCancelResponse {
  378. var systemParams: map[string]string = {
  379. method = 'alipay.trade.cancel',
  380. app_id = @kernel.getConfig("appId"),
  381. timestamp = @kernel.getTimestamp(),
  382. format = 'json',
  383. version = '1.0',
  384. alipay_sdk = @kernel.getSdkVersion(),
  385. charset = 'UTF-8',
  386. sign_type = @kernel.getConfig("signType"),
  387. app_cert_sn = @kernel.getMerchantCertSN(),
  388. alipay_root_cert_sn = @kernel.getAlipayRootCertSN()
  389. };
  390. var bizParams: map[string]any = {
  391. out_trade_no = outTradeNo
  392. };
  393. var textParams: map[string]string = {
  394. };
  395. __request.protocol = @kernel.getConfig("protocol");
  396. __request.method = 'POST';
  397. __request.pathname = '/gateway.do';
  398. __request.headers = {
  399. host = @kernel.getConfig("gatewayHost"),
  400. content-type = 'application/x-www-form-urlencoded;charset=utf-8'
  401. };
  402. __request.query = @kernel.sortMap({
  403. sign = @kernel.sign(systemParams, bizParams, textParams, @kernel.getConfig("merchantPrivateKey")),
  404. ... systemParams,
  405. ... textParams
  406. });
  407. __request.body = @kernel.toUrlEncodedRequestBody(bizParams);
  408. } returns {
  409. var respMap: map[string]any = @kernel.readAsJson(__response, "alipay.trade.cancel");
  410. if (@kernel.isCertMode()) {
  411. if (@kernel.verify(respMap, @kernel.extractAlipayPublicKey(@kernel.getAlipayCertSN(respMap)))) {
  412. return @kernel.toRespModel(respMap);
  413. }
  414. } else {
  415. if (@kernel.verify(respMap, @kernel.getConfig("alipayPublicKey"))) {
  416. return @kernel.toRespModel(respMap);
  417. }
  418. }
  419. throw {
  420. message = '验签失败,请检查支付宝公钥设置是否正确。'
  421. }
  422. } runtime {
  423. connectTimeout = 15000,
  424. readTimeout = 15000,
  425. retry = {
  426. maxAttempts = 0
  427. }
  428. }
  429. api queryRefund(outTradeNo: string, outRequestNo: string): AlipayTradeFastpayRefundQueryResponse {
  430. var systemParams: map[string]string = {
  431. method = 'alipay.trade.fastpay.refund.query',
  432. app_id = @kernel.getConfig("appId"),
  433. timestamp = @kernel.getTimestamp(),
  434. format = 'json',
  435. version = '1.0',
  436. alipay_sdk = @kernel.getSdkVersion(),
  437. charset = 'UTF-8',
  438. sign_type = @kernel.getConfig("signType"),
  439. app_cert_sn = @kernel.getMerchantCertSN(),
  440. alipay_root_cert_sn = @kernel.getAlipayRootCertSN()
  441. };
  442. var bizParams: map[string]any = {
  443. out_trade_no = outTradeNo,
  444. out_request_no = outRequestNo
  445. };
  446. var textParams: map[string]string = {
  447. };
  448. __request.protocol = @kernel.getConfig("protocol");
  449. __request.method = 'POST';
  450. __request.pathname = '/gateway.do';
  451. __request.headers = {
  452. host = @kernel.getConfig("gatewayHost"),
  453. content-type = 'application/x-www-form-urlencoded;charset=utf-8'
  454. };
  455. __request.query = @kernel.sortMap({
  456. sign = @kernel.sign(systemParams, bizParams, textParams, @kernel.getConfig("merchantPrivateKey")),
  457. ... systemParams,
  458. ... textParams
  459. });
  460. __request.body = @kernel.toUrlEncodedRequestBody(bizParams);
  461. } returns {
  462. var respMap: map[string]any = @kernel.readAsJson(__response, "alipay.trade.fastpay.refund.query");
  463. if (@kernel.isCertMode()) {
  464. if (@kernel.verify(respMap, @kernel.extractAlipayPublicKey(@kernel.getAlipayCertSN(respMap)))) {
  465. return @kernel.toRespModel(respMap);
  466. }
  467. } else {
  468. if (@kernel.verify(respMap, @kernel.getConfig("alipayPublicKey"))) {
  469. return @kernel.toRespModel(respMap);
  470. }
  471. }
  472. throw {
  473. message = '验签失败,请检查支付宝公钥设置是否正确。'
  474. }
  475. } runtime {
  476. connectTimeout = 15000,
  477. readTimeout = 15000,
  478. retry = {
  479. maxAttempts = 0
  480. }
  481. }
  482. api downloadBill(billType: string, billDate: string): AlipayDataDataserviceBillDownloadurlQueryResponse {
  483. var systemParams: map[string]string = {
  484. method = 'alipay.data.dataservice.bill.downloadurl.query',
  485. app_id = @kernel.getConfig("appId"),
  486. timestamp = @kernel.getTimestamp(),
  487. format = 'json',
  488. version = '1.0',
  489. alipay_sdk = @kernel.getSdkVersion(),
  490. charset = 'UTF-8',
  491. sign_type = @kernel.getConfig("signType"),
  492. app_cert_sn = @kernel.getMerchantCertSN(),
  493. alipay_root_cert_sn = @kernel.getAlipayRootCertSN()
  494. };
  495. var bizParams: map[string]any = {
  496. bill_type = billType,
  497. bill_date = billDate
  498. };
  499. var textParams: map[string]string = {
  500. };
  501. __request.protocol = @kernel.getConfig("protocol");
  502. __request.method = 'POST';
  503. __request.pathname = '/gateway.do';
  504. __request.headers = {
  505. host = @kernel.getConfig("gatewayHost"),
  506. content-type = 'application/x-www-form-urlencoded;charset=utf-8'
  507. };
  508. __request.query = @kernel.sortMap({
  509. sign = @kernel.sign(systemParams, bizParams, textParams, @kernel.getConfig("merchantPrivateKey")),
  510. ... systemParams,
  511. ... textParams
  512. });
  513. __request.body = @kernel.toUrlEncodedRequestBody(bizParams);
  514. } returns {
  515. var respMap: map[string]any = @kernel.readAsJson(__response, "alipay.data.dataservice.bill.downloadurl.query");
  516. if (@kernel.isCertMode()) {
  517. if (@kernel.verify(respMap, @kernel.extractAlipayPublicKey(@kernel.getAlipayCertSN(respMap)))) {
  518. return @kernel.toRespModel(respMap);
  519. }
  520. } else {
  521. if (@kernel.verify(respMap, @kernel.getConfig("alipayPublicKey"))) {
  522. return @kernel.toRespModel(respMap);
  523. }
  524. }
  525. throw {
  526. message = '验签失败,请检查支付宝公钥设置是否正确。'
  527. }
  528. } runtime {
  529. connectTimeout = 15000,
  530. readTimeout = 15000,
  531. retry = {
  532. maxAttempts = 0
  533. }
  534. }
  535. function verifyNotify(parameters: map[string]string): boolean {
  536. if (@kernel.isCertMode()) {
  537. return @kernel.verifyParams(parameters, @kernel.extractAlipayPublicKey(''));
  538. } else {
  539. return @kernel.verifyParams(parameters, @kernel.getConfig('alipayPublicKey'));
  540. }
  541. }