Refactor webhooks to remove need for gate configuration and add event

Created on 2 August 2023, over 1 year ago
Updated 11 September 2024, 2 months ago

Problem/Motivation

The current webhook system is tedious and confusing to set up, especially when you have more than one gateway. You'd need to set up webhooks for every configured gateway, and then for every transaction, all but the current one will complain about the unknown transaction for example or things might even get processed more than once.

Steps to reproduce

Create two gateways, for example one for credit card and the other for twint payments.

Proposed resolution

Remove the gate context, look up the relevant gateway based on the passed context, which is mostly the space id.

We did this for the forked commerce_postfinance_checkout module and it has worked well there, this is basically just backporting this to the current API in this module.

Additionally, this patch adds an event subscriber so that custom code can easily listen to additional events, which is actually my main reason for the backport. I also removed two bogus and unused classes in the EventSubscriber namespace that don't do anything.

I believe there is no security aspect to the gate configuration, per https://app-wallee.com/de-de/doc/webhooks#_integration_details, no data that needs to be secured is transported, worst case is that you can cause a site to send a lot of requests to wallee, but you still need to find an actually valid transaction and space id for that.

Existing webhook urls with the gate url should keep working, it will just no longer use that.

Remaining tasks

As a possible follow-up, the module could also provide a button to set up the url and listeners automatically as it knows what exactly it needs.

This is a draft/work in progress, I still need to implement and verify the hook.

User interface changes

API changes

Data model changes

📌 Task
Status

Fixed

Version

2.0

Component

Code

Created by

🇨🇭Switzerland berdir Switzerland

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024