admin管理员组

文章数量:1538621

2024年1月6日发(作者:)

26.

27. public static String POST = "POST";28. public static String GET = "GET";29.

30. public static String host = "";31. public static String APPLY_PATH = "/v3/applyment4sub/applyment/"; // 申请单url32. public static String CERT_PATH = "/v3/certificates"; // 获取微信平台证书url33. public static String APPLY_QUERY_PATH = "/v3/applyment4sub/applyment/applyment_id/"; // 查询申请状态34.

35. /**36. * POST请求37. */38. public static String sendPost(String body) {39. String url = host + APPLY_PATH;40. try {41. // 获取微信平台商户证书序列号42. String wxSerialNo = tSerialNo();43. String authorization = getToken(POST, url, body);44. WebClient client = (host);45. ();46. ("Content-Type", "application/json; charset=UTF-8");47. ("Accept", "application/json");48. ("user-agent", "application/json");49. ("Wechatpay-Serial", wxSerialNo);50. ("Authorization", authorization);51. (APPLY_PATH);52. Response r = (body);53. return tity();54. } catch (Exception e) {55. return null;56. }57. }58.

59. /**60. * get请求61. */62. public static String sendGet() {63. // 请求URL64. String url = host + CERT_PATH;65. try {66. String authorization = getToken(GET, url, "");67. WebClient client = (host);68. ();69. ("Content-Type", "application/json; charset=UTF-8");70. ("Accept", "application/json");71. ("User-Agent", "application/json");72. ("Authorization", authorization);73. (CERT_PATH);74. Response r = ();75. return tity();76. } catch (Exception e) {77. tackTrace();78. return null;79. }80. }81.

82. /**83. * get请求84. */85. public static String sendGet(String applymentId) {86. // 请求URL87. String url = host + APPLY_QUERY_PATH + applymentId;88. try {89. String authorization = getToken(GET, url, "");90. WebClient client = (host);91. ();92. ("Content-Type", "application/json; charset=UTF-8");93. ("Accept", "application/json");94. ("User-Agent", "application/json");95. ("Authorization", authorization);96. (APPLY_QUERY_PATH + applymentId);97. Response r = ();98. return tity();99. } catch (Exception e) {100. tackTrace();101. return null;102. }103. }104.

105. /**106. * 获取加密串107. *

108. * @param method109. * @param url110. * @param body111. * @return112. */113. public static String getToken(String method, String url, String body) {114. String nonceStr = D32();115. long timestamp = tTimeMillis() / 1000;116. HttpUrl httpUrl = (url);

69. } catch (BadPaddingException | IllegalBlockSizeException e) {70. throw new BadPaddingException("解密失败");71. }72. }73. }

本文标签: 商户微信进件获取小微