Service URL: PUT /baskets/{basketReference}
Tokens:
basketReference – The basket reference of the basket to replace the content for, or can be ‘PRIMARY’ to replace the PRIMARY basket.
Request Body:
IReplaceBasketRequest:
basket – IBasket – The content of the new basket – Required
Remarks:
Replaces the content of an existing basket with the supplied content. This is similar to POST /basket
but you cannot use it to create a new basket. i.e. the basketReference
must already exist. If the basketReference
is PRIMARY, the content of the PRIMARY basket is replaced.
Scenarios:
Scenario | Outcome | Expected behaviour | Status Code | Response | |
---|---|---|---|---|---|
1 | Replace basket service has received a request without a basket (A required field) | Fail | The service should return an error message of bad request | 500 | Error Message: Failed to replace basket. Bad Request: Missing data… |
2 | Replace basket service received a valid basket reference and a request with a basket | Success | The service should replace and save the basket from the request. | 200 | 200 Success ok |
3 | Replace basket service received a valid PRIMARY basket reference and a request with a basket | Success | The service should replace and save the basket from the request. | 200 | 200 Success ok |
Example Request
PUT: http://localhost:8080/WebRestApi/rest/baskets/PRIMARY
{
"basket": {
"items": [
{
"@type": "styleColourSizeItem",
"colourId": {
"id": "RED",
"colourRangeId": "MENS_SHOES"
},
"description": "Vans Canvas Shoes",
"deviceId": "pos2@0001.enactor",
"effectiveNetValue": 5995,
"lineNumber": 1,
"netValue": 5995,
"value": 5995,
"dateTimeCreated": "2019-07-19T15:35:52.000+01:00",
"userId": "CUST_USER",
"modifiersNetValue": 0,
"modifiersEffectiveNetValue": 0,
"modifiersVoidQuantity": 0,
"modifiersQuantity": 0,
"notDiscountable": false,
"maxDiscount": 0,
"handKeyed": true,
"productID": "VV639JS-8",
"quantity": 1,
"netQuantity": 1,
"isReturn": false,
"unitPrice": 5995,
"sourceInventoryType": "AVA",
"orderable": true,
"priceTypeId": "R",
"productTypeId": "skuProduct",
"productImageURL": "image://PRODUCT/VV639JS-1.jpg",
"type": "VALUE",
"mmGroupId": "MENS_SHOES",
"mmGroupHierarchyId": "FASHION",
"mmGroupVariantGroupId": "All",
"mmGroupVariantHierarchyId": "All",
"mmGroupDescription": "Mens Shoes",
"brandGroupId": "VANS",
"brandGroupHierarchyId": "FASHION",
"sizeId": {
"id": "8",
"sizeRangeId": "MENS_SHOES"
}
}
],
"balance": 5995,
"currencyId": "GBP",
"currencyDescription": "Pounds Sterling",
"taxInclusive": true,
"taxSchemeId": "UK",
"itemCount": 2,
"saleItemQuantity": 1,
"returnItemQuantity": 0,
"saleItemNetValue": 5995,
"returnItemNetValue": 0,
"merchandiseItemQuantity": 1,
"merchandiseItemValue": 5995,
"total": 5995,
"grossTotal": 5995,
"taxTotal": 0,
"totalTaxAdjustment": 0,
"preAuthBalance": 0,
"effectiveSaleValue": 5995
},
"basketReference": "PRIMARY",
"basketType": "PRIMARY"
}
Example Response
Status: 200 OK |