We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Processing Orders

Management thinks our branding is so creative that our SaaS customers will pay for Textio merch.

Assignment

Complete the placeOrder function.

It returns a bool indicating whether the order was successful (true is a success) and a float64 representing the user's balance after the order. The placeOrder function should always return the account balance regardless of whether it was adjusted.

The amountInStock and calcPrice functions can be used to look up the current stock and price of an item.

  • If the quantity is greater than the amount in stock, the order should be rejected.
  • If the user doesn't have enough money in their account, the order should be rejected.
  • Otherwise, the order should be accepted and you should return the new balance.