diff --git a/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/impl/RiskBusinessServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/impl/RiskBusinessServiceImpl.java index 29d5b3331..be20cc7aa 100644 --- a/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/impl/RiskBusinessServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/riskbusiness/core/impl/RiskBusinessServiceImpl.java @@ -5,6 +5,7 @@ import au.com.royalpay.payment.core.beans.ChargebackStatus; import au.com.royalpay.payment.core.exceptions.EmailException; import au.com.royalpay.payment.core.exceptions.InvalidShortIdException; import au.com.royalpay.payment.core.exceptions.OrderNotMatchException; +import au.com.royalpay.payment.core.utils.ExtParamsUtils; import au.com.royalpay.payment.manage.mappers.log.AppMessageLogMapper; import au.com.royalpay.payment.manage.mappers.payment.OrderMapper; import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper; @@ -392,7 +393,19 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo if (evt == null) { return; } + JSONObject order = orderMapper.find(evt.getOrders().get(0).getRealOrderId()); + if (order == null) { + throw new BadRequestException("Order Not found"); + } + if (ExtParamsUtils.getExtParamsBooleanValue(order, "chargeback_mark")) { + throw new BadRequestException("Duplicated chargeback on same order"); + } cardSecureService.submitChargeBackReport(evt); + JSONObject update = new JSONObject(); + update.put("order_id", order.getString("order_id")); + update.put(ExtParamsUtils.EXT_PARAMS, order.getString(ExtParamsUtils.EXT_PARAMS)); + ExtParamsUtils.putExtParam(update, "chargeback_mark", true); + orderMapper.update(update); } } @@ -1378,6 +1391,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo } @Override + @Transactional public void markChargebackStatus(String riskId, JSONObject manager, ChargebackStatus status) { RiskEvent risk = getRiskEvent(riskId); if (risk == null) { @@ -1389,13 +1403,19 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo if (status == null || status == ChargebackStatus.PROCESSING) { throw new BadRequestException("Invalid status"); } - riskProcessLogService.addRiskProcessLog(riskId, - manager.getString("manager_id"), - manager.getString("display_name"), - RiskResultTypeEnum.ALREADY_HANDLED.getRemark(), - RiskResultTypeEnum.ALREADY_HANDLED.getResultType(), - RiskResultTypeEnum.ALREADY_HANDLED.getResultType()); - cardSecureService.changeChargebackReportStatus(riskId, status); + if (risk.getResultType() < 5) { + riskProcessLogService.addRiskProcessLog(riskId, + manager.getString("manager_id"), + manager.getString("display_name"), + RiskResultTypeEnum.ALREADY_HANDLED.getRemark(), + RiskResultTypeEnum.ALREADY_HANDLED.getResultType(), + RiskResultTypeEnum.ALREADY_HANDLED.getResultType()); + cardSecureService.changeChargebackReportStatus(riskId, status); + JSONObject evt = new JSONObject(); + evt.put("risk_id", risk.getRiskId()); + evt.put("result_type", RiskResultTypeEnum.ALREADY_HANDLED.getResultType()); + riskEventMapper.update(evt); + } } private List getShopTemplate() { diff --git a/src/main/ui/static/analysis/risk_business.js b/src/main/ui/static/analysis/risk_business.js index b36e56413..4fcecd4fc 100644 --- a/src/main/ui/static/analysis/risk_business.js +++ b/src/main/ui/static/analysis/risk_business.js @@ -415,7 +415,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'], $scope.commitChargebackStatus = function (std) { commonDialog.confirm({title: '确认操作', content: '当前操作不可逆,并会将风控项标记为办结状态,确认操作?'}).then(function () { - $http.put('/risk/business/chargebacks/' + $scope.riskEvent.risk_id + '/status', {status: std}).then(function () { + $http.put('/risk/business/chargebacks/' + $scope.riskEvent.risk_id + '/mark_status', {status: std}).then(function () { $state.reload(); commonDialog.alert({title: 'Success', content: '修改成功', type: success}) }, function (res) { diff --git a/src/main/ui/static/analysis/templates/riskEvent_detail.html b/src/main/ui/static/analysis/templates/riskEvent_detail.html index 92de35374..673e1e00a 100644 --- a/src/main/ui/static/analysis/templates/riskEvent_detail.html +++ b/src/main/ui/static/analysis/templates/riskEvent_detail.html @@ -264,12 +264,12 @@ ng-if="clientInfo.is_valid == 0">重新启用商户