ive been testing the Stripe provider these past days because i'm planning to use it in production, and i noticed something that i'm not sure if it is intended. the thing is when a partial refund is done, the payment status gets set to REFUNDED right away.
The problem is that after this first partial refund, doing another partial refund looks impossible, because BasePayment.refund() only allows refunds while the payment is still CONFIRMED.
So the flow becomes something like:
- payment starts as CONFIRMED
- first partial refund works
- status becomes REFUNDED
- second partial refund can't be done anymore, even if there is still some amount left to refund
maybe the status must stay CONFIRMED after a partial refund, and only become REFUNDED once the remaining captured_amount reaches 0 (which is already handeled by BasePayment.refund())
I did notice a few other providers seem to do something similar too, but im opening this for Stripe because that's the one i'm testing right now.