Examples of PaymentGatewayViewBean


Examples of org.hoteia.qalingo.core.web.mvc.viewbean.PaymentGatewayViewBean

    /**
     *
     */
    public PaymentGatewayViewBean buildViewBeanPaymentGateway(final RequestData requestData, final AbstractPaymentGateway paymentGateway) throws Exception {
        final MarketArea marketArea = requestData.getMarketArea();
        final PaymentGatewayViewBean paymentGatewayViewBean = new PaymentGatewayViewBean();
        if (paymentGateway != null) {
            paymentGatewayViewBean.setCode(paymentGateway.getCode());
            paymentGatewayViewBean.setName(paymentGateway.getName());
            paymentGatewayViewBean.setDescription(paymentGateway.getDescription());
            if(Hibernate.isInitialized(paymentGateway.getMarketAreas())
                    && paymentGateway.getMarketAreas() != null){
                paymentGatewayViewBean.setActive(paymentGateway.getMarketAreas().contains(marketArea));
            }

            List<PaymentGatewayAttribute> globalAttributes = paymentGateway.getGlobalAttributes();
            if(globalAttributes != null){
                for (Iterator<PaymentGatewayAttribute> iterator = globalAttributes.iterator(); iterator.hasNext();) {
                    PaymentGatewayAttribute attribute = (PaymentGatewayAttribute) iterator.next();
                    paymentGatewayViewBean.getGlobalAttributes().put(attribute.getAttributeDefinition().getCode(), attribute.getValueAsString());
                }
            }

            List<PaymentGatewayAttribute> marketAreaAttributes = paymentGateway.getMarketAreaAttributes(marketArea.getId());
            if(marketAreaAttributes != null){
                for (Iterator<PaymentGatewayAttribute> iterator = marketAreaAttributes.iterator(); iterator.hasNext();) {
                    PaymentGatewayAttribute attribute = (PaymentGatewayAttribute) iterator.next();
                    paymentGatewayViewBean.getMarketAreaAttributes().put(attribute.getAttributeDefinition().getCode(), attribute.getValueAsString());
                }
            }
           
            Set<PaymentGatewayOption> options = paymentGateway.getOptions();
            if(options != null){
                for (Iterator<PaymentGatewayOption> iterator = options.iterator(); iterator.hasNext();) {
                    PaymentGatewayOption option = (PaymentGatewayOption) iterator.next();
                    paymentGatewayViewBean.getOptions().put(option.getCode(), option.getOptionValue());
                }
            }
           
            DateFormat dateFormat = requestUtil.getFormatDate(requestData, DateFormat.MEDIUM, DateFormat.MEDIUM);
            Date dateCreate = paymentGateway.getDateCreate();
            if (dateCreate != null) {
                paymentGatewayViewBean.setDateCreate(dateFormat.format(dateCreate));
            } else {
                paymentGatewayViewBean.setDateCreate(Constants.NOT_AVAILABLE);
            }

            Date dateUpdate = paymentGateway.getDateUpdate();
            if (dateUpdate != null) {
                paymentGatewayViewBean.setDateUpdate(dateFormat.format(dateUpdate));
            } else {
                paymentGatewayViewBean.setDateUpdate(Constants.NOT_AVAILABLE);
            }

            paymentGatewayViewBean.setDetailsUrl(backofficeUrlService.generateUrl(BoUrls.PAYMENT_GATEWAY_DETAILS, requestData, paymentGateway));
            paymentGatewayViewBean.setEditUrl(backofficeUrlService.generateUrl(BoUrls.PAYMENT_GATEWAY_EDIT, requestData, paymentGateway));

        }
        return paymentGatewayViewBean;
    }
View Full Code Here

Examples of org.hoteia.qalingo.core.web.mvc.viewbean.PaymentGatewayViewBean

        final String paymentGatewayCode = request.getParameter(RequestConstants.REQUEST_PARAMETER_PAYMENT_GATEWAY_CODE);
        if(StringUtils.isNotEmpty(paymentGatewayCode)){
            // EDIT MODE
            final AbstractPaymentGateway paymentGateway = paymentGatewayService.getPaymentGatewayByCode(paymentGatewayCode, FetchPlanGraphCommon.defaultPaymentGatewayFetchPlan());

            PaymentGatewayViewBean paymentGatewayViewBean = backofficeViewBeanFactory.buildViewBeanPaymentGateway(requestData, paymentGateway);
            request.setAttribute(ModelConstants.PAYMENT_GATEWAY_VIEW_BEAN, paymentGatewayViewBean);

            modelAndView.addObject("availableGlobaleAttributeDefinitions", attributeService.findPaymentGatewayGlobalAttributeDefinitions());
            modelAndView.addObject("availableMarketAreaAttributeDefinitions", attributeService.findPaymentGatewayMarketAreaAttributeDefinitions());
            modelAndView.addObject("availableOptions", paymentGatewayService.findPaymentGatewayOptions());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.