use of org.broadleafcommerce.core.web.checkout.model.OrderInfoForm in project BroadleafCommerce by BroadleafCommerce.
the class OrderInfoFormValidator method validate.
public void validate(Object obj, Errors errors) {
OrderInfoForm orderInfoForm = (OrderInfoForm) obj;
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "emailAddress", "emailAddress.required");
if (!errors.hasErrors()) {
if (!EmailValidator.getInstance().isValid(orderInfoForm.getEmailAddress())) {
errors.rejectValue("emailAddress", "emailAddress.invalid", null, null);
}
}
}
use of org.broadleafcommerce.core.web.checkout.model.OrderInfoForm 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;
}
Aggregations