| | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.security.MessageDigest; |
| | | import java.security.NoSuchAlgorithmException; |
| | |
| | | @RequestParam("currency") String currency, |
| | | @RequestParam("paydate") String payDate, |
| | | @RequestParam("approcode") String appCode, |
| | | @RequestParam("skey") String receivedSkey, |
| | | HttpServletResponse response) throws IOException{ |
| | | @RequestParam("skey") String receivedSkey) throws IOException{ |
| | | |
| | | // 计算 skey 验证 |
| | | String calculatedSkey = calculateSkey(tranId, orderId, status, domain, amount, currency, payDate, appCode); |
| | |
| | | log.info("callback calculatedSkey: {}", calculatedSkey); |
| | | log.info("callback payResult: {}", mallOrderInfo.getPayResult()); |
| | | if("1".equals(mallOrderInfo.getPayResult())){ |
| | | response.sendRedirect("/pages/order/pay/paySuccess?amount="+amount+"&type=3"); |
| | | return; |
| | | } |
| | | if (!calculatedSkey.equalsIgnoreCase(receivedSkey)) { |
| | |
| | | } |
| | | if ("00".equals(status)) { |
| | | updateOrderStatus(orderId, status, amount, payDate, tranId); |
| | | response.sendRedirect("/pages/order/pay/paySuccess?amount="+amount+"&type=3"); |
| | | return; |
| | | } |
| | | } |