-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
新版商家转账 - 回调 #3549
Comments
自己试着写了写,解析正常给大家参考下 @PostMapping(value = "/transfer/notify")
public ResponseEntity<String> transferNotify(HttpServletRequest request, @RequestBody String notifyData) {
SignatureHeader header = getRequestHeader(request);
try {
TransferBillsNotifyResult transferBillsNotifyResult = this.wxPayService.parseTransferBillsNotifyV3Result(notifyData, header);
log.info("转账通知: {}", transferBillsNotifyResult);
String resp = WxPayNotifyV3Response.success("");
return ResponseEntity.ok(resp);
} catch (Exception e) {
log.error("WxPayController#transferNotify", e);
String resp = WxPayNotifyV3Response.fail("系统错误");
return ResponseEntity.status(500).body(resp);
}
}
/**
* 组装请求头重的前面信息
*
* @param request
* @return
*/
private SignatureHeader getRequestHeader(HttpServletRequest request) {
// 获取通知签名
String signature = request.getHeader("Wechatpay-Signature");
String nonce = request.getHeader("Wechatpay-Nonce");
String serial = request.getHeader("Wechatpay-Serial");
String timestamp = request.getHeader("Wechatpay-Timestamp");
SignatureHeader signatureHeader = new SignatureHeader();
signatureHeader.setSignature(signature);
signatureHeader.setNonce(nonce);
signatureHeader.setSerial(serial);
signatureHeader.setTimeStamp(timestamp);
return signatureHeader;
} |
欢迎你把代码直接通过PR贡献到demo里 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
是否有大佬可以提供一个Controller demo处理转账回调,感谢
The text was updated successfully, but these errors were encountered: