veritrans 2.2.0 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 7e730ba1e4af501d657c0899a9245863bf7248a2
4
- data.tar.gz: 8be1a82116cc7c32749f598b8e096f911375808a
2
+ SHA256:
3
+ metadata.gz: 198c28438ceb828b7c7d7e84d3211ef6f60311a9b9433a31de193bdc61f024f0
4
+ data.tar.gz: 12bb67253165bb466ecb48c8a72fb59df99c3d81f9b6fc7dd0b3a6aa7040ea23
5
5
  SHA512:
6
- metadata.gz: f8f0f756955f910466940d0f9ded79afe66ed5344b52b310a4b075ac69afc096f8b9f422e1a8284cf19ada0920d8196550a9b2bfa6db968dd84f319e8c1e7916
7
- data.tar.gz: 3dcb81801e38bc39bf517c07bb69fc6ebacd4949fffc3127508bd410ec121b751310123f866284229b17a2c980eaee819909b38f7175d893c7ab1423820bdf0a
6
+ metadata.gz: 4c46fc675f2ce31f1ad0c9737ec0c19a6306b6fa1e765db4fa8e55f5123ccd626d2d726b8bb09a0b672b59cbfe36185adb07063c80e0b9f4f7803f910e43c21c
7
+ data.tar.gz: ecb2db780ad8ff7a3e832148a04496ce72a7f46c4a97cda597cd02c5b423a39a3583fe775753a8eb70183d5d01b2a7d0da303b30d5ed716d13cddae499070bc2
@@ -0,0 +1,35 @@
1
+ Rails:
2
+ Enabled: true
3
+
4
+ Metrics/MethodLength:
5
+ Max: 100
6
+
7
+ Metrics/AbcSize:
8
+ Max: 40
9
+
10
+ Metrics/CyclomaticComplexity:
11
+ Max: 10
12
+
13
+ Metrics/PerceivedComplexity:
14
+ Max: 10
15
+
16
+ Metrics/ClassLength:
17
+ Enabled: false
18
+
19
+ Metrics/BlockLength:
20
+ Enabled: false
21
+
22
+ Metrics/LineLength:
23
+ Max: 120
24
+
25
+ Metrics/ModuleLength:
26
+ Enabled: false
27
+
28
+ Rails/CreateTableWithTimestamps:
29
+ Enabled: false
30
+
31
+ Style/FrozenStringLiteralComment:
32
+ Enabled: false
33
+
34
+ Style/Documentation:
35
+ Enabled: false
@@ -1,11 +1,17 @@
1
1
  language: ruby
2
2
  cache: bundler
3
+
3
4
  env:
4
- - DEBUG=1
5
+ # - DEBUG=1
6
+
7
+ before_install:
8
+ - gem install bundler -v '1.17.3' --no-doc
5
9
 
6
- script: "bundle exec rspec"
10
+ script:
11
+ - bundle exec rspec
7
12
 
8
13
  rvm:
9
- - 2.2.7
10
- - 2.3.4
11
- - 2.4.1
14
+ - 2.3.8
15
+ - 2.4.6
16
+ - 2.5.5
17
+ - 2.6.2
@@ -1,3 +1,15 @@
1
+ ### Version 2.3.0 (date 1 April 2019)
2
+
3
+ * Add refund, deny, and test_token methods (Thank to @christianmkuss)
4
+ * Remove logging of server key
5
+
6
+ ### Version 2.2.1 (date 30 May 2018)
7
+
8
+ * Update assertion message value
9
+ * Add alias method create_snap_redirect_url
10
+ * add redirect_url accessor in SnapResult
11
+ * Improve some wordings and examples in README.md
12
+
1
13
  ### Version 2.2.0 (date 08 May 2017)
2
14
 
3
15
  * Change default endpoint to *.midtrans.com
data/Gemfile CHANGED
@@ -1,12 +1,20 @@
1
- source "https://rubygems.org"
2
-
3
- gem 'rake'
4
- gem 'rspec'
1
+ source 'https://rubygems.org'
5
2
 
3
+ gem 'puma'
6
4
  gem 'rails', '< 6'
7
-
5
+ gem 'rake'
8
6
  gem 'sinatra'
9
- gem 'puma'
10
7
  gem 'tilt'
