微信支付回调地址修改

pull/1/head
czc 2 years ago
parent 7472a8d85a
commit f484542fca

@ -38,7 +38,7 @@ import java.util.Map;
*/
@Api(description ="微信回调接口列表")
@RestController
@RequestMapping("/wechat/pay/callback")
@RequestMapping("/no-auth/wechat")
public class PayNotifyController {
private static final Logger log = LoggerFactory.getLogger(PayNotifyController.class);
@ -52,7 +52,7 @@ public class PayNotifyController {
* @param request
* @throws IOException
*/
@PostMapping("/weChatPayNotify")
@PostMapping("/notify")
public void weChatPayNotify(HttpServletRequest request) throws Exception {
log.info("收到了微信支付回调");
// 从请求头中获取信息

@ -29,8 +29,7 @@ public class WechatPayUtil {
public static String getSign(String signatureStr,String privateKey) throws InvalidKeyException, NoSuchAlgorithmException, SignatureException, IOException, URISyntaxException {
//replace 根据实际情况,不一定都需要
String replace = privateKey.replace("\\n", "\n");
ClassPathResource classPathResource = new ClassPathResource(privateKey);
InputStream certStream = classPathResource.getInputStream();
InputStream certStream = Files.newInputStream(Paths.get(privateKey));
PrivateKey merchantPrivateKey = PemUtil.readPemPrivateKey(certStream);
Signature sign = Signature.getInstance("SHA256withRSA");
sign.initSign(merchantPrivateKey);

Loading…
Cancel
Save