com.konakart.bl
Class OrderMgr

java.lang.Object
  extended by com.konakart.bl.BaseMgr
      extended by com.konakart.bl.OrderMgr
All Implemented Interfaces:
OrderMgrIf

public class OrderMgr
extends BaseMgr
implements OrderMgrIf

Manages all business logic relevant to the management of orders within the system


Field Summary
static int CANCELLED_STATUS
          CANCELLED_STATUS Order Status.
static int DELIVERED_STATUS
          DELIVERED Order Status.
protected static org.apache.commons.logging.Log log
          the log
static int ORD_PROD_CUSTOMER_INFORMED_OF_DELIVERY_DATE
          Product wasn't in stock and but customer has been informed of the delivery date when order was created.
static int ORD_PROD_IN_STOCK
          Product in stock when order was created.
static int ORD_PROD_OUT_OF_STOCK_AVAILABLE_DATE_KNOWN
          Product out of stock but with known availability date when order was created.
static int ORD_PROD_OUT_OF_STOCK_AVAILABLE_DATE_UNKNOWN
          Product out of stock and availability date unknown when order was created.
static int ORD_PROD_PARTIALLY_OUT_OF_STOCK_AVAILABLE_DATE_KNOWN
          Product not in stock with the required quantity but with known availability date when order was created.
static int ORD_PROD_PARTIALLY_OUT_OF_STOCK_AVAILABLE_DATE_UNKNOWN
          Product not in stock with the required quantity and availability date unknown when order was created.
static int PARTIALLY_DELIVERED_STATUS
          PARTIALLY_DELIVERED_STATUS Order Status.
static int PAYMENT_DECLINED_STATUS
          PAYMENT_DECLINED Order Status.
static int PAYMENT_RECEIVED_STATUS
          PAYMENT_RECEIVED Order Status.
static int PENDING_STATUS
          PENDING Order Status.
static int PROCESSING_STATUS
          PROCESSING Order Status.
protected static int secretKeyLength
          Mutex for the Manager
static int WAITING_PAYMENT_STATUS
          WAITING_PAYMENT Order Status.
 
Fields inherited from class com.konakart.bl.BaseMgr
templateBaseDir
 
Constructor Summary
OrderMgr(KKEngIf eng)
          Constructor
 
Method Summary
protected  void addTaxRateObjects(Order order, int taxClassId, java.util.HashMap<java.lang.Integer,TaxRate> taxRateMap)
          We get the tax rate objects for the order and taxClassId and add them to the hash map.
 Order changeDeliveryAddress(java.lang.String sessionId, OrderIf order, AddressIf deliveryAddress)
          The current delivery address is substituted with the new one.
 void changeOrderStatus(int orderId, int status, boolean customerNotified, java.lang.String comments)
          The state of the current order id changed and an orders_status_history record is added to the order to keep track of the change.
 void changeOrderStatus(java.lang.String sessionId, int orderId, int status, boolean customerNotified, java.lang.String comments)
          The state of the current order id changed and an orders_status_history record is added to the order to keep track of the change.
protected  AddToBasketOptionsIf createAddToBasketOptions(CreateOrderOptionsIf options)
          Creates an AddToBasketOptions object from an CreateOrderOptions
 Order createAndSaveOrder(java.lang.String emailAddr, java.lang.String password, CustomerRegistrationIf custReg, BasketIf[] basketItemArray, java.lang.String shippingModule, java.lang.String paymentModule, int languageId)
           
protected  FetchProductOptionsIf createFetchProductOptions(CreateOrderOptionsIf options)
          Creates a FetchProductOptions object from an CreateOrderOptions
 Order createOrder(java.lang.String sessionId, BasketIf[] basketItemArray, int languageId)
          An order object is returned with all addresses populated with the default address of the customer referenced by the session Id.
 Order createOrderWithOptions(java.lang.String sessionId, BasketIf[] basketItemArray, CreateOrderOptionsIf options, int languageId)
          An order object is returned with all addresses populated with the default address of the customer referenced by the session Id.
 void deleteOrderIdForSecretKey(java.lang.String secretKey)
          The order id stored in the database and indexed by the secretKey, is deleted
