Skip to content

Sticky routing: record successes on update-gateway-score #415

Description

@prajjwalkumar17

Part of #393 (sticky routing). Status: implemented in #420 (commit 23f953b), pending review/merge.

POST /update-gateway-score gains three optional, backward-compatible fields:

{ "customerId": "cust_123", "paymentMethod": "INTERAC", "paymentMethodType": "RTP", ... }
  • Payload wins; the decide-time gateway_scoring_data_{payment_id} snapshot (which now also stashes customerId) is the fallback — so callers only need the fields when success webhooks can outlive the snapshot's 30-minute TTL.
  • Two-pass hook in check_and_update_gateway_score_: a payload-only pass runs before the snapshot fetch (a CHARGED webhook hours late still counts), the snapshot pass after.
  • Writes only on CHARGED / AUTHORIZED / PARTIAL_CHARGED — the engine's wider success set includes lifecycle statuses (VOIDED, AUTO_REFUNDED, CAPTURE_FAILED, …) that would let a late webhook re-count an earlier attempt's connector. Retries are correct by construction: fail-on-A writes nothing, success-on-B increments B.
  • No dedupe, by design: update-gateway-score is the source of truth — every event counts, N times if sent N times (matching the engine default SR behavior; its feedback locks are opt-in per merchant).
  • Bug fixed en route: the GSM healthy-failure early-return now fires on failures only — previously a success carrying errorInfo skipped both the SR reward and any snapshot-based work.
  • Gated by the sticky_routing_enabled FeatureConf; a sticky write failure is logged, never surfaced to the caller. openapi + api-refs updated.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions