v1.0.12 customer properties and membership
This commit is contained in:
@@ -566,4 +566,34 @@ class CustomerRepository with Logging {
|
||||
}
|
||||
return allProperties;
|
||||
}
|
||||
|
||||
void initCustomerProperties() {
|
||||
List<Property>? properties = Cache().getProperties();
|
||||
Customer? customer = Cache().userLoggedIn;
|
||||
if (customer == null || customer.customerProperties.isEmpty || properties == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (var property in properties) {
|
||||
CustomerProperty? customerProperty = getCustomerPropertyById(property.propertyId);
|
||||
if (customerProperty != null) {
|
||||
customer.properties[property.propertyName] = customerProperty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CustomerProperty? getCustomerPropertyById(int id) {
|
||||
CustomerProperty? property;
|
||||
Customer? customer = Cache().userLoggedIn;
|
||||
if (customer == null) {
|
||||
return property;
|
||||
}
|
||||
for (var customerProperty in customer.customerProperties) {
|
||||
if (customerProperty.propertyId == id) {
|
||||
property = customerProperty;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return property;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user