[Y] 父商户处理子商户交易验证

master
taylor.dang 6 years ago
parent b7aa93ba46
commit 1c97b5e1fb

@ -75,17 +75,14 @@ public class RefundServiceImpl implements RefundService, ApplicationEventPublish
@Override @Override
public JSONObject checkOrderRefundAmount(String orderId, JSONObject account) { public JSONObject checkOrderRefundAmount(String orderId, JSONObject account) {
JSONObject order = orderMapper.getOrderDetail(orderId); JSONObject order = orderMapper.getOrderDetail(orderId);
if (account != null) { if (account != null && (account.getIntValue("client_id") != order.getIntValue("client_id"))) {
JSONObject client = clientMapper.findClient(account.getIntValue("client_id")); JSONObject client = clientMapper.findClient(account.getIntValue("client_id"));
////父商户全局管理子商户时候,跳过 ////父商户全局管理子商户时候,跳过
if (account.getIntValue("client_id") != order.getIntValue("client_id")) { JSONObject orderTargetClient = clientMapper.findClient(order.getIntValue("client_id"));
JSONObject clientOrder = clientMapper.findClient(order.getIntValue("client_id")); if (orderTargetClient.getIntValue("parent_client_id") != account.getIntValue("client_id")) {
if(!(client.getBoolean("sub_manage") && throw new ForbiddenException("Order is not belong to your shop/merchant");
clientOrder.containsKey("parent_client_id")?clientOrder.getIntValue("parent_client_id")==client.getIntValue("client_id"):false)){ } else if (!client.getBooleanValue("sub_manage")) {
throw new ForbiddenException("Order is not belong to your shop/merchant"); throw new ForbiddenException("Order is not belong to your shop/merchant");
}
} }
} }
Assert.notNull(order, "Order Not Exists"); Assert.notNull(order, "Order Not Exists");

Loading…
Cancel
Save