Process auth requests with fraud rules
StripeSoftware Engineer · Technical ScreenLast updated
This question evaluates a candidate's ability to implement stateful stream processing and event handling, including applying time-scoped fraud rules to authorization requests, maintaining chronological ordering, and producing verified outputs via unit tests.
Question
Implement a function that, given a list of Authorization Requests (timestamp_seconds, unique_id, amount, card_number, merchant), outputs a human-readable report ordered chronologically, with each line formatted as "timestamp unique_id amount APPROVE".
Extend the function to also consume a stream of Fraud Rules (time, field, value). From the rule’s time onward, any future Authorization Request whose specified field equals the rule’s value must be marked fraudulent. Produce the same report, but with "REJECT" for fraudulent requests and "APPROVE" otherwise. Include unit tests demonstrating correctness.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.