use of com.salesmanager.core.model.catalog.product.price.FinalPrice in project shopizer by shopizer-ecommerce.
the class ReadableProductDefinitionMapper method merge.
@Override
public ReadableProductDefinition merge(Product source, ReadableProductDefinition destination, MerchantStore store, Language language) {
Validate.notNull(source, "Product cannot be null");
Validate.notNull(destination, "Product destination cannot be null");
ReadableProductDefinition returnDestination = destination;
if (language == null) {
returnDestination = new ReadableProductDefinitionFull();
}
List<com.salesmanager.shop.model.catalog.product.ProductDescription> fulldescriptions = new ArrayList<com.salesmanager.shop.model.catalog.product.ProductDescription>();
returnDestination.setIdentifier(source.getSku());
returnDestination.setId(source.getId());
returnDestination.setVisible(source.isAvailable());
returnDestination.setDateAvailable(DateUtil.formatDate(source.getDateAvailable()));
ProductDescription description = null;
if (source.getDescriptions() != null && source.getDescriptions().size() > 0) {
for (ProductDescription desc : source.getDescriptions()) {
if (language != null && desc.getLanguage() != null && desc.getLanguage().getId().intValue() == language.getId().intValue()) {
description = desc;
break;
} else {
fulldescriptions.add(populateDescription(desc));
}
}
}
if (description != null) {
com.salesmanager.shop.model.catalog.product.ProductDescription tragetDescription = populateDescription(description);
returnDestination.setDescription(tragetDescription);
}
if (source.getManufacturer() != null) {
ReadableManufacturer manufacturer = readableManufacturerMapper.convert(source.getManufacturer(), store, language);
returnDestination.setManufacturer(manufacturer);
}
if (!CollectionUtils.isEmpty(source.getCategories())) {
List<ReadableCategory> categoryList = new ArrayList<ReadableCategory>();
for (Category category : source.getCategories()) {
ReadableCategory readableCategory = readableCategoryMapper.convert(category, store, language);
categoryList.add(readableCategory);
}
returnDestination.setCategories(categoryList);
}
ProductSpecification specifications = new ProductSpecification();
specifications.setHeight(source.getProductHeight());
specifications.setLength(source.getProductLength());
specifications.setWeight(source.getProductWeight());
specifications.setWidth(source.getProductWidth());
if (!StringUtils.isBlank(store.getSeizeunitcode())) {
specifications.setDimensionUnitOfMeasure(DimensionUnitOfMeasure.valueOf(store.getSeizeunitcode().toLowerCase()));
}
if (!StringUtils.isBlank(store.getWeightunitcode())) {
specifications.setWeightUnitOfMeasure(WeightUnitOfMeasure.valueOf(store.getWeightunitcode().toLowerCase()));
}
returnDestination.setProductSpecifications(specifications);
if (source.getType() != null) {
ReadableProductType readableType = readableProductTypeMapper.convert(source.getType(), store, language);
returnDestination.setType(readableType);
}
returnDestination.setSortOrder(source.getSortOrder());
// images
Set<ProductImage> images = source.getImages();
if (CollectionUtils.isNotEmpty(images)) {
List<ReadableImage> imageList = images.stream().map(i -> this.convertImage(source, i, store)).collect(Collectors.toList());
returnDestination.setImages(imageList);
}
// quantity
ProductAvailability availability = null;
for (ProductAvailability a : source.getAvailabilities()) {
availability = a;
returnDestination.setCanBePurchased(availability.getProductStatus());
returnDestination.setQuantity(availability.getProductQuantity() == null ? 1 : availability.getProductQuantity());
}
FinalPrice price = null;
try {
price = pricingService.calculateProductPrice(source);
} catch (ServiceException e) {
throw new ConversionRuntimeException("Unable to get product price", e);
}
if (price != null) {
returnDestination.setPrice(price.getStringPrice());
}
if (returnDestination instanceof ReadableProductDefinitionFull) {
((ReadableProductDefinitionFull) returnDestination).setDescriptions(fulldescriptions);
}
return returnDestination;
}
use of com.salesmanager.core.model.catalog.product.price.FinalPrice in project shopizer by shopizer-ecommerce.
the class ShoppingOrderController method displayCheckout.
@SuppressWarnings("unused")
@RequestMapping("/checkout.html")
public String displayCheckout(@CookieValue("cart") String cookie, Model model, HttpServletRequest request, HttpServletResponse response, Locale locale) throws Exception {
Language language = (Language) request.getAttribute("LANGUAGE");
MerchantStore store = (MerchantStore) request.getAttribute(Constants.MERCHANT_STORE);
Customer customer = (Customer) request.getSession().getAttribute(Constants.CUSTOMER);
model.addAttribute("googleMapsKey", googleMapsKey);
/**
* Shopping cart
*
* ShoppingCart should be in the HttpSession
* Otherwise the cart id is in the cookie
* Otherwise the customer is in the session and a cart exist in the DB
* Else -> Nothing to display
*/
// check if an existing order exist
ShopOrder order = null;
order = super.getSessionAttribute(Constants.ORDER, request);
// Get the cart from the DB
String shoppingCartCode = (String) request.getSession().getAttribute(Constants.SHOPPING_CART);
com.salesmanager.core.model.shoppingcart.ShoppingCart cart = null;
if (StringUtils.isBlank(shoppingCartCode)) {
if (cookie == null) {
// session expired and cookie null, nothing to do
return "redirect:/shop/cart/shoppingCart.html";
}
String[] merchantCookie = cookie.split("_");
String merchantStoreCode = merchantCookie[0];
if (!merchantStoreCode.equals(store.getCode())) {
return "redirect:/shop/cart/shoppingCart.html";
}
shoppingCartCode = merchantCookie[1];
}
cart = shoppingCartFacade.getShoppingCartModel(shoppingCartCode, store);
if (cart == null && customer != null) {
cart = shoppingCartFacade.getShoppingCartModel(customer, store);
}
boolean allAvailables = true;
boolean requiresShipping = false;
boolean freeShoppingCart = true;
// Filter items, delete unavailable
Set<com.salesmanager.core.model.shoppingcart.ShoppingCartItem> availables = new HashSet<ShoppingCartItem>();
if (cart == null) {
return "redirect:/shop/cart/shoppingCart.html";
}
// Take out items no more available
Set<com.salesmanager.core.model.shoppingcart.ShoppingCartItem> items = cart.getLineItems();
for (com.salesmanager.core.model.shoppingcart.ShoppingCartItem item : items) {
Long id = item.getProduct().getId();
Product p = productService.getById(id);
if (p.isAvailable()) {
availables.add(item);
} else {
allAvailables = false;
}
FinalPrice finalPrice = pricingService.calculateProductPrice(p);
if (finalPrice.getFinalPrice().longValue() > 0) {
freeShoppingCart = false;
}
if (p.isProductShipeable()) {
requiresShipping = true;
}
}
cart.setLineItems(availables);
if (!allAvailables) {
shoppingCartFacade.saveOrUpdateShoppingCart(cart);
}
super.setSessionAttribute(Constants.SHOPPING_CART, cart.getShoppingCartCode(), request);
if (shoppingCartCode == null && cart == null) {
// error
return "redirect:/shop/cart/shoppingCart.html";
}
if (customer != null) {
if (cart.getCustomerId() != customer.getId().longValue()) {
return "redirect:/shop/shoppingCart.html";
}
} else {
customer = orderFacade.initEmptyCustomer(store);
AnonymousCustomer anonymousCustomer = (AnonymousCustomer) request.getAttribute(Constants.ANONYMOUS_CUSTOMER);
if (anonymousCustomer != null && anonymousCustomer.getBilling() != null) {
Billing billing = customer.getBilling();
billing.setCity(anonymousCustomer.getBilling().getCity());
Map<String, Country> countriesMap = countryService.getCountriesMap(language);
Country anonymousCountry = countriesMap.get(anonymousCustomer.getBilling().getCountry());
if (anonymousCountry != null) {
billing.setCountry(anonymousCountry);
}
Map<String, Zone> zonesMap = zoneService.getZones(language);
Zone anonymousZone = zonesMap.get(anonymousCustomer.getBilling().getZone());
if (anonymousZone != null) {
billing.setZone(anonymousZone);
}
if (anonymousCustomer.getBilling().getPostalCode() != null) {
billing.setPostalCode(anonymousCustomer.getBilling().getPostalCode());
}
customer.setBilling(billing);
}
}
if (CollectionUtils.isEmpty(items)) {
return "redirect:/shop/shoppingCart.html";
}
if (order == null) {
// TODO
order = orderFacade.initializeOrder(store, customer, cart, language);
}
/**
* hook for displaying or not delivery address configuration
*/
ShippingMetaData shippingMetaData = shippingService.getShippingMetaData(store);
model.addAttribute("shippingMetaData", shippingMetaData);
/**
* shipping *
*/
ShippingQuote quote = null;
if (requiresShipping) {
// System.out.println("** Berfore default shipping quote **");
// Get all applicable shipping quotes
quote = orderFacade.getShippingQuote(customer, cart, order, store, language);
model.addAttribute("shippingQuote", quote);
}
if (quote != null) {
String shippingReturnCode = quote.getShippingReturnCode();
if (StringUtils.isBlank(shippingReturnCode) || shippingReturnCode.equals(ShippingQuote.NO_POSTAL_CODE)) {
if (order.getShippingSummary() == null) {
ShippingSummary summary = orderFacade.getShippingSummary(quote, store, language);
order.setShippingSummary(summary);
// TODO DTO
request.getSession().setAttribute(Constants.SHIPPING_SUMMARY, summary);
}
if (order.getSelectedShippingOption() == null) {
order.setSelectedShippingOption(quote.getSelectedShippingOption());
}
// save quotes in HttpSession
List<ShippingOption> options = quote.getShippingOptions();
// TODO DTO
request.getSession().setAttribute(Constants.SHIPPING_OPTIONS, options);
if (!CollectionUtils.isEmpty(options)) {
for (ShippingOption shipOption : options) {
StringBuilder moduleName = new StringBuilder();
moduleName.append("module.shipping.").append(shipOption.getShippingModuleCode());
String carrier = messages.getMessage(moduleName.toString(), locale);
String note = messages.getMessage(moduleName.append(".note").toString(), locale, "");
shipOption.setDescription(carrier);
shipOption.setNote(note);
// option name
if (!StringUtils.isBlank(shipOption.getOptionCode())) {
// try to get the translate
StringBuilder optionCodeBuilder = new StringBuilder();
try {
optionCodeBuilder.append("module.shipping.").append(shipOption.getShippingModuleCode());
String optionName = messages.getMessage(optionCodeBuilder.toString(), locale);
shipOption.setOptionName(optionName);
} catch (Exception e) {
// label not found
LOGGER.warn("displayCheckout No shipping code found for " + optionCodeBuilder.toString());
}
}
}
}
}
if (quote.getDeliveryAddress() != null) {
ReadableCustomerDeliveryAddressPopulator addressPopulator = new ReadableCustomerDeliveryAddressPopulator();
addressPopulator.setCountryService(countryService);
addressPopulator.setZoneService(zoneService);
ReadableDelivery deliveryAddress = new ReadableDelivery();
addressPopulator.populate(quote.getDeliveryAddress(), deliveryAddress, store, language);
model.addAttribute("deliveryAddress", deliveryAddress);
super.setSessionAttribute(Constants.KEY_SESSION_ADDRESS, deliveryAddress, request);
}
// get shipping countries
List<Country> shippingCountriesList = orderFacade.getShipToCountry(store, language);
model.addAttribute("countries", shippingCountriesList);
} else {
// get all countries
List<Country> countries = countryService.getCountries(language);
model.addAttribute("countries", countries);
}
if (quote != null && quote.getShippingReturnCode() != null && quote.getShippingReturnCode().equals(ShippingQuote.NO_SHIPPING_MODULE_CONFIGURED)) {
LOGGER.error("Shipping quote error " + quote.getShippingReturnCode());
model.addAttribute("errorMessages", messages.getMessage(quote.getShippingReturnCode(), locale, quote.getShippingReturnCode()));
}
if (quote != null && !StringUtils.isBlank(quote.getQuoteError())) {
LOGGER.error("Shipping quote error " + quote.getQuoteError());
model.addAttribute("errorMessages", quote.getQuoteError());
}
if (quote != null && quote.getShippingReturnCode() != null && quote.getShippingReturnCode().equals(ShippingQuote.NO_SHIPPING_TO_SELECTED_COUNTRY)) {
LOGGER.error("Shipping quote error " + quote.getShippingReturnCode());
model.addAttribute("errorMessages", quote.getShippingReturnCode());
}
/**
* end shipping *
*/
// get payment methods
List<PaymentMethod> paymentMethods = paymentService.getAcceptedPaymentMethods(store);
// not free and no payment methods
if (CollectionUtils.isEmpty(paymentMethods) && !freeShoppingCart) {
LOGGER.error("No payment method configured");
model.addAttribute("errorMessages", messages.getMessage("payment.not.configured", locale, "No payments configured"));
}
if (!CollectionUtils.isEmpty(paymentMethods)) {
// select default payment method
PaymentMethod defaultPaymentSelected = null;
for (PaymentMethod paymentMethod : paymentMethods) {
if (paymentMethod.isDefaultSelected()) {
defaultPaymentSelected = paymentMethod;
break;
}
}
if (defaultPaymentSelected == null) {
// forced default selection
defaultPaymentSelected = paymentMethods.get(0);
defaultPaymentSelected.setDefaultSelected(true);
}
order.setDefaultPaymentMethodCode(defaultPaymentSelected.getPaymentMethodCode());
}
// readable shopping cart items for order summary box
ShoppingCartData shoppingCart = shoppingCartFacade.getShoppingCartData(cart, language);
model.addAttribute("cart", shoppingCart);
order.setCartCode(shoppingCart.getCode());
// order total
OrderTotalSummary orderTotalSummary = orderFacade.calculateOrderTotal(store, order, language);
order.setOrderTotalSummary(orderTotalSummary);
// if order summary has to be re-used
super.setSessionAttribute(Constants.ORDER_SUMMARY, orderTotalSummary, request);
// display hacks
if (!StringUtils.isBlank(googleMapsKey)) {
model.addAttribute("fieldDisabled", "true");
model.addAttribute("cssClass", "");
} else {
model.addAttribute("fieldDisabled", "false");
model.addAttribute("cssClass", "required");
}
model.addAttribute("order", order);
model.addAttribute("paymentMethods", paymentMethods);
/**
* template *
*/
StringBuilder template = new StringBuilder().append(ControllerConstants.Tiles.Checkout.checkout).append(".").append(store.getStoreTemplate());
return template.toString();
}
use of com.salesmanager.core.model.catalog.product.price.FinalPrice in project shopizer by shopizer-ecommerce.
the class ProductVariantApi method calculateVariant.
/**
* Calculates the price based on selected options if any
* @param id
* @param options
* @param merchantStore
* @param language
* @param response
* @return
* @throws Exception
*/
@RequestMapping(value = "/products/{id}/variant", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.OK)
@ApiOperation(httpMethod = "POST", value = "Get product price variation based on selected product", notes = "", produces = "application/json", response = ReadableProductPrice.class)
@ResponseBody
@ApiImplicitParams({ @ApiImplicitParam(name = "store", dataType = "String", defaultValue = "DEFAULT"), @ApiImplicitParam(name = "lang", dataType = "String", defaultValue = "en") })
public ReadableProductPrice calculateVariant(@PathVariable final Long id, @RequestBody ReadableSelectedProductVariant options, @ApiIgnore MerchantStore merchantStore, @ApiIgnore Language language, HttpServletResponse response) throws Exception {
Product product = productService.getById(id);
if (product == null) {
response.sendError(404, "Product not fount for id " + id);
return null;
}
List<ReadableProductVariantValue> ids = options.getOptions();
if (CollectionUtils.isEmpty(ids)) {
return null;
}
List<ReadableProductVariantValue> variants = options.getOptions();
List<ProductAttribute> attributes = new ArrayList<ProductAttribute>();
Set<ProductAttribute> productAttributes = product.getAttributes();
for (ProductAttribute attribute : productAttributes) {
Long option = attribute.getProductOption().getId();
Long optionValue = attribute.getProductOptionValue().getId();
for (ReadableProductVariantValue v : variants) {
if (v.getOption().longValue() == option.longValue() && v.getValue().longValue() == optionValue.longValue()) {
attributes.add(attribute);
}
}
}
FinalPrice price = pricingService.calculateProductPrice(product, attributes);
ReadableProductPrice readablePrice = new ReadableProductPrice();
ReadableFinalPricePopulator populator = new ReadableFinalPricePopulator();
populator.setPricingService(pricingService);
populator.populate(price, readablePrice, merchantStore, language);
return readablePrice;
}
use of com.salesmanager.core.model.catalog.product.price.FinalPrice in project shopizer by shopizer-ecommerce.
the class ManufacturerShippingCodeOrderTotalModuleImpl method caculateProductPiceVariation.
@Override
public OrderTotal caculateProductPiceVariation(final OrderSummary summary, ShoppingCartItem shoppingCartItem, Product product, Customer customer, MerchantStore store) throws Exception {
Validate.notNull(product, "product must not be null");
Validate.notNull(product.getManufacturer(), "product manufacturer must not be null");
// requires shipping summary, otherwise return null
if (summary.getShippingSummary() == null) {
return null;
}
OrderTotalInputParameters inputParameters = new OrderTotalInputParameters();
inputParameters.setItemManufacturerCode(product.getManufacturer().getCode());
inputParameters.setShippingMethod(summary.getShippingSummary().getShippingOptionCode());
LOGGER.debug("Setting input parameters " + inputParameters.toString());
/* KieSession kieSession = kieManufacturerBasedPricingContainer.newKieSession();
kieSession.insert(inputParameters);
kieSession.fireAllRules();*/
// orderTotalMethodDecision.execute(inputParameters);
LOGGER.debug("Applied discount " + inputParameters.getDiscount());
OrderTotal orderTotal = null;
if (inputParameters.getDiscount() != null) {
orderTotal = new OrderTotal();
orderTotal.setOrderTotalCode(Constants.OT_DISCOUNT_TITLE);
orderTotal.setOrderTotalType(OrderTotalType.SUBTOTAL);
orderTotal.setTitle(Constants.OT_SUBTOTAL_MODULE_CODE);
// calculate discount that will be added as a negative value
FinalPrice productPrice = pricingService.calculateProductPrice(product);
Double discount = inputParameters.getDiscount();
BigDecimal reduction = productPrice.getFinalPrice().multiply(new BigDecimal(discount));
reduction = reduction.multiply(new BigDecimal(shoppingCartItem.getQuantity()));
orderTotal.setValue(reduction);
}
return orderTotal;
}
use of com.salesmanager.core.model.catalog.product.price.FinalPrice in project shopizer by shopizer-ecommerce.
the class ShippingQuoteByWeightTest method testGetCustomShippingQuotesByWeight.
@Ignore
public // @Test
void testGetCustomShippingQuotesByWeight() throws ServiceException {
Language en = languageService.getByCode("en");
Country country = countryService.getByCode("CA");
Zone zone = zoneService.getByCode("QC");
MerchantStore store = merchantService.getByCode(MerchantStore.DEFAULT_STORE);
ProductType generalType = productTypeService.getProductType(ProductType.GENERAL_TYPE);
// set valid store postal code
store.setStorepostalcode("J4B-9J9");
Product product = new Product();
product.setProductHeight(new BigDecimal(4));
product.setProductLength(new BigDecimal(3));
product.setProductWidth(new BigDecimal(5));
product.setProductWeight(new BigDecimal(8));
product.setSku("TESTSKU");
product.setType(generalType);
product.setMerchantStore(store);
// Product description
ProductDescription description = new ProductDescription();
description.setName("Product 1");
description.setLanguage(en);
description.setProduct(product);
product.getDescriptions().add(description);
productService.create(product);
// productService.saveOrUpdate(product);
// Availability
ProductAvailability availability = new ProductAvailability();
availability.setProductDateAvailable(new Date());
availability.setProductQuantity(100);
availability.setRegion("*");
// associate with product
availability.setProduct(product);
product.getAvailabilities().add(availability);
productAvailabilityService.create(availability);
ProductPrice dprice = new ProductPrice();
dprice.setDefaultPrice(true);
dprice.setProductPriceAmount(new BigDecimal(29.99));
dprice.setProductAvailability(availability);
ProductPriceDescription dpd = new ProductPriceDescription();
dpd.setName("Base price");
dpd.setProductPrice(dprice);
dpd.setLanguage(en);
dprice.getDescriptions().add(dpd);
availability.getPrices().add(dprice);
productPriceService.create(dprice);
// get product
product = productService.getByCode("TESTSKU", en);
// check the product
Set<ProductAvailability> avails = product.getAvailabilities();
for (ProductAvailability as : avails) {
Set<ProductPrice> availabilityPrices = as.getPrices();
for (ProductPrice ps : availabilityPrices) {
System.out.println(ps.getProductPriceAmount().toString());
}
}
// check availability
Set<ProductPrice> availabilityPrices = availability.getPrices();
for (ProductPrice ps : availabilityPrices) {
System.out.println(ps.getProductPriceAmount().toString());
}
// configure shipping
ShippingConfiguration shippingConfiguration = new ShippingConfiguration();
// based on shipping or billing address
shippingConfiguration.setShippingBasisType(ShippingBasisType.SHIPPING);
shippingConfiguration.setShippingType(ShippingType.INTERNATIONAL);
// individual item pricing or box packaging (see unit test above)
shippingConfiguration.setShippingPackageType(ShippingPackageType.ITEM);
// only if package type is package
shippingConfiguration.setBoxHeight(5);
shippingConfiguration.setBoxLength(5);
shippingConfiguration.setBoxWidth(5);
shippingConfiguration.setBoxWeight(1);
shippingConfiguration.setMaxWeight(10);
List<String> supportedCountries = new ArrayList<String>();
supportedCountries.add("CA");
supportedCountries.add("US");
supportedCountries.add("UK");
supportedCountries.add("FR");
shippingService.setSupportedCountries(store, supportedCountries);
CustomShippingQuotesConfiguration customConfiguration = new CustomShippingQuotesConfiguration();
customConfiguration.setModuleCode("weightBased");
customConfiguration.setActive(true);
CustomShippingQuotesRegion northRegion = new CustomShippingQuotesRegion();
northRegion.setCustomRegionName("NORTH");
List<String> countries = new ArrayList<String>();
countries.add("CA");
countries.add("US");
northRegion.setCountries(countries);
CustomShippingQuoteWeightItem caQuote4 = new CustomShippingQuoteWeightItem();
caQuote4.setMaximumWeight(4);
caQuote4.setPrice(new BigDecimal(20));
CustomShippingQuoteWeightItem caQuote10 = new CustomShippingQuoteWeightItem();
caQuote10.setMaximumWeight(10);
caQuote10.setPrice(new BigDecimal(50));
CustomShippingQuoteWeightItem caQuote100 = new CustomShippingQuoteWeightItem();
caQuote100.setMaximumWeight(100);
caQuote100.setPrice(new BigDecimal(120));
List<CustomShippingQuoteWeightItem> quotes = new ArrayList<CustomShippingQuoteWeightItem>();
quotes.add(caQuote4);
quotes.add(caQuote10);
quotes.add(caQuote100);
northRegion.setQuoteItems(quotes);
customConfiguration.getRegions().add(northRegion);
// create an integration configuration - USPS
IntegrationConfiguration configuration = new IntegrationConfiguration();
configuration.setActive(true);
configuration.setEnvironment(Environment.TEST.name());
configuration.setModuleCode("weightBased");
// configure module
shippingService.saveShippingConfiguration(shippingConfiguration, store);
// create the basic configuration
shippingService.saveShippingQuoteModuleConfiguration(configuration, store);
// and the custom configuration
shippingService.saveCustomShippingConfiguration("weightBased", customConfiguration, store);
// now create ShippingProduct
ShippingProduct shippingProduct1 = new ShippingProduct(product);
FinalPrice price = pricingService.calculateProductPrice(product);
shippingProduct1.setFinalPrice(price);
List<ShippingProduct> shippingProducts = new ArrayList<ShippingProduct>();
shippingProducts.add(shippingProduct1);
Customer customer = new Customer();
customer.setMerchantStore(store);
customer.setEmailAddress("test@test.com");
customer.setGender(CustomerGender.M);
customer.setDefaultLanguage(en);
customer.setAnonymous(true);
customer.setCompany("ifactory");
customer.setDateOfBirth(new Date());
customer.setNick("My nick");
customer.setPassword("123456");
Delivery delivery = new Delivery();
delivery.setAddress("Shipping address");
delivery.setCity("Boucherville");
delivery.setCountry(country);
delivery.setZone(zone);
delivery.setPostalCode("J5C-6J4");
// overwrite delivery to US
/* delivery.setPostalCode("90002");
delivery.setCountry(us);
Zone california = zoneService.getByCode("CA");
delivery.setZone(california);*/
Billing billing = new Billing();
billing.setAddress("Billing address");
billing.setCountry(country);
billing.setZone(zone);
billing.setPostalCode("J4B-8J9");
billing.setFirstName("Carl");
billing.setLastName("Samson");
customer.setBilling(billing);
customer.setDelivery(delivery);
customerService.create(customer);
// for correlation
Long dummyCartId = 0L;
ShippingQuote shippingQuote = shippingService.getShippingQuote(dummyCartId, store, delivery, shippingProducts, en);
Assert.notNull(shippingQuote);
}
Aggregations