8
+ gem 'sqlite3'
9
+
10
+ group :test do
11
+ gem 'capybara', '~> 3.15.0' # for ruby 2.3 support
12
+ gem 'capybara-screenshot'
13
+ gem 'poltergeist', '~> 1.8'
14
+ gem 'rspec', '~> 3.4'
15
+ gem 'vcr', '~> 4.0'
16
+ gem 'webmock', '>= 1.20'
17
+ gem 'timecop'
18
+ end
11
19
 
12
20
  gemspec
@@ -1,176 +1,198 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- veritrans (2.2.0)
4
+ veritrans (2.3.0)
5
5
  excon (~> 0.20)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actioncable (5.1.0)
11
- actionpack (= 5.1.0)
10
+ actioncable (5.2.3)
11
+ actionpack (= 5.2.3)
12
12
  nio4r (~> 2.0)
13
- websocket-driver (~> 0.6.1)
14
- actionmailer (5.1.0)
15
- actionpack (= 5.1.0)
16
- actionview (= 5.1.0)
17
- activejob (= 5.1.0)
13
+ websocket-driver (>= 0.6.1)
14
+ actionmailer (5.2.3)
15
+ actionpack (= 5.2.3)
16
+ actionview (= 5.2.3)
17
+ activejob (= 5.2.3)
18
18
  mail (~> 2.5, >= 2.5.4)
19
19
  rails-dom-testing (~> 2.0)
20
- actionpack (5.1.0)
21
- actionview (= 5.1.0)
22
- activesupport (= 5.1.0)
20
+ actionpack (5.2.3)
21
+ actionview (= 5.2.3)
22
+ activesupport (= 5.2.3)
23
23
  rack (~> 2.0)
24
- rack-test (~> 0.6.3)
24
+ rack-test (>= 0.6.3)
25
25
  rails-dom-testing (~> 2.0)
26
26
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
27
- actionview (5.1.0)
28
- activesupport (= 5.1.0)
27
+ actionview (5.2.3)
28
+ activesupport (= 5.2.3)
29
29
  builder (~> 3.1)
30
30
  erubi (~> 1.4)
31
31
  rails-dom-testing (~> 2.0)
32
32
  rails-html-sanitizer (~> 1.0, >= 1.0.3)
33
- activejob (5.1.0)
34
- activesupport (= 5.1.0)
33
+ activejob (5.2.3)
34
+ activesupport (= 5.2.3)
35
35
  globalid (>= 0.3.6)
36
- activemodel (5.1.0)
37
- activesupport (= 5.1.0)
38
- activerecord (5.1.0)
39
- activemodel (= 5.1.0)
40
- activesupport (= 5.1.0)
41
- arel (~> 8.0)
42
- activesupport (5.1.0)
36
+ activemodel (5.2.3)
37
+ activesupport (= 5.2.3)
38
+ activerecord (5.2.3)
39
+ activemodel (= 5.2.3)
40
+ activesupport (= 5.2.3)
41
+ arel (>= 9.0)
42
+ activestorage (5.2.3)
43
+ actionpack (= 5.2.3)
44
+ activerecord (= 5.2.3)
45
+ marcel (~> 0.3.1)
46
+ activesupport (5.2.3)
43
47
  concurrent-ruby (~> 1.0, >= 1.0.2)
44
- i18n (~> 0.7)
48
+ i18n (>= 0.7, < 2)
45
49
  minitest (~> 5.1)
46
50
  tzinfo (~> 1.1)
47
- addressable (2.5.1)
48
- public_suffix (~> 2.0, >= 2.0.2)
49
- arel (8.0.0)
51
+ addressable (2.6.0)
52
+ public_suffix (>= 2.0.2, < 4.0)
53
+ arel (9.0.0)
50
54
  builder (3.2.3)
51
- capybara (2.14.0)
55
+ capybara (3.15.0)
52
56
  addressable
53
- mime-types (>= 1.16)
54
- nokogiri (>= 1.3.3)
55
- rack (>= 1.0.0)
56
- rack-test (>= 0.5.4)
57
- xpath (~> 2.0)
57
+ mini_mime (>= 0.1.3)
58
+ nokogiri (~> 1.8)
59
+ rack (>= 1.6.0)
60
+ rack-test (>= 0.6.3)
61
+ regexp_parser (~> 1.2)
62
+ xpath (~> 3.2)
63
+ capybara-screenshot (1.0.22)
64
+ capybara (>= 1.0, < 4)
65
+ launchy
58
66
  cliver (0.3.2)
