Skip to content

Commit

Permalink
Merge pull request #9 from gisce/fix_checksum_operation
Browse files Browse the repository at this point in the history
Fix checksum operation
  • Loading branch information
guilleJB committed May 5, 2016
2 parents 6f8dbcf + d273986 commit 647a04e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bankbarcode/cuaderno57.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ def checksum(self):
+ int(self.notice) \
+ self.amount100()
decimals = int(Decimal(sum) / 97 % 1 * 100)
if not decimals:
return '00'
return unicode(100 - decimals).zfill(2)

def code(self):
Expand Down
9 changes: 9 additions & 0 deletions spec/cuaderno57_Recibo507_checksum_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,12 @@
amount = '37.62'
checksum = '56'
expect(Recibo507(entity, suffix, ref, notice, amount).checksum()).to(equal(checksum))

with it('accomplish another example'):
entity = '22350466'
suffix = '501'
ref = '00000085501'
notice = '130516'
amount = '56.92'
checksum = '00'
expect(Recibo507(entity, suffix, ref, notice, amount).checksum()).to(equal(checksum))

0 comments on commit 647a04e

Please sign in to comment.