|
@@ -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);
|
|
|
}
|
|
|
|
|
|
}
|