Basket API

Basket API #

The basket API is used to add/remove/update items in a basket. It also allows for promotion calculations to be performed against a basket.

The Basket API allows for baskets to be named, and a single customer can have multiple active baskets; this is used to support ‘wishlists’. In this scenario there is one ‘PRIMARY’ basket for the customer, and many ‘WISHLIST’ baskets – these are internally identified by the BasketType on the StoredCustomerBasket entity.

Baskets have a unique reference ID. This is generated from a Class 4 UUID encoded into Base32, as shown by the following code:

public String createReferenceId() {

// First create a UUID

UUID uuid = UUID.randomUUID();

// Convert to binary

ByteBuffer buffer = ByteBuffer.wrap(new byte[16]);

buffer.putLong(uuid.getMostSignificantBits());

buffer.putLong(uuid.getLeastSignificantBits());

byte[] bytes = buffer.array();

// Encode to Base32

String base32Id = Base32.encodeBytes(bytes);

// Strip (trailing) ‘=’ symbols and return

return base32Id.replace(“=”,””);

}

This should result in a 22 character string.

Baskets can be either associated with a customer, or be anonymous. In the latter case, the anonymous customer can only access their stored baskets by retaining the basket reference (for example in a cookie) â€“ if the basket reference is lost, an anonymous basket cannot be retrieved.

Baskets will be stored using the Enactor Basket Store (not the stored transaction service)

Create/Save a Basket #

Service URL: POST /baskets

Request Body:

ICreateBasketRequest

name – String – The name for the new basket – Optional, generated if not supplied

type – String – The type of basket to create – Optional, can be ‘WISHLIST’ or ‘ANONYMOUS’. If not supplied it will default to ‘WISHLIST’

Response Headers:

Location: /baskets/{basketReference}

Remarks:

Creates a new empty basket with the given name. The reference for the new basket is returned in the response headers. If the accessToken contains customer details, the basket will be associated with the customer, otherwise the basket is anonymous.

The type determines what kind of basket to create, can be supplied as ‘WISHLIST’ or ‘ANONYMOUS’. If ‘ANONYMOUS’ is specified the basket will not be associated with any customer present in the id token (if present).

If the name is not supplied, the service will generate one, using a simple incrementing number for the number of wishlists the customer has, or if the customer is anonymous the name will be just set to ‘Wish List’.

Scenarios:

Scenario

Outcome

Expected behaviour

Status Code

Response

1

Create basket service has been given an empty request

Success

Annoymous basket is created and stored as a WISHLIST basket, and with a generated/incremented basket name.

201

Location Header: BasketReference

2

Create basket service has been given a basket name

Success

Annoymous basket is created and stored with the basket name

201

Location Header: BasketReference

3

Create basket service has not given a basket name.

Success

Annoymous basket is created and stored with a generated/incremented basket name.

201

Location Header: BasketReference

4

Create basket service has been given a WISHLIST basket type

Success

Annoymous basket is created and stored as a WISHLIST basket

201

Location Header: BasketReference

5

Create basket service has been given customer details

Success

A customer associated basket is created and stored

201

Location Header: BasketReference

6

Create basket service has been given a PRIMARY basket type

Fail

The process checks and basket type for PRIMARY and should fail.

405

Error Message: Not Allowed to create basket

7

Create Basket Service has recieved a request with a basket name that already exists

AlreadyExists

The basket is not created. An error message of 400 – Bad Request is returned.

400

Error Message: Bad Request. A customer with that name already exists. outcome Already Exists.

8

Create basket service has received a request to create a ANONYMOUS basket

Success

Anonymous basket is create and stored as an ANONYMOUS basket with a generate/incremented basket name (if not supplied)

201

Location Header: BasketReference

Example Request:

Example Create Basket Request

POST: http://localhost:8080/WebRestApi/rest/baskets

Content-Type: application/json

{

“basketType”: “WISHLIST”,

“basketName”: “Xmas Wishlist”

}

Example Response:

Status: 201 created

Location: http://localhost:8080/WebRestApi/rest/baskets/MUCFJAIBTVDK3HHNC444ZALMV4

Replace a Basket #

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

 Expand source

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

Delete a Basket

Service URL: DELETE /baskets/{basketReference}

Tokens:

basketReference – The basket reference of the basket to add the item to, or can be ‘PRIMARY’ to “delete” the PRIMARY basket.

Remarks:

Deletes a basket, identified by the basket reference. If the PRIMARY basket is specified, it is not deleted, but all items are removed from it.

Scenarios:

Scenario

Outcome

Expected behaviour

Status Code

Response

1

Delete basket service has recieved a request with a valid basket reference

Success

The basket should be deleted.

200

200 Success ok

2

Delete basket service has recieved a request with a invalid basket reference

Fail

The basket should not be deleted. An bad request error message should be returned to the user.

400

Error Message: Failed to delete basket. Bad Request

3

Delete basket service has recieved a request with a PRIMARY basket reference

Successs

The basket should not be deleted. All items in the basket should be deleted

200

200 Success ok

Example Request:

DELETE: http://localhost:8080/WebRestApi/rest/baskets/MUCFJAIBTVDK3HHNC444ZALMV4

Example Response:

Status: 200 OK

Get Basket item #

Service URL: GET /baskets/{basketReference}/items/{lineNumber}

Tokens:

basketReference – The basket reference of the basket to add the item to, or can be ‘PRIMARY’ to add to the PRIMARY basket.

Response Body:

IBasketItemRetrievalResponse:

basketItem – IBasketItem – The requested basket item

Remarks:

Loads an existing basket and extracts the basket item based on the line number.

Scenarios

Scenario

Outcome

Expected behaviour

Status Code

Response

1

Service recieves a valid basket reference and line number

Success

The item is extracted from the basket and returned.

200

IBasketItemRetrievalResponse: basketItem

2

Serivce recieves a valid basket and invalid line number

NotFound

Basket item with line number provided was not found. Error Message should be returned

400

Error Message: Item could not found for basket reference <basketReference>

3

Serivce recieves a valid basket and invalid line number

NotFound

Basket was not found given the basket reference. Error Message should be returned

400

Error Message: Item could not found for basket reference <basketReference>

Example Request:

Example Get Basket Item Request

GET: http://localhost:8080/WebRestApi/rest/baskets/PRIMARY/items/1

Example Response:

Example Get Basket Item Response  Expand source

{

“basketItem”: {

“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”

}

},

“customerNumber”: “1”

}

Add an Item to a Basket #

Service URL: POST /baskets/{basketReference}/items

Tokens:

basketReference – The basket reference of the basket to add the item to, or can be ‘PRIMARY’ to add to the PRIMARY basket.

Request Parameters:

returnBasket – Boolean – If true the updated basket is returned – Defaults to false

Request Body:

IAddBasketItemRequest:

itemType –  String – The type of the item to add to the basket. Currently, supported types are VOUCHER and PRODUCT. Optional, defaults to PRODUCT.

itemId – String – The id of the item to add to the basket. If the type is PRODUCT or empty, the item should be the id of the product. When the type is VOUCHER, the item id should be the vouchers serial number – Required

quantity – Integer – The quantity to add to the basket – Optional, defaults to 1

Response Headers:

Location: /baskets/{basketReference}/items/{lineNumber}

Response Body:

IBasketItemResponse:

basketItemLineNumber – String – the line number of the item added to the basket.

basket – IBasket – The new or updated transaction containing the item being added, if returnBasket is true

basketReference – String – the reference of the basket

basketType – String – the type of the basket

basketDescription – String – the description of the basket

basketResponseCode – String – A specific basket code to indict whether the basket was implicitly created by the server.

