mpesa_connect 0.1.2 → 0.1.3
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 +4 -4
- data/README.md +27 -0
- data/lib/mpesa_connect/version.rb +1 -1
- metadata +2 -3
- data/lib/security_credentials.rb +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b85c5b30cce8857a2c1f51f3d8e786eca50ff72c
|
4
|
+
data.tar.gz: 5907659d3a32961c0c0a206cd7fdbc8b0ad9a63d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34473a9542d59a2c51547ed044ec13da924e652bf8527c7e41082676f4fd5c18e5764d633b00ce362a569ac90b96fa4ed70462c66ddf85d2aac524da39cd2a11
|
7
|
+
data.tar.gz: 588c4168a76d7dface6f92d885929f074a123f93a59410d1d6e0bbc4cb12b31dd0798bdd18a4830e3b1648fada03ce92e02b031d91daf358731959c791617ce8
|
data/README.md
CHANGED
@@ -76,6 +76,33 @@ Salary Payment
|
|
76
76
|
client.b2c_transaction(initiator, amount, party_a, party_b)
|
77
77
|
```
|
78
78
|
|
79
|
+
### C2B Transaction
|
80
|
+
|
81
|
+
first you need to setup the following
|
82
|
+
|
83
|
+
- `ConfirmationURL` : Validation URL for the client
|
84
|
+
- `ValidationURL` : Confirmation URL for the client
|
85
|
+
- `ResponseType` : Cancelled | Completed
|
86
|
+
- `ShortCode` : The short code of the organization.
|
87
|
+
|
88
|
+
|
89
|
+
setup the required urls
|
90
|
+
```ruby
|
91
|
+
client.set_urls(nil, nil, confirmation_url, validation_url)
|
92
|
+
```
|
93
|
+
|
94
|
+
Register URL
|
95
|
+
|
96
|
+
```ruby
|
97
|
+
client.c2b_register_url(shortcode, response_type)
|
98
|
+
```
|
99
|
+
|
100
|
+
Simulate Transaction
|
101
|
+
|
102
|
+
```ruby
|
103
|
+
client.c2b_transaction(shortcode, amount, msisdn, bill_reference)
|
104
|
+
```
|
105
|
+
|
79
106
|
## Development
|
80
107
|
|
81
108
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mpesa_connect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mboya
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -176,7 +176,6 @@ files:
|
|
176
176
|
- lib/mpesa_connect/access_token.rb
|
177
177
|
- lib/mpesa_connect/security_credentials.rb
|
178
178
|
- lib/mpesa_connect/version.rb
|
179
|
-
- lib/security_credentials.rb
|
180
179
|
- mpesa_connect.gemspec
|
181
180
|
homepage: https://mboya.github.io/mpesa_connect/
|
182
181
|
licenses:
|
data/lib/security_credentials.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'pry'
|
2
|
-
require 'pry-nav'
|
3
|
-
require 'openssl'
|
4
|
-
|
5
|
-
module MpesaConnect
|
6
|
-
class SecurityCredentials
|
7
|
-
|
8
|
-
def initialize security_cred
|
9
|
-
@security_cred = security_cred
|
10
|
-
end
|
11
|
-
|
12
|
-
def encrypt_security_cred
|
13
|
-
byte_array = @security_cred.bytes.to_a.to_s
|
14
|
-
key_file = "lib/pubkey.pem"
|
15
|
-
public_key = File.read(key_file)
|
16
|
-
ssl = OpenSSL::PKey::RSA.new(public_key)
|
17
|
-
|
18
|
-
encrypted_string = Base64.encode64(ssl.public_encrypt(byte_array)).split("\n").join
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
22
|
-
end
|