Because somtimes the values change after converting and rounding several times by several functions the paid amount will not always reduce the payment value to zero. Thats why the paid_in_full-method won't return true and our external payment provieders did not close with a success email after a successful payment.
My proposal is to create a field in the settings where the shop owner can define a tolerance value (eg 0.10) the zero-balance can differ from
ORDER_VALUE_TOLERANCE = config_register( DecimalValue(PAYMENT_GROUP, 'ORDER_VALUE_TOLERANCE', description= _('Order value tolerance'), help_text=_('Enter a decimal value which will be used as tolerance around the order value (eg 0.10 so the paid amount can differ - or + 0.10 of the order total).'), default='0.00' ) )
def _paid_in_full(self): """True if total has been paid""" return self.balance == Decimal('0.00') paid_in_full = property(fget=_paid_in_full)
def _paid_in_full(self): """True if total has been paid""" config = config_get_group('PAYMENT') try: tolerance = config.ORDER_VALUE_TOLERANCE.value except: tolerance = '0' return self.balance >= Decimal('-%s'%tolerance) and \ self.balance =< Decimal(tolerance) paid_in_full = property(fget=_paid_in_full)