Problem/Motivation
In \Drupal\mollie_commerce\EventSubscriber\MollieRedirectEventSubscriber::setRedirectUrl() the mollie_payment storage handler is called with loadByProperties() method, given the context & context id.
However this not actually do any conditional logic on these properties, but just returns the latest Mollie payment.
Steps to reproduce
Call the loadByProperties() method for a Mollie transaction that is NOT the most recent one.
E.g.
$payments = \Drupal::entityTypeManager()->getStorage('mollie_payment')
->loadByProperties([
'context' => 'mollie_commerce',
'context_id' => "13851"
]);
$payment = reset($payments);
The payment entity you receive, is not the one with these properties.
Proposed resolution
The PaymentStorage logic seems flawed currently (probably caused by all the "TODO" comments in the source code).
Currently, via the query execution, it always loads the latest 50 transactions. No conditional logic is applied.
Remaining tasks
Improve logic to retrieve conditional transactions from Mollie API
Maybe override \Drupal\Core\Entity\EntityStorageBase::loadByProperties() in TransactionStorageBase, so it does some conditional checking on the results, although it will only be the last 50 ones, and will be difficult to filter on any kind of property...
Alternatively, add a dedicated method to retrieve a transaction by context, and use that method in the event subscriber, instead of loadByProperties