diff --git a/rattail_corepos/importing/corepos/api.py b/rattail_corepos/importing/corepos/api.py index 8adab57..9f1d01e 100644 --- a/rattail_corepos/importing/corepos/api.py +++ b/rattail_corepos/importing/corepos/api.py @@ -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