Browse Source

Merge pull request #246 from invitu/8.0-fix-hw_telium_payment_terminal-currency_decimals

[FIX] fixes currencies with decimals <>2
pull/106/merge
Alexis de Lattre 7 years ago
committed by GitHub
parent
commit
4dc185a3bb
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      hw_telium_payment_terminal/controllers/main.py

4
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

Loading…
Cancel
Save