59
- concurrent-ruby (1.0.5)
67
+ concurrent-ruby (1.1.5)
60
68
  crack (0.4.3)
61
69
  safe_yaml (~> 1.0.0)
70
+ crass (1.0.4)
62
71
  diff-lcs (1.3)
63
- erubi (1.6.0)
64
- excon (0.55.0)
65
- globalid (0.4.0)
72
+ erubi (1.8.0)
73
+ excon (0.62.0)
74
+ globalid (0.4.2)
66
75
  activesupport (>= 4.2.0)
67
- hashdiff (0.3.4)
68
- i18n (0.8.1)
69
- loofah (2.0.3)
76
+ hashdiff (0.3.8)
77
+ i18n (1.6.0)
78
+ concurrent-ruby (~> 1.0)
79
+ launchy (2.4.3)
80
+ addressable (~> 2.3)
81
+ loofah (2.2.3)
82
+ crass (~> 1.0.2)
70
83
  nokogiri (>= 1.5.9)
71
- mail (2.6.5)
72
- mime-types (>= 1.16, < 4)
73
- method_source (0.8.2)
74
- mime-types (3.1)
75
- mime-types-data (~> 3.2015)
76
- mime-types-data (3.2016.0521)
77
- mini_portile2 (2.1.0)
78
- minitest (5.10.1)
79
- mustermann (1.0.0)
80
- nio4r (2.0.0)
81
- nokogiri (1.7.1)
82
- mini_portile2 (~> 2.1.0)
83
- poltergeist (1.15.0)
84
- capybara (~> 2.1)
84
+ mail (2.7.1)
85
+ mini_mime (>= 0.1.1)
86
+ marcel (0.3.3)
87
+ mimemagic (~> 0.3.2)
88
+ method_source (0.9.2)
89
+ mimemagic (0.3.3)
90
+ mini_mime (1.0.1)
91
+ mini_portile2 (2.4.0)
92
+ minitest (5.11.3)
93
+ mustermann (1.0.3)
94
+ nio4r (2.3.1)
95
+ nokogiri (1.10.2)
96
+ mini_portile2 (~> 2.4.0)
97
+ poltergeist (1.18.1)
98
+ capybara (>= 2.1, < 4)
85
99
  cliver (~> 0.3.1)
86
100
  websocket-driver (>= 0.2.0)
87
- public_suffix (2.0.5)
88
- puma (3.8.2)
89
- rack (2.0.1)
90
- rack-protection (2.0.0)
101
+ public_suffix (3.0.3)
102
+ puma (3.12.1)
103
+ rack (2.0.7)
104
+ rack-protection (2.0.5)
91
105
  rack
92
- rack-test (0.6.3)
93
- rack (>= 1.0)
94
- rails (5.1.0)
95
- actioncable (= 5.1.0)
96
- actionmailer (= 5.1.0)
97
- actionpack (= 5.1.0)
98
- actionview (= 5.1.0)
99
- activejob (= 5.1.0)
100
- activemodel (= 5.1.0)
101
- activerecord (= 5.1.0)
102
- activesupport (= 5.1.0)
103
- bundler (>= 1.3.0, < 2.0)
104
- railties (= 5.1.0)
106
+ rack-test (1.1.0)
107
+ rack (>= 1.0, < 3)
108
+ rails (5.2.3)
109
+ actioncable (= 5.2.3)
110
+ actionmailer (= 5.2.3)
111
+ actionpack (= 5.2.3)
112
+ actionview (= 5.2.3)
113
+ activejob (= 5.2.3)
114
+ activemodel (= 5.2.3)
115
+ activerecord (= 5.2.3)
116
+ activestorage (= 5.2.3)
117
+ activesupport (= 5.2.3)
118
+ bundler (>= 1.3.0)
119
+ railties (= 5.2.3)
105
120
  sprockets-rails (>= 2.0.0)
106
- rails-dom-testing (2.0.2)
107
- activesupport (>= 4.2.0, < 6.0)
108
- nokogiri (~> 1.6)
109
- rails-html-sanitizer (1.0.3)
110
- loofah (~> 2.0)
111
- railties (5.1.0)
112
- actionpack (= 5.1.0)
113
- activesupport (= 5.1.0)
121
+ rails-dom-testing (2.0.3)
122
+ activesupport (>= 4.2.0)
123
+ nokogiri (>= 1.6)
124
+ rails-html-sanitizer (1.0.4)
125
+ loofah (~> 2.2, >= 2.2.2)
126
+ railties (5.2.3)
127
+ actionpack (= 5.2.3)
128
+ activesupport (= 5.2.3)
114
129
  method_source
