From 06aa10563a07f670d79932eef24a3457201427fe Mon Sep 17 00:00:00 2001 From: Yixian Date: Wed, 30 Mar 2022 14:37:39 +0800 Subject: [PATCH] hotfix: copy mw config --- .../core/impls/MerchantChannelPermissionServiceImpl.java | 9 +++++++-- 1 file changed, 7 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 e8be89cff..6d5681fe0 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 @@ -2,6 +2,7 @@ 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.core.PaymentApi; import au.com.royalpay.payment.manage.mappers.system.ClientRateMapper; import au.com.royalpay.payment.manage.mappers.system.SysClientUpayProfileMapper; import au.com.royalpay.payment.manage.merchants.core.ClientManager; @@ -30,6 +31,8 @@ public class MerchantChannelPermissionServiceImpl implements MerchantChannelPerm private RPayMerchantMapper rPayMerchantMapper; @Resource private ClientRateMapper clientRateMapper; + @Resource + private PaymentApi paymentApi; @Override @Transactional @@ -66,8 +69,10 @@ public class MerchantChannelPermissionServiceImpl implements MerchantChannelPerm targetRPayMch.setClientMoniker(targetMerchant.getString("client_moniker")); rPayMerchantMapper.save(targetRPayMch); } - clientManager.switchPermission(manager, targetClientMoniker, "enable_rpaypmt_card", sourceMerchant.getBooleanValue("enable_rpaypmt_card")); - clientManager.switchPermission(manager, targetClientMoniker, "enable_rpaypmt_dd", sourceMerchant.getBooleanValue("enable_rpaypmt_dd")); + boolean enableCard = paymentApi.channelApi(PayChannel.RPAY_CHANNEL_CARD.getChannelCode()).getChannelPermissionResolver().channelEnabled(sourceMerchant); + boolean enableDd = paymentApi.channelApi(PayChannel.RPAY_CHANNEL_DD.getChannelCode()).getChannelPermissionResolver().channelEnabled(sourceMerchant); + clientManager.switchChannelPermission(manager, targetClientMoniker, PayChannel.RPAY_CHANNEL_CARD.getChannelCode(), enableCard); + clientManager.switchChannelPermission(manager, targetClientMoniker, PayChannel.RPAY_CHANNEL_DD.getChannelCode(), enableDd); try { merchantInfoProvider.clientCurrentRate(targetClientId, new Date(), PayChannel.RPAY_CHANNEL_CARD.getChannelCode()); } catch (NoRateConfigException e) {