protected  boolean doesOrderStatusExist(int status)
          Determines whether an order_status record exists for the status id parameter
protected  void formatOrderAddresses(Order order)
          It gets the address templates for all three addresses and sets the formatted addresses
 OrderStatus[] getAllOrderStatuses(int languageId)
          Returns an array of Order Status objects for a given language
protected  int getCount(KKCriteria c)
          This method is mainly used for paging.
 IpnHistory[] getIpnHistory(int orderId)
          Retrieve an array of IpnHistory objects for an order
 IpnHistory[] getIpnHistory(java.lang.String sessionId, int orderId)
          Retrieve an array of IpnHistory objects for an order.
protected  java.lang.String getModuleCodeFromQuote(ShippingQuoteIf sq)
          Return a shipping module code from the Shipping Quote.
 Order getOrder(java.lang.String sessionId, int orderId, int languageId)
          Retrieve an order for the customer referenced by the sessionId.
protected  void getOrderCountryAndZone(Order order)
          Instantiate the Country and Zone objects for the order
protected  void getOrderDetails(Order order, int languageId)
          Calls methods to get all of the details of the order
 Order getOrderForOrderId(int orderId, int languageId)
          Retrieve an order for an orderId.
 int getOrderIdFromSecretKey(java.lang.String secretKey)
          The order id stored in the database and indexed by the secretKey, is returned
protected  OrderIntegrationMgrInterface getOrderIntegrationMgr()
          Used to get an instance of the OrderIntegrationMgr
protected  void getOrderProducts(Order order)
          Get the OrderProduct and the Options of each OrderProduct for this order.
 Orders getOrdersPerCustomer(DataDescriptorIf dataDesc, java.lang.String sessionId, int languageId)
          Retrieve a number of orders for the customer referenced by the sessionId.
 int getOrderStatus(java.lang.String sessionId, int orderId)
          Get the order status for an order.
protected  java.lang.String getOrderStatusText(int statusId, int languageId)
          It returns the text of the order status based on the status id and the language
protected  void getOrderTotals(Order order)
          Populates the Order object with an array of OrderTotal objects sorted by the sortOrder attribute
protected  ReorderMgrInterface getReorderMgr()
          Used to get an instance of the ReorderMgr
 java.lang.String getSecretKeyForOrderId(int orderId)
          Every time we send a notification to a payment gateway, we get a new secret key for the order, which is sent back to us in the reply.
 java.lang.String getStatusText(int statusId, int languageId)
          Returns the text of a status from the orders_status table
protected  void getStatusTrail(Order order, int languageId)
          Populates the Order object with an array of OrderStatusHistory objects
protected  java.math.BigDecimal getTaxRate(Order order, int taxClassId)
          We get the tax rate for the order and taxClassId
 TaxRate[] getTaxRateObjectsPerOrder(Order order)
          Returns a list of TaxRate objects used by this order.
protected  void manageDataDescriptor(DataDescriptorIf dataDesc, org.apache.torque.util.Criteria c)
          Provides common code to deal with the management of the DataDescriptor.
 int saveIpnHistory(java.lang.String sessionId, IpnHistoryIf ipnHistory)
          The IpnHistory object is saved in the database.
 int saveOrder(java.lang.String sessionId, OrderIf order, int languageId)
          A new order is created in the DB.
 Orders searchForOrdersPerCustomer(java.lang.String sessionId, DataDescriptorIf dataDesc, OrderSearchIf orderSearch, int languageId)
          Return orders matching the search criteria.
 void setCreditCardDetailsOnOrder(java.lang.String sessionId, int orderId, CreditCardIf card)
          The credit card details in the CreditCard object passed in as a parameter, are saved in the database for an existing order.
