← 返回 stripe 的题目列表Parse Transaction CSV and Calculate Fees
类型:online_judge
Problem Statement
You are given a CSV string containing multiple transactions, each with fields like transaction status, amount, payment provider, buyer country, etc. You need to parse the string and calculate fees based on the transaction status and details.
Requirements
Parse the CSV string to extract information for each transaction.
Calculate fees based on payment provider, buyer country, and other details for each transaction.
Only for transactions with status "completed", use exchange rates for fee calculation among different countries.
Refund fees are not considered; all other transaction statuses use the logic from part one.
Input
A CSV string representing multiple transactions, formatted as follows: timestamp,transaction_status,amount,payment_provider,buyer_country
Output
Calculated fees for each transaction, returned or output in a specific format.
Example
Input:
"2023-10-20,payment_completed,100,visa,US\n2023-10-21,payment_pending,50,mastercard,DE"
Output:
"2023-10-20: $fee1\n2023-10-21: $fee2"
Where fee1 and fee2 are the fees calculated based on the given rules.
Example
Input
"2023-10-20,payment_completed,100,visa,US\n2023-10-21,payment_pending,50,mastercard,DE"
Output
"2023-10-20: $3.20\n2023-10-21: $1.75"