veritrans 2.1.3 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (240) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +6 -1
  3. data/.travis.yml +3 -5
  4. data/CHANGELOG.md +20 -0
  5. data/Gemfile +1 -1
  6. data/Gemfile.lock +89 -94
  7. data/Procfile +1 -1
  8. data/README.md +62 -13
  9. data/api_reference.md +10 -10
  10. data/example/rails/cable/Gemfile +48 -0
  11. data/example/rails/cable/Gemfile.lock +184 -0
  12. data/example/rails/cable/README.md +29 -0
  13. data/example/rails/cable/Rakefile +6 -0
  14. data/example/rails/cable/app/assets/config/manifest.js +3 -0
  15. data/example/rails/cable/app/assets/images/.keep +0 -0
  16. data/example/rails/cable/app/assets/javascripts/application.js +15 -0
  17. data/example/rails/cable/app/assets/javascripts/cable.js +13 -0
  18. data/example/rails/cable/app/assets/javascripts/channels/.keep +0 -0
  19. data/example/rails/cable/app/assets/javascripts/chats.js +39 -0
  20. data/example/rails/cable/app/assets/javascripts/rooms.js +55 -0
  21. data/example/rails/cable/app/assets/stylesheets/application.css +16 -0
  22. data/example/rails/cable/app/assets/stylesheets/chatbox.scss +31 -0
  23. data/example/rails/cable/app/assets/stylesheets/peoplebox.scss +6 -0
  24. data/example/rails/cable/app/channels/application_cable/channel.rb +4 -0
  25. data/example/rails/cable/app/channels/application_cable/connection.rb +4 -0
  26. data/example/rails/cable/app/channels/rooms_texting_channel.rb +13 -0
  27. data/example/rails/cable/app/controllers/application_controller.rb +3 -0
  28. data/example/rails/cable/app/controllers/chats_controller.rb +18 -0
  29. data/example/rails/cable/app/controllers/concerns/.keep +0 -0
  30. data/example/rails/cable/app/controllers/pays_controller.rb +28 -0
  31. data/example/rails/cable/app/controllers/rooms_controller.rb +4 -0
  32. data/example/rails/cable/app/helpers/application_helper.rb +2 -0
  33. data/example/rails/cable/app/helpers/chats_helper.rb +2 -0
  34. data/example/rails/cable/app/helpers/rooms_helper.rb +5 -0
  35. data/example/rails/cable/app/jobs/application_job.rb +2 -0
  36. data/example/rails/cable/app/jobs/chat_broadcaster_job.rb +15 -0
  37. data/example/rails/cable/app/mailers/application_mailer.rb +4 -0
  38. data/example/rails/cable/app/models/application_record.rb +3 -0
  39. data/example/rails/cable/app/models/chat.rb +41 -0
  40. data/example/rails/cable/app/models/concerns/.keep +0 -0
  41. data/example/rails/cable/app/models/order.rb +2 -0
  42. data/example/rails/cable/app/models/user.rb +2 -0
  43. data/example/rails/cable/app/views/chats/_chat.html.erb +18 -0
  44. data/example/rails/cable/app/views/layouts/application.html.erb +19 -0
  45. data/example/rails/cable/app/views/layouts/mailer.html.erb +13 -0
  46. data/example/rails/cable/app/views/layouts/mailer.text.erb +1 -0
  47. data/example/rails/cable/app/views/rooms/_chatbox.html.erb +13 -0
  48. data/example/rails/cable/app/views/rooms/_online_people.html.erb +53 -0
  49. data/example/rails/cable/app/views/rooms/index.html.erb +9 -0
  50. data/example/rails/cable/bin/bundle +3 -0
  51. data/example/rails/cable/bin/rails +9 -0
  52. data/example/rails/cable/bin/rake +9 -0
  53. data/example/rails/cable/bin/setup +34 -0
  54. data/example/rails/cable/bin/spring +16 -0
  55. data/example/rails/cable/bin/update +29 -0
  56. data/example/rails/cable/config.ru +5 -0
  57. data/example/rails/cable/config/application.rb +16 -0
  58. data/example/rails/cable/config/boot.rb +3 -0
  59. data/example/rails/cable/config/cable.yml +9 -0
  60. data/example/rails/cable/config/database.yml +20 -0
  61. data/example/rails/cable/config/environment.rb +5 -0
  62. data/example/rails/cable/config/environments/development.rb +57 -0
  63. data/example/rails/cable/config/environments/production.rb +86 -0
  64. data/example/rails/cable/config/environments/test.rb +42 -0
  65. data/example/rails/cable/config/initializers/application_controller_renderer.rb +6 -0
  66. data/example/rails/cable/config/initializers/assets.rb +11 -0
  67. data/example/rails/cable/config/initializers/backtrace_silencers.rb +7 -0
  68. data/example/rails/cable/config/initializers/cookies_serializer.rb +5 -0
  69. data/example/rails/cable/config/initializers/filter_parameter_logging.rb +4 -0
  70. data/example/rails/cable/config/initializers/inflections.rb +16 -0
  71. data/example/rails/cable/config/initializers/mime_types.rb +4 -0
  72. data/example/rails/cable/config/initializers/new_framework_defaults.rb +24 -0
  73. data/example/rails/cable/config/initializers/session_store.rb +3 -0
  74. data/example/rails/cable/config/initializers/sidekiq.rb +2 -0
  75. data/example/rails/cable/config/initializers/veritrans.rb +46 -0
  76. data/example/rails/cable/config/initializers/wrap_parameters.rb +14 -0
  77. data/example/rails/cable/config/locales/en.yml +23 -0
  78. data/example/rails/cable/config/puma.rb +47 -0
  79. data/example/rails/cable/config/routes.rb +18 -0
  80. data/example/rails/cable/config/secrets.yml +22 -0
  81. data/example/rails/cable/config/spring.rb +6 -0
  82. data/example/rails/cable/config/veritrans.yml +13 -0
  83. data/example/rails/cable/db/development.sqlite3 +0 -0
  84. data/example/rails/cable/db/migrate/20161215070044_create_chats.rb +10 -0
  85. data/example/rails/cable/db/migrate/20161215072021_create_users.rb +10 -0
  86. data/example/rails/cable/db/migrate/20161219110219_create_orders.rb +11 -0
  87. data/example/rails/cable/db/schema.rb +37 -0
  88. data/example/rails/cable/db/seeds.rb +41 -0
  89. data/example/rails/cable/db/test.sqlite3 +0 -0
  90. data/example/rails/cable/lib/assets/.keep +0 -0
  91. data/example/rails/cable/lib/tasks/.keep +0 -0
  92. data/example/rails/cable/public/404.html +67 -0
  93. data/example/rails/cable/public/422.html +67 -0
  94. data/example/rails/cable/public/500.html +66 -0
  95. data/example/rails/cable/public/apple-touch-icon-precomposed.png +0 -0
  96. data/example/rails/cable/public/apple-touch-icon.png +0 -0
  97. data/example/rails/cable/public/favicon.ico +0 -0
  98. data/example/rails/cable/public/images/avatar1.jpg +0 -0
  99. data/example/rails/cable/public/images/avatar2.jpg +0 -0
  100. data/example/rails/cable/public/images/avatar3.jpg +0 -0
  101. data/example/rails/cable/public/images/avatar4.jpg +0 -0
  102. data/example/rails/cable/public/images/avatar5.jpg +0 -0
  103. data/example/rails/cable/public/images/avatar6.jpg +0 -0
  104. data/example/rails/cable/public/robots.txt +5 -0
  105. data/example/rails/cable/vendor/assets/javascripts/.keep +0 -0
  106. data/example/rails/cable/vendor/assets/stylesheets/.keep +0 -0
  107. data/example/rails/cable/vendor/assets/stylesheets/photon.css +2333 -0
  108. data/example/rails/simplepay/Gemfile +54 -0
  109. data/example/rails/simplepay/Gemfile.lock +178 -0
  110. data/example/rails/simplepay/README.md +30 -0
  111. data/example/rails/simplepay/Rakefile +6 -0
  112. data/example/rails/simplepay/app/assets/config/manifest.js +3 -0
  113. data/example/rails/simplepay/app/assets/images/.keep +0 -0
  114. data/example/rails/simplepay/app/assets/javascripts/application.js +16 -0
  115. data/example/rails/simplepay/app/assets/javascripts/cable.js +13 -0
  116. data/example/rails/simplepay/app/assets/javascripts/channels/.keep +0 -0
  117. data/example/rails/simplepay/app/assets/javascripts/pay.js +18 -0
  118. data/example/rails/simplepay/app/assets/stylesheets/application.css +15 -0
  119. data/example/rails/simplepay/app/assets/stylesheets/style.css +254 -0
  120. data/example/rails/simplepay/app/channels/application_cable/channel.rb +4 -0
  121. data/example/rails/simplepay/app/channels/application_cable/connection.rb +4 -0
  122. data/example/rails/simplepay/app/controllers/application_controller.rb +3 -0
  123. data/example/rails/simplepay/app/controllers/concerns/.keep +0 -0
  124. data/example/rails/simplepay/app/controllers/home_controller.rb +16 -0
  125. data/example/rails/simplepay/app/controllers/pay_controller.rb +10 -0
  126. data/example/rails/simplepay/app/helpers/application_helper.rb +2 -0
  127. data/example/rails/simplepay/app/helpers/pay_helper.rb +2 -0
  128. data/example/rails/simplepay/app/jobs/application_job.rb +2 -0
  129. data/example/rails/simplepay/app/mailers/application_mailer.rb +4 -0
  130. data/example/rails/simplepay/app/models/application_record.rb +3 -0
  131. data/example/rails/simplepay/app/models/concerns/.keep +0 -0
  132. data/example/rails/simplepay/app/models/order.rb +2 -0
  133. data/example/rails/simplepay/app/views/home/index.html.erb +19 -0
  134. data/example/rails/simplepay/app/views/layouts/application.html.erb +15 -0
  135. data/example/rails/simplepay/app/views/layouts/mailer.html.erb +13 -0
  136. data/example/rails/simplepay/app/views/layouts/mailer.text.erb +1 -0
  137. data/example/rails/simplepay/app/views/pay/notify.html.erb +2 -0
  138. data/example/rails/simplepay/bin/bundle +3 -0
  139. data/example/rails/simplepay/bin/rails +9 -0
  140. data/example/rails/simplepay/bin/rake +9 -0
  141. data/example/rails/simplepay/bin/setup +34 -0
  142. data/example/rails/simplepay/bin/spring +16 -0
  143. data/example/rails/simplepay/bin/update +29 -0
  144. data/example/rails/simplepay/config.ru +5 -0
  145. data/example/rails/simplepay/config/application.rb +15 -0
  146. data/example/rails/simplepay/config/boot.rb +3 -0
  147. data/example/rails/simplepay/config/cable.yml +9 -0
  148. data/example/rails/simplepay/config/database.yml +25 -0
  149. data/example/rails/simplepay/config/environment.rb +5 -0
  150. data/example/rails/simplepay/config/environments/development.rb +57 -0
  151. data/example/rails/simplepay/config/environments/production.rb +86 -0
  152. data/example/rails/simplepay/config/environments/test.rb +42 -0
  153. data/example/rails/simplepay/config/initializers/application_controller_renderer.rb +6 -0
  154. data/example/rails/simplepay/config/initializers/assets.rb +11 -0
  155. data/example/rails/simplepay/config/initializers/backtrace_silencers.rb +7 -0
  156. data/example/rails/simplepay/config/initializers/cookies_serializer.rb +5 -0
  157. data/example/rails/simplepay/config/initializers/filter_parameter_logging.rb +4 -0
  158. data/example/rails/simplepay/config/initializers/inflections.rb +16 -0
  159. data/example/rails/simplepay/config/initializers/mime_types.rb +4 -0
  160. data/example/rails/simplepay/config/initializers/new_framework_defaults.rb +24 -0
  161. data/example/rails/simplepay/config/initializers/session_store.rb +3 -0
  162. data/example/rails/simplepay/config/initializers/veritrans.rb +46 -0
  163. data/example/rails/simplepay/config/initializers/wrap_parameters.rb +14 -0
  164. data/example/rails/simplepay/config/locales/en.yml +23 -0
  165. data/example/rails/simplepay/config/puma.rb +47 -0
  166. data/example/rails/simplepay/config/routes.rb +5 -0
  167. data/example/rails/simplepay/config/secrets.yml +22 -0
  168. data/example/rails/simplepay/config/spring.rb +6 -0
  169. data/example/rails/simplepay/config/veritrans.yml +18 -0
  170. data/example/rails/simplepay/db/development.sqlite3 +0 -0
  171. data/example/rails/simplepay/db/migrate/20161221090855_create_orders.rb +10 -0
  172. data/example/rails/simplepay/db/schema.rb +22 -0
  173. data/example/rails/simplepay/db/seeds.rb +7 -0
  174. data/example/rails/simplepay/db/test.sqlite3 +0 -0
  175. data/example/rails/simplepay/lib/assets/.keep +0 -0
  176. data/example/rails/simplepay/lib/tasks/.keep +0 -0
  177. data/example/rails/simplepay/public/404.html +67 -0
  178. data/example/rails/simplepay/public/422.html +67 -0
  179. data/example/rails/simplepay/public/500.html +66 -0
  180. data/example/rails/simplepay/public/apple-touch-icon-precomposed.png +0 -0
  181. data/example/rails/simplepay/public/apple-touch-icon.png +0 -0
  182. data/example/rails/simplepay/public/favicon.ico +0 -0
  183. data/example/rails/simplepay/public/robots.txt +5 -0
  184. data/example/rails/simplepay/vendor/assets/javascripts/.keep +0 -0
  185. data/example/rails/simplepay/vendor/assets/stylesheets/.keep +0 -0
  186. data/example/{README.md → sinatra/README.md} +0 -0
  187. data/example/{config.ru → sinatra/config.ru} +3 -0
  188. data/example/{index.erb → sinatra/index.erb} +7 -6
  189. data/example/{localization.erb → sinatra/localization.erb} +6 -5
  190. data/example/{points.erb → sinatra/points.erb} +6 -5
  191. data/example/{recurring.erb → sinatra/recurring.erb} +6 -6
  192. data/example/{response.erb → sinatra/response.erb} +4 -1
  193. data/example/{sinatra.rb → sinatra/sinatra.rb} +9 -3
  194. data/example/{style.css → sinatra/style.css} +11 -0
  195. data/example/{veritrans.yml → sinatra/veritrans.yml} +2 -2
  196. data/example/{widget.erb → sinatra/widget.erb} +18 -6
  197. data/lib/generators/templates/assets/credit_card_form.js +6 -0
  198. data/lib/generators/templates/payments_controller.rb +4 -4
  199. data/lib/generators/templates/veritrans.yml +5 -5
  200. data/lib/generators/templates/views/_credit_card_form.erb +2 -2
  201. data/lib/generators/templates/views/_veritrans_include.erb +1 -1
  202. data/lib/generators/veritrans/install_generator.rb +1 -1
  203. data/lib/generators/veritrans/payment_form_generator.rb +1 -1
  204. data/lib/veritrans.rb +106 -5
  205. data/lib/veritrans/api.rb +7 -7
  206. data/lib/veritrans/cli.rb +11 -5
  207. data/lib/veritrans/client.rb +7 -4
  208. data/lib/veritrans/config.rb +5 -3
  209. data/lib/veritrans/events.rb +46 -35
  210. data/lib/veritrans/result.rb +58 -2
  211. data/lib/veritrans/testing.rb +156 -0
  212. data/lib/veritrans/version.rb +1 -1
  213. data/spec/cli_spec.rb +2 -2
  214. data/spec/fixtures/approve_failed.yml +1 -1
  215. data/spec/fixtures/cancel_failed.yml +1 -1
  216. data/spec/fixtures/cancel_success.yml +2 -2
  217. data/spec/fixtures/capture_failed.yml +1 -1
  218. data/spec/fixtures/charge.yml +2 -2
  219. data/spec/fixtures/charge_direct.yml +1 -1
  220. data/spec/fixtures/charge_vtweb.yml +2 -2
  221. data/spec/fixtures/cli_test_1111-not-exists.yml +1 -1
  222. data/spec/fixtures/cli_test_not_exists.yml +1 -1
  223. data/spec/fixtures/cli_test_real_txn.yml +1 -1
  224. data/spec/fixtures/cli_test_unauthorized.yml +1 -1
  225. data/spec/fixtures/events_test_real_txn.yml +1 -1
  226. data/spec/fixtures/expire_failed.yml +1 -1
  227. data/spec/fixtures/expire_success.yml +1 -1
  228. data/spec/fixtures/midtrans_status.yml +2 -2
  229. data/spec/fixtures/status_fail.yml +1 -1
  230. data/spec/fixtures/status_success.yml +2 -2
  231. data/spec/rails_plugin_spec.rb +37 -20
  232. data/spec/spec_helper.rb +0 -1
  233. data/spec/veritrans_client_spec.rb +1 -1
  234. data/spec/veritrans_config_spec.rb +1 -1
  235. data/spec/veritrans_events_spec.rb +6 -6
  236. data/spec/veritrans_testing_spec.rb +184 -0
  237. data/testing_webhooks.md +2 -2
  238. data/veritrans.gemspec +1 -1
  239. metadata +195 -16
  240. data/lib/veritrans/core_extensions.rb +0 -32
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c610e190c04bc6be296adf2fe3d4b5ad00009872
4
- data.tar.gz: 19375928d04af1fef395e20df335910f621ec9a9
3
+ metadata.gz: 7e730ba1e4af501d657c0899a9245863bf7248a2
4
+ data.tar.gz: 8be1a82116cc7c32749f598b8e096f911375808a
5
5
  SHA512:
