liujc 1 年之前
父節點
當前提交
5b3ba15d75

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

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 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 org.apache.commons.collections.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -38,26 +39,54 @@ public class PaymentMerchantConfigServiceImpl extends ServiceImpl<PaymentMerchan
             return;
         }
         for (PaymentMerchantConfig config : list) {
-            PayConfigProperties.AdapayPayConfig adapayPayConfig = new PayConfigProperties.AdapayPayConfig();
-            adapayPayConfig.setEnable(true);
-            adapayPayConfig.setAppId(config.getAppId());
-            adapayPayConfig.setPayType(config.getPaymentVendor());
-            adapayPayConfig.setMerchantId(config.getMerKey());
-            adapayPayConfig.setMerchantId(config.getApiKey());
-            adapayPayConfig.setPayNotifyUrl(properties.getPayNotifyUrl());
-            adapayPayConfig.setRefundNotifyUrl(properties.getRefundNotifyUrl());
-            adapayPayConfig.setKeyPublic(config.getRsaPublicKey());
-            adapayPayConfig.setKeyPrivate(config.getRsaPrivateKey());
-            adapayPayConfig.setWxAppId(config.getWxAppId());
-            adapayPayConfig.setWxAppSecret(config.getWxAppSecret());
-            adapayPayConfig.setSupportCreditCards(properties.getSupportCreditCards());
-            AdapayPaymentServicePlugin plugin = null;
-            try {
-                plugin = new AdapayPaymentServicePlugin(config.getPaymentVendor(), adapayPayConfig, false);
-                PaymentServiceContext.addPlugin(plugin);
-            } catch (Exception e) {
-                log.error("初始化支付插件失败", e);
+            if (config.getPaymentVendor().equals("adapay")) {
+
+                PayConfigProperties.AdapayPayConfig adapayPayConfig = new PayConfigProperties.AdapayPayConfig();
+                adapayPayConfig.setEnable(true);
+                adapayPayConfig.setAppId(config.getAppId());
+                adapayPayConfig.setPayType(config.getPaymentVendor());
+                adapayPayConfig.setMerchantId(config.getMerKey());
+                adapayPayConfig.setMerchantId(config.getApiKey());
+                adapayPayConfig.setPayNotifyUrl(properties.getPayNotifyUrl());
+                adapayPayConfig.setRefundNotifyUrl(properties.getRefundNotifyUrl());
+                adapayPayConfig.setKeyPublic(config.getRsaPublicKey());
+                adapayPayConfig.setKeyPrivate(config.getRsaPrivateKey());
+                adapayPayConfig.setWxAppId(config.getWxAppId());
+                adapayPayConfig.setWxAppSecret(config.getWxAppSecret());
+                adapayPayConfig.setSupportCreditCards(properties.getSupportCreditCards());
+                AdapayPaymentServicePlugin plugin = null;
+                try {
+                    plugin = new AdapayPaymentServicePlugin(config.getPaymentVendor(), adapayPayConfig, false);
+                    PaymentServiceContext.addPlugin(plugin);
+                } catch (Exception e) {
+                    log.error("初始化支付插件失败", e);
+                }
+            } else if (config.getPaymentVendor().equals("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());
+                yeepayPayConfig.setKeyPrivate(config.getRsaPrivateKey());
+                yeepayPayConfig.setWxAppId(config.getWxAppId());
+                yeepayPayConfig.setWxAppSecret(config.getWxAppSecret());
+                yeepayPayConfig.setSupportCreditCards(properties.getSupportCreditCards());
+                yeepayPayConfig.setAlipayAppId(config.getAlipayAppId());
+                yeepayPayConfig.setAlipayPrivateKey(config.getAlipayPrivateKey());
+                yeepayPayConfig.setAlipayPrivateKey(config.getAlipayPublicKey());
+                YeepayPaymentServicePlugin plugin = null;
+                try {
+                    plugin = new YeepayPaymentServicePlugin(config.getPaymentVendor(), yeepayPayConfig, false);
+                    PaymentServiceContext.addPlugin(plugin);
+                } catch (Exception e) {
+                    log.error("初始化支付插件失败", e);
+                }
             }
+
         }
 
     }