fix(connector): stop cashtocode, tokenio and zen declaring manual capture - #14315
Open
abhisheksharma2411 wants to merge 1 commit into
Open
abhisheksharma2411 wants to merge 1 commit into
abhisheksharma2411 wants to merge 1 commit into
Conversation
…ture All three list `CaptureMethod::Manual` in `supported_capture_methods` while their `ConnectorIntegration<Capture, ..>::build_request` returns `FlowNotSupported`. `validate_connector_against_payment_request` checks membership of that list, so a manual-capture payment is accepted at authorization and then cannot be captured — the failure lands after the customer has already paid, rather than when the request is validated. `SequentialAutomatic` stays for all three: a charge never reports `Authorized`, so no follow-up capture call is made for it. Same defect and the same fix as juspay#14292 for Coinbase, found by scanning for connectors whose Capture flow is `FlowNotSupported` but which still advertise Manual. Those four were the complete set. Each connector gets the regression test from juspay#14292, asserting through `validate_connector_against_payment_request` rather than reading the constant, so re-adding Manual to the list fails rather than passing.
Changed Files
|
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.
Type of Change
Description
Three connectors advertise a capture method they cannot perform. Each lists
CaptureMethod::Manualinsupported_capture_methodswhile itsConnectorIntegration<Capture, ..>::build_requestreturnsFlowNotSupported:cashtocodeErr(FlowNotSupported { flow: "Capture" })tokenioErr(FlowNotSupported { flow: "Capture" })zenErr(FlowNotSupported { flow: "Capture" })validate_connector_against_payment_requestdecides purely on membership of that list:So a manual-capture payment passes validation, authorizes, and then cannot be captured. The failure arrives after the customer has already paid, instead of when the request is validated — which is the wrong end of the transaction for a capability error.
SequentialAutomaticis kept for all three, for the same reason as #14292: a charge never reportsAuthorized, so no follow-up capture call is made for it.How this was found
Reviewing #14292, which fixes exactly this for Coinbase. Scanning the connector directory for the same shape — a
Captureimpl returningFlowNotSupportedalongside aCaptureMethod::Manualdeclaration — returned four connectors:coinbase(covered by #14292), and these three. That is the complete set; every other connector whose Capture flow is unsupported already omits Manual.Credit to @errmakov for #14292 — this is that fix applied to the rest of the set, deliberately mirroring its shape rather than inventing a different one.
Testing
Each connector gets the regression test from #14292, asserting through
validate_connector_against_payment_requestrather than reading the constant, so the guard survives a refactor of the list:Watched them fail first. Re-adding
CaptureMethod::Manualto all three lists:so each test fails for its own connector rather than passing on someone else's behaviour.
cargo fmt --all -- --checkclean,cargo clippy -p hyperswitch_connectors --features "v1,payouts,frm,revenue_recovery"clean.Not included
No change to the webhook-flow declarations. #14292 also drops
EventClass::Refundsfor Coinbase; I checked these three separately and did not find the same mismatch, so that half is deliberately not copied across.