webpay_interswitch 1.1.1 → 1.1.2
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.
@@ -3,10 +3,11 @@ module WebpayInterswitch
|
|
3
3
|
|
4
4
|
include WebpayInterswitch::Core
|
5
5
|
|
6
|
-
def initialize(txn_ref, amount, html_options)
|
6
|
+
def initialize(txn_ref, amount, html_options, optional_parameters)
|
7
7
|
@txn_ref = txn_ref
|
8
8
|
@amount = amount
|
9
9
|
@html_options = html_options
|
10
|
+
@optional_parameters = optional_parameters
|
10
11
|
sanitize_options
|
11
12
|
end
|
12
13
|
|
@@ -17,12 +18,13 @@ module WebpayInterswitch
|
|
17
18
|
|
18
19
|
form_html += generate_transaction_data_elements
|
19
20
|
|
21
|
+
form_html += generate_optional_parameter_elements
|
22
|
+
|
20
23
|
# This generates the submit button alongwith the @submit_button_text
|
21
24
|
# If submit_button_text is not provided, it defaults to 'Make Payment'
|
22
25
|
form_html += generate_input_field('commit', @submit_button_text, 'submit', @html_options)
|
23
26
|
|
24
27
|
form_html += '</form>'
|
25
|
-
|
26
28
|
end
|
27
29
|
|
28
30
|
def valid?
|
@@ -45,6 +47,12 @@ module WebpayInterswitch
|
|
45
47
|
txn_elem_html += generate_input_field('hash', sha_hash(string_for_hash_param))
|
46
48
|
end
|
47
49
|
|
50
|
+
def generate_optional_parameter_elements
|
51
|
+
@optional_parameters.collect do |field_name, field_value|
|
52
|
+
generate_input_field(field_name, field_value)
|
53
|
+
end.join('<br />')
|
54
|
+
end
|
55
|
+
|
48
56
|
# Generates the input tag alongwith the provided name, value, type and html_options if any.
|
49
57
|
def generate_input_field(name, value, type = 'hidden', html_options={})
|
50
58
|
html_string = string_for_html_options(html_options)
|
@@ -78,4 +86,4 @@ module WebpayInterswitch
|
|
78
86
|
end
|
79
87
|
|
80
88
|
end
|
81
|
-
end
|
89
|
+
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module WebpayInterswitch
|
2
2
|
module ViewHelper
|
3
3
|
|
4
|
-
def form_for_webpay(txn_ref, amount, html_options={})
|
5
|
-
form_builder = WebpayInterswitch::FormBuilder.new(txn_ref, amount, html_options)
|
4
|
+
def form_for_webpay(txn_ref, amount, html_options={}, optional_parameters={})
|
5
|
+
form_builder = WebpayInterswitch::FormBuilder.new(txn_ref, amount, html_options, optional_parameters)
|
6
6
|
WebpayInterswitch::Gateway.new.validate!
|
7
7
|
form_builder.generate_webpay_form.html_safe if form_builder.valid?
|
8
8
|
end
|
data/templates/webpay.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
## This should be placed at config/initializers of your Rails app.
|
2
|
+
|
3
|
+
WebpayInterswitch::Gateway.setup do |config|
|
4
|
+
|
5
|
+
gateway_attrs = YAML.load_file(File.join("#{Rails.root}", 'config', 'webpay_interswitch.yml'))['webpay'][Rails.env].symbolize_keys!
|
6
|
+
config.product_id = gateway_attrs[:product_id]
|
7
|
+
config.pay_item_id = gateway_attrs[:pay_item_id]
|
8
|
+
config.currency = gateway_attrs[:currency]
|
9
|
+
config.site_redirect_url = gateway_attrs[:site_redirect_url]
|
10
|
+
config.mac_key = gateway_attrs[:mac_key]
|
11
|
+
config.test = gateway_attrs[:test]
|
12
|
+
|
13
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
$:.push File.expand_path('../lib', __FILE__)
|
2
|
+
|
3
|
+
require 'webpay_interswitch/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = 'webpay_interswitch'
|
7
|
+
s.version = WebpayInterswitch::VERSION
|
8
|
+
s.authors = ['Shubham Gupta', 'Jitender Rai']
|
9
|
+
s.email = ['info@vinsol.com']
|
10
|
+
s.homepage = 'http://vinsol.com'
|
11
|
+
s.files = `git ls-files`.split($/)
|
12
|
+
s.summary = 'A simple gem to integrate your Rails app with Webpay Interswitch, a nigerian payment gateway'
|
13
|
+
s.description = 'A simple gem to integrate Rails app with Webpay Interswitch, a nigerian payment gateway'
|
14
|
+
s.license = 'MIT'
|
15
|
+
|
16
|
+
s.add_dependency('rails')
|
17
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webpay_interswitch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-
|
13
|
+
date: 2015-08-26 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -28,7 +28,7 @@ dependencies:
|
|
28
28
|
- - ">="
|
29
29
|
- !ruby/object:Gem::Version
|
30
30
|
version: '0'
|
31
|
-
description: A simple gem to integrate
|
31
|
+
description: A simple gem to integrate Rails app with Webpay Interswitch, a nigerian
|
32
32
|
payment gateway
|
33
33
|
email:
|
34
34
|
- info@vinsol.com
|
@@ -36,15 +36,18 @@ executables: []
|
|
36
36
|
extensions: []
|
37
37
|
extra_rdoc_files: []
|
38
38
|
files:
|
39
|
-
-
|
39
|
+
- README.md
|
40
40
|
- lib/generators/webpay_interswitch/install_generator.rb
|
41
|
-
- lib/webpay_interswitch
|
41
|
+
- lib/webpay_interswitch.rb
|
42
|
+
- lib/webpay_interswitch/core.rb
|
42
43
|
- lib/webpay_interswitch/form_builder.rb
|
43
44
|
- lib/webpay_interswitch/gateway.rb
|
44
|
-
- lib/webpay_interswitch/
|
45
|
+
- lib/webpay_interswitch/transaction_query.rb
|
45
46
|
- lib/webpay_interswitch/version.rb
|
46
47
|
- lib/webpay_interswitch/view_helper.rb
|
47
|
-
-
|
48
|
+
- templates/webpay.rb
|
49
|
+
- templates/webpay_interswitch.yml.example
|
50
|
+
- webpay_interswitch.gemspec
|
48
51
|
homepage: http://vinsol.com
|
49
52
|
licenses:
|
50
53
|
- MIT
|