|
|
|
@ -9,6 +9,7 @@ import au.com.royalpay.payment.manage.merchants.core.ClientManager;
|
|
|
|
|
import au.com.royalpay.payment.manage.merchants.core.MerchantChannelPermissionService;
|
|
|
|
|
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 com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
@ -34,7 +35,13 @@ public class MerchantChannelPermissionServiceImpl implements MerchantChannelPerm
|
|
|
|
|
@Transactional
|
|
|
|
|
public RPayMerchantEntity copyMerchantWarriorConfig(JSONObject manager, String targetClientMoniker, String sourceClientMoniker) {
|
|
|
|
|
JSONObject targetMerchant = merchantInfoProvider.getClientInfoByMoniker(targetClientMoniker);
|
|
|
|
|
if (targetMerchant == null) {
|
|
|
|
|
throw new NotFoundException("Merchant not found:" + targetClientMoniker);
|
|
|
|
|
}
|
|
|
|
|
JSONObject sourceMerchant = merchantInfoProvider.getClientInfoByMoniker(sourceClientMoniker);
|
|
|
|
|
if (sourceMerchant == null) {
|
|
|
|
|
throw new NotFoundException("Merchant not found:" + sourceClientMoniker);
|
|
|
|
|
}
|
|
|
|
|
int sourceClientId = sourceMerchant.getIntValue("client_id");
|
|
|
|
|
int targetClientId = targetMerchant.getIntValue("client_id");
|
|
|
|
|
JSONObject targetProfile = sysClientUpayProfileMapper.findInfo(targetClientId);
|
|
|
|
@ -61,8 +68,8 @@ 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 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);
|
|
|
|
|