adyen-shopware6
adyen-shopware6 copied to clipboard
Added PrePaymentDataBuildEvent and implemented dispatch in the abstra…
…ctPaymentMethodHandler
Summary
There's a possibility in Shopware to have a custom crediting system, be it a rewards program, customer balance or other things that affect the remaining amount of an order. When using the adyen plugin at the time of writing, it's impossible to apply this to the payment as Adyen always sends either the full amount or the partial amount (defined by adyen plugin).
In order to make the above scenario possible, I introduced an event so that a developer can use this hook to make changes accordingly.
Tested scenarios
- Without changes: orders still work as intended - nothing has changed
- Subscribed to the event and changed the amount: only that amount has to be paid through Adyen
Quality Gate passed
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code
Hello @MattMaes,
Thank you for your contribution. Your case seems to be a valid one but I still have some questions about the implementation.
If the plugin only uses the amount coming from PrePaymentDataBuildEvent
while authorising a payment, this implementation might create an issue on AuthorisationWebhookHandler. Since the transaction amount will not be equal to the notification amount, order status will not be updated.
In this case, I expect transaction amount to be the full amount (Adyen payment + shopper credit) however notification only contains Adyen payment amount.
What would you think about this case from the perspective of webhooks?
Best regards, Can
FYI: this is a new (better if I say so myself) approach => https://github.com/Adyen/adyen-shopware6/pull/516