protected  void setCriteriaWithStandardAttributes(KKCriteria c, int languageId)
          Set the criteria object with all of the attributes for an order
 void setRewardPointReservationId(int customerId, int orderId, int reservationId)
          Verifies that the order belongs to the customer identified by the customerId parameter and then updates the reservation id.
 void setRewardPointReservationId(java.lang.String sessionId, int orderId, int reservationId)
          Verifies that the order belongs to the customer identified by the sessionId parameter and then updates the reservation id.
 void updateInventory(java.lang.String sessionId, int orderId)
          If the STOCK_LIMITED configuration variable is set to true, we subtract the products in stock by the product orders.
 void updateInventoryWithOptions(java.lang.String sessionId, int orderId, CreateOrderOptionsIf options)
          If the STOCK_LIMITED configuration variable is set to true, we subtract the products in stock by the product orders.
 
Methods inherited from class com.konakart.bl.BaseMgr
addInsertAttr, addInsertAttr, checkRequired, getAdminEngMgr, getBasketMgr, getBillingMgr, getBookableProductMgr, getCatMgr, getConfigMgr, getCookieMgr, getCurrMgr, getCustMgr, getCustomerIdFromSession, getCustomerStatsMgr, getCustomerTagMgr, getEmailMgr, getEng, getLangMgr, getManuMgr, getMiscItemMgr, getMode, getModeString, getMqMgr, getMultiStoreMgr, getNewCriteria, getNewCriteria, getOrderMgr, getOrderTotalMgr, getPaymentMgr, getProdMgr, getPromMgr, getRewardPointMgr, getSecMgr, getShippingMgr, getSolrMgr, getStoreId, getTaxMgr, getTemplate, getTemplateRoot, getVelocityContextMgr, getWishListMgr, init, isEnterprise, isMultiStoreShareCustomers, isMultiStoreShareProducts
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ORD_PROD_IN_STOCK

public static final int ORD_PROD_IN_STOCK
Product in stock when order was created.

See Also:
Constant Field Values

ORD_PROD_OUT_OF_STOCK_AVAILABLE_DATE_KNOWN

public static final int ORD_PROD_OUT_OF_STOCK_AVAILABLE_DATE_KNOWN
Product out of stock but with known availability date when order was created.

See Also:
Constant Field Values

ORD_PROD_OUT_OF_STOCK_AVAILABLE_DATE_UNKNOWN

public static final int ORD_PROD_OUT_OF_STOCK_AVAILABLE_DATE_UNKNOWN
Product out of stock and availability date unknown when order was created.

See Also:
Constant Field Values

ORD_PROD_PARTIALLY_OUT_OF_STOCK_AVAILABLE_DATE_KNOWN

public static final int ORD_PROD_PARTIALLY_OUT_OF_STOCK_AVAILABLE_DATE_KNOWN
Product not in stock with the required quantity but with known availability date when order was created.

See Also:
Constant Field Values

ORD_PROD_PARTIALLY_OUT_OF_STOCK_AVAILABLE_DATE_UNKNOWN

public static final int ORD_PROD_PARTIALLY_OUT_OF_STOCK_AVAILABLE_DATE_UNKNOWN
Product not in stock with the required quantity and availability date unknown when order was created.

See Also:
Constant Field Values

ORD_PROD_CUSTOMER_INFORMED_OF_DELIVERY_DATE

public static final int ORD_PROD_CUSTOMER_INFORMED_OF_DELIVERY_DATE
Product wasn't in stock and but customer has been informed of the delivery date when order was created.

See Also:
Constant Field Values

log

protected static org.apache.commons.logging.Log log
the log


secretKeyLength

protected static final int secretKeyLength
Mutex for the Manager

See Also:
Constant Field Values

PENDING_STATUS

public static final int PENDING_STATUS
PENDING Order Status. It is the state that the order receives when it is first created and saved in the database. If the order may go ahead without payment (i.e. Cash on Delivery) then through the administration tool the state can be changed to PROCESSING.

See Also:
Constant Field Values

PROCESSING_STATUS

public static final int PROCESSING_STATUS
PROCESSING Order Status. This state can be set through the administration tool. It means that the order has been accepted and is being processed.

See Also:
Constant Field Values

DELIVERED_STATUS

public static final int DELIVERED_STATUS
DELIVERED Order Status. This state can be set through the administration tool. It means that the order has been delivered to the customer. This state is set automatically by KonaKart if the order consists of only Digital Download products since the Digital Download products are delivered instantly and automatically through the creation of download links..

