public class CartController extends BaseController
DEFAULT_CURRENT_PAGE, DEFAULT_PAGE_SIZE| Constructor and Description |
|---|
CartController() |
| Modifier and Type | Method and Description |
|---|---|
CartData |
addPaymentInfo(HttpServletRequest request)
Web service for creating a credit card payment subscription.
Sample call: https://localhost:9002/rest/v1/mysite/cart/paymentinfo CCPaymentInfoData parameters need to be send as post body. Method uses dedicated populator - HttpRequestPaymentInfoPopulator - to populate the
CCPaymentInfoData from request parameters.Method uses dedicated validator - CCPaymentInfoValidator - to validate request parameters.This method requires authentication and is restricted for HTTPS channel.Method type : POST. |
CartModificationData |
addToCart(java.lang.String baseSiteId,
java.lang.String code,
long qty,
java.lang.String storeName)
Web service handler for adding new products to the session cart.
Sample target URL : http://localhost:9001/rest/v1/cart/entry. Client should provide product code and quantity (optional) as POST body. It's also possible to add product that will be pickedup in store by specifying optional storeName parameter (product must be in stock in that particular store). For Content-Type=application/x-www-form-urlencoded;charset=UTF-8 a sample body is: (urlencoded) is: entryNumber=1&qty=2.. Request Method = POST |
CartData |
applyPromotion(java.lang.String promotionCode)
Web service for enabling order promotions.
Sample call: https://localhost:9002/rest/v1/mysite/cart/promotion/{promotionCode} This method requires authentication and is restricted to HTTPS |
CartData |
applyVoucherForCart(java.lang.String voucherCode)
Web service for applying voucher to cart.
Sample call: https://localhost:9002/rest/v1/mysite/cart/voucher/abc-9PSW-EDH2-RXKA This method requires authentication. Method type : POST.Method is restricted for HTTPS channel. |
CartData |
authorizePayment(java.lang.String securityCode)
Web service for authorizing cart's credit cart payment.
Sample call: https://localhost:9002/rest/v1/mysite/cart/authorizePayment authorization security code - ccv - must be sent as a post body. Response contains a set-cookie header with the jsessionId associated with the cart. This method requires authentication and is restricted to HTTPS |
protected AddressData |
createAddress(HttpServletRequest request) |
CartModificationData |
deleteCartEntry(long entryNumber)
Web service for deleting cart entry.
Client should provide cart entry number as path variable. Sample target URL : http://localhost:9001/rest/v1/cart/entry/0 Response contains a set-cookie header with the jsessionId associated with the cart. Request Method = DELETE |
protected OrderEntryData |
getCartEntryForNumber(long number) |
CartData |
getSessionCart() |
CartData |
getSessionCart(boolean restore)
Web service for getting session cart.
|
DeliveryModesData |
getSupportedDeliveryModes()
Web service for getting all supported delivery modes for the session cart.
Sample call: https://localhost:9002/rest/v1/mysite/cart/deliverymodes Response contains a set-cookie header with the jsessionId associated with the cart. This method requires authentication and is restricted to HTTPS |
OrderData |
oneStepCheckout(java.lang.String addressId,
java.lang.String addressIsocode,
java.lang.String deliveryMode,
java.lang.String voucherCode,
java.lang.String paymentInfoId,
java.lang.String securityCode,
HttpServletRequest request)
Web service for one-step checkout from current session cart.
Sample call: https://localhost:9002/rest/v1/mysite/cart/checkout This method requires authentication. Method type : POST.Method is restricted for HTTPS channel. |
CartModificationData |
pickupEntryInStore(java.lang.String baseSiteId,
long entryNumber,
java.lang.String storeName)
Web service for setting store where cart entry will be picked up.
Client should provide cart entry number as path variable and storeName parameter in body. Sample target URL : http://localhost:9001/rest/v1/cart/entry/{entryNumber}/store Response contains a set-cookie header with the jsessionId associated with the cart. Request Method = PUT |
OrderData |
placeOrder(HttpSession session)
Web service for placing order from current session cart.
Sample call: https://localhost:9002/rest/v1/mysite/cart/placeorder. |
CartData |
releaseVoucherFromCart(java.lang.String voucherCode)
Web service for removing voucher from cart.
Sample call: https://localhost:9002/rest/v1/mysite/cart/voucher/abc-9PSW-EDH2-RXKA This method requires authentication. Method type : DELETE.Method is restricted for HTTPS channel. |
CartData |
removeDeliveryAddress()
Web service for removing delivery address from current cart.
Sample call: https://localhost:9002/rest/v1/mysite/cart/address/delivery Response contains a set-cookie header with the jsessionId associated with the cart. This method requires authentication. Method type : DELETE.Method is restricted for HTTPS channel. |
CartData |
removeDeliveryMode()
Web service for removing delivery mode from current cart.
Sample call: https://localhost:9002/rest/v1/mysite/cart/deliverymode Response contains a set-cookie header with the jsessionId associated with the cart. This method requires authentication. Method type : DELETE.Method is restricted for HTTPS channel. |
CartData |
removePromotion(java.lang.String promotionCode)
Web service for disabling order promotions.
Sample call: https://localhost:9002/rest/v1/mysite/cart/promotion/{promotionCode} This method requires authentication and is restricted to HTTPS |
CartRestorationData |
restoreCart(java.lang.String guid)
Web service for restoring anonymous cart by guid.
Sample call: https://localhost:9002/rest/v1/mysite/cart/restore This method requires authentication and is restricted to HTTPS |
CartData |
setCartDeliveryAddress(java.lang.String id)
Web service for setting cart's delivery address by address id.
Address id must be given as path variable. Sample call: https://localhost:9002/rest/v1/mysite/cart/address/delivery/1234 Response contains a set-cookie header with the jsessionId associated with the cart. This method requires authentication. Method type : PUT.Method is restricted for HTTPS channel. |
CartData |
setCartDeliveryMode(java.lang.String code)
Web service for setting cart's delivery mode by delivery mode code.
Delivery mode code must be given as path variable. Sample call: https://localhost:9002/rest/v1/mysite/cart/deliverymode/expressDelivery Response contains a set-cookie header with the jsessionId associated with the cart. This method requires authentication. Method type : PUT.Method is restricted for HTTPS channel. |
CartData |
setPaymentDetails(java.lang.String id)
Web service for assigning given payment (by payment id) to the checkout cart.
Sample call: https://localhost:9002/rest/v1/mysite/cart/paymentinfo/1234 This method requires authentication and is restricted for HTTPS channel.Method type : PUT. |
CartModificationData |
updateCartEntry(long entryNumber,
long qty)
Web service for modifying cart entry quantity.
Client should provide cart entry number as path variable and new quantity as url request parameter. Sample target URL : http://localhost:9001/rest/v1/cart/entry/0?qty=2 Response contains a set-cookie header with the jsessionId associated with the cart. Request Method = PUT |
CartModificationData |
updateEntryToDelivery(java.lang.String baseSiteId,
long entryNumber)
Web service reseting store where entry should be picked up.
|
protected void |
validateCartForPlaceOrder() |
handleErrorInternal, handleModelNotFoundException, sanitizepublic CartData getSessionCart()
public CartData getSessionCart(boolean restore)
restore - enables cart restoration (true by default)CartData as response body.public CartModificationData addToCart(java.lang.String baseSiteId, java.lang.String code, long qty, java.lang.String storeName) throws CommerceCartModificationException, WebserviceValidationException, ProductLowStockException, StockSystemException
POST
Response contains a set-cookie header with the jsessionId associated with the cart.code - qty - storeName - CartModificationData as response body.CommerceCartModificationExceptionWebserviceValidationExceptionStockSystemExceptionProductLowStockExceptionpublic CartModificationData updateCartEntry(long entryNumber, long qty) throws CommerceCartModificationException
PUTentryNumber - qty - CartModificationData as response body.CommerceCartModificationExceptionpublic CartModificationData deleteCartEntry(long entryNumber) throws CommerceCartModificationException
DELETEentryNumber - CartModificationData as response body.CommerceCartModificationExceptionpublic CartModificationData pickupEntryInStore(java.lang.String baseSiteId, long entryNumber, java.lang.String storeName) throws CommerceCartModificationException, LowStockException, StockSystemException, WebserviceValidationException
PUTentryNumber - identifier of entry which should be updatedstoreName - name of store where items will be pickedCartModificationData as response body.CommerceCartModificationExceptionWebserviceValidationExceptionStockSystemExceptionLowStockExceptionpublic CartModificationData updateEntryToDelivery(java.lang.String baseSiteId, long entryNumber) throws CommerceCartModificationException, LowStockException, StockSystemException
DELETEentryNumber - identifier of entry which should be updatedCartModificationData as response body.CommerceCartModificationExceptionStockSystemExceptionLowStockExceptionpublic CartData setCartDeliveryAddress(java.lang.String id) throws UnsupportedDeliveryAddressException, NoCheckoutCartException
PUT.HTTPS channel.UnsupportedDeliveryAddressExceptionNoCheckoutCartExceptionpublic CartData removeDeliveryAddress()
DELETE.HTTPS channel.public CartData setCartDeliveryMode(java.lang.String code) throws UnsupportedDeliveryModeException
PUT.HTTPS channel.UnsupportedDeliveryModeExceptionpublic CartData removeDeliveryMode()
DELETE.HTTPS channel.public OrderData placeOrder(HttpSession session) throws InvalidCartException, NoCheckoutCartException, WebserviceValidationException
POST.HTTPS channel.OrderData as response bodyInvalidCartExceptionNoCheckoutCartExceptionWebserviceValidationExceptionprotected void validateCartForPlaceOrder()
throws NoCheckoutCartException,
InvalidCartException,
WebserviceValidationException
public CartData addPaymentInfo(HttpServletRequest request) throws WebserviceValidationException, InvalidPaymentInfoException, NoCheckoutCartException
HttpRequestPaymentInfoPopulator - to populate the
CCPaymentInfoData from request parameters.CCPaymentInfoValidator - to validate request parameters.HTTPS channel.POST.request - incoming HttpServletRequest. As there are many potential query parameters to handle they are not mapped
using annotations.CartData as response bodyWebserviceValidationExceptionInvalidPaymentInfoExceptionNoCheckoutCartExceptionpublic CartData setPaymentDetails(java.lang.String id) throws InvalidPaymentInfoException
HTTPS channel.PUT.true if paymentInfo was assigned to the session cart.InvalidPaymentInfoExceptionpublic DeliveryModesData getSupportedDeliveryModes()
HTTPS channel only.
Method type : GET.DeliveryModeData as response body.public CartData authorizePayment(java.lang.String securityCode) throws PaymentAuthorizationException
HTTPS channel only.
Method type : POST.PaymentAuthorizationExceptionpublic CartRestorationData restoreCart(java.lang.String guid) throws CommerceCartRestorationException
HTTPS channel only.
Method type : GET.guid - CartRestorationDataCommerceCartRestorationExceptionpublic CartData applyPromotion(java.lang.String promotionCode) throws CommercePromotionRestrictionException
HTTPS channel only.
Method type : POST.promotionCode - promotion codeCartDataCommercePromotionRestrictionExceptionpublic CartData removePromotion(java.lang.String promotionCode) throws CommercePromotionRestrictionException, NoCheckoutCartException
HTTPS channel only.
Method type : DELETE.promotionCode - promotion codeCartDataCommercePromotionRestrictionExceptionNoCheckoutCartExceptionpublic CartData applyVoucherForCart(java.lang.String voucherCode) throws NoCheckoutCartException, VoucherOperationException
POST.HTTPS channel.NoCheckoutCartExceptionVoucherOperationExceptionpublic CartData releaseVoucherFromCart(java.lang.String voucherCode) throws NoCheckoutCartException, VoucherOperationException
DELETE.HTTPS channel.NoCheckoutCartExceptionVoucherOperationExceptionpublic OrderData oneStepCheckout(java.lang.String addressId, java.lang.String addressIsocode, java.lang.String deliveryMode, java.lang.String voucherCode, java.lang.String paymentInfoId, java.lang.String securityCode, HttpServletRequest request) throws NoCheckoutCartException, UnsupportedDeliveryAddressException, UnsupportedDeliveryModeException, InvalidPaymentInfoException, PaymentAuthorizationException, InvalidCartException, WebserviceValidationException, VoucherOperationException
POST.HTTPS channel.addressId - id of created addressaddressIsocode - country isocode, parameter is also used as a flag to decide if new address should be createddeliveryMode - delivery modevoucherCode - voucher codepaymentInfoId - id of created payment infosecurityCode - security code for payment validationrequest - incoming HttpServletRequest. As there are many potential query parameters to handle they are not mapped
using annotations.OrderDataNoCheckoutCartExceptionUnsupportedDeliveryAddressExceptionUnsupportedDeliveryModeExceptionInvalidPaymentInfoExceptionPaymentAuthorizationExceptionInvalidCartExceptionWebserviceValidationExceptionVoucherOperationExceptionprotected OrderEntryData getCartEntryForNumber(long number)
protected AddressData createAddress(HttpServletRequest request)
Copyright © 2018 SAP SE. All Rights Reserved.