Browse Source

Avoid rounding issues with float

master
Georg Sauthoff 6 months ago
parent
commit
6c1f9bb1f5
  1. 5
      inema/inema.py

5
inema/inema.py

@ -13,6 +13,7 @@ import pkg_resources
import requests, zipfile
import io
import logging
import decimal
__version__ = pkg_resources.get_distribution(__package__).version
@ -93,8 +94,8 @@ class Internetmarke(object):
return [p, t, k, s]
def get_product_price_by_id(self, ext_prod_id):
price_float_str = marke_products[str(ext_prod_id)]['cost_price']
return int(round(float(price_float_str) * 100))
price_str = marke_products[str(ext_prod_id)]['cost_price']
return int(decimal.Decimal(price_str) * 100)
def __init__(self, partner_id, key, key_phase="1"):
self.client = Client(self.wsdl_url)

Loading…
Cancel
Save