Shared offer limits

  • Two offers compete for one allowance. Compare the current checks with a guarded update and replayable result.
Diagram phase
100%

Two offers under one PAN · illustrative amounts

How one utilization changes another offer’s availabilityRequest / responseData accessutilizationdebit 30remaining 50own ceilingmin(60, 50)Customer A has its own active product offer. The amount-only example assumes every other rule permits use.Offer Aceiling 60A channel records utilization against A. In this example both A’s available offer amount and one applicable PAN allowance decrease.A uses 30Only selected rules apply across customer IDs associated with a PAN. The example models a logical balance and makes no claim about a particular database row or lock.Shared allowance80 becomes 50Customer B retains a separate active product offer. The example leaves B’s own ceiling unchanged.Offer Bceiling 60Evaluate the active offer and its applicable shared allowance. Amount and EMI can have separate rules. The simplified minimum holds only for these two amount caps.Inquiry on BB’s own ceiling remains 60 and the shared remaining allowance is 50. A successful inquiry describes availability at evaluation time.B can useup to 50utilizationdebit 30remaining 50own ceilingmin(60, 50)

Select a component to trace its direct connections. Drag to pan · Ctrl + wheel or pinch to zoom.

  • A and B are symbolic customer/product records linked to one PAN.
  • In this example A uses 30 of an 80-unit shared allowance. B’s own ceiling stays 60, so its next inquiry returns at most 50.
  • Product rules determine which controls apply. Concurrent utilizations must recheck shared controls at the owning writer.
Customer offers and a shared allowance

Customer offers and a shared allowance

Customer/product offers and shared PAN controls

Calculate the second inquiry

  • Assume each offer permits 60 units and one applicable shared allowance has 80 left. Hold EMI and other eligibility rules constant.
  • After A uses 30, A has 30 left and the shared allowance has 50 left. B’s independent ceiling stays 60.
  • B can use at most min(60, 50) = 50. A concurrent inquiry taken earlier may have returned 60.
Two offers against one shared allowancejson
{
  "scope": "Illustrative amount-only calculation with one applicable shared rule",
  "assumptions": [
    "Both customer/product offers are active and satisfy every other eligibility rule.",
    "A and B denote two customer records linked to the same PAN.",
    "Amounts are teaching units. EMI, other limits and product-specific rules are held constant."
  ],
  "before": {
    "offerA": 60,
    "offerB": 60,
    "sharedRemaining": 80
  },
  "event": { "operation": "utilize", "offer": "A", "units": 30 },
  "after": {
    "offerA": 30,
    "offerB": 60,
    "sharedRemaining": 50,
    "inquiryForB": 50
  }
}

Find the unit of contention

  • An offer lock scoped to A cannot on its own serialize a competing debit to B sharing the same allowance. Validate the actual database transaction and rule-specific guards.
  • A blanket PAN lock would serialize unrelated customer/product controls too. Restrict serialization to the shared control when that rule actually applies.
  • Confirm which product rules share PAN scope, who can change their membership and how inquiry and utilization treat stale quotes before rollout.
Concurrent utilization and replay

Concurrent utilization and replay

Proposed local transaction contract · illustrative acceptance cases

Bind replay to the business command

  • Prefer an existing durable transaction reference after verifying uniqueness, scope and retry behavior. If the caller cannot supply a stable identity, expose authorized outcome lookup before accepting automatic replay.
  • Scope the receipt to the authorized caller and operation. Persist a normalized request fingerprint so the same ID cannot silently acquire a new amount or target.
  • Reserve the unique ID in the mutation transaction. After a lost response, check that receipt before re-evaluating a now-smaller allowance.
Proposed transaction and replay contracttext
Proposed utilization contract (pseudocode, illustrative fields)

Before opening the transaction:
  Authenticate the caller and authorize today's access to this offer.
  Normalize units, product, operation type and expected offer version.
  Bind these fields and the affected offer identity to the command fingerprint.

