PRE-3683: resolve the /account payload per gateway config - #324
Merged
adumont-payplug merged 1 commit intoSep 15, 2026
Conversation
Base automatically changed from
feature/PRE-3629_disable_claimed_channels
to
feature/PRE-3440_multi_shop_configuration
September 14, 2026 14:34
adumont-payplug
added this pull request to stack #326
September 14, 2026 15:20
adumont-payplug
force-pushed
the
fix/PRE-3683_per_config_account_memo
branch
from
September 14, 2026 15:23
c1e9874 to
9d83d25
Compare
hdelaforce-payplug
left a comment
Contributor
There was a problem hiding this comment.
Revue automatisée (haute exhaustivité). Le fix corrige bien le bug décrit : le passage à createForPaymentMethod() + la mémoïsation par config résolvent correctement le cas multi-shop. Deux points relevés en commentaires inline, le premier me semble à considérer avant merge, le second est mineur.
À noter, écarté après vérification : pas de bug d'ordre d'arguments dans les 6 decorators (named arguments déjà en place sur cette branche) ; IpnAction/IntegratedPaymentController partagent le même défaut "config arbitraire" mais c'est explicitement mentionné comme hors-scope (follow-up) dans la description de la PR.
adumont-payplug
removed this pull request from stack #326
September 15, 2026 08:15
adumont-payplug
added this pull request to stack #328
September 15, 2026 08:17
adumont-payplug
merged commit Sep 15, 2026
5d63bd5
into
feature/PRE-3440_multi_shop_configuration
13 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
SupportedMethodsProvider::provide()resolved the PayPlug/accountpayload once per call and reused it for every payment method in the loop:Two things were wrong with it:
allowed_countriesdrove the billing-country gate, for all of them.PayPlugApiClientFactory::create($factoryName), i.e.findOneBy(['factoryName' => …]), so the account was that of an arbitrary config for the factory — the lowest id — regardless of which payment method was being filtered. With two CB gateways on disjoint channels (now possible since PRE-3628/PRE-3629), the second channel's checkout was filtered against the first channel's PayPlug account.The fix memoizes the
/accountpayload per gateway config and resolves the client withcreateForPaymentMethod(), the idiom already used at the other 16 call sites. The currency/country helpers now take the account array and are pure, so one config costs one/accountread instead of two, and the one-call-per-account optimisation is kept rather than traded away for correctness.accountMemoKey()keys on the persisted id, falling back tospl_object_id()for a config that has not been flushed — anullid would otherwise collide with every other unsaved one. The$paymentMethodKeyderived by splitting the factory name on_is untouched: it keys into the/accountpayload, not into credentials.Motivation: on a multiboutique shop, a merchant's second CB gateway was hidden or shown at checkout according to a different account's currencies, countries and amount limits.
Related issue(s): PRE-3683 — follow-up 2/4 of the PRE-3630 spike (§3b), under epic PRE-3440.
Out of scope:
IpnActionandIntegratedPaymentControllerare the last twocreate($factoryName)callers and share the same "arbitrary config for this factory" property. That reads as credential-scoping work (follow-up 3/4 or 4/4) and is deliberately left alone here.Type of Change
Checklist
Code Quality
ecsclean,phpstanlevel max cleanTesting
Three tests added to
SupportedMethodsProviderTest, each watched failing on the old code first:…filtersEachAgainstItsOwnCurrencies— two methods, two accounts (EUR-only vs USD-only); before the fix both survived an EUR checkout.…filtersEachAgainstItsOwnAllowedCountries— same split for the billing-country gate (FR vs DE).…readsThatAccountOnce— two methods sharing one gateway config hit/accountonce between them, guarding the memo against a per-method regression.Full suite: 545 tests / 1017 assertions green.
composer testsstill aborts atphpmd— 43 violations, the exact same count before and after this change (verified by stashing), all pre-existing ondevelop: long class names,$e, andPayplugCardPersister::persist()complexity.provide()sits at cyclomatic 10 on both sides.Security & Ops