See Also:
Constant Field Values

WAITING_PAYMENT_STATUS

public static final int WAITING_PAYMENT_STATUS
WAITING_PAYMENT Order Status. The order is blocked until payment arrives. This state is set automatically when waiting for the response from a payment gateway.

See Also:
Constant Field Values

PAYMENT_RECEIVED_STATUS

public static final int PAYMENT_RECEIVED_STATUS
PAYMENT_RECEIVED Order Status. Payment has been received for the order. Through the administration tool, the state of the order may now be set to PROCESSING.

See Also:
Constant Field Values

PAYMENT_DECLINED_STATUS

public static final int PAYMENT_DECLINED_STATUS
PAYMENT_DECLINED Order Status. This state is set when payment has been declined from a payment gateway.

See Also:
Constant Field Values

PARTIALLY_DELIVERED_STATUS

public static final int PARTIALLY_DELIVERED_STATUS
PARTIALLY_DELIVERED_STATUS Order Status. This state can be set through the administration tool. It means that some of the order items have been delivered to the customer. This state is set automatically by KonaKart if the order consists of some Digital Download products and some physical products. The Digital Download products are delivered instantly.

See Also:
Constant Field Values

CANCELLED_STATUS

public static final int CANCELLED_STATUS
CANCELLED_STATUS Order Status. This state can be set through the administration tool. It means that the order has been cancelled.

See Also:
Constant Field Values
Constructor Detail

OrderMgr

public OrderMgr(KKEngIf eng)
         throws java.lang.Exception
Constructor

Parameters:
eng -
Throws:
java.lang.Exception
Method Detail

saveOrder

public int saveOrder(java.lang.String sessionId,
                     OrderIf order,
                     int languageId)
              throws java.lang.Exception
A new order is created in the DB. The Order object parameter should have all addresses populated (customer, billing and delivery). The status of the newly created order is taken from the order itself. A check is made to determine whether the status exists within the orders_status table. To save an order we have to write into a few DB tables: orders, orders_products, orders_products_attributes, orders_total, orders_status_history. We do this in a single transaction.

Specified by:
saveOrder in interface OrderMgrIf
Parameters:
sessionId -
order -
languageId -
Returns:
The id of the new order
Throws:
java.lang.Exception

getModuleCodeFromQuote

protected java.lang.String getModuleCodeFromQuote(ShippingQuoteIf sq)
Return a shipping module code from the Shipping Quote. If the moduleCode attribute is not null and not empty we use that, otherwise we use the code attribute.

The code and moduleCode on the ShippingQuote should be identical if there aren't multiple quotes for the shipping module but in the case of the more complex shipping modules such as UPS, UPSINT, FEDEX etc... multiple quotes are possible and in these circumstances the code has "_n" (where 'n' is an integer) append to the code to make it unique for showing on the UI for selection by the user.

The reason the ModuleCode is checked here for null and empty string is that it is possible that an older shipping module isn't populating the new moduleCode attribute - in these cases we revert to the old behaviour of just using the code attribute.

Parameters:
sq -
Returns:
a shipping module code from the Shipping Quote. Returns null if the ShippingQuote is null.

getOrderIntegrationMgr

protected OrderIntegrationMgrInterface getOrderIntegrationMgr()
                                                       throws org.apache.torque.TorqueException,
                                                              KKException,
                                                              com.workingdogs.village.DataSetException,
                                                              java.lang.Exception
Used to get an instance of the OrderIntegrationMgr

Returns:
Returns an OrderIntegrationMgr Object
Throws:
java.lang.Exception
com.workingdogs.village.DataSetException
KKException
org.apache.torque.TorqueException

getReorderMgr

protected ReorderMgrInterface getReorderMgr()
Used to get an instance of the ReorderMgr

Returns:
Returns an ReorderMgr Object

createOrder

public Order createOrder(java.lang.String sessionId,
                         BasketIf[] basketItemArray,
                         int languageId)
                  throws java.lang.Exception
