Drop the unused token-factory wiring from CaptureAction - #50
Merged
Conversation
CaptureAction implemented GenericTokenFactoryAwareInterface and used the trait, but never touched $this->tokenFactory — a capture needs no token. Only AuthorizeAction mints one, for the callback url. That was pulling payum/core's deprecated GenericTokenFactoryInterface into the class for nothing, so removing it halves this package's exposure to the deprecation in #3. The test now pins the intent from the other side, asserting the action does NOT implement the interface, so it cannot drift back in. No behaviour change: Payum's GenericTokenFactoryExtension simply stops injecting a factory that was never read. Refs #3
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 2.x #50 +/- ##
=========================================
Coverage 97.40% 97.40%
Complexity 126 126
=========================================
Files 14 14
Lines 347 347
=========================================
Hits 338 338
Misses 9 9 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Refs #3.
CaptureActionimplementedGenericTokenFactoryAwareInterfaceand used the trait, but never touched$this->tokenFactory— a capture needs no token. OnlyAuthorizeActionmints one, for the callback url.That was dragging payum/core's deprecated
GenericTokenFactoryInterfaceinto the class for nothing, soremoving it halves this package's exposure to the deprecation. The test now pins the intent from the
other side — asserting the action does not implement the interface — so it cannot drift back in.
No behaviour change: Payum's
GenericTokenFactoryExtensionsimply stops injecting a factory that wasnever read.
Why #3 cannot be fully fixed
The remaining use in
AuthorizeActionis not removable, and the deprecation is inert:GenericTokenFactoryAwareInterfaceandGenericTokenFactoryAwareTraitcarry no deprecation. OnlyGenericTokenFactoryInterfacedoes —"deprecated since 1.3.7 and will be removed in 2.0".
annotation, and our constraint is
payum/core: ^1.6, so a hypothetical removal cannot reach ussilently.
Payum::__construct()takes aGenericTokenFactoryInterfaceand
Payum::getTokenFactory()returns one. It cannot go without a major release of payum/core.AuthorizeActioncallscreateNotifyToken()to buildthe callback url. The non-deprecated
TokenFactoryInterface::createToken()requires the caller tosupply the notify path — but that path is consumer-configured via
setGenericTokenFactoryPaths()(Payum's own default is
notify.php; our e2e harness usesnotify). Hardcoding it would breakconsumers, which is worse than the deprecation.
So the practical answer is: use what payum/core still ships and still wires, keep the exposure minimal,
and revisit if payum/core ever tags a 2.0.