use of org.broadleafcommerce.profile.core.domain.Customer in project BroadleafCommerce by BroadleafCommerce.
the class FulfillmentGroupDaoTest method createDefaultFulfillmentGroup.
@Test(groups = "createDefaultFulfillmentGroup", dataProvider = "basicFulfillmentGroup", dataProviderClass = FulfillmentGroupDataProvider.class)
@Transactional
@Rollback(false)
public void createDefaultFulfillmentGroup(FulfillmentGroup fulfillmentGroup) {
Customer customer = createCustomerWithBasicOrderAndAddresses();
Address address = (customerAddressDao.readActiveCustomerAddressesByCustomerId(customer.getId())).get(0).getAddress();
Order salesOrder = orderDao.readOrdersForCustomer(customer.getId()).get(0);
FulfillmentGroup newFG = fulfillmentGroupDao.createDefault();
newFG.setAddress(address);
newFG.setRetailShippingPrice(fulfillmentGroup.getRetailShippingPrice());
newFG.setMethod(fulfillmentGroup.getMethod());
newFG.setService(fulfillmentGroup.getService());
newFG.setOrder(salesOrder);
newFG.setReferenceNumber(fulfillmentGroup.getReferenceNumber());
assert newFG.getId() == null;
fulfillmentGroup = fulfillmentGroupService.save(newFG);
assert fulfillmentGroup.getId() != null;
defaultFulfillmentGroupOrderId = salesOrder.getId();
defaultFulfillmentGroupId = fulfillmentGroup.getId();
}
use of org.broadleafcommerce.profile.core.domain.Customer in project BroadleafCommerce by BroadleafCommerce.
the class FulfillmentGroupItemDaoTest method createDefaultFulfillmentGroup.
@Test(groups = "createItemFulfillmentGroup", dataProvider = "basicFulfillmentGroup", dataProviderClass = FulfillmentGroupDataProvider.class, dependsOnGroups = { "createOrder", "createCustomerAddress" })
@Rollback(false)
@Transactional
public void createDefaultFulfillmentGroup(FulfillmentGroup fulfillmentGroup) {
String userName = "customer1";
Customer customer = customerService.readCustomerByUsername(userName);
Address address = (customerAddressDao.readActiveCustomerAddressesByCustomerId(customer.getId())).get(0).getAddress();
salesOrder = orderDao.createNewCartForCustomer(customer);
FulfillmentGroup newFG = fulfillmentGroupDao.createDefault();
newFG.setAddress(address);
newFG.setRetailShippingPrice(fulfillmentGroup.getRetailShippingPrice());
newFG.setMethod(fulfillmentGroup.getMethod());
newFG.setService(fulfillmentGroup.getService());
newFG.setOrder(salesOrder);
newFG.setReferenceNumber(fulfillmentGroup.getReferenceNumber());
assert newFG.getId() == null;
this.fulfillmentGroup = fulfillmentGroupService.save(newFG);
assert this.fulfillmentGroup.getId() != null;
}
use of org.broadleafcommerce.profile.core.domain.Customer in project BroadleafCommerce by BroadleafCommerce.
the class OrderDaoTest method createOrder.
@Test(groups = { "createOrder" }, dataProvider = "basicOrder", dataProviderClass = OrderDataProvider.class, dependsOnGroups = { "readCustomer", "createPhone" })
@Rollback(false)
@Transactional
public void createOrder(Order order) {
userName = "customer1";
Customer customer = customerService.readCustomerByUsername(userName);
assert order.getId() == null;
order.setCustomer(customer);
order = orderDao.save(order);
assert order.getId() != null;
orderId = order.getId();
}
use of org.broadleafcommerce.profile.core.domain.Customer in project BroadleafCommerce by BroadleafCommerce.
the class OrderDaoTest method readOrdersForCustomer.
@Test(groups = { "readOrdersForCustomer" }, dependsOnGroups = { "readCustomer", "createOrder" })
@Transactional
public void readOrdersForCustomer() {
userName = "customer1";
Customer user = customerService.readCustomerByUsername(userName);
List<Order> orders = orderDao.readOrdersForCustomer(user.getId());
assert orders.size() > 0;
}
use of org.broadleafcommerce.profile.core.domain.Customer in project BroadleafCommerce by BroadleafCommerce.
the class CartTest method testMergeWithNoAnonymousCart.
@Transactional
@Test(groups = { "testMergeCart" })
public void testMergeWithNoAnonymousCart() throws PricingException, RemoveFromCartException, AddToCartException {
Order anonymousCart = null;
Order customerCart = setUpCartWithActiveSku();
Customer customer = customerCart.getCustomer();
MergeCartResponse response = mergeCartService.mergeCart(customer, anonymousCart);
assert response.getOrder().getOrderItems().size() == 1;
assert response.getOrder().getId().equals(customerCart.getId());
assert response.isMerged() == false;
}
Aggregations