An order object is returned with all addresses populated with the default address of the customer referenced by the session Id. The products being ordered are retrieved from the basketItemArray. The returned object has not been saved in the DB.

Specified by:
createOrder in interface OrderMgrIf
Parameters:
sessionId -
basketItemArray -
languageId -
Returns:
Order object
Throws:
java.lang.Exception

createOrderWithOptions

public Order createOrderWithOptions(java.lang.String sessionId,
                                    BasketIf[] basketItemArray,
                                    CreateOrderOptionsIf options,
                                    int languageId)
                             throws java.lang.Exception
An order object is returned with all addresses populated with the default address of the customer referenced by the session Id. The products being ordered are retrieved from the basketItemArray. The returned object has not been saved in the DB.
If the options parameter is set to null, the functionality is identical to createOrder(), otherwise the option parameters are used to determine the additional functionality.

Specified by:
createOrderWithOptions in interface OrderMgrIf
Parameters:
sessionId -
basketItemArray -
options -
languageId -
Returns:
Order object
Throws:
java.lang.Exception

changeDeliveryAddress

public Order changeDeliveryAddress(java.lang.String sessionId,
                                   OrderIf order,
                                   AddressIf deliveryAddress)
                            throws java.lang.Exception
The current delivery address is substituted with the new one. If the country and zone have changed, then we need to work out the new tax for the order products

Specified by:
changeDeliveryAddress in interface OrderMgrIf
Parameters:
sessionId -
order -
deliveryAddress -
Returns:
New Order
Throws:
java.lang.Exception

getTaxRateObjectsPerOrder

public TaxRate[] getTaxRateObjectsPerOrder(Order order)
                                    throws java.lang.Exception
Returns a list of TaxRate objects used by this order. A tax rate object is added to the list if it is used to add tax to a product or to the shipping.

Specified by:
getTaxRateObjectsPerOrder in interface OrderMgrIf
Parameters:
order -
Returns:
Returns an array of TaxRate objects used by this order
Throws:
java.lang.Exception

getOrderStatusText

protected java.lang.String getOrderStatusText(int statusId,
                                              int languageId)
                                       throws com.workingdogs.village.DataSetException,
                                              org.apache.torque.TorqueException,
                                              KKException
It returns the text of the order status based on the status id and the language

Parameters:
statusId -
languageId -
Returns:
The text of the order status
Throws:
com.workingdogs.village.DataSetException
org.apache.torque.TorqueException
KKException

getTaxRate

protected java.math.BigDecimal getTaxRate(Order order,
                                          int taxClassId)
                                   throws java.lang.Exception
We get the tax rate for the order and taxClassId

Parameters:
order -
taxClassId -
Returns:
Returns the final tax rate for the taxClass
Throws:
java.lang.Exception

addTaxRateObjects

protected void addTaxRateObjects(Order order,
                                 int taxClassId,
                                 java.util.HashMap<java.lang.Integer,TaxRate> taxRateMap)
                          throws java.lang.Exception
We get the tax rate objects for the order and taxClassId and add them to the hash map. The hash map keeps track of all of the different tax rates used for the order.

Parameters:
order -
taxClassId -
taxRateMap -
Throws:
java.lang.Exception

formatOrderAddresses

protected void formatOrderAddresses(Order order)
                             throws java.lang.Exception
It gets the address templates for all three addresses and sets the formatted addresses

Parameters:
order -
Throws:
java.lang.Exception

getOrdersPerCustomer

public Orders getOrdersPerCustomer(DataDescriptorIf dataDesc,
                                   java.lang.String sessionId,
                                   int languageId)
                            throws java.lang.Exception
Retrieve a number of orders for the customer referenced by the sessionId. The orders are always returned sorted by date (most recent orders first). The DataDescriptor is used to retrieve offset and limit information. If null, the offset defaults to 0 and a default limit is used.

Specified by:
getOrdersPerCustomer in interface OrderMgrIf
Parameters:
dataDesc -
sessionId -
languageId -
Returns:
An Orders object
Throws:
java.lang.Exception

searchForOrdersPerCustomer

