Search in sources :

Example 1 with BillingInfoForm

use of org.broadleafcommerce.core.web.checkout.model.BillingInfoForm in project BroadleafCommerce by BroadleafCommerce.

the class BillingInfoFormValidator method validate.

public void validate(Object obj, Errors errors) {
    BillingInfoForm billingInfoForm = (BillingInfoForm) obj;
    super.validate(BroadleafFormType.BILLING_FORM, billingInfoForm.getAddress(), errors);
}
Also used : BillingInfoForm(org.broadleafcommerce.core.web.checkout.model.BillingInfoForm)

Example 2 with BillingInfoForm

use of org.broadleafcommerce.core.web.checkout.model.BillingInfoForm in project BroadleafCommerce by BroadleafCommerce.

the class OnePageCheckoutProcessor method populateModelVariables.

@Override
public Map<String, Object> populateModelVariables(String tagName, Map<String, String> tagAttributes, BroadleafTemplateContext context) {
    // Pre-populate the command objects
    OrderInfoForm orderInfoForm = context.parseExpression(tagAttributes.get("orderInfoForm"));
    ShippingInfoForm shippingInfoForm = context.parseExpression(tagAttributes.get("shippingInfoForm"));
    BillingInfoForm billingInfoForm = context.parseExpression(tagAttributes.get("billingInfoForm"));
    String orderInfoHelpMessage = context.parseExpression(tagAttributes.get("orderInfoHelpMessage"));
    String billingInfoHelpMessage = context.parseExpression(tagAttributes.get("billingInfoHelpMessage"));
    String shippingInfoHelpMessage = context.parseExpression(tagAttributes.get("shippingInfoHelpMessage"));
    prepopulateCheckoutForms(CartState.getCart(), orderInfoForm, shippingInfoForm, billingInfoForm);
    // Add PaymentRequestDTO to the model in the case of errors or other cases
    Map<String, Object> newModelVars = new HashMap<>();
    Order cart = CartState.getCart();
    if (cart != null && !(cart instanceof NullOrderImpl)) {
        newModelVars.put("paymentRequestDTO", orderToPaymentRequestDTOService.translateOrder(cart));
    }
    // Initialize Fulfillment Group Vars
    int numShippableFulfillmentGroups = calculateNumShippableFulfillmentGroups();
    newModelVars.put("numShippableFulfillmentGroups", numShippableFulfillmentGroups);
    populateFulfillmentOptionsAndEstimationOnModel(newModelVars);
    // Initialize View States
    newModelVars.put("orderInfoHelpMessage", orderInfoHelpMessage);
    newModelVars.put("billingInfoHelpMessage", billingInfoHelpMessage);
    newModelVars.put("shippingInfoHelpMessage", shippingInfoHelpMessage);
    populateSectionViewStates(newModelVars);
    // Helpful lists to populate dropdowns on a checkout page
    newModelVars.put("states", stateService.findStates());
    newModelVars.put("countries", countryService.findCountries());
    newModelVars.put("expirationMonths", populateExpirationMonths());
    newModelVars.put("expirationYears", populateExpirationYears());
    // Populate any Payment Processing Errors
    populateProcessingError(newModelVars);
    return newModelVars;
}
Also used : Order(org.broadleafcommerce.core.order.domain.Order) OrderInfoForm(org.broadleafcommerce.core.web.checkout.model.OrderInfoForm) ShippingInfoForm(org.broadleafcommerce.core.web.checkout.model.ShippingInfoForm) HashMap(java.util.HashMap) BillingInfoForm(org.broadleafcommerce.core.web.checkout.model.BillingInfoForm) NullOrderImpl(org.broadleafcommerce.core.order.domain.NullOrderImpl)

Aggregations

BillingInfoForm (org.broadleafcommerce.core.web.checkout.model.BillingInfoForm)2 HashMap (java.util.HashMap)1 NullOrderImpl (org.broadleafcommerce.core.order.domain.NullOrderImpl)1 Order (org.broadleafcommerce.core.order.domain.Order)1 OrderInfoForm (org.broadleafcommerce.core.web.checkout.model.OrderInfoForm)1 ShippingInfoForm (org.broadleafcommerce.core.web.checkout.model.ShippingInfoForm)1