|
@@ -9,13 +9,17 @@ import com.fasterxml.jackson.databind.JsonNode;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.szwl.common.AccessTokenCommon;
|
|
|
import com.szwl.constant.AirwallexConstant;
|
|
|
+import com.szwl.feign.bean.SzwlFeign;
|
|
|
import com.szwl.model.bean.PaymentIntentRequestBody;
|
|
|
import com.szwl.model.bean.RefundRequestBody;
|
|
|
+import com.szwl.model.bo.JsonMessage;
|
|
|
import com.szwl.model.bo.R;
|
|
|
import com.szwl.model.bo.ResponseModel;
|
|
|
import com.szwl.model.dto.*;
|
|
|
+import com.szwl.model.entity.TAdmin;
|
|
|
import com.szwl.model.entity.TAirwallexPayment;
|
|
|
import com.szwl.model.entity.TCoinOrder;
|
|
|
+import com.szwl.model.entity.TEquipment;
|
|
|
import com.szwl.model.utils.AccessTokenThreadUtil;
|
|
|
import com.szwl.service.*;
|
|
|
import io.swagger.annotations.Api;
|
|
@@ -48,11 +52,14 @@ public class AirwallexPayController {
|
|
|
|
|
|
TAirwallexPaymentService tAirwallexPaymentService;
|
|
|
|
|
|
- public AirwallexPayController(TAdminService tAdminService, AirwallexService airwallexService, TCoinOrderService tCoinOrderService, TAirwallexPaymentService tAirwallexPaymentService) {
|
|
|
+ SzwlFeign szwlFeign;
|
|
|
+
|
|
|
+ public AirwallexPayController(TAdminService tAdminService, AirwallexService airwallexService, TCoinOrderService tCoinOrderService, TAirwallexPaymentService tAirwallexPaymentService, SzwlFeign szwlFeign) {
|
|
|
this.tAdminService = tAdminService;
|
|
|
this.airwallexService = airwallexService;
|
|
|
this.tCoinOrderService = tCoinOrderService;
|
|
|
this.tAirwallexPaymentService = tAirwallexPaymentService;
|
|
|
+ this.szwlFeign = szwlFeign;
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "创建收款人")
|
|
@@ -107,6 +114,7 @@ public class AirwallexPayController {
|
|
|
|
|
|
/**
|
|
|
* 创建付款意向 - 消费者发起
|
|
|
+ *
|
|
|
* @param paymentIntentRequestBody
|
|
|
* @return
|
|
|
*/
|
|
@@ -136,6 +144,19 @@ public class AirwallexPayController {
|
|
|
String productName = paymentIntentRequestBody.getProductName();
|
|
|
String clientId = paymentIntentRequestBody.getClientId();
|
|
|
Long equipmentId = paymentIntentRequestBody.getEquipmentId();
|
|
|
+
|
|
|
+ // 七云还是申泽
|
|
|
+ TEquipment equipment = R.getDataIfSuccess(szwlFeign.findEquipmentByClientId(clientId));
|
|
|
+// System.out.println("设备信息:>>> " + equipment);
|
|
|
+ String machineType = equipment.getMachineType(); // 设备类型
|
|
|
+ Long adminId = equipment.getAdminId();
|
|
|
+ if (adminId == null) {
|
|
|
+ return R.fail("找不到设备商家");
|
|
|
+ }
|
|
|
+ TAdmin byId = tAdminService.getById(adminId);
|
|
|
+ String companyType = byId.getCompanyType(); // 公司类型
|
|
|
+
|
|
|
+
|
|
|
// 创建订单
|
|
|
TCoinOrder tCoinOrder = new TCoinOrder();
|
|
|
tCoinOrder.setAmount(amount);
|
|
@@ -149,6 +170,8 @@ public class AirwallexPayController {
|
|
|
// 设置订单支付状态,0未支付,1已支付,3已退款。
|
|
|
tCoinOrder.setStatus("0");
|
|
|
tCoinOrder.setIsAir("1");
|
|
|
+ tCoinOrder.setMachineType(machineType);
|
|
|
+ tCoinOrder.setCompanyType(companyType);
|
|
|
|
|
|
// 返回payment intent id和client secret
|
|
|
Map<String, Object> responseMap = airwallexService.caPaymentIntent(amount, currency, requestId, merchantOrderId);
|
|
@@ -415,7 +438,6 @@ public class AirwallexPayController {
|
|
|
// }
|
|
|
|
|
|
|
|
|
-
|
|
|
// 返回 payment_id
|
|
|
return R.ok(paymentId);
|
|
|
}
|