public class CustomersController extends BaseController
DEFAULT_CURRENT_PAGE, DEFAULT_PAGE_SIZE| Constructor and Description |
|---|
CustomersController() |
| Modifier and Type | Method and Description |
|---|---|
void |
changeCustomerPassword(java.lang.String customerId,
java.lang.String newPassword)
Client should pass old and new password in Body.
|
LoginChangeResponse |
changeLogin(java.lang.String newLogin,
java.lang.String password)
Web service for changing customer login.
Sample call: https://localhost:9002/rest/v1/mysite/customers/current/login?newLogin=:newLogin&password=:password Method requires customer authentication and is restricted to HTTPS |
void |
changePassword(java.lang.String old,
java.lang.String newPassword)
Client should pass old and new password in Body.
|
void |
convertAnonymousUserToCustomer(java.lang.String password,
HttpSession httpSession)
Converts currently logged guest user to full user.
|
AddressData |
createAddress(HttpServletRequest request)
Create new address for current customer
|
protected ErrorListWsDTO |
createResponseErrors(Errors errors) |
void |
deleteAddress(java.lang.String id)
Remove address from current customer
|
void |
deletePaymentInfo(java.lang.String id)
Web service for deleting current user's credit card payment info by id.
Sample call: http://localhost:9001/rest/v1/mysite/customers/paymentinfos/123 Method requires authentication and is restricted to HTTPS |
AddressData |
editAddress(java.lang.String id,
HttpServletRequest request)
Edit address from current customer
|
AddressDataList |
getAddresses()
Get all customer's addresses
|
UserGroupDataList |
getAllCustomerGroupsForCurrentCustomer() |
UserGroupDataList |
getAllCustomerGroupsForCustomer(java.lang.String uid)
Web service for getting customer groups for current user.
Sample call: https://localhost:9002/rest/v1/mysite/customers/{uid}/customergroups Method requires authentication and is restricted to HTTPS |
CustomerData |
getCurrentCustomer()
Get customer data
|
CCPaymentInfoData |
getPaymentInfo(java.lang.String id)
Web service for getting current user's credit card payment info by id.
Sample call: https://localhost:9002/rest/v1/mysite/customers/paymentinfos/123 Method requires authentication and is restricted to HTTPS |
CCPaymentInfoDatas |
getPaymentInfos(boolean saved)
Web service for getting current user's credit card payment infos.
Sample call: http://localhost:9001/rest/v1/mysite/customers/paymentinfos?saved=true Method requires authentication and is restricted to HTTPS |
void |
guestLogin(java.lang.String email)
Creates the user dedicated to do a guest checkout.
|
protected boolean |
isAddressValid(AddressData addressData,
Errors errors,
AddressValidationData validationData)
Checks if address is valid by a validators
|
protected void |
populateErrors(Errors errors,
AddressVerificationResult<AddressVerificationDecision> addressVerificationResult)
Populates Errors object
|
void |
registerUser(java.lang.String login,
java.lang.String password,
java.lang.String titleCode,
java.lang.String firstName,
java.lang.String lastName)
Client should pass customer's data as POST Body.
|
PasswordRestoreResponse |
restorePassword(java.lang.String login)
Web service for restoring password of current customer.
Sample call: https://localhost:9002/rest/v1/mysite/customers/current/forgottenpassword?login=:login/ Method requires client or trusted_client authentication and is restricted to HTTPS |
void |
updateDefaultAddress(java.lang.String id)
Update customer's default address
|
void |
updatePaymentInfo(java.lang.String paymentInfoId,
HttpServletRequest request)
Web service for modifying existing payment info.
Sample call: https://localhost:9002/rest/v1/mysite/paymentinfos/123 Method requires authentication and is restricted to HTTPS |
void |
updatePaymentInfoAddress(java.lang.String paymentInfoId,
HttpServletRequest request)
Web service for modifying billing address data for the specific payment info.
Sample call: https://localhost:9002/rest/v1/mysite/paymentinfos/123/address Method requires authentication and is restricted to HTTPS |
CustomerData |
updateProfile(HttpServletRequest request)
Update customer's profile
|
protected AddressValidationData |
verifyAddresByService(AddressData addressData,
Errors errors,
AddressValidationData validationData)
Verifies address by commerce service
|
AddressValidationData |
verifyAddress(HttpServletRequest request)
Verifies address
|
handleErrorInternal, handleModelNotFoundException, sanitizepublic void registerUser(java.lang.String login,
java.lang.String password,
java.lang.String titleCode,
java.lang.String firstName,
java.lang.String lastName)
throws DuplicateUidException,
RequestParameterException
HTTPS channel.
Method type : POST Register data need to be sent as post body..
login - - login to be createdpassword - - customer passwordfirstName - - customer first namelastName - - customer last nametitleCode - - customer's titleDuplicateUidException - in case the requested login already existsRequestParameterExceptionpublic void guestLogin(java.lang.String email)
throws DuplicateUidException
email - - guest user's e-mail, it will be part of user idDuplicateUidExceptionpublic void convertAnonymousUserToCustomer(java.lang.String password,
HttpSession httpSession)
throws DuplicateUidException,
SessionAttributeException
password - httpSession - DuplicateUidExceptionSessionAttributeExceptionpublic void updateDefaultAddress(java.lang.String id)
throws DuplicateUidException
id - - Address id to be set as default addressDuplicateUidExceptionpublic CustomerData updateProfile(HttpServletRequest request) throws DuplicateUidException
request - - http requestDuplicateUidExceptionpublic AddressDataList getAddresses()
public AddressData createAddress(HttpServletRequest request) throws DuplicateUidException, WebserviceValidationException
request - DuplicateUidExceptionWebserviceValidationExceptionpublic AddressData editAddress(java.lang.String id, HttpServletRequest request) throws WebserviceValidationException
id - - id of address to be editedWebserviceValidationExceptionpublic void deleteAddress(java.lang.String id)
id - - id of address to be removedpublic CustomerData getCurrentCustomer()
public void changePassword(java.lang.String old,
java.lang.String newPassword)
old - - old passwordnewPassword - - new passwordpublic CCPaymentInfoDatas getPaymentInfos(boolean saved)
HTTPS channel.
Method type : GET.
saved - - true to retrieve only saved payment infos. false by defaultCCPaymentInfoData as response bodypublic CCPaymentInfoData getPaymentInfo(java.lang.String id)
HTTPS channel.
Method type : GET.
CCPaymentInfoData as response bodypublic void deletePaymentInfo(java.lang.String id)
HTTPS channel.
Method type : DELETE.
public void updatePaymentInfoAddress(java.lang.String paymentInfoId,
HttpServletRequest request)
throws RequestParameterException
HTTPS channel.
Method type : POST. Address data need to be sent as post body.
Method uses HttpRequestAddressDataPopulator to populate address data from request parameters.paymentInfoId - request - RequestParameterExceptionpublic void updatePaymentInfo(java.lang.String paymentInfoId,
HttpServletRequest request)
throws RequestParameterException
HTTPS channel.
Method type : PUT. PaymentInfo data need to be sent in body.
Method uses HttpRequestPaymentInfoPopulator to populate payment info data from request parameters.paymentInfoId - request - RequestParameterExceptionpublic UserGroupDataList getAllCustomerGroupsForCurrentCustomer()
public UserGroupDataList getAllCustomerGroupsForCustomer(java.lang.String uid)
HTTPS channel.
Method type : GET.UserGroupDataList as response bodypublic LoginChangeResponse changeLogin(java.lang.String newLogin, java.lang.String password) throws DuplicateUidException, PasswordMismatchException, RequestParameterException
HTTPS channel.
Method type : POST.newLogin - password - LoginChangeResponseDuplicateUidExceptionPasswordMismatchExceptionRequestParameterExceptionpublic PasswordRestoreResponse restorePassword(java.lang.String login)
HTTPS channel.
Method type : POST.login - PasswordRestoreResponsepublic void changeCustomerPassword(java.lang.String customerId,
java.lang.String newPassword)
newPassword - - new passwordpublic AddressValidationData verifyAddress(HttpServletRequest request)
request - protected boolean isAddressValid(AddressData addressData, Errors errors, AddressValidationData validationData)
addressData - errors - validationData - true if address is valid; false otherwiseprotected AddressValidationData verifyAddresByService(AddressData addressData, Errors errors, AddressValidationData validationData)
addressData - errors - validationData - protected ErrorListWsDTO createResponseErrors(Errors errors)
protected void populateErrors(Errors errors,
AddressVerificationResult<AddressVerificationDecision> addressVerificationResult)
errors - addressVerificationResult - Copyright © 2018 SAP SE. All Rights Reserved.