use of org.broadleafcommerce.profile.core.domain.Customer in project BroadleafCommerce by BroadleafCommerce.
the class OrderTest method testReadOrdersForCustomer.
@Test(groups = { "testReadOrdersForCustomer" }, dependsOnGroups = { "findNamedOrderForCustomer" })
@Transactional
public void testReadOrdersForCustomer() throws PricingException {
Customer customer = customerService.createCustomerFromId(null);
Order order = orderService.createNewCartForCustomer(customer);
order.setStatus(OrderStatus.IN_PROCESS);
order = orderService.save(order, false);
List<Order> newOrders = orderService.findOrdersForCustomer(customer, OrderStatus.IN_PROCESS);
boolean containsOrder = false;
if (newOrders.contains(order)) {
containsOrder = true;
}
assert containsOrder == true;
containsOrder = false;
newOrders = orderService.findOrdersForCustomer(customer, null);
if (newOrders.contains(order)) {
containsOrder = true;
}
assert containsOrder == true;
}
use of org.broadleafcommerce.profile.core.domain.Customer in project BroadleafCommerce by BroadleafCommerce.
the class OrderTest method testSubmitOrder.
@Test(groups = { "testSubmitOrder" }, dependsOnGroups = { "findNamedOrderForCustomer" })
public void testSubmitOrder() throws PricingException {
Customer customer = customerService.createCustomerFromId(null);
Order order = orderService.createNewCartForCustomer(customer);
order.setStatus(OrderStatus.IN_PROCESS);
order = orderService.save(order, false);
Long orderId = order.getId();
Order confirmedOrder = orderService.confirmOrder(order);
confirmedOrder = orderService.findOrderById(confirmedOrder.getId());
Long confirmedOrderId = confirmedOrder.getId();
assert orderId.equals(confirmedOrderId);
assert confirmedOrder.getStatus().equals(OrderStatus.SUBMITTED);
}
use of org.broadleafcommerce.profile.core.domain.Customer in project BroadleafCommerce by BroadleafCommerce.
the class OrderTest method testOrderPaymentInfos.
@Test(groups = { "testOrderPaymentInfos" }, dataProvider = "basicPaymentInfo", dataProviderClass = PaymentInfoDataProvider.class)
@Transactional
public void testOrderPaymentInfos(OrderPayment info) throws PricingException {
Customer customer = customerService.saveCustomer(createNamedCustomer());
Order order = orderService.createNewCartForCustomer(customer);
info = orderService.addPaymentToOrder(order, info, null);
boolean foundInfo = false;
assert order.getPayments() != null;
for (OrderPayment testInfo : order.getPayments()) {
if (testInfo.equals(info)) {
foundInfo = true;
}
}
assert foundInfo == true;
assert orderService.findPaymentsForOrder(order) != null;
}
use of org.broadleafcommerce.profile.core.domain.Customer in project BroadleafCommerce by BroadleafCommerce.
the class OrderTest method findCartForAnonymousCustomer.
@Test(groups = { "findCartForAnonymousCustomer" }, dependsOnGroups = { "getOrdersForCustomer" })
public void findCartForAnonymousCustomer() {
Customer customer = customerService.createCustomerFromId(null);
Order order = orderService.findCartForCustomer(customer);
assert order == null;
order = orderService.createNewCartForCustomer(customer);
Long orderId = order.getId();
Order newOrder = orderService.findOrderById(orderId);
assert newOrder != null;
assert newOrder.getCustomer() != null;
}
use of org.broadleafcommerce.profile.core.domain.Customer in project BroadleafCommerce by BroadleafCommerce.
the class OrderTest method findCurrentCartForCustomer.
@Test(groups = { "findCurrentCartForCustomer" }, dependsOnGroups = { "readCustomer", "createPhone", "createCartForCustomer" })
@Transactional
@Rollback(false)
public void findCurrentCartForCustomer() {
String userName = "customer1";
Customer customer = customerService.readCustomerByUsername(userName);
Order order = orderService.findCartForCustomer(customer);
assert order != null;
assert order.getId() != null;
this.orderId = order.getId();
}
Aggregations