com.shephertz.app42.paas.sdk.jme.shopping
Class CartService

java.lang.Object
  extended by com.shephertz.app42.paas.sdk.jme.shopping.CartService

public class CartService
extends java.lang.Object

This is Cloud Persistent Shopping Cart Service. App Developers can use this to create a Shopping Cart. Add Items and Check Out items. It also maintains the transactions and the corresponding Payment Status. The Payment Gateway interface is not provided by the Platform. It is left to the App developer how he wants to do the Payment Integration. This can be used along with Catalogue or used independently

See Also:
Catalgoue, Cart, App42Response, ItemData, PaymentStatus

Constructor Summary
CartService(java.lang.String apiKey, java.lang.String secretKey, java.lang.String baseURL)
          Constructor that takes
 
Method Summary
 Cart addItem(java.lang.String cartID, java.lang.String itemID, int itemQuantity, double price)
          Adds an Item in the Cart with quantity and price.
 Cart checkOut(java.lang.String cartID)
          Checks out the Cart and put it in CheckOut Stage and returns the Transaction Id The transaction id has to be used in future to update the Payment Status.
 Cart createCart(java.lang.String user)
          Creates a Cart Session for the specified User
 Cart decreaseQuantity(java.lang.String cartID, java.lang.String itemID, int itemQuantity)
          To decrease quantity of existing item in the cart..
 Cart getCartDetails(java.lang.String cartId)
          Fetch Cart details.
 Cart getItem(java.lang.String cartId, java.lang.String itemId)
          Fetches the specified Item from the specified Cart
 Cart getItems(java.lang.String cartId)
          Fetches the Items from the specified Cart
 Cart getPaymentByCart(java.lang.String cartId)
          Fetches Payment information for the specified Cart Id
 java.util.Vector getPaymentHistoryAll()
          History of all carts.
 java.util.Vector getPaymentHistoryByUser(java.lang.String userId)
          History of Carts and Payments for a User.
 java.util.Vector getPaymentsByStatus(java.lang.String paymentStatus)
          Fetches Payment information based on Status
 java.util.Vector getPaymentsByUser(java.lang.String userId)
          Fetches Payment information for a User.
 java.util.Vector getPaymentsByUserAndStatus(java.lang.String userId, java.lang.String paymentStatus)
          Fetches Payment information based on User Id and Status
 Cart increaseQuantity(java.lang.String cartID, java.lang.String itemID, int itemQuantity)
          To increase quantity of existing item in the cart.
 Cart isEmpty(java.lang.String cartId)
          Checks whether the Cart is Empty or not
 Cart payment(java.lang.String cartID, java.lang.String transactionID, java.lang.String paymentStatus)
          Update Payment Status of the Cart.
 App42Response removeAllItems(java.lang.String cartId)
          Removes all Items from the specified Cart
 App42Response removeItem(java.lang.String cartId, java.lang.String itemId)
          Removes the specified item from the specified Cart
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CartService

public CartService(java.lang.String apiKey,
                   java.lang.String secretKey,
                   java.lang.String baseURL)
Constructor that takes

Parameters:
apiKey -
secretKey -
baseURL -
Method Detail

addItem

public Cart addItem(java.lang.String cartID,
                    java.lang.String itemID,
                    int itemQuantity,
                    double price)
             throws App42Exception
Adds an Item in the Cart with quantity and price. This method does not take currency. Its the bonus of the App developer to maitain the currency. It takes only the price.

Parameters:
cartID - - The Cart Id into which item has to be added
itemID - - The Item id which has to be added in the cart. If the Catalogue Service is used along with the Cart Service then the Item ids should be same.
itemQuantity - - Quantity of the Item to be purchased
price - - Price of the item
Throws:
App42Exception

checkOut

public Cart checkOut(java.lang.String cartID)
              throws App42Exception
Checks out the Cart and put it in CheckOut Stage and returns the Transaction Id The transaction id has to be used in future to update the Payment Status.

Parameters:
cartID - - The cart id that has to be checkedOut.
Throws:
App42Exception

createCart

public Cart createCart(java.lang.String user)
                throws App42Exception
Creates a Cart Session for the specified User

Parameters:
user - - User for whom Cart Session has to be created
Throws:
App42Exception

decreaseQuantity

public Cart decreaseQuantity(java.lang.String cartID,
                             java.lang.String itemID,
                             int itemQuantity)
                      throws App42Exception
To decrease quantity of existing item in the cart..