basketStatus – String – the status of the basket. Fresh baskets have the status NEW. Baskets in progress have the status of IN_PROGRESS. Baskets will have been submitted to retail processing have the status SUBMITTED.

Remarks:

Adds a new item to a basket. If the PRIMARY basket is specified and it does not currently exist, it will be created. However, if a wishlist basket that does not exists, the service call should fail with a bad request. The lineNumber for the new item is returned in the response header. If the returnBasket the parameter is true, the updated basket and the line number of the new item is returned in the response body.

Scenarios:

Primary Basket Scenarios

All scenarios start with “Basket items service has received a request to add an item to a primary basket”.

Scenario

Outcome

Expected behavior

Status Code

Response

1

 The customer does not currently have a primary basket. Return basket is empty

success

A new primary basket gets created with the item. The basket is not returned

200

200 Success ok

2

 The customer does not currently have a primary basket. Return basket is set to true

success

A new primary basket gets created with the item. The basket is returned

200

IBasketResponse: basket

3

The customer already has a primary basket. Return basket is empty

success

The item should be added to the existing basket. The basket is returned

200

200 Success ok

4

The customer already has a primary basket. Return basket is set to true

success

The item should be added to the existing basket. The basket is not returned

200

IBasketResponse: basket

Wishlist Basket Scenarios

All scenarios start with “Basket items service has received a request to add the item to a wishlist basket”.

Scenario

Outcome

Expected behavior

Status Code

Response

1

The wishlist basket exists, and return basket is empty

success

The item should be added to the existing wishlist basket. The basket is not returned

200

200 Success ok

2

The wishlist basket exists, and return basket is set to true

success

The item should be added to the existing wishlist basket. The basket is returned

200

IBasketResponse: basket

3

The wishlist basket does not exist

BadRequest

The service should return and an error message stating that it can’t add the item to the specified basket.

400

Error Message: Failed to add the item to the basket. Bad Request

Example Request:

 Expand source

POST: http://localhost:8080/WebRestApi/rest/baskets/PRIMARY/items?returnBasket=true

Content-Type: application/json

{

“itemId” : “MB709SN-4”,

“itemType” : “PRODUCT”,

“quantity” : “1”,

“returnBasket” : true

}

Response Body:

 Expand source

Status: 200 OK

{

“basketItemLineNumber”: “3”,

“basketType”: “PRIMARY”,

“basketDescription”: “Primary”,

“basket”: {

“items”: [

{

“@type”: “orderDetailsItem”,

“description”: “Order”,

“deviceId”: “pos2@0001.enactor”,

“effectiveNetValue”: -9955,

“lineNumber”: 1,

“netValue”: -9955,

“value”: -9955,

“dateTimeCreated”: “2019-08-22T15:01:07.000+01:00”,

“userId”: “CUST_USER”,

“type”: “VALUE”,

“orderReference”: “149”,

“sendCustomerDeliveryNotification”: true,

“customerOrderTypeId”: “CUSTOMER_ORDER”

},

{

“@type”: “styleColourSizeItem”,

“colourId”: {

“id”: “RED”,

“colourRangeId”: “MENS_SHOES”

},

“description”: “Vans Canvas Shoes”,

“deviceId”: “pos2@0001.enactor”,

“effectiveNetValue”: 5995,

“lineNumber”: 2,

“netValue”: 5995,

“value”: 5995,

“dateTimeCreated”: “2019-08-22T15:01:18.000+01:00”,

“userId”: “CUST_USER”,

“modifiersNetValue”: 0,

“modifiersEffectiveNetValue”: 0,

“modifiersVoidQuantity”: 0,

“modifiersQuantity”: 0,

“notDiscountable”: false,

“maxDiscount”: 0,

“handKeyed”: true,

“productID”: “VV639JS-12”,

“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”,

“modifiers”: [

{

“@type”: “orderModifier”,

“modifierItemLine”: 1

}

],

“sizeId”: {

“id”: “12”,

“sizeRangeId”: “MENS_SHOES”

}

},

{

“@type”: “styleColourSizeItem”,

“colourId”: {

“id”: “NAVY_BLUE”,

“colourRangeId”: “WOMENS_DRESSES”

},

“description”: “Rose Print Tea Dress”,

“deviceId”: “pos2@0001.enactor”,

“effectiveNetValue”: 3960,

“lineNumber”: 3,

“netValue”: 4260,

“value”: 4260,

“dateTimeCreated”: “2019-08-29T12:19:35.000+01:00”,

“userId”: “CUST_USER”,

“modifiersNetValue”: 0,

“modifiersEffectiveNetValue”: -300,

“modifiersVoidQuantity”: 0,

“modifiersQuantity”: 0,

“notDiscountable”: false,

“maxDiscount”: 0,

“handKeyed”: true,

“productID”: “MB709SN-4”,

“quantity”: 1,

“netQuantity”: 1,

“isReturn”: false,

“unitPrice”: 4260,

“sourceInventoryType”: “AVA”,

“orderable”: true,

“priceTypeId”: “R”,

“productTypeId”: “skuProduct”,

“productImageURL”: “image://PRODUCT/MB709SN-2.jpg”,

“type”: “VALUE”,

“mmGroupId”: “WOMENS_DRESSES”,

“mmGroupHierarchyId”: “FASHION”,

“mmGroupVariantGroupId”: “All”,

“mmGroupVariantHierarchyId”: “All”,

“mmGroupDescription”: “Women’s Dresses”,

“brandGroupId”: “INTERNAL”,

“brandGroupHierarchyId”: “FASHION”,

“modifiers”: [

{

“@type”: “orderModifier”,

“modifierItemLine”: 1

},

{

“@type”: “distributedPromotionSavingItem”,

“lineNumber”: 3,

“distributedSaving”: 300,

“promotionKey”: {

“promotionId”: “AmountDiscount”,

“groupKey”: {

“id”: “UK”,

“groupTypeId”: “region”,

“groupHierarchyId”: “All”

}

},

“modifierType”: “PROMOTION”,

“modifierItemLine”: 0,

“effectiveValue”: -300

}

],

“sizeId”: {

“id”: “14”,

“sizeRangeId”: “WOMENS_DRESSES”

}

}

],

“balance”: 0,

“currencyId”: “GBP”,

“currencyDescription”: “Pounds Sterling”,

“taxInclusive”: true,

“taxSchemeId”: “UK”,

“itemCount”: 3,

“saleItemQuantity”: 2,

“returnItemQuantity”: 0,

“saleItemNetValue”: 9955,

“returnItemNetValue”: 0,

“merchandiseItemQuantity”: 2,

“merchandiseItemValue”: 10255,

“total”: 0,

“grossTotal”: 300,

“taxTotal”: 0,

“promotionCalculation”: {

“totalSaving”: 300,

“totalPoints”: 0,

“itemsArray”: [

{

“promotionSavingItem”: {

“saving”: 300,

“savingAdjustment”: 0,

“adjustEmployeeBalance”: false,

“promotionDescription”: “£3 off of KAT VON D Eye Liner”,

“promotionQuantity”: 1,

“operationWithDiscounts”: “APPLIES_AFTER_ON_GROSS”,

“promotionKey”: {

“promotionId”: “AmountDiscount”,

“groupKey”: {

“id”: “UK”,

“groupTypeId”: “region”,

“groupHierarchyId”: “All”

}

},

“triggers”: [

{

“rewardValue”: 300,

“lineRewardValue”: 300,

“distributeSaving”: true,

“lineNumber”: 3,

“quantity”: 1,

“unitValue”: 4260,

“triggerCount”: 1,

“rewardId”: “1”

}

]

}

}

]

},

“currentModifierLineNumber”: 1,

“totalTaxAdjustment”: 0,

“preAuthBalance”: 0,

“effectiveSaleValue”: 9955

},

“basketResponseCode”: “BASKET_ITEM_ADDED”

}

