Showing
2 changed files
with
6 additions
and
5 deletions
| ... | @@ -42,8 +42,8 @@ public class PayController { | ... | @@ -42,8 +42,8 @@ public class PayController { |
| 42 | @ApiOperation(value = "支付通知") | 42 | @ApiOperation(value = "支付通知") |
| 43 | @PostMapping(value = "/pay/callback") | 43 | @PostMapping(value = "/pay/callback") |
| 44 | @ResponseStatus(HttpStatus.OK) | 44 | @ResponseStatus(HttpStatus.OK) |
| 45 | - public void callback(@Valid @RequestBody PaymentCallbackDTO paymentCallbackDTO) { | 45 | + public boolean callback(@Valid @RequestBody PaymentCallbackDTO paymentCallbackDTO) { |
| 46 | - payServiceClient.callback(paymentCallbackDTO); | 46 | + return payServiceClient.callback(paymentCallbackDTO); |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | } | 49 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -105,7 +105,7 @@ public class PayServiceClient { | ... | @@ -105,7 +105,7 @@ public class PayServiceClient { |
| 105 | } | 105 | } |
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | - public void callback(PaymentCallbackDTO paymentCallbackDTO) { | 108 | + public boolean callback(PaymentCallbackDTO paymentCallbackDTO) { |
| 109 | log.info("callback request received: {}", paymentCallbackDTO); | 109 | log.info("callback request received: {}", paymentCallbackDTO); |
| 110 | try { | 110 | try { |
| 111 | final var paymentCallbackResult = xmlMapper.readValue(paymentCallbackDTO.getPayResult(), PaymentCallbackResult.class); | 111 | final var paymentCallbackResult = xmlMapper.readValue(paymentCallbackDTO.getPayResult(), PaymentCallbackResult.class); |
| ... | @@ -114,11 +114,11 @@ public class PayServiceClient { | ... | @@ -114,11 +114,11 @@ public class PayServiceClient { |
| 114 | final var orderById = orderServiceRpcClient.getOrderById(orderId); | 114 | final var orderById = orderServiceRpcClient.getOrderById(orderId); |
| 115 | if (orderById == null) { | 115 | if (orderById == null) { |
| 116 | log.error("Order not found, orderId: {}", orderId); | 116 | log.error("Order not found, orderId: {}", orderId); |
| 117 | - return; | 117 | + return false; |
| 118 | } | 118 | } |
| 119 | if (orderById.getPayStatus() == PayStatusEnum.SUCCEED || orderById.getPayStatus() == PayStatusEnum.FAILED) { | 119 | if (orderById.getPayStatus() == PayStatusEnum.SUCCEED || orderById.getPayStatus() == PayStatusEnum.FAILED) { |
| 120 | log.info("Order {} already processed, skipping.", orderId); | 120 | log.info("Order {} already processed, skipping.", orderId); |
| 121 | - return; | 121 | + return true; |
| 122 | } | 122 | } |
| 123 | long payTime; | 123 | long payTime; |
| 124 | try { | 124 | try { |
| ... | @@ -146,6 +146,7 @@ public class PayServiceClient { | ... | @@ -146,6 +146,7 @@ public class PayServiceClient { |
| 146 | .build(); | 146 | .build(); |
| 147 | final var updateResponse = orderServiceRpcClient.updateClientCustomerOrderPaymentResult(orderById, build); | 147 | final var updateResponse = orderServiceRpcClient.updateClientCustomerOrderPaymentResult(orderById, build); |
| 148 | log.info("callback updateClientCustomerOrder result: {}", updateResponse.getIsUpdated()); | 148 | log.info("callback updateClientCustomerOrder result: {}", updateResponse.getIsUpdated()); |
| 149 | + return updateResponse.getIsUpdated(); | ||
| 149 | } catch (JsonProcessingException e) { | 150 | } catch (JsonProcessingException e) { |
| 150 | log.error("Failed to parse XML response, raw XML: {}", paymentCallbackDTO.getPayResult(), e); | 151 | log.error("Failed to parse XML response, raw XML: {}", paymentCallbackDTO.getPayResult(), e); |
| 151 | throw new RuntimeException("支付通知结果解析失败", e); | 152 | throw new RuntimeException("支付通知结果解析失败", e); | ... | ... |
-
Please register or login to post a comment