diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java index 7f1e41efd..0c275a206 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java @@ -553,6 +553,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid resolver.newOrderEnabled(client, null, PlatformEnvironment.getEnv().getForeignCurrency())) { client.put("enable_alipayplus", true); } + client.put("enable_alipayaps", false); + MerchantChannelPermissionResolver resolverAps = this.paymentApi.channelApi(PayChannel.ALIPAY_APS.getChannelCode()).getChannelPermissionResolver(); + if (!Objects.isNull(resolver) && + resolverAps.newOrderEnabled(client, null, PlatformEnvironment.getEnv().getForeignCurrency())) { + client.put("enable_alipayaps", true); + } ApsConfigData apsConfig = apsConfigService.getApsConfigByClientId(client.getString("client_id")); if (apsConfig == null) { apsConfig = apsConfigService.saveApsConfigClientId(manager.getString("manager_id"), client.getString("client_id"), new ApsConfigDescriptor()); @@ -1588,9 +1594,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid throw new NotFoundException("Client Not Exists"); } try { - clientModifySupport.processModify(new SwitchChannelPermissionModify(manager, clientMoniker, merchantInfoProvider, paymentApi.channelApi(channel).getChannelPermissionResolver(), allow)); + clientModifySupport.processModify(new SwitchChannelPermissionModify(manager, clientMoniker, merchantInfoProvider, channelApi.getChannelPermissionResolver(), allow)); } catch (Exception e) { - logger.error("Failed to change channel switch:{}", channel); + logger.error("Failed to change channel switch:{}", channel,e); } logger.info("{}({}) switched client {} channel {} to {}", manager.getString("display_name"), manager.getString("manager_id"), clientMoniker, channel, allow); if (allow && (StringUtils.equalsAnyIgnoreCase("Wechat", channel) || StringUtils.equalsAnyIgnoreCase("Alipay", channel))) { diff --git a/src/main/ui/static/templates/alipayaps/v1/payment.js b/src/main/ui/static/templates/alipayaps/v1/payment.js index 9f846d9df..0a49f9143 100644 --- a/src/main/ui/static/templates/alipayaps/v1/payment.js +++ b/src/main/ui/static/templates/alipayaps/v1/payment.js @@ -258,14 +258,14 @@ $(function () { data.qrcodeVersion = window.qrcodeVersion; $.ajax({ - url: '/api/v1.0/alipay/partners/' + window.client_moniker + '/orders', + url: '/api/v1.0/alipay_aps/partners/' + window.client_moniker + '/orders', method: 'POST', data: JSON.stringify(data), contentType: 'application/json', dataType: 'json', success: function (pay) { if (pay.direct_paid) { - location.href = '/api/v1.0/alipay/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result'; + location.href = '/api/v1.0/alipay_aps/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result'; return; } if (pay.mweb_url){ @@ -294,7 +294,7 @@ $(function () { }, closeCurrentApp: false }); - startCheckOrder(pay.order_id, '/api/v1.0/alipay/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result'); + startCheckOrder(pay.order_id, '/api/v1.0/alipay_aps/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result'); } else if (res.resultCode == '6001') { //do nothing } else { diff --git a/src/main/ui/static/templates/alipayaps/v4/payment.js b/src/main/ui/static/templates/alipayaps/v4/payment.js index 43c4c0012..be2d64c9a 100644 --- a/src/main/ui/static/templates/alipayaps/v4/payment.js +++ b/src/main/ui/static/templates/alipayaps/v4/payment.js @@ -303,14 +303,14 @@ $(function () { data.coupons = dataCache.coupons; data.qrcodeVersion = window.qrcodeVersion; $.ajax({ - url: '/api/v1.0/alipay/partners/' + window.client_moniker + '/orders', + url: '/api/v1.0/alipay_aps/partners/' + window.client_moniker + '/orders', method: 'POST', data: JSON.stringify(data), contentType: 'application/json', dataType: 'json', success: function (pay) { if (pay.direct_paid) { - location.href = '/api/v1.0/alipay/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result'; + location.href = '/api/v1.0/alipay_aps/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result'; return; } if (pay.mweb_url){ @@ -339,7 +339,7 @@ $(function () { }, closeCurrentApp: false }); - startCheckOrder(pay.order_id, '/api/v1.0/alipay/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result'); + startCheckOrder(pay.order_id, '/api/v1.0/alipay_aps/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result'); } else if (res.resultCode == '6001') { //do nothing } else { diff --git a/src/main/ui/static/templates/alipayaps/v5/payment.js b/src/main/ui/static/templates/alipayaps/v5/payment.js index 5c1498ad3..759356aff 100644 --- a/src/main/ui/static/templates/alipayaps/v5/payment.js +++ b/src/main/ui/static/templates/alipayaps/v5/payment.js @@ -266,14 +266,14 @@ $(function () { data.coupons = dataCache.coupons; data.qrcodeVersion = window.qrcodeVersion; $.ajax({ - url: '/api/v1.0/alipay/partners/' + window.client_moniker + '/orders', + url: '/api/v1.0/alipay_aps/partners/' + window.client_moniker + '/orders', method: 'POST', data: JSON.stringify(data), contentType: 'application/json', dataType: 'json', success: function (pay) { if (pay.direct_paid) { - location.href = '/api/v1.0/alipay/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result'; + location.href = '/api/v1.0/alipay_aps/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result'; return; } if (pay.mweb_url){ @@ -302,7 +302,7 @@ $(function () { }, closeCurrentApp: false }); - startCheckOrder(pay.order_id, '/api/v1.0/alipay/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result'); + startCheckOrder(pay.order_id, '/api/v1.0/alipay_aps/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result'); } else if (res.resultCode == '6001') { //do nothing } else {