π Hi there! The description you are currently reading is just 2nd part of the problem set. It is highly recommended to read ALL THE PARTS before coding as parts may build on top of each other π³
The initial version of our system looks good ππ! But it turns out merchants also need to be able to update the amount of initialized Payment Intents. This happen if a customer begins to check out but then decides to change the items in their shopping cart π and thus the amount of the payment. Let's add that the our system π»!
Commands
Your system should support an additional command for updaing a Payment Intent.
UPDATE <payment_intent_id> <new amount>
qοΎβ’βκ°α 𧑠Credit to Rachel π§‘ΰ»κ±β⒠qοΎ
Example 1:
Input: commands = ["INIT m1 0", "CREATE p1 m1 50", "UPDATE p1 100", "ATTEMPT p1", "SUCCEED p1"]
Output: ["m1 100"]
Explanation:While the Payment Intent p1 was initially created with an amount of 50, this was then updated to 100 before being attempted then succeeded. Therefore, merchant m1 has a balance of 100 after all commands have been processed.
π«Ά
input:
output: