chore(voucher): use settlement amount to get voucher price #4546
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously, we handled the sales amount like this:
Sales amount = $1.05 (paid to escrow).
Voucher created for $1.04 (platform fee = 1%).
However, when using a BTC wallet to pay for the voucher, the sales amount is converted to satoshis and paid to escrow. This can lead to discrepancies (due to conversion from cents to sats). For example, we might end up paying $1.04 instead of $1.05, resulting in no platform fee being collected.
To improve accuracy, we now use the settlement amount (the actual amount paid to escrow) as the base and deduct the platform fees from that to create the voucher.
For example, if the amount paid to escrow is $1.04, we will deduct the fees from this amount and create a voucher for $1.03.