public Orders searchForOrdersPerCustomer(java.lang.String sessionId,
                                         DataDescriptorIf dataDesc,
                                         OrderSearchIf orderSearch,
                                         int languageId)
                                  throws java.lang.Exception
Return orders matching the search criteria.

Specified by:
searchForOrdersPerCustomer in interface OrderMgrIf
Parameters:
sessionId -
dataDesc -
orderSearch -
languageId -
Returns:
An Orders object
Throws:
java.lang.Exception

getOrder

public Order getOrder(java.lang.String sessionId,
                      int orderId,
                      int languageId)
               throws java.lang.Exception
Retrieve an order for the customer referenced by the sessionId.

Specified by:
getOrder in interface OrderMgrIf
Parameters:
sessionId -
orderId -
languageId -
Returns:
An Order object
Throws:
java.lang.Exception

getOrderForOrderId

public Order getOrderForOrderId(int orderId,
                                int languageId)
                         throws java.lang.Exception
Retrieve an order for an orderId.

Specified by:
getOrderForOrderId in interface OrderMgrIf
Parameters:
orderId -
languageId -
Returns:
An Order object
Throws:
java.lang.Exception

getOrderProducts

protected void getOrderProducts(Order order)
                         throws java.lang.Exception
Get the OrderProduct and the Options of each OrderProduct for this order.

Parameters:
order -
Throws:
java.lang.Exception

getOrderDetails

protected void getOrderDetails(Order order,
                               int languageId)
                        throws java.lang.Exception
Calls methods to get all of the details of the order

Parameters:
order -
languageId -
Throws:
java.lang.Exception

getOrderTotals

protected void getOrderTotals(Order order)
                       throws org.apache.torque.TorqueException,
                              com.workingdogs.village.DataSetException
Populates the Order object with an array of OrderTotal objects sorted by the sortOrder attribute

Parameters:
order -
Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException

getStatusTrail

protected void getStatusTrail(Order order,
                              int languageId)
                       throws org.apache.torque.TorqueException,
                              com.workingdogs.village.DataSetException
Populates the Order object with an array of OrderStatusHistory objects

Parameters:
order -
languageId -
Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException

getOrderCountryAndZone

protected void getOrderCountryAndZone(Order order)
                               throws java.lang.Exception
Instantiate the Country and Zone objects for the order

Parameters:
order -
Throws:
java.lang.Exception

setCriteriaWithStandardAttributes

protected void setCriteriaWithStandardAttributes(KKCriteria c,
                                                 int languageId)
Set the criteria object with all of the attributes for an order

Parameters:
c -
languageId -

getCount

protected int getCount(KKCriteria c)
                throws org.apache.torque.TorqueException,
                       com.workingdogs.village.DataSetException
This method is mainly used for paging.

Parameters:
c -
Returns:
The number of records present in the database matching the given criteria
Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException

doesOrderStatusExist

protected boolean doesOrderStatusExist(int status)
                                throws org.apache.torque.TorqueException,
                                       KKException
Determines whether an order_status record exists for the status id parameter

Parameters:
status -
Returns:
Returns true or false
Throws:
org.apache.torque.TorqueException
KKException

getStatusText

public java.lang.String getStatusText(int statusId,
                                      int languageId)
                               throws java.lang.Exception
Returns the text of a status from the orders_status table

Specified by:
getStatusText in interface OrderMgrIf
Parameters:
statusId -
languageId -
Returns:
Returns the text of the status. Null if not found.
Throws:
java.lang.Exception

changeOrderStatus

public void changeOrderStatus(java.lang.String sessionId,
                              int orderId,
                              int status,
                              boolean customerNotified,
                              java.lang.String comments)
                       throws java.lang.Exception
The state of the current order id changed and an orders_status_history record is added to the order to keep track of the change.

Specified by:
changeOrderStatus in interface OrderMgrIf
Parameters:
sessionId -
orderId -
status -
customerNotified - Has the customer been notified
comments -
Throws:
java.lang.Exception

getOrderStatus

public int getOrderStatus(java.lang.String sessionId,
                          int orderId)
                   throws java.lang.Exception
Get the order status for an order.

