liujc 1 年之前
父节点
当前提交
8a8f9221f2

+ 5 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/PaymentMerchantConfig.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.IdType;
+import com.yonge.cooleshow.common.enums.EPayerType;
 import lombok.Data;
 
 import io.swagger.annotations.ApiModel;
@@ -30,6 +31,10 @@ public class PaymentMerchantConfig implements Serializable {
 	@TableField(value = "tenant_id_")
     private Long tenantId;
 
+    @ApiModelProperty("支付类型 ADAPAY,YEEPAY")
+    @TableField(value = "payer_type_")
+    private EPayerType payerType;
+
     @ApiModelProperty("支付厂商") 
 	@TableField(value = "payment_vendor_")
     private String paymentVendor;

+ 10 - 6
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/PaymentMerchantConfigServiceImpl.java

@@ -7,6 +7,7 @@ import com.microsvc.toolkit.middleware.payment.common.api.PaymentServiceContext;
 import com.microsvc.toolkit.middleware.payment.impl.AdapayPaymentServicePlugin;
 import com.microsvc.toolkit.middleware.payment.impl.YeepayPaymentServicePlugin;
 import com.microsvc.toolkit.middleware.payment.properties.PayConfigProperties;
+import com.yonge.cooleshow.common.enums.EPayerType;
 import org.apache.commons.collections.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -39,13 +40,15 @@ public class PaymentMerchantConfigServiceImpl extends ServiceImpl<PaymentMerchan
             return;
         }
         for (PaymentMerchantConfig config : list) {
-            if (config.getPaymentVendor().equals("adapay")) {
+            if (config.getPayerType() == null) {
+
+            } else if (config.getPayerType().equals(EPayerType.ADAPAY)) {
 
                 PayConfigProperties.AdapayPayConfig adapayPayConfig = new PayConfigProperties.AdapayPayConfig();
                 adapayPayConfig.setEnable(true);
                 adapayPayConfig.setAppId(config.getAppId());
                 adapayPayConfig.setPayType(config.getPaymentVendor());
-                adapayPayConfig.setMerchantId(config.getMerKey());
+                adapayPayConfig.setMerchantKey(config.getMerKey());
                 adapayPayConfig.setMerchantId(config.getApiKey());
                 adapayPayConfig.setPayNotifyUrl(properties.getPayNotifyUrl());
                 adapayPayConfig.setRefundNotifyUrl(properties.getRefundNotifyUrl());
@@ -61,13 +64,12 @@ public class PaymentMerchantConfigServiceImpl extends ServiceImpl<PaymentMerchan
                 } catch (Exception e) {
                     log.error("初始化支付插件失败", e);
                 }
-            } else if (config.getPaymentVendor().equals("yeepay")){
+            } else if (config.getPayerType().equals(EPayerType.YEEPAY)){
                 PayConfigProperties.YeepayPayConfig yeepayPayConfig = new PayConfigProperties.YeepayPayConfig();
                 yeepayPayConfig.setEnable(true);
                 yeepayPayConfig.setAppId(config.getAppId());
                 yeepayPayConfig.setPayType(config.getPaymentVendor());
                 yeepayPayConfig.setMerchantId(config.getMerKey());
-                yeepayPayConfig.setMerchantId(config.getApiKey());
                 yeepayPayConfig.setPayNotifyUrl(properties.getPayNotifyUrl());
                 yeepayPayConfig.setRefundNotifyUrl(properties.getRefundNotifyUrl());
                 yeepayPayConfig.setKeyPublic(config.getRsaPublicKey());
@@ -77,14 +79,16 @@ public class PaymentMerchantConfigServiceImpl extends ServiceImpl<PaymentMerchan
                 yeepayPayConfig.setSupportCreditCards(properties.getSupportCreditCards());
                 yeepayPayConfig.setAlipayAppId(config.getAlipayAppId());
                 yeepayPayConfig.setAlipayPrivateKey(config.getAlipayPrivateKey());
-                yeepayPayConfig.setAlipayPrivateKey(config.getAlipayPublicKey());
-                YeepayPaymentServicePlugin plugin = null;
+                yeepayPayConfig.setAlipayPublicKey(config.getAlipayPublicKey());
+                YeepayPaymentServicePlugin plugin;
                 try {
                     plugin = new YeepayPaymentServicePlugin(config.getPaymentVendor(), yeepayPayConfig, false);
                     PaymentServiceContext.addPlugin(plugin);
                 } catch (Exception e) {
                     log.error("初始化支付插件失败", e);
                 }
+            } else {
+                log.error("数据错误 {}", config);
             }
 
         }

+ 1 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserPaymentCoreServiceImpl.java

@@ -793,6 +793,7 @@ public class UserPaymentCoreServiceImpl implements UserPaymentCoreService {
                 .merOrderNo(reqConfig.getMerOrderNo())
                 .code(reqConfig.getCode());
 
+            config.setIp(reqConfig.getIp());
             // 重新格式化设置价格
             config.setPrice(config.getPrice().setScale(2, RoundingMode.HALF_UP));
             log.info("executePayment reqConfig={}", config.jsonString());