AGENT VIEW · Mokabla · Question · idempotent-topup-api
AgentGate · request ag_f34da8bf5651

Who you are, as far as this app can tell

declared   ClaudeBot · Anthropic   · not verified

The user agent is ClaudeBot (Anthropic), which identifies itself as an AI agent.

Signals: Known agent user agent

This classification is final for the session. The human pages are not served to agents.

This page

page
question
human URL
https://www.mokabla.com/en/c/orange/idempotent-topup-api

State

question
object · slug, title, difficulty, tags, is_free, locked, frequency, last_reported_at, url, agent, company, body_md, follow_ups_md
paid
false
access
Question bodies are paid content: a person buys 30 days of access per company (200 EGP or 200 points) in the human app. Agents get titles, tags and difficulty; bodies only for free questions.
{
  "question": {
    "slug": "idempotent-topup-api",
    "title": "Idempotent Top-Up API",
    "difficulty": "medium",
    "tags": [
      "coding",
      "oop-design",
      "technical",
      "backend"
    ],
    "is_free": true,
    "locked": false,
    "frequency": 0.75,
    "last_reported_at": "2026-06-14T22:54:45.272524Z",
    "url": "https://www.mokabla.com/en/c/orange/idempotent-topup-api",
    "agent": {
      "page": "https://www.mokabla.com/agent/en/c/orange/idempotent-topup-api",
      "question": "https://www.mokabla.com/agent/_call/get_question?company=orange&question=idempotent-topup-api"
    },
    "company": {
      "slug": "orange",
      "name_en": "Orange Egypt / Orange Business"
    },
    "body_md": "## Problem\nWe expose a Spring Boot endpoint `POST /topups` that adds credit to a subscriber's balance. Mobile clients retry on timeouts, so the same top-up sometimes arrives two or three times and the customer gets charged once but credited twice. Design the endpoint so that retries are safe, then implement the core service method in memory: `topUp(idempotencyKey, msisdn, amount)` returns the resulting balance and must produce exactly one credit per key, even under concurrent calls.\n\nIn the Java version I expect to hear about `@Transactional`, a unique constraint on the idempotency key, and what happens when two threads hit the method at once.\n\n## Examples\n**Example 1**\n`topUp(\"k1\", \"0100000001\", 50)` → balance 50; `topUp(\"k1\", \"0100000001\", 50)` again → still 50 (replayed response, no second credit); `topUp(\"k2\", \"0100000001\", 20)` → 70.\n\n**Example 2**\n`topUp(\"k9\", \"0100000002\", 30)` succeeds; `topUp(\"k9\", \"0100000002\", 99)`, same key, different payload → reject with a conflict error rather than silently returning the old result.\n\n## Constraints\n- Keys are client-generated UUIDs, valid for 24 hours\n- Two concurrent requests with the same key must not both credit\n- Balance is an integer number of piasters, never negative\n\n## What they look for\nStore-then-act ordering (insert the key first, credit second, inside one transaction), a DB unique constraint as the real guard, payload hash comparison for the conflict case, and knowing that `synchronized` does not help across two pods.",
    "follow_ups_md": "- Where would you cache the replayed response and for how long?\n- How does this interact with the payment gateway's own retries?\n- Which HTTP status for a replay, and which for a conflict?"
  },
  "paid": false,
  "access": "Question bodies are paid content: a person buys 30 days of access per company (200 EGP or 200 points) in the human app. Agents get titles, tags and difficulty; bodies only for free questions."
}

Actions you may take here

actioninputpermission
get_question
One question with its body. Bodies are paid content unless the question is free.
company: string, question: stringAllowedcall →
list_questions
The questions reported at a company: titles, tags, difficulty, whether each is free or paid.
company: string, page: number?Allowedcall →
buy_access
Buy 30 days of access to a company.
company: stringRefused
R1 This action is for people only
people: https://www.mokabla.com/en/pricing
post_comment
Comment on a question.
question: string, text: stringRefused
R1 This action is for people only
people: https://www.mokabla.com/en/companies

Allowed actions answer in JSON. Add ?format=json or send Accept: application/json to get this whole page as data.

Navigate (pre-filled links you can follow)

Notices

This classification is final for the session: it came from a strong signal, not a guess. The human pages are not served to agents.
Unverified agents are read-only. Signed requests (Web Bot Auth) are the path to write access.