adyen-shopware6 icon indicating copy to clipboard operation
adyen-shopware6 copied to clipboard

Added PrePaymentDataBuildEvent and implemented dispatch in the abstra…

Open MattMaes opened this issue 11 months ago • 2 comments

…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

MattMaes avatar Mar 19 '24 15:03 MattMaes

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

candemiralp avatar Apr 15 '24 14:04 candemiralp

FYI: this is a new (better if I say so myself) approach => https://github.com/Adyen/adyen-shopware6/pull/516

sneakyvv avatar Jul 10 '24 07:07 sneakyvv