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