diff --git a/bankbarcode/cuaderno57.py b/bankbarcode/cuaderno57.py index dea428b..e6b6594 100644 --- a/bankbarcode/cuaderno57.py +++ b/bankbarcode/cuaderno57.py @@ -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): diff --git a/spec/cuaderno57_Recibo507_checksum_spec.py b/spec/cuaderno57_Recibo507_checksum_spec.py index 38c5e3a..7ecc89d 100644 --- a/spec/cuaderno57_Recibo507_checksum_spec.py +++ b/spec/cuaderno57_Recibo507_checksum_spec.py @@ -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))