6
- metadata.gz: 9e83f571dc75053a9cd0d254202cbef175c045ad9477af7ea94480e77c31f317631cf377b512ac9a4e2d9f88d15270958fb24294f7195c8265899a3536a68d67
7
- data.tar.gz: 8593be4707141266a9d55dbd8599242d5e8153b04d8ad7b985a71aa7358a620cb61c04c63c32b8765513eb86c1aad2e2f9208af5cfc23c1db713d743475ca831
6
+ metadata.gz: f8f0f756955f910466940d0f9ded79afe66ed5344b52b310a4b075ac69afc096f8b9f422e1a8284cf19ada0920d8196550a9b2bfa6db968dd84f319e8c1e7916
7
+ data.tar.gz: 3dcb81801e38bc39bf517c07bb69fc6ebacd4949fffc3127508bd410ec121b751310123f866284229b17a2c980eaee819909b38f7175d893c7ab1423820bdf0a
data/.gitignore CHANGED
@@ -3,4 +3,9 @@ rails_example*
3
3
  .DS_Store
4
4
  tmp
5
5
  doc/
6
- veritrans_credentials
6
+ example/rails/cable/log
7
+ example/rails/cable/tmp
8
+ example/rails/simplepay/log
9
+ example/rails/simplepay/tmp
10
+ veritrans_credentials
11
+ .ruby-version
@@ -3,11 +3,9 @@ cache: bundler
3
3
  env:
