nukturnal/mpower_ruby — pull request #2 by yawboakye (2014-12-27 10:54:52+00:00)
Title: Read total_amount as sum of all total_prices.

Added total_amount as a method on MPower::Checkout::Invoice. It sums the
total_prices of all items in the invoice. The value is calculated
everytime `invoice.total_amount` is called. Ideally it shouldn't be
called the MPower client.

In my opinion this address 2 potential problems:
- Application developers forgetting to set `total_amount`. (happened
to me)
- Application developers setting `total_amount` to a value not
consistent with total price of all items bought. In their haste,
customers may not confirm that they are paying the right price
before submitting their confirmation token. This helps prevent
potential fraud.

Tests included.