Commits

Jason R. Coombs committed 9a79b2a

Add support for association name/number

Comments (0)

Files changed (1)

jaraco/financial/merchant.py

 class Merchant(object):
 	_merchants = dict()
 
-	def __init__(self, id, name):
+	def __init__(self, id, name, association_number):
 		self.id = id
 		self.name = name
+		self.association_number = association_number
 
 	@classmethod
 	def from_row(cls, row):
 		id = row['Merchant ID']
 		name = row['DBA Name'].strip()
-		merchant = cls._merchants.setdefault(id, cls(id, name))
+		assoc = row['Association Number'].strip()
+		merchant = cls._merchants.setdefault(id, cls(id, name), assoc)
 		return merchant
 
 	def __repr__(self):
 		return '{name} ({id})'.format(**vars(self))
 
+	@property
+	def association_name(self):
+		return {
+			'096367': 'advance',
+			'096403': 'residual',
+			'096509': 'simple',
+		}[self.association_number]
+
 class Transaction(object):
 	def __init__(self, date, amount):
 		self.date = date