Implement should_accept_transaction(transaction, rules) for a fraud-rule engine.
Part 1 — String equality rules
Each transaction has string fields, such as merchant name and card brand.
Each ordered rule is either ACCEPT or BLOCK.
A rule has one equality condition, such as (merchant_name: "Not A Fraudster").
Apply rules in order; the first matching rule decides the result.
If no rule matches, accept the transaction by default.
Part 2 — Boolean, AND, and OR rules
Extend the same fraud-rule engine to support Boolean transaction fields.
A rule condition may be one Boolean variable, such as (:known_stolen_card:).
It may combine two Boolean variables with AND or OR, such as (:large_amount: AND :from_different_country:).
Keep Part 1 string-equality behavior working.
Rules are still evaluated in order, and no matching rule means accept.
This problem asks you to build a rule engine that evaluates transaction rules in order and returns the action from the first matching rule. In Part 1, rules check string equality on transaction fields such as merchant name or card brand. In Part 2, the engine also supports Boolean fields and simple AND/OR combinations, while preserving the original string-matching behavior. The key idea is to model each rule as a condition that can be evaluated against the transaction, then scan the rules sequentially and default to accept when nothing matches.