Customer service methods
Service providers are wrapper objects designed to make it easier to interact with Connect pipelines. The providers implement no logic other than calling pipelines. All of the business logic is implemented in the pipeline processors.
For each method there is a corresponding Request and Result object returned, for example, CreateUser takes a CreateUserRequest object and returns a CreateUserResult object.
The Customer service provider contains the following methods for interacting with customer and user data.
CreateUser method
|
Name: |
CreateUser |
|
Description: |
Creates a user account by which the user can re-authenticate themselves upon return. By default the account is disabled until it has be confirmed by the visitor to be a valid request and Calls the |
|
Usage: |
Called from Sitecore when a visitor is registering for an account. It could be during the checkout process or through plain signup. |
|
Signature: |
|
|
Input: | |
|
Username – string. Mandatory The user name for the new user. | |
|
Email – string. Mandatory The e-mail address for the new user. | |
|
Password – string. Mandatory The password for the new user. | |
|
Shops– Mandatory An instance of the CommerceUser object is parsed in. Mandatory fields: Username, Email, Shops. | |
|
Output: | |
|
User – An instance of the user object is returned. The user object is updated by the external commerce system by supplying the External ID value. | |
|
SystemMessages - Collection of messages from the external system. |
Usage example:
var customerService = new CustomerServiceProvider();
var request = new CreateUserRequest("JohnSmith", "password", "[email protected]", "webstore");
var result = customerService.CreateUser(request);UpdateUser method
|
Name: |
UpdateUser |
|
Description: |
Updates an existing user account. Calls the |
|
Usage: |
Called from Sitecore when a visitor wants to update the information stored on the account. |
|
Signature: |
|
|
Input: | |
|
CommerceUser – An instance of the modified CommerceUser object is passed in. | |
|
Output: | |
|
User – An instance of the user object is returned. | |
|
SystemMessages - Collection of messages from the external system. |
Usage example:
var customerService = new CustomerServiceProvider();
// create a user
var request = new CreateUserRequest("JohnSmith", "password", "[email protected]", "webstore");
var user = customerService.CreateUser(request).CommerceUser;
user.FirstName = "John";
// update the user
var updateRequest = new UpdateUserRequest(user);
var result = customerService.UpdateUser(updateRequest);DeleteUser method
|
Name: |
DeleteUser |
|
Description: |
Deletes a user account. Calls the |
|
Usage: |
Called from Sitecore when the shop owner wants to delete an account. It is a solution business decision whether the account is actually deleted or simply disabled. |
|
Signature: |
|
|
Input: | |
|
CommerceUser – An instance of the CommerceUser object is parsed in | |
|
Output: | |
|
SystemMessages - Collection of messages from the external system. |
Usage example:
var customerService = new CustomerServiceProvider();
// create a user
var request = new CreateUserRequest("JohnSmith", "password", "[email protected]", "webstore");
var user = customerService.CreateUser(request).CommerceUser;
// delete the user
var deleteRequest = new DeleteUserRequest(user);
var result = customerService.DeleteUser(deleteRequest);DisableUser method
|
Name: |
DisableUser |
|
Description: |
Disables a user account. Calls the |
|
Usage: |
Called from Sitecore when the user account should be disabled. |
|
Signature: |
|
|
Input: | |
|
CommerceUser – Mandatory An instance of the user object is parsed in. | |
|
Comment – Optional An optional string that can explain why the user account was disabled. Will be put in the Page Event as an explanation. | |
|
Output: | |
|
CommerceUser – The disabled CommerceUser entity. | |
|
SystemMessages - Collection of messages from the external system. |
Usage example:
var customerService = new CustomerServiceProvider();
// create a user
var request = new CreateUserRequest("JohnSmith", "password", "[email protected]", "webstore");
var user = customerService.CreateUser(request).CommerceUser;
// disable the user
var disableRequest = new DisableUserRequest(user);
var disableResult = customerService.DisableUser(disableRequest);
// enable the user
var enableRequest = new EnableUserRequest(user);
var enableResult = customerService.EnableUser(enableRequest);EnableUser method
|
Name: |
EnableUser |
|
Description: |
Enables a user account. Calls the A user account can be disabled for different reasons and triggered by the shop owner or visitor. When a user account is disabled it must be possible to enable it again, which is the purpose of this method. The method seems similar to the The |
|
Usage: |
Called from Sitecore when the user account should be enabled. |
|
Signature: |
|
|
Input: | |
|
CommerceUser – Mandatory An instance of the user object is parsed in. | |
|
Comment – Optional An optional string that can explain why the user account was enabled. Will be put in the Page Event as an explanation. | |
|
Output: | |
|
CommerceUser – The enabled CommerceUser entity. | |
|
SystemMessages - Collection of messages from the external system. |
Usage example:
var customerService = new CustomerServiceProvider();
// create a user
var request = new CreateUserRequest("JohnSmith", "password", "[email protected]", "webstore");
var user = customerService.CreateUser(request).CommerceUser;
// disable the user
var disableRequest = new DisableUserRequest(user);
var disableResult = customerService.DisableUser(disableRequest);
// enable the user
var enableRequest = new EnableUserRequest(user);
var enableResult = customerService.EnableUser(enableRequest);GetUser method
|
Name: |
GetUser |
|
Description: |
Returns a single user account. Calls the |
|
Usage: |
Called from Sitecore when searching for one or more accounts. |
|
Signature: |
|
|
Input: | |
|
ShopName – Mandatory. | |
|
UserName – Mandatory. The ID of the user to retrieve. | |
|
Output: | |
|
User – A single instance of a User. | |
|
SystemMessages - Collection of messages from the external system. |
Usage example:
var customerService = new CustomerServiceProvider();
// create a user
var request = new CreateUserRequest("JohnSmith", "password", "[email protected]", "webstore");
var user = customerService.CreateUser(request).CommerceUser;
var getRequest = new GetUserRequest("JohnSmith");
var result = customerService.GetUser(getRequest);GetUsers method
|
Name: |
GetUsers |
|
Description: |
Queries and returns user accounts. Calls the Different input parameters can be provided and they will be combined using logical and. |
|
Usage: |
Called from Sitecore when searching for one or more accounts. |
|
Signature: |
|
|
Input: | |
|
ExternalIDs – Optional. Can be a single or a list of IDs. When provided, it takes precedence. | |
|
SitecoreIDs – Optional. Can be a single or a list of IDs. | |
|
UserName – Optional. | |
|
Email – Optional. | |
|
ExternalCustomerIDs – Optional. Can be a single or a list of IDs. Used when looking for users associated with a given customer. | |
|
Disabled - Optional. | |
|
ShopName – Optional. | |
|
Output: | |
|
List<User> | |
|
SystemMessages - Collection of messages from the external system. |
Usage example:
var customerService = new CustomerServiceProvider();
// create some users
var request = new CreateUserRequest("JohnSmith", "password", "[email protected]", "webstore");
var result = customerService.CreateUser(request);
request = new CreateUserRequest("JaneSmith", "passWord", "[email protected]", "webstore");
result = customerService.CreateUser(request);
request = new CreateUserRequest("Rob", "abcdefghij", "[email protected]", "webstore");
result = customerService.CreateUser(request);
var getRequest = new GetUsersRequest(new UserSearchCriteria { ShopName = "webstore" });
var getResult = customerService.GetUsers(getRequest);
Sitecore.Diagnostics.Assert.AreEqual(3, getResult.CommerceUsers.Count, "should have a count of 3");
getRequest = new GetUsersRequest(new UserSearchCriteria { UserName = "JohnSmith" });
getResult = customerService.GetUsers(getRequest);
Sitecore.Diagnostics.Assert.AreEqual(1, getResult.CommerceUsers.Count, "should have a count of 1");AddUsers method
|
Name: |
AddUsers |
|
Description: |
Add a user to a customer. Calls the |
|
Usage: |
Called to associate a user to a visitor. |
|
Signature: |
|
|
Input: | |
|
List<string> UserIds – The user IDs to add to the customer. | |
|
Output: | |
|
IReadOnlyCollection<string> UserIds – The list of user IDs associated with the customer. | |
|
SystemMessages - Collection of messages from the external system. |
Usage example:
var customerService = new CustomerServiceProvider();
// create a user
var request = new CreateUserRequest("JohnSmith", "password", "[email protected]", "webstore");
var user = customerService.CreateUser(request).CommerceUser;
// create a customer
var customer = customerService.CreateCustomer(new CreateCustomerRequest(
new CommerceCustomer
{
Name = "Jeff",
Shops = new[] { "autohaus" },
ExternalId = "1234567890"
})).CommerceCustomer;
// add the user to the customer
var addRequest = new AddUsersRequest(customer, new List<string> { user.ExternalId });
var addResult = customerService.AddUsers(addRequest);RemoveUsers method
|
Name: |
RemoveUsers |
|
Description: |
Removes users from a customer. Calls the |
|
Usage: |
Called to remove an associated user to a visitor. |
|
Signature: |
|
|
Input: | |
|
List<string> UserIds – The user IDs to remove from the customer. | |
|
Output: | |
|
IReadOnlyCollection<string> UserIds – The list of user IDs associated with the customer. | |
|
SystemMessages - Collection of messages from the external system. |
Usage example:
var customerService = new CustomerServiceProvider();
// create 2 users
var request = new CreateUserRequest("JohnSmith", "password", "[email protected]", "webstore");
var user = customerService.CreateUser(request).CommerceUser;
request = new CreateUserRequest("JaneSmith", "passWord", "[email protected]", "webstore");
var user2 = customerService.CreateUser(request).CommerceUser;
// create a customer
var customer = customerService.CreateCustomer(new CreateCustomerRequest(
new CommerceCustomer
{
Name = "Jeff",
Shops = new[] { "autohaus" },
ExternalId = "1234567890"
})).CommerceCustomer;
// add the users to the customer
var addRequest = new AddUsersRequest(customer, new List<string> { user.ExternalId, user2.ExternalId });
var addResult = customerService.AddUsers(addRequest);
// remove a user
var removeRequest = new RemoveUsersRequest(customer, new List<string> { user.ExternalId });
var removeResult = customerService.RemoveUsers(removeRequest);CreateCustomer method
|
Name: |
CreateCustomer |
|
Description: |
Creates a customer. Calls the |
|
Usage: |
Typically called when a visitor is going through the checkout process. |
|
Signature: |
|
|
Input: | |
|
CommerceCustomer – Mandatory An instance of the CommerceCustomer object is parsed in. Mandatory field values are: Name and Shops. | |
|
Output: | |
|
CommerceCustomer – An instance of the customer object is returned. The customer object is updated by the external commerce system by supplying the External ID. | |
|
SystemMessages - Collection of messages from the external system. |
Usage example:
var customerService = new CustomerServiceProvider();
customerService.CreateCustomer(new CreateCustomerRequest(
new CommerceCustomer
{
Name = "Jeff",
Shops = new[] { "autohaus" },
IsDisabled = true,
ExternalId = "Jeff",
Users = new[] { "Jeff" }
}));
customerService.CreateCustomer(new CreateCustomerRequest(
new CommerceCustomer
{
Name = "Bob",
Shops = new[] { "webstore" },
IsDisabled = false,
ExternalId = "Jeff",
Users = new[] { "Bob" }
}));UpdateCustomer method
|
Name: |
UpdateCustomer |
|
Description: |
Updates an existing customer account. Calls the |
|
Usage: |
Called from Sitecore when a visitor or shop owner wants to update the information stored on the customer account. |
|
Signature: |
|
|
Input: | |
|
CommerceCustomer – An instance of the modified CommerceCustomer object is parsed in. | |
|
Output: | |
|
CommerceCustomer – An instance of the customer object is returned. | |
|
SystemMessages - Collection of messages from the external system. |
Usage example:
var customerService = new CustomerServiceProvider();
customerService.CreateCustomer(new CreateCustomerRequest(
new CommerceCustomer
{
Name = "Jeff",
Shops = new[] { "autohaus" },
IsDisabled = true,
ExternalId = "Jeff",
Users = new[] { "Jeff" }
}));
var customer = customerService.CreateCustomer(new CreateCustomerRequest(
new CommerceCustomer
{
Name = "Bob",
Shops = new[] { "webstore" },
IsDisabled = false,
ExternalId = "Jeff",
Users = new[] { "Bob" }
})).CommerceCustomer;
customer.IsDisabled = true;
customer.Name = "Bobby";
var request = new UpdateCustomerRequest(customer);
var result = customerService.UpdateCustomer(request);DisableCustomer method
|
Name: |
DisableCustomer |
|
Description: |
Disables a customer account. Calls the |
|
Usage: |
Called from Sitecore when the customer account should be disabled. |
|
Signature: |
|
|
Input: | |
|
CommerceCustomer – Mandatory An instance of the customer object is parsed in. | |
|
Comment – Optional An optional string that can explain why the user account was disabled. Will be put in the Page Event as an explanation. | |
|
Output: | |
|
CommerceCustomer – The disabled customer. | |
|
SystemMessages - Collection of messages from the external system. |
Usage example:
var customerService = new CustomerServiceProvider();
var customer = customerService.CreateCustomer(new CreateCustomerRequest(
new CommerceCustomer
{
Name = "Bob",
Shops = new[] { "webstore" },
IsDisabled = false,
ExternalId = "Jeff",
Users = new[] { "Bob" }
})).CommerceCustomer;
var disableRequest = new DisableCustomerRequest(customer);
var disableResult = customerService.DisableCustomer(disableRequest);
var enableRequest = new EnableCustomerRequest(customer);
var enableResult = customerService.EnableCustomer(enableRequest);EnableCustomer method
|
Name: |
EnableCustomer |
|
Description: |
Enables a customer account. Calls the |
|
Usage: |
Called from Sitecore when the customer account should be enabled. |
|
Signature: |
|
|
Input: | |
|
CommerceCustomer – Mandatory An instance of the customer object is parsed in. | |
|
Comment – Optional An optional string that can explain why the user account was enabled. Will be put in the Page Event as an explanation. | |
|
Output: | |
|
SystemMessages - Collection of messages from the external system. |
Usage example:
var customerService = new CustomerServiceProvider();
var customer = customerService.CreateCustomer(new CreateCustomerRequest(
new CommerceCustomer
{
Name = "Bob",
Shops = new[] { "webstore" },
IsDisabled = false,
ExternalId = "Jeff",
Users = new[] { "Bob" }
})).CommerceCustomer;
var disableRequest = new DisableCustomerRequest(customer);
var disableResult = customerService.DisableCustomer(disableRequest);
var enableRequest = new EnableCustomerRequest(customer);
var enableResult = customerService.EnableCustomer(enableRequest);DeleteCustomer method
|
Name: |
DeleteCustomer |
|
Description: |
Deletes a customer account. Calls the |
|
Usage: |
Called when an account should be deleted. It is a solution business decision whether the account is actually deleted or simply disabled. |
|
Signature: |
|
|
Input: | |
|
CommerceCustomer – An instance of the CommerceCustomer object is parsed in. | |
|
Output: | |
|
SystemMessages - Collection of messages from the external system. |
Usage example:
var customerService = new CustomerServiceProvider();
var customer = customerService.CreateCustomer(new CreateCustomerRequest(
new CommerceCustomer
{
Name = "Bob",
Shops = new[] { "webstore" },
IsDisabled = false,
ExternalId = "Jeff",
Users = new[] { "Bob" }
})).CommerceCustomer;
var deleteRequest = new DeleteCustomerRequest(customer);
var deleteResult = customerService.DeleteCustomer(deleteRequest);GetCustomer method
|
Name: |
GetCustomer |
|
Description: |
Returns a single customer instance. Calls the |
|
Usage: |
Called from Sitecore when searching for an account. |
|
Signature: |
|
|
Input: | |
|
ShopName – Mandatory. | |
|
ExternalID – Mandatory. The unique ID of the customer in the given shop. | |
|
Output: | |
|
CommerceCustomer – An instance of the CommerceCustomer if it exists. | |
|
SystemMessages - Collection of messages from the external system. |
Usage example:
var customerService = new CustomerServiceProvider();
customerService.CreateCustomer(new CreateCustomerRequest(
new CommerceCustomer
{
Name = "Bob",
Shops = new[] { "webstore" },
IsDisabled = false,
ExternalId = "1234567890",
Users = new[] { "Bob" }
}));
var getRequest = new GetCustomerRequest("1234567890");
var result = customerService.GetCustomer(getRequest);GetCustomers method
|
Name: |
GetCustomers |
|
Description: |
Queries and returns customer entities. Calls the Different input parameters can be provided and they will be combined using logical and. |
|
Usage: |
Called from Sitecore when searching for an account. |
|
Signature: |
|
|
Input: | |
|
ExternalIDs – Optional. Can be a single or a list of IDs. When provided, it takes precedence. | |
|
SitecoreIDs – Optional. Can be a single or a list of IDs. | |
|
Name – Optional | |
|
ExternalUserIDs – Optional. Can be a single or a list of IDs. Used when looking for customers associated with a given user. | |
|
Disabled – Optional. | |
|
ShopName – Optional. | |
|
Output: | |
|
List<CommerceCustomer> | |
|
SystemMessages - Collection of messages from the external system. |
Usage example:
var customerService = new CustomerServiceProvider();
customerService.CreateCustomer(new CreateCustomerRequest(
new CommerceCustomer
{
Name = "Jeff",
Shops = new[] { "autohaus" },
IsDisabled = true,
ExternalId = "Jeff",
Users = new[] { "Jeff" }
}));
customerService.CreateCustomer(new CreateCustomerRequest(
new CommerceCustomer
{
Name = "Bob",
Shops = new[] { "webstore" },
IsDisabled = false,
ExternalId = "Jeff",
Users = new[] { "Bob" }
}));
customerService.CreateCustomer(new CreateCustomerRequest(
new CommerceCustomer
{
Name = "Michael",
Shops = new[] { "autohaus" },
IsDisabled = false,
ExternalId = "Michael",
Users = new[] { "Michael" }
}));
customerService.CreateCustomer(new CreateCustomerRequest(
new CommerceCustomer
{
Name = "Kerry",
Shops = new[] { "webstore" },
IsDisabled = true,
ExternalId = "Michael",
Users = new[] { "Michael" }
}));
var result = customerService.GetCustomers(new GetCustomersRequest(new CustomerSearchCriteria { IsDisabled = true }));
Sitecore.Diagnostics.Assert.AreEqual(2, result.CommerceCustomers.Count, "Should have 2 disabled");
result = customerService.GetCustomers(new GetCustomersRequest(new CustomerSearchCriteria { ExternalIDs = new[] { "Jeff" }, Name = "Bob" }));
Sitecore.Diagnostics.Assert.AreEqual(2, result.CommerceCustomers.Count, "Should have 1 match");AddCustomers method
|
Name: |
AddCustomers |
|
Description: |
Add a customer to a user. Calls the |
|
Usage: |
Called to associate a visitor to a user. |
|
Signature: |
|
|
Input: | |
|
List<string> CustomerIds – The customer IDs to add to the user. | |
|
Output: | |
|
IReadOnlyCollection<string> CustomerIds – The list of customer IDs associated with the user. | |
|
SystemMessages - Collection of messages from the external system. |
Usage example:
var customerService = new CustomerServiceProvider();
// create a customer
customerService.CreateCustomer(new CreateCustomerRequest(
new CommerceCustomer
{
Name = "Jeff",
Shops = new[] { "autohaus" },
ExternalId = "1234567890"
}));
// create a user
var request = new CreateUserRequest("JohnSmith", "password", "[email protected]", "webstore");
var user = customerService.CreateUser(request).CommerceUser;
// add the customer to the user
var addRequest = new AddCustomersRequest(user, new List<string> { "1234567890" });
var addResult = customerService.AddCustomers(addRequest);RemoveCustomers method
|
Name: |
RemoveCustomers |
|
Description: |
Removes customers from a user. Calls the |
|
Usage: |
Called to remove an associated visitor to a user. |
|
Signature: |
|
|
Input: | |
|
List<string> CustomerIds – The customer IDs to remove from the user. | |
|
Output: | |
|
IReadOnlyCollection<string> CustomerIds – The list of customer IDs associated with the user. | |
|
SystemMessages - Collection of messages from the external system. |
Usage example:
var customerService = new CustomerServiceProvider();
// create 2 customers
customerService.CreateCustomer(new CreateCustomerRequest(
new CommerceCustomer
{
Name = "Jeff",
Shops = new[] { "webstore" },
ExternalId = "1234567890"
}));
customerService.CreateCustomer(new CreateCustomerRequest(
new CommerceCustomer
{
Name = "Bob",
Shops = new[] { "webstore" },
ExternalId = "9876543210"
}));
// create a user
var request = new CreateUserRequest("JohnSmith", "password", "[email protected]", "webstore");
var user = customerService.CreateUser(request).CommerceUser;
// add the customers to the user
var addRequest = new AddCustomersRequest(user, new List<string> { "1234567890", "9876543210" });
var addResult = customerService.AddCustomers(addRequest);
// remove a customer
var removeRequest = new RemoveCustomersRequest(user, new List<string> { "1234567890" });
var removeResult = customerService.RemoveCustomers(removeRequest);AddCustomerParties method
|
Name: |
AddCustomerParties |
|
Description: |
This method is responsible for adding one or more given customer parties to the specified customer. |
|
Usage: |
Called from Sitecore when adding parties to a customer account, typically during checkout or editing the customer account. |
|
Signature: |
|
|
Input: | |
|
Customer – CommerceCustomer. Mandatory. An instance of the customer. | |
|
CustomerParties – List<CustomerParty>. Mandatory. A list of customer parties to associate with the customer. | |
|
Output: | |
|
Customer - Customer. Mandatory. | |
|
SystemMessages - Collection of messages from the external system. |
Usage example:
var customerService = new CustomerServiceProvider();
// create a customer
var customer = customerService.CreateCustomer(new CreateCustomerRequest(
new CommerceCustomer
{
Name = "Jeff",
Shops = new[] { "autohaus" },
ExternalId = "1234567890"
})).CommerceCustomer;
// create the add request
var request = new AddCustomerPartiesRequest(customer,
new List<CustomerParty>
{
new CustomerParty {ExternalId = "1234567890", PartyID = "1", Name = "HomeAddess", PartyType = 2}
});
var result = customerService.AddCustomerParties(request);RemoveCustomerParties method
|
Name: |
RemoveCustomerParties |
|
Description: |
This method is responsible for removing one or more given customer parties from the specified customer. |
|
Usage: |
Called from Sitecore when removing parties to a customer account, typically when editing the customer account. |
|
Signature: |
|
|
Input: | |
|
Customer – CommerceCustomer. Mandatory. An instance of the customer. | |
|
Parties – List<Party>. Mandatory. A list of customer parities to un-associate with the customer. | |
|
Output: | |
|
Customer - Customer. Mandatory. | |
|
SystemMessages - Collection of messages from the external system. |
Usage example:
var customerService = new CustomerServiceProvider();
// create a customer
var customer = customerService.CreateCustomer(new CreateCustomerRequest(
new CommerceCustomer
{
Name = "Jeff",
Shops = new[] { "autohaus" },
ExternalId = "1234567890"
})).CommerceCustomer;
var parties = new List<CustomerParty>
{
new CustomerParty {ExternalId = "1234567890", PartyID = "1", Name = "HomeAddess", PartyType = 2}
};
// create the add request
var request = new AddCustomerPartiesRequest(customer, parties);
var result = customerService.AddCustomerParties(request);
// remove the parties
var removeRequest = new RemoveCustomerPartiesRequest(customer, parties);
var removeResult = customerService.RemoveCustomerParties(removeRequest);UpdateCustomerParties method
|
Name: |
UpdateCustomerParties |
|
Description: |
This method is responsible for updating one or more given customer parties on the specified customer. |
|
Usage: |
Called from Sitecore when updating parties on a customer account, typically when editing the customer account. |
|
Signature: |
|
|
Input: | |
|
Customer – CommerceCustomer. Mandatory. An instance of the customer. | |
|
Parties – List<Party>. Mandatory. A list of customer parties to update on the customer. | |
|
Output: | |
|
Customer - Customer. Mandatory. | |
|
SystemMessages - Collection of messages from the external system. |
Usage example:
var customerService = new CustomerServiceProvider();
// create a customer
var customer = customerService.CreateCustomer(new CreateCustomerRequest(
new CommerceCustomer
{
Name = "Jeff",
Shops = new[] { "autohaus" },
ExternalId = "1234567890"
})).CommerceCustomer;
var parties = new List<CustomerParty>
{
new CustomerParty {ExternalId = "1234567890", PartyID = "1", Name = "HomeAddess", PartyType = 2}
};
// create the add request
var request = new AddCustomerPartiesRequest(customer, parties);
var result = customerService.AddCustomerParties(request);
parties.Add(new CustomerParty { ExternalId = "9876543210", PartyID = "2", Name = "BillingAddess", PartyType = 1 });
// update the parties
var updateRequest = new UpdateCustomerPartiesRequest(customer, parties);
var updateResult = customerService.UpdateCustomerParties(updateRequest);GetParties method
|
Name: |
GetParties |
|
Description: |
This method is responsible for getting all the parties. |
|
Usage: |
Called from Sitecore when adding parties to a customer account, typically during checkout or editing the customer account. |
|
Signature: |
|
|
Input: | |
|
Customer – CommerceCustomer. Mandatory. An instance of the customer. | |
|
Output: | |
|
Parties – List<Party> A list of parties | |
|
SystemMessages - Collection of messages from the external system. |
Usage example:
var customerService = new CustomerServiceProvider();
// create a customer
var customer = customerService.CreateCustomer(new CreateCustomerRequest(
new CommerceCustomer
{
Name = "Jeff",
Shops = new[] { "autohaus" },
ExternalId = "1234567890"
})).CommerceCustomer;
var parties = new List<Party>
{
new Party {ExternalId = "1234567890", Address1 = "123 My Street", City = "My City", Country = "My Country", PartyId = "1"}
};
// add the party
var addRequest = new AddPartiesRequest(customer, parties);
var addResult = customerService.AddParties(addRequest);
// get the party
var getRequest = new GetPartiesRequest(customer);
var getResult = customerService.GetParties(getRequest);UpdateParties method
|
Name: |
UpdateParties |
|
Description: |
This method is responsible for updating one or more given customer parties on the specified customer. |
|
Usage: |
Called from Sitecore when updating parties on a customer account, typically when editing the customer account. |
|
Signature: |
|
|
Input: | |
|
Customer – CommerceCustomer. Mandatory. An instance of the customer. | |
|
Parties – List<Party>. Mandatory. A list of parties to update | |
|
Output: | |
|
Customer - Customer. Mandatory. | |
|
SystemMessages - Collection of messages from the external system. |
Usage example:
var customerService = new CustomerServiceProvider();
// create a customer
var customer = customerService.CreateCustomer(new CreateCustomerRequest(
new CommerceCustomer
{
Name = "Jeff",
Shops = new[] { "autohaus" },
ExternalId = "1234567890"
})).CommerceCustomer;
var parties = new List<Party>
{
new Party {ExternalId = "1234567890", Address1 = "123 My Street", City = "My City", Country = "My Country", PartyId = "1"}
};
// add the party
var addRequest = new AddPartiesRequest(customer, parties);
var addResult = customerService.AddParties(addRequest);
parties.Add(new Party { ExternalId = "9876543210", Address1 = "123 My Road", City = "My Town", Country = "Your Country", PartyId = "2" });
// update the parties
var updateRequest = new UpdatePartiesRequest(customer, parties);
var getResult = customerService.UpdateParties(updateRequest);AddParties method
|
Name: |
AddParties |
|
Description: |
This method is responsible for adding one or more given customer parties to the specified customer. |
|
Usage: |
Called from Sitecore when adding parties to a customer account, typically during checkout or editing the customer account. |
|
Signature: |
|
|
Input: | |
|
Customer – CommerceCustomer. Mandatory. An instance of the customer. | |
|
Parties – List<Party>. Mandatory. A list of customer parties to add. | |
|
Output: | |
|
Customer - Customer. Mandatory. | |
|
SystemMessages - Collection of messages from the external system. |
Usage example:
var customerService = new CustomerServiceProvider();
// create a customer
var customer = customerService.CreateCustomer(new CreateCustomerRequest(
new CommerceCustomer
{
Name = "Jeff",
Shops = new[] { "autohaus" },
ExternalId = "1234567890"
})).CommerceCustomer;
var parties = new List<Party>
{
new Party {ExternalId = "1234567890", Address1 = "123 My Street", City = "My City", Country = "My Country", PartyId = "1"}
};
// add the party
var addRequest = new AddPartiesRequest(customer, parties);
var addResult = customerService.AddParties(addRequest);RemoveParties method
|
Name: |
RemoveParties |
|
Description: |
This method is responsible for removing one or more given customer parties from the specified customer. |
|
Usage: |
Called from Sitecore when removing parties to a customer account, typically when editing the customer account. |
|
Signature: |
|
|
Input: | |
|
Customer – CommerceCustomer. Mandatory. An instance of the customer. | |
|
Parties – List<Party>. Mandatory. A list of customer parties to remove. | |
|
Output: | |
|
Customer - Customer. Mandatory. | |
|
SystemMessages - Collection of messages from the external system. |
Usage example:
var customerService = new CustomerServiceProvider();
// create a customer
var customer = customerService.CreateCustomer(new CreateCustomerRequest(
new CommerceCustomer
{
Name = "Jeff",
Shops = new[] { "autohaus" },
ExternalId = "1234567890"
})).CommerceCustomer;
var parties = new List<Party>
{
new Party {ExternalId = "1234567890", Address1 = "123 My Street", City = "My City", Country = "My Country", PartyId = "1"}
};
// add the party
var addRequest = new AddPartiesRequest(customer, parties);
var addResult = customerService.AddParties(addRequest);
// remove the party
var removeRequest = new RemovePartiesRequest(customer, parties);
var getResult = customerService.RemoveParties(removeRequest);UpdatePassword method
|
Name: |
UpdatePassword |
|
Description: |
Change the user password. Calls the |
|
Usage: |
Called from Sitecore when the password must be changed. |
|
Signature: |
|
|
Input: | |
|
UserID – Mandatory The ID of the user to change the password for. | |
|
OldPassword – Mandatory. The old password. | |
|
NewPassword – Mandatory The new password. | |
|
Output: | |
|
SystemMessages - Collection of messages from the external system. |
Usage example:
var customerService = new CustomerServiceProvider();
// create a customer
var request = new CreateUserRequest("JohnSmith", "password", "[email protected]", "webstore");
customerService.CreateUser(request);
// update the password
var updateRequest = new UpdatePasswordRequest("JohnSmith", "password", "nEwPaSsWoRd");
var result = customerService.UpdatePassword(updateRequest);