veritrans 2.3.0 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (275) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +4 -0
  3. data/.idea/.gitignore +8 -0
  4. data/.rubocop.yml +1 -1
  5. data/.travis.yml +2 -1
  6. data/CHANGELOG.md +13 -0
  7. data/Gemfile +2 -11
  8. data/Gemfile.lock +116 -145
  9. data/Maintaining.MD +8 -0
  10. data/README.md +247 -278
  11. data/api_reference.md +482 -173
  12. data/example/coreapi/core_api_credit_card_example.rb +66 -0
  13. data/example/coreapi/readme.md +4 -0
  14. data/example/sinatra/Gemfile +7 -0
  15. data/example/sinatra/README.md +4 -6
  16. data/example/sinatra/index.erb +180 -192
  17. data/example/sinatra/response.erb +1 -40
  18. data/example/sinatra/snap.erb +33 -0
  19. data/example/sinatra/snap_redirect.erb +10 -0
  20. data/example/sinatra/webapp.rb +113 -0
  21. data/example/snap/readme.md +4 -0
  22. data/example/snap/snap_example.rb +39 -0
  23. data/lib/test/all.rb +1 -0
  24. data/lib/test/api_test.rb +319 -0
  25. data/lib/test/config_test.rb +26 -0
  26. data/lib/test/gopay_tokenization_test.rb +80 -0
  27. data/lib/test/snap_test.rb +79 -0
  28. data/lib/test/subscription_test.rb +116 -0
  29. data/lib/test/transaction_test.rb +160 -0
  30. data/lib/veritrans/api.rb +105 -8
  31. data/lib/veritrans/client.rb +40 -7
  32. data/lib/veritrans/config.rb +26 -3
  33. data/lib/veritrans/midtrans_error.rb +15 -0
  34. data/lib/veritrans/version.rb +1 -1
  35. data/lib/veritrans.rb +5 -6
  36. data/veritrans.gemspec +1 -2
  37. metadata +25 -248
  38. data/.rspec +0 -2
  39. data/Procfile +0 -1
  40. data/Rakefile +0 -16
  41. data/bin/midtrans +0 -3
  42. data/bin/veritrans +0 -68
  43. data/example/rails/cable/Gemfile +0 -48
  44. data/example/rails/cable/Gemfile.lock +0 -184
  45. data/example/rails/cable/README.md +0 -29
  46. data/example/rails/cable/Rakefile +0 -6
  47. data/example/rails/cable/app/assets/config/manifest.js +0 -3
  48. data/example/rails/cable/app/assets/images/.keep +0 -0
  49. data/example/rails/cable/app/assets/javascripts/application.js +0 -15
  50. data/example/rails/cable/app/assets/javascripts/cable.js +0 -13
  51. data/example/rails/cable/app/assets/javascripts/channels/.keep +0 -0
  52. data/example/rails/cable/app/assets/javascripts/chats.js +0 -39
  53. data/example/rails/cable/app/assets/javascripts/rooms.js +0 -55
  54. data/example/rails/cable/app/assets/stylesheets/application.css +0 -16
  55. data/example/rails/cable/app/assets/stylesheets/chatbox.scss +0 -31
  56. data/example/rails/cable/app/assets/stylesheets/peoplebox.scss +0 -6
  57. data/example/rails/cable/app/channels/application_cable/channel.rb +0 -4
  58. data/example/rails/cable/app/channels/application_cable/connection.rb +0 -4
  59. data/example/rails/cable/app/channels/rooms_texting_channel.rb +0 -13
  60. data/example/rails/cable/app/controllers/application_controller.rb +0 -3
  61. data/example/rails/cable/app/controllers/chats_controller.rb +0 -18
  62. data/example/rails/cable/app/controllers/concerns/.keep +0 -0
  63. data/example/rails/cable/app/controllers/pays_controller.rb +0 -28
  64. data/example/rails/cable/app/controllers/rooms_controller.rb +0 -4
  65. data/example/rails/cable/app/helpers/application_helper.rb +0 -2
  66. data/example/rails/cable/app/helpers/chats_helper.rb +0 -2
  67. data/example/rails/cable/app/helpers/rooms_helper.rb +0 -5
  68. data/example/rails/cable/app/jobs/application_job.rb +0 -2
  69. data/example/rails/cable/app/jobs/chat_broadcaster_job.rb +0 -15
  70. data/example/rails/cable/app/mailers/application_mailer.rb +0 -4
  71. data/example/rails/cable/app/models/application_record.rb +0 -3
  72. data/example/rails/cable/app/models/chat.rb +0 -41
  73. data/example/rails/cable/app/models/concerns/.keep +0 -0
  74. data/example/rails/cable/app/models/order.rb +0 -2
  75. data/example/rails/cable/app/models/user.rb +0 -2
  76. data/example/rails/cable/app/views/chats/_chat.html.erb +0 -18
  77. data/example/rails/cable/app/views/layouts/application.html.erb +0 -19
  78. data/example/rails/cable/app/views/layouts/mailer.html.erb +0 -13
  79. data/example/rails/cable/app/views/layouts/mailer.text.erb +0 -1
  80. data/example/rails/cable/app/views/rooms/_chatbox.html.erb +0 -13
  81. data/example/rails/cable/app/views/rooms/_online_people.html.erb +0 -53
  82. data/example/rails/cable/app/views/rooms/index.html.erb +0 -9
  83. data/example/rails/cable/bin/bundle +0 -3
  84. data/example/rails/cable/bin/rails +0 -9
  85. data/example/rails/cable/bin/rake +0 -9
  86. data/example/rails/cable/bin/setup +0 -34
  87. data/example/rails/cable/bin/spring +0 -16
  88. data/example/rails/cable/bin/update +0 -29
  89. data/example/rails/cable/config/application.rb +0 -16
  90. data/example/rails/cable/config/boot.rb +0 -3
  91. data/example/rails/cable/config/cable.yml +0 -9
  92. data/example/rails/cable/config/database.yml +0 -20
  93. data/example/rails/cable/config/environment.rb +0 -5
  94. data/example/rails/cable/config/environments/development.rb +0 -57
  95. data/example/rails/cable/config/environments/production.rb +0 -86
  96. data/example/rails/cable/config/environments/test.rb +0 -42
  97. data/example/rails/cable/config/initializers/application_controller_renderer.rb +0 -6
  98. data/example/rails/cable/config/initializers/assets.rb +0 -11
  99. data/example/rails/cable/config/initializers/backtrace_silencers.rb +0 -7
  100. data/example/rails/cable/config/initializers/cookies_serializer.rb +0 -5
  101. data/example/rails/cable/config/initializers/filter_parameter_logging.rb +0 -4
  102. data/example/rails/cable/config/initializers/inflections.rb +0 -16
  103. data/example/rails/cable/config/initializers/mime_types.rb +0 -4
  104. data/example/rails/cable/config/initializers/new_framework_defaults.rb +0 -24
  105. data/example/rails/cable/config/initializers/session_store.rb +0 -3
  106. data/example/rails/cable/config/initializers/sidekiq.rb +0 -2
  107. data/example/rails/cable/config/initializers/veritrans.rb +0 -46
  108. data/example/rails/cable/config/initializers/wrap_parameters.rb +0 -14
  109. data/example/rails/cable/config/locales/en.yml +0 -23
  110. data/example/rails/cable/config/puma.rb +0 -47
  111. data/example/rails/cable/config/routes.rb +0 -18
  112. data/example/rails/cable/config/secrets.yml +0 -22
  113. data/example/rails/cable/config/spring.rb +0 -6
  114. data/example/rails/cable/config/veritrans.yml +0 -13
  115. data/example/rails/cable/config.ru +0 -5
  116. data/example/rails/cable/db/development.sqlite3 +0 -0
  117. data/example/rails/cable/db/migrate/20161215070044_create_chats.rb +0 -10
  118. data/example/rails/cable/db/migrate/20161215072021_create_users.rb +0 -10
  119. data/example/rails/cable/db/migrate/20161219110219_create_orders.rb +0 -11
  120. data/example/rails/cable/db/schema.rb +0 -37
  121. data/example/rails/cable/db/seeds.rb +0 -41
  122. data/example/rails/cable/db/test.sqlite3 +0 -0
  123. data/example/rails/cable/lib/assets/.keep +0 -0
  124. data/example/rails/cable/lib/tasks/.keep +0 -0
  125. data/example/rails/cable/log/.keep +0 -0
  126. data/example/rails/cable/public/404.html +0 -67
  127. data/example/rails/cable/public/422.html +0 -67
  128. data/example/rails/cable/public/500.html +0 -66
  129. data/example/rails/cable/public/apple-touch-icon-precomposed.png +0 -0
  130. data/example/rails/cable/public/apple-touch-icon.png +0 -0
  131. data/example/rails/cable/public/favicon.ico +0 -0
  132. data/example/rails/cable/public/images/avatar1.jpg +0 -0
  133. data/example/rails/cable/public/images/avatar2.jpg +0 -0
  134. data/example/rails/cable/public/images/avatar3.jpg +0 -0
  135. data/example/rails/cable/public/images/avatar4.jpg +0 -0
  136. data/example/rails/cable/public/images/avatar5.jpg +0 -0
  137. data/example/rails/cable/public/images/avatar6.jpg +0 -0
  138. data/example/rails/cable/public/robots.txt +0 -5
  139. data/example/rails/cable/vendor/assets/javascripts/.keep +0 -0
  140. data/example/rails/cable/vendor/assets/stylesheets/.keep +0 -0
  141. data/example/rails/cable/vendor/assets/stylesheets/photon.css +0 -2333
  142. data/example/rails/simplepay/Gemfile +0 -54
  143. data/example/rails/simplepay/Gemfile.lock +0 -178
  144. data/example/rails/simplepay/README.md +0 -30
  145. data/example/rails/simplepay/Rakefile +0 -6
  146. data/example/rails/simplepay/app/assets/config/manifest.js +0 -3
  147. data/example/rails/simplepay/app/assets/images/.keep +0 -0
  148. data/example/rails/simplepay/app/assets/javascripts/application.js +0 -16
  149. data/example/rails/simplepay/app/assets/javascripts/cable.js +0 -13
  150. data/example/rails/simplepay/app/assets/javascripts/channels/.keep +0 -0
  151. data/example/rails/simplepay/app/assets/javascripts/pay.js +0 -18
  152. data/example/rails/simplepay/app/assets/stylesheets/application.css +0 -15
  153. data/example/rails/simplepay/app/assets/stylesheets/style.css +0 -254
  154. data/example/rails/simplepay/app/channels/application_cable/channel.rb +0 -4
  155. data/example/rails/simplepay/app/channels/application_cable/connection.rb +0 -4
  156. data/example/rails/simplepay/app/controllers/application_controller.rb +0 -3
  157. data/example/rails/simplepay/app/controllers/concerns/.keep +0 -0
  158. data/example/rails/simplepay/app/controllers/home_controller.rb +0 -16
  159. data/example/rails/simplepay/app/controllers/pay_controller.rb +0 -10
  160. data/example/rails/simplepay/app/helpers/application_helper.rb +0 -2
  161. data/example/rails/simplepay/app/helpers/pay_helper.rb +0 -2
  162. data/example/rails/simplepay/app/jobs/application_job.rb +0 -2
  163. data/example/rails/simplepay/app/mailers/application_mailer.rb +0 -4
  164. data/example/rails/simplepay/app/models/application_record.rb +0 -3
  165. data/example/rails/simplepay/app/models/concerns/.keep +0 -0
  166. data/example/rails/simplepay/app/models/order.rb +0 -2
  167. data/example/rails/simplepay/app/views/home/index.html.erb +0 -19
  168. data/example/rails/simplepay/app/views/layouts/application.html.erb +0 -15
  169. data/example/rails/simplepay/app/views/layouts/mailer.html.erb +0 -13
  170. data/example/rails/simplepay/app/views/layouts/mailer.text.erb +0 -1
  171. data/example/rails/simplepay/app/views/pay/notify.html.erb +0 -2
  172. data/example/rails/simplepay/bin/bundle +0 -3
  173. data/example/rails/simplepay/bin/rails +0 -9
  174. data/example/rails/simplepay/bin/rake +0 -9
  175. data/example/rails/simplepay/bin/setup +0 -34
  176. data/example/rails/simplepay/bin/spring +0 -16
  177. data/example/rails/simplepay/bin/update +0 -29
  178. data/example/rails/simplepay/config/application.rb +0 -15
  179. data/example/rails/simplepay/config/boot.rb +0 -3
  180. data/example/rails/simplepay/config/cable.yml +0 -9
  181. data/example/rails/simplepay/config/database.yml +0 -25
  182. data/example/rails/simplepay/config/environment.rb +0 -5
  183. data/example/rails/simplepay/config/environments/development.rb +0 -57
  184. data/example/rails/simplepay/config/environments/production.rb +0 -86
  185. data/example/rails/simplepay/config/environments/test.rb +0 -42
  186. data/example/rails/simplepay/config/initializers/application_controller_renderer.rb +0 -6
  187. data/example/rails/simplepay/config/initializers/assets.rb +0 -11
  188. data/example/rails/simplepay/config/initializers/backtrace_silencers.rb +0 -7
  189. data/example/rails/simplepay/config/initializers/cookies_serializer.rb +0 -5
  190. data/example/rails/simplepay/config/initializers/filter_parameter_logging.rb +0 -4
  191. data/example/rails/simplepay/config/initializers/inflections.rb +0 -16
  192. data/example/rails/simplepay/config/initializers/mime_types.rb +0 -4
  193. data/example/rails/simplepay/config/initializers/new_framework_defaults.rb +0 -24
  194. data/example/rails/simplepay/config/initializers/session_store.rb +0 -3
  195. data/example/rails/simplepay/config/initializers/veritrans.rb +0 -46
  196. data/example/rails/simplepay/config/initializers/wrap_parameters.rb +0 -14
  197. data/example/rails/simplepay/config/locales/en.yml +0 -23
  198. data/example/rails/simplepay/config/puma.rb +0 -47
  199. data/example/rails/simplepay/config/routes.rb +0 -5
  200. data/example/rails/simplepay/config/secrets.yml +0 -22
  201. data/example/rails/simplepay/config/spring.rb +0 -6
  202. data/example/rails/simplepay/config/veritrans.yml +0 -18
  203. data/example/rails/simplepay/config.ru +0 -5
  204. data/example/rails/simplepay/db/development.sqlite3 +0 -0
  205. data/example/rails/simplepay/db/migrate/20161221090855_create_orders.rb +0 -10
  206. data/example/rails/simplepay/db/schema.rb +0 -22
  207. data/example/rails/simplepay/db/seeds.rb +0 -7
  208. data/example/rails/simplepay/db/test.sqlite3 +0 -0
  209. data/example/rails/simplepay/lib/assets/.keep +0 -0
  210. data/example/rails/simplepay/lib/tasks/.keep +0 -0
  211. data/example/rails/simplepay/log/.keep +0 -0
  212. data/example/rails/simplepay/public/404.html +0 -67
  213. data/example/rails/simplepay/public/422.html +0 -67
  214. data/example/rails/simplepay/public/500.html +0 -66
  215. data/example/rails/simplepay/public/apple-touch-icon-precomposed.png +0 -0
  216. data/example/rails/simplepay/public/apple-touch-icon.png +0 -0
  217. data/example/rails/simplepay/public/favicon.ico +0 -0
  218. data/example/rails/simplepay/public/robots.txt +0 -5
  219. data/example/rails/simplepay/vendor/assets/javascripts/.keep +0 -0
  220. data/example/rails/simplepay/vendor/assets/stylesheets/.keep +0 -0
  221. data/example/sinatra/config.ru +0 -9
  222. data/example/sinatra/localization.erb +0 -249
  223. data/example/sinatra/points.erb +0 -188
  224. data/example/sinatra/recurring.erb +0 -201
  225. data/example/sinatra/sinatra.rb +0 -194
  226. data/example/sinatra/style.css +0 -137
  227. data/example/sinatra/veritrans.yml +0 -11
  228. data/example/sinatra/widget.erb +0 -63
  229. data/lib/generators/templates/assets/credit_card_form.js +0 -57
  230. data/lib/generators/templates/payments_controller.rb +0 -85
  231. data/lib/generators/templates/veritrans.rb +0 -46
  232. data/lib/generators/templates/veritrans.yml +0 -18
  233. data/lib/generators/templates/views/_credit_card_form.erb +0 -42
  234. data/lib/generators/templates/views/_veritrans_include.erb +0 -10
  235. data/lib/generators/templates/views/payments/create.erb +0 -15
  236. data/lib/generators/templates/views/payments/new.erb +0 -6
  237. data/lib/generators/veritrans/install_generator.rb +0 -32
  238. data/lib/generators/veritrans/payment_form_generator.rb +0 -45
  239. data/lib/veritrans/cli.rb +0 -161
  240. data/lib/veritrans/testing.rb +0 -156
  241. data/spec/cli_spec.rb +0 -83
  242. data/spec/configs/real_key.yml +0 -4
  243. data/spec/configs/veritrans.yml +0 -7
  244. data/spec/configs/veritrans_flat.yml +0 -2
  245. data/spec/configs/veritrans_with_erb.yml +0 -2
  246. data/spec/fixtures/approve_failed.yml +0 -48
  247. data/spec/fixtures/cancel_failed.yml +0 -48
  248. data/spec/fixtures/cancel_success.yml +0 -126
  249. data/spec/fixtures/capture_failed.yml +0 -48
  250. data/spec/fixtures/charge.yml +0 -50
  251. data/spec/fixtures/charge_direct.yml +0 -56
  252. data/spec/fixtures/charge_vtweb.yml +0 -50
  253. data/spec/fixtures/cli_test_1111-not-exists.yml +0 -45
  254. data/spec/fixtures/cli_test_not_exists.yml +0 -45
  255. data/spec/fixtures/cli_test_real_txn.yml +0 -55
  256. data/spec/fixtures/cli_test_unauthorized.yml +0 -47
  257. data/spec/fixtures/deny_failed.yml +0 -144
  258. data/spec/fixtures/events_test_real_txn.yml +0 -55
  259. data/spec/fixtures/expire_failed.yml +0 -50
  260. data/spec/fixtures/expire_success.yml +0 -56
  261. data/spec/fixtures/midtrans_status.yml +0 -117
  262. data/spec/fixtures/refund_failed.yml +0 -54
  263. data/spec/fixtures/status_fail.yml +0 -48
  264. data/spec/fixtures/status_success.yml +0 -128
  265. data/spec/fixtures/test_token.yml +0 -49
  266. data/spec/midtrans_rename_spec.rb +0 -27
  267. data/spec/rails_plugin_spec.rb +0 -317
  268. data/spec/spec_helper.rb +0 -71
  269. data/spec/veritrans_client_spec.rb +0 -235
  270. data/spec/veritrans_config_spec.rb +0 -70
  271. data/spec/veritrans_events_spec.rb +0 -72
  272. data/spec/veritrans_logger_spec.rb +0 -46
  273. data/spec/veritrans_snap_spec.rb +0 -54
  274. data/spec/veritrans_testing_spec.rb +0 -184
  275. data/testing_webhooks.md +0 -78
