paygate-ruby 0.2.1 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -2
- data/LICENSE.txt +1 -1
- data/README.md +18 -16
- data/lib/paygate/rails/engine.rb +8 -0
- data/lib/paygate/{action_view → rails}/form_helper.rb +7 -4
- data/lib/paygate/version.rb +1 -1
- data/lib/paygate.rb +8 -7
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 582cf643e186a710575161056933e2acf18bddab848e526c8e99ff9267a71074
|
4
|
+
data.tar.gz: 119afea7817bae85ef973d540e3b423c4c79cc3bb3d26688652d1e6bb18603e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66fcb7f94b75c4b4bd91c322d078575f20fdcbbb3ac9c6b5d6a5a5db5fa4f3f0428cf422fa553018f6e67aebddac704dcc18832c3922c86350243da460352241
|
7
|
+
data.tar.gz: 76d2ccb4a692fbeeef60dc1861ce0b07c068e7c5769da03eb0464b7f0f48455b8e0279a913a2992c8631078f9c3971dec02ad60eac06d7204b4dd5d966699a03
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,13 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
-
##
|
3
|
+
## 0.2.3 - 2023-04-26
|
4
|
+
|
5
|
+
- [PR#13](https://github.com/tablecheck/paygate-ruby/pull/13) Make Rails helper functions as module_functions ([johnnyshields](https://github.com/johnnyshields))
|
6
|
+
|
7
|
+
## 0.2.2 - 2023-04-26
|
8
|
+
|
9
|
+
- [PR#12](https://github.com/tablecheck/paygate-ruby/pull/12) Re-add Rails Engine (was dropped in version 0.2.0) ([johnnyshields](https://github.com/johnnyshields))
|
10
|
+
- [PR#12](https://github.com/tablecheck/paygate-ruby/pull/12) Rename Paygate::ActionView::FormHelper to Paygate::Rails::FormHelper. ([johnnyshields](https://github.com/johnnyshields))
|
4
11
|
|
5
12
|
## 0.2.1 - 2023-04-26
|
6
13
|
|
@@ -8,7 +15,7 @@
|
|
8
15
|
|
9
16
|
## 0.2.0 - 2023-04-26
|
10
17
|
|
11
|
-
- [PR#9](https://github.com/tablecheck/paygate-ruby/pull/9) Rename Paygate::FormHelper to Paygate::
|
18
|
+
- [PR#9](https://github.com/tablecheck/paygate-ruby/pull/9) Rename Paygate::FormHelper to Paygate::ActionView::FormHelper. ([johnnyshields](https://github.com/johnnyshields))
|
12
19
|
- [PR#9](https://github.com/tablecheck/paygate-ruby/pull/9) Do not include Paygate::FormHelper in ActionView::Base. ([johnnyshields](https://github.com/johnnyshields))
|
13
20
|
- [PR#9](https://github.com/tablecheck/paygate-ruby/pull/9) Update BIN list. Note BINs can now be a flexible number of digits. ([johnnyshields](https://github.com/johnnyshields))
|
14
21
|
- [PR#9](https://github.com/tablecheck/paygate-ruby/pull/9) Rename data config YAML keys. ([johnnyshields](https://github.com/johnnyshields))
|
data/LICENSE.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c)
|
3
|
+
Copyright (c) TableCheck Inc.
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
@@ -43,29 +43,35 @@ Contents:
|
|
43
43
|
|
44
44
|
#### 1.1. Include JavaScript
|
45
45
|
|
46
|
-
|
46
|
+
Add `Paygate::Rails::FormHelper` to your controller.
|
47
47
|
|
48
|
-
```
|
49
|
-
|
48
|
+
```ruby
|
49
|
+
class ApplicationController < ActionController::Base
|
50
|
+
include Paygate::Rails::FormHelper
|
51
|
+
```
|
52
|
+
|
53
|
+
Then include the _OpenPayAPI.js_ file in `<head>` of your payment page.
|
54
|
+
|
55
|
+
```erb
|
56
|
+
<%= javascript_include_tag paygate_open_pay_api_js_url %>
|
50
57
|
```
|
51
58
|
|
52
59
|
#### 1.2 Payment form
|
53
60
|
|
54
61
|
Render the PayGate payment form in your view file.
|
55
62
|
|
56
|
-
```
|
57
|
-
|
63
|
+
```erb
|
64
|
+
<%= paygate_open_pay_api_form %>
|
58
65
|
```
|
59
66
|
|
60
67
|
You will see a form with all the necessary fields for making payment with a credit card. Some of the fields have default values set. You can also set the value and placeholder for almost all the fields while rendering the form. See example below:
|
61
68
|
|
62
|
-
```
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
)
|
69
|
+
```erb
|
70
|
+
<%= paygate_open_pay_api_form(
|
71
|
+
mid: { value: 'testmid', placeholder: 'Merchant ID' },
|
72
|
+
currency: { value: 'USD' },
|
73
|
+
amount: { value: 2000 }
|
74
|
+
) %>
|
69
75
|
```
|
70
76
|
|
71
77
|
Here is a list of all the form fields which you can set:
|
@@ -321,7 +327,3 @@ response.json
|
|
321
327
|
## Contributing
|
322
328
|
|
323
329
|
Bug reports and pull requests are welcome on GitHub at https://github.com/tablecheck/paygate-ruby.
|
324
|
-
|
325
|
-
## License
|
326
|
-
|
327
|
-
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Paygate
|
4
|
-
module
|
4
|
+
module Rails
|
5
5
|
module FormHelper
|
6
|
-
PAYGATE_FORM_TEXT_FIELDS = {
|
6
|
+
(PAYGATE_FORM_TEXT_FIELDS = {
|
7
7
|
mid: {
|
8
8
|
placeholder: 'Member ID'
|
9
9
|
},
|
@@ -117,13 +117,13 @@ module Paygate
|
|
117
117
|
|
118
118
|
profile_no: {
|
119
119
|
placeholder: 'Profile No'
|
120
|
-
},
|
120
|
+
}.freeze,
|
121
121
|
|
122
122
|
hash_result: {
|
123
123
|
name: 'hashresult',
|
124
124
|
placeholder: 'Hash Result'
|
125
125
|
}
|
126
|
-
}.freeze
|
126
|
+
}.freeze).each_value(&:freeze)
|
127
127
|
|
128
128
|
def paygate_open_pay_api_js_url
|
129
129
|
if Paygate.configuration.mode == :live
|
@@ -132,6 +132,7 @@ module Paygate
|
|
132
132
|
'https://stgapi.paygate.net/ajax/common/OpenPayAPI.js'
|
133
133
|
end
|
134
134
|
end
|
135
|
+
module_function :paygate_open_pay_api_js_url
|
135
136
|
|
136
137
|
def paygate_open_pay_api_form(options = {})
|
137
138
|
form_tag({}, name: 'PGIOForm') do
|
@@ -150,10 +151,12 @@ module Paygate
|
|
150
151
|
fields.join.html_safe
|
151
152
|
end.html_safe
|
152
153
|
end
|
154
|
+
module_function :paygate_open_pay_api_form
|
153
155
|
|
154
156
|
def paygate_open_pay_api_screen
|
155
157
|
content_tag(:div, nil, id: 'PGIOscreen')
|
156
158
|
end
|
159
|
+
module_function :paygate_open_pay_api_screen
|
157
160
|
end
|
158
161
|
end
|
159
162
|
end
|
data/lib/paygate/version.rb
CHANGED
data/lib/paygate.rb
CHANGED
@@ -9,19 +9,20 @@ require 'paygate/member'
|
|
9
9
|
require 'paygate/response'
|
10
10
|
require 'paygate/transaction'
|
11
11
|
require 'paygate/profile'
|
12
|
-
|
12
|
+
|
13
|
+
if defined?(Rails)
|
14
|
+
require 'paygate/rails/engine'
|
15
|
+
require 'paygate/rails/form_helper'
|
16
|
+
end
|
13
17
|
|
14
18
|
module Paygate
|
15
19
|
extend self
|
16
20
|
|
17
21
|
CONFIG = YAML.safe_load(File.read(File.expand_path('../data/config.yml', __dir__)),
|
18
22
|
permitted_classes: [Symbol]).freeze
|
19
|
-
LOCALES_MAP = CONFIG[:locales].freeze
|
20
|
-
|
21
|
-
|
22
|
-
INTL_BRANDS_MAP.each_value(&:freeze)
|
23
|
-
KOREA_BIN_NUMBERS = CONFIG[:korea_bin_numbers].freeze
|
24
|
-
KOREA_BIN_NUMBERS.each(&:freeze)
|
23
|
+
(LOCALES_MAP = CONFIG[:locales].freeze).each { |k, v| k.freeze; v.freeze } # rubocop:disable Style/Semicolon
|
24
|
+
(INTL_BRANDS_MAP = CONFIG[:intl_brands].freeze).each_value(&:freeze)
|
25
|
+
(KOREA_BIN_NUMBERS = CONFIG[:korea_bin_numbers].freeze).each(&:freeze)
|
25
26
|
DEFAULT_CURRENCY = 'WON'
|
26
27
|
DEFAULT_LOCALE = 'US'
|
27
28
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paygate-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jagdeepsingh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-04-
|
11
|
+
date: 2023-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -25,12 +25,13 @@ files:
|
|
25
25
|
- data/config.yml
|
26
26
|
- lib/paygate-ruby.rb
|
27
27
|
- lib/paygate.rb
|
28
|
-
- lib/paygate/action_view/form_helper.rb
|
29
28
|
- lib/paygate/aes.rb
|
30
29
|
- lib/paygate/aes_ctr.rb
|
31
30
|
- lib/paygate/configuration.rb
|
32
31
|
- lib/paygate/member.rb
|
33
32
|
- lib/paygate/profile.rb
|
33
|
+
- lib/paygate/rails/engine.rb
|
34
|
+
- lib/paygate/rails/form_helper.rb
|
34
35
|
- lib/paygate/response.rb
|
35
36
|
- lib/paygate/transaction.rb
|
36
37
|
- lib/paygate/version.rb
|