bygpay 0.2.7 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -6
- data/bygpay.gemspec +1 -3
- data/lib/bygpay/byg_response.rb +10 -1
- data/lib/bygpay/configuration.rb +6 -1
- data/lib/bygpay/deposit/card.rb +0 -1
- data/lib/bygpay/deposit/express_pay.rb +20 -0
- data/lib/bygpay/deposit/hubtel.rb +21 -0
- data/lib/bygpay/deposit/paystack.rb +20 -0
- data/lib/bygpay/deposit/rave.rb +20 -0
- data/lib/bygpay/utils.rb +19 -1
- data/lib/bygpay/version.rb +1 -1
- data/lib/bygpay.rb +4 -0
- metadata +12 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 526e3b00c45bf2a6e92dba46d79c42a30d7ed63cbd07609d681ffd0c9607fdd3
|
4
|
+
data.tar.gz: e95a6b5972136e9df49515d0587aa2a178af1e63cda792a6c4a428e9e93a9c39
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a51f5a5aff19f62339f654fefd34584105b296454f7f9657421458c28b7b5e42330eac8449a13b80fbcdc26f50c0910458a4ac5b5af8cf8f338461fbf1311c09
|
7
|
+
data.tar.gz: feff812ebb777b48b9f9eaf87cc4eb0f0e012cf09aba47e328dab1f905d6e744168743d576623ee2261b38f4a80645b8914301a0af4a927d137a166526b5a247
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
[![Gem Version](https://badge.fury.io/rb/bygpay.svg)](https://badge.fury.io/rb/bygpay) [![Code Climate](https://codeclimate.com/github/nukturnal/bygpay_ruby/badges/gpa.svg)](https://codeclimate.com/github/nukturnal/bygpay_ruby) [![
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/bygpay.svg)](https://badge.fury.io/rb/bygpay) [![Code Climate](https://codeclimate.com/github/nukturnal/bygpay_ruby/badges/gpa.svg)](https://codeclimate.com/github/nukturnal/bygpay_ruby) [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fnukturnal%2Fbygpay_ruby.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fnukturnal%2Fbygpay_ruby?ref=badge_shield) [![Issue Count](https://codeclimate.com/github/nukturnal/bygpay_ruby/badges/issue_count.svg)](https://codeclimate.com/github/nukturnal/bygpay_ruby) [![codebeat badge](https://codebeat.co/badges/f32a71e8-3b38-4f6f-9018-07fa503e487e)](https://codebeat.co/projects/github-com-nukturnal-bygpay_ruby-master) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/7425ac54e6484723a5482a92fc7f35ef)](https://www.codacy.com/app/nukturnal/bygpay_ruby?utm_source=github.com&utm_medium=referral&utm_content=nukturnal/bygpay_ruby&utm_campaign=Badge_Grade) [![Build Status](https://travis-ci.org/nukturnal/bygpay_ruby.svg?branch=master)](https://travis-ci.org/nukturnal/bygpay_ruby)
|
2
2
|
|
3
3
|
# Bygpay Ruby SDK
|
4
4
|
|
@@ -66,7 +66,8 @@ mobile_payload = {
|
|
66
66
|
provider: 'MTN',
|
67
67
|
currency: 'USD', # optional
|
68
68
|
token: '23571', # Optional (Only required for Vodafone Payments)
|
69
|
-
extrnx_code: nil # optional
|
69
|
+
extrnx_code: nil, # optional
|
70
|
+
meta_data: { name: "Alfred Rowe" } # pass an optional arbitary meta_data which will be returned later
|
70
71
|
}
|
71
72
|
result = deposit.charge(1.99, mobile_payload)
|
72
73
|
if result
|
@@ -96,7 +97,8 @@ card_data = {
|
|
96
97
|
cvv: 123,
|
97
98
|
country: 'GH', # Optional country ISO code
|
98
99
|
currency: 'USD', # Optional currency ISO code
|
99
|
-
card_name: 'Gifty Cobbinah' # Optional Card Hold Name
|
100
|
+
card_name: 'Gifty Cobbinah', # Optional Card Hold Name
|
101
|
+
meta_data: { store: "Gifty's Thrifts" } # pass an optional arbitary meta_data which will be returned later
|
100
102
|
}
|
101
103
|
result = deposit.charge(1.99, card_data)
|
102
104
|
if result
|
@@ -119,6 +121,7 @@ if result
|
|
119
121
|
puts deposit.uuid
|
120
122
|
puts deposit.status # accepted, :pending, :fail, :success
|
121
123
|
puts deposit.transaction_id
|
124
|
+
puts deposit.meta_data # retrieve meta_data
|
122
125
|
else
|
123
126
|
puts deposit.response_text
|
124
127
|
puts deposit.status
|
@@ -175,6 +178,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/nuktur
|
|
175
178
|
## License
|
176
179
|
|
177
180
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
178
|
-
|
179
|
-
|
180
|
-
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fnukturnal%2Fbygpay_ruby.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fnukturnal%2Fbygpay_ruby?ref=badge_large)
|
data/bygpay.gemspec
CHANGED
@@ -22,11 +22,9 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
23
|
spec.require_paths = ["lib"]
|
24
24
|
|
25
|
-
spec.add_development_dependency "bundler"
|
26
|
-
spec.add_development_dependency "rake"
|
27
25
|
spec.add_development_dependency "rspec", "~> 3.0"
|
28
26
|
spec.add_development_dependency "simplecov"
|
29
27
|
spec.add_development_dependency "codeclimate-test-reporter", "~> 1.0.0"
|
30
|
-
spec.add_dependency "http", "~> 4.1
|
28
|
+
spec.add_dependency "http", "~> 4.4.1"
|
31
29
|
spec.add_dependency "hashie", "~> 3.6.0"
|
32
30
|
end
|
data/lib/bygpay/byg_response.rb
CHANGED
@@ -57,6 +57,14 @@ module Bygpay
|
|
57
57
|
data.data.provider
|
58
58
|
end
|
59
59
|
|
60
|
+
def redirect_link
|
61
|
+
data.data.redirect_url
|
62
|
+
end
|
63
|
+
|
64
|
+
def meta_data
|
65
|
+
data.data.meta_data
|
66
|
+
end
|
67
|
+
|
60
68
|
# Hash strucuture
|
61
69
|
# {
|
62
70
|
# "status": "success",
|
@@ -70,7 +78,8 @@ module Bygpay
|
|
70
78
|
# "extrnx_code": null,
|
71
79
|
# "walletno": "0276967627",
|
72
80
|
# "amount": 0.1,
|
73
|
-
# "provider": "TIGO"
|
81
|
+
# "provider": "TIGO",
|
82
|
+
# "meta_data": { "key": "value" }
|
74
83
|
# }
|
75
84
|
# }
|
76
85
|
# This may throw JSON::ParserError if the json_payload is not valid JSON.
|
data/lib/bygpay/configuration.rb
CHANGED
@@ -3,7 +3,8 @@ module Bygpay
|
|
3
3
|
attr_accessor :base_url, :api_key,
|
4
4
|
:deposit_mobile_path, :deposit_status_overide_path, :deposit_status_path,
|
5
5
|
:withdraw_mobile_path, :withdraw_status_overide_path, :withdraw_status_path,
|
6
|
-
:deposit_card_path
|
6
|
+
:deposit_card_path, :deposit_rave_path, :deposit_expresspay_path,
|
7
|
+
:deposit_paystack_path, :deposit_hubtel_path
|
7
8
|
|
8
9
|
def initialize
|
9
10
|
@base_url = nil
|
@@ -11,6 +12,10 @@ module Bygpay
|
|
11
12
|
|
12
13
|
# Preset default paths but allow for changes
|
13
14
|
@deposit_mobile_path = '/deposits/mobile'
|
15
|
+
@deposit_rave_path = '/deposits/rave-redirect'
|
16
|
+
@deposit_paystack_path = '/deposits/paystack'
|
17
|
+
@deposit_hubtel_path = '/deposits/hubtel'
|
18
|
+
@deposit_expresspay_path = '/deposits/expresspay'
|
14
19
|
@deposit_card_path = '/deposits/card'
|
15
20
|
@deposit_status_overide_path = '/deposits/status-overide'
|
16
21
|
@deposit_status_path = '/deposits'
|
data/lib/bygpay/deposit/card.rb
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
module Bygpay
|
2
|
+
module Deposit
|
3
|
+
class ExpressPay < Bygpay::Deposits
|
4
|
+
# {
|
5
|
+
# "customer_email" : "james.bolie@gmail.com",
|
6
|
+
# "customer_phone": null,
|
7
|
+
# "customer_firstname": null,
|
8
|
+
# "customer_lastname": null,
|
9
|
+
# "custom_logo": null,
|
10
|
+
# "country": "GH",
|
11
|
+
# "currency": "GHS",
|
12
|
+
# "redirect_url": "URL"
|
13
|
+
# }
|
14
|
+
# Perform ExpressPay Checkout Transaction
|
15
|
+
def charge(amount, payload = {})
|
16
|
+
post(expresspay_deposit_endpoint, payload.merge(amount: amount))
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Bygpay
|
2
|
+
module Deposit
|
3
|
+
class Hubtel < Bygpay::Deposits
|
4
|
+
# {
|
5
|
+
# "customer_email" : "james.bolie@gmail.com",
|
6
|
+
# "customer_phone": null,
|
7
|
+
# "customer_firstname": null,
|
8
|
+
# "customer_lastname": null,
|
9
|
+
# "custom_logo": null,
|
10
|
+
# "country": "GH",
|
11
|
+
# "currency": "GHS",
|
12
|
+
# "redirect_url": "URL"
|
13
|
+
# "description": "Payment info"
|
14
|
+
# }
|
15
|
+
# Perform Hubtel Checkout Transaction
|
16
|
+
def charge(amount, payload = {})
|
17
|
+
post(hubtel_deposit_endpoint, payload.merge(amount: amount))
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Bygpay
|
2
|
+
module Deposit
|
3
|
+
class Paystack < Bygpay::Deposits
|
4
|
+
# {
|
5
|
+
# "customer_email" : "james.bolie@gmail.com",
|
6
|
+
# "customer_phone": null,
|
7
|
+
# "customer_firstname": null,
|
8
|
+
# "customer_lastname": null,
|
9
|
+
# "custom_logo": null,
|
10
|
+
# "country": "GH",
|
11
|
+
# "currency": "GHS",
|
12
|
+
# "redirect_url": "URL"
|
13
|
+
# }
|
14
|
+
# Perform ExpressPay Checkout Transaction
|
15
|
+
def charge(amount, payload = {})
|
16
|
+
post(paystack_deposit_endpoint, payload.merge(amount: amount))
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Bygpay
|
2
|
+
module Deposit
|
3
|
+
class Rave < Bygpay::Deposits
|
4
|
+
# {
|
5
|
+
# "customer_email" : "james.bolie@gmail.com",
|
6
|
+
# "customer_phone": null,
|
7
|
+
# "customer_firstname": null,
|
8
|
+
# "customer_lastname": null,
|
9
|
+
# "custom_title": null,
|
10
|
+
# "custom_logo": null,
|
11
|
+
# "country": "GH",
|
12
|
+
# "currency": "GHS"
|
13
|
+
# }
|
14
|
+
# Perform a RaveRedirect Transaction
|
15
|
+
def charge(amount, payload = {})
|
16
|
+
post(rave_deposit_endpoint, payload.merge(amount: amount))
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/bygpay/utils.rb
CHANGED
@@ -3,13 +3,30 @@ require 'http'
|
|
3
3
|
module Bygpay
|
4
4
|
module Utils
|
5
5
|
attr_accessor :status, :response_text, :transaction_id,
|
6
|
-
:uuid, :result, :response, :amount
|
6
|
+
:uuid, :result, :response, :amount, :meta_data
|
7
7
|
|
8
8
|
# Mobile Deposit transactions endpoint
|
9
9
|
def mobile_deposit_endpoint
|
10
10
|
Bygpay.configuration.deposit_mobile_path
|
11
11
|
end
|
12
12
|
|
13
|
+
# Rave Deposit transactions endpoint
|
14
|
+
def rave_deposit_endpoint
|
15
|
+
Bygpay.configuration.deposit_rave_path
|
16
|
+
end
|
17
|
+
|
18
|
+
def expresspay_deposit_endpoint
|
19
|
+
Bygpay.configuration.deposit_expresspay_path
|
20
|
+
end
|
21
|
+
|
22
|
+
def paystack_deposit_endpoint
|
23
|
+
Bygpay.configuration.deposit_paystack_path
|
24
|
+
end
|
25
|
+
|
26
|
+
def hubtel_deposit_endpoint
|
27
|
+
Bygpay.configuration.deposit_hubtel_path
|
28
|
+
end
|
29
|
+
|
13
30
|
# Mobile Deposit transactions endpoint
|
14
31
|
def card_deposit_endpoint
|
15
32
|
Bygpay.configuration.deposit_card_path
|
@@ -54,6 +71,7 @@ module Bygpay
|
|
54
71
|
@response_text = resp.message
|
55
72
|
@uuid = @response.uuid
|
56
73
|
@amount = @response.amount
|
74
|
+
@meta_data = @response.meta_data
|
57
75
|
@status = @response.transaction_status
|
58
76
|
@result = @response.request_successful?
|
59
77
|
end
|
data/lib/bygpay/version.rb
CHANGED
data/lib/bygpay.rb
CHANGED
@@ -5,6 +5,10 @@ require 'bygpay/utils'
|
|
5
5
|
require 'bygpay/deposits'
|
6
6
|
require 'bygpay/deposit/mobile'
|
7
7
|
require 'bygpay/deposit/card'
|
8
|
+
require 'bygpay/deposit/rave'
|
9
|
+
require 'bygpay/deposit/express_pay'
|
10
|
+
require 'bygpay/deposit/paystack'
|
11
|
+
require 'bygpay/deposit/hubtel'
|
8
12
|
require 'bygpay/withdrawals'
|
9
13
|
require 'bygpay/withdraw/mobile'
|
10
14
|
|
metadata
CHANGED
@@ -1,43 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bygpay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alfred Rowe
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-05-28 00:00:00.000000000 Z
|
12
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: '0'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
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
13
|
- !ruby/object:Gem::Dependency
|
42
14
|
name: rspec
|
43
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,14 +58,14 @@ dependencies:
|
|
86
58
|
requirements:
|
87
59
|
- - "~>"
|
88
60
|
- !ruby/object:Gem::Version
|
89
|
-
version: 4.1
|
61
|
+
version: 4.4.1
|
90
62
|
type: :runtime
|
91
63
|
prerelease: false
|
92
64
|
version_requirements: !ruby/object:Gem::Requirement
|
93
65
|
requirements:
|
94
66
|
- - "~>"
|
95
67
|
- !ruby/object:Gem::Version
|
96
|
-
version: 4.1
|
68
|
+
version: 4.4.1
|
97
69
|
- !ruby/object:Gem::Dependency
|
98
70
|
name: hashie
|
99
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -131,7 +103,11 @@ files:
|
|
131
103
|
- lib/bygpay/byg_response.rb
|
132
104
|
- lib/bygpay/configuration.rb
|
133
105
|
- lib/bygpay/deposit/card.rb
|
106
|
+
- lib/bygpay/deposit/express_pay.rb
|
107
|
+
- lib/bygpay/deposit/hubtel.rb
|
134
108
|
- lib/bygpay/deposit/mobile.rb
|
109
|
+
- lib/bygpay/deposit/paystack.rb
|
110
|
+
- lib/bygpay/deposit/rave.rb
|
135
111
|
- lib/bygpay/deposits.rb
|
136
112
|
- lib/bygpay/utils.rb
|
137
113
|
- lib/bygpay/version.rb
|
@@ -141,7 +117,7 @@ homepage: https://github.com/nukturnal/bygpay_ruby
|
|
141
117
|
licenses:
|
142
118
|
- MIT
|
143
119
|
metadata: {}
|
144
|
-
post_install_message:
|
120
|
+
post_install_message:
|
145
121
|
rdoc_options: []
|
146
122
|
require_paths:
|
147
123
|
- lib
|
@@ -156,8 +132,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
156
132
|
- !ruby/object:Gem::Version
|
157
133
|
version: '0'
|
158
134
|
requirements: []
|
159
|
-
rubygems_version: 3.
|
160
|
-
signing_key:
|
135
|
+
rubygems_version: 3.3.14
|
136
|
+
signing_key:
|
161
137
|
specification_version: 4
|
162
138
|
summary: Bygpay Payment Gateway Ruby SDK
|
163
139
|
test_files: []
|