Java Code Examples for com.neovisionaries.i18n.CountryCode#equals()

The following examples show how to use com.neovisionaries.i18n.CountryCode#equals() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultAddressFormData.java    From commercetools-sunrise-java with Apache License 2.0 5 votes vote down vote up
public String validate() {
    final CountryCode country = CountryCode.getByCode(this.country);
    if (country == null || country.equals(CountryCode.UNDEFINED)) {
        return "Invalid country"; // TODO use i18n version
    }
    return null;
}
 
Example 2
Source File: DefaultCheckoutAddressFormData.java    From commercetools-sunrise-java with Apache License 2.0 5 votes vote down vote up
public String validate() {
    final CountryCode shippingCountry = CountryCode.getByCode(countryShipping);
    if (shippingCountry == null || shippingCountry.equals(CountryCode.UNDEFINED)) {
        return "Invalid shipping country"; // TODO use i18n version
    }
    if (billingAddressDifferentToBillingAddress) {
        final CountryCode billingCountry = CountryCode.getByCode(countryBilling);
        if (billingCountry == null || billingCountry.equals(CountryCode.UNDEFINED)) {
            return "Invalid billing country"; // TODO use i18n version
        }
    }
    return null;
}