diff --git a/pom.xml b/pom.xml index 01e19154b..ee1192967 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ 4.0.0 manage - 2.3.78-SNAPSHOT + 2.3.79-SNAPSHOT UTF-8 2.4.0 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 3ad05d758..d4bfadbc0 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 @@ -1371,6 +1371,15 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid public void sendInitEmail(final JSONObject client, String username, String pwd, boolean isUpayAuditPass) { logger.debug("sending email after comply"); + // 配置了部分组织不发送邮件 + JSONObject sysConfig = sysConfigManager.getSysConfig(); + String[] orgs = sysConfig.getString("no_send_email_org").split(","); + for (String org : orgs) { + if (client.getString("org_id").equals(org)) { + logger.info("Merchant of organization does not send email.(org_id:" + org + ")"); + return; + } + } List bds = clientBDMapper.listClientBDInfoAvailable(client.getIntValue("client_id"), new Date()); Context ctx = new Context(); ctx.setVariable("bds", bds); @@ -2004,14 +2013,33 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid configNewClientRate(config, clientId, "AlipayOnline", "alipayonline_rate_value", org, "min_alipayonline_rate"); configNewClientRate(config, clientId, "Rpay", "Rpay_rate_value", org, "min_Rpay_rate"); configNewClientRate(config, clientId, "CB_BankPay", "cb_bankpay_rate_value", org, "min_cb_bankpay_rate"); + addAlipayPlusRateConfig(config,clientId,PayChannel.ALIPAY_PLUS.getChannelCode()); + } + + private void addAlipayPlusRateConfig(JSONObject config,int clientId, String channel){ + if (config.getString("alipay_cn_retail") != null){ + config.put("pay_type","alipay_cn_retail"); + configNewClientRate(config, clientId, channel, "alipay_cn_retail", null, null); + } + if (config.getString("alipay_cn_online")!= null){ + config.put("pay_type","alipay_cn_online"); + configNewClientRate(config, clientId, channel, "alipay_cn_online", null,null); + } + if (config.getString("alipay_other")!= null){ + config.put("pay_type","alipay_other"); + configNewClientRate(config, clientId, channel, "alipay_other", null,null); + } + config.remove("pay_type"); } + private void configNewClientRate(JSONObject config, int clientId, String channel, String rateKey, JSONObject org, String rateValueKey) { if (config.containsKey(rateKey)) { JSONObject newConfig = new JSONObject(); newConfig.putAll(config); newConfig.put("rate_value", config.getBigDecimal(rateKey)); newConfig.put("rate_name", channel); + newConfig.put("pay_type",config.getString("pay_type")); if (!clientRateMapper.listClientRatesForSaving(clientId, config.getDate("active_time"), config.getDate("expiry_time"), config.getBigDecimal("rate_value"), config.getInteger("clean_days"), channel).isEmpty()) { return; } @@ -2024,10 +2052,17 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid newConfig.put("ext_rates", extRateParams.toJSONString()); } else { List existRate = clientRateMapper.listCurrentClientRates(clientId, config.getDate("active_time"), channel); - for (JSONObject rateLog : existRate) { - rateLog.put("expiry_time", DateUtils.addDays(config.getDate("active_time"), -1)); - clientRateMapper.updateConfig(rateLog); - } + existRate.stream().filter(existConfig->{ + if(existConfig.getDate("active_time").equals(config.getDate("active_time")) && existConfig.getDate("expiry_time").equals(config.getDate("expiry_time")) ){ + return false; + } + return true; + } + ) + .forEach((rateLog)->{ + rateLog.put("expiry_time", DateUtils.addDays(config.getDate("active_time"), -1)); + clientRateMapper.updateConfig(rateLog); + }); } if ("cb_bankpay".equalsIgnoreCase(channel)) { if (newConfig.getBigDecimal("cb_bankpay_rate_value") != null) { diff --git a/src/main/java/au/com/royalpay/payment/manage/organizations/beans/DefaultClientProfile.java b/src/main/java/au/com/royalpay/payment/manage/organizations/beans/DefaultClientProfile.java index 08a049156..e6fa261f3 100644 --- a/src/main/java/au/com/royalpay/payment/manage/organizations/beans/DefaultClientProfile.java +++ b/src/main/java/au/com/royalpay/payment/manage/organizations/beans/DefaultClientProfile.java @@ -10,13 +10,18 @@ import com.yixsoft.support.mybatis.utils.FieldDescription; import org.apache.commons.lang3.ClassUtils; import org.apache.commons.lang3.ObjectUtils; import org.hibernate.validator.constraints.Range; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.core.annotation.AnnotatedElementUtils; +import java.lang.reflect.InvocationTargetException; import java.util.List; +import java.util.Objects; import java.util.stream.Collectors; @JSONType(naming = PropertyNamingStrategy.SnakeCase) public class DefaultClientProfile { + private final Logger logger = LoggerFactory.getLogger(getClass()); @ProfileDesc(value = "周末延迟清算", detail = "周末交易延迟到周二清算") private boolean weekendDelay = true; @ProfileDesc("手续费包含GST") @@ -35,40 +40,46 @@ public class DefaultClientProfile { return new ClassFieldsDescription<>(getClass()).getFields().stream() .filter(field -> !"class".equalsIgnoreCase(field.getFieldName())) .map(this::convertFieldInfo) + .filter(Objects::nonNull) .collect(Collectors.toList()); } private JSONObject convertFieldInfo(FieldDescription field) { - Object value = field.readField(this); - String fieldName = CaseFormat.LOWER_CAMEL.converterTo(CaseFormat.LOWER_UNDERSCORE).convert(field.getFieldName()); - JSONObject info = new JSONObject(); - info.put("field", fieldName); - info.put("value", value); - Class fieldType = field.getMethod().getReturnType(); - if (ClassUtils.isPrimitiveOrWrapper(fieldType)) { - if (ClassUtils.isPrimitiveWrapper(fieldType)) { - fieldType = ClassUtils.wrapperToPrimitive(fieldType); - } - if (fieldType.equals(boolean.class)) { - info.put("type", "checkbox"); + try { + Object value = field.readField(this); + String fieldName = CaseFormat.LOWER_CAMEL.converterTo(CaseFormat.LOWER_UNDERSCORE).convert(field.getFieldName()); + JSONObject info = new JSONObject(); + info.put("field", fieldName); + info.put("value", value); + Class fieldType = field.getMethod().getReturnType(); + if (ClassUtils.isPrimitiveOrWrapper(fieldType)) { + if (ClassUtils.isPrimitiveWrapper(fieldType)) { + fieldType = ClassUtils.wrapperToPrimitive(fieldType); + } + if (fieldType.equals(boolean.class)) { + info.put("type", "checkbox"); + } else { + info.put("type", "number"); + } } else { - info.put("type", "number"); + info.put("type", "text"); } - } else { - info.put("type", "text"); - } - ProfileDesc getterDesc = AnnotatedElementUtils.findMergedAnnotation(field.getMethod(), ProfileDesc.class); - try { - ProfileDesc fieldDesc = AnnotatedElementUtils.findMergedAnnotation(getClass().getDeclaredField(field.getFieldName()), ProfileDesc.class); - ProfileDesc desc = ObjectUtils.defaultIfNull(getterDesc, fieldDesc); - if (desc != null) { - info.put("title", desc.value()); - info.put("detail", desc.detail()); + ProfileDesc getterDesc = AnnotatedElementUtils.findMergedAnnotation(field.getMethod(), ProfileDesc.class); + try { + ProfileDesc fieldDesc = AnnotatedElementUtils.findMergedAnnotation(getClass().getDeclaredField(field.getFieldName()), ProfileDesc.class); + ProfileDesc desc = ObjectUtils.defaultIfNull(getterDesc, fieldDesc); + if (desc != null) { + info.put("title", desc.value()); + info.put("detail", desc.detail()); + } + } catch (NoSuchFieldException e) { } - } catch (NoSuchFieldException e) { + return info; + } catch (IllegalAccessException | InvocationTargetException e) { + logger.error("failed to access getter of field {}", field.getFieldName(), e); + return null; } - return info; } public void applyToClientConfig(JSONObject client) { diff --git a/src/main/ui/static/payment/partner/partner-manage.js b/src/main/ui/static/payment/partner/partner-manage.js index fe48aea7a..da97ebea7 100644 --- a/src/main/ui/static/payment/partner/partner-manage.js +++ b/src/main/ui/static/payment/partner/partner-manage.js @@ -3404,6 +3404,97 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter } } $scope.complianceChangeCheck() + + // 是否为alipayplus + $scope.isAlipayCN = true + // 修改渠道 + $scope.changeAlipayPlusRateState = function (flag) { + $scope.isAlipayCN = flag + } + // 过滤渠道 + $scope.isAlipayPlus = function (item) { + if ($scope.isAlipayCN) { + return item.rate_name === 'AlipayPlus' && (item.pay_type === 'alipay_cn_retail' || item.pay_type === 'alipay_cn_online') + } else { + return item.rate_name === 'AlipayPlus' && item.pay_type === 'alipay_other' + } + } + // 新增alipay+费率 + $scope.newAlipayPlusRate = function () { + $uibModal + .open({ + templateUrl: '/static/payment/partner/templates/partner_new_alipayplus_rate.html', + resolve: { + rate: function () { + return { + rate_name: 'AlipayPlus', + clean_days: '3', + } + }, + sys_common_rate: function () { + return $http.get('/sys/partners/sys_rates') + }, + clientMoniker: function () { + return $scope.partner.client_moniker + }, + }, + controller: [ + '$scope', + '$http', + 'rate', + 'sys_common_rate', + 'clientMoniker', + function ($scope, $http, rate, sys_common_rate, clientMoniker) { + $scope.rate = angular.copy(rate) + $scope.sysRateConfig = angular.copy(sys_common_rate.data) + $scope.ctrl = { sending: false } + $scope.saveRate = function (form) { + if (form.$invalid) { + angular.forEach(form, function (item, key) { + if (key.indexOf('$') < 0) { + item.$dirty = true + } + }) + return + } + $scope.errmsg = null + $scope.ctrl.sending = true + $http.post('/sys/partners/' + clientMoniker + '/rates', $scope.rate).then( + function () { + $scope.ctrl.sending = false + $scope.$close() + }, + function (resp) { + $scope.ctrl.sending = false + $scope.errmsg = resp.data.message + } + ) + } + $scope.changeDays = function () { + // if ($scope.rate.clean_days) { + // switch ($scope.rate.clean_days) { + // case '1': { + // $scope.rate.alipayplus = parseFloat($scope.sysRateConfig.t1.AlipayPlus) + // break + // } + // case '2': { + // $scope.rate.alipayplus = parseFloat($scope.sysRateConfig.t2.AlipayPlus) + // break + // } + // case '3': { + // $scope.rate.alipayplus = parseFloat($scope.sysRateConfig.t3.AlipayPlus) + // break + // } + // } + // } + } + }, + ], + }) + .result.then(function () { + $scope.getRates() + }) + } }, ]) app.controller('surchargeAccountDetailCtrl', [ diff --git a/src/main/ui/static/payment/partner/templates/partner_bankaccounts.html b/src/main/ui/static/payment/partner/templates/partner_bankaccounts.html index edc8f9da8..f15c83f7c 100644 --- a/src/main/ui/static/payment/partner/templates/partner_bankaccounts.html +++ b/src/main/ui/static/payment/partner/templates/partner_bankaccounts.html @@ -8,7 +8,7 @@

Bank Account + ng-if="!bankCtrl.edit && (('11'|withRole)||((!partner.approve_result||partner.approve_result>4) && ('111'|withRole)))">

@@ -18,15 +18,15 @@

{{surcharge.balance|currency:'AUD'}}

+ style="font-size: 15px;color: #3c8dbc;cursor: pointer;padding-left: 15px" + ng-click="surchargeAccountDetail()">

+ switch-change="allowSurchargeCredit(partner.allow_surcharge_credit)">
@@ -34,12 +34,12 @@

balance - + distributed - +

启用到收支分离(distributed)模式,将使消费者支付手续费模式失效
@@ -52,28 +52,28 @@

+ switch-change="taxInSurcharge(partner.tax_in_surcharge)">
+ switch-change="customerTaxFree(partner.customer_tax_free)">
+ switch-change="skipClearing(partner.skip_clearing)">
+ switch-change="switchPreSettle(partner.enable_presettle)">
@@ -86,7 +86,7 @@ -
-
+
+

Rates - + ng-if="partner.rate_editable && (('11'|withRole)||((!partner.approve_result||partner.approve_result>4) && ('111'|withRole)))" + ng-click="newRate()"> +

- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Rate NameRate ValueDomestic Rate ValueInternational Rate ValueTransaction FeeActive TimeExpire Time - Clean Days - Update TimeOperatorRemarkOperation
- T+{{rate.clean_days}} - - - - (Promotional Offer) - - -
-
- check +
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Rate NameRate ValueDomestic Rate ValueInternational Rate ValueTransaction FeeActive TimeExpire Time + Clean Days + Update TimeOperatorRemarkOperation
+ + T+{{rate.clean_days}} + + + + (Promotional Offer) + + +
+
+
+
+ +
+
+

AlipayPlus Rates + +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Rate NameRate ValueTransaction FeeActive TimeExpire TimeClean DaysUpdate TimeOperatorRemarkOperation
T+{{rate.clean_days}} + + + (Promotional Offer) + + +
+
-
-
+
\ No newline at end of file diff --git a/src/main/ui/static/payment/partner/templates/partner_new_alipayplus_rate.html b/src/main/ui/static/payment/partner/templates/partner_new_alipayplus_rate.html new file mode 100644 index 000000000..996cba8c1 --- /dev/null +++ b/src/main/ui/static/payment/partner/templates/partner_new_alipayplus_rate.html @@ -0,0 +1,150 @@ + + + \ No newline at end of file diff --git a/src/main/ui/static/templates/alipay/v1/bill_retail_jsapi.js b/src/main/ui/static/templates/alipay/v1/bill_retail_jsapi.js index 7e7290d52..4afadc43b 100644 --- a/src/main/ui/static/templates/alipay/v1/bill_retail_jsapi.js +++ b/src/main/ui/static/templates/alipay/v1/bill_retail_jsapi.js @@ -24,7 +24,7 @@ $(document).ready(function () { dataCache.paying = true; $.ajax({ - url: '/api/v1.0/alipay/partners/' + window.client_moniker + '/orders/'+window.order_id+'/order_params', + url: '../order_params', method: 'GET', dataType: 'json', success: function (pay) { @@ -32,6 +32,11 @@ $(document).ready(function () { location.href = window.redirect; return; } + if (pay.web_from) { + $('#alipay_plus').html(pay.web_from) + location.href = window.redirect; + return; + } if (window.AlipayJSBridge) { callPayment(); } else { diff --git a/src/main/ui/static/templates/alipay/v1/retail_jsapi.js b/src/main/ui/static/templates/alipay/v1/retail_jsapi.js index 6b74c75cf..6e1145907 100644 --- a/src/main/ui/static/templates/alipay/v1/retail_jsapi.js +++ b/src/main/ui/static/templates/alipay/v1/retail_jsapi.js @@ -24,7 +24,7 @@ $(document).ready(function () { dataCache.paying = true; $.ajax({ - url: '/api/v1.0/alipay/partners/' + window.client_moniker + '/orders/'+window.order_id+'/order_params', + url: './order_params', method: 'GET', dataType: 'json', success: function (pay) { @@ -32,6 +32,11 @@ $(document).ready(function () { location.href = window.redirect; return; } + if (pay.web_from) { + $('#alipay_plus').html(pay.web_from) + startCheckOrder(window.order_id, window.redirect); + return; + } if (window.AlipayJSBridge) { callPayment(); } else { @@ -88,6 +93,9 @@ $(document).ready(function () { } else { setTimeout(checkOrderStd, 500); } + }, + error:function (){ + setTimeout(checkOrderStd, 500); } }) } diff --git a/src/main/ui/static/templates/payment/v1/gateway_jsapi.js b/src/main/ui/static/templates/payment/v1/gateway_jsapi.js index 6b76458a1..9b50c79b5 100644 --- a/src/main/ui/static/templates/payment/v1/gateway_jsapi.js +++ b/src/main/ui/static/templates/payment/v1/gateway_jsapi.js @@ -113,6 +113,9 @@ $(document).ready(function () { } else { setTimeout(checkOrderStd, 500); } + }, + error:function (){ + setTimeout(checkOrderStd, 500); } }) }