public String validate() { final CountryCode shippingCountry = CountryCode.getByCode(countryShipping); if (shippingCountry == null || shippingCountry.equals(CountryCode.UNDEFINED)) { return "messages:checkout.address.invalidShippingCountry"; } if (billingAddressDifferentToBillingAddress) { final CountryCode billingCountry = CountryCode.getByCode(countryBilling); if (billingCountry == null || billingCountry.equals(CountryCode.UNDEFINED)) { return "messages:checkout.address.invalidBillingCountry"; } } return null; } }
/** * Looks up the locations and checks if the country is present. It does not matter if the location has a state specified. * * @param countryCode the country to search for * @return true if the country is somehow in the locations. */ default boolean contains(final CountryCode countryCode) { return getLocations().stream().anyMatch(location -> location.getCountry().equals(countryCode)); } }
/** * Looks up the locations and checks if the country is present. It does not matter if the location has a state specified. * * @param countryCode the country to search for * @return true if the country is somehow in the locations. */ default boolean contains(final CountryCode countryCode) { return getLocations().stream().anyMatch(location -> location.getCountry().equals(countryCode)); }
/** * Looks up the locations and checks if the country is present. It does not matter if the location has a state specified. * * @param countryCode the country to search for * @return true if the country is somehow in the locations. */ default boolean contains(final CountryCode countryCode) { return getLocations().stream().anyMatch(location -> location.getCountry().equals(countryCode)); }
/** * Looks up the locations and checks if the country is present. It does not matter if the location has a state specified. * * @param countryCode the country to search for * @return true if the country is somehow in the locations. */ default boolean contains(final CountryCode countryCode) { return getLocations().stream().anyMatch(location -> location.getCountry().equals(countryCode)); }
@Override public CompletionStage<Cart> onCartLoadedAction(final Cart cart, final ExpansionPathContainer<Cart> expansionPathContainer) { final CountryCode country = injector.getInstance(UserContext.class).country(); final boolean hasDifferentCountry = !country.equals(cart.getCountry()); return hasDifferentCountry ? updateCartCountry(cart, country, expansionPathContainer) : completedFuture(cart); }
private List<FormSelectableOptionBean> createCountryFormOptions() { final List<FormSelectableOptionBean> countrySelector = projectContext.countries().stream() .map(countryCode -> { final FormSelectableOptionBean bean = new FormSelectableOptionBean(); bean.setLabel(countryCode.getName()); bean.setValue(countryCode.getAlpha2()); bean.setSelected(countryCode.equals(userContext.country())); return bean; }).collect(toList()); return (countrySelector.size() > 1) ? countrySelector : emptyList(); }
public boolean matches(String currencyCode, CountryCode country, Reference<CustomerGroup> customerGroup) { return (value == null || (value != null && value.getCurrencyCode().equals(currencyCode))) && (country == null ? this.country == null : country.equals(this.country)) && ((customerGroup == null || customerGroup.isEmpty()) ? this.customerGroup.isEmpty() : !this.customerGroup.isEmpty() && this.customerGroup.getId().equals(customerGroup.getId())); }