Aggregate payment states from asynchronous events
I was asked this
No reports yet. Sign in to say where you were asked it.
Payments are driven by asynchronous events that arrive as CSV lines: an event ID, a timestamp, the payment ID and an action such as create (with its merchant), authorize or capture (with an amount). Process the events in arrival order and report, for each payment in the order it was created, its merchant, its current state, the amounts authorized and captured so far, and the time of its last event.
An event ID that was already processed must be ignored. The question comes in four parts that add event types and rules one at a time (a payment captured for less than was authorized ends up partially captured, for example), so keep the state transitions easy to extend.
No official answer yet. Write yours on the right and run it.
Nothing published yet.
Sign in to submit your code; every attempt is kept here.
