mpower 1.0.9 → 1.0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +12 -0
- data/Gemfile +1 -1
- data/README.md +31 -2
- data/lib/mpower/checkout/redirect_invoice.rb +1 -1
- data/lib/mpower/version.rb +1 -1
- data/mpower.gemspec +1 -0
- metadata +19 -2
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
[![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/nukturnal/mpower_ruby)
|
2
2
|
|
3
|
-
#
|
4
|
-
|
3
|
+
# Mpower Ruby Client API
|
4
|
+
========================
|
5
5
|
MPower Payments Ruby Client Library
|
6
6
|
|
7
|
+
## Offical Documentation
|
8
|
+
http://mpowerpayments.com/developers/docs/ruby.html
|
9
|
+
|
7
10
|
## Installation
|
8
11
|
|
9
12
|
Add this line to your application's Gemfile:
|
@@ -53,6 +56,10 @@ When a returnURL is not set, MPower will redirect the customer to the receipt pa
|
|
53
56
|
|
54
57
|
co = MPower::Checkout::Invoice.new
|
55
58
|
|
59
|
+
## Create your Onsite Payment Request Invoice
|
60
|
+
|
61
|
+
co = MPower::Onsite::Invoice.new
|
62
|
+
|
56
63
|
Params for addItem function `add_item(name_of_item,quantity,unit_price,total_price,optional_description)`
|
57
64
|
|
58
65
|
co.add_item("13' Apple Retina 500 HDD",1,999.99,999.99)
|
@@ -82,6 +89,28 @@ Params for addItem function `add_item(name_of_item,quantity,unit_price,total_pri
|
|
82
89
|
@message = co.response_text
|
83
90
|
end
|
84
91
|
|
92
|
+
## Onsite Payment Request(OPR) Charge
|
93
|
+
First step is to take the customers mpower account alias, this could be the phoneno, username or mpower account number.
|
94
|
+
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.
|
95
|
+
|
96
|
+
if co.create("CUSTOMER_MPOWER_USERNAME_OR_PHONE")
|
97
|
+
@opr_token = co.token
|
98
|
+
else
|
99
|
+
@message = co.response_text
|
100
|
+
end
|
101
|
+
|
102
|
+
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.
|
103
|
+
|
104
|
+
if co.charge("OPR_TOKEN","CUSTOMER_CONFIRM_TOKEN")
|
105
|
+
@receipt = co.receipt_url
|
106
|
+
@customer_name = co.customer['name']
|
107
|
+
else
|
108
|
+
@message = co.response_text
|
109
|
+
end
|
110
|
+
|
111
|
+
## Download MPower RubyOnRails Demo
|
112
|
+
https://github.com/nukturnal/MPower_Rails_Demo
|
113
|
+
|
85
114
|
## Contributing
|
86
115
|
|
87
116
|
1. Fork it
|
@@ -62,7 +62,7 @@ module MPower
|
|
62
62
|
|
63
63
|
def confirm(token)
|
64
64
|
result = http_get_request("#{MPower::Setup.checkout_confirm_base_url}#{token}")
|
65
|
-
|
65
|
+
unless result.size > 0
|
66
66
|
@response_text = "Invoice Not Found"
|
67
67
|
@response_code = 1002
|
68
68
|
@status = MPower::FAIL
|
data/lib/mpower/version.rb
CHANGED
data/mpower.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mpower
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.10
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-11-
|
12
|
+
date: 2012-11-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|
@@ -75,6 +75,22 @@ dependencies:
|
|
75
75
|
- - ! '>='
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: rake
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ~>
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0.9'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0.9'
|
78
94
|
description: Ruby library for integrating with the MPower Gateway
|
79
95
|
email:
|
80
96
|
- alfred@ncodedevlabs.com
|
@@ -83,6 +99,7 @@ extensions: []
|
|
83
99
|
extra_rdoc_files: []
|
84
100
|
files:
|
85
101
|
- .gitignore
|
102
|
+
- .travis.yml
|
86
103
|
- Gemfile
|
87
104
|
- LICENSE.txt
|
88
105
|
- README.md
|