bygpay 0.2.3 → 0.2.4
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/.travis.yml +6 -1
- data/CHANGELOG.md +5 -1
- data/README.md +6 -19
- data/bygpay.gemspec +2 -0
- data/lib/bygpay/byg_response.rb +4 -0
- data/lib/bygpay/deposit/card.rb +2 -4
- data/lib/bygpay/deposit/mobile.rb +9 -5
- data/lib/bygpay/deposits.rb +2 -0
- data/lib/bygpay/utils.rb +4 -3
- data/lib/bygpay/version.rb +1 -1
- data/lib/bygpay/withdraw/mobile.rb +3 -10
- data/lib/bygpay/withdrawals.rb +7 -1
- metadata +31 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 476dae06f05d44825808c2615b0d5246e14d1cef
|
4
|
+
data.tar.gz: 23a341f51de1fd9fb0cd5afe258e46809289d2fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf8222521ad9896c74e0af9e904d7f73f3751fec4a96907539e94f0d2b6778b7757135de49fcc57840368d04dd08d60505f70fde5e4298c4bd7cbfbb456e2a69
|
7
|
+
data.tar.gz: 8c1d417f28e03680b94c93c11c49f247eb837f41d5c3f320eb92dc656ded3595a5c68aa1775857303c167453157e31eaf1575acc3d9b86431b0a0f23f95ebccc
|
data/.travis.yml
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
addons:
|
2
|
+
code_climate:
|
3
|
+
repo_token: ea1ac3f76e7689a49786a2b7d8fa8ace6ef3f87f7c00825fed66ca6cc22dc4be
|
4
|
+
after_success:
|
5
|
+
- bundle exec codeclimate-test-reporter
|
1
6
|
sudo: false
|
2
7
|
language: ruby
|
3
8
|
rvm:
|
@@ -6,4 +11,4 @@ rvm:
|
|
6
11
|
- 2.2.0
|
7
12
|
- 2.1.0
|
8
13
|
- 2.0.0
|
9
|
-
before_install: gem install bundler -v 1.14.6
|
14
|
+
before_install: gem install bundler -v 1.14.6
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
[](https://badge.fury.io/rb/bygpay) [](https://codeclimate.com/github/nukturnal/bygpay) [](https://codebeat.co/projects/github-com-nukturnal-bygpay-master) [](https://www.codacy.com/app/nukturnal/bygpay?utm_source=github.com&utm_medium=referral&utm_content=nukturnal/bygpay&utm_campaign=Badge_Grade) [](https://travis-ci.org/nukturnal/bygpay_ruby)
|
1
|
+
[](https://badge.fury.io/rb/bygpay) [](https://codeclimate.com/github/nukturnal/bygpay) [](https://codeclimate.com/github/nukturnal/bygpay/coverage) [](https://codeclimate.com/github/nukturnal/bygpay) [](https://codebeat.co/projects/github-com-nukturnal-bygpay-master) [](https://www.codacy.com/app/nukturnal/bygpay?utm_source=github.com&utm_medium=referral&utm_content=nukturnal/bygpay&utm_campaign=Badge_Grade) [](https://travis-ci.org/nukturnal/bygpay_ruby)
|
2
2
|
|
3
3
|
# Bygpay Ruby SDK
|
4
4
|
|
@@ -32,6 +32,7 @@ Bygpay.configure do |config|
|
|
32
32
|
# Optional Configurations (Every code below this line)
|
33
33
|
# (In case you've changed routes in your Bygpay Installation)
|
34
34
|
config.deposit_mobile_path = '/deposits/mobile'
|
35
|
+
config.deposit_card_path = '/deposits/card'
|
35
36
|
config.deposit_status_overide_path = '/deposits/status-overide'
|
36
37
|
config.deposit_status_path = '/deposits'
|
37
38
|
|
@@ -64,6 +65,7 @@ mobile_payload = {
|
|
64
65
|
walletno: '0244124550',
|
65
66
|
provider: 'MTN',
|
66
67
|
currency: 'USD', # optional
|
68
|
+
token: '23571', # Optional (Only required for Vodafone Payments)
|
67
69
|
extrnx_code: nil # optional
|
68
70
|
}
|
69
71
|
result = deposit.charge(1.99, mobile_payload)
|
@@ -77,21 +79,6 @@ else
|
|
77
79
|
end
|
78
80
|
```
|
79
81
|
|
80
|
-
Query Transaction status
|
81
|
-
```ruby
|
82
|
-
# Checking transaction status
|
83
|
-
# You always need the transaction UUID to get status response
|
84
|
-
deposit = Bygpay::Deposit::Mobile.new
|
85
|
-
result = deposit.transaction_status('e81216aa-9ef7-4c5c-aed0-6e5ff1fe')
|
86
|
-
if result
|
87
|
-
puts deposit.uuid # need uuid to check transacion status
|
88
|
-
puts deposit.status # accepted, :pending, :fail, :success
|
89
|
-
puts deposit.transaction_id
|
90
|
-
else
|
91
|
-
puts deposit.response_text
|
92
|
-
puts deposit.status
|
93
|
-
end
|
94
|
-
```
|
95
82
|
#### Debit/Credit Card
|
96
83
|
|
97
84
|
Supports VISA, MasterCard and any other cards based on the processors available on Bygpay Gateway. This is a onetime transaction and immediate response is the final status of the transaction. However transaction status request is still available
|
@@ -126,7 +113,7 @@ Query Transaction status
|
|
126
113
|
```ruby
|
127
114
|
# Checking transaction status
|
128
115
|
# You always need the transaction UUID to get status response
|
129
|
-
deposit = Bygpay::
|
116
|
+
deposit = Bygpay::Deposits.new
|
130
117
|
result = deposit.transaction_status('e81216aa-9ef7-4c5c-aed0-6e5ff1fe')
|
131
118
|
if result
|
132
119
|
puts deposit.uuid
|
@@ -147,7 +134,7 @@ Currently SDK supports MTN, AIRTEL, TIGO, VODAFONE, you may refer to your Bygpay
|
|
147
134
|
```ruby
|
148
135
|
# Making a Mobile Money Withdrawal Request
|
149
136
|
withdraw = Bygpay::Withdraw::Mobile.new
|
150
|
-
result = withdraw.
|
137
|
+
result = withdraw.sendmoney(1.99,{walletno: '0244124550', provider: 'MTN'})
|
151
138
|
if result
|
152
139
|
puts withdraw.uuid
|
153
140
|
puts withdraw.status # accepted, :pending, :fail, :success
|
@@ -162,7 +149,7 @@ Query Transaction status
|
|
162
149
|
```ruby
|
163
150
|
# Checking transaction status
|
164
151
|
# You always need the transaction UUID to get status response
|
165
|
-
withdraw = Bygpay::
|
152
|
+
withdraw = Bygpay::Withdrawals.new
|
166
153
|
result = withdraw.transaction_status('e81216aa-9ef7-4c5c-aed0-6e5ff1fe')
|
167
154
|
if result
|
168
155
|
puts withdraw.uuid
|
data/bygpay.gemspec
CHANGED
@@ -24,6 +24,8 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_development_dependency "bundler", "~> 1.14"
|
25
25
|
spec.add_development_dependency "rake", "~> 10.0"
|
26
26
|
spec.add_development_dependency "rspec", "~> 3.0"
|
27
|
+
spec.add_development_dependency "simplecov"
|
28
|
+
spec.add_development_dependency "codeclimate-test-reporter", "~> 1.0.0"
|
27
29
|
spec.add_dependency "http", "~> 2.0"
|
28
30
|
spec.add_dependency "hashie", "~> 3.5.5"
|
29
31
|
end
|
data/lib/bygpay/byg_response.rb
CHANGED
data/lib/bygpay/deposit/card.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
module Bygpay
|
2
2
|
module Deposit
|
3
3
|
class Card < Bygpay::Deposits
|
4
|
-
|
5
4
|
# {
|
6
5
|
# "card_number" : "4111111111111111",
|
7
6
|
# "amount": 1.00,
|
@@ -13,9 +12,8 @@ module Bygpay
|
|
13
12
|
# }
|
14
13
|
# Perform a Bankcard debit request
|
15
14
|
def charge(amount, card_data = {})
|
16
|
-
post(card_deposit_endpoint, card_data.merge(
|
15
|
+
post(card_deposit_endpoint, card_data.merge(amount: amount))
|
17
16
|
end
|
18
|
-
|
19
17
|
end
|
20
18
|
end
|
21
|
-
end
|
19
|
+
end
|
@@ -2,16 +2,20 @@ module Bygpay
|
|
2
2
|
module Deposit
|
3
3
|
class Mobile < Bygpay::Deposits
|
4
4
|
|
5
|
+
# Perform a mobile deposit request
|
6
|
+
# @param amount [Decimal]
|
7
|
+
# @param mobile_data [Hash]
|
8
|
+
# mobile data example
|
5
9
|
# {
|
6
10
|
# "walletno" : "0276967627",
|
7
11
|
# "provider": "TIGO",
|
8
|
-
# "currency": "USD",
|
9
|
-
# "
|
12
|
+
# "currency": "USD", # Optional
|
13
|
+
# "token": "393902", # Optional (Only Required for Vodafone Payments)
|
14
|
+
# "extrnx_code": null # Optional
|
10
15
|
# }
|
11
|
-
# Perform a mobile deposit request
|
12
16
|
def charge(amount, mobile_data = {})
|
13
|
-
post(mobile_deposit_endpoint, mobile_data.merge(
|
17
|
+
post(mobile_deposit_endpoint, mobile_data.merge(amount: amount))
|
14
18
|
end
|
15
19
|
end
|
16
20
|
end
|
17
|
-
end
|
21
|
+
end
|
data/lib/bygpay/deposits.rb
CHANGED
data/lib/bygpay/utils.rb
CHANGED
@@ -3,7 +3,7 @@ require 'http'
|
|
3
3
|
module Bygpay
|
4
4
|
module Utils
|
5
5
|
attr_accessor :status, :response_text, :transaction_id,
|
6
|
-
:uuid, :result, :response
|
6
|
+
:uuid, :result, :response, :amount
|
7
7
|
|
8
8
|
# Mobile Deposit transactions endpoint
|
9
9
|
def mobile_deposit_endpoint
|
@@ -50,9 +50,10 @@ module Bygpay
|
|
50
50
|
def parse_response(json_payload)
|
51
51
|
@response = Bygpay::BygResponse.parse_response(json_payload)
|
52
52
|
resp = @response.data
|
53
|
-
@transaction_id =
|
53
|
+
@transaction_id = @response.transaction_id
|
54
54
|
@response_text = resp.message
|
55
|
-
@uuid =
|
55
|
+
@uuid = @response.uuid
|
56
|
+
@amount = @response.amount
|
56
57
|
@status = @response.transaction_status
|
57
58
|
@result = @response.request_successful?
|
58
59
|
end
|
data/lib/bygpay/version.rb
CHANGED
@@ -1,22 +1,15 @@
|
|
1
1
|
module Bygpay
|
2
2
|
module Withdraw
|
3
3
|
class Mobile < Bygpay::Withdrawals
|
4
|
-
|
5
4
|
# {
|
6
5
|
# "walletno" : "0276967627",
|
7
6
|
# "provider": "TIGO",
|
8
7
|
# "extrnx_code": null
|
9
8
|
# }
|
10
9
|
# Perform a mobile deposit request
|
11
|
-
def
|
12
|
-
post(mobile_withdraw_endpoint, payload.merge(
|
10
|
+
def sendmoney(amount, payload = {})
|
11
|
+
post(mobile_withdraw_endpoint, payload.merge(amount: amount))
|
13
12
|
end
|
14
|
-
|
15
|
-
# Return deposit transaction status
|
16
|
-
def transaction_status(uuid)
|
17
|
-
get_status(withdraw_status_endpoint,uuid)
|
18
|
-
end
|
19
|
-
|
20
13
|
end
|
21
14
|
end
|
22
|
-
end
|
15
|
+
end
|
data/lib/bygpay/withdrawals.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bygpay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alfred Rowe
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,34 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: simplecov
|
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: codeclimate-test-reporter
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.0.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.0.0
|
55
83
|
- !ruby/object:Gem::Dependency
|
56
84
|
name: http
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -129,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
129
157
|
version: '0'
|
130
158
|
requirements: []
|
131
159
|
rubyforge_project:
|
132
|
-
rubygems_version: 2.6.
|
160
|
+
rubygems_version: 2.6.13
|
133
161
|
signing_key:
|
134
162
|
specification_version: 4
|
135
163
|
summary: Bygpay Payment Gateway Ruby SDK
|