Part 1: Given a CSV transaction string, return a CSV string containing id, transaction_type, payment_provider, and fee. Calculate payment, refund, and dispute fees using the fixed rules.
Part 2: Update payment fees so their variable rate depends on payment_provider and buyer_country; if no rate exists, fall back to Part 1’s 2.1% rate. Dispute rules remain unchanged.
This problem asks you to parse a CSV list of transactions, compute fees for each row, and output the result as a new CSV. In Part 1, payment, refund, and dispute transactions follow fixed fee rules, so the core work is mapping each transaction type to the correct calculation and formatting the output consistently. In Part 2, payment fees become more dynamic: the rate depends on both payment_provider and buyer_country, with a fallback to the original 2.1% when no specific rate applies. The key techniques are CSV parsing, dictionary-based rule lookup, conditional logic, and careful string reconstruction.