Skip to content

Commit

Permalink
Merge pull request #5 from kmee/fix/python3-charge
Browse files Browse the repository at this point in the history
[FIX] Python3 compatibility
  • Loading branch information
mileo authored Feb 28, 2021
2 parents 5b64683 + a70d4c7 commit a2f764d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions febraban/cnab240/libs/dac.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ class DAC:
@classmethod
def calculate(cls, branch, accountNumber, wallet, bankNumber):
x1 = branch + accountNumber + wallet + bankNumber
x2 = "12" * (len(x1) / 2) + ("1" if len(x1) % 2 == 1 else "")
x2 = "12" * int(len(x1) / 2) + ("1" if len(x1) % 2 == 1 else "")
out = [int(a) * int(b) for (a, b) in zip(x1, x2)]
s = sum(map(lambda x: x/10 + x % 10, out))
s = sum(map(lambda x: int(x/10 + x % 10), out))
return (10 - s % 10) % 10

@classmethod
def calculateTaxDac(cls, productId, segmentId, currency, amount, company, freeField):
x1 = productId + segmentId + currency + amount + company + freeField
x2 = "12" * (len(x1) / 2) + ("1" if len(x1) % 2 == 1 else "")
x2 = "12" * int(len(x1) / 2) + ("1" if len(x1) % 2 == 1 else "")
out = [int(a) * int(b) for (a, b) in zip(x1, x2)]
s = sum(map(lambda x: x/10 + x % 10, out))
s = sum(map(lambda x: int(x/10 + x % 10), out))
return (10 - s % 10) % 10

0 comments on commit a2f764d

Please sign in to comment.