|
@@ -48,8 +48,17 @@ public class StripeController {
|
|
|
|
|
|
@PostMapping("/webhook")
|
|
|
public synchronized ResultData webhook(@RequestBody JSONObject webhookObj){
|
|
|
- StripeWebhookLog stripeWebhookLog = new StripeWebhookLog();
|
|
|
+
|
|
|
String type = webhookObj.getString("type");
|
|
|
+ String msgId = webhookObj.getString("id");
|
|
|
+ StripeWebhookLog stripeWebhookLog = stripeWebhookLogService.getByMsgId(msgId);
|
|
|
+ if(stripeWebhookLog == null){
|
|
|
+ stripeWebhookLog = new StripeWebhookLog();
|
|
|
+ }else {
|
|
|
+ log.info("stripe-webhook-重复:{}",webhookObj);
|
|
|
+ return ResultData.ok();
|
|
|
+ }
|
|
|
+ stripeWebhookLog.setMsgId(msgId);
|
|
|
stripeWebhookLog.setEventType(type);
|
|
|
stripeWebhookLog.setMsg(webhookObj.toJSONString());
|
|
|
stripeWebhookLogService.save(stripeWebhookLog);
|
|
@@ -85,7 +94,7 @@ public class StripeController {
|
|
|
log.info("订单号为:id:{},trade_no:{},orderId:{},subscriptionId:{}",id,trade_no,orderId,subscriptionId);
|
|
|
if(orderId != null){
|
|
|
order = orderService.getByOrderSn(orderId);
|
|
|
- if( order != null){
|
|
|
+ if( order != null ){
|
|
|
orderService.payResult(order,true,trade_no,customer);
|
|
|
}
|
|
|
}
|