veritrans 2.0.4 → 2.1.0
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/.gitignore +2 -1
- data/.travis.yml +11 -3
- data/CHANGELOG.md +15 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +136 -97
- data/Procfile +1 -0
- data/README.md +12 -5
- data/Rakefile +7 -5
- data/api_reference.md +21 -1
- data/example/README.md +8 -0
- data/example/config.ru +6 -0
- data/example/index.erb +104 -9
- data/example/localization.erb +248 -0
- data/example/points.erb +187 -0
- data/example/recurring.erb +201 -0
- data/example/response.erb +10 -1
- data/example/sinatra.rb +120 -8
- data/example/style.css +83 -2
- data/example/veritrans.yml +0 -1
- data/example/widget.erb +52 -0
- data/lib/generators/templates/assets/credit_card_form.js +3 -2
- data/lib/generators/templates/payments_controller.rb +5 -0
- data/lib/generators/templates/veritrans.rb +20 -17
- data/lib/generators/veritrans/install_generator.rb +1 -1
- data/lib/generators/veritrans/payment_form_generator.rb +1 -1
- data/lib/veritrans.rb +73 -44
- data/lib/veritrans/api.rb +39 -5
- data/lib/veritrans/cli.rb +1 -1
- data/lib/veritrans/client.rb +15 -10
- data/lib/veritrans/config.rb +11 -4
- data/lib/veritrans/events.rb +4 -4
- data/lib/veritrans/result.rb +28 -7
- data/lib/veritrans/version.rb +2 -2
- data/spec/cli_spec.rb +1 -0
- data/spec/rails_plugin_spec.rb +72 -27
- data/spec/spec_helper.rb +1 -0
- data/spec/veritrans_client_spec.rb +57 -3
- data/spec/veritrans_config_spec.rb +1 -1
- data/spec/veritrans_events_spec.rb +2 -0
- data/spec/veritrans_snap_spec.rb +39 -0
- data/testing_webhooks.md +0 -2
- data/veritrans.gemspec +5 -5
- metadata +29 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b793647405fbf0445648ea2ea9def74ed8396c0a
|
4
|
+
data.tar.gz: d40b25e0abe559a4d2a2314d3b46ef8efefa97df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17c8354877faa0b5e75df829c59fdd2a8e2c05a3256d07d710589338a157c8b03f64410e36b4f51b6eb2f5a25aa600b12ff5f7c33204f849852a9008ce4be846
|
7
|
+
data.tar.gz: cf8a7fa7afcc7082c23cf8f6ac4db13f0a48dc92d9b5a15d86bcce36b23bac9903f3b33052e79161c9551027ca47876f2087068bfb032e0be1eea59f4fd47286
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
### Version 2.1.0 (date 12 Aug 2016)
|
2
|
+
|
3
|
+
* Add support for rails 5
|
4
|
+
* Add Snap API and example
|
5
|
+
* Add support to create multiple instance of client
|
6
|
+
* Increase timeout to 120 seconds
|
7
|
+
* Fix network exception handling
|
8
|
+
* Add missing require 'logger'
|
9
|
+
* Add validation for payment_id argument
|
10
|
+
* Improve VT-Web example
|
11
|
+
* Add example for recurring (1 clck / 2 click)
|
12
|
+
* Add example for Indonesian validation messages
|
13
|
+
* Add Credit Card Points example
|
14
|
+
* Deploy example in heroku
|
15
|
+
|
1
16
|
### Version 2.0.4 (date: 30 Nov 2015)
|
2
17
|
|
3
18
|
* Show warning when can not find section in veritrans.yml
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,138 +1,169 @@
|
|
1
|
+
GIT
|
2
|
+
remote: git://github.com/sinatra/rack-protection.git
|
3
|
+
revision: 7e723a74763bb83989d1249cdceb9cceb2ee6f01
|
4
|
+
specs:
|
5
|
+
rack-protection (2.0.0)
|
6
|
+
rack
|
7
|
+
|
8
|
+
GIT
|
9
|
+
remote: git://github.com/sinatra/sinatra.git
|
10
|
+
revision: 285275b42fa1bf096a5c9559b6cead2f31b65b66
|
11
|
+
specs:
|
12
|
+
sinatra (2.0.0.pre.alpha)
|
13
|
+
mustermann (~> 0.4)
|
14
|
+
rack (~> 2.0)
|
15
|
+
rack-protection (~> 2.0)
|
16
|
+
tilt (~> 2.0)
|
17
|
+
|
1
18
|
PATH
|
2
19
|
remote: .
|
3
20
|
specs:
|
4
|
-
veritrans (2.0.
|
21
|
+
veritrans (2.0.4)
|
5
22
|
excon (~> 0.20)
|
6
23
|
|
7
24
|
GEM
|
8
25
|
remote: https://rubygems.org/
|
9
26
|
specs:
|
10
|
-
|
11
|
-
actionpack (=
|
12
|
-
|
13
|
-
|
27
|
+
actioncable (5.0.0.1)
|
28
|
+
actionpack (= 5.0.0.1)
|
29
|
+
nio4r (~> 1.2)
|
30
|
+
websocket-driver (~> 0.6.1)
|
31
|
+
actionmailer (5.0.0.1)
|
32
|
+
actionpack (= 5.0.0.1)
|
33
|
+
actionview (= 5.0.0.1)
|
34
|
+
activejob (= 5.0.0.1)
|
14
35
|
mail (~> 2.5, >= 2.5.4)
|
15
|
-
rails-dom-testing (~>
|
16
|
-
actionpack (
|
17
|
-
actionview (=
|
18
|
-
activesupport (=
|
19
|
-
rack (~>
|
20
|
-
rack-test (~> 0.6.
|
21
|
-
rails-dom-testing (~>
|
22
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.
|
23
|
-
actionview (
|
24
|
-
activesupport (=
|
36
|
+
rails-dom-testing (~> 2.0)
|
37
|
+
actionpack (5.0.0.1)
|
38
|
+
actionview (= 5.0.0.1)
|
39
|
+
activesupport (= 5.0.0.1)
|
40
|
+
rack (~> 2.0)
|
41
|
+
rack-test (~> 0.6.3)
|
42
|
+
rails-dom-testing (~> 2.0)
|
43
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
44
|
+
actionview (5.0.0.1)
|
45
|
+
activesupport (= 5.0.0.1)
|
25
46
|
builder (~> 3.1)
|
26
47
|
erubis (~> 2.7.0)
|
27
|
-
rails-dom-testing (~>
|
28
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.
|
29
|
-
activejob (
|
30
|
-
activesupport (=
|
31
|
-
globalid (>= 0.3.
|
32
|
-
activemodel (
|
33
|
-
activesupport (=
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
48
|
+
rails-dom-testing (~> 2.0)
|
49
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
50
|
+
activejob (5.0.0.1)
|
51
|
+
activesupport (= 5.0.0.1)
|
52
|
+
globalid (>= 0.3.6)
|
53
|
+
activemodel (5.0.0.1)
|
54
|
+
activesupport (= 5.0.0.1)
|
55
|
+
activerecord (5.0.0.1)
|
56
|
+
activemodel (= 5.0.0.1)
|
57
|
+
activesupport (= 5.0.0.1)
|
58
|
+
arel (~> 7.0)
|
59
|
+
activesupport (5.0.0.1)
|
60
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
40
61
|
i18n (~> 0.7)
|
41
|
-
json (~> 1.7, >= 1.7.7)
|
42
62
|
minitest (~> 5.1)
|
43
|
-
thread_safe (~> 0.3, >= 0.3.4)
|
44
63
|
tzinfo (~> 1.1)
|
45
|
-
addressable (2.
|
46
|
-
arel (
|
64
|
+
addressable (2.4.0)
|
65
|
+
arel (7.1.1)
|
47
66
|
builder (3.2.2)
|
48
|
-
capybara (2.
|
67
|
+
capybara (2.7.1)
|
68
|
+
addressable
|
49
69
|
mime-types (>= 1.16)
|
50
70
|
nokogiri (>= 1.3.3)
|
51
71
|
rack (>= 1.0.0)
|
52
72
|
rack-test (>= 0.5.4)
|
53
73
|
xpath (~> 2.0)
|
54
74
|
cliver (0.3.2)
|
55
|
-
|
75
|
+
concurrent-ruby (1.0.2)
|
76
|
+
crack (0.4.3)
|
56
77
|
safe_yaml (~> 1.0.0)
|
57
78
|
diff-lcs (1.2.5)
|
58
79
|
erubis (2.7.0)
|
59
|
-
excon (0.
|
60
|
-
globalid (0.3.
|
80
|
+
excon (0.51.0)
|
81
|
+
globalid (0.3.7)
|
61
82
|
activesupport (>= 4.1.0)
|
62
|
-
|
83
|
+
hashdiff (0.3.0)
|
63
84
|
i18n (0.7.0)
|
64
|
-
|
65
|
-
loofah (2.0.1)
|
85
|
+
loofah (2.0.3)
|
66
86
|
nokogiri (>= 1.5.9)
|
67
|
-
mail (2.6.
|
68
|
-
mime-types (>= 1.16, <
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
87
|
+
mail (2.6.4)
|
88
|
+
mime-types (>= 1.16, < 4)
|
89
|
+
method_source (0.8.2)
|
90
|
+
mime-types (3.1)
|
91
|
+
mime-types-data (~> 3.2015)
|
92
|
+
mime-types-data (3.2016.0521)
|
93
|
+
mini_portile2 (2.1.0)
|
94
|
+
minitest (5.9.0)
|
95
|
+
mustermann (0.4.0)
|
96
|
+
tool (~> 0.2)
|
97
|
+
nio4r (1.2.1)
|
98
|
+
nokogiri (1.6.8)
|
99
|
+
mini_portile2 (~> 2.1.0)
|
100
|
+
pkg-config (~> 1.1.7)
|
101
|
+
pkg-config (1.1.7)
|
102
|
+
poltergeist (1.10.0)
|
76
103
|
capybara (~> 2.1)
|
77
104
|
cliver (~> 0.3.1)
|
78
|
-
multi_json (~> 1.0)
|
79
105
|
websocket-driver (>= 0.2.0)
|
80
|
-
|
106
|
+
puma (3.6.0)
|
107
|
+
rack (2.0.1)
|
81
108
|
rack-test (0.6.3)
|
82
109
|
rack (>= 1.0)
|
83
|
-
rails (
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
110
|
+
rails (5.0.0.1)
|
111
|
+
actioncable (= 5.0.0.1)
|
112
|
+
actionmailer (= 5.0.0.1)
|
113
|
+
actionpack (= 5.0.0.1)
|
114
|
+
actionview (= 5.0.0.1)
|
115
|
+
activejob (= 5.0.0.1)
|
116
|
+
activemodel (= 5.0.0.1)
|
117
|
+
activerecord (= 5.0.0.1)
|
118
|
+
activesupport (= 5.0.0.1)
|
91
119
|
bundler (>= 1.3.0, < 2.0)
|
92
|
-
railties (=
|
93
|
-
sprockets-rails
|
94
|
-
rails-
|
95
|
-
activesupport (>= 4.2.0.
|
96
|
-
rails-dom-testing (1.0.5)
|
97
|
-
activesupport (>= 4.2.0.beta, < 5.0)
|
120
|
+
railties (= 5.0.0.1)
|
121
|
+
sprockets-rails (>= 2.0.0)
|
122
|
+
rails-dom-testing (2.0.1)
|
123
|
+
activesupport (>= 4.2.0, < 6.0)
|
98
124
|
nokogiri (~> 1.6.0)
|
99
|
-
|
100
|
-
rails-html-sanitizer (1.0.1)
|
125
|
+
rails-html-sanitizer (1.0.3)
|
101
126
|
loofah (~> 2.0)
|
102
|
-
railties (
|
103
|
-
actionpack (=
|
104
|
-
activesupport (=
|
127
|
+
railties (5.0.0.1)
|
128
|
+
actionpack (= 5.0.0.1)
|
129
|
+
activesupport (= 5.0.0.1)
|
130
|
+
method_source
|
105
131
|
rake (>= 0.8.7)
|
106
132
|
thor (>= 0.18.1, < 2.0)
|
107
|
-
rake (
|
108
|
-
rspec (
|
109
|
-
rspec-core (~>
|
110
|
-
rspec-expectations (~>
|
111
|
-
rspec-mocks (~>
|
112
|
-
rspec-core (
|
113
|
-
|
114
|
-
|
115
|
-
|
133
|
+
rake (11.2.2)
|
134
|
+
rspec (3.5.0)
|
135
|
+
rspec-core (~> 3.5.0)
|
136
|
+
rspec-expectations (~> 3.5.0)
|
137
|
+
rspec-mocks (~> 3.5.0)
|
138
|
+
rspec-core (3.5.2)
|
139
|
+
rspec-support (~> 3.5.0)
|
140
|
+
rspec-expectations (3.5.0)
|
141
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
142
|
+
rspec-support (~> 3.5.0)
|
143
|
+
rspec-mocks (3.5.0)
|
144
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
145
|
+
rspec-support (~> 3.5.0)
|
146
|
+
rspec-support (3.5.0)
|
116
147
|
safe_yaml (1.0.4)
|
117
|
-
sprockets (
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
activesupport (>= 3.0)
|
125
|
-
sprockets (>= 2.8, < 4.0)
|
148
|
+
sprockets (3.7.0)
|
149
|
+
concurrent-ruby (~> 1.0)
|
150
|
+
rack (> 1, < 3)
|
151
|
+
sprockets-rails (3.1.1)
|
152
|
+
actionpack (>= 4.0)
|
153
|
+
activesupport (>= 4.0)
|
154
|
+
sprockets (>= 3.0.0)
|
126
155
|
thor (0.19.1)
|
127
|
-
thread_safe (0.3.
|
128
|
-
tilt (
|
156
|
+
thread_safe (0.3.5)
|
157
|
+
tilt (2.0.5)
|
158
|
+
tool (0.2.3)
|
129
159
|
tzinfo (1.2.2)
|
130
160
|
thread_safe (~> 0.1)
|
131
|
-
vcr (
|
132
|
-
webmock (1.
|
161
|
+
vcr (3.0.3)
|
162
|
+
webmock (2.1.0)
|
133
163
|
addressable (>= 2.3.6)
|
134
164
|
crack (>= 0.3.2)
|
135
|
-
|
165
|
+
hashdiff
|
166
|
+
websocket-driver (0.6.4)
|
136
167
|
websocket-extensions (>= 0.1.0)
|
137
168
|
websocket-extensions (0.1.2)
|
138
169
|
xpath (2.0.0)
|
@@ -142,9 +173,17 @@ PLATFORMS
|
|
142
173
|
ruby
|
143
174
|
|
144
175
|
DEPENDENCIES
|
145
|
-
poltergeist (~> 1.
|
146
|
-
|
147
|
-
|
148
|
-
|
176
|
+
poltergeist (~> 1.8)
|
177
|
+
puma
|
178
|
+
rack-protection!
|
179
|
+
rails (< 6)
|
180
|
+
rake
|
181
|
+
rspec
|
182
|
+
sinatra!
|
183
|
+
tilt
|
184
|
+
vcr (~> 3.0)
|
149
185
|
veritrans!
|
150
|
-
webmock (
|
186
|
+
webmock (>= 1.20)
|
187
|
+
|
188
|
+
BUNDLED WITH
|
189
|
+
1.12.5
|
data/Procfile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
web: bundle exec puma -p $PORT --dir example config.ru
|
data/README.md
CHANGED
@@ -30,6 +30,9 @@ development:
|
|
30
30
|
server_key: # your api client key
|
31
31
|
```
|
32
32
|
|
33
|
+
See out example sinatra application in [example](https://github.com/veritrans/veritrans-ruby/tree/master/example) folder or [online](https://veritrans-ruby-example.herokuapp.com/)
|
34
|
+
|
35
|
+
|
33
36
|
## STEP 1: Process credit cards
|
34
37
|
|
35
38
|
|
@@ -252,11 +255,15 @@ Veritrans.setup do
|
|
252
255
|
config.client_key = "..."
|
253
256
|
|
254
257
|
events.subscribe('payment.success') do |payment|
|
255
|
-
|
258
|
+
# payment variable is hash with params recieved from Veritrans
|
259
|
+
# assuming you have model Order in your project
|
260
|
+
Order.find_by(order_id: payment.order_id).mark_paid!(payment.masked_card)
|
256
261
|
end
|
257
262
|
|
258
263
|
events.subscribe('payment.failed', 'payment.challenge') do |payment|
|
259
|
-
|
264
|
+
# payment variable is hash with params recieved from Veritrans
|
265
|
+
# assuming you have model Order in your project
|
266
|
+
Order.find_by(order_id: payment.order_id) ...
|
260
267
|
end
|
261
268
|
end
|
262
269
|
```
|
@@ -298,8 +305,8 @@ Testing http notification:
|
|
298
305
|
|
299
306
|
#### Get help
|
300
307
|
|
301
|
-
* [Veritrans gem reference](https://github.com/veritrans/veritrans-ruby/blob/
|
302
|
-
* [Veritrans
|
303
|
-
* [Veritrans
|
308
|
+
* [Veritrans gem reference](https://github.com/veritrans/veritrans-ruby/blob/master/api_reference.md)
|
309
|
+
* [Veritrans login](https://my.veritrans.co.id/login)
|
310
|
+
* [Veritrans registration](https://my.veritrans.co.id/register)
|
304
311
|
* [Veritrans documentation](http://docs.veritrans.co.id)
|
305
312
|
* Technical support [support@veritrans.co.id](mailto:support@veritrans.co.id)
|
data/Rakefile
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
begin
|
4
|
+
desc "Run Specs"
|
5
|
+
require 'rspec/core/rake_task'
|
6
|
+
RSpec::Core::RakeTask.new(:spec)
|
7
|
+
rescue LoadError
|
8
|
+
puts "no rspec available"
|
9
|
+
end
|
8
10
|
|
9
11
|
desc "Generate documentation with sdoc"
|
10
12
|
task :doc do
|
data/api_reference.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# API Reference
|
2
2
|
|
3
3
|
Here is only reference for API of this gem, to see complete information
|
4
|
-
please use our [documentation](http://docs.veritrans.co.id/en/api/introduction.
|
4
|
+
please use our [documentation](http://docs.veritrans.co.id/en/api/introduction.html)
|
5
5
|
|
6
6
|
|
7
7
|
<table>
|
@@ -240,3 +240,23 @@ In this situation you better expire previous transaction, and you can use same o
|
|
240
240
|
q = Veritrans.expire("testing-0.2072-1415086078")
|
241
241
|
q.success? # => true
|
242
242
|
```
|
243
|
+
|
244
|
+
|
245
|
+
|
246
|
+
### `Veritrans::Result`
|
247
|
+
|
248
|
+
```ruby
|
249
|
+
result = Veritrans.charge(...)
|
250
|
+
|
251
|
+
result.class # => Veritrans::Result
|
252
|
+
```
|
253
|
+
|
254
|
+
* `Veritrans::Result#success?` - `boolean`, base on `status_code` field in json
|
255
|
+
* `Veritrans::Result#created?` - `boolean`, for VT-Link
|
256
|
+
* `Veritrans::Result#status_code` - `integer`, e.g. 200, 402. Documentation http://docs.veritrans.co.id/en/api/status_code.html
|
257
|
+
* `Veritrans::Result#status_message` - `string`, e.g. "OK, success do VTWeb transaction, please go to redirect_url"
|
258
|
+
* `Veritrans::Result#redirect_url` - `string`, redirect URL for VT-Web and VT-Link
|
259
|
+
* `Veritrans::Result#body` - `string`, raw HTTP request body
|
260
|
+
* `Veritrans::Result#data` - `hash`, parsed json body as hash
|
261
|
+
* `Veritrans::Result#response` - `Excon::Response` instance
|
262
|
+
* `Veritrans::Result#method_mising` - acessing fields of `data`. E.g. `result.transction_status`, `result.masked_card`, `result.approval_code`
|