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
@@ -0,0 +1,54 @@
1
+ source 'https://rubygems.org'
2
+
3
+ git_source(:github) do |repo_name|
4
+ repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
5
+ "https://github.com/#{repo_name}.git"
6
+ end
7
+
8
+
9
+ # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
10
+ gem 'rails', '~> 5.0.1'
11
+ # Use sqlite3 as the database for Active Record
12
+ gem 'sqlite3'
13
+ # Use Puma as the app server
14
+ gem 'puma', '~> 3.0'
15
+ # Use SCSS for stylesheets
16
+ gem 'sass-rails', '~> 5.0'
17
+ # Use Uglifier as compressor for JavaScript assets
18
+ gem 'uglifier', '>= 1.3.0'
19
+ # Use CoffeeScript for .coffee assets and views
20
+ gem 'coffee-rails', '~> 4.2'
21
+ # See https://github.com/rails/execjs#readme for more supported runtimes
22
+ # gem 'therubyracer', platforms: :ruby
23
+ gem 'veritrans', '~> 2'
24
+
25
+ # Use jquery as the JavaScript library
26
+ gem 'jquery-rails'
27
+ # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
28
+ gem 'turbolinks', '~> 5'
29
+ # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
30
+ gem 'jbuilder', '~> 2.5'
31
+ # Use Redis adapter to run Action Cable in production
32
+ # gem 'redis', '~> 3.0'
33
+ # Use ActiveModel has_secure_password
34
+ # gem 'bcrypt', '~> 3.1.7'
35
+
36
+ # Use Capistrano for deployment
37
+ # gem 'capistrano-rails', group: :development
38
+
39
+ group :development, :test do
40
+ # Call 'byebug' anywhere in the code to stop execution and get a debugger console
41
+ gem 'byebug', platform: :mri
42
+ end
43
+
44
+ group :development do
45
+ # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
46
+ gem 'web-console', '>= 3.3.0'
47
+ gem 'listen', '~> 3.0.5'
48
+ # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
49
+ gem 'spring'
50
+ gem 'spring-watcher-listen', '~> 2.0.0'
51
+ end
52
+
53
+ # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
54
+ gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
@@ -0,0 +1,178 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ actioncable (5.0.1)
5
+ actionpack (= 5.0.1)
6
+ nio4r (~> 1.2)
7
+ websocket-driver (~> 0.6.1)
8
+ actionmailer (5.0.1)
9
+ actionpack (= 5.0.1)
10
+ actionview (= 5.0.1)
11
+ activejob (= 5.0.1)
12
+ mail (~> 2.5, >= 2.5.4)
13
+ rails-dom-testing (~> 2.0)
14
+ actionpack (5.0.1)
15
+ actionview (= 5.0.1)
16
+ activesupport (= 5.0.1)
17
+ rack (~> 2.0)
18
+ rack-test (~> 0.6.3)
19
+ rails-dom-testing (~> 2.0)
20
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
21
+ actionview (5.0.1)
22
+ activesupport (= 5.0.1)
23
+ builder (~> 3.1)
24
+ erubis (~> 2.7.0)
25
+ rails-dom-testing (~> 2.0)
26
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
27
+ activejob (5.0.1)
28
+ activesupport (= 5.0.1)
29
+ globalid (>= 0.3.6)
30
+ activemodel (5.0.1)
31
+ activesupport (= 5.0.1)
32
+ activerecord (5.0.1)
33
+ activemodel (= 5.0.1)
34
+ activesupport (= 5.0.1)
35
+ arel (~> 7.0)
36
+ activesupport (5.0.1)
37
+ concurrent-ruby (~> 1.0, >= 1.0.2)
38
+ i18n (~> 0.7)
39
+ minitest (~> 5.1)
40
+ tzinfo (~> 1.1)
41
+ arel (7.1.4)
42
+ builder (3.2.2)
43
+ byebug (9.0.6)
44
+ coffee-rails (4.2.1)
45
+ coffee-script (>= 2.2.0)
46
+ railties (>= 4.0.0, < 5.2.x)
47
+ coffee-script (2.4.1)
48
+ coffee-script-source
49
+ execjs
50
+ coffee-script-source (1.12.2)
51
+ concurrent-ruby (1.0.3)
52
+ debug_inspector (0.0.2)
53
+ erubis (2.7.0)
54
+ excon (0.54.0)
55
+ execjs (2.7.0)
56
+ ffi (1.9.14)
57
+ globalid (0.3.7)
58
+ activesupport (>= 4.1.0)
59
+ i18n (0.7.0)
60
+ jbuilder (2.6.1)
61
+ activesupport (>= 3.0.0, < 5.1)
62
+ multi_json (~> 1.2)
63
+ jquery-rails (4.2.1)
64
+ rails-dom-testing (>= 1, < 3)
65
+ railties (>= 4.2.0)
66
+ thor (>= 0.14, < 2.0)
67
+ listen (3.0.8)
68
+ rb-fsevent (~> 0.9, >= 0.9.4)
69
+ rb-inotify (~> 0.9, >= 0.9.7)
70
+ loofah (2.0.3)
71
+ nokogiri (>= 1.5.9)
72
+ mail (2.6.4)
73
+ mime-types (>= 1.16, < 4)
74
+ method_source (0.8.2)
75
+ mime-types (3.1)
76
+ mime-types-data (~> 3.2015)
77
+ mime-types-data (3.2016.0521)
78
+ mini_portile2 (2.1.0)
79
+ minitest (5.10.1)
80
+ multi_json (1.12.1)
81
+ nio4r (1.2.1)
82
+ nokogiri (1.6.8.1)
83
+ mini_portile2 (~> 2.1.0)
84
+ puma (3.6.2)
85
+ rack (2.0.1)
86
+ rack-test (0.6.3)
87
+ rack (>= 1.0)
88
+ rails (5.0.1)
89
+ actioncable (= 5.0.1)
90
+ actionmailer (= 5.0.1)
91
+ actionpack (= 5.0.1)
92
+ actionview (= 5.0.1)
93
+ activejob (= 5.0.1)
94
+ activemodel (= 5.0.1)
95
+ activerecord (= 5.0.1)
96
+ activesupport (= 5.0.1)
97
+ bundler (>= 1.3.0, < 2.0)
98
+ railties (= 5.0.1)
99
+ sprockets-rails (>= 2.0.0)
100
+ rails-dom-testing (2.0.1)
101
+ activesupport (>= 4.2.0, < 6.0)
102
+ nokogiri (~> 1.6.0)
103
+ rails-html-sanitizer (1.0.3)
104
+ loofah (~> 2.0)
105
+ railties (5.0.1)
106
+ actionpack (= 5.0.1)
107
+ activesupport (= 5.0.1)
108
+ method_source
109
+ rake (>= 0.8.7)
110
+ thor (>= 0.18.1, < 2.0)
111
+ rake (12.0.0)
112
+ rb-fsevent (0.9.8)
113
+ rb-inotify (0.9.7)
114
+ ffi (>= 0.5.0)
115
+ sass (3.4.23)
116
+ sass-rails (5.0.6)
117
+ railties (>= 4.0.0, < 6)
118
+ sass (~> 3.1)
119
+ sprockets (>= 2.8, < 4.0)
120
+ sprockets-rails (>= 2.0, < 4.0)
121
+ tilt (>= 1.1, < 3)
122
+ spring (2.0.0)
123
+ activesupport (>= 4.2)
124
+ spring-watcher-listen (2.0.1)
125
+ listen (>= 2.7, < 4.0)
126
+ spring (>= 1.2, < 3.0)
127
+ sprockets (3.7.1)
128
+ concurrent-ruby (~> 1.0)
129
+ rack (> 1, < 3)
130
+ sprockets-rails (3.2.0)
131
+ actionpack (>= 4.0)
132
+ activesupport (>= 4.0)
133
+ sprockets (>= 3.0.0)
134
+ sqlite3 (1.3.12)
135
+ thor (0.19.4)
136
+ thread_safe (0.3.5)
137
+ tilt (2.0.5)
138
+ turbolinks (5.0.1)
139
+ turbolinks-source (~> 5)
140
+ turbolinks-source (5.0.0)
141
+ tzinfo (1.2.2)
142
+ thread_safe (~> 0.1)
143
+ uglifier (3.0.4)
144
+ execjs (>= 0.3.0, < 3)
145
+ veritrans (2.1.3)
146
+ excon (~> 0.20)
147
+ web-console (3.4.0)
148
+ actionview (>= 5.0)
149
+ activemodel (>= 5.0)
150
+ debug_inspector
151
+ railties (>= 5.0)
152
+ websocket-driver (0.6.4)
153
+ websocket-extensions (>= 0.1.0)
154
+ websocket-extensions (0.1.2)
155
+
156
+ PLATFORMS
157
+ ruby
158
+
159
+ DEPENDENCIES
160
+ byebug
161
+ coffee-rails (~> 4.2)
162
+ jbuilder (~> 2.5)
163
+ jquery-rails
164
+ listen (~> 3.0.5)
165
+ puma (~> 3.0)
166
+ rails (~> 5.0.1)
167
+ sass-rails (~> 5.0)
168
+ spring
169
+ spring-watcher-listen (~> 2.0.0)
170
+ sqlite3
171
+ turbolinks (~> 5)
172
+ tzinfo-data
173
+ uglifier (>= 1.3.0)
174
+ veritrans (~> 2)
175
+ web-console (>= 3.3.0)
176
+
177
+ BUNDLED WITH
178
+ 1.13.1
@@ -0,0 +1,30 @@
1
+ # Simplepay
2
+
3
+ Example of checkout page using Midtrans Snap. A quick way to accept payment with
4
+ a beautiful user interface done for you.
5
+
6
+ This is a very simple, very minimalist example to demonstrate integrating
7
+ Midtrans Snap with Ruby on Rails. To start:
8
+
9
+ 1. Install Ruby and Ruby on Rails
10
+ 2. Clone the repository
11
+ 3. `bundle install` on the directory
12
+ 4. Run `rake db:drop db:create db:migrate`
13
+ 5. Run `rails s`, and you are done. You can visit it at `http://127.0.0.1:3000`
14
+
15
+ The Midtrans configuration is located at `config/initializers/veritrans.rb`.
16
+
17
+ ## PaysController
18
+
19
+ PaysController handle the notification from Midtrans. As each payment is processed
20
+ asynchronously (you don't want your system to do nothing/wait when Midtrans system
21
+ is also channeling your charge request to the bank/payment providers), all merchant
22
+ need to implement the notification mechanism.
23
+
24
+ The notification mechanism on your part allow Midtrans to callback your system
25
+ and informing if the payment is really successful, or if the payment is rejected
26
+ due to some reasons. Therefore, payment notification is an integral part to
27
+ have a successful integration with Midtrans.
28
+
29
+ The notification infrastructure in the client's part is implemented on
30
+ `PaysController` which handle the callbacks from Midtrans (the `notify` action).
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require_relative 'config/application'
5
+
6
+ Rails.application.load_tasks
@@ -0,0 +1,3 @@
1
+ //= link_tree ../images
2
+ //= link_directory ../javascripts .js
3
+ //= link_directory ../stylesheets .css
@@ -0,0 +1,16 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file. JavaScript code in this file should be added after the last require_* statement.
9
+ //
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require turbolinks
16
+ //= require_tree .
@@ -0,0 +1,13 @@
1
+ // Action Cable provides the framework to deal with WebSockets in Rails.
2
+ // You can generate new channels where WebSocket features live using the rails generate channel command.
3
+ //
4
+ //= require action_cable
5
+ //= require_self
6
+ //= require_tree ./channels
7
+
8
+ (function() {
9
+ this.App || (this.App = {});
10
+
11
+ App.cable = ActionCable.createConsumer();
12
+
13
+ }).call(this);
@@ -0,0 +1,18 @@
1
+ jQuery(document).ready(function() {
2
+ var token = jQuery("#snap_token").val();
3
+
4
+ jQuery('.checkout-button').on('click', function() {
5
+ snap.pay(token, {
6
+ onSuccess: function(res) {
7
+ console.log("SUCCESS", res);
8
+ alert("Payment accepted!");
9
+ },
10
+ onPending: function(res) {
11
+ console.log("PENDING", res);
12
+ },
13
+ onError: function(res) {
14
+ console.log("ERROR", res);
15
+ }
16
+ })
17
+ })
18
+ });
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,254 @@
1
+ * {
2
+ -moz-transition: all 0.3s;
3
+ -o-transition: all 0.3s;
4
+ -webkit-transition: all 0.3s;
5
+ transition: all 0.3s;
6
+ -moz-box-sizing: border-box;
7
+ -webkit-box-sizing: border-box;
8
+ box-sizing: border-box;
9
+ }
10
+
11
+ body {
12
+ background: #ecece6;
13
+ }
14
+
15
+ @-webkit-keyframes $animation_name {
16
+ from {
17
+ -moz-transform: rotate(45deg) translate(-80px, 40px);
18
+ -ms-transform: rotate(45deg) translate(-80px, 40px);
19
+ -webkit-transform: rotate(45deg) translate(-80px, 40px);
20
+ transform: rotate(45deg) translate(-80px, 40px);
21
+ }
22
+ to {
23
+ -moz-transform: rotate(0deg) translate(0px, 0);
24
+ -ms-transform: rotate(0deg) translate(0px, 0);
25
+ -webkit-transform: rotate(0deg) translate(0px, 0);
26
+ transform: rotate(0deg) translate(0px, 0);
27
+ }
28
+ }
29
+ @-moz-keyframes $animation_name {
30
+ from {
31
+ -moz-transform: rotate(45deg) translate(-80px, 40px);
32
+ -ms-transform: rotate(45deg) translate(-80px, 40px);
33
+ -webkit-transform: rotate(45deg) translate(-80px, 40px);
34
+ transform: rotate(45deg) translate(-80px, 40px);
35
+ }
36
+ to {
37
+ -moz-transform: rotate(0deg) translate(0px, 0);
38
+ -ms-transform: rotate(0deg) translate(0px, 0);
39
+ -webkit-transform: rotate(0deg) translate(0px, 0);
40
+ transform: rotate(0deg) translate(0px, 0);
41
+ }
42
+ }
43
+ @-o-keyframes $animation_name {
44
+ from {
45
+ -moz-transform: rotate(45deg) translate(-80px, 40px);
46
+ -ms-transform: rotate(45deg) translate(-80px, 40px);
47
+ -webkit-transform: rotate(45deg) translate(-80px, 40px);
48
+ transform: rotate(45deg) translate(-80px, 40px);
49
+ }
50
+ to {
51
+ -moz-transform: rotate(0deg) translate(0px, 0);
52
+ -ms-transform: rotate(0deg) translate(0px, 0);
53
+ -webkit-transform: rotate(0deg) translate(0px, 0);
54
+ transform: rotate(0deg) translate(0px, 0);
55
+ }
56
+ }
57
+ @keyframes $animation_name {
58
+ from {
59
+ -moz-transform: rotate(45deg) translate(-80px, 40px);
60
+ -ms-transform: rotate(45deg) translate(-80px, 40px);
61
+ -webkit-transform: rotate(45deg) translate(-80px, 40px);
62
+ transform: rotate(45deg) translate(-80px, 40px);
63
+ }
64
+ to {
65
+ -moz-transform: rotate(0deg) translate(0px, 0);
66
+ -ms-transform: rotate(0deg) translate(0px, 0);
67
+ -webkit-transform: rotate(0deg) translate(0px, 0);
68
+ transform: rotate(0deg) translate(0px, 0);
69
+ }
70
+ }
71
+ /* button style */
72
+ .cart {
73
+ width: 40px;
74
+ height: 40px;
75
+ padding: 0;
76
+ margin: 0;
77
+ margin-top: 100px;
78
+ position: absolute;
79
+ left: 50%;
80
+ margin-left: -20px;
81
+ -moz-border-radius: 9999em;
82
+ -webkit-border-radius: 9999em;
83
+ border-radius: 9999em;
84
+ border: none;
85
+ background: #e54040;
86
+ cursor: pointer;
87
+ }
88
+ .cart:hover {
89
+ -moz-box-shadow: inset 0 0 7px 0 rgba(0, 0, 0, 0.5);
90
+ -webkit-box-shadow: inset 0 0 7px 0 rgba(0, 0, 0, 0.5);
91
+ box-shadow: inset 0 0 7px 0 rgba(0, 0, 0, 0.5);
92
+ }
93
+ .cart:hover .popup {
94
+ visibility: visible;
95
+ opacity: 1;
96
+ pointer-events: auto;
97
+ -webkit-animation-duration: 200ms;
98
+ -webkit-animation-name: show-popup;
99
+ -webkit-animation-direction: normal;
100
+ -webkit-animation-timing-function: cubic-bezier(1, 0.18, 1, 0.93);
101
+ -moz-animation-duration: 200ms;
102
+ -moz-animation-name: show-popup;
103
+ -moz-animation-direction: normal;
104
+ -moz-animation-timing-function: cubic-bezier(1, 0.18, 1, 0.93);
105
+ -o-animation-duration: 200ms;
106
+ -o-animation-name: show-popup;
107
+ -o-animation-direction: normal;
108
+ -o-animation-timing-function: cubic-bezier(1, 0.18, 1, 0.93);
109
+ animation-duration: 200ms;
110
+ animation-name: show-popup;
111
+ animation-direction: normal;
112
+ animation-timing-function: cubic-bezier(1, 0.18, 1, 0.93);
113
+ }
114
+
115
+ /* popup window style */
116
+ .popup {
117
+ visibility: hidden;
118
+ opacity: 0;
119
+ pointer-events: none;
120
+ position: absolute;
121
+ top: 100%;
122
+ width: 250px;
123
+ margin-left: -105px;
124
+ margin-top: 20px;
125
+ background: #ffffff;
126
+ border: 1px solid #cbcbcb;
127
+ -moz-border-radius: 5px;
128
+ -webkit-border-radius: 5px;
129
+ border-radius: 5px;
130
+ -moz-box-shadow: 0 0 3px 0 rgba(0, 0, 0, 0.3);
131
+ -webkit-box-shadow: 0 0 3px 0 rgba(0, 0, 0, 0.3);
132
+ box-shadow: 0 0 3px 0 rgba(0, 0, 0, 0.3);
133
+ }
134
+ .popup:after {
135
+ position: absolute;
136
+ content: ' ';
137
+ top: -30px;
138
+ height: 30px;
139
+ width: 100%;
140
+ }
141
+ .popup:before {
142
+ position: absolute;
143
+ content: ' ';
144
+ left: 117px;
145
+ top: -9px;
146
+ width: 16px;
147
+ height: 16px;
148
+ border-top: 1px solid #cbcbcb;
149
+ border-right: 1px solid #cbcbcb;
150
+ background: #ffffff;
151
+ -moz-box-shadow: 1px -1px 1px 0 rgba(0, 0, 0, 0.2);
152
+ -webkit-box-shadow: 1px -1px 1px 0 rgba(0, 0, 0, 0.2);
153
+ box-shadow: 1px -1px 1px 0 rgba(0, 0, 0, 0.2);
154
+ -moz-transform: rotate(-45deg);
155
+ -ms-transform: rotate(-45deg);
156
+ -webkit-transform: rotate(-45deg);
157
+ transform: rotate(-45deg);
158
+ }
159
+
160
+ /* data rows */
161
+ .row {
162
+ padding: 15px 20px;
163
+ overflow: hidden;
164
+ }
165
+ .row.header {
166
+ background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgeDE9IjAuNSIgeTE9IjAuMCIgeDI9IjAuNSIgeTI9IjEuMCI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2ZmZmZmZiIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iI2U3ZTdlNyIvPjwvbGluZWFyR3JhZGllbnQ+PC9kZWZzPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JhZCkiIC8+PC9zdmc+IA==');
167
+ background-size: 100%;
168
+ background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #ffffff), color-stop(100%, #e7e7e7));
169
+ background-image: -moz-linear-gradient(top, #ffffff 0%, #e7e7e7 100%);
170
+ background-image: -webkit-linear-gradient(top, #ffffff 0%, #e7e7e7 100%);
171
+ background-image: linear-gradient(to bottom, #ffffff 0%, #e7e7e7 100%);
172
+ background-image: -ms-linear-gradient(top, #ffffff 0%, #e7e7e7 100%);
173
+ -moz-box-shadow: 0 1px 0 0 rgba(203, 203, 203, 0.75);
174
+ -webkit-box-shadow: 0 1px 0 0 rgba(203, 203, 203, 0.75);
175
+ box-shadow: 0 1px 0 0 rgba(203, 203, 203, 0.75);
176
+ -moz-border-radius: 5px 5px 0 0;
177
+ -webkit-border-radius: 5px;
178
+ border-radius: 5px 5px 0 0;
179
+ color: #747474;
180
+ text-shadow: 1px 1px 1px rgba(255, 255, 255, 0.75);
181
+ font: bold 11px Arial;
182
+ }
183
+ .row.items {
184
+ color: #e54040;
185
+ font: bold 18px Arial;
186
+ position: relative;
187
+ }
188
+ .row.items span:first-child {
189
+ color: #000000;
190
+ }
191
+ .row.items:after {
192
+ content: '';
193
+ position: absolute;
194
+ height: 1px;
195
+ width: 100%;
196
+ background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgeDE9IjAuMCIgeTE9IjAuNSIgeDI9IjEuMCIgeTI9IjAuNSI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2ZmZmZmZiIvPjxzdG9wIG9mZnNldD0iNTAlIiBzdG9wLWNvbG9yPSIjZGRkZGRkIi8+PHN0b3Agb2Zmc2V0PSIxMDAlIiBzdG9wLWNvbG9yPSIjZmZmZmZmIi8+PC9saW5lYXJHcmFkaWVudD48L2RlZnM+PHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsbD0idXJsKCNncmFkKSIgLz48L3N2Zz4g');
197
+ background-size: 100%;
198
+ background-image: -webkit-gradient(linear, 0% 50%, 100% 50%, color-stop(0%, #ffffff), color-stop(50%, #dddddd), color-stop(100%, #ffffff));
199
+ background-image: -moz-linear-gradient(left, #ffffff 0%, #dddddd 50%, #ffffff 100%);
200
+ background-image: -webkit-linear-gradient(left, #ffffff 0%, #dddddd 50%, #ffffff 100%);
201
+ background-image: linear-gradient(to right, #ffffff 0%, #dddddd 50%, #ffffff 100%);
202
+ left: 0;
203
+ top: 97%;
204
+ }
205
+ .row.checkout {
206
+ font: normal 12px Arial;
207
+ }
208
+ .row.checkout span:first-child {
209
+ padding: 3px 0;
210
+ }
211
+ .row.checkout a {
212
+ color: #e54040;
213
+ text-decoration: none;
214
+ }
215
+ .row.checkout a:hover {
216
+ text-decoration: underline;
217
+ }
218
+ .row span:first-child {
219
+ float: left;
220
+ }
221
+ .row span:last-child {
222
+ float: right;
223
+ }
224
+
225
+ .checkout-button {
226
+ padding: 3px 5px;
227
+ background: #e54040;
228
+ -moz-box-shadow: inset 0 2px 7px 0 rgba(255, 255, 255, 0.3);
229
+ -webkit-box-shadow: inset 0 2px 7px 0 rgba(255, 255, 255, 0.3);
230
+ box-shadow: inset 0 2px 7px 0 rgba(255, 255, 255, 0.3);
231
+ border: 1px solid #e06b6b;
232
+ -moz-border-radius: 3px;
233
+ -webkit-border-radius: 3px;
234
+ border-radius: 3px;
235
+ color: #ffffff;
236
+ }
237
+ .checkout-button:hover {
238
+ background: #e54040;
239
+ -moz-box-shadow: none;
240
+ -webkit-box-shadow: none;
241
+ box-shadow: none;
242
+ }
243
+ .checkout-button:active {
244
+ background: #e54040;
245
+ -moz-box-shadow: inset 0 1px 2px 0 rgba(0, 0, 0, 0.2);
246
+ -webkit-box-shadow: inset 0 1px 2px 0 rgba(0, 0, 0, 0.2);
247
+ box-shadow: inset 0 1px 2px 0 rgba(0, 0, 0, 0.2);
248
+ }
249
+
250
+ .cart {
251
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAIGNIUk0AAHolAACAgwAA+f8AAIDoAABSCAABFVgAADqXAAAXb9daH5AAAAGPSURBVHjajNNNi85RGAbw3zwzI/XMmEHeFYmSvJRSYsOWfAHZ+wAWakp8AAs+A5ImKzujUfKapQnZzIaVxzCYGcMzXRbuydO/Wcxdd+ecq3Ouc67rvk9fkqcY8T8mcA3frSIGcLKBfcMaq4wWpjCNjwi2o71aggGcQT92YBybcLTIZ7ABX7G+xlF8qvWgJMs5kuRFksUkDypPJLmd5FSSW0lOJ7lT+GSSt70E7SQ38i+eJDmSZE+SA0n21bi35heTdJMstnrkzOMlfmELhnEVQxjDOlzBDxwv2c/7kvR6sh+Py8QLeFde9GMJ3arQw/JqrNUwtVMVaWMbFnC51pfwGQfrhR1MNgnm8LpuPVsNdr0236xKncdgyZ0eaBD8xhss4hyOlea1hQ1ha0mZwM8mwRKe4VVJ6K9Daj6PD9V0j7DUNBH6sLNcn8efOtytp7cxW82U3j5Yzs1J7ieZSnI3yXDho0nGC7+XZGMSKxEcSjJbDdVJsrvwww18VxKtFf7HTH2wObwvGfClgS/A3wEAjJAlBBKFdqAAAAAASUVORK5CYII=);
252
+ background-repeat: no-repeat;
253
+ background-position: center;
254
+ }