Charge Processor

Problem 08

Charge Processor

preview

Implement a PaymentProcessor with charge(ref, amountCents): it processes an idempotent charge and returns { chargeId, amountCents }.

Requirements

  1. 01charge(ref, amountCents) returning { chargeId, amountCents }.
  2. 02A first-seen non-empty ref with a positive integer amountCents creates exactly one charge and stores its result.
  3. 03Repeating the same ref and amount returns the original chargeId and amountCents without creating another charge.
  4. 04Repeating a ref with a different amount rejects the request and leaves the original charge unchanged.

Constraints

  • • Submit one compact engineering spec, not implementation code.
  • • The generated artifact must use the declared TypeScript adapter.
  • • Scoring rewards observable behavior and prompt efficiency, not runtime.
Difficulty
expert
Target
10 min
Acceptance
Artifact
library