4
4
  - DEBUG=1
5
5
 
6
- before_install:
7
- - gem install bundler -v '~> 1.11'
8
-
9
6
  script: "bundle exec rspec"
10
7
 
11
8
  rvm:
12
- - 2.2.4
13
- - 2.3.1
9
+ - 2.2.7
10
+ - 2.3.4
11
+ - 2.4.1
@@ -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
@@ -5,7 +5,7 @@ gem 'rspec'
5
5
 
6
6
  gem 'rails', '< 6'
7
7
 
8
- gem 'sinatra', git: 'https://github.com/sinatra/sinatra.git'
8
+ gem 'sinatra'
9
9
  gem 'puma'
10
10
  gem 'tilt'
11
11
 
@@ -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.1.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.0.0.1)
23
- actionpack (= 5.0.0.1)
24
- nio4r (~> 1.2)
10
+ actioncable (5.1.0)
11
+ actionpack (= 5.1.0)
12
+ nio4r (~> 2.0)
25
13
  websocket-driver (~> 0.6.1)
26
- actionmailer (5.0.0.1)
27
- actionpack (= 5.0.0.1)
28
- actionview (= 5.0.0.1)
29
- activejob (= 5.0.0.1)
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.0.0.1)
33
- actionview (= 5.0.0.1)
34
- activesupport (= 5.0.0.1)
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.0.0.1)
40
- activesupport (= 5.0.0.1)
27
+ actionview (5.1.0)
28
+ activesupport (= 5.1.0)
41
29
  builder (~> 3.1)
