Supported Features
SAP Commerce Cloud integration supports all endpoints listed in the SAP Commerce Cloud API documentation. Additionally, it supports all endpoints of the Assisted Service Module listed in the ASM API documentation.
Limitations of SAP Commerce Cloud
This section presents limitations coming from the SAP Commerce Cloud and possible workarounds.
Setting district
field in a new address is being lost
When creating a new address, the district
field is being lost. It is a known issue in SAP Commerce Cloud. It happens because in the controller responsible for creating an address, the district
field is not being set. However, it is being set in the controller responsible for updating an address. You can follow this flow to address this issue.
As a workaround, you can:
- Create an address (
createCartAddress
SDK method) withoutdistrict
field, - Patch it with the field (
updateUserAddress
SDK method), - Fetch updated address using (
getUserAddress
SDK method).
This workaround works only for a logged in user. Guest user can't use an update address endpoint as it is restricted to logged in users.
It is possible to create user with the same email multiple times
Even though, it looks like it is possible. In reality, SAP responds with data you provided + UID which is Random string but it doesn't create a new user in that scenario.
We can find code responsible for that in SAP's source code:
// ...
// Part of method responsible for creating an user
try {
customerFacade.register(registerData);
} catch (final DuplicateUidException ex) {
userExists = true;
LOG.debug("Duplicated UID", ex);
}
final String userId = user.getUid().toLowerCase(Locale.ENGLISH);
httpResponse.setHeader(YcommercewebservicesConstants.LOCATION, getAbsoluteLocationURL(httpRequest, userId));
final CustomerData customerData = getCustomerData(registerData, userExists, userId);
return getDataMapper().map(customerData, UserWsDTO.class, fields);
// ...
// Here we can see what's happening if userExists === true
protected CustomerData getCustomerData(final RegisterData registerData, final boolean userExists, final String userId)
{
final CustomerData customerData;
if (userExists)
{
customerData = customerFacade.nextDummyCustomerData(registerData);
// if user exists, make sure return the customer.uid is the same with exist one
alignCustomerUidWithExistUser(userId, customerData);
}
else
{
customerData = customerFacade.getUserForUID(userId);
}
return customerData;
}
/**
* Generate dummy customer data with random customerId to return if user already exists in database.
*
* * @param registerData
* data provided by user during registration
* @return
*/
CustomerData nextDummyCustomerData(final RegisterData registerData);
// ...
@Override
public CustomerData nextDummyCustomerData(final RegisterData registerData)
{
final CustomerModel userModel = new CustomerModel();
setCommonPropertiesForRegister(registerData, userModel);
userModel.setCustomerID(UUID.randomUUID().toString());
return getCustomerConverter().convert(userModel);
}