115
130
  rake (>= 0.8.7)
116
- thor (>= 0.18.1, < 2.0)
117
- rake (12.0.0)
118
- rspec (3.6.0)
119
- rspec-core (~> 3.6.0)
120
- rspec-expectations (~> 3.6.0)
121
- rspec-mocks (~> 3.6.0)
122
- rspec-core (3.6.0)
123
- rspec-support (~> 3.6.0)
124
- rspec-expectations (3.6.0)
131
+ thor (>= 0.19.0, < 2.0)
132
+ rake (12.3.2)
133
+ regexp_parser (1.4.0)
134
+ rspec (3.8.0)
135
+ rspec-core (~> 3.8.0)
136
+ rspec-expectations (~> 3.8.0)
137
+ rspec-mocks (~> 3.8.0)
138
+ rspec-core (3.8.0)
139
+ rspec-support (~> 3.8.0)
140
+ rspec-expectations (3.8.2)
125
141
  diff-lcs (>= 1.2.0, < 2.0)
126
- rspec-support (~> 3.6.0)
127
- rspec-mocks (3.6.0)
142
+ rspec-support (~> 3.8.0)
143
+ rspec-mocks (3.8.0)
128
144
  diff-lcs (>= 1.2.0, < 2.0)
129
- rspec-support (~> 3.6.0)
130
- rspec-support (3.6.0)
131
- safe_yaml (1.0.4)
132
- sinatra (2.0.0)
145
+ rspec-support (~> 3.8.0)
146
+ rspec-support (3.8.0)
147
+ safe_yaml (1.0.5)
148
+ sinatra (2.0.5)
133
149
  mustermann (~> 1.0)
134
150
  rack (~> 2.0)
135
- rack-protection (= 2.0.0)
151
+ rack-protection (= 2.0.5)
136
152
  tilt (~> 2.0)
137
- sprockets (3.7.1)
153
+ sprockets (3.7.2)
138
154
  concurrent-ruby (~> 1.0)
139
155
  rack (> 1, < 3)
140
- sprockets-rails (3.2.0)
156
+ sprockets-rails (3.2.1)
141
157
  actionpack (>= 4.0)
142
158
  activesupport (>= 4.0)
143
159
  sprockets (>= 3.0.0)
144
- thor (0.19.4)
160
+ sqlite3 (1.4.0)
161
+ thor (0.20.3)
145
162
  thread_safe (0.3.6)
146
- tilt (2.0.7)
147
- tzinfo (1.2.3)
163
+ tilt (2.0.9)
164
+ timecop (0.9.1)
165
+ tzinfo (1.2.5)
148
166
  thread_safe (~> 0.1)
149
- vcr (3.0.3)
150
- webmock (3.0.1)
167
+ vcr (4.0.0)
168
+ webmock (3.5.1)
151
169
  addressable (>= 2.3.6)
152
170
  crack (>= 0.3.2)
153
171
  hashdiff
154
- websocket-driver (0.6.5)
172
+ websocket-driver (0.7.0)
155
173
  websocket-extensions (>= 0.1.0)
156
- websocket-extensions (0.1.2)
157
- xpath (2.0.0)
158
- nokogiri (~> 1.3)
174
+ websocket-extensions (0.1.3)
175
+ xpath (3.2.0)
176
+ nokogiri (~> 1.8)
159
177
 
160
178
  PLATFORMS
161
179
  ruby
162
180
 
163
181
  DEPENDENCIES
182
+ capybara (~> 3.15.0)
183
+ capybara-screenshot
164
184
  poltergeist (~> 1.8)
165
185
  puma
166
186
  rails (< 6)
167
187
  rake
168
- rspec
188
+ rspec (~> 3.4)
169
189
  sinatra
190
+ sqlite3
170
191
  tilt
171
- vcr (~> 3.0)
192
+ timecop
193
+ vcr (~> 4.0)
172
194
  veritrans!
173
195
  webmock (>= 1.20)
174
196
 
175
197
  BUNDLED WITH
176
- 1.14.6
198
+ 1.17.3
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Veritrans ruby library
2
2
 
3
3
  Veritrans gem is the library that will help you to integrate seamlessly with
4
- Midtrans.
4
+ Midtrans (formerly known as Veritrans Indonesia).
5
5
 