42
- erubis (~> 2.7.0)
30
+ erubi (~> 1.4)
43
31
  rails-dom-testing (~> 2.0)
44
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
45
- activejob (5.0.0.1)
46
- activesupport (= 5.0.0.1)
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.0.0.1)
49
- activesupport (= 5.0.0.1)
50
- activerecord (5.0.0.1)
51
- activemodel (= 5.0.0.1)
52
- activesupport (= 5.0.0.1)
53
- arel (~> 7.0)
54
- activesupport (5.0.0.1)
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.4.0)
60
- arel (7.1.1)
61
- builder (3.2.2)
62
- capybara (2.7.1)
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.2)
59
+ concurrent-ruby (1.0.5)
71
60
  crack (0.4.3)
72
61
  safe_yaml (~> 1.0.0)
73
- diff-lcs (1.2.5)
74
- erubis (2.7.0)
75
- excon (0.53.0)
76
- globalid (0.3.7)
77
- activesupport (>= 4.1.0)
78
- hashdiff (0.3.0)
79
- i18n (0.7.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.4)
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.9.0)
90
- mustermann (1.0.0.beta2)
91
- nio4r (1.2.1)
92
- nokogiri (1.6.8)
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
- pkg-config (~> 1.1.7)
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
- puma (3.6.0)
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.0.0.1)
105
- actioncable (= 5.0.0.1)
106
- actionmailer (= 5.0.0.1)
107
- actionpack (= 5.0.0.1)
108
- actionview (= 5.0.0.1)
109
- activejob (= 5.0.0.1)
110
- activemodel (= 5.0.0.1)
111
- activerecord (= 5.0.0.1)
112
- activesupport (= 5.0.0.1)
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.0.0.1)
104
+ railties (= 5.1.0)
115
105
  sprockets-rails (>= 2.0.0)
