Skip to content

Commit

Permalink
payments: fixup for ISO11649 customer reference check-digit calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
jayaddison committed Dec 17, 2023
1 parent cf4f13d commit e1fc8fc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions models/payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,7 @@ def customer_reference(self):
# Derive an ISO-11649 payment reference for EUR-currency payments
if self.currency == "EUR":
order_id = f"{event_year()}{self.id:08d}"
order_check_digits = mod_97_10.calc_check_digits(order_id)
assert len(order_check_digits) == 2
order_check_digits = mod_97_10.calc_check_digits(f"{order_id}RF")
customer_reference = f"RF{order_check_digits}{order_id}"
assert iso11649.validate(customer_reference)
return customer_reference
Expand Down
2 changes: 1 addition & 1 deletion tests/test_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def test_format_inline_epc_qr(app):
"GB47LOND11213141516171",
"EUR10",
"",
"RF53202400000001",
"RF84202400000001",
]

decoded = decode(qr_image)
Expand Down

0 comments on commit e1fc8fc

Please sign in to comment.