Note: you will have to do part one before part two however, we strongly recommend…
- User
Note: you will have to do part one before part two however, we strongly recommend reading both parts before starting the problem as part two is an extension of part one. All test cases will not pass until both part one and part two are completed. Part One Stripe processes charges on behalf of a merchant, takes a fee for processing the charges, and later sends the remaining funds to the merchant. The sending of funds to a merchant is referred to as a "payout" . Payouts can only be sent in the currencies of the merchant's bank accounts. Therefore, if the merchant processes charges in a currency that they don't have a bank account for, Stripe has to exchange (FX) the funds to the bank account currency first. For example, my online t-shirt business has expanded from the U.S. to parts of Europe so l allow my European customers to pay in Euro (€). However, I still only have a bank account in U.S. Dollars ($) where Stripe sends me the funds from my business sales. Therefore Stripe will exchange any Euro charges to U.S. Dollars before sending a payout to my U.S. Dollar bank account.Complete the function calculate_payouts: when the parameter part is "part_one" it should print out the total amount the merchant will be paid out per bank account currency, given a list of charges this merchant has processed. Input calculate_payouts has the following parameters: part: a string, dictating which part of the question to do, equal to either "part_one" or "part_two" . For this part it will equal "part_one". bank_account_currencies: an array of strings, representing the currencies the merchant has bank accounts in. charges: an array of strings, representing charges the merchant has processed on Stripe. Charges will be in chronological order of when they were processed. Note: depending on the language you choose, the function signature of calculate_payouts may also provide the size of the arrays. Format of the strings in the array charges Each value in charges is a comma separated string in the format date, amount, currency where If you need to exchange between two currencies where one isn't USD, you can still use this conversion chart to calculate the exchange rate. For example, I need to exchange 10 EUR to GBP. 10 EUR = 10.5 USD = 8.47 GBP. Stripe fee • Stripe takes a fixed fee per charge, 2%. This is taken from the original charge amount. Output Print the total amount the merchant will be paid out in each currency, each line in the format currency, amount, e.g. "EUR, 100". Final amounts should be rounded to the nearest whole number in the currency's smallest denomination and should be printed in alphabetical order of currency - do not round any amounts until printing the final output. • Example Case Input part="part_one" bank_account_currencies=["USD", "CHF"] charges= [ "2022-01-01, 100, USD" , "2022-01-01, 200 , USD", "2022-01-01, 200, CHF" "2022-01-01, 100, EUR", ]* Output CHF, 196 USD, 397 Explanation The merchant has bank accounts in USD and CHF. Their default bank account is in USD, so any charges that were not in USD or CHF will be converted to USD. CHF payout: 200 CHF - 2% Stripe fee = 196 CHF (1.96 Swiss Francs) USD payout: (100 USD - 2% Stripe fee) + (200 USD
- Assistant