Repository URL to install this package:
|
Version:
0.4.192 ▾
|
lib-py-b2b
/
customer_service.py
|
|---|
from datetime import datetime
from lib_b2b.address import Address
from lib_b2b.calendar import OperatingCalendar
from lib_b2b.customer import Customer
from lib_b2b.holidays import Holidays
from lib_b2b.profile import Profile
from lib_b2b.service_center import ServiceCenter
class CustomerServiceCenter(ServiceCenter):
def operating_calendar(self, customer):
return OperatingCalendar(work_days=self.workdays, holidays=self.holidays)
# TODO: - Ideally, the list of customer service centers should be pulled from the
# database. However, with only one customer service center it's unnecessary. If
# there is future expansion, this will need to be revisited.
class CustomerServiceCenters:
customer_service_centers = {
'MTAD': CustomerServiceCenter(
center_id='MTAD',
name='Building D',
address=Address(
address1='199 Woltz St',
city='Mount Airy',
state='NC',
postalCode='27030',
country='US',
phone='(336)789-9161'
),
time_zone='US/Eastern',
workdays=[0, 1, 2, 3, 4],
holidays=Holidays.get('BarnhardtCalendar', years=[datetime.now().year])
),
'MTAA': CustomerServiceCenter(
center_id='MTAA',
name='Building A',
address=Address(
address1='199 Woltz St',
city='Mount Airy',
state='NC',
postalCode='27030',
country='US',
phone='(336)789-9161'
),
time_zone='US/Eastern',
workdays=[0, 1, 2, 3, 4],
holidays=Holidays.get('BarnhardtCalendar', years=[datetime.now().year])
)
}
@classmethod
def for_(cls, customer):
_profile = Profile.profile_for(customer)
_svc_ctr = cls.get(_profile.customer_service_center)
return _svc_ctr
@classmethod
def get(cls, center_id):
return cls.customer_service_centers.get(center_id, None)
@classmethod
def all(cls):
return cls.customer_service_centers.values()