Remove an Item From a Basket #

Service URL: DELETE /baskets/{basketReference}/items/{lineNumber}

Tokens:

basketReference – The basket reference of the basket to remove the item from. The basket reference can be a basketId or PRIMARY for a primary basket

lineNumber – The line number to remove from the basket

Remarks:

Deletes an existing line number from a basket.

Scenarios

Scenario

Outcome

Expected behaviour

Status Code

Response

1

Service is given a valid lineNumber and basketReference so the item is removed from the basket

success

The basket item is removed.

200

200 Success ok

2

Service is given a invalid lineNumber and a valid basketReference

NotFound

Service returns a bad request

400

Error Message: Item could not be removed from the basket with reference: <BasketReference>

Example Request:

DELETE: http://localhost:8080/WebRestApi/rest/baskets/PRIMARY/items/2

Example Response:

Status: 200 OK

Update an Items Quantity #

Service URL: PATCH /baskets/{basketReference}/items/{lineNumber}/quantity

Tokens:

basketReference – The basket reference of the basket to add the item to, or can be ‘PRIMARY’ to add to the PRIMARY basket.

lineNumber – The line number to update in the basket

Parameters:

IUpdateBasketItemQuantityRequest:

returnBasket – Boolean – If true the updated basket is returned – Defaults to false

Request Body:

quantity – Integer – The new quantity for the line

Response Body:

BasketResponse

basket – IBasket – The basket associated with the given reference

basketReference – String – the reference of the basket

basketType – String – the type of the basket

basketDescription – String – the description of the basket

basketResponseCode – String – A specific basket code to indict whether the basket was implicitly created by the server.

basketStatus – String – the status of the basket. Fresh baskets have the status NEW. Baskets in progress have the status of IN_PROGRESS. Baskets will have been submitted to retail processing have the status SUBMITTED.

Remarks:

Updates the quantity on an existing line in the basket. The line number is used to identify which line to update. Setting the quantity to zero will result in the line being deleted.

Scenarios

Scenario

Outcome

Expected behaviour

Status Code

Response

1

Service is given a valid lineNumber and basketReference .ReturnBasket is not set

Success

The basket items quantity is updated.

200

200 Success ok

2

Service is given a valid lineNumber and basketReference. ReturnBasket is set to true

Success

The basket items quantity is updated. The basket is returned to the client

200

IBasketResponse: basket

Example Request:

PATCH: http://localhost:8080/WebRestApi/rest/baskets/PRIMARY/items/1/quantity

Content-Type: application/json

{

“quantity” : “1”,

“returnBasket” : true

}

Example Response:

Example Update Basket Item Response  Expand source

200 OK

Copy/Move All Items from one Basket to another #

Service URLs

  • Copy: POST /baskets/manager/copy
  • Move: POST /baskets/manager/move

Request Body:

ModifyBasketItemsRequest

sourceBasketReference – String – the basket reference of the source basket to copy/move the items from.

targetBasketReference – String – The basketReference of the basket to copy/move the items to.

Response Body:

IModifyBasketItemsResponse

sourceLocation – String – location of the URL for the destination basket

destinationLocation – String – location of the URL for the destination basket

Remarks:

Copies all Line Items from the source basket (BasketReference) to the Basket identified by the targetBasketReference. If the Copy operation is specified, the source basket is retained with all its items. If the Move operation is specified, all items of the source basket are deleted and in all cases except the PRIMARY Basket, the source basket is also deleted.

Scenarios

Scenario

Outcome

Expected behaviour

Status Code

Response

1

A user wants to copy over items from their primary basket to a wishlist basket.

Success

The items are copied over from the source to the target basket.

200

ModifyBasketItemsResponse

2

A user wants to move over items from their primary basket to a wishlist basket.

Success

The items are moved over from the source to the target basket. The source (primary) should have it’s basket emptied.

200

ModifyBasketItemsResponse

3

A user wants to move over items from a wishlist basket to a primary basket.

Success

The items are moved over from the source to the target basket. The source (wishlist) should be removed.

200

ModifyBasketItemsResponse

Example Request

POST /baskets/manager/copy

{

“sourceBasketReference”: “WWNOGKK4FVCOZJMKGDE6ZSIQA4”,

“targetBasketReference”: “PRIMARY”

}

Example Response

{

“sourceBasketLocation”: “http://localhost:8080/WebRestApi/rest/baskets/WWNOGKK4FVCOZJMKGDE6ZSIQA4”,

“destinationBasketLocation”: “http://localhost:8080/WebRestApi/rest/baskets/PRIMARY”

}

Remove all Items from a Basket #

Service URL: DELETE /baskets/{basketReference}/items

Tokens:

basketReference – The basket reference of the basket to remove all items from a basket.

Remarks:

Removes all items from a basket.

Scenarios

Scenario

Outcome

Expected behaviour

Status Code

Response

1

Delete all items for a valid primary basket reference.

Success

All items should be deleted for the requested basket.

200

200 Success Ok

2

Delete all items for a valid wishlist basket reference.

Success

All items should be deleted for the requested basket.

200

200 Success Ok

3

Delete all items for an invalid basket reference.

NotFound

A bad request error should be raised.

400

ErrorMessage :Bad request. Could not delete items for basket reference <basketReference>

Example Request:

DELETE: http://localhost:8080/WebRestApi/rest/baskets/MUCFJAIBTVDK3HHNC444ZALMV4/items

Example Response:

Status: 200 OK

Request a Promotion Calculation #

Not sure we need/want this

Service URL: PATCH /baskets/{basketReference}/promotions

Tokens:

basketReference – The basket reference of the basket to add the items to, or can be ‘PRIMARY’ to add to the PRIMARY basket.

Parameters:

returnBasket – Boolean – If true the updated basket is returned – Optional, defaults to false

Response Body:

BasketResponse – The updated basket if returnBasket is true

basket – IBasket – The basket associated with the given reference

basketReference – String – the reference of the basket

basketType – String – the type of the basket

basketDescription – String – the description of the basket

basketResponseCode – String – A specific basket code to indict whether the basket was implicitly created by the server.

basketStatus – String – the status of the basket. Fresh baskets have the status NEW. Baskets in progress have the status of IN_PROGRESS. Baskets will have been submitted to retail processing have the status SUBMITTED.

Remarks:

Recalculate promotions on the associated basket. Typically promotions will only be updated when items are added/removed/updated, this service can be called to force an update if required.

Example Request:

PATCH: http://localhost:8080/WebRestApi/rest/baskets/PRIMARY/promotions?returnBasket=true

id_token: <identity_token>

Example Response:

 Expand source

