Add customer "account holder" support for CORE -> Rattail

This commit is contained in:
Lance Edgar 2023-06-11 14:53:14 -05:00
parent 15bac1dc23
commit 914fcbe192

View file

@ -170,9 +170,8 @@ class CustomerImporter(FromCOREPOSAPI, corepos_importing.model.CustomerImporter)
else:
raise NotImplementedError("TODO: how to handle member with no customers?")
return {
data = {
'corepos_card_number': card_number,
'corepos_account_id': int(customer['customerAccountID']),
'number': card_number,
'name': normalize_full_name(customer['firstName'],
customer['lastName']),
@ -184,6 +183,12 @@ class CustomerImporter(FromCOREPOSAPI, corepos_importing.model.CustomerImporter)
'address_zipcode': member['zip'] or None,
}
if 'corepos_account_id' in self.fields:
account_id = customer.get('customerAccountID')
data['corepos_account_id'] = int(account_id) if account_id is not None else None
return data
class CustomerShopperImporter(FromCOREPOSAPI, corepos_importing.model.CustomerShopperImporter):
"""
@ -201,6 +206,7 @@ class CustomerShopperImporter(FromCOREPOSAPI, corepos_importing.model.CustomerSh
'phone_number',
'phone_number_2',
'email_address',
'account_holder',
]
def setup(self):
@ -305,6 +311,7 @@ class CustomerShopperImporter(FromCOREPOSAPI, corepos_importing.model.CustomerSh
'phone_number_2': shopper['altPhone'] or None,
'email_address': shopper['email'] or None,
'account_holder': bool(shopper['accountHolder']),
}
# truncate phone number data if needed