org.paneris.melati.shopping
Class DefaultShoppingTrolley

java.lang.Object
  extended by org.paneris.melati.shopping.ShoppingTrolley
      extended by org.paneris.melati.shopping.DefaultShoppingTrolley

public class DefaultShoppingTrolley
extends ShoppingTrolley

A Shopping Trolley stores information in the user's Shopping Trolley.

It does this by storing itself in the session.

For this reason, the constructors are private, and you will be expected always to get the Shopping Trolley using getInstance();

usage example: ShoppingTrolley trolley = ShoppingTrolley.getInstance(Melati melati); context.put("trolley", trolley);


Field Summary
 
Fields inherited from class org.paneris.melati.shopping.ShoppingTrolley
address, config, country, county, email, hasDetails, locale, melati, message, name, postcode, tel, town, VAT_PERCENT_TIMES_TEN
 
Constructor Summary
DefaultShoppingTrolley()
           
 
Method Summary
 void assertLogin(org.melati.Melati melatiIn)
          Do something to force users to login.
 void confirmPayment(org.melati.Melati melatiIn)
          A call back point for the payment server.
 double getDeliveryValue()
          You need to provide some mechanism for calculating the delivery value for the order (item delivery values are calculated individually.
 double getDiscountRate()
          If you want to apply a discount to this order, do it here.
 java.util.Locale getLocale()
          Set the Locale for this trolley.
 boolean hasDelivery()
          Provide a mechanism for working out if this order should include a delivery charge.
 boolean hasDiscount()
          Provide a mechanism for working out if this order should include a discount.
 boolean hasVAT()
          Provide a mechanism for working out whether this order should include VAT (default should be true).
 void load(java.lang.Integer id)
          Load a trolley from something persistent.
 void save()
          Save a trolley to something persistent.
 void setDefaultDetails(org.melati.Melati melati)
          Set the user's detault details into this trolley.
 
Methods inherited from class org.paneris.melati.shopping.ShoppingTrolley
abandonURL, addItem, baseURL, configureRequest, confirmURL, detailsURL, displayCurrency, displayCurrency, getCountry, getCounty, getDeliveryAddress, getDeliveryDisplay, getDiscountRateDisplay, getDiscountValue, getDiscountValueDisplay, getEmail, getInstance, getItem, getItems, getMessage, getName, getPostcode, getTel, getTotalDeliveryValue, getTotalValue, getTotalValueDisplay, getTotalValuePence, getTown, getValue, getValueDisplay, getVATDisplay, getVATValue, hasDetails, initialise, initialise, isEmpty, name, newItem, newTrolley, paidURL, remove, removeItem, roundTo2dp, setCountry, setCounty, setDeliveryAddress, setEmail, setFromForm, setLocale, setMessage, setName, setPostcode, setTel, setTown, updateURL, viewURL
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultShoppingTrolley

public DefaultShoppingTrolley()
Method Detail

getLocale

public java.util.Locale getLocale()
Set the Locale for this trolley.

Specified by:
getLocale in class ShoppingTrolley

load

public void load(java.lang.Integer id)
Load a trolley from something persistent.

Specified by:
load in class ShoppingTrolley

save

public void save()
Save a trolley to something persistent.

Specified by:
save in class ShoppingTrolley

setDefaultDetails

public void setDefaultDetails(org.melati.Melati melati)
Set the user's detault details into this trolley. This is useful if users have already logged in, and we don't want them to reenter their details.

Specified by:
setDefaultDetails in class ShoppingTrolley

assertLogin

public void assertLogin(org.melati.Melati melatiIn)
Do something to force users to login. You should throw an access poem exception in order to generate the login page.

Specified by:
assertLogin in class ShoppingTrolley

hasDelivery

public boolean hasDelivery()
Provide a mechanism for working out if this order should include a delivery charge.

Specified by:
hasDelivery in class ShoppingTrolley

getDeliveryValue

public double getDeliveryValue()
You need to provide some mechanism for calculating the delivery value for the order (item delivery values are calculated individually.

Specified by:
getDeliveryValue in class ShoppingTrolley

hasDiscount

public boolean hasDiscount()
Provide a mechanism for working out if this order should include a discount.

Specified by:
hasDiscount in class ShoppingTrolley

getDiscountRate

public double getDiscountRate()
If you want to apply a discount to this order, do it here.

Specified by:
getDiscountRate in class ShoppingTrolley

hasVAT

public boolean hasVAT()
Provide a mechanism for working out whether this order should include VAT (default should be true).

Specified by:
hasVAT in class ShoppingTrolley

confirmPayment

public void confirmPayment(org.melati.Melati melatiIn)
A call back point for the payment server.

Specified by:
confirmPayment in class ShoppingTrolley


Copyright © 1997-2009 PanEris. All Rights Reserved.