Loyalty programs and cards 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 Cart service provider contains the following methods for interacting with cart data.
GetLoyaltyProgram method
The GetLoyaltyProgram method is used to query for a specific loyal program against the external commerce system.
|
Name: |
GetLoyaltyProgram |
|
Description: |
Gets the loyalty program that matches the specified criteria. Calls the |
|
Usage: |
Called when a specific loyalty program is needed. Examples include:
|
|
Signature: |
GetLoyaltyProgramResult GetLoyaltyProgram([NotNull]GetLoyaltyProgramRequest request) |
|
Input: | |
|
UserId - Optional - The IDs of the users whose carts should be retrieved. If no value is specified, the user IDs are not considered when retrieving carts. | |
|
ProgramId – The ID of the program you need returned. | |
|
ShopName – Optional. Name of shop to search for carts in. | |
|
Output: | |
|
LoyaltyProgram – The requested loyalty program. The object represents the program that matches the criteria specified in the request. | |
|
SystemMessages - Collection of messages from the external system. |
Usage example:
var loyaltyProgramService = new LoyaltyProgramServiceProvider();
var request = new GetLoyaltyProgramRequest("myShop", "John");
var result = loyaltyProgramService.GetLoyaltyProgram(request);GetLoyaltyPrograms method
The GetLoyaltyPrograms method is used to query for lists of loyalty programs against the external commerce system.
|
Name: |
GetLoyaltyPrograms |
|
Description: |
Gets the loyalty programs that match the specified criteria. Calls the |
|
Usage: |
Called when a list of loyalty programs is needed. Examples include:
|
|
Signature: |
GetLoyaltyProgramsResult GetLoyaltyPrograms([NotNull]GetLoyaltyProgramsRequest request) |
|
Input: | |
|
UserId – Optional - The IDs of the users whose associated programs you need returned. | |
|
ShopName – Name of shop to search for carts in | |
|
Output: | |
|
ReadOnlyCollection<LoyaltyProgramSummary> – A collection of LoyaltyProgramSummary objects The lists represent the programs that match the criteria specified in the request. | |
|
SystemMessages - Collection of messages from the external system. |
Usage example:
var loyaltyProgramService = new LoyaltyProgramServiceProvider();
var request = new GetLoyaltyProgramsRequest("myShop", "John");
var result = loyaltyProgramService.GetLoyaltyPrograms(request);GetLoyaltyProgramStatus method
GetCarts is used to query cart data against the external commerce system and does not return a collection of Carts, but a collection of CartBase objects that only contains the summary of the main cart data.
|
Name: |
GetLoyaltyProgramStatus |
|
Description: |
Gets the status of a loyalty card against all or a specific program. Calls the |
|
Usage: |
Called when the loyalty card program status is needed. Examples include:
|
|
Signature: |
GetLoyaltyProgramStatusResult GetLoyaltyProgramStatus([NotNull]GetLoyaltyProgramStatusRequest request) |
|
Input: | |
|
LoyaltyCard–The loyalty card to check for the status against. | |
|
ProgramIds – Optional – An optional list of program IDs to check for status against. | |
|
Output: | |
|
ReadOnlyCollection<LoyaltyProgramStatus> – A collection of statuses against specific programs. | |
|
SystemMessages - Collection of messages from the external system. |
Usage example:
var loyaltyProgramService = new LoyaltyProgramServiceProvider();
var loyaltyCard = new LoyaltyCard
{
CardNumber = "1234567890",
CustomerId = "John",
ProgramIds = new List<string>(new List<string> {"ProgamId1"})
};
var request = new GetLoyaltyProgramStatusRequest(loyaltyCard);
var result = loyaltyProgramService.GetLoyaltyProgramStatus(request);JoinLoyaltyProgram method
The JoinLoyaltyProgram method is used to add a user to a loyalty program in the external commerce system.
|
Name: |
JoinLoyaltyProgram |
|
Description: |
Joins a user to the loyalty program in the specified criteria. Calls the |
|
Usage: |
Called when a user needs to join a loyalty program. Examples include:
|
|
Signature: |
JoinLoyaltyProgramResult JoinLoyaltyProgram([NotNull]JoinLoyaltyProgramRequest request) |
|
Input: | |
|
UserId - The ID of the user who needs to join the program. | |
|
ShopName –The shop the user is registering for the program in. | |
|
ProgramId – Optional. The program to add the user to. | |
|
Output: | |
|
LoyaltyCard – The loyalty card created in the program. | |
|
SystemMessages - Collection of messages from the external system. |
Usage example:
var loyaltyProgramService = new LoyaltyProgramServiceProvider();
var request = new JoinLoyaltyProgramRequest("Rob", "webShop");
var result = loyaltyProgramService.JoinLoyaltyProgram(request);
var loyaltyCard = result.LoyaltyCard;GetLoyaltyCards method
The GetLoyaltyCards method is used to return a collection of the loyalty cards.
|
Name: |
GetLoyaltyCards |
|
Description: |
Gets the loyalty cards that match the specified criteria. Calls the |
|
Usage: |
Called when a list of loyalty cards or one loyalty card is needed. Examples include:
|
|
Signature: |
GetLoyaltyCardsResult GetLoyaltyCards([NotNull]GetLoyaltyCardsRequest request) |
|
Input: | |
|
UserId- The ID of the user whose card(s) should be retrieved. | |
|
ShopName - Name of shop to search for cards in. | |
|
CardId – Optional - The ID of a card if you are looking for specific one. | |
|
Output: | |
|
ReadOnlyCollection<LoyaltyCard> – The cards found that match the specified criteria. | |
|
SystemMessages - Collection of messages from the external system. |
Usage example:
var loyaltyProgramService = new LoyaltyProgramServiceProvider();
var request = new GetLoyaltyCardsRequest("Rob", "WebShop");
var result = loyaltyProgramService.GetLoyaltyCards(request);GetLoyaltyCardTransactions method
The GetLoyaltyCardTransactions method returns a list of transaction for a specific card.
|
Name: |
GetLoyaltyCardTransactions |
|
Description: |
Gets the list of transactions that match the specified criteria. Calls the |
|
Usage: |
Called when a list of transactions for a card is needed. |
|
Signature: |
GetLoyaltyCardTransactionsResult GetLoyaltyCardTransactions([NotNull]GetLoyaltyCardTransactionsRequest request) |
|
Input: | |
|
LoyaltyCard–The loyalty card to retrieve transactions for. | |
|
Output: | |
|
ReadOnlyCollection<LoyaltyCardTransaction> – A collection of transactions for the card. | |
|
SystemMessages - Collection of messages from the external system. |
Usage example:
var loyaltyProgramService = new LoyaltyProgramServiceProvider();
var loyaltyCard = new LoyaltyCard
{
CardNumber = "1234567890",
CustomerId = "Mike",
ProgramIds = new List<string> {"ProgamId1"}
};
var request = new GetLoyaltyCardTransactionsRequest(loyaltyCard);
var result = loyaltyProgramService.GetLoyaltyCardTransactions(request);