@@ -1,22 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Your secret key is used for verifying the integrity of signed cookies.
4
- # If you change this key, all old signed cookies will become invalid!
5
-
6
- # Make sure the secret is at least 30 characters and all random,
7
- # no regular words or you'll be exposed to dictionary attacks.
8
- # You can use `rails secret` to generate a secure secret key.
9
-
10
- # Make sure the secrets in this file are kept private
11
- # if you're sharing your code publicly.
12
-
13
- development:
14
- secret_key_base: 48b67a9deaeff21125d6b51e248ecb5faddb9ccd79bdd8ad0d63244f3808b80522c7d46389ab00c57d6c3f662649f79c44abf42aaa69c6b482e3720feeeb6087
15
-
16
- test:
17
- secret_key_base: dc0146d85beb69c695ec27103143dc8b2ee8a86b470885f80b38d99dad1c1d426f4d5bba4e80efb4be084d17b3854b188a6966a35d6c22e4fb9cc4f5986b29d6
18
-
19
- # Do not keep production secrets in the repository,
20
- # instead read values from the environment.
21
- production:
22
- secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
@@ -1,6 +0,0 @@
1
- %w(
2
- .ruby-version
3
- .rbenv-vars
4
- tmp/restart.txt
5
- tmp/caching-dev.txt
6
- ).each { |path| Spring.watch(path) }
@@ -1,18 +0,0 @@
1
- development:
2
- # Register in sandbox veritrans and get your keys here:
3
- # https://dashboard.sandbox.midtrans.com/settings/config_info
4
- client_key: ""
5
- server_key: ""
6
- api_host: https://api.sandbox.midtrans.com
7
-
8
- production:
9
- # Register and get your keys here:
10
- # https://dashboard.midtrans.com/settings/config_info
11
- client_key: <%= ENV['VERITRANS_CLIENT_KEY'] %>
12
- server_key: <%= ENV['VERITRANS_SERVER_KEY'] %>
13
- api_host: https://api.midtrans.com
14
-
15
- staging:
16
- client_key: <%= ENV['VT_SANDBOX_CLIENT_KEY'] %>
17
- server_key: <%= ENV['VT_SANDBOX_SERVER_KEY'] %>
18
- api_host: https://api.sandbox.midtrans.com
@@ -1,5 +0,0 @@
1
- # This file is used by Rack-based servers to start the application.
2
-
3
- require_relative 'config/environment'
4
-
5
- run Rails.application
@@ -1,10 +0,0 @@
1
- class CreateOrders < ActiveRecord::Migration[5.0]
2
- def change
3
- create_table :orders do |t|
4
- t.string :transaction_status
5
- t.string :price
6
-
7
- t.timestamps
8
- end
9
- end
10
- end
@@ -1,22 +0,0 @@
1
- # This file is auto-generated from the current state of the database. Instead
2
- # of editing this file, please use the migrations feature of Active Record to
3
- # incrementally modify your database, and then regenerate this schema definition.
4
- #
5
- # Note that this schema.rb definition is the authoritative source for your
6
- # database schema. If you need to create the application database on another
7
- # system, you should be using db:schema:load, not running all the migrations
8
- # from scratch. The latter is a flawed and unsustainable approach (the more migrations
9
- # you'll amass, the slower it'll run and the greater likelihood for issues).
10
- #
11
- # It's strongly recommended that you check this file into your version control system.
12
-
13
- ActiveRecord::Schema.define(version: 20161221090855) do
14
-
15
- create_table "orders", force: :cascade do |t|
16
- t.string "transaction_status"
17
- t.string "price"
18
- t.datetime "created_at", null: false
19
- t.datetime "updated_at", null: false
20
- end
21
-
22
- end
@@ -1,7 +0,0 @@
1
- # This file should contain all the record creation needed to seed the database with its default values.
2
- # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
3
- #
4
- # Examples:
5
- #
6
- # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
7
- # Character.create(name: 'Luke', movie: movies.first)
File without changes
File without changes
File without changes
File without changes
@@ -1,67 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>The page you were looking for doesn't exist (404)</title>
5
- <meta name="viewport" content="width=device-width,initial-scale=1">
6
- <style>
7
- body {
8
- background-color: #EFEFEF;
9
- color: #2E2F30;
10
- text-align: center;
11
- font-family: arial, sans-serif;
12
- margin: 0;
13
- }
14
-
15
- div.dialog {
16
- width: 95%;
17
- max-width: 33em;
18
- margin: 4em auto 0;
19
- }
20
-
21
- div.dialog > div {
22
- border: 1px solid #CCC;
23
- border-right-color: #999;
24
- border-left-color: #999;
25
- border-bottom-color: #BBB;
26
- border-top: #B00100 solid 4px;
27
- border-top-left-radius: 9px;
28
- border-top-right-radius: 9px;
29
- background-color: white;
30
- padding: 7px 12% 0;
31
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
- }
33
-
34
- h1 {
35
- font-size: 100%;
36
- color: #730E15;
37
- line-height: 1.5em;
38
- }
39
-
40
- div.dialog > p {
41
- margin: 0 0 1em;
42
- padding: 1em;
43
- background-color: #F7F7F7;
44
- border: 1px solid #CCC;
45
- border-right-color: #999;
46
- border-left-color: #999;
47
- border-bottom-color: #999;
48
- border-bottom-left-radius: 4px;
49
- border-bottom-right-radius: 4px;
50
- border-top-color: #DADADA;
51
- color: #666;
52
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
- }
54
- </style>
55
- </head>
56
-
57
- <body>
58
- <!-- This file lives in public/404.html -->
59
- <div class="dialog">
60
- <div>
61
- <h1>The page you were looking for doesn't exist.</h1>
62
- <p>You may have mistyped the address or the page may have moved.</p>
63
- </div>
64
- <p>If you are the application owner check the logs for more information.</p>
65
- </div>
66
- </body>
67
- </html>
@@ -1,67 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>The change you wanted was rejected (422)</title>
5
- <meta name="viewport" content="width=device-width,initial-scale=1">
6
- <style>
7
- body {
8
- background-color: #EFEFEF;
9
- color: #2E2F30;
10
- text-align: center;
11
- font-family: arial, sans-serif;
12
- margin: 0;
13
- }
14
-
15
- div.dialog {
16
- width: 95%;
17
- max-width: 33em;
18
- margin: 4em auto 0;
19
- }
20
-
21
- div.dialog > div {
22
- border: 1px solid #CCC;
23
- border-right-color: #999;
24
- border-left-color: #999;
25
- border-bottom-color: #BBB;
26
- border-top: #B00100 solid 4px;
27
- border-top-left-radius: 9px;
28
- border-top-right-radius: 9px;
29
- background-color: white;
30
- padding: 7px 12% 0;
31
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
- }
33
-
34
- h1 {
35
- font-size: 100%;
36
- color: #730E15;
37
- line-height: 1.5em;
38
- }
39
-
40
- div.dialog > p {
41
- margin: 0 0 1em;
42
- padding: 1em;
43
- background-color: #F7F7F7;
44
- border: 1px solid #CCC;
45
- border-right-color: #999;
46
- border-left-color: #999;
47
- border-bottom-color: #999;
48
- border-bottom-left-radius: 4px;
49
- border-bottom-right-radius: 4px;
50
- border-top-color: #DADADA;
51
- color: #666;
52
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
- }
54
- </style>
55
- </head>
56
-
57
- <body>
58
- <!-- This file lives in public/422.html -->
59
- <div class="dialog">
60
- <div>
61
- <h1>The change you wanted was rejected.</h1>
62
- <p>Maybe you tried to change something you didn't have access to.</p>
63
- </div>
64
- <p>If you are the application owner check the logs for more information.</p>
65
- </div>
66
- </body>
67
- </html>
@@ -1,66 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>We're sorry, but something went wrong (500)</title>
5
- <meta name="viewport" content="width=device-width,initial-scale=1">
6
- <style>
7
- body {
8
- background-color: #EFEFEF;
9
- color: #2E2F30;
10
- text-align: center;
11
- font-family: arial, sans-serif;
12
- margin: 0;
13
- }
14
-
15
- div.dialog {
16
- width: 95%;
17
- max-width: 33em;
18
- margin: 4em auto 0;
19
- }
20
-
21
- div.dialog > div {
22
- border: 1px solid #CCC;
23
- border-right-color: #999;
24
- border-left-color: #999;
25
- border-bottom-color: #BBB;
26
- border-top: #B00100 solid 4px;
27
- border-top-left-radius: 9px;
28
- border-top-right-radius: 9px;
29
- background-color: white;
30
- padding: 7px 12% 0;
31
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
- }
33
-
34
- h1 {
35
- font-size: 100%;
36
- color: #730E15;
37
- line-height: 1.5em;
38
- }
39
-
40
- div.dialog > p {
41
- margin: 0 0 1em;
42
- padding: 1em;
43
- background-color: #F7F7F7;
44
- border: 1px solid #CCC;
45
- border-right-color: #999;
46
- border-left-color: #999;
47
- border-bottom-color: #999;
48
- border-bottom-left-radius: 4px;
49
- border-bottom-right-radius: 4px;
50
- border-top-color: #DADADA;
51
- color: #666;
52
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
- }
54
- </style>
55
- </head>
56
-
57
- <body>
58
- <!-- This file lives in public/500.html -->
59
- <div class="dialog">
60
- <div>
61
- <h1>We're sorry, but something went wrong.</h1>
62
- </div>
63
- <p>If you are the application owner check the logs for more information.</p>
64
- </div>
65
- </body>
66
- </html>
File without changes
File without changes
@@ -1,5 +0,0 @@
1
- # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
2
- #
3
- # To ban all spiders from the entire site uncomment the next two lines:
4
- # User-agent: *
5
- # Disallow: /
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- # This file is for running on heroku
4
-
5
- require './sinatra'
6
- Sinatra::Application.run!
7
-
8
- require ::File.expand_path("./cable/config/environment", __FILE__)
9
- run Rails.application
@@ -1,249 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <title>veritrans-ruby demo</title>
5
- <link rel="icon" type="image/x-icon" href="https://account.midtrans.com/favicon.ico" />
6
- <link rel="stylesheet" href="/style.css">
7
- </head>
8
- <body>
9
-
10
- <header>
11
- <h3>
12
- <a href="/">Midtrans sinatra app</a>
13
- </h3>
14
- <a href="https://github.com/veritrans/veritrans-ruby" class="github">Source Code</a>
15
- </header>
16
-
17
- <section>
18
- <h4>VT-Direct Localization</h4>
19
-
20
- <form action="/charge_vtdirect" method="post" id="card_form">
21
- <input type="hidden" name="format" value="json">
22
- <input type="hidden" name="token_id" id="card_token">
23
- <fieldset>
24
- <legend>Credit Card</legend>
25
- <p>
26
- <label>Language</label>
27
- <select name="locale" id="locale">
28
- <option value="id" selected>Indonesian</option>
29
- <option value="en">English</option>
30
- </select>
31
- </p>
32
- <p>
33
- <label for="gross_amount">Amount, Rp.</label>
34
- <input type="text" name="gross_amount" id="gross_amount" value="30000">
35
- </p>
36
- <p>
37
- <label for="card_number">Card Number</label>
38
- <input type="text" id="card_number" style="width: 150px" value="4811 1111 1111 1114">
39
- <br>
40
- <small style="margin-left: 100px" class="card-numbers">
41
- <a onclick="$('#card_number').val('4811 1111 1111 1114')">success Visa</a>
42
- <a onclick="$('#card_number').val('5810 1111 1111 1112')">success MasterCard</a>
43
- <a onclick="$('#card_number').val('4511 1111 1111 1117')">challenge</a>
44
- <a onclick="$('#card_number').val('4611 1111 1111 1116')">Deny by FDS</a>
45
- <a onclick="$('#card_number').val('4911 1111 1111 1113')">Deny by bank</a>
46
- <a href="https://docs.midtrans.com/en/reference/test.html" target="_blank">documentation</a>
47
- </small>
48
- </p>
49
- <p>
50
- <label for="card_cvc">Card CVV</label>
51
- <input type="text" id="card_cvc" style="width: 35px" placeholder="cvc" value="123">
52
- </p>
53
- <p>
54
- <label for="card_exp">Card Expiry Date</label>
55
- <input type="text" id="card_exp" placeholder="MM / YY" value="12 / 18">
56
- </p>
57
-
58
- <p>
59
- <label for="card_secure">3D-Secure</label>
60
- <input type="checkbox" id="card_secure">
61
- </p>
62
-
63
- </fieldset>
64
-
65
- <input id="submit_btn" type="submit">
66
- </form>
67
- </section>
68
-
69
- <script src="https://api.sandbox.midtrans.com/v2/assets/veritrans.js"></script>
70
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
71
- <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.payment/1.0.2/jquery.payment.js"></script>
72
- <script src="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/jquery.magnific-popup.min.js"></script>
73
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/magnific-popup.css">
74
-
75
- <script type="text/javascript">
76
- // set Veritrans settings
77
- Veritrans.url = "<%= Veritrans.config.api_host %>/v2/token";
78
- Veritrans.client_key = "<%= Veritrans.config.client_key %>";
79
-
80
- var Translations = {
81
- en: {
82
- "card_cvv does not match with regular expression": "Card CVV is not valid",
83
- "card_cvv must be 3 digits": "Card CVV should be 3 digits",
84
- "card_cvv is required": "Card CVV is required",
85
-
86
- "card_number is required": "Card Number is required",
87
- "card_number must be between 12 to 19 digits": "Card Number must be between 12 to 19 digits",
88
- "card_number does not match with regular expression": "Card Number must contain only numbers",
89
- "Invalid card_number association": "Card Number is not valid",
90
- "card_number does not match with luhn algorithm": "Card Number is not valid",
91
-
92
- "card_exp_month must be between 1 and 12": "Expiry month should be between 1 and 12",
93
- "card_exp_month does not match with regular expression": "Expiry month must contain only numbers",
94
- "card_exp_month must be 2 digits": "Expiry month must be 2 digits",
95
- "card_expire_month must be greater than this year's month": "Expiry month must be greater than this year's month",
96
-
97
- "card_exp_year does not match with regular expression": "Expiry year is not valid",
98
- "card_exp_year must be greater than this year": "Expiry year must be greater than this year",
99
- "card_exp_year must be 4 digits": "Expiry year must be 4 digits",
100
- "card_exp_year is required": "Expiry year is required",
101
-
102
- "gross_amount is required for 3d secure transaction": "Transaction amount is required",
103
-
104
- "Denied by Veritrans Fraud Detection System": "Payment denied by fraud detection system",
105
- "Deny by Bank [X] with code [05] and message [Do not honour]": "Your credit card was rejected by bank",
106
- "Success, Credit Card transaction is successful": "Payment successfuly processed",
107
- "transaction_details.gross_amount must be greater than or equal to 1": "Amount must be greater than or equal to 1",
108
- "transaction_details.gross_amount is required": "Amount is required"
109
- },
110
-
111
- id: {
112
- "card_cvv does not match with regular expression": "Nomor CVV tidak valid",
113
- "card_cvv must be 3 digits": "Nomor CVV harus 3 angka",
114
- "card_cvv is required": "Nomor CVV wajib diisi",
115
-
116
- "card_number is required": "Nomor kartu wajib diisi",
117
- "card_number must be between 12 to 19 digits": "Jumlah nomor kartu harus 12 hingga 19 angka",
118
- "card_number does not match with regular expression": "Nomor kartu harus berupa angka",
119
- "Invalid card_number association": "Nomor kartu tidak valid dengan asosiasinya",
120
- "card_number does not match with luhn algorithm": "Nomor kartu tidak valid",
121
-
122
- "card_exp_month must be between 1 and 12": "Bulan kedaluarsa harus 01 hingga 12",
123
- "card_exp_month does not match with regular expression": "Bulan kedaluarsa tidak valid",
124
- "card_exp_month must be 2 digits": "Bulan kedaluarsa harus 2 digit",
125
- "card_expire_month must be greater than this year's month": "Bulan kedaluarsa harus lebih dari bulan sekarang",
126
- "card_exp_month is required": "Bulan kedaluarsa wajib diisi",
127
-
128
- "card_exp_year does not match with regular expression": "Tahun kedaluarsa tidak valid",
129
- "card_exp_year must be greater than this year": "Tahun kedaluarsa harus lebih dari tahun sekarang",
130
- "card_exp_year must be 4 digits": "Tahun kedaluarsa harus 4 digit",
131
- "card_exp_year is required": "Tahun kedaluarsa wajib diisi",
132
-
133
- "gross_amount is required for 3d secure transaction": "Jumlah transaksi wajib diisi untuk transaksi 3D secure",
134
-
135
- "Denied by Veritrans Fraud Detection System": "Pembayaran ditolak oleh sistem deteksi fraud",
136
- "Deny by Bank [X] with code [05] and message [Do not honour]": "Kartu kredit ditolak oleh bank",
137
- "Success, Credit Card transaction is successful": "Pembayaran berhasil",
138
- "transaction_details.gross_amount must be greater than or equal to 1": "Jumlah transaksi harus lebih besar 0",
139
- "transaction_details.gross_amount is required": "Jumlah transaksi wajib diisi"
140
- }
141
- }
142
-
143
- function createTokenData() {
144
- var date = $('#card_exp').val();
145
- return {
146
- // Optional params:
147
- // secure: true
148
- // bank: 'MANDIRI'
149
-
150
- card_number: $('#card_number').val(),
151
- card_cvv: $('#card_cvc').val(),
152
- card_exp_month: date && date.match(/(\d+) \//)[1],
153
- card_exp_year: date ? '20' + date.match(/\/ (\d+)/)[1] : date,
154
- gross_amount: $('#gross_amount').val(),
155
- secure: $('#card_secure')[0].checked
156
- };
157
- }
158
-
159
- function submitForm(callback) {
160
- var form = $('#card_form');
161
- $.ajax({
162
- url: form.attr('action'),
163
- method: 'POST',
164
- data: form.serialize(),
165
- success: function (data, status, xhr) {
166
- if (data.status_code == "200") {
167
- $.magnificPopup.open({
168
- items: {
169
- src: '<div class="white-popup">' +
170
- '<h1>Successful!</h1>' +
171
- '<code><pre>' + JSON.stringify(data, null, 2) + '</code></pre>' +
172
- '</div>',
173
- type: 'inline'
174
- }
175
- });
176
- } else {
177
- var language = $('#locale').val();
178
- var messages = data.validation_messages || [data.status_message.replace(/Bank \[\w+\]/, 'Bank [X]')];
179
- var localized = [];
180
- messages.forEach(function (message) {
181
- localized.push(Translations[language][message] || message)
182
- });
183
- $.magnificPopup.open({
184
- items: {
185
- src: '<div class="white-popup">' +
186
- '<strong>Localized: ' + localized.join("\n") + '</strong>' +
187
- '<code><pre>' + JSON.stringify(data, null, 2) + '</code></pre>' +
188
- '</div>',
189
- type: 'inline'
190
- }
191
- });
192
- }
193
- callback();
194
- }
195
- });
196
- };
197
-
198
- $(document).ready(function () {
199
- $('#card_number').payment('formatCardNumber');
200
- $('#card_cvc').payment('formatCardCVC');
201
- $('#card_exp').payment('formatCardExpiry');
202
-
203
- $('#card_form').on('submit', function (event) {
204
- var form = this;
205
- $('#submit_btn').attr('disabled', true).val("Processing ...");
206
- event.preventDefault();
207
-
208
- Veritrans.token(createTokenData, function (data) {
209
- console.log('Token data:', data);
210
- // if we get url then it's 3d-secure transaction
211
- // so we need to open that page
212
- // this callback function will be called again after user confirm 3d-secure
213
- // you can also redirect on server side
214
- if (data.redirect_url) {
215
- $.magnificPopup.open({
216
- items: { type: 'iframe', src: data.redirect_url }
217
- });
218
- $.magnificPopup.instance.content.find('iframe').height(590);
219
- // if no redirect_url and we have token_id then just make charge request
220
- } else if (data.token_id) {
221
- $('#card_token').val(data.token_id);
222
- $.magnificPopup.close();
223
- submitForm(function () {
224
- $('#submit_btn').removeAttr('disabled').removeAttr("value");
225
- });
226
- // if no redirect_url and no token_id, then it should be error
227
- } else {
228
- $('#submit_btn').removeAttr('disabled').removeAttr("value");
229
-
230
- var language = $('#locale').val();
231
- var messages = data.validation_messages || [data.status_message];
232
- var localizedMessages = [];
233
- messages.forEach(function (message) {
234
- if (Translations[language] && Translations[language][message]) {
235
- localizedMessages.push(Translations[language][message]);
236
- } else {
237
- console.log("Missing translation", language, message);
238
- localizedMessages.push(message);
239
- }
240
- });
241
- alert(localizedMessages.sort().join("\n"));
242
- }
243
- });
244
- });
245
- });
246
- </script>
247
-
248
- </body>
249
- </html>