116
- rails-dom-testing (2.0.1)
106
+ rails-dom-testing (2.0.2)
117
107
  activesupport (>= 4.2.0, < 6.0)
118
- nokogiri (~> 1.6.0)
108
+ nokogiri (~> 1.6)
119
109
  rails-html-sanitizer (1.0.3)
120
110
  loofah (~> 2.0)
121
- railties (5.0.0.1)
122
- actionpack (= 5.0.0.1)
123
- activesupport (= 5.0.0.1)
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 (11.2.2)
128
- rspec (3.5.0)
129
- rspec-core (~> 3.5.0)
130
- rspec-expectations (~> 3.5.0)
131
- rspec-mocks (~> 3.5.0)
132
- rspec-core (3.5.2)
133
- rspec-support (~> 3.5.0)
134
- rspec-expectations (3.5.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)
135
125
  diff-lcs (>= 1.2.0, < 2.0)
136
- rspec-support (~> 3.5.0)
137
- rspec-mocks (3.5.0)
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.5.0)
140
- rspec-support (3.5.0)
129
+ rspec-support (~> 3.6.0)
130
+ rspec-support (3.6.0)
141
131
  safe_yaml (1.0.4)
142
- sprockets (3.7.0)
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.1.1)
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.1)
150
- thread_safe (0.3.5)
151
- tilt (2.0.5)
152
- tzinfo (1.2.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 (2.1.0)
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.4)
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.13.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="//api.sandbox.veritrans.co.id/v2/assets/veritrans.js"></script>
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 / 16", name: nil, placeholder: "MM / YY" %>
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 / 16">
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](http://docs.veritrans.co.id/sandbox/charge.html) for other available options.
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://my.sandbox.veritrans.co.id/settings/vtweb_configuration
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/new_api/testing_webhooks.md) and [command line tool](#command-line-tool)
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
- * [Veritrans login](https://my.veritrans.co.id/login)
310
- * [Veritrans registration](https://my.veritrans.co.id/register)
311
- * [Veritrans documentation](http://docs.veritrans.co.id)
312
- * Technical support [support@veritrans.co.id](mailto:support@veritrans.co.id)
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)