Specified by:
getOrderStatus in interface OrderMgrIf
Parameters:
sessionId -
orderId -
Returns:
Returns the order status. Returns -1 if the order doesn't exist.
Throws:
java.lang.Exception

getAllOrderStatuses

public OrderStatus[] getAllOrderStatuses(int languageId)
                                  throws java.lang.Exception
Returns an array of Order Status objects for a given language

Specified by:
getAllOrderStatuses in interface OrderMgrIf
Parameters:
languageId -
Returns:
Returns an array of Order Status Objects
Throws:
java.lang.Exception

changeOrderStatus

public void changeOrderStatus(int orderId,
                              int status,
                              boolean customerNotified,
                              java.lang.String comments)
                       throws java.lang.Exception
The state of the current order id changed and an orders_status_history record is added to the order to keep track of the change.

Specified by:
changeOrderStatus in interface OrderMgrIf
Parameters:
orderId -
status -
customerNotified - Has the customer been notified
comments -
Throws:
java.lang.Exception

updateInventory

public void updateInventory(java.lang.String sessionId,
                            int orderId)
                     throws java.lang.Exception
If the STOCK_LIMITED configuration variable is set to true, we subtract the products in stock by the product orders. If we hit the STOCK_REORDER_LEVEL, then we instantiate a class defined by the STOCK_REORDER_CLASS and call it. If STOCK_ALLOW_CHECKOUT is set to true, when we hit zero items in stock we don't touch the status, otherwise we disable the product when the quantity reaches zero by seting the status to zero. In this method we also update any promotion data such as the number of times a coupon has been used or the number of times a customer has used a promotion.

Specified by:
updateInventory in interface OrderMgrIf
Parameters:
sessionId -
orderId -
Throws:
java.lang.Exception

updateInventoryWithOptions

public void updateInventoryWithOptions(java.lang.String sessionId,
                                       int orderId,
                                       CreateOrderOptionsIf options)
                                throws java.lang.Exception
If the STOCK_LIMITED configuration variable is set to true, we subtract the products in stock by the product orders. If we hit the STOCK_REORDER_LEVEL, then we instantiate a class defined by the STOCK_REORDER_CLASS and call it. If STOCK_ALLOW_CHECKOUT is set to true, when we hit zero items in stock we don't touch the status, otherwise we disable the product when the quantity reaches zero by setting the status to zero. In this method we also update any promotion data such as the number of times a coupon has been used or the number of times a customer has used a promotion.

Specified by:
updateInventoryWithOptions in interface OrderMgrIf
Parameters:
sessionId -
orderId -
options -
Throws:
java.lang.Exception

getSecretKeyForOrderId

public java.lang.String getSecretKeyForOrderId(int orderId)
                                        throws java.lang.Exception
Every time we send a notification to a payment gateway, we get a new secret key for the order, which is sent back to us in the reply. We use the secret key to look up the order.

Specified by:
getSecretKeyForOrderId in interface OrderMgrIf
Parameters:
orderId -
Returns:
Returns the secret key
Throws:
java.lang.Exception

getOrderIdFromSecretKey

public int getOrderIdFromSecretKey(java.lang.String secretKey)
                            throws com.workingdogs.village.DataSetException,
                                   org.apache.torque.TorqueException
The order id stored in the database and indexed by the secretKey, is returned

Specified by:
getOrderIdFromSecretKey in interface OrderMgrIf
Parameters:
secretKey -
Returns:
The order Id that was stored in the database. A negative number is returned if no orderId can be found.
Throws:
com.workingdogs.village.DataSetException
org.apache.torque.TorqueException

deleteOrderIdForSecretKey

public void deleteOrderIdForSecretKey(java.lang.String secretKey)
                               throws org.apache.torque.TorqueException
The order id stored in the database and indexed by the secretKey, is deleted

Specified by:
deleteOrderIdForSecretKey in interface OrderMgrIf
Parameters:
secretKey -
Throws:
org.apache.torque.TorqueException

saveIpnHistory

public int saveIpnHistory(java.lang.String sessionId,
                          IpnHistoryIf ipnHistory)
                   throws java.lang.Exception
