|
@@ -189,6 +189,29 @@ public class PayMerchantServiceImpl extends ServiceImpl<PayMerchantMapper, PayMe
|
|
|
.eq(PayMerchant::getId, id));
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public boolean secretKeyUpdate(Long id, String secretKey) {
|
|
|
+ PayMerchant payMerchant = super.getById(id);
|
|
|
+ if (payMerchant == null) {
|
|
|
+ throw new BaseException("参数错误, 商户信息不存在");
|
|
|
+ }
|
|
|
+ Map<String, String> configMap = new HashMap<>(4);
|
|
|
+ if (Objects.equals(payMerchant.getPayWayId().intValue(), PayWayEnum.ALI_PAY.getPayWayId())) {
|
|
|
+ configMap.put("protocol", "https");
|
|
|
+ configMap.put("gatewayHost", "openapi.alipay.com");
|
|
|
+ configMap.put("signType", "RSA2");
|
|
|
+ configMap.put("alipayPublicKey", secretKey);
|
|
|
+ }
|
|
|
+ if (Objects.equals(payMerchant.getPayWayId().intValue(), PayWayEnum.WX_PAY.getPayWayId())) {
|
|
|
+ configMap.put("mchId", payMerchant.getMerchantNo());
|
|
|
+ configMap.put("apiKey", secretKey);
|
|
|
+ configMap.put("signType", "MD5");
|
|
|
+ }
|
|
|
+ payMerchant.setPayConfig(JsonUtil.toString(configMap));
|
|
|
+ return super.updateById(payMerchant);
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public boolean deleteById(Long id) {
|