Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Decouple OrderFacade from ShoppingCartService #1062

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.salesmanager.core.business.services.shoppingcart;

import com.salesmanager.core.model.merchant.MerchantStore;
import com.salesmanager.core.model.shipping.ShippingProduct;
import com.salesmanager.core.model.shoppingcart.ShoppingCart;

import java.util.List;

/**
* Adapter interface for shopping cart operations needed by the orders domain
*/
public interface ShoppingCartAdapter {

/**
* Get shopping cart by ID
*/
ShoppingCart getById(Long cartId, MerchantStore store) throws Exception;

/**
* Save or update shopping cart
*/
void saveOrUpdate(ShoppingCart shoppingCart) throws Exception;

/**
* Create shipping products from cart
*/
List<ShippingProduct> createShippingProducts(ShoppingCart cart) throws Exception;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.salesmanager.core.business.services.shoppingcart;

import com.salesmanager.core.model.merchant.MerchantStore;
import com.salesmanager.core.model.shipping.ShippingProduct;
import com.salesmanager.core.model.shoppingcart.ShoppingCart;
import org.springframework.stereotype.Service;

import javax.inject.Inject;
import java.util.List;

@Service("shoppingCartAdapter")
public class ShoppingCartAdapterImpl implements ShoppingCartAdapter {

@Inject
private ShoppingCartService shoppingCartService;

@Override
public ShoppingCart getById(Long cartId, MerchantStore store) throws Exception {
return shoppingCartService.getById(cartId, store);
}

@Override
public void saveOrUpdate(ShoppingCart shoppingCart) throws Exception {
shoppingCartService.saveOrUpdate(shoppingCart);
}

@Override
public List<ShippingProduct> createShippingProducts(ShoppingCart cart) throws Exception {
return shoppingCartService.createShippingProduct(cart);
}
}
Loading