Customer Profile Management - rezolved/rezolve_sdk_sampleapp_android GitHub Wiki
Once you have established a session, you can access it through RezolveSDK
, and from the session you can access set of Managers, responsible for backend communication, for example:
RezolveSdk.peekInstance().getRezolveSession().getAddressbookManager();
Keep in mind that sdk instance and session can be null
if they haven't been initiatilized.
If the session was correctly initialized you now have access to the consumer's records. These include:
- Consumer Profile - Via the
ConsumerProfileManager
. Name, email, and device profile (phone info) for the consumer - Address Book - Via the
AddressbookManager
. A collection of postal addresses, to be used for ship-to and bill-to purposes. - Phone Book - Via the
PhonebookManager
. A collection of phone numbers associated with the profile. - Favourites - Via the
FavouriteManager
. Reserved for future functionality, "Favourites" are collections of unique devices that can be topped up. A favourite can represent a mobile phone, a tollway transponder, or other device/account. - Wallet - Via the
WalletManager
. Wallet lets you store credit card info securely, and lets the consumer maintain the list of cards. There can be multiple cards.
There are no specific flows to consider when managing the customer profile and associated records.
AddressbookManager
, FavouriteManager
, PhonebookManager
and WalletManager
support the following CRUD operations: create, update, delete, getAll, get.
CustomerProfileManager
supports only update and get.
CustomerProfile customerProfile = new CustomerProfile();
customerProfile.setEmail("[email protected]");
customerProfile.setTitle("Mr.");
customerProfile.setFirstName("John");
customerProfile.setLastName("Doe");
String currentLocale = Locale.getDefault().getLanguage() + "_" + Locale.getDefault().getCountry();
DeviceProfile device = new DeviceProfile(deviceId, Build.MANUFACTURER, currentLocale);
List<DeviceProfile> deviceProfiles = new ArrayList<>();
deviceProfiles.add(deviceProfile);
customerProfile.setDevices(deviceProfiles);
customerProfile.setDateCreated(String.valueOf(System.currentTimeMillis()));
customerProfile.setDateUpdated(String.valueOf(System.currentTimeMillis()));
customerProfile.setLocale(Locale.getDefault().getCountry());
rezolveSession.getCustomerProfileManager().update(customerProfile, new CustomerProfileCallback() {
@Override
public void onUpdateSuccess(CustomerProfile customerProfile) {
// handle success response
}
@Override
public void onError(@NonNull RezolveError error) {
// handle error response
}
});
Even though updating user data is not required to access the engagements, we need certain data to process the product purchase. In most standard usecase it is updated CustomerProfile
and at least one Phone
, Address
and PaymentCard
.
// TODO: link to buy flow chapter