4 ms·
One thing that jumped out at me on this is that currency is being associated with every instance of a value. It is a common use case for multiple different curr
by Karunamon 7y ago
One thing that jumped out at me on this is that currency is being associated with every instance of a value. It is a common use case for multiple different currencies to be used as a part of a single transaction, instead of being set at the per-transaction level?
I.e.
items = [...]
currency = "USD"
value = 5.00
#vs
amount = {"currency": "USD", "value": 5.00}
- PeterisP 7y agoIt's general good practice in financial software to not have "naked" values without the associated currency. Even if right now all your transactions have a single currency, it's still useful to follow that practice because it might not be that way in some edge case, it might not stay that way in the future, to reduce the risk of accidental aggregation (adding multiple values without concern that they might be in different currencies), etc. Two arbitrary edge cases with multiple currencies mixed in single purchase that come in mind; i'm not saying that they apply here, but they are relevant in some cases: 1) card txns with currency exchange - txn currency differs from card currency, the merchant asks for and receives some amount in currency A, the customer gets shown, confirms and pays amount in currency B. 2) tax-included payments (e.g. VAT where applicable) for txns in foreign currency; you might have a payment for 1000 USD but you'd need to calculate/indicate/store the VAT in the local currency.