Payment command parser and state machine
Build the parser and the object-oriented state machine behind a payment command interface. Every command line has the same fixed number of positions, with empty strings in the unused ones: CREATE id payer payee amount, then APPROVE, CAPTURE and CANCEL, which name an existing payment and an amount. Parse each line, apply it to its payment, reject transitions the payment's current state does not allow, and structure the classes so new commands and states are easy to add.
No answer yet. Write the first one; the best answer gets endorsed.
