Develop a REST API for a receipt processing workflow.
For grading, model the API as an in-memory function that processes sequential receipt actions and returns one response for each action. Each action has receipt_id and operation, where operation is submit, approve, or reject. A receipt starts in RECEIVED after submission. Return response objects containing status_code and state for successful actions, or status_code and error for invalid actions.
Function signature: process_receipt_actions(actions)
The workflow must reject duplicate submissions, reject transitions from terminal states, and return status code 400 for unknown operations.
def process_receipt_actions(actions):