Description
For example, I have Pay-In with the next data (screenshot from the dashboard):
When I check this Pay-In in the terminal I have:
In [3]: p = DirectDebitWebPayIn.get('xxxxxxxxxx')
In [4]: p.debited_funds
Out[4]: EUR 18043
In [5]: p.fees
Out[5]: EUR 6542
From my point of view, these values should be represented as EUR 180.43
and EUR 65.42
(as in the dashboard).
To fix this I can suggest to use self.amount / 100
instead of self.amount
here:
mangopay2-python-sdk/mangopay/utils.py
Lines 62 to 63 in 2a656a8
and here:
mangopay2-python-sdk/mangopay/utils.py
Lines 65 to 66 in 2a656a8
But of course, this "fix" will work only for the currencies with 2 digits after the decimal separator. So maybe there can be a better solution.
Also, I understand that Money
in the SDK represents An amount of money in the smallest sub-division of the currency, so showing 18043
instead of 180.43
can be correct from some point of view. But we show currency near it and this can be confusing.
But I think the minimum that can be done here is to use for __str__
the same functionality as for __repr__
(means remove :,.2f
. For example, when I want to log Pay-In values I have something like next in my logs:
Booking #000000001: Created Pay-In #0000000002, debited funds - EUR 18,043.00, fees - EUR 6,542.00
As you can see, the __str__
method is definitely produces an incorrect representation of the values from above.