Wish lists service provider
Service providers are wrapper objects designed to make it easier to interact with Connect pipelines. The providers implement no logic other than calling Connect pipelines. All of the business logic is implemented in the pipeline processors.
For each method in the provider there is a corresponding Request and Result object used, for example, GetCarts takes a GetCartsRequest object and returns a GetCartsResult object. In some cases the response objects are re-used when returning the same data.
Customized versions of the default request and result arguments can be used by calling the overloaded generics-based versions of the methods.
The wish list service provider contains the following methods for interacting with cart data.
CreateWishList method
The CreateWishList method is used to query create a wish list in the external commerce system and returns the newly created WishList object.
|
Name: |
CreateWishList |
|
Description: |
Creates a wish list that matches the specified criteria. Calls the |
|
Usage: |
Called when creating a new wish list. Examples include:
|
|
Signature: |
CreateWishListResult CreateWishList([NotNull]CreateWishListRequest request) |
|
Input: | |
|
UserId –The ID of the user to create the cart for. | |
|
WishListName – The friendly name to assign to the wish list. | |
|
ShopName –The name of the shop the wish list is being created in. | |
|
Output: | |
|
WishList – The newly created wish list. | |
|
SystemMessages - Collection of messages from the external system. |
Usage example:
var wishListService = new WishListServiceProvider();
var request = new CreateWishListRequest("Bob", "Bobs wish list", "webShop");
var result = wishListService.CreateWishList(request);DeleteWishList method
The DeleteWishList method is used to query delete a wish list in the external commerce system and returns the deleted wish list object.
|
Name: |
DeleteWishList |
|
Description: |
Deletes a wish list that matches the specified criteria. Calls the |
|
Usage: |
Called when a wish list needs to be deleted. Examples include:
|
|
Signature: |
DeleteWishListResult DeleteWishList([NotNull]DeleteWishListRequest request) |
|
Input: | |
|
WishList - The wish list to delete from the ecommerce system. | |
|
Output: | |
|
WishList – The deleted wish list. | |
|
SystemMessages - Collection of messages from the external system. |
Usage example:
var wishListService = new WishListServiceProvider();
var createRequest = new CreateWishListRequest("Bob", "Bob's wish list", "webShop");
var wishList = wishListService.CreateWishList(createRequest).WishList;
var deleteRequest = new DeleteWishListRequest(wishList);
var result = wishListService.DeleteWishList(deleteRequest); EmailWishLists method
The EmailWishLists method is used to raise a page event when a user tries to send a wish list in an email message.
|
Name: |
EmailWishLists |
|
Description: |
Sends email messages with some wish lists based on the specified criteria. Calls the |
|
Usage: |
Called wish lists to send in an email message. |
|
Signature: |
EmailWishListsResult EmailWishLists([NotNull] EmailWishListsRequest request) |
|
Input: | |
|
IEnumerable<WishList> -The wish lists to send in an email message. | |
|
Output: | |
|
IEnumerable<WishList> – The wish lists that were sent in an email message. | |
|
SystemMessages - Collection of messages from the external system. |
Usage example:
var wishListService = new WishListServiceProvider();
var line = new WishListLine
{
Product = new Entities.Carts.CartProduct
{
ProductId = "Product1",
Price = new Entities.Prices.Price((decimal)22.99, "USD")
},
Quantity = 1
};
var wishList = new WishList
{
CustomerId = "Bob",
Name = "Bob's wish list",
ShopName = "webShop",
Lines = new List<WishListLine>() {line}.AsReadOnly()
};
var wishLists = new Collection<WishList> { wishList };
var request = new EmailWishListsRequest(wishLists);
var result = wishListService.EmailWishLists(request);GetWishList method
The GetWishList method is used to query wish list data against the external commerce system and returns a single wish list.
|
Name: |
GetWishList |
|
Description: |
Gets the wish list that matches the specified criteria. Calls the |
|
Usage: |
Called when a wish list is needed. Examples include:
|
|
Signature: |
GetWishListResult GetWishList([NotNull]GetWishListRequest request) |
|
Input: | |
|
UserId –The ID of the user who owns the wish list. | |
|
WishListId – The ID of the wish list being searched for. | |
|
ShopName – The name of the store containing the wish list. | |
|
Output: | |
|
WishList – The wish list found based on the search criteria. | |
|
SystemMessages - Collection of messages from the external system. |
Usage example:
var wishListService = new WishListServiceProvider();
var createRequest = new CreateWishListRequest("Bob", "Bob's wish list", "webShop");
var wishList = wishListService.CreateWishList(createRequest).WishList;
var request = new GetWishListRequest("Bob", wishList.ExternalId, "webShop");
var result = wishListService.GetWishList(request);
Assert.AreEqual(wishList.Name, result.WishList.Name, "Names should be the same");GetWishLists method
The GetWishLists method is used to query wish list data against the external commerce system and returns a collection wish list.
|
Name: |
GetWishLists |
|
Description: |
Gets the wish lists that match the specified criteria. Calls the |
|
Usage: |
Called when all of the wish lists for a user are needed. |
|
Signature: |
GetWishListsResult GetWishLists([NotNull]GetWishListsRequest request) |
|
Input: | |
|
UserId – The ID of the user to search for. | |
|
ShopName – The store containing the wish lists. | |
|
Output: | |
|
ReadOnlyCollection<WishListHeader>– WishListHeader objects for all of the wish lists found. | |
|
SystemMessages - Collection of messages from the external system. |
Usage example:
var wishListService = new WishListServiceProvider();
var request = new GetWishListsRequest("Bob", "webShop");
var result = wishListService.GetWishLists(request);UpdateWishList method
The UpdateWishList method is used to update wish list data in the external commerce system and returns the updated wish list object.
|
Name: |
UpdateWishList |
|
Description: |
Updates the specified wish list. Calls the |
|
Usage: |
Called when a wish list needs to be updated. |
|
Signature: |
GetCartsResult GetCarts(GetCartsRequest request) |
|
Input: | |
|
WishList –The wish list to update. | |
|
Output: | |
|
WishList – The updated wish list. | |
|
SystemMessages - Collection of messages from the external system. |
Usage example:
var wishListService = new WishListServiceProvider();
var createRequest = new CreateWishListRequest("Bob", "Bob's wish list", "webShop");
var wishList = wishListService.CreateWishList(createRequest).WishList;
wishList.IsFavorite = true;
var request = new UpdateWishListRequest(wishList);
var result = wishListService.UpdateWishList(request);AddLinesToWishList method
The AddLinesToWishList method is used to add line items to a wish list in the external commerce system and returns the updated wish list and added line items.
|
Name: |
AddLinesToWishList |
|
Description: |
Adds the specified line items to the wish list. Calls the |
|
Usage: |
Called when line items need to be added to wish list. |
|
Signature: |
AddLinesToWishListResult AddLinesToWishList([NotNull]AddLinesToWishListRequest request) |
|
Input: | |
|
WishList - The wish list to add line items to. | |
|
IEnumerable<WishListLine> – The line items to add to the wish list. | |
|
Output: | |
|
WishList – The updated wish list object. ReadOnlyCollection<WishListLine> - The line items added to the wish list. | |
|
SystemMessages - Collection of messages from the external system. |
Usage example:
var wishListService = new WishListServiceProvider();
var createRequest = new CreateWishListRequest("Bob", "Bob's wish list", "webShop");
var wishList = wishListService.CreateWishList(createRequest).WishList;
var line = new WishListLine
{
Product = new Entities.Carts.CartProduct
{
ProductId = "Product1",
Price = new Entities.Prices.Price((decimal)22.99, "USD")
},
Quantity = 1
};
var lines = new List<WishListLine> {line}.AsReadOnly();
var request = new AddLinesToWishListRequest(wishList, lines);
var result = wishListService.AddLinesToWishList(request);RemoveWishListLines method
The RemoveWishListLines method is used to remove some specific line items from a wish list, and return the updated wish list.
|
Name: |
RemoveWishListLines |
|
Description: |
Removes line items from a wish list that match the specified criteria. Calls the |
|
Usage: |
Called when a line items need to be removed from a wish list. |
|
Signature: |
RemoveWishListLinesResult RemoveWishListLines([NotNull]RemoveWishListLinesRequest request) |
|
Input: | |
|
WishList–The wish list requiring the items to be removed. | |
|
IEnumerable<string> – The IDs of the line items to remove. | |
|
Output: | |
|
WishList – The wish list with the line items removed. ReadOnlyCollection<WishListLine> – The line items that were removed from the wish list. | |
|
SystemMessages - Collection of messages from the external system. |
Usage example:
var wishListService = new WishListServiceProvider();
var createRequest = new CreateWishListRequest("Bob", "Bob's wish list", "webShop");
var wishList = wishListService.CreateWishList(createRequest).WishList;
var line = new WishListLine
{
Product = new Entities.Carts.CartProduct
{
ProductId = "Product1",
Price = new Entities.Prices.Price((decimal)22.99, "USD")
},
Quantity = 1
};
var line2 = new WishListLine
{
Product = new Entities.Carts.CartProduct
{
ProductId = "Product2",
Price = new Entities.Prices.Price((decimal)33.77, "USD")
},
Quantity = 2
};
var lines = new List<WishListLine> { line, line2 };
var addLinesRequest = new AddLinesToWishListRequest(wishList, lines);
wishList = wishListService.AddLinesToWishList(addLinesRequest).WishList;
var request = new RemoveWishListLinesRequest(wishList, new List<string> { wishList.Lines[0].ExternalId });
var result = wishListService.RemoveWishListLines(request);UpdateWishListLines method
The UpdateWishListLines method is used to update line items in a wish list in an external commerce system and returns the updated wish list and line items added to it.
|
Name: |
UpdateWishListLines |
|
Description: |
Updates specific line items on a wish list. Calls the |
|
Usage: |
Called when some line items on a wish list need to be updated. |
|
Signature: |
UpdateWishListLinesResult UpdateWishListLines([NotNull]UpdateWishListLinesRequest request) |
|
Input: | |
|
WishList –The wish list that contains the line items that need to be updated. | |
|
IEnumerable<WishListLine> – The wish list items to update. | |
|
Output: | |
|
WishList – The updated wish list. ReadOnlyCollection<WishListLine> – The wish list items that were updated. | |
|
SystemMessages - Collection of messages from the external system. |
Usage example:
var wishListService = new WishListServiceProvider();
var createRequest = new CreateWishListRequest("Bob", "Bob's wish list", "webShop");
var wishList = wishListService.CreateWishList(createRequest).WishList;
var line = new WishListLine
{
Product = new Entities.Carts.CartProduct
{
ProductId = "Product1",
Price = new Entities.Prices.Price((decimal)22.99, "USD")
},
Quantity = 1
};
var lines = new List<WishListLine> { line };
var addLinesRequest = new AddLinesToWishListRequest(wishList, lines);
wishList = wishListService.AddLinesToWishList(addLinesRequest).WishList;
line = new WishListLine
{
Product = new Entities.Carts.CartProduct
{
ProductId = "Product2",
Price = new Entities.Prices.Price((decimal)33.77, "USD")
},
Quantity = 2
};
lines = wishList.Lines.ToList();
lines.Add(line);
var request = new UpdateWishListLinesRequest(wishList, lines);
var result = wishListService.UpdateWishListLines(request);PrintWishList method
The PrintWishList method is used to raise a page event when a user tries to print a wish list.
|
Name: |
PrintWishList |
|
Description: |
Gets the wish list that matches the specified criteria. Calls the |
|
Usage: |
Called when a copy of the wish list is needed for printing. |
|
Signature: |
PrintWishListResult PrintWishList([NotNull] PrintWishListRequest request) |
|
Input: | |
|
WishList – The wish list required for printing. | |
|
Output: | |
|
WishList – The wish list for printing | |
|
SystemMessages - Collection of messages from the external system. |
Usage example:
var wishListService = new WishListServiceProvider();
var line = new WishListLine
{
Product = new Entities.Carts.CartProduct
{
ProductId = "Product1",
Price = new Entities.Prices.Price((decimal)22.99, "USD")
},
Quantity = 1
};
var wishList = new WishList
{
CustomerId = "Bob",
Name = "Bob's wish list",
ShopName = "webShop",
Lines = new List<WishListLine>() { line }.AsReadOnly()
};
var request = new PrintWishListRequest(wishList);
var result = wishListService.PrintWishList(request);