|
@@ -7,6 +7,7 @@ import java.io.InputStream;
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
import java.security.PrivateKey;
|
|
|
import java.security.PublicKey;
|
|
|
+import java.util.Date;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
@@ -112,23 +113,27 @@ public class YeepayController extends BaseController {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- @PostMapping("/callback/{tenantId}")
|
|
|
- public String callback(@PathVariable("tenantId") Integer tenantId, HttpServletRequest request) {
|
|
|
+ @PostMapping("/callback/{requestNo}")
|
|
|
+ public String callback(@PathVariable("requestNo") String requestNo, HttpServletRequest request) {
|
|
|
+
|
|
|
+ HfMember hfMember = hfMemberService.queryByRequestNo(requestNo);
|
|
|
+ if(hfMember == null){
|
|
|
+ return "请求编号["+ requestNo +"]在系统中不存在";
|
|
|
+ }
|
|
|
+ hfMember.setUpdateTime(new Date());
|
|
|
|
|
|
- HfMerchantConfig hfMerchantConfig = hfMerchantConfigService.queryByTenantId(tenantId, PaymentChannelEnum.YEEPAY.getCode());
|
|
|
+ HfMerchantConfig hfMerchantConfig = hfMerchantConfigService.queryByTenantId(hfMember.getTenantId(), PaymentChannelEnum.YEEPAY.getCode());
|
|
|
if(hfMerchantConfig == null){
|
|
|
- throw new BizException("机构[{}][{}]商户信息找不到", tenantId, PaymentChannelEnum.YEEPAY.getCode());
|
|
|
+ throw new BizException("机构[{}][{}]商户信息找不到", hfMember.getTenantId(), PaymentChannelEnum.YEEPAY.getCode());
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
-
|
|
|
- String content = IOUtils.toString(request.getInputStream(), StandardCharsets.UTF_8);
|
|
|
-
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(content);
|
|
|
+
|
|
|
+ String content = request.getParameter("response");
|
|
|
|
|
|
// 构造结果通知请求对象
|
|
|
DigitalEnvelopeDTO dto = new DigitalEnvelopeDTO();
|
|
|
- dto.setCipherText(jsonObject.getString("response"));
|
|
|
+ dto.setCipherText(content);
|
|
|
PrivateKey privateKey =RSAKeyUtils.string2PrivateKey(hfMerchantConfig.getRsaPrivateKey());
|
|
|
PublicKey publicKey = RSAKeyUtils.string2PublicKey(hfMerchantConfig.getRsaPublicKey());
|
|
|
|