Skip to content

Instantly share code, notes, and snippets.

@hprobotic
Created December 27, 2019 19:21
Show Gist options
  • Save hprobotic/a3134e5ee3a062717e5830d7137723f9 to your computer and use it in GitHub Desktop.
Save hprobotic/a3134e5ee3a062717e5830d7137723f9 to your computer and use it in GitHub Desktop.
def generate_fingerprint(self):
# the body of fingerprint is generated with the following sequences
# seperated by '_'
sequence = [
'account_number',
'account_routing_type',
'account_routing_value',
'bank_country_id',
'swift_code',
'account_routing_type2',
'account_routing_value2',
'iban',
]
bank = self.__dict__
body = ''
for key in sequence:
if key in bank and bank[key]:
body += str(bank[key])
body += '_'
# remove the last _
body = body[:-1]
m = hashlib.md5()
m.update(body.encode('utf-8'))
return m.hexdigest()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment