public CheckoutForm() { shippingAddress = new AddressImpl(); billingAddress = new AddressImpl(); shippingAddress.setPhonePrimary(new PhoneImpl()); billingAddress.setPhonePrimary(new PhoneImpl()); shippingAddress.setPhoneSecondary(new PhoneImpl()); billingAddress.setPhoneSecondary(new PhoneImpl()); shippingAddress.setPhoneFax(new PhoneImpl()); billingAddress.setPhoneFax(new PhoneImpl()); shippingAddress.setIsoCountryAlpha2(new ISOCountryImpl()); billingAddress.setIsoCountryAlpha2(new ISOCountryImpl()); isSameAddress = true; /** * @deprecated - setCountry() and setState() on address have been deprecated in favor of ISO standardization. * Leaving here for legacy implementations. */ shippingAddress.setCountry(new CountryImpl()); billingAddress.setCountry(new CountryImpl()); shippingAddress.setState(new StateImpl()); billingAddress.setState(new StateImpl()); }
/** * This method only exists because so many other tests depend on it, but should be removed once tests are more isolated * @param customerAddress */ @Deprecated @Test(groups = "createCustomerAddress", dataProvider = "setupCustomerAddress", dataProviderClass = CustomerAddressDataProvider.class, dependsOnGroups = {"readCustomer", "createCountry", "createState"}) @Transactional @Rollback(false) public void createCustomerAddress(CustomerAddress customerAddress) { userName = "customer1"; Customer customer = customerService.readCustomerByUsername(userName); assert customerAddress.getId() == null; customerAddress.setCustomer(customer); State state = stateService.findStateByAbbreviation("KY"); customerAddress.getAddress().setState(state); Country country = countryService.findCountryByAbbreviation("US"); customerAddress.getAddress().setCountry(country); customerAddress.getAddress().setIsoCountrySubdivision("US-KY"); ISOCountry isoCountry = isoService.findISOCountryByAlpha2Code("US"); customerAddress.getAddress().setIsoCountryAlpha2(isoCountry); customerAddress = customerAddressService.saveCustomerAddress(customerAddress); assert customer.equals(customerAddress.getCustomer()); userId = customerAddress.getCustomer().getId(); }
/** * Saves a customerAddress with state KY and country US. Requires that createCountry() and createState() have been called * @param customerAddress */ public CustomerAddress saveCustomerAddress(CustomerAddress customerAddress) { State state = stateService.findStateByAbbreviation("KY"); customerAddress.getAddress().setState(state); Country country = countryService.findCountryByAbbreviation("US"); customerAddress.getAddress().setCountry(country); customerAddress.getAddress().setIsoCountrySubdivision("US-KY"); ISOCountry isoCountry = isoService.findISOCountryByAlpha2Code("US"); customerAddress.getAddress().setIsoCountryAlpha2(isoCountry); return customerAddressService.saveCustomerAddress(customerAddress); }
address.setIsoCountryAlpha2(isoCountry);
cloned.setLastName(lastName); cloned.setFullName(fullName); cloned.setIsoCountryAlpha2(isoCountryAlpha2); cloned.setIsoCountrySubdivision(isoCountrySubdivision); cloned.setStreet(isStreet);
private Address buildAddress() { Address address = new AddressImpl(); address.setAddressLine1("123 Test Rd"); address.setCity("Dallas"); address.setFirstName("Jeff"); address.setLastName("Fischer"); address.setPostalCode("75240"); address.setPrimaryPhone("972-978-9067"); State state = new StateImpl(); state.setAbbreviation("ALL"); state.setName("ALL"); address.setState(state); Country country = new CountryImpl(); country.setAbbreviation("US"); country.setName("United States"); state.setCountry(country); address.setCountry(country); ISOCountry isoCountry = new ISOCountryImpl(); isoCountry.setAlpha2("US"); isoCountry.setName("UNITED STATES"); address.setIsoCountryAlpha2(isoCountry); return address; } }
address.setCountry(country); address.setIsoCountrySubdivision("US-TX"); address.setIsoCountryAlpha2(isoCountry);
address.setCountry(country); address.setIsoCountrySubdivision("US-TX"); address.setIsoCountryAlpha2(isoCountry); group1.setAddress(address); group1.setOrder(order);
dest.setZipFour(orig.getZipFour()); dest.setCountry(orig.getCountry()); dest.setIsoCountryAlpha2(orig.getIsoCountryAlpha2()); dest.setCompanyName(orig.getCompanyName()); dest.setPrimaryPhone(orig.getPrimaryPhone());
address1.setIsoCountryAlpha2(isoCountry); address1.setDefault(true); address1.setFirstName("John"); address2.setIsoCountryAlpha2(isoCountry2); address2.setDefault(true); address2.setFirstName("John");
address1.setIsoCountryAlpha2(isoCountry); address1.setDefault(true); address1.setFirstName("John"); address2.setIsoCountryAlpha2(isoCountry2); address2.setDefault(true); address2.setFirstName("John");
address.setCountry(country); address.setIsoCountrySubdivision("US-TX"); address.setIsoCountryAlpha2(isoCountry);
address.setCountry(countryService.findCountryByAbbreviation("US")); address.setIsoCountrySubdivision("US-KY"); address.setIsoCountryAlpha2(isoService.findISOCountryByAlpha2Code("US"));
@Override public Address updateEntity(final Address address, final AddressDto addressDto) { address.setAddressLine1(Optional.ofNullable(addressDto.getAddressLine1()).orElse("")); address.setAddressLine2(addressDto.getAddressLine2()); address.setAddressLine3(addressDto.getAddressLine3()); address.setFirstName(addressDto.getFirstName()); address.setLastName(addressDto.getLastName()); address.setCity(Optional.ofNullable(addressDto.getCity()).orElse("")); address.setPostalCode(addressDto.getPostalCode()); address.setCompanyName(addressDto.getCompanyName()); address.setCounty(addressDto.getCountrySubdivisionCode()); address.setIsoCountrySubdivision(addressDto.getCountrySubdivisionCode()); Optional.ofNullable(addressDto.getCountryCode()) .ifPresent(countryCode -> address.setIsoCountryAlpha2(isoService.findISOCountryByAlpha2Code(countryCode))); address.setEmailAddress(addressDto.getEmail()); Optional.ofNullable(addressDto.getPhone()).ifPresent(phone -> address.setPhonePrimary(phoneNumberFormat.parseObject(phone, new ParsePosition(0))) ); return address; }