README.md in mpower-1.0.9 vs README.md in mpower-1.0.10
- old
+ new
@@ -1,11 +1,14 @@
[![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/nukturnal/mpower_ruby)
-# MpowerRuby
-
+# Mpower Ruby Client API
+========================
MPower Payments Ruby Client Library
+## Offical Documentation
+http://mpowerpayments.com/developers/docs/ruby.html
+
## Installation
Add this line to your application's Gemfile:
gem 'mpower'
@@ -51,10 +54,14 @@
## Create your Checkout Invoice
co = MPower::Checkout::Invoice.new
+## Create your Onsite Payment Request Invoice
+
+ co = MPower::Onsite::Invoice.new
+
Params for addItem function `add_item(name_of_item,quantity,unit_price,total_price,optional_description)`
co.add_item("13' Apple Retina 500 HDD",1,999.99,999.99)
co.add_item("Case Logic laptop Bag",2,100.50,201,"My optional item description")
co.add_item("Mordecai's Bag",2,100.50,400)
@@ -79,9 +86,31 @@
if co.create
redirect_to co.invoice_url
else
@message = co.response_text
end
+
+## Onsite Payment Request(OPR) Charge
+First step is to take the customers mpower account alias, this could be the phoneno, username or mpower account number.
+pass this as a param for the `create` action of the `MPower::Onsite::Invoice` class instance. MPower will return an OPR TOKEN after the request is successfull. The customer will also receieve a confirmation TOKEN.
+
+ if co.create("CUSTOMER_MPOWER_USERNAME_OR_PHONE")
+ @opr_token = co.token
+ else
+ @message = co.response_text
+ end
+
+Second step requires you to accept the confirmation TOKEN from the customer, add your OPR Token and issue the charge. Upon successfull charge you should be able to access the digital receipt URL and other objects outlined in the offical docs.
+
+ if co.charge("OPR_TOKEN","CUSTOMER_CONFIRM_TOKEN")
+ @receipt = co.receipt_url
+ @customer_name = co.customer['name']
+ else
+ @message = co.response_text
+ end
+
+## Download MPower RubyOnRails Demo
+https://github.com/nukturnal/MPower_Rails_Demo
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)