add copy upay profile api-ui

master
yixian 4 years ago
parent 273468c56b
commit a25cc7c767

@ -5,11 +5,11 @@
<parent>
<groupId>au.com.royalpay.payment</groupId>
<artifactId>payment-parent</artifactId>
<version>2.2.25</version>
<version>2.2.26</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>manage</artifactId>
<version>2.3.76-SNAPSHOT</version>
<version>2.3.77-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jib-maven-plugin.version>2.4.0</jib-maven-plugin.version>

@ -3,7 +3,6 @@ package au.com.royalpay.payment.manage.merchants.core.impls;
import au.com.royalpay.payment.channels.rpaypaymentsvc.mappers.RPayMerchantMapper;
import au.com.royalpay.payment.channels.rpaypaymentsvc.runtime.request.entities.RPayMerchantEntity;
import au.com.royalpay.payment.manage.mappers.system.ClientRateMapper;
import au.com.royalpay.payment.manage.mappers.system.RateMapper;
import au.com.royalpay.payment.manage.mappers.system.SysClientUpayProfileMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.merchants.core.MerchantChannelPermissionService;
@ -11,6 +10,7 @@ import au.com.royalpay.payment.tools.defines.PayChannel;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.NotFoundException;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
import au.com.royalpay.payment.tools.merchants.exceptions.NoRateConfigException;
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -68,12 +68,13 @@ public class MerchantChannelPermissionServiceImpl implements MerchantChannelPerm
}
clientManager.switchPermission(manager, targetClientMoniker, "enable_rpaypmt_card", sourceMerchant.getBooleanValue("enable_rpaypmt_card"));
clientManager.switchPermission(manager, targetClientMoniker, "enable_rpaypmt_dd", sourceMerchant.getBooleanValue("enable_rpaypmt_dd"));
JSONObject targetRate = merchantInfoProvider.clientCurrentRate(targetClientId, new Date(), PayChannel.RPAY_CHANNEL_CARD.getChannelCode());
if (targetRate == null) {
JSONObject sourceRate = merchantInfoProvider.clientCurrentRate(sourceClientId, new Date(), PayChannel.RPAY_CHANNEL_CARD.getChannelCode());
targetRate = new JSONObject(sourceRate);
targetRate.put("client_id", targetClientId);
clientRateMapper.saveRate(targetRate);
try {
merchantInfoProvider.clientCurrentRate(targetClientId, new Date(), PayChannel.RPAY_CHANNEL_CARD.getChannelCode());
} catch (NoRateConfigException e) {
JSONObject rate = merchantInfoProvider.clientCurrentRate(sourceClientId, new Date(), PayChannel.RPAY_CHANNEL_CARD.getChannelCode());
rate.put("client_id", targetClientId);
rate.remove("client_rate_id");
clientRateMapper.saveRate(rate);
}
return targetRPayMch;
}

@ -5,8 +5,8 @@ spring:
master:
driver-class-name: com.mysql.cj.jdbc.Driver
jdbc-url: jdbc:mysql://${spring.datasource.host}/${spring.datasource.schema-name}?useUnicode=true&characterEncoding=utf8&useSSL=false
password: read0nly
username: readonly
password: ZOIBhellor0yalpay
username: root
schema-name: royalpay_production
slave:
driver-class-name: com.mysql.cj.jdbc.Driver

@ -0,0 +1,30 @@
package au.com.royalpay.payment.manage.merchants.core.impls;
import au.com.royalpay.payment.manage.mappers.system.ManagerMapper;
import au.com.royalpay.payment.manage.merchants.core.MerchantChannelPermissionService;
import com.alibaba.fastjson.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource;
@RunWith(SpringRunner.class)
@SpringBootTest
@ActiveProfiles({"proxy","common", "alipay", "wechat", "rpay", "rppaysvc"})
public class MerchantChannelPermissionServiceImplTest {
@Resource
private MerchantChannelPermissionService merchantChannelPermissionService;
@Resource
private ManagerMapper managerMapper;
@Test
public void test() {
JSONObject manager = managerMapper.findByLoginId("yixian");
merchantChannelPermissionService.copyMerchantWarriorConfig(manager, "DV11", "DV02");
}
}
Loading…
Cancel
Save