|
|
@@ -10,6 +10,7 @@ import com.github.binarywang.wxpay.exception.WxPayException;
|
|
|
import com.github.binarywang.wxpay.service.WxPayService;
|
|
|
import com.izouma.nineth.config.AlipayProperties;
|
|
|
import com.izouma.nineth.enums.PayMethod;
|
|
|
+import com.izouma.nineth.service.AssetService;
|
|
|
import com.izouma.nineth.service.OrderService;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
@@ -36,6 +37,7 @@ public class OrderNotifyController {
|
|
|
private final AlipayProperties alipayProperties;
|
|
|
private final OrderService orderService;
|
|
|
private final WxPayService wxPayService;
|
|
|
+ private final AssetService assetService;
|
|
|
|
|
|
@PostMapping("/order/alipay")
|
|
|
@ResponseBody
|
|
|
@@ -65,10 +67,16 @@ public class OrderNotifyController {
|
|
|
JSONObject body = JSON.parseObject(params.get("body"));
|
|
|
String action = body.getString("action");
|
|
|
switch (action) {
|
|
|
- case "payOrder":
|
|
|
+ case "payOrder": {
|
|
|
Long orderId = body.getLong("orderId");
|
|
|
orderService.notifyAlipay(orderId, PayMethod.ALIPAY, MapUtils.getString(params, "trade_no"));
|
|
|
break;
|
|
|
+ }
|
|
|
+ case "payGiftOrder": {
|
|
|
+ Long orderId = body.getLong("orderId");
|
|
|
+ assetService.giftNotify(orderId, PayMethod.ALIPAY, MapUtils.getString(params, "trade_no"));
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
return "success";
|
|
|
}
|
|
|
@@ -84,10 +92,16 @@ public class OrderNotifyController {
|
|
|
JSONObject attach = JSONObject.parseObject(notifyResult.getAttach());
|
|
|
String action = attach.getString("action");
|
|
|
switch (action) {
|
|
|
- case "payOrder":
|
|
|
+ case "payOrder": {
|
|
|
Long orderId = attach.getLong("orderId");
|
|
|
orderService.notifyAlipay(orderId, PayMethod.WEIXIN, notifyResult.getTransactionId());
|
|
|
break;
|
|
|
+ }
|
|
|
+ case "payGiftOrder": {
|
|
|
+ Long orderId = attach.getLong("orderId");
|
|
|
+ assetService.giftNotify(orderId, PayMethod.WEIXIN, notifyResult.getTransactionId());
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
return WxPayNotifyResponse.success("OK");
|
|
|
}
|