The IpnHistory object is saved in the database.

Specified by:
saveIpnHistory in interface OrderMgrIf
Parameters:
sessionId -
ipnHistory -
Returns:
Id of newly created object
Throws:
java.lang.Exception

getIpnHistory

public IpnHistory[] getIpnHistory(java.lang.String sessionId,
                                  int orderId)
                           throws java.lang.Exception
Retrieve an array of IpnHistory objects for an order. The order must belong to the customer referenced by the sessionId.

Specified by:
getIpnHistory in interface OrderMgrIf
Parameters:
sessionId - The session id of the logged in user
orderId - The numeric id of the order
Returns:
Returns an array of IpnHistory objects for the order
Throws:
java.lang.Exception

getIpnHistory

public IpnHistory[] getIpnHistory(int orderId)
                           throws com.workingdogs.village.DataSetException,
                                  org.apache.torque.TorqueException
Retrieve an array of IpnHistory objects for an order

Specified by:
getIpnHistory in interface OrderMgrIf
Parameters:
orderId -
Returns:
Returns an array of IpnHistory objects for the order
Throws:
com.workingdogs.village.DataSetException
org.apache.torque.TorqueException

createAndSaveOrder

public Order createAndSaveOrder(java.lang.String emailAddr,
                                java.lang.String password,
                                CustomerRegistrationIf custReg,
                                BasketIf[] basketItemArray,
                                java.lang.String shippingModule,
                                java.lang.String paymentModule,
                                int languageId)
                         throws java.lang.Exception
Specified by:
createAndSaveOrder in interface OrderMgrIf
Parameters:
emailAddr -
password -
custReg -
basketItemArray -
shippingModule -
paymentModule -
languageId -
Returns:
Returns an Order object
Throws:
java.lang.Exception

setCreditCardDetailsOnOrder

public void setCreditCardDetailsOnOrder(java.lang.String sessionId,
                                        int orderId,
                                        CreditCardIf card)
                                 throws java.lang.Exception
The credit card details in the CreditCard object passed in as a parameter, are saved in the database for an existing order. Before being saved, this sensitive information is encrypted.
No update or insert is done for attributes of the CreditCard object that are set to null. The credit card details are mapped as follows to attributes in the order object:

Specified by:
setCreditCardDetailsOnOrder in interface OrderMgrIf
Parameters:
sessionId -
orderId -
card -
Throws:
java.lang.Exception

createFetchProductOptions

protected FetchProductOptionsIf createFetchProductOptions(CreateOrderOptionsIf options)
Creates a FetchProductOptions object from an CreateOrderOptions

Parameters:
options -
Returns:
Return a FetchProductOptions object

createAddToBasketOptions

protected AddToBasketOptionsIf createAddToBasketOptions(CreateOrderOptionsIf options)
Creates an AddToBasketOptions object from an CreateOrderOptions

Parameters:
options -
Returns:
Return an AddToBasketOptions object

setRewardPointReservationId

public void setRewardPointReservationId(java.lang.String sessionId,
                                        int orderId,
                                        int reservationId)
                                 throws java.lang.Exception
Verifies that the order belongs to the customer identified by the sessionId parameter and then updates the reservation id.

Specified by:
setRewardPointReservationId in interface OrderMgrIf
Parameters:
sessionId -
orderId -
reservationId -
Throws:
java.lang.Exception

setRewardPointReservationId

public void setRewardPointReservationId(int customerId,
                                        int orderId,
                                        int reservationId)
                                 throws java.lang.Exception
Verifies that the order belongs to the customer identified by the customerId parameter and then updates the reservation id.

Specified by:
setRewardPointReservationId in interface OrderMgrIf
Parameters:
customerId -
orderId -
reservationId -
Throws:
java.lang.Exception

manageDataDescriptor

protected void manageDataDescriptor(DataDescriptorIf dataDesc,
                                    org.apache.torque.util.Criteria c)
Provides common code to deal with the management of the DataDescriptor.

Parameters:
dataDesc -
c -


Copyright © 2011 DS Data Systems UK Ltd.