Parameters:
cartID - - The Cart Id from where item quantity has to be reduced
itemID - - The Item id from where item quantity has to be reduced. If the Catalogue Service is used along with the Cart Service then the Item ids should be same.
itemQuantity - - Quantity of the Item has to be reduced
Throws:
App42Exception

getCartDetails

public Cart getCartDetails(java.lang.String cartId)
                    throws App42Exception
Fetch Cart details. Can be used by the App developer to display Cart Details i.e. Items in a Cart.

Parameters:
cartId - - The Cart Id that has to be fetched
Throws:
App42Exception

getItem

public Cart getItem(java.lang.String cartId,
                    java.lang.String itemId)
             throws App42Exception
Fetches the specified Item from the specified Cart

Parameters:
cartId - - The cart id from which item has to be fetched
itemId - - The item for which the information has to be fetched
Throws:
App42Exception

getItems

public Cart getItems(java.lang.String cartId)
              throws App42Exception
Fetches the Items from the specified Cart

Parameters:
cartId - - The cart id from which items have to be fetched
Throws:
App42Exception

getPaymentByCart

public Cart getPaymentByCart(java.lang.String cartId)
                      throws App42Exception
Fetches Payment information for the specified Cart Id

Parameters:
cartID - - Cart Id for which the payment information has to be fetched
Throws:
App42Exception

getPaymentHistoryAll

public java.util.Vector getPaymentHistoryAll()
                                      throws App42Exception
History of all carts. It gives all the carts which are in AUTHORIZED, DECLINED, PENDING state.

Throws:
App42Exception

getPaymentHistoryByUser

public java.util.Vector getPaymentHistoryByUser(java.lang.String userId)
                                         throws App42Exception
History of Carts and Payments for a User. It gives all the carts which are in AUTHORIZED, DECLINED, PENDING state.

Parameters:
userId - - User Id for whom payment history has to be fetched
Throws:
App42Exception

getPaymentsByStatus

public java.util.Vector getPaymentsByStatus(java.lang.String paymentStatus)
                                     throws App42Exception
Fetches Payment information based on Status

Parameters:
paymentStatus - - Status of type which payment information has to be fetched
Throws:
App42Exception

getPaymentsByUser

public java.util.Vector getPaymentsByUser(java.lang.String userId)
                                   throws App42Exception
Fetches Payment information for a User. This can be used to display Order and Payment History

Parameters:
userId - - User Id for whom payment information has to be fetched
Throws:
App42Exception

getPaymentsByUserAndStatus

public java.util.Vector getPaymentsByUserAndStatus(java.lang.String userId,
                                                   java.lang.String paymentStatus)
                                            throws App42Exception
Fetches Payment information based on User Id and Status

Parameters:
userId - - User Id for whom payment information has to be fetched
paymentStatus - - Status of type which payment information has to be fetched
Throws:
App42Exception

increaseQuantity

public Cart increaseQuantity(java.lang.String cartID,
                             java.lang.String itemID,
                             int itemQuantity)
                      throws App42Exception
To increase quantity of existing item in the cart.

Parameters:
cartID - - The Cart Id into which item has to be added
itemID - - The Item id which has to be added in the cart. If the Catalogue Service is used along with the Cart Service then the Item ids should be same.
itemQuantity - - Quantity of the Item to be purchased
Throws:
App42Exception

isEmpty

public Cart isEmpty(java.lang.String cartId)
             throws App42Exception
Checks whether the Cart is Empty or not

Parameters:
cartId - - The cart id to check for empty
Throws:
App42Exception

payment

public Cart payment(java.lang.String cartID,
                    java.lang.String transactionID,
                    java.lang.String paymentStatus)
             throws App42Exception
Update Payment Status of the Cart. When a Cart is checkout, it is in Checkout state. The payment status has to be updated based on the Payment Gateway interaction

Parameters:
cartID - - The cart id for which the payment status has to be updated
transactionID - - Transaction id for which the payment status has to be updated
paymentStatus - - Payment Status to be updated. The probable values are PaymentStatus.DECLINED, PaymentStatus.AUTHORIZED, PaymentStatus.PENDING
Throws:
App42Exception

removeAllItems

public App42Response removeAllItems(java.lang.String cartId)
                             throws App42Exception
Removes all Items from the specified Cart

Parameters:
cartId - - The cart id from which items have to be removed
Throws:
App42Exception

removeItem

public App42Response removeItem(java.lang.String cartId,
                                java.lang.String itemId)
                         throws App42Exception
Removes the specified item from the specified Cart

Parameters:
cartId - - The cart id from which the item has to be removed
itemId - - Id of the Item which has to be removed
Throws:
App42Exception