From 8da2c3285ec3b3a212572fcf5405d52eb2c3871c Mon Sep 17 00:00:00 2001 From: Invitu Date: Fri, 9 Feb 2018 07:17:43 -1000 Subject: [PATCH] [FIX] fixes currencies with decimals <>2 --- hw_telium_payment_terminal/controllers/main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw_telium_payment_terminal/controllers/main.py b/hw_telium_payment_terminal/controllers/main.py index e6b35027..d40232b0 100644 --- a/hw_telium_payment_terminal/controllers/main.py +++ b/hw_telium_payment_terminal/controllers/main.py @@ -129,6 +129,8 @@ class TeliumPaymentTerminalDriver(Thread): "The payment mode '%s' is not supported" % payment_info_dict['payment_mode']) return False + cur_decimals = payment_info_dict['currency_decimals'] + cur_fact = 10**cur_decimals cur_iso_letter = payment_info_dict['currency_iso'].upper() try: cur = pycountry.currencies.get(alpha_3=cur_iso_letter) @@ -145,7 +147,7 @@ class TeliumPaymentTerminalDriver(Thread): 'private': ' ' * 10, 'delay': 'A011', 'auto': 'B010', - 'amount_msg': ('%.0f' % (amount * 100)).zfill(8), + 'amount_msg': ('%.0f' % (amount * cur_fact)).zfill(8), } return data