summaryrefslogtreecommitdiffstats
path: root/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/logic/Cart.java
blob: b636de2f73c2db8b95d30db8158025e1a3b608fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package examples.shop.logic;

import java.util.List;

import examples.shop.impl.entity.LineItem;

/**
 * The Cart interface.
 */
public interface Cart {

    /**
     * Adds an item to the shopping cart
     */
    public void add(LineItem lineItem);
    
    /**
     * Changes the quantities of contents in the shopping cart
     */
    public void modify(String productID, int quantity) 
        throws Exception;

    /**
     * Returns all the shopping cart line items
     * 
     * @return A collection of Cart LineItems
     */
    public List<LineItem> getAll();

    /**
     * Empties the shopping cart
     */
    public void clear();

    /**
     * Get/set methods for the shopping cart owner's name
     */
    public String getOwner();
    
    public void setOwner(String owner);

    /**
     * Purchases this cart. The cart will create an order in the database.
     * 
     * @return The Order confirmation number
     */
    public String purchase();    
    
   /**
     * Returns the subtotal price which has been previously set by
     * setSubtotal().
     * 
     * @return the subtotal of this cart items.
     */ 
    public double getSubtotal();

   /**
     * Sets the subtotal price. Our external pricer bean is responsible for
     * calculating the subtotal. It calculates it based upon customer discounts
     * (and can be extended to include other rules as well).
     */
    public void setSubtotal(double subTotal);
    
  /**
     * Returns the taxes for this Quote.
     */
    public double getTaxes();
    
    /**
     * Sets the taxes for this Quote.
     */
    public void setTaxes(double taxes);    
    
    /**
     * Returns the total price. Total Price is computed from: 1) Subtotal price
     * 2) Tax
     */	
    public double getTotalPrice();
   

}