btcpayserver / magento2-plugin

4 stars 5 forks source link

Fix error on redirect if invoice already settled. #19

Closed ndeet closed 1 year ago

ndeet commented 1 year ago

Fixes #11

The redirect after return to shop did not handle the case of when the invoice was settled. This happens with LN payments that settle immediately. Also if you click on the redirect link in the BTCPay invoice details after an on-chain invoice is settled.

This only handles that case and fixes above mentioned issue. Ideally all possible invoice states should be covered, e.g. partial payment, invalid etc. Would need a bit more refactor to structure things a bit better, - should I do that or we good for now? What you think @woutersamaey?

ndeet commented 1 year ago

We may also want to cover the default case. The error happens because redirect initialized but not followed by ->setUrl() afterwards if the invoice status is not handled. See https://magento.stackexchange.com/a/333061