}
@RequestMapping(value = BoUrls.PAYMENT_GATEWAY_EDIT_URL, method = RequestMethod.POST)
public ModelAndView submitAbstractPaymentGatewayEdit(final HttpServletRequest request, final Model model, @Valid @ModelAttribute(ModelConstants.PAYMENT_GATEWAY_FORM) PaymentGatewayForm paymentGatewayForm,
BindingResult result) throws Exception {
final RequestData requestData = requestUtil.getRequestData(request);
final Locale locale = requestData.getLocale();
if (result.hasErrors()) {
return paymentGatewayEdit(request, model, paymentGatewayForm);
}
AbstractPaymentGateway paymentGateway = null;
if(StringUtils.isNotEmpty(paymentGatewayForm.getId())){
paymentGateway = paymentGatewayService.getPaymentGatewayById(paymentGatewayForm.getId(), FetchPlanGraphCommon.fullPaymentGatewayFetchPlan());
}
try {
// CREATE OR UPDATE PAYMENT GATEWAY
webBackofficeService.createOrUpdatePaymentGateway(requestData.getMarketArea(), paymentGateway, paymentGatewayForm);
if (paymentGateway == null) {
addSuccessMessage(request, getSpecificMessage(ScopeWebMessage.PAYMENT_GATEWAY, "create_success_message", locale));
final String urlRedirect = backofficeUrlService.generateUrl(BoUrls.PAYMENT_GATEWAY_LIST, requestUtil.getRequestData(request));
return new ModelAndView(new RedirectView(urlRedirect));