To add or update customer fields, please do the following, call the method passing a JSONArray containing a JSONObject:
Indigitall.assignOrUpdateValueToCustomerFields(context, JSONObject("YOUR FIELDS"), object: CustomerCallback(context){
override fun onSuccess(customer: Customer) {
//do something
}
override fun onError(errorModel: ErrorModel?) {
// log error
}
})
For example:
Indigitall.assignOrUpdateValueToCustomerFields(context,
JSONObject("{" +
"\"email\": \"[email protected]\"," +
"\"phone\": \"123456\"," +
"\"name\\": \"Peter\"," +
"\"last_name\": \"Brice\"" +
}", object : CustomerCallback() {)
override fun onSuccess(customerId: String?) {
//do something
}
override fun onError(errorModel: ErrorModel?) {
//log error
}
})
Otherwise, if you want to eliminate a field, you have to do this with an arrayList of the fieldNames:
Indigitall.deleteValuesFromCustomerFields(context, arrayListOf(customerFieldKey), object: CustomerCallback(context) {
override fun onSuccess(customer: Customer) {
//do something
}
override fun onError(errorModel: ErrorModel?) {
//log error
}
})