Created
December 27, 2019 19:21
-
-
Save hprobotic/a3134e5ee3a062717e5830d7137723f9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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