Import membership types from CORE API
This commit is contained in:
parent
dde729b959
commit
2c38e4d5d3
|
@ -58,6 +58,7 @@ class FromCOREPOSToRattail(importing.ToRattailHandler):
|
||||||
importers['Customer'] = CustomerImporter
|
importers['Customer'] = CustomerImporter
|
||||||
importers['Person'] = PersonImporter
|
importers['Person'] = PersonImporter
|
||||||
importers['CustomerPerson'] = CustomerPersonImporter
|
importers['CustomerPerson'] = CustomerPersonImporter
|
||||||
|
importers['MembershipType'] = MembershipTypeImporter
|
||||||
importers['Member'] = MemberImporter
|
importers['Member'] = MemberImporter
|
||||||
importers['Store'] = StoreImporter
|
importers['Store'] = StoreImporter
|
||||||
importers['Department'] = DepartmentImporter
|
importers['Department'] = DepartmentImporter
|
||||||
|
@ -840,6 +841,26 @@ class ProductCostImporter(FromCOREPOSAPI, corepos_importing.model.ProductCostImp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class MembershipTypeImporter(FromCOREPOSAPI, importing.model.MembershipTypeImporter):
|
||||||
|
"""
|
||||||
|
Imports membership type data from CORE-POS API
|
||||||
|
"""
|
||||||
|
key = 'number'
|
||||||
|
supported_fields = [
|
||||||
|
'number',
|
||||||
|
'name',
|
||||||
|
]
|
||||||
|
|
||||||
|
def get_host_objects(self):
|
||||||
|
return self.api.get_member_types()
|
||||||
|
|
||||||
|
def normalize_host_object(self, memtype):
|
||||||
|
return {
|
||||||
|
'number': int(memtype['memtype']),
|
||||||
|
'name': memtype['memDesc'],
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class MemberImporter(FromCOREPOSAPI, corepos_importing.model.MemberImporter):
|
class MemberImporter(FromCOREPOSAPI, corepos_importing.model.MemberImporter):
|
||||||
"""
|
"""
|
||||||
Importer for member data from CORE POS API.
|
Importer for member data from CORE POS API.
|
||||||
|
@ -849,6 +870,7 @@ class MemberImporter(FromCOREPOSAPI, corepos_importing.model.MemberImporter):
|
||||||
'number',
|
'number',
|
||||||
'customer_uuid',
|
'customer_uuid',
|
||||||
'person_uuid',
|
'person_uuid',
|
||||||
|
'membership_type_number',
|
||||||
'joined',
|
'joined',
|
||||||
'withdrew',
|
'withdrew',
|
||||||
'active',
|
'active',
|
||||||
|
@ -931,6 +953,7 @@ class MemberImporter(FromCOREPOSAPI, corepos_importing.model.MemberImporter):
|
||||||
'number': card_number,
|
'number': card_number,
|
||||||
'customer_uuid': customer.uuid,
|
'customer_uuid': customer.uuid,
|
||||||
'person_uuid': person.uuid,
|
'person_uuid': person.uuid,
|
||||||
|
'membership_type_number': int(member['customerTypeID']),
|
||||||
'joined': joined,
|
'joined': joined,
|
||||||
'withdrew': withdrew,
|
'withdrew': withdrew,
|
||||||
'active': not bool(withdrew),
|
'active': not bool(withdrew),
|
||||||
|
|
Loading…
Reference in a new issue