Tutorial
- In order to add an item to your cart, you need to create cart object as followed
new GC.OrderService().createCart(skusArray, placeId)
Where skusArray is a list of products (SKUs) , product count (quantity) added to the shopping cart [{skuId: id, quantity: count}], and placeId is the delivery address
Example -
We want to add 5 pieces of the product with SkuId 10
new GC.OrderService().createCart([{skuId: 10, quantity: 5}], placeId)

idCart is a unique cart identifier for the future reference that you will receive after executing an example above. if we want to add another item ((ex. 10 items of skuId 50) we need to execute
new GC.OrderService().createCart([
{skuId: 50, quantity: 10},
{skuId: 10, quantity: 5}
], placeId)
We must pass the full list of products when adding a new one**
2.If the items we wanted to buy have already been added to the cart, we can proceed to the checkout stage, but first we need to select the day and time of delivery
new GC.DeliveryService().findTimeslots(placeId)

- Once shopping cart is ready for checkout we can execute the following method
new GC.OrderService().checkoutCart(idCart, paymentMethod, deliveryType, timeslotInfo)

idCart - Unique identificator for the cart we received when we created the cart object
paymentMethod - DEBIT \ CASH
deliveryType - PICKUP \ ON_DEMAND \ SCHEDULED
timeslotInfo - { date: "20YY-MM-DD", start: "10:00:00", end: "12:00:00" }
- checkoutCart return an order id if request was successful
Updated over 1 year ago