From bd82a9f3c4291684cd57caf200f033f771a11e8c Mon Sep 17 00:00:00 2001 From: yixian Date: Mon, 15 Feb 2021 13:03:15 +0800 Subject: [PATCH] add copy upay profile api --- .../impls/MerchantChannelPermissionServiceImpl.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/MerchantChannelPermissionServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/MerchantChannelPermissionServiceImpl.java index 341123324..389b411d6 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/MerchantChannelPermissionServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/MerchantChannelPermissionServiceImpl.java @@ -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);