Conversation
…webhook flow Coinbase has no capture API (the Capture flow returns FlowNotSupported) and does not support refunds, but its connector specification declared CaptureMethod::Manual and EventClass::Refunds. /feature_matrix and the generated connector docs advertised both. Keep SequentialAutomatic: a Coinbase charge never reports Authorized, so should_initiate_capture_flow never chains a capture call for it and it behaves like Automatic. Add unit tests for capture method validation and declared webhook flows. Fixes juspay#14277 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
abhisheksharma2411
left a comment
There was a problem hiding this comment.
Verified both removals against the connector rather than the description, and both are correct — this is removing capabilities the code cannot actually perform.
Manual capture. impl ConnectorIntegration<Capture, …> for Coinbase at L349 has a build_request that returns Err(FlowNotSupported) outright. So a merchant configuring manual capture on Coinbase got an accepted configuration and a runtime failure at capture time — after the customer had already paid. Moving that rejection to request validation is the right trade: in payments, failing at configuration beats failing mid-transaction.
Keeping SequentialAutomatic with the reasoning spelled out (a charge never reports Authorized, so no follow-up capture is ever attempted) is the detail that makes this safe to merge — that's the one that would have been easy to remove along with Manual and quietly break working integrations.
Refunds webhook. Also correct, and doubly so:
ConnectorIntegration<Execute, RefundsData, …>::build_request -> Err(FlowNotSupported)
get_webhook_event_type -> PaymentIntentSuccess | PaymentActionRequired
| PaymentIntentProcessing | EventNotSupported
The refund flow is unimplemented, and the webhook mapper cannot emit a single refund event — there is no IncomingWebhookEvent::Refund* anywhere in the connector. So EventClass::Refunds was advertising a webhook class that can never fire.
This looks like a small pattern rather than a one-off. Scanning for connectors whose Capture impl returns FlowNotSupported and which still name CaptureMethod::Manual:
cashtocode
coinbase <- this PR
tokenio
zen
cashtocode has Manual sitting in its supported_capture_methods vector next to Automatic and SequentialAutomatic, same shape as Coinbase before this change. I haven't checked whether each of those three has the same runtime outcome — a couple may route capture differently — but they're worth a look, and the validate_capture_method test added here is exactly the guard that would pin them once checked. Happy to file an issue listing them if that's useful rather than expanding this PR.
The test is the right shape: asserting through validate_connector_against_payment_request rather than reading the constant means a future edit to the supported list has to confront it.
Type of Change
Description
The Coinbase connector specification declared capabilities that the connector does not implement, so
GET /feature_matrix(and the connector docs generated from it) advertised them:supported_capture_methodsAutomatic,Manual,SequentialAutomaticAutomatic,SequentialAutomaticConnectorIntegration<Capture>returnsFlowNotSupported, so a manual capture can never be completedCOINBASE_SUPPORTED_WEBHOOK_FLOWSPayments,RefundsPaymentsNotSupported,ExecutereturnsFlowNotSupported, andget_webhook_event_typemaps no refund eventBecause the default
ConnectorValidation::validate_connector_against_payment_requestchecks the requested capture method againstsupported_capture_methods, a Coinbase payment withcapture_method: manualis now rejected up front withNotSupported, instead of being accepted and failing at capture time.Why
SequentialAutomaticis kept (the issue suggests removing it):should_initiate_capture_flowonly chains a capture call when the attempt isAuthorized, and only for Paybox. Coinbase's status mapping never producesAuthorized(New→AuthenticationPending,Completed/Resolved→Charged), so for CoinbaseSequentialAutomaticbehaves exactly likeAutomaticand works today. Removing it would start rejecting requests that currently succeed. This matchescryptopay, which declares the same pair.Additional Changes
Motivation and Context
Fixes #14277.
How did you test it?
Added unit tests in
crates/hyperswitch_connectors/src/connectors/coinbase.rsthat callvalidate_connector_against_payment_requestfor each capture method and checkget_supported_webhook_flows.Tests against the old declarations (tests only):
With the fix:
Not tested against a live Coinbase account: the change only affects declarations and request validation, and no Coinbase API call changes.
Checklist
cargo +nightly fmt --allcargo clippy🤖 Generated with Claude Code