{

“basket”: {

“items”: [

{

“@type”: “orderDetailsItem”,

“description”: “###.###”,

“deviceId”: “pos2@0001.enactor”,

“effectiveNetValue”: 0,

“lineNumber”: 1,

“netValue”: 0,

“value”: 0,

“dateTimeCreated”: “2019-07-22T16:04:03.000+01:00”,

“userId”: “CUST_USER”,

“type”: “VALUE”,

“orderReference”: “17”,

“customerOrderTypeId”: “CUSTOMER_ORDER”

},

{

“@type”: “styleColourSizeItem”,

“colourId”: {

“id”: “RED”,

“colourRangeId”: “MENS_SHOES”

},

“description”: “Vans Canvas Shoes”,

“deviceId”: “pos2@0001.enactor”,

“effectiveNetValue”: 5995,

“lineNumber”: 2,

“netValue”: 5995,

“value”: 5995,

“dateTimeCreated”: “2019-07-22T16:04:26.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”,

“basketDescription”: “Primary”,

“basketStatus”: “IN_PROGRESS”

}

List the Customers Baskets #

Service URL: GET /baskets

Parameters:

pageSize – Integer – The maximum number of baskets to return in a single page – Optional, default to 10, limited to 100

pageOffset – Integer – The offset, in rows, of the first basket to return – Optional, default to 0

extended – boolean – If the flag is true, then a list of basket responses is returned. Otherwise, a list of basket summaries is returned. Defaults to false

Response Body:

basksetSummaries – A list of basket summaries, excluding the Primary basket, for the given customer. The basket summaries only include details about the basket’s reference, type, and description

When the extended flag is true

basketResponses – A list of basket responses, excluding the Primary basket, for the given customer. The list will include the basketReferences to allow the details to be later retrieved.

Remarks:

List the baskets associated with the given customer, excluding the Primary basket. It is not possible to list baskets associated with an anonymous customer – if the customer loses their reference to an anonymous basket the basket cannot be recalled.

Scenarios

Scenario

Outcome

Expected behaviour

Status Code

Response

1

The list customer baskets is called with a valid list customer baskets request

Success

Loads a list of summaries for the customer’s baskets, excluding their primary baskets.

200

IListCustomerBasketsSummariesResponse: basketSummaries

2

The list customer baskets is called with a valid list customer baskets request and the extended flag is true

Success

Loads a list of basket response for the customer, excluding their primary baskets.

200

IListCustomerBasketsResponse: basketResponses

Example Request:

Example List Customer Baskets Request

GET: http://localhost:8080/WebRestApi/rest/baskets

Example Response:

Example List Customer Baskets Response  Expand source

{

“basketSummaries”: [

{

“reference”: “4PYQCL2LQ5EQXM2TYE3PBTGO4A”,

“type”: “WISHLIST”,

“description”: “Monday”

},

{

“reference”: “BK3TSNHJJZF23F7K7PJ4YDWK5M”,

“type”: “WISHLIST”,

“description”: “Christmas Wishlist”

},

{

“reference”: “BRC7SUUIJ5CU3OKJ6K3ZJFVZR4”,

“type”: “WISHLIST”,

“description”: “Stored Basket”

},

{

“reference”: “BTRGMY7JHBDHDOXRBJR5CZVFAA”,

“type”: “WISHLIST”,

“description”: “Postman2”

},

{

“reference”: “CKKTFIP7FVAMDHHMPI27TZ6TD4”,

“type”: “WISHLIST”,

“description”: “Postman2”

},

{

“reference”: “GYM5JXTEFFE4PNTQJZYF6M3HBM”,

“type”: “WISHLIST”,

“description”: “Postman2”

},

{

“reference”: “H3TD3SGOIBHUROO63N7SI7HDQ4”,

“type”: “WISHLIST”,

“description”: “Xmas Wishlist”

},

{

“reference”: “HLMC4D7VIVBUFI6NOFEB4APIFQ”,

“type”: “WISHLIST”,

“description”: “TEst 1”

},

{

“reference”: “MUZ5LFOTGFDGJK7VNPERD5X65M”,

“type”: “WISHLIST”,

“description”: “Stored Basket”

},

{

“reference”: “NDCRLG3TBFA5DGZBRESAGMZPMA”,

“type”: “WISHLIST”,

“description”: “BLANK”

},

{

“reference”: “Q7J6EFEULFGD7BB7J6BKLVWVXE”,

“type”: “WISHLIST”,

“description”: “My Bag”

},

{

“reference”: “R7WB2IJJURESPIRPQUOHPP46EU”,

“type”: “WISHLIST”,

“description”: “Dehan”

},

{

“reference”: “RQVE6DPYSNHQLLM2SCEB5KO2ZE”,

“type”: “WISHLIST”,

“description”: “James”

},

{

“reference”: “TXS7FJKNSFEZXNVKRNQ3JLUVSY”,

“type”: “WISHLIST”,

“description”: “Easter”

},

{

“reference”: “YUEPHVMGLJFIBDIEWE42JVW2UM”,

“type”: “WISHLIST”,

“description”: “Stored Basket”

}

]

}

Example Request with the extended flag set to true:

Example List Customer Baskets Request

GET: http://localhost:8080/WebRestApi/rest/baskets

Example Response:

 Expand source

{

“basketResponses”: [

{

“basket”: {

“items”: [

{

“@type”: “orderDetailsItem”,

“description”: “###.###”,

“deviceId”: “pos2@0001.enactor”,

“effectiveNetValue”: 0,

“lineNumber”: 1,

“netValue”: 0,

“value”: 0,

“dateTimeCreated”: “2019-02-11T13:23:18.000+00:00”,

“userId”: “CUST_USER”,

“type”: “VALUE”,

“orderReference”: “0002190211132318”,

“performedOffline”: true,

“customerOrderTypeId”: “CUSTOMER_ORDER”

},

{

“@type”: “orderDetailsItem”,

“description”: “###.###”,

“deviceId”: “pos2@0001.enactor”,

“effectiveNetValue”: 0,

“lineNumber”: 2,

“netValue”: 0,

“value”: 0,

“dateTimeCreated”: “2019-01-22T14:39:26.000+00:00”,

“userId”: “CUST_USER”,

“type”: “VALUE”,

“orderReference”: “120”,

“customerOrderTypeId”: “CUSTOMER_ORDER”

},

{

“@type”: “styleColourSizeItem”,

“colourId”: {

“id”: “RED”,

“colourRangeId”: “MENS_SHOES”

},

“description”: “Vans Canvas Shoes”,

“deviceId”: “pos2@0001.enactor”,

“effectiveNetValue”: 5590,

“lineNumber”: 3,

“netValue”: 5995,

“value”: 5995,

“dateTimeCreated”: “2019-01-22T14:39:28.000+00:00”,

“userId”: “CUST_USER”,

“modifiersNetValue”: 0,

“modifiersEffectiveNetValue”: -405,

“modifiersVoidQuantity”: 0,

“modifiersQuantity”: 0,

“notDiscountable”: false,

“maxDiscount”: 0,

“handKeyed”: true,

“productID”: “VV639JS-12”,

“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”,

“modifiers”: [

{

“@type”: “distributedPromotionSavingItem”,

“lineNumber”: 3,

“distributedSaving”: 405,

“promotionKey”: {

“promotionId”: “3”,

“groupKey”: {

“id”: “All”,

“groupTypeId”: “region”,

“groupHierarchyId”: “All”

}

},

“modifierType”: “PROMOTION”,

“effectiveValue”: -405

}

],

“sizeId”: {

“id”: “12”,

“sizeRangeId”: “MENS_SHOES”

}

},

{

“@type”: “styleColourSizeItem”,

“colourId”: {

“id”: “RED”,

“colourRangeId”: “MENS_SHOES”

},

“description”: “Vans Canvas Shoes”,

“deviceId”: “pos2@0001.enactor”,

“effectiveNetValue”: 5589,

“lineNumber”: 4,

“netValue”: 5995,

“value”: 5995,

“dateTimeCreated”: “2019-01-22T14:39:30.000+00:00”,

“userId”: “CUST_USER”,

“modifiersNetValue”: 0,

“modifiersEffectiveNetValue”: -406,

“modifiersVoidQuantity”: 0,

“modifiersQuantity”: 0,

“notDiscountable”: false,

“maxDiscount”: 0,

“handKeyed”: true,

“productID”: “VV639JS-12”,

“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”,

“modifiers”: [

{

“@type”: “distributedPromotionSavingItem”,

“lineNumber”: 4,

“distributedSaving”: 406,

“promotionKey”: {

“promotionId”: “3”,

“groupKey”: {

“id”: “All”,

“groupTypeId”: “region”,

“groupHierarchyId”: “All”

}

},

“modifierType”: “PROMOTION”,

“effectiveValue”: -406

}

],

“sizeId”: {

“id”: “12”,

“sizeRangeId”: “MENS_SHOES”

}

},

{

“@type”: “styleColourSizeItem”,

“colourId”: {

“id”: “BLUE”,

“colourRangeId”: “WOMENS_DRESSES”

},

“description”: “Crinkle Day Dress”,

“deviceId”: “pos2@0001.enactor”,

“effectiveNetValue”: 2609,

“lineNumber”: 5,

“netValue”: 2798,

“value”: 2798,

“dateTimeCreated”: “2019-01-28T11:41:35.000+00:00”,

“userId”: “CUST_USER”,

“modifiersNetValue”: 0,

“modifiersEffectiveNetValue”: -189,

“modifiersVoidQuantity”: 0,

“modifiersQuantity”: 0,

“notDiscountable”: false,

“maxDiscount”: 0,

“handKeyed”: true,

“productID”: “MB229XML-4”,

“quantity”: 1,

“netQuantity”: 1,

“isReturn”: false,

“unitPrice”: 2798,

“sourceInventoryType”: “AVA”,

“orderable”: true,

“priceTypeId”: “R”,

“productTypeId”: “skuProduct”,

“productImageURL”: “image://PRODUCT/MB229XM-3.jpg”,

“type”: “VALUE”,

“mmGroupId”: “WOMENS_DRESSES”,

“mmGroupHierarchyId”: “FASHION”,

“mmGroupVariantGroupId”: “All”,

“mmGroupVariantHierarchyId”: “All”,

“mmGroupDescription”: “Women’s Dresses”,

“brandGroupId”: “INTERNAL”,

“brandGroupHierarchyId”: “FASHION”,

“modifiers”: [

{

“@type”: “distributedPromotionSavingItem”,

“lineNumber”: 5,

“distributedSaving”: 189,

“promotionKey”: {

“promotionId”: “3”,

“groupKey”: {

“id”: “All”,

“groupTypeId”: “region”,

“groupHierarchyId”: “All”

}

},

“modifierType”: “PROMOTION”,

“effectiveValue”: -189

}

],

“sizeId”: {

“id”: “16”,

“sizeRangeId”: “WOMENS_DRESSES”

}

},

{

“@type”: “voucherRedemptionItem”,

“voucherDetails”: {

“voucherTypeId”: {

“regionId”: {

“id”: “All”,

“groupTypeId”: “region”,

“groupHierarchyId”: “All”

},

“voucherTypeId”: “10_POUND”

}

},

“track”: false,

“markItemsUsed”: false,

“currencyId”: “GBP”,

“description”: “£10 Pound off”,

“deviceId”: “pos2@0001.enactor”,

“lineNumber”: 6,

“dateTimeCreated”: “2019-02-07T11:47:15.000+00:00”,

“userId”: “CUST_USER”,

“type”: “VALUE”

}

],

“balance”: 13788,

“currencyId”: “GBP”,

“currencyDescription”: “Pounds Sterling”,

“taxInclusive”: true,

“taxSchemeId”: “UK”,

“itemCount”: 6,

“saleItemQuantity”: 3,

“returnItemQuantity”: 0,

“saleItemNetValue”: 13788,

“returnItemNetValue”: 0,

“merchandiseItemQuantity”: 3,

“merchandiseItemValue”: 14788,

“total”: 13788,

“grossTotal”: 14788,

“taxTotal”: 0,

“promotionCalculation”: {

“totalSaving”: 1000,

“totalPoints”: 0,

“itemsArray”: [

{

“promotionSavingItem”: {

“saving”: 1000,

“savingAdjustment”: 0,

“distributedSavings”: [

{

“distributedPromotionSavingItem”: {

“lineNumber”: 3,

“distributedSaving”: 405,

“promotionKey”: {

“promotionId”: “3”,

“groupKey”: {

“id”: “All”,

“groupTypeId”: “region”,

“groupHierarchyId”: “All”

}

},

“modifierType”: “PROMOTION”,

“effectiveValue”: -405

}

},

{

“distributedPromotionSavingItem”: {

“lineNumber”: 4,

“distributedSaving”: 406,

“promotionKey”: {

“promotionId”: “3”,

“groupKey”: {

“id”: “All”,

“groupTypeId”: “region”,

“groupHierarchyId”: “All”

}

},

“modifierType”: “PROMOTION”,

“effectiveValue”: -406

}

},

{

“distributedPromotionSavingItem”: {

“lineNumber”: 5,

“distributedSaving”: 189,

“promotionKey”: {

“promotionId”: “3”,

“groupKey”: {

“id”: “All”,

“groupTypeId”: “region”,

“groupHierarchyId”: “All”

}

},

“modifierType”: “PROMOTION”,

“effectiveValue”: -189

}

}

],

“adjustEmployeeBalance”: false,

“promotionDescription”: “£10 off when you spend £100”,

“promotionQuantity”: 1,

“operationWithDiscounts”: “APPLIES_AFTER_ON_GROSS”,

“promotionKey”: {

“promotionId”: “3”,

“groupKey”: {

“id”: “All”,

“groupTypeId”: “region”,

“groupHierarchyId”: “All”

}

},

“triggers”: [

{

“rewardValue”: 1000,

“lineRewardValue”: 405,

“distributeSaving”: true,

“lineNumber”: 3,

“quantity”: 1,

“unitValue”: 5995,

“triggerCount”: 1

},

{

“rewardValue”: 1000,

“lineRewardValue”: 406,

“distributeSaving”: true,

“lineNumber”: 4,

“quantity”: 1,

“unitValue”: 5995,

“triggerCount”: 1

},

{

“rewardValue”: 1000,

“lineRewardValue”: 189,

“distributeSaving”: true,

“lineNumber”: 5,

“quantity”: 1,

“unitValue”: 2798,

“triggerCount”: 1

}

]

}

}

]

},

“totalTaxAdjustment”: 0,

“preAuthBalance”: 0,

“effectiveSaleValue”: 13788

},

“basketReference”: “4PYQCL2LQ5EQXM2TYE3PBTGO4A”,

“basketType”: “WISHLIST”,

“basketDescription”: “Monday”,

“basketStatus”: “NEW”

},

]

}

Get a Baskets Details #

Service URL: GET /baskets/{basketReference}

Tokens:

basketReference – The basket reference of the basket to add the items to, or can be ‘PRIMARY’ to add to the PRIMARY basket.

Parameters:

basketType – String – the type of basket to query for

Response Body:

BasketResponse

basket – IBasket – The basket associated with the given reference

basketReference – String – the reference of the basket

basketType – String – the type of the basket

basketDescription – String – the description of the basket

basketResponseCode – String – A specific basket code to indict whether the basket was implicitly created by the server.

basketStatus – String – the status of the basket. Fresh baskets have the status NEW. Baskets in progress have the status of IN_PROGRESS. Baskets will have been submitted to retail processing have the status SUBMITTED.

Remarks:

Load an existing basket and return it, without making any changes. A user should only be able to load baskets which belong to them.

Scenarios:

Scenario

Outcome

Expected behavior

Status Code

Response

1

Get Basket service has been given a valid basket reference

Success

The basket is returned to the client

200

BaskerResponse

2

Get Basket service has been given a basket reference that doesn’t exist

NotFound

The basket is not returned. A NotFound outcome is returned with a 404 not found response.

404

Error Message: Failed to retrieve basket, outcome: NotFound

3

Get Basket service has been given a PRIMARY basket reference with a valid token.

Success

The primary basket for a customer is returned to the client

200

BaskerResponse

4

Get Basket service has been given a PRIMARY basket reference but no token is supplied

Fail

The basket is not returned. The service will fail because the customer’s information is missing

500

Error Message: Failed to retrieve basket, outcome: Fail

Cucumber (Deprecated):

Number

Scenario

Outcome

Response

1

Call GetBasket process for a wishlist basket given a valid basket key/reference

Success

BasketResponse

2

Call GetBasket process for a primary basket

Success

BasketResponse

Rest Assured (Deprecated):

Number

Scenario

StatusCode

Response

1

Call GetBasket service for a wishlist basket given a valid basket key/reference

200

BasketResponse

2

Call GetBasket service for a basket given a invalid basket key/reference

500

ErrorMessage: Failed to retrieve basket

3

Call GetBasket service for a primary basket

200

BasketResponse

Example Request:

GET: http://localhost:8080/WebRestApi/rest/baskets/PRIMARY

Example Response:

Example Get Basket Response  Expand source

{

“basket”: {

“items”: [

{

“@type”: “orderDetailsItem”,

“description”: “###.###”,

“deviceId”: “pos2@0001.enactor”,

“effectiveNetValue”: 0,

“lineNumber”: 1,

“netValue”: 0,

“value”: 0,

“dateTimeCreated”: “2019-07-19T16:18:23.000+01:00”,

“userId”: “CUST_USER”,

“type”: “VALUE”,

“orderReference”: “15”,

“customerOrderTypeId”: “CUSTOMER_ORDER”

},

{

“@type”: “styleColourSizeItem”,

“colourId”: {

“id”: “RED”,

“colourRangeId”: “MENS_SHOES”

},

“description”: “Vans Canvas Shoes”,

“deviceId”: “pos2@0001.enactor”,

“effectiveNetValue”: 5995,

“lineNumber”: 2,

“netValue”: 5995,

“value”: 5995,

“dateTimeCreated”: “2019-07-19T16:18:26.000+01:00”,

“userId”: “CUST_USER”,

“modifiersNetValue”: 0,

“modifiersEffectiveNetValue”: 0,

“modifiersVoidQuantity”: 0,

“modifiersQuantity”: 0,

“notDiscountable”: false,

“maxDiscount”: 0,

“handKeyed”: true,

“productID”: “VV639JS-12”,

“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”: “12”,

“sizeRangeId”: “MENS_SHOES”

}

},

{

“@type”: “styleColourSizeItem”,

“colourId”: {

“id”: “RED”,

“colourRangeId”: “MENS_SHIRTS”

},

“description”: “Button Down Collar Red”,

“deviceId”: “pos2@0001.enactor”,

“effectiveNetValue”: 2595,

“lineNumber”: 3,

“netValue”: 2595,

“value”: 2595,

“dateTimeCreated”: “2019-07-19T16:21:08.000+01:00”,

“userId”: “CUST_USER”,

“modifiersNetValue”: 0,

“modifiersEffectiveNetValue”: 0,

“modifiersVoidQuantity”: 0,

“modifiersQuantity”: 0,

“notDiscountable”: false,

“maxDiscount”: 0,

“handKeyed”: true,

“productID”: “DF517XM-1”,

“quantity”: 1,

“netQuantity”: 1,

“isReturn”: false,

“unitPrice”: 2595,

“sourceInventoryType”: “AVA”,

“orderable”: true,

“priceTypeId”: “R”,

“productTypeId”: “skuProduct”,

“productImageURL”: “image://PRODUCT/DF517XM-2.jpg”,

“type”: “VALUE”,

“mmGroupId”: “MENS_SHIRTS”,

“mmGroupHierarchyId”: “FASHION”,

“mmGroupVariantGroupId”: “All”,

“mmGroupVariantHierarchyId”: “All”,

“mmGroupDescription”: “Mens Shirts”,

“brandGroupId”: “INTERNAL”,

“brandGroupHierarchyId”: “FASHION”,

“sizeId”: {

“id”: “S”,

“sizeRangeId”: “MENS_SHIRTS”

}

},

{

“@type”: “styleColourSizeItem”,

“colourId”: {

“id”: “RED”,

“colourRangeId”: “MENS_SHIRTS”

},

“description”: “Button Down Collar Red”,

“deviceId”: “pos2@0001.enactor”,

“effectiveNetValue”: 2595,

“lineNumber”: 4,

“netValue”: 2595,

“value”: 2595,

“dateTimeCreated”: “2019-07-19T16:21:10.000+01:00”,

“userId”: “CUST_USER”,

“modifiersNetValue”: 0,

“modifiersEffectiveNetValue”: 0,

“modifiersVoidQuantity”: 0,

“modifiersQuantity”: 0,

“notDiscountable”: false,

“maxDiscount”: 0,

“handKeyed”: true,

“productID”: “DF517XM-1”,

“quantity”: 1,

“netQuantity”: 1,

“isReturn”: false,

“unitPrice”: 2595,

“sourceInventoryType”: “AVA”,

“orderable”: true,

“priceTypeId”: “R”,

“productTypeId”: “skuProduct”,

“productImageURL”: “image://PRODUCT/DF517XM-2.jpg”,

“type”: “VALUE”,

“mmGroupId”: “MENS_SHIRTS”,

“mmGroupHierarchyId”: “FASHION”,

“mmGroupVariantGroupId”: “All”,

“mmGroupVariantHierarchyId”: “All”,

“mmGroupDescription”: “Mens Shirts”,

“brandGroupId”: “INTERNAL”,

“brandGroupHierarchyId”: “FASHION”,

“sizeId”: {

“id”: “S”,

“sizeRangeId”: “MENS_SHIRTS”

}

},

{

“@type”: “styleColourSizeItem”,

“colourId”: {

“id”: “RED”,

“colourRangeId”: “MENS_SHIRTS”

},

“description”: “Button Down Collar Red”,

“deviceId”: “pos2@0001.enactor”,

“effectiveNetValue”: 2595,

“lineNumber”: 5,

“netValue”: 2595,

“value”: 2595,

“dateTimeCreated”: “2019-07-19T16:21:11.000+01:00”,

“userId”: “CUST_USER”,

“modifiersNetValue”: 0,

“modifiersEffectiveNetValue”: 0,

“modifiersVoidQuantity”: 0,

“modifiersQuantity”: 0,

“notDiscountable”: false,

“maxDiscount”: 0,

“handKeyed”: true,

“productID”: “DF517XM-1”,

“quantity”: 1,

“netQuantity”: 1,

“isReturn”: false,

“unitPrice”: 2595,

“sourceInventoryType”: “AVA”,

“orderable”: true,

“priceTypeId”: “R”,

“productTypeId”: “skuProduct”,

“productImageURL”: “image://PRODUCT/DF517XM-2.jpg”,

“type”: “VALUE”,

“mmGroupId”: “MENS_SHIRTS”,

“mmGroupHierarchyId”: “FASHION”,

“mmGroupVariantGroupId”: “All”,

“mmGroupVariantHierarchyId”: “All”,

“mmGroupDescription”: “Mens Shirts”,

“brandGroupId”: “INTERNAL”,

“brandGroupHierarchyId”: “FASHION”,

“sizeId”: {

“id”: “S”,

“sizeRangeId”: “MENS_SHIRTS”

}

},

{

“@type”: “styleColourSizeItem”,

“colourId”: {

“id”: “RED”,

“colourRangeId”: “MENS_SHIRTS”

},

“description”: “Button Down Collar Red”,

“deviceId”: “pos2@0001.enactor”,

“effectiveNetValue”: 2595,

“lineNumber”: 6,

“netValue”: 2595,

“value”: 2595,

“dateTimeCreated”: “2019-07-19T16:21:13.000+01:00”,

“userId”: “CUST_USER”,

“modifiersNetValue”: 0,

“modifiersEffectiveNetValue”: 0,

“modifiersVoidQuantity”: 0,

“modifiersQuantity”: 0,

“notDiscountable”: false,

“maxDiscount”: 0,

“handKeyed”: true,

“productID”: “DF517XM-1”,

“quantity”: 1,

“netQuantity”: 1,

“isReturn”: false,

“unitPrice”: 2595,

“sourceInventoryType”: “AVA”,

“orderable”: true,

“priceTypeId”: “R”,

“productTypeId”: “skuProduct”,

“productImageURL”: “image://PRODUCT/DF517XM-2.jpg”,

“type”: “VALUE”,

“mmGroupId”: “MENS_SHIRTS”,

“mmGroupHierarchyId”: “FASHION”,

“mmGroupVariantGroupId”: “All”,

“mmGroupVariantHierarchyId”: “All”,

“mmGroupDescription”: “Mens Shirts”,

“brandGroupId”: “INTERNAL”,

“brandGroupHierarchyId”: “FASHION”,

“sizeId”: {

“id”: “S”,

“sizeRangeId”: “MENS_SHIRTS”

}

}

],

“balance”: 16375,

“currencyId”: “GBP”,

“currencyDescription”: “Pounds Sterling”,

“taxInclusive”: true,

“taxSchemeId”: “UK”,

“itemCount”: 6,

“saleItemQuantity”: 5,

“returnItemQuantity”: 0,

“saleItemNetValue”: 16375,

“returnItemNetValue”: 0,

“merchandiseItemQuantity”: 5,

“merchandiseItemValue”: 16375,

“total”: 16375,

“grossTotal”: 16375,

“taxTotal”: 0,

“totalTaxAdjustment”: 0,

“preAuthBalance”: 0,

“effectiveSaleValue”: 16375

},

“basketReference”: “PRIMARY”,

“basketType”: “PRIMARY”,

“basketDescription”: “Primary”,

“basketStatus”: “IN_PROGRESS”

}

Associate a Basket with the Customer #

Service URL: PATCH /baskets/{basketReference}/customer

Tokens:

basketReference – The basket reference of the basket to add the items to, or can be ‘PRIMARY’ to add to the PRIMARY basket.

Parameters:

mergeRule – String – Determines how to behave if there is a merge conflict – Optional, defaults to ERROR

returnBasket – Boolean – If true the updated basket is returned – Optional, defaults to true

Response:

BasketResponse – The updated basket, if returnBasket is true

basket – IBasket – The basket associated with the given reference

basketReference – String – the reference of the basket

basketType – String – the type of the basket

basketDescription – String – the description of the basket

basketResponseCode – String – A specific basket code to indict whether the basket was implicitly created by the server.

basketStatus – String – the status of the basket. Fresh baskets have the status NEW. Baskets in progress have the status of IN_PROGRESS. Baskets will have been submitted to retail processing have the status SUBMITTED.

Remarks:

Updates the basket so it is associated with the customer using the accessToken to determine the customer id. Note that this does not set the ‘CustomerRetailDetails’ on the basket.

When the basket is associated with the customer this may result in a conflict:

i. If the basket is a primary basket, but the customer already has a primary basket, or

ii. If the basket is a wishlist and the customer already has a wishlist with the same name.

In these cases the following table determines how the system should behave, as controlled by the mergeRule parameter:

Merge Rule

Result

ERROR

Return an error and do not make any changes

MERGE

Copy items from the incoming basket into the existing basket. Return the existing basket and its reference. Discard the incoming basket.

OVERWRITE

Associate the incoming basket with the customer and overwrite any existing basket. Return the basket and its reference.

DISCARD

Discard the incoming basket. Return the existing basket and its reference.

Notes:

The service checks for an existing wishlist basket by looking for a stored basket with a basket type of WISHLIST, and matches the basket description of the incoming baskets.

Merge Rule Scenarios:

No Merge Rule:

Scenario

Outcome

Expected behaviour

Status Code

Response

1

Basket manager service recieves an associate basket customer request with no merge rule

Fail

Return an error and do not make any changes

500

ErrorMessage: Failed to associate basket with customer, outcome (500)

Error:

Scenario

Outcome

Expected behaviour

Status Code

Response

1

Basket manager service recieves an associate basket customer request with the merge Rule of ERROR.

Fail

Return an error and do not make any changes

500

ErrorMessage: Failed to associate basket with customer, outcome (500)

Merge:

All Scenarios start with: Basket manager service recieves an associate basket customer request with the merge Rule of MERGE.

Scenario

Outcome

Expected behaviour

Status Code

Response

1

The customer wants to associate a Primary basket (Annoymous primary basket).

Success

Copy items from the incoming basket into the existing basket. Return the existing basket and its reference. Discard the incoming basket.

200

Return the existing basket (BasketResponse)

2

The customer wants to associate a Wishlist basket. (Annoymous wishlist basket). The existing basket already exists.

Success

Copy items from the incoming basket into the existing basket. Return the existing basket and its reference. Discard the incoming basket.

200

Return the existing basket (BasketResponse)

3

The customer wants to associate a Wishlist basket. (Annoymous wishlist basket). The existing basket does not exists.

Success

Stored the incoming basket as a new basket against the customer. Return the existing basket and its reference. Discard the incoming basket.

200

Return the existing basket (BasketResponse)

4

The customer wants to associate a Wishlist basket which is already associated with a customer

NotAllowed

Return a NotAllowed error and do not make any changes

400: Bad Request

ErrorMessage: Failed to associate basket with customer. Basket already associated with customer, outcome (500)


Overwrite:

Scenario

Outcome

Expected behaviour

Status Code

Response

1

The customer wants to associate a Primary basket (Annoymous primary basket).

Success

Associate the incoming basket with the customer and overwrite any existing basket. Return the basket and its reference.

200

Return the existing basket (BasketResponse)

2

The customer wants to associate a Primary basket (Annoymous wishlist basket).

Success

Associate the incoming basket with the customer and overwrite any existing basket. Return the basket and its reference.

200

Return the existing basket (BasketResponse)

Discard:

All Scenarios start with: Basket manager service recieves an associate basket customer request with the merge Rule of DISCARD.

Scenario

Outcome

Expected behaviour

Status Code

Response

1

The customer wants discard the incoming wishlist basket.

Success

200

IBasketResponse: basket, basketReference…

2

The customer wants discard the incoming primary basket

Success

The incoming basket is discarded. Returns the customers existing primary basket and its reference.

200

IBasketResponse: basket, basketReference…

Update a basket’s description #

Service URL: PATCH /baskets/{basketReference}/description

Tokens:

basketReference – The basket reference of the basket to add the items to, or can be ‘PRIMARY’ to add to the PRIMARY basket.

Request:

UpdateBasketDescriptionRequest – extends BasketRetrievalRequest

  • description – String – the new description of the wishlist – max length 20

Parameters:

  • returnBasket – Boolean – Should the basket be returned in the request. (Optional, defaults to false)

Response:

BasketResponse

basket – IBasket – The basket associated with the given reference

basketReference – String – the reference of the basket

basketType – String – the type of the basket

basketDescription – String – the description of the basket

basketResponseCode – String – A specific basket code to indict whether the basket was implicitly created by the server.

basketStatus – String – the status of the basket. Fresh baskets have the status NEW. Baskets in progress have the status of IN_PROGRESS. Baskets will have been submitted to retail processing have the status SUBMITTED.

Remarks:

  • Updates an existing baskets description. The basket must already exist, otherwise, the service will return a 404 not found. If the description is empty in the request, the service should return 400 bad request. If the service call is successful, a 200 OK response is returned. However, if the returnBasket parameter is true, the basket is also returned in the response.

All Scenarios start with: Basket manager service receives an associate basket customer request with the merge Rule of DISCARD.

Scenario

Outcome

Expected behaviour

Status Code

Response

1

The Update Basket Service has received a valid request for a basket reference that exists.

Success

The baskets description is updated

200

200 OK Success

2

The Update Basket Service has received a valid request for a basket reference that exists with the flag returnBasket set to true

Success

The baskets description is updated.

200

BasketResponse

3

The Update Basket Service has received a valid request for a basket that does not exist.

NotFound

The baskets description is not updated. An error message is returned with a 404 response.

404

ErrorMessage:

Failed to update baskets description, outcome: NotFound

Example Request

 Expand source

PATCH /WebRestApi/rest/baskets/PRIMARY/description

Content-Type: application/json

{

“description”: “New Description”

}

Submit a basket #

Service URL: POST /baskets/{basketReference}/submit

Tokens:

basketReference – The basket reference of the basket to add the items to, or can be ‘PRIMARY’ to add to the PRIMARY basket.

Response

SubmitBasketResponse

orderId – String – the id of the order submitted

newBasketReference – String – the id of the new basket

Remarks

  • Submits a basket for transaction processing. Once submitted, a new transaction is created and stored. The new transaction is returned in the response. The id of the order submitted is also returned.

Scenarios

Scenario

Outcome

Expected behaviour

Status Code

Response

1

The submit basket service was given a valid basket reference to be submitted

Success

The basket was submitted successfully

200

SubmitBasketResponse

2

The submit basket service was given an invalid basket reference to be submitted

NotFound

The basket was not submitted. NotFound error response is returned.

404

ErrorMessage: Failed to submit basket, outcome: NotFound

3

The submit basket service was given a valid basket reference to be submitted but the basket could not be submitted

Fail

The basket was not submitted. Fail error response is returned.

ErrorMessage: Failed to submit basket, outcome: Fail

Example Request

 Expand source

http://localhost:8080/WebRestApi/rest/baskets/PRIMARY/submit

Example Response

 Expand source

200 OK

{

“orderId” : “00000033”,

“newBasketReference” : “A6U7KWLMYFCZ7CNFLAUE67HFKY”

}

Get Transction #

Service URL: GET /baskets/{basketReference}/transaction

Tokens:

basketReference – The basket reference of the basket to add the items to, or can be ‘PRIMARY’ to add to the PRIMARY basket.

Response:

TransactionResponse

transaction – ITransaction – returns the transaction of the basket

Remarks

Todo

Example Request

GET /WebRestApi/rest/baskets/PRIMARY/transaction

Host: localhost:8080

subject: 1

Example Response

Example Get Transaction Response  Expand source

{

“transaction”: {

“source”: “pos2@0001.enactor”,

“sourceApplication”: “POS”,

“topic”: “Transactions”,

“sequenceNumber”: 0,

“transactionId”: “00010002000571907191549452”,

“applicationId”: “WEB_REST_API”,

“transactionNumber”: 57,

“originatedBy”: {

“regionId”: {

“id”: “UK”,

“groupTypeId”: “region”,

“groupHierarchyId”: “All”

},

“branchNumber”: 1,

“terminalNumber”: 2,

“transactionNumber”: 57,

“userId”: {

“id”: “CUST_USER”

},

“deviceId”: {

“id”: “pos2@0001.enactor”

},

“locationId”: {

“id”: “0001”

}

},

“dateTimeCreated”: “2019-07-19T15:49:45.000+01:00”,

“basket”: {

“items”: [

{

“@type”: “styleColourSizeItem”,

“colourId”: {

“id”: “RED”,

“colourRangeId”: “MENS_SHOES”

},

“description”: “Vans Canvas Shoes”,

“deviceId”: “pos2@0001.enactor”,

“effectiveNetValue”: 59950,

“lineNumber”: 1,

“netValue”: 59950,

“value”: 59950,

“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”: 10,

“netQuantity”: 10,

“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”,

“modifiers”: [

{

“@type”: “quantityModifier”,

“modifierItemLine”: 2,

“newQuantity”: 6,

“originalQuantity”: 1

},

{

“@type”: “quantityModifier”,

“modifierItemLine”: 3,

“newQuantity”: 4,

“originalQuantity”: 6

},

{

“@type”: “quantityModifier”,

“modifierItemLine”: 4,

“newQuantity”: 10,

“originalQuantity”: 4

},

{

“@type”: “quantityModifier”,

“modifierItemLine”: 5,

“newQuantity”: 10,

“originalQuantity”: 10

}

],

“sizeId”: {

“id”: “8”,

“sizeRangeId”: “MENS_SHOES”

}

},

{

“@type”: “quantityModifierItem”,

“description”: “Modify Quantity”,

“deviceId”: “pos2@0001.enactor”,

“lineNumber”: 2,

“dateTimeCreated”: “2019-07-19T16:00:33.000+01:00”,

“userId”: “CUST_USER”,

“type”: “QUANTITY”,

“newQuantity”: 6

},

{

“@type”: “quantityModifierItem”,

“description”: “Modify Quantity”,

“deviceId”: “pos2@0001.enactor”,

“lineNumber”: 3,

“dateTimeCreated”: “2019-07-19T16:00:58.000+01:00”,

“userId”: “CUST_USER”,

“type”: “QUANTITY”,

“newQuantity”: 4

},

{

“@type”: “quantityModifierItem”,

“description”: “Modify Quantity”,

“deviceId”: “pos2@0001.enactor”,

“lineNumber”: 4,

“dateTimeCreated”: “2019-07-19T16:03:48.000+01:00”,

“userId”: “CUST_USER”,

“type”: “QUANTITY”,

“newQuantity”: 10

},

{

“@type”: “quantityModifierItem”,

“description”: “Modify Quantity”,

“deviceId”: “pos2@0001.enactor”,

“lineNumber”: 5,

“dateTimeCreated”: “2019-07-19T16:07:04.000+01:00”,

“userId”: “CUST_USER”,

“type”: “QUANTITY”,

“newQuantity”: 10

}

],

“balance”: 59950,

“currencyId”: “GBP”,

“currencyDescription”: “Pounds Sterling”,

“taxInclusive”: true,

“taxSchemeId”: “UK”,

“itemCount”: 5,

“saleItemQuantity”: 10,

“returnItemQuantity”: 0,

“saleItemNetValue”: 59950,

“returnItemNetValue”: 0,

“merchandiseItemQuantity”: 10,

“merchandiseItemValue”: 59950,

“total”: 59950,

“grossTotal”: 59950,

“taxTotal”: 0,

“totalTaxAdjustment”: 0,

“preAuthBalance”: 0,

“effectiveSaleValue”: 59950

},

“loyaltyPointsDetails”: {

“dayNumber”: 0,

“loyaltyPointsBalance”: 0,

“loyaltyPointsEarned”: 0,

“promotionalLoyaltyPointsEarned”: 0,

“loyaltyPointsMissed”: 0,

“loyaltyPointsRate”: 0,

“loyaltyAccountOffline”: true,

“loyaltyPointsUsed”: 0,

“totalSpend”: 0,

“spendToNextTier”: 0,

“externalProvider”: false,

“noLoyaltyUpdate”: false,

“rewardValue”: 0,

“rewardValueRedeemed”: 0

}

}

}

Go to Top