add CBBank手续费开关 && 增加clientconfig单独配置方法

boolean onlyModifyConfig
master
luoyang 5 years ago
parent 41d15002d2
commit b5e932c6e1

@ -213,6 +213,8 @@ public interface ClientManager {
void setClientRetailPaySurCharge(JSONObject account,String clientMoniker, boolean paySurcharge);
void setClientCBBankPaySurCharge(JSONObject account,String clientMoniker, boolean paySurcharge);
void setClientTaxInSurcharge(JSONObject account,String clientMoniker, boolean taxInSurcharge);
void setClientCustomerTaxFree(JSONObject account,String clientMoniker, boolean customerTaxFree);
@ -267,6 +269,8 @@ public interface ClientManager {
void changeRetailPaySurcharge(JSONObject account, boolean paySurcharge);
void changeCBBankPaySurcharge(JSONObject account, boolean paySurcharge);
void changeRequireCustinfo(JSONObject account, boolean requireCustinfo);
void changeRequireRemark(JSONObject account, boolean requireRemark);

@ -13,5 +13,7 @@ public interface ClientModifySupport {
void processClientConfigModify(ClientConfigModify clientConfigModify);
void processClientConfigModify(ClientConfigModify clientConfigModify, boolean onlyModifyConfig);
void processClientGatewaySignModify(ClientGatewaySignModify clientGatewaySignModify);
}

@ -2899,6 +2899,16 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
@Override
public void setClientCBBankPaySurCharge(JSONObject account, String clientMoniker, boolean paySurcharge) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account, clientMoniker, "cbbank_surcharge", paySurcharge), true);
}
@Override
public void setClientTaxInSurcharge(JSONObject account, String clientMoniker, boolean taxInSurcharge) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
@ -2906,7 +2916,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new InvalidShortIdException();
}
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account, clientMoniker, "tax_in_surcharge", taxInSurcharge));
}
@Override
@ -3434,6 +3443,21 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
.processClientConfigModify(new SwitchPermissionModify(account, client.getString("client_moniker"), "retail_surcharge", paySurcharge));
}
@Override
public void changeCBBankPaySurcharge(JSONObject account, boolean paySurcharge) {
int clientId = account.getIntValue("client_id");
JSONObject client = getClientInfo(clientId);
if (client == null) {
throw new InvalidShortIdException();
}
if (account.getIntValue("role") == 3) {
// cashier cannot change this config
throw new ForbiddenException("Cashier has no permission to switch retail surcharge");
}
clientModifySupport
.processClientConfigModify(new SwitchPermissionModify(account, client.getString("client_moniker"), "cbbank_surcharge", paySurcharge),true);
}
@Override
public void changeRequireCustinfo(JSONObject account, boolean requireCustinfo) {
int clientId = account.getIntValue("client_id");

@ -45,6 +45,12 @@ public class ClientModifySupportImpl implements ClientModifySupport {
clientInfoCacheSupport.clearClientCache(clientId);
}
@Override
public void processClientConfigModify(ClientConfigModify clientConfigModify,boolean onlyModifyConfig) {
int clientId =clientConfigModify.doModify(merchantInfoProvider, clientConfigMapper,clientMapper,mongoTemplate,onlyModifyConfig);
clientInfoCacheSupport.clearClientConfigCache(clientId);
}
@Override
public void processClientGatewaySignModify(ClientGatewaySignModify clientGatewaySignModify) {
int clientId =clientGatewaySignModify.doModify(merchantInfoProvider, merchantSignInfoMapper,mongoTemplate);

@ -50,6 +50,20 @@ public abstract class ClientConfigModify {
return clientId;
}
public int doModify(MerchantInfoProvider merchantInfoProvider, ClientConfigMapper clientConfigMapper, ClientMapper clientMapper, MongoTemplate mongoTemplate,boolean onlyModifyConfig) {
JSONObject clientConfig = merchantInfoProvider.getClientConfigInfoByMoniker(clientMoniker);
JSONObject modifyResult = getModifyResult();
try {
saveModifyHistory(clientConfig, modifyResult, mongoTemplate);
}catch (Exception e){
}
int clientId = clientConfig.getIntValue("client_id");
modifyResult.put("client_id", clientId);
clientConfigMapper.update(modifyResult);
return clientId;
}
private void saveModifyHistory(JSONObject client, JSONObject modifyResult,MongoTemplate mongoTemplate) {
if (account == null) {
return;

@ -230,6 +230,11 @@ public class PartnerManageController {
clientManager.setClientRetailPaySurCharge(manager,clientMoniker, config.getBooleanValue("retail_surcharge"));
}
@ManagerMapping(value = "/{clientMoniker}/cbbank_surcharge", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN, ManagerRole.BD_USER})
public void setClientCBBankPaySurCharge(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@PathVariable String clientMoniker, @RequestBody JSONObject config) {
clientManager.setClientCBBankPaySurCharge(manager,clientMoniker, config.getBooleanValue("cbbank_surcharge"));
}
@ManagerMapping(value = "/{clientMoniker}/tax_in_surcharge", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN})
public void setClientTaxPayer(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@PathVariable String clientMoniker, @RequestBody JSONObject config) {
clientManager.setClientTaxInSurcharge(manager,clientMoniker, config.getBooleanValue("tax_in_surcharge"));

@ -419,6 +419,12 @@ public class PartnerViewController {
clientManager.changeRetailPaySurcharge(account, pass.getBooleanValue("retail_surcharge"));
}
@PartnerMapping(value = "/cbbank_surcharge", method = RequestMethod.PUT)
@ResponseBody
public void changeCBBankPaySurCharge(@RequestBody JSONObject pass, @ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account) {
clientManager.changeCBBankPaySurcharge(account, pass.getBooleanValue("cbbank_surcharge"));
}
@PartnerMapping(value = "/require_custinfo", method = RequestMethod.PUT)
@ResponseBody
public void changeRequireCustinfo(@RequestBody JSONObject pass, @ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account) {

@ -1659,6 +1659,21 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
});
};
$scope.updateClientCBBankPaySurCharge = function () {
if (!$scope.paymentInfo) {
return;
}
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/cbbank_surcharge', {cbbank_surcharge: $scope.paymentInfo.cbbank_surcharge}).then(function () {
// $scope.loadPartnerPaymentInfo();
}, function (resp) {
commonDialog.alert({
title: 'failed to change Customer Pay for Surcharge for Retail',
content: resp.data.message,
type: 'error'
})
})
}
$scope.updateClientApiSurCharge = function () {
if (!$scope.paymentInfo) {
return;

@ -999,6 +999,20 @@ define(['angular', 'decimal', 'uiRouter', 'ngBootSwitch', 'ngFileUpload','uiBoot
})
})
}
$scope.updateClientCBBankPaySurCharge = function () {
if (!$scope.paymentInfo) {
return;
}
$http.put('/client/partner_info/cbbank_surcharge', {cbbank_surcharge: $scope.paymentInfo.cbbank_surcharge}).then(function () {
// $scope.loadPartnerPaymentInfo();
}, function (resp) {
commonDialog.alert({
title: 'failed to change Customer Pay for Surcharge for Retail',
content: resp.data.message,
type: 'error'
})
})
}
$scope.toggleRequireCustInfo = function () {
if (!$scope.paymentInfo) {
return;

@ -444,6 +444,12 @@
</p>
</div>
</div>
<div class="form-group" ng-if="paymentInfo.enable_cb_bankpay">
<label class="col-sm-4 control-label">Customer Pay for Surcharge for CBBank Pay</label>
<div class="col-sm-8">
<input type="checkbox" ng-model="paymentInfo.cbbank_surcharge" bs-switch ng-change="updateClientCBBankPaySurCharge()">
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">Customer Pay for Surcharge for Retail(POS, iOS App)</label>
<div class="col-sm-8">

@ -426,6 +426,12 @@
<input ng-if="paymentInfo.enable_cb_bankpay_link" style="opacity: 0" id="cpcbbankpay" value={{paymentInfo.cb_bankpay_url}} readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Customer Pay for Surcharge for CBBank Pay</label>
<div class="col-sm-10">
<input type="checkbox" ng-model="paymentInfo.cbbank_surcharge" bs-switch ng-change="updateClientCBBankPaySurCharge()">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">CB Bank Pay Channel</label>
<div class="col-sm-3">

Loading…
Cancel
Save