veritrans 2.1.3 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +6 -1
- data/.travis.yml +3 -5
- data/CHANGELOG.md +20 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +89 -94
- data/Procfile +1 -1
- data/README.md +62 -13
- data/api_reference.md +10 -10
- data/example/rails/cable/Gemfile +48 -0
- data/example/rails/cable/Gemfile.lock +184 -0
- data/example/rails/cable/README.md +29 -0
- data/example/rails/cable/Rakefile +6 -0
- data/example/rails/cable/app/assets/config/manifest.js +3 -0
- data/example/rails/cable/app/assets/images/.keep +0 -0
- data/example/rails/cable/app/assets/javascripts/application.js +15 -0
- data/example/rails/cable/app/assets/javascripts/cable.js +13 -0
- data/example/rails/cable/app/assets/javascripts/channels/.keep +0 -0
- data/example/rails/cable/app/assets/javascripts/chats.js +39 -0
- data/example/rails/cable/app/assets/javascripts/rooms.js +55 -0
- data/example/rails/cable/app/assets/stylesheets/application.css +16 -0
- data/example/rails/cable/app/assets/stylesheets/chatbox.scss +31 -0
- data/example/rails/cable/app/assets/stylesheets/peoplebox.scss +6 -0
- data/example/rails/cable/app/channels/application_cable/channel.rb +4 -0
- data/example/rails/cable/app/channels/application_cable/connection.rb +4 -0
- data/example/rails/cable/app/channels/rooms_texting_channel.rb +13 -0
- data/example/rails/cable/app/controllers/application_controller.rb +3 -0
- data/example/rails/cable/app/controllers/chats_controller.rb +18 -0
- data/example/rails/cable/app/controllers/concerns/.keep +0 -0
- data/example/rails/cable/app/controllers/pays_controller.rb +28 -0
- data/example/rails/cable/app/controllers/rooms_controller.rb +4 -0
- data/example/rails/cable/app/helpers/application_helper.rb +2 -0
- data/example/rails/cable/app/helpers/chats_helper.rb +2 -0
- data/example/rails/cable/app/helpers/rooms_helper.rb +5 -0
- data/example/rails/cable/app/jobs/application_job.rb +2 -0
- data/example/rails/cable/app/jobs/chat_broadcaster_job.rb +15 -0
- data/example/rails/cable/app/mailers/application_mailer.rb +4 -0
- data/example/rails/cable/app/models/application_record.rb +3 -0
- data/example/rails/cable/app/models/chat.rb +41 -0
- data/example/rails/cable/app/models/concerns/.keep +0 -0
- data/example/rails/cable/app/models/order.rb +2 -0
- data/example/rails/cable/app/models/user.rb +2 -0
- data/example/rails/cable/app/views/chats/_chat.html.erb +18 -0
- data/example/rails/cable/app/views/layouts/application.html.erb +19 -0
- data/example/rails/cable/app/views/layouts/mailer.html.erb +13 -0
- data/example/rails/cable/app/views/layouts/mailer.text.erb +1 -0
- data/example/rails/cable/app/views/rooms/_chatbox.html.erb +13 -0
- data/example/rails/cable/app/views/rooms/_online_people.html.erb +53 -0
- data/example/rails/cable/app/views/rooms/index.html.erb +9 -0
- data/example/rails/cable/bin/bundle +3 -0
- data/example/rails/cable/bin/rails +9 -0
- data/example/rails/cable/bin/rake +9 -0
- data/example/rails/cable/bin/setup +34 -0
- data/example/rails/cable/bin/spring +16 -0
- data/example/rails/cable/bin/update +29 -0
- data/example/rails/cable/config.ru +5 -0
- data/example/rails/cable/config/application.rb +16 -0
- data/example/rails/cable/config/boot.rb +3 -0
- data/example/rails/cable/config/cable.yml +9 -0
- data/example/rails/cable/config/database.yml +20 -0
- data/example/rails/cable/config/environment.rb +5 -0
- data/example/rails/cable/config/environments/development.rb +57 -0
- data/example/rails/cable/config/environments/production.rb +86 -0
- data/example/rails/cable/config/environments/test.rb +42 -0
- data/example/rails/cable/config/initializers/application_controller_renderer.rb +6 -0
- data/example/rails/cable/config/initializers/assets.rb +11 -0
- data/example/rails/cable/config/initializers/backtrace_silencers.rb +7 -0
- data/example/rails/cable/config/initializers/cookies_serializer.rb +5 -0
- data/example/rails/cable/config/initializers/filter_parameter_logging.rb +4 -0
- data/example/rails/cable/config/initializers/inflections.rb +16 -0
- data/example/rails/cable/config/initializers/mime_types.rb +4 -0
- data/example/rails/cable/config/initializers/new_framework_defaults.rb +24 -0
- data/example/rails/cable/config/initializers/session_store.rb +3 -0
- data/example/rails/cable/config/initializers/sidekiq.rb +2 -0
- data/example/rails/cable/config/initializers/veritrans.rb +46 -0
- data/example/rails/cable/config/initializers/wrap_parameters.rb +14 -0
- data/example/rails/cable/config/locales/en.yml +23 -0
- data/example/rails/cable/config/puma.rb +47 -0
- data/example/rails/cable/config/routes.rb +18 -0
- data/example/rails/cable/config/secrets.yml +22 -0
- data/example/rails/cable/config/spring.rb +6 -0
- data/example/rails/cable/config/veritrans.yml +13 -0
- data/example/rails/cable/db/development.sqlite3 +0 -0
- data/example/rails/cable/db/migrate/20161215070044_create_chats.rb +10 -0
- data/example/rails/cable/db/migrate/20161215072021_create_users.rb +10 -0
- data/example/rails/cable/db/migrate/20161219110219_create_orders.rb +11 -0
- data/example/rails/cable/db/schema.rb +37 -0
- data/example/rails/cable/db/seeds.rb +41 -0
- data/example/rails/cable/db/test.sqlite3 +0 -0
- data/example/rails/cable/lib/assets/.keep +0 -0
- data/example/rails/cable/lib/tasks/.keep +0 -0
- data/example/rails/cable/public/404.html +67 -0
- data/example/rails/cable/public/422.html +67 -0
- data/example/rails/cable/public/500.html +66 -0
- data/example/rails/cable/public/apple-touch-icon-precomposed.png +0 -0
- data/example/rails/cable/public/apple-touch-icon.png +0 -0
- data/example/rails/cable/public/favicon.ico +0 -0
- data/example/rails/cable/public/images/avatar1.jpg +0 -0
- data/example/rails/cable/public/images/avatar2.jpg +0 -0
- data/example/rails/cable/public/images/avatar3.jpg +0 -0
- data/example/rails/cable/public/images/avatar4.jpg +0 -0
- data/example/rails/cable/public/images/avatar5.jpg +0 -0
- data/example/rails/cable/public/images/avatar6.jpg +0 -0
- data/example/rails/cable/public/robots.txt +5 -0
- data/example/rails/cable/vendor/assets/javascripts/.keep +0 -0
- data/example/rails/cable/vendor/assets/stylesheets/.keep +0 -0
- data/example/rails/cable/vendor/assets/stylesheets/photon.css +2333 -0
- data/example/rails/simplepay/Gemfile +54 -0
- data/example/rails/simplepay/Gemfile.lock +178 -0
- data/example/rails/simplepay/README.md +30 -0
- data/example/rails/simplepay/Rakefile +6 -0
- data/example/rails/simplepay/app/assets/config/manifest.js +3 -0
- data/example/rails/simplepay/app/assets/images/.keep +0 -0
- data/example/rails/simplepay/app/assets/javascripts/application.js +16 -0
- data/example/rails/simplepay/app/assets/javascripts/cable.js +13 -0
- data/example/rails/simplepay/app/assets/javascripts/channels/.keep +0 -0
- data/example/rails/simplepay/app/assets/javascripts/pay.js +18 -0
- data/example/rails/simplepay/app/assets/stylesheets/application.css +15 -0
- data/example/rails/simplepay/app/assets/stylesheets/style.css +254 -0
- data/example/rails/simplepay/app/channels/application_cable/channel.rb +4 -0
- data/example/rails/simplepay/app/channels/application_cable/connection.rb +4 -0
- data/example/rails/simplepay/app/controllers/application_controller.rb +3 -0
- data/example/rails/simplepay/app/controllers/concerns/.keep +0 -0
- data/example/rails/simplepay/app/controllers/home_controller.rb +16 -0
- data/example/rails/simplepay/app/controllers/pay_controller.rb +10 -0
- data/example/rails/simplepay/app/helpers/application_helper.rb +2 -0
- data/example/rails/simplepay/app/helpers/pay_helper.rb +2 -0
- data/example/rails/simplepay/app/jobs/application_job.rb +2 -0
- data/example/rails/simplepay/app/mailers/application_mailer.rb +4 -0
- data/example/rails/simplepay/app/models/application_record.rb +3 -0
- data/example/rails/simplepay/app/models/concerns/.keep +0 -0
- data/example/rails/simplepay/app/models/order.rb +2 -0
- data/example/rails/simplepay/app/views/home/index.html.erb +19 -0
- data/example/rails/simplepay/app/views/layouts/application.html.erb +15 -0
- data/example/rails/simplepay/app/views/layouts/mailer.html.erb +13 -0
- data/example/rails/simplepay/app/views/layouts/mailer.text.erb +1 -0
- data/example/rails/simplepay/app/views/pay/notify.html.erb +2 -0
- data/example/rails/simplepay/bin/bundle +3 -0
- data/example/rails/simplepay/bin/rails +9 -0
- data/example/rails/simplepay/bin/rake +9 -0
- data/example/rails/simplepay/bin/setup +34 -0
- data/example/rails/simplepay/bin/spring +16 -0
- data/example/rails/simplepay/bin/update +29 -0
- data/example/rails/simplepay/config.ru +5 -0
- data/example/rails/simplepay/config/application.rb +15 -0
- data/example/rails/simplepay/config/boot.rb +3 -0
- data/example/rails/simplepay/config/cable.yml +9 -0
- data/example/rails/simplepay/config/database.yml +25 -0
- data/example/rails/simplepay/config/environment.rb +5 -0
- data/example/rails/simplepay/config/environments/development.rb +57 -0
- data/example/rails/simplepay/config/environments/production.rb +86 -0
- data/example/rails/simplepay/config/environments/test.rb +42 -0
- data/example/rails/simplepay/config/initializers/application_controller_renderer.rb +6 -0
- data/example/rails/simplepay/config/initializers/assets.rb +11 -0
- data/example/rails/simplepay/config/initializers/backtrace_silencers.rb +7 -0
- data/example/rails/simplepay/config/initializers/cookies_serializer.rb +5 -0
- data/example/rails/simplepay/config/initializers/filter_parameter_logging.rb +4 -0
- data/example/rails/simplepay/config/initializers/inflections.rb +16 -0
- data/example/rails/simplepay/config/initializers/mime_types.rb +4 -0
- data/example/rails/simplepay/config/initializers/new_framework_defaults.rb +24 -0
- data/example/rails/simplepay/config/initializers/session_store.rb +3 -0
- data/example/rails/simplepay/config/initializers/veritrans.rb +46 -0
- data/example/rails/simplepay/config/initializers/wrap_parameters.rb +14 -0
- data/example/rails/simplepay/config/locales/en.yml +23 -0
- data/example/rails/simplepay/config/puma.rb +47 -0
- data/example/rails/simplepay/config/routes.rb +5 -0
- data/example/rails/simplepay/config/secrets.yml +22 -0
- data/example/rails/simplepay/config/spring.rb +6 -0
- data/example/rails/simplepay/config/veritrans.yml +18 -0
- data/example/rails/simplepay/db/development.sqlite3 +0 -0
- data/example/rails/simplepay/db/migrate/20161221090855_create_orders.rb +10 -0
- data/example/rails/simplepay/db/schema.rb +22 -0
- data/example/rails/simplepay/db/seeds.rb +7 -0
- data/example/rails/simplepay/db/test.sqlite3 +0 -0
- data/example/rails/simplepay/lib/assets/.keep +0 -0
- data/example/rails/simplepay/lib/tasks/.keep +0 -0
- data/example/rails/simplepay/public/404.html +67 -0
- data/example/rails/simplepay/public/422.html +67 -0
- data/example/rails/simplepay/public/500.html +66 -0
- data/example/rails/simplepay/public/apple-touch-icon-precomposed.png +0 -0
- data/example/rails/simplepay/public/apple-touch-icon.png +0 -0
- data/example/rails/simplepay/public/favicon.ico +0 -0
- data/example/rails/simplepay/public/robots.txt +5 -0
- data/example/rails/simplepay/vendor/assets/javascripts/.keep +0 -0
- data/example/rails/simplepay/vendor/assets/stylesheets/.keep +0 -0
- data/example/{README.md → sinatra/README.md} +0 -0
- data/example/{config.ru → sinatra/config.ru} +3 -0
- data/example/{index.erb → sinatra/index.erb} +7 -6
- data/example/{localization.erb → sinatra/localization.erb} +6 -5
- data/example/{points.erb → sinatra/points.erb} +6 -5
- data/example/{recurring.erb → sinatra/recurring.erb} +6 -6
- data/example/{response.erb → sinatra/response.erb} +4 -1
- data/example/{sinatra.rb → sinatra/sinatra.rb} +9 -3
- data/example/{style.css → sinatra/style.css} +11 -0
- data/example/{veritrans.yml → sinatra/veritrans.yml} +2 -2
- data/example/{widget.erb → sinatra/widget.erb} +18 -6
- data/lib/generators/templates/assets/credit_card_form.js +6 -0
- data/lib/generators/templates/payments_controller.rb +4 -4
- data/lib/generators/templates/veritrans.yml +5 -5
- data/lib/generators/templates/views/_credit_card_form.erb +2 -2
- data/lib/generators/templates/views/_veritrans_include.erb +1 -1
- data/lib/generators/veritrans/install_generator.rb +1 -1
- data/lib/generators/veritrans/payment_form_generator.rb +1 -1
- data/lib/veritrans.rb +106 -5
- data/lib/veritrans/api.rb +7 -7
- data/lib/veritrans/cli.rb +11 -5
- data/lib/veritrans/client.rb +7 -4
- data/lib/veritrans/config.rb +5 -3
- data/lib/veritrans/events.rb +46 -35
- data/lib/veritrans/result.rb +58 -2
- data/lib/veritrans/testing.rb +156 -0
- data/lib/veritrans/version.rb +1 -1
- data/spec/cli_spec.rb +2 -2
- data/spec/fixtures/approve_failed.yml +1 -1
- data/spec/fixtures/cancel_failed.yml +1 -1
- data/spec/fixtures/cancel_success.yml +2 -2
- data/spec/fixtures/capture_failed.yml +1 -1
- data/spec/fixtures/charge.yml +2 -2
- data/spec/fixtures/charge_direct.yml +1 -1
- data/spec/fixtures/charge_vtweb.yml +2 -2
- data/spec/fixtures/cli_test_1111-not-exists.yml +1 -1
- data/spec/fixtures/cli_test_not_exists.yml +1 -1
- data/spec/fixtures/cli_test_real_txn.yml +1 -1
- data/spec/fixtures/cli_test_unauthorized.yml +1 -1
- data/spec/fixtures/events_test_real_txn.yml +1 -1
- data/spec/fixtures/expire_failed.yml +1 -1
- data/spec/fixtures/expire_success.yml +1 -1
- data/spec/fixtures/midtrans_status.yml +2 -2
- data/spec/fixtures/status_fail.yml +1 -1
- data/spec/fixtures/status_success.yml +2 -2
- data/spec/rails_plugin_spec.rb +37 -20
- data/spec/spec_helper.rb +0 -1
- data/spec/veritrans_client_spec.rb +1 -1
- data/spec/veritrans_config_spec.rb +1 -1
- data/spec/veritrans_events_spec.rb +6 -6
- data/spec/veritrans_testing_spec.rb +184 -0
- data/testing_webhooks.md +2 -2
- data/veritrans.gemspec +1 -1
- metadata +195 -16
- data/lib/veritrans/core_extensions.rb +0 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e730ba1e4af501d657c0899a9245863bf7248a2
|
4
|
+
data.tar.gz: 8be1a82116cc7c32749f598b8e096f911375808a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8f0f756955f910466940d0f9ded79afe66ed5344b52b310a4b075ac69afc096f8b9f422e1a8284cf19ada0920d8196550a9b2bfa6db968dd84f319e8c1e7916
|
7
|
+
data.tar.gz: 3dcb81801e38bc39bf517c07bb69fc6ebacd4949fffc3127508bd410ec121b751310123f866284229b17a2c980eaee819909b38f7175d893c7ab1423820bdf0a
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,23 @@
|
|
1
|
+
### Version 2.2.0 (date 08 May 2017)
|
2
|
+
|
3
|
+
* Change default endpoint to *.midtrans.com
|
4
|
+
* Fix broken links to documentation
|
5
|
+
* Add support for Rails 5.1
|
6
|
+
* Add Rails examples (Thanks to Adam Pahlevi)
|
7
|
+
* More complete rdoc commects
|
8
|
+
* Add items to vtweb example
|
9
|
+
* Update year in example app
|
10
|
+
* Log error message for failed requests
|
11
|
+
* Add Veritrans::Testing for testing API
|
12
|
+
|
13
|
+
### Version 2.1.3 (date 19 Dec 2016)
|
14
|
+
|
15
|
+
* Update create snap token endpoint
|
16
|
+
|
17
|
+
### Version 2.1.2 (date 20 Oct 2016)
|
18
|
+
|
19
|
+
* Create alias Midtrans = Veritrans
|
20
|
+
|
1
21
|
### Version 2.1.1 (date 15 Sep 2016)
|
2
22
|
|
3
23
|
* Allow use ENV variables in config
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,65 +1,54 @@
|
|
1
|
-
GIT
|
2
|
-
remote: https://github.com/sinatra/sinatra.git
|
3
|
-
revision: 1b0edc0aeaaf4839cadfcec1b21da86e6af1d4c0
|
4
|
-
specs:
|
5
|
-
rack-protection (2.0.0.beta2)
|
6
|
-
rack
|
7
|
-
sinatra (2.0.0.beta2)
|
8
|
-
mustermann (= 1.0.0.beta2)
|
9
|
-
rack (~> 2.0)
|
10
|
-
rack-protection (= 2.0.0.beta2)
|
11
|
-
tilt (~> 2.0)
|
12
|
-
|
13
1
|
PATH
|
14
2
|
remote: .
|
15
3
|
specs:
|
16
|
-
veritrans (2.
|
4
|
+
veritrans (2.2.0)
|
17
5
|
excon (~> 0.20)
|
18
6
|
|
19
7
|
GEM
|
20
8
|
remote: https://rubygems.org/
|
21
9
|
specs:
|
22
|
-
actioncable (5.
|
23
|
-
actionpack (= 5.
|
24
|
-
nio4r (~>
|
10
|
+
actioncable (5.1.0)
|
11
|
+
actionpack (= 5.1.0)
|
12
|
+
nio4r (~> 2.0)
|
25
13
|
websocket-driver (~> 0.6.1)
|
26
|
-
actionmailer (5.
|
27
|
-
actionpack (= 5.
|
28
|
-
actionview (= 5.
|
29
|
-
activejob (= 5.
|
14
|
+
actionmailer (5.1.0)
|
15
|
+
actionpack (= 5.1.0)
|
16
|
+
actionview (= 5.1.0)
|
17
|
+
activejob (= 5.1.0)
|
30
18
|
mail (~> 2.5, >= 2.5.4)
|
31
19
|
rails-dom-testing (~> 2.0)
|
32
|
-
actionpack (5.
|
33
|
-
actionview (= 5.
|
34
|
-
activesupport (= 5.
|
20
|
+
actionpack (5.1.0)
|
21
|
+
actionview (= 5.1.0)
|
22
|
+
activesupport (= 5.1.0)
|
35
23
|
rack (~> 2.0)
|
36
24
|
rack-test (~> 0.6.3)
|
37
25
|
rails-dom-testing (~> 2.0)
|
38
26
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
39
|
-
actionview (5.
|
40
|
-
activesupport (= 5.
|
27
|
+
actionview (5.1.0)
|
28
|
+
activesupport (= 5.1.0)
|
41
29
|
builder (~> 3.1)
|
42
|
-
|
30
|
+
erubi (~> 1.4)
|
43
31
|
rails-dom-testing (~> 2.0)
|
44
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.
|
45
|
-
activejob (5.
|
46
|
-
activesupport (= 5.
|
32
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
33
|
+
activejob (5.1.0)
|
34
|
+
activesupport (= 5.1.0)
|
47
35
|
globalid (>= 0.3.6)
|
48
|
-
activemodel (5.
|
49
|
-
activesupport (= 5.
|
50
|
-
activerecord (5.
|
51
|
-
activemodel (= 5.
|
52
|
-
activesupport (= 5.
|
53
|
-
arel (~>
|
54
|
-
activesupport (5.
|
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)
|
55
43
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
56
44
|
i18n (~> 0.7)
|
57
45
|
minitest (~> 5.1)
|
58
46
|
tzinfo (~> 1.1)
|
59
|
-
addressable (2.
|
60
|
-
|
61
|
-
|
62
|
-
|
47
|
+
addressable (2.5.1)
|
48
|
+
public_suffix (~> 2.0, >= 2.0.2)
|
49
|
+
arel (8.0.0)
|
50
|
+
builder (3.2.3)
|
51
|
+
capybara (2.14.0)
|
63
52
|
addressable
|
64
53
|
mime-types (>= 1.16)
|
65
54
|
nokogiri (>= 1.3.3)
|
@@ -67,96 +56,102 @@ GEM
|
|
67
56
|
rack-test (>= 0.5.4)
|
68
57
|
xpath (~> 2.0)
|
69
58
|
cliver (0.3.2)
|
70
|
-
concurrent-ruby (1.0.
|
59
|
+
concurrent-ruby (1.0.5)
|
71
60
|
crack (0.4.3)
|
72
61
|
safe_yaml (~> 1.0.0)
|
73
|
-
diff-lcs (1.
|
74
|
-
|
75
|
-
excon (0.
|
76
|
-
globalid (0.
|
77
|
-
activesupport (>= 4.
|
78
|
-
hashdiff (0.3.
|
79
|
-
i18n (0.
|
62
|
+
diff-lcs (1.3)
|
63
|
+
erubi (1.6.0)
|
64
|
+
excon (0.55.0)
|
65
|
+
globalid (0.4.0)
|
66
|
+
activesupport (>= 4.2.0)
|
67
|
+
hashdiff (0.3.4)
|
68
|
+
i18n (0.8.1)
|
80
69
|
loofah (2.0.3)
|
81
70
|
nokogiri (>= 1.5.9)
|
82
|
-
mail (2.6.
|
71
|
+
mail (2.6.5)
|
83
72
|
mime-types (>= 1.16, < 4)
|
84
73
|
method_source (0.8.2)
|
85
74
|
mime-types (3.1)
|
86
75
|
mime-types-data (~> 3.2015)
|
87
76
|
mime-types-data (3.2016.0521)
|
88
77
|
mini_portile2 (2.1.0)
|
89
|
-
minitest (5.
|
90
|
-
mustermann (1.0.0
|
91
|
-
nio4r (
|
92
|
-
nokogiri (1.
|
78
|
+
minitest (5.10.1)
|
79
|
+
mustermann (1.0.0)
|
80
|
+
nio4r (2.0.0)
|
81
|
+
nokogiri (1.7.1)
|
93
82
|
mini_portile2 (~> 2.1.0)
|
94
|
-
|
95
|
-
pkg-config (1.1.7)
|
96
|
-
poltergeist (1.10.0)
|
83
|
+
poltergeist (1.15.0)
|
97
84
|
capybara (~> 2.1)
|
98
85
|
cliver (~> 0.3.1)
|
99
86
|
websocket-driver (>= 0.2.0)
|
100
|
-
|
87
|
+
public_suffix (2.0.5)
|
88
|
+
puma (3.8.2)
|
101
89
|
rack (2.0.1)
|
90
|
+
rack-protection (2.0.0)
|
91
|
+
rack
|
102
92
|
rack-test (0.6.3)
|
103
93
|
rack (>= 1.0)
|
104
|
-
rails (5.
|
105
|
-
actioncable (= 5.
|
106
|
-
actionmailer (= 5.
|
107
|
-
actionpack (= 5.
|
108
|
-
actionview (= 5.
|
109
|
-
activejob (= 5.
|
110
|
-
activemodel (= 5.
|
111
|
-
activerecord (= 5.
|
112
|
-
activesupport (= 5.
|
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)
|
113
103
|
bundler (>= 1.3.0, < 2.0)
|
114
|
-
railties (= 5.
|
104
|
+
railties (= 5.1.0)
|
115
105
|
sprockets-rails (>= 2.0.0)
|
116
|
-
rails-dom-testing (2.0.
|
106
|
+
rails-dom-testing (2.0.2)
|
117
107
|
activesupport (>= 4.2.0, < 6.0)
|
118
|
-
nokogiri (~> 1.6
|
108
|
+
nokogiri (~> 1.6)
|
119
109
|
rails-html-sanitizer (1.0.3)
|
120
110
|
loofah (~> 2.0)
|
121
|
-
railties (5.
|
122
|
-
actionpack (= 5.
|
123
|
-
activesupport (= 5.
|
111
|
+
railties (5.1.0)
|
112
|
+
actionpack (= 5.1.0)
|
113
|
+
activesupport (= 5.1.0)
|
124
114
|
method_source
|
125
115
|
rake (>= 0.8.7)
|
126
116
|
thor (>= 0.18.1, < 2.0)
|
127
|
-
rake (
|
128
|
-
rspec (3.
|
129
|
-
rspec-core (~> 3.
|
130
|
-
rspec-expectations (~> 3.
|
131
|
-
rspec-mocks (~> 3.
|
132
|
-
rspec-core (3.
|
133
|
-
rspec-support (~> 3.
|
134
|
-
rspec-expectations (3.
|
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)
|
135
125
|
diff-lcs (>= 1.2.0, < 2.0)
|
136
|
-
rspec-support (~> 3.
|
137
|
-
rspec-mocks (3.
|
126
|
+
rspec-support (~> 3.6.0)
|
127
|
+
rspec-mocks (3.6.0)
|
138
128
|
diff-lcs (>= 1.2.0, < 2.0)
|
139
|
-
rspec-support (~> 3.
|
140
|
-
rspec-support (3.
|
129
|
+
rspec-support (~> 3.6.0)
|
130
|
+
rspec-support (3.6.0)
|
141
131
|
safe_yaml (1.0.4)
|
142
|
-
|
132
|
+
sinatra (2.0.0)
|
133
|
+
mustermann (~> 1.0)
|
134
|
+
rack (~> 2.0)
|
135
|
+
rack-protection (= 2.0.0)
|
136
|
+
tilt (~> 2.0)
|
137
|
+
sprockets (3.7.1)
|
143
138
|
concurrent-ruby (~> 1.0)
|
144
139
|
rack (> 1, < 3)
|
145
|
-
sprockets-rails (3.
|
140
|
+
sprockets-rails (3.2.0)
|
146
141
|
actionpack (>= 4.0)
|
147
142
|
activesupport (>= 4.0)
|
148
143
|
sprockets (>= 3.0.0)
|
149
|
-
thor (0.19.
|
150
|
-
thread_safe (0.3.
|
151
|
-
tilt (2.0.
|
152
|
-
tzinfo (1.2.
|
144
|
+
thor (0.19.4)
|
145
|
+
thread_safe (0.3.6)
|
146
|
+
tilt (2.0.7)
|
147
|
+
tzinfo (1.2.3)
|
153
148
|
thread_safe (~> 0.1)
|
154
149
|
vcr (3.0.3)
|
155
|
-
webmock (
|
150
|
+
webmock (3.0.1)
|
156
151
|
addressable (>= 2.3.6)
|
157
152
|
crack (>= 0.3.2)
|
158
153
|
hashdiff
|
159
|
-
websocket-driver (0.6.
|
154
|
+
websocket-driver (0.6.5)
|
160
155
|
websocket-extensions (>= 0.1.0)
|
161
156
|
websocket-extensions (0.1.2)
|
162
157
|
xpath (2.0.0)
|
@@ -171,11 +166,11 @@ DEPENDENCIES
|
|
171
166
|
rails (< 6)
|
172
167
|
rake
|
173
168
|
rspec
|
174
|
-
sinatra
|
169
|
+
sinatra
|
175
170
|
tilt
|
176
171
|
vcr (~> 3.0)
|
177
172
|
veritrans!
|
178
173
|
webmock (>= 1.20)
|
179
174
|
|
180
175
|
BUNDLED WITH
|
181
|
-
1.
|
176
|
+
1.14.6
|
data/Procfile
CHANGED
@@ -1 +1 @@
|
|
1
|
-
web: bundle exec puma -p $PORT --dir example config.ru
|
1
|
+
web: bundle exec puma -p $PORT --dir example/sinatra config.ru
|
data/README.md
CHANGED
@@ -1,8 +1,17 @@
|
|
1
1
|
# Veritrans ruby library
|
2
2
|
|
3
|
+
Veritrans gem is the library that will help you to integrate seamlessly with
|
4
|
+
Midtrans.
|
5
|
+
|
3
6
|
[![Gem Version](https://badge.fury.io/rb/veritrans.svg)](http://badge.fury.io/rb/veritrans)
|
4
7
|
[![Build Status](https://travis-ci.org/veritrans/veritrans-ruby.svg?branch=master)](https://travis-ci.org/veritrans/veritrans-ruby)
|
5
8
|
|
9
|
+
To see it in action, we have made 3 examples:
|
10
|
+
|
11
|
+
1. Sinatra, which demonstrate in as succint code as possible. Please [have a look here](https://github.com/veritrans/veritrans-ruby/tree/master/example/sinatra)
|
12
|
+
2. Simplepay, demonstrated how to integrate Midtrans with a simple, succint Rails project. [Have a look](https://github.com/veritrans/veritrans-ruby/tree/master/example/rails/simplepay).
|
13
|
+
3. Cable, demonstrate a chat-commerce app where the payment is handled with Midtrans. [Have a look](https://github.com/veritrans/veritrans-ruby/tree/master/example/rails/cable).
|
14
|
+
|
6
15
|
## How to use (Rails)
|
7
16
|
|
8
17
|
### Add gem veritrans to Gemfile
|
@@ -30,9 +39,6 @@ development:
|
|
30
39
|
server_key: # your api client key
|
31
40
|
```
|
32
41
|
|
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
|
-
|
36
42
|
## STEP 1: Process credit cards
|
37
43
|
|
38
44
|
|
@@ -52,6 +58,49 @@ See out example sinatra application in [example](https://github.com/veritrans/ve
|
|
52
58
|
redirect_to @result.redirect_url
|
53
59
|
```
|
54
60
|
|
61
|
+
#### Snap
|
62
|
+
|
63
|
+
First, generate token in the back end provided with enough details as necessary
|
64
|
+
and as detailed as you wish to.
|
65
|
+
|
66
|
+
```ruby
|
67
|
+
response = Veritrans.create_widget_token(
|
68
|
+
transaction_details: {
|
69
|
+
order_id: 'THE-ITEM-ORDER-ID',
|
70
|
+
gross_amount: 200000
|
71
|
+
}
|
72
|
+
)
|
73
|
+
|
74
|
+
@snap_token = response.token
|
75
|
+
```
|
76
|
+
|
77
|
+
Then on the front end, the token is saved somewhere probably in the hidden field.
|
78
|
+
|
79
|
+
```
|
80
|
+
<div class='cart'>
|
81
|
+
<!-- some other codes -->
|
82
|
+
<input type='hidden' name='snap-token' id='snap-token' value='<%= %>'>
|
83
|
+
<%= hidden_field_tag 'snap_token', @snap_token %>
|
84
|
+
<a href='#' class='order-button'>Order</a>
|
85
|
+
</div>
|
86
|
+
```
|
87
|
+
|
88
|
+
Then JavaScript can be used to invoke the SNAP dialog upon click on the
|
89
|
+
order button.
|
90
|
+
|
91
|
+
```javascript
|
92
|
+
var token = jQuery("#snap_token").val();
|
93
|
+
|
94
|
+
jQuery(".order-button").on("click", function() {
|
95
|
+
snap.pay(token, {
|
96
|
+
onSuccess: function(res) { console.log("SUCCESS RESPONSE", res); },
|
97
|
+
// you may also implement:
|
98
|
+
// onPending
|
99
|
+
// onError
|
100
|
+
});
|
101
|
+
});
|
102
|
+
```
|
103
|
+
|
55
104
|
#### VT-Direct
|
56
105
|
|
57
106
|
It's little more complicated, because credit_card is sensitive data,
|
@@ -62,7 +111,7 @@ We don't want you to send credit card number to your server, especially for webs
|
|
62
111
|
File: "app/views/shared/_veritrans_include.erb"
|
63
112
|
|
64
113
|
```html
|
65
|
-
<script src="
|
114
|
+
<script src="https://api.midtrans.com/v2/assets/js/midtrans.min.js"></script>
|
66
115
|
|
67
116
|
<script type="text/javascript">
|
68
117
|
Veritrans.url = "<%= Veritrans.config.api_host %>/v2/token";
|
@@ -86,7 +135,7 @@ Payment form: (same as if you use `rails g veritrans:payment_form`)
|
|
86
135
|
</p>
|
87
136
|
<p>
|
88
137
|
<%= label_tag "card_exp", "Expiration date" %>
|
89
|
-
<%= text_field_tag :card_exp, "12 /
|
138
|
+
<%= text_field_tag :card_exp, "12 / 18", name: nil, placeholder: "MM / YY" %>
|
90
139
|
</p>
|
91
140
|
<%= submit_tag "Make payment", id: "submit_btn" %>
|
92
141
|
<% end %>
|
@@ -109,7 +158,7 @@ For sinatra:
|
|
109
158
|
</p>
|
110
159
|
<p>
|
111
160
|
<label for="card_exp">Expiration date</label>
|
112
|
-
<input type="text" id="card_exp" placeholder="MM / YY" value="12 /
|
161
|
+
<input type="text" id="card_exp" placeholder="MM / YY" value="12 / 18">
|
113
162
|
</p>
|
114
163
|
<p>
|
115
164
|
<label for="card_secure">3D-secure</label>
|
@@ -198,16 +247,16 @@ For VT-Direct you have to specify payment method (token required only for credit
|
|
198
247
|
puts "Please send money to account no. #{@result.permata_va_number} in bank Permata"
|
199
248
|
```
|
200
249
|
|
201
|
-
See [our documentation](
|
250
|
+
See [our documentation](https://api-docs.midtrans.com/#charge-features) for other available options.
|
202
251
|
|
203
252
|
|
204
253
|
## STEP 3: Receive notification callback
|
205
254
|
|
206
255
|
For every transaction success and failed we will send you HTTP POST notification (aka webhook)
|
207
256
|
|
208
|
-
First you should set callback url in our dashboard https://
|
257
|
+
First you should set callback url in our dashboard https://dashboard.sandbox.midtrans.com/settings/vtweb_configuration
|
209
258
|
|
210
|
-
For testing in development phase please read our [Testing webhooks tutorial](https://github.com/veritrans/veritrans-ruby/blob/
|
259
|
+
For testing in development phase please read our [Testing webhooks tutorial](https://github.com/veritrans/veritrans-ruby/blob/master/testing_webhooks.md) and [command line tool](#command-line-tool)
|
211
260
|
|
212
261
|
|
213
262
|
For rails:
|
@@ -306,7 +355,7 @@ Testing http notification:
|
|
306
355
|
#### Get help
|
307
356
|
|
308
357
|
* [Veritrans gem reference](https://github.com/veritrans/veritrans-ruby/blob/master/api_reference.md)
|
309
|
-
* [
|
310
|
-
* [
|
311
|
-
* [
|
312
|
-
* Technical support [support@
|
358
|
+
* [Midtrans login](https://account.midtrans.com/login)
|
359
|
+
* [Midtrans registration](https://account.midtrans.com/register)
|
360
|
+
* [Midtrans documentation](http://docs.midtrans.com)
|
361
|
+
* Technical support [support@midtrans.com](mailto:support@midtrans.com)
|