add copy upay profile api-ui

master
yixian 4 years ago
parent 273468c56b
commit a25cc7c767

@ -5,11 +5,11 @@
<parent> <parent>
<groupId>au.com.royalpay.payment</groupId> <groupId>au.com.royalpay.payment</groupId>
<artifactId>payment-parent</artifactId> <artifactId>payment-parent</artifactId>
<version>2.2.25</version> <version>2.2.26</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>manage</artifactId> <artifactId>manage</artifactId>
<version>2.3.76-SNAPSHOT</version> <version>2.3.77-SNAPSHOT</version>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jib-maven-plugin.version>2.4.0</jib-maven-plugin.version> <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.mappers.RPayMerchantMapper;
import au.com.royalpay.payment.channels.rpaypaymentsvc.runtime.request.entities.RPayMerchantEntity; 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.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.mappers.system.SysClientUpayProfileMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientManager; import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.merchants.core.MerchantChannelPermissionService; 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.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.NotFoundException; import au.com.royalpay.payment.tools.exceptions.NotFoundException;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider; import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
import au.com.royalpay.payment.tools.merchants.exceptions.NoRateConfigException;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; 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_card", sourceMerchant.getBooleanValue("enable_rpaypmt_card"));
clientManager.switchPermission(manager, targetClientMoniker, "enable_rpaypmt_dd", sourceMerchant.getBooleanValue("enable_rpaypmt_dd")); clientManager.switchPermission(manager, targetClientMoniker, "enable_rpaypmt_dd", sourceMerchant.getBooleanValue("enable_rpaypmt_dd"));
JSONObject targetRate = merchantInfoProvider.clientCurrentRate(targetClientId, new Date(), PayChannel.RPAY_CHANNEL_CARD.getChannelCode()); try {
if (targetRate == null) { merchantInfoProvider.clientCurrentRate(targetClientId, new Date(), PayChannel.RPAY_CHANNEL_CARD.getChannelCode());
JSONObject sourceRate = merchantInfoProvider.clientCurrentRate(sourceClientId, new Date(), PayChannel.RPAY_CHANNEL_CARD.getChannelCode()); } catch (NoRateConfigException e) {
targetRate = new JSONObject(sourceRate); JSONObject rate = merchantInfoProvider.clientCurrentRate(sourceClientId, new Date(), PayChannel.RPAY_CHANNEL_CARD.getChannelCode());
targetRate.put("client_id", targetClientId); rate.put("client_id", targetClientId);
clientRateMapper.saveRate(targetRate); rate.remove("client_rate_id");
clientRateMapper.saveRate(rate);
} }
return targetRPayMch; return targetRPayMch;
} }

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