6
6
  [![Gem Version](https://badge.fury.io/rb/veritrans.svg)](http://badge.fury.io/rb/veritrans)
7
7
  [![Build Status](https://travis-ci.org/veritrans/veritrans-ruby.svg?branch=master)](https://travis-ci.org/veritrans/veritrans-ruby)
@@ -41,24 +41,11 @@ development:
41
41
 
42
42
  ## STEP 1: Process credit cards
43
43
 
44
+ #### Snap
44
45
 
45
- #### VT-Web
46
-
47
- *If you want to use VT-Web, add `payment_type: "VTWEB"`*
48
-
49
- ```ruby
50
- @result = Veritrans.charge(
51
- payment_type: "VTWEB",
52
- transaction_details: {
53
- order_id: "my-unique-order-id",
54
- gross_amount: 100_000
55
- }
56
- )
57
-
58
- redirect_to @result.redirect_url
59
- ```
46
+ ##### Pop-up
60
47
 
61
- #### Snap
48
+ This will result in payment page being a pop-up(iframe) inside your own web page, no need redirection, similar to our [demo](http://demo.midtrans.com)
62
49
 
63
50
  First, generate token in the back end provided with enough details as necessary
64
51
  and as detailed as you wish to.
@@ -101,10 +88,45 @@ jQuery(".order-button").on("click", function() {
101
88
  });
102
89
  ```
103
90
 
104
- #### VT-Direct
91
+ ##### Redirection
92
+
93
+ This will result in redirect_url, you can redirect customer to the url, payment page is securely hosted by Midtrans.
94
+
95
+ ```ruby
96
+ @result = Veritrans.create_snap_redirect_url(
97
+ transaction_details: {
98
+ order_id: "my-unique-order-id",
99
+ gross_amount: 100_000
100
+ }
101
+ )
102
+
103
+ redirect_to @result.redirect_url
104
+ ```
105
+
106
+ > This is similar feature as old VT-Web
107
+
108
+ #### VT-Web
109
+
110
+ > !!! WARNING NOTE: VT-Web is deprecated, please use [Snap](#Snap) instead, it has better previous VT-Web feature and many more improvements, including redirect_url.
111
+
112
+ *If you want to use VT-Web, add `payment_type: "VTWEB"`*
113
+
114
+ ```ruby
115
+ @result = Veritrans.charge(
116
+ payment_type: "VTWEB",
117
+ transaction_details: {
118
+ order_id: "my-unique-order-id",
119
+ gross_amount: 100_000
120
+ }
121
+ )
122
+
123
+ redirect_to @result.redirect_url
124
+ ```
125
+
126
+ #### VT-Direct / Core API
105
127
 
106
128
  It's little more complicated, because credit_card is sensitive data,
107
- you need put credit card number in our safe storage first using `veritrans.js` library, then send received token to with other payment details.
129
+ you need put credit card number in our safe storage first using `midtrans.min.js` library, then send received token to with other payment details.
108
130
 
109
131
  We don't want you to send credit card number to your server, especially for websites not using https.
110
132
 
@@ -227,13 +249,13 @@ if @result.success?
227
249
  end
228
250
  ```
229
251
 
230
- ## STEP 2: Process not credit cards
252
+ ## STEP 2: Process non credit cards payment
231
253
 
232
- We provide many payment channels to receive money, but API is almost same.
254
+ We provide many payment channels to accept payment, but the API call is almost the same.
233
255
 
234
- For VT-Web in only one request, and payment page will have all available payment options.
256
+ For Snap / VT-Web in only one request, payment page will display all available payment options.
235
257
 
236
- For VT-Direct you have to specify payment method (token required only for credit card transactions).
258
+ For Core API / VT-Direct you have to specify payment method (without get token step, credit card token required only for credit card transactions).
237
259
 
238
260
  ```ruby
239
261
  @result = Veritrans.charge(
@@ -244,7 +266,7 @@ For VT-Direct you have to specify payment method (token required only for credit
244
266
  gross_amount: @payment.amount
245
267
  }
246
268
  )
247
- puts "Please send money to account no. #{@result.permata_va_number} in bank Permata"
269
+ puts "Please transfer fund to account no. #{@result.permata_va_number} in bank Permata"
248
270
  ```
249
271
 
250
272
  See [our documentation](https://api-docs.midtrans.com/#charge-features) for other available options.