mobile-money 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/.idea/.name +1 -0
- data/.idea/.rakeTasks +7 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/lib/mobile-money/pesapal.rb +76 -0
- data/lib/mobile-money/version.rb +5 -0
- data/lib/mobile-money.rb +2 -0
- data/mobile-money.gemspec +26 -0
- data/spec/pesapal_spec.rb +7 -0
- data/spec/spec_helper.rb +1 -0
- metadata +131 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: f0df9fa5343dfd2804b576c7f9420715e06dfb5b
|
|
4
|
+
data.tar.gz: f7c949927b673b75b8b2603120d25d9f7331a03a
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 3fb9527d2fbcb6190ef43cf7f308d5aafb037083f5f118b9f7b16a349644eaf0e70a90161c0e7d076998af050636ff77e31a0de2a59c0b93d8095322fe55e2b8
|
|
7
|
+
data.tar.gz: 3eeaa8db8dd1b049e939b78551f4da2cd248beb1b84c9cfd863983bbba93e7d9e2d05c53e54d20d292460b3b0d6b430a0f3ff196e43f8dec40004c64612f4bdd
|
data/.gitignore
ADDED
data/.idea/.name
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
MobileMoney
|
data/.idea/.rakeTasks
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<Settings><!--This file was automatically generated by Ruby plugin.
|
|
3
|
+
You are allowed to:
|
|
4
|
+
1. Remove rake task
|
|
5
|
+
2. Add existing rake tasks
|
|
6
|
+
To add existing rake tasks automatically delete this file and reload the project.
|
|
7
|
+
--><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build MobileMoney-0.0.1.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Build and install MobileMoney-0.0.1.gem into system gems" fullCmd="install" taksId="install" /><RakeTask description="Create tag v0.0.1 and build and push MobileMoney-0.0.1.gem to Rubygems" fullCmd="release" taksId="release" /></RakeGroup></Settings>
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2014 Bernard Banta
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# MobileMoney
|
|
2
|
+
|
|
3
|
+
TODO: Write a gem description
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add this line to your application's Gemfile:
|
|
8
|
+
|
|
9
|
+
gem 'MobileMoney'
|
|
10
|
+
|
|
11
|
+
And then execute:
|
|
12
|
+
|
|
13
|
+
$ bundle
|
|
14
|
+
|
|
15
|
+
Or install it yourself as:
|
|
16
|
+
|
|
17
|
+
$ gem install MobileMoney
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
TODO: Write usage instructions here
|
|
22
|
+
|
|
23
|
+
## Contributing
|
|
24
|
+
|
|
25
|
+
1. Fork it
|
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require "bundler/gem_tasks"
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
module Pesapal
|
|
2
|
+
class OrderUrl
|
|
3
|
+
|
|
4
|
+
require 'oauth'
|
|
5
|
+
require 'uri'
|
|
6
|
+
require 'active_support/core_ext/object/to_query'
|
|
7
|
+
require 'htmlentities'
|
|
8
|
+
|
|
9
|
+
attr_reader :post_data_xml, :callback_url, :token, :test
|
|
10
|
+
|
|
11
|
+
HTTP_METHOD = 'get'
|
|
12
|
+
API_ACTION = '/API/PostPesapalDirectOrderV4'
|
|
13
|
+
|
|
14
|
+
def initialize(post_data_xml, callback_url, test=true)
|
|
15
|
+
@post_data_xml = post_data_xml
|
|
16
|
+
@callback_url = callback_url
|
|
17
|
+
@token = nil
|
|
18
|
+
@test = test
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def api_domain
|
|
22
|
+
test ? 'http://demo.pesapal.com' : 'https://www.pesapal.com'
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def url
|
|
26
|
+
"#{api_domain}#{signed_request.path}"
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def consumer
|
|
30
|
+
@consumer ||= begin
|
|
31
|
+
OAuth::Consumer.new(consumer_key, consumer_secret, {
|
|
32
|
+
site: api_domain,
|
|
33
|
+
http_method: HTTP_METHOD,
|
|
34
|
+
scheme: :query_string
|
|
35
|
+
})
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def consumer_key
|
|
40
|
+
Rails.application.secrets.pesapal_consumer_key
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def consumer_secret
|
|
44
|
+
Rails.application.secrets.pesapal_consumer_secret
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def signed_request
|
|
48
|
+
consumer.create_signed_request HTTP_METHOD, request_url, nil, {}, params
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def request_url
|
|
52
|
+
API_ACTION + "?" + params_to_string
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def params
|
|
57
|
+
@params ||= {
|
|
58
|
+
'oauth_callback' => callback_url,
|
|
59
|
+
'pesapal_request_data' => escaped_xml,
|
|
60
|
+
}
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def params_to_string
|
|
64
|
+
strings = []
|
|
65
|
+
params.each do |key, value|
|
|
66
|
+
strings << "#{key}=#{CGI::escape(value)}"
|
|
67
|
+
end
|
|
68
|
+
strings.join('&')
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def escaped_xml
|
|
72
|
+
HTMLEntities.new.encode(post_data_xml)
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
end
|
data/lib/mobile-money.rb
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'mobile-money/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "mobile-money"
|
|
8
|
+
spec.version = Mobile::Money::VERSION
|
|
9
|
+
spec.authors = ["Bernard Banta"]
|
|
10
|
+
spec.email = ["banta.bernard@gmail.com"]
|
|
11
|
+
spec.description = %q{This gem integrates with mobile money services in Kenya. The services include Kopo-Kopo and PesaPal}
|
|
12
|
+
spec.summary = %q{This gem integrates with mobile money services in Kenya. The services include Kopo-Kopo and PesaPal}
|
|
13
|
+
spec.homepage = ""
|
|
14
|
+
spec.license = "MIT"
|
|
15
|
+
|
|
16
|
+
spec.files = `git ls-files`.split($/)
|
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
19
|
+
spec.require_paths = ["lib"]
|
|
20
|
+
|
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
|
22
|
+
spec.add_development_dependency "rake"
|
|
23
|
+
spec.add_development_dependency 'rspec'
|
|
24
|
+
spec.add_development_dependency 'oauth'
|
|
25
|
+
spec.add_dependency 'htmlentities'
|
|
26
|
+
end
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require '../lib/MobileMoney/pesapal'
|
metadata
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: mobile-money
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.2.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Bernard Banta
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2014-04-26 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ~>
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.3'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ~>
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.3'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - '>='
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - '>='
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rspec
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - '>='
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - '>='
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: oauth
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - '>='
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - '>='
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: htmlentities
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - '>='
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '0'
|
|
76
|
+
type: :runtime
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - '>='
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '0'
|
|
83
|
+
description: This gem integrates with mobile money services in Kenya. The services
|
|
84
|
+
include Kopo-Kopo and PesaPal
|
|
85
|
+
email:
|
|
86
|
+
- banta.bernard@gmail.com
|
|
87
|
+
executables: []
|
|
88
|
+
extensions: []
|
|
89
|
+
extra_rdoc_files: []
|
|
90
|
+
files:
|
|
91
|
+
- .gitignore
|
|
92
|
+
- .idea/.name
|
|
93
|
+
- .idea/.rakeTasks
|
|
94
|
+
- Gemfile
|
|
95
|
+
- LICENSE.txt
|
|
96
|
+
- README.md
|
|
97
|
+
- Rakefile
|
|
98
|
+
- lib/mobile-money.rb
|
|
99
|
+
- lib/mobile-money/pesapal.rb
|
|
100
|
+
- lib/mobile-money/version.rb
|
|
101
|
+
- mobile-money.gemspec
|
|
102
|
+
- spec/pesapal_spec.rb
|
|
103
|
+
- spec/spec_helper.rb
|
|
104
|
+
homepage: ''
|
|
105
|
+
licenses:
|
|
106
|
+
- MIT
|
|
107
|
+
metadata: {}
|
|
108
|
+
post_install_message:
|
|
109
|
+
rdoc_options: []
|
|
110
|
+
require_paths:
|
|
111
|
+
- lib
|
|
112
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
113
|
+
requirements:
|
|
114
|
+
- - '>='
|
|
115
|
+
- !ruby/object:Gem::Version
|
|
116
|
+
version: '0'
|
|
117
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
|
+
requirements:
|
|
119
|
+
- - '>='
|
|
120
|
+
- !ruby/object:Gem::Version
|
|
121
|
+
version: '0'
|
|
122
|
+
requirements: []
|
|
123
|
+
rubyforge_project:
|
|
124
|
+
rubygems_version: 2.0.7
|
|
125
|
+
signing_key:
|
|
126
|
+
specification_version: 4
|
|
127
|
+
summary: This gem integrates with mobile money services in Kenya. The services include
|
|
128
|
+
Kopo-Kopo and PesaPal
|
|
129
|
+
test_files:
|
|
130
|
+
- spec/pesapal_spec.rb
|
|
131
|
+
- spec/spec_helper.rb
|