Add support for external refundsSee original GitHub issue
Scenario: the original credit card has been deleted and the merchant wants to issue a refund by check.
Today, this can be supported by:
- Adding an external payment method to the account and issuing a payment credit (to record the payment, i.e. the check)
- Adjusting the balance of the invoice by issuing an invoice credit (i.e. CBA)
The main drawback of this approach is that the payment credit won’t be linked to the invoice, so the invoice credit won’t be marked as a recognizable credit in the financial reports (i.e. real money associated to the credit vs non-recognizable credit, which is credit given to nice customers for example).
One fix would be to change
PaymentAutomatonRunner: when retrieving the
effectivePaymentMethodId, verify if the payment method was deleted. If it has been deleted, fail the refund. The exception can be caught at the JAX-RS level, and if the right query parameter is passed, add the external payment method if needed, and trigger the payment credit against that payment method. We still need to link the payment to that invoice somehow.
For testing, we need to write an integration test for the scenario above using the test payment plugin.
- Created 9 years ago
- Comments:11 (11 by maintainers)
Top GitHub Comments
@pierre Thank you for your explanations.
I just pushed the refund implementation and tests for scenario 1 and 2a (with and without adjustments). I also created two PRs for you, so you can start reviewing the code.
- killbill-client-java: https://github.com/killbill/killbill-client-java/pull/47
- killbill: https://github.com/killbill/killbill/pull/606
Scenario 2b (refund on a different payment method) is still pending. It’s my next task.
Yes, it does. It will involve more work that I’d estimated 😅
It’s a large task indeed (although I expect the bulk of the work is more in the testing than in the core, but we’ll see…), but it’s quite a useful feature (it has been requested a few times in the past already).
Should I keep this validation?
I believe that’s already taken care of: when Kill Bill will try to retrieve the payment method, it won’t find it and fail the payment. To be checked! 😼