In one local transaction:
  Reserve (authorized caller scope, stable operation ID) under a unique constraint.
  If already committed:
    Different fingerprint -> reject ID reuse.
    Same fingerprint      -> return the authorized, stored business result.
  If another transaction owns the reservation:
    Wait within the request deadline or return the agreed pending outcome.
    Re-read the authoritative receipt before starting any new attempt.

  Resolve all applicable offer and shared-control rows.
  Acquire guards in a consistent order across all writers.
  Recheck rule membership, offer version, status, amount and EMI using current rows.
  If stale or ineligible:
    Record a deterministic rejection for this command and commit the receipt.
  Otherwise:
    Apply local utilization to offer and applicable shared controls.
    Record the result and, where required, durable campaign-dispatch intent.
    Commit once, then reply.

If the reply is lost:
  Use the original caller scope, operation ID and fingerprint for result lookup.
  If the commit is unresolved, reconcile at the transaction owner before re-execution.

Outside the transaction:
  Dispatch any committed campaign intent using its own recoverable stage protocol.
  A remote campaign acknowledgement describes a separate outcome.

Two concurrent uses

  • Start two eligible 50-unit commands for separate offers sharing 80 units. Lock or conditionally update the relevant controls at commit, with consistent ordering for every writer.
  • Either order can win. The first accepted use leaves 30. The second must re-evaluate and receive the established insufficient-availability outcome.
  • An earlier inquiry is a quote. If the business promises a time-limited reservation, add a separately approved hold/expiry contract and size the capacity tied up in holds.
Acceptance cases for two simultaneous usesjson
{
  "scope": "Proposed acceptance scenario, shared amount is the binding rule",
  "setup": { "offerA": 60, "offerB": 60, "sharedRemaining": 80 },
  "commands": [
    { "id": "first-use", "offer": "A", "units": 50 },
    { "id": "other-use", "offer": "B", "units": 50 }
  ],
  "allowedSchedules": [
    { "commitOrder": ["first-use", "other-use"], "accepted": "first-use", "remaining": 30 },
    { "commitOrder": ["other-use", "first-use"], "accepted": "other-use", "remaining": 30 }
  ],
  "failureChecks": [
    { "event": "Accepted response lost; same command delivered again", "expected": "Return original receipt; remaining stays 30" },
    { "event": "Repeat accepted ID with a different amount", "expected": "Reject the changed fingerprint; remaining stays 30" },
    { "event": "Crash before local commit", "expected": "No debit, committed receipt or dispatch intent for that transaction" },
    { "event": "Crash after local commit, before campaign send", "expected": "One local debit, committed result and discoverable dispatch intent" }
  ]
}

Check the crash boundaries

Failure Check at the authoritative writer
Request times out before commit is known Look up the same operation within caller scope. Keep an unresolved result pending investigation.
Commit succeeds and response is lost Replaying the same ID and fingerprint returns the recorded result. One debit and at most one local intent exist.
Old offer is refreshed before utilization Recheck the expected version/status and all controls. Preserve the channel’s documented rejection or re-inquiry contract.
Campaign send is delayed or redelivered Reuse the committed dispatch identity and reconcile CP’s stage outcome. Local commit alone cannot prove remote application.

Adopt and reverse safely

  • First inspect every channel, bulk and maintenance writer, existing transaction resources, locks and receipt semantics. Reuse an equivalent mechanism where verified.
  • Exercise both race orders, concurrent duplicate IDs, changed payload, stale offer version, and disconnects before/after commit against the target database. Include hot-key lock waits and deadline exhaustion.
  • Roll out one write owner at a time, with a compatible receipt reader for old requests. During rollback retain receipts and dispatched operation IDs throughout the agreed retry horizon.
  • Compare lock-wait latency and queue age under mixed load. Expanding synchronous critical sections to include a remote campaign call would make CP latency hold offer locks.