The order should not be refreshed in the webhook

Created on 11 September 2024, 3 months ago

Problem/Motivation

In the method WebhookController:transactionHandler() the order is loaded with $order = $order_storage->load($order_id);. This can lead to the order refreshing in the webhook. Refreshing in the webhook should be avoided as it cause multiple negative effects. For example, the refresh can cause the order item title to be reset based on the current language in the webhook, rather than the language used during the checkout, leading to inconsistent translation on order confirmation mails. Steps were already made in commerce core (#3323736) to avoid a refresh on payment order updates to avoid such scenarios.

Steps to reproduce

Place an order using the Payrexx.
The webhook fires.
The order may be refreshed (based on settings on the order type) and depending on the duration since the last refresh.

Proposed resolution

Load the 'unchanged order': $order = $order_storage->loadUnchanged($order_id);

Remaining tasks

Create an MR (to follow).

User interface changes

None.

API changes

None.

Data model changes

None

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇨🇭Switzerland tcrawford

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