Skip to main content

Customer Info

This section refers to CustomerDetail and CustomerInfo modules.

Getting the Detailed Customer Information

To get the latest updated details about the customer, you can call getCustomerDetail method.

    Amani.sharedInstance.customerInfo().getCustomer()

Updating the Customer

You can just call the setInfo method as shown in the example below.

    var addressInfo:AddressInfo = AddressInfo(city: "City", address: "address", province:  "Province")
Amani.sharedInstance.customerInfo().setInfo(occupation: "Occupation" , address: addressInfo)
note

All the fields in this function are optionals. If you give them null and call upload it'll remove those fields from our side.

If you don't call the upload method, it won't update.

Uploading the Updated Customer Data

After calling the setInfo, you must call the `upload to reflect the changes to our system.

    Amani.sharedInstance.customerInfo().upload(location: nil){ ([weak self] (uploadSuccess, error) in
if (uploadSuccess != nil) {
// uploadSuccess is a boolean variable
// TODO: handle the upload state
} else if (error != nil) {
// TODO: handle the error
}
}