veritrans 2.1.2 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +10 -1
  3. data/.idea/.gitignore +8 -0
  4. data/.rubocop.yml +35 -0
  5. data/.travis.yml +10 -5
  6. data/CHANGELOG.md +45 -0
  7. data/Gemfile +6 -7
  8. data/Gemfile.lock +134 -146
  9. data/Maintaining.MD +8 -0
  10. data/README.md +266 -226
  11. data/api_reference.md +534 -143
  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 +6 -0
  16. data/example/sinatra/index.erb +202 -0
  17. data/example/sinatra/response.erb +1 -0
  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 +146 -22
  31. data/lib/veritrans/client.rb +48 -12
  32. data/lib/veritrans/config.rb +31 -6
  33. data/lib/veritrans/events.rb +46 -35
  34. data/lib/veritrans/midtrans_error.rb +15 -0
  35. data/lib/veritrans/result.rb +66 -5
  36. data/lib/veritrans/version.rb +1 -1
  37. data/lib/veritrans.rb +121 -12
  38. data/veritrans.gemspec +2 -9
  39. metadata +30 -146
  40. data/.rspec +0 -2
  41. data/Procfile +0 -1
  42. data/Rakefile +0 -16
  43. data/bin/midtrans +0 -3
  44. data/bin/veritrans +0 -68
  45. data/example/README.md +0 -8
  46. data/example/config.ru +0 -6
  47. data/example/index.erb +0 -213
  48. data/example/localization.erb +0 -248
  49. data/example/points.erb +0 -187
  50. data/example/recurring.erb +0 -201
  51. data/example/response.erb +0 -37
  52. data/example/sinatra.rb +0 -188
  53. data/example/style.css +0 -126
  54. data/example/veritrans.yml +0 -11
  55. data/example/widget.erb +0 -51
  56. data/lib/generators/templates/assets/credit_card_form.js +0 -51
  57. data/lib/generators/templates/payments_controller.rb +0 -85
  58. data/lib/generators/templates/veritrans.rb +0 -46
  59. data/lib/generators/templates/veritrans.yml +0 -18
  60. data/lib/generators/templates/views/_credit_card_form.erb +0 -42
  61. data/lib/generators/templates/views/_veritrans_include.erb +0 -10
  62. data/lib/generators/templates/views/payments/create.erb +0 -15
  63. data/lib/generators/templates/views/payments/new.erb +0 -6
  64. data/lib/generators/veritrans/install_generator.rb +0 -32
  65. data/lib/generators/veritrans/payment_form_generator.rb +0 -45
  66. data/lib/veritrans/cli.rb +0 -155
  67. data/lib/veritrans/core_extensions.rb +0 -32
  68. data/spec/cli_spec.rb +0 -83
  69. data/spec/configs/real_key.yml +0 -4
  70. data/spec/configs/veritrans.yml +0 -7
  71. data/spec/configs/veritrans_flat.yml +0 -2
  72. data/spec/configs/veritrans_with_erb.yml +0 -2
  73. data/spec/fixtures/approve_failed.yml +0 -48
  74. data/spec/fixtures/cancel_failed.yml +0 -48
  75. data/spec/fixtures/cancel_success.yml +0 -106
  76. data/spec/fixtures/capture_failed.yml +0 -48
  77. data/spec/fixtures/charge.yml +0 -50
  78. data/spec/fixtures/charge_direct.yml +0 -56
  79. data/spec/fixtures/charge_vtweb.yml +0 -50
  80. data/spec/fixtures/cli_test_1111-not-exists.yml +0 -45
  81. data/spec/fixtures/cli_test_not_exists.yml +0 -45
  82. data/spec/fixtures/cli_test_real_txn.yml +0 -55
  83. data/spec/fixtures/cli_test_unauthorized.yml +0 -47
  84. data/spec/fixtures/events_test_real_txn.yml +0 -55
  85. data/spec/fixtures/expire_failed.yml +0 -50
  86. data/spec/fixtures/expire_success.yml +0 -56
  87. data/spec/fixtures/midtrans_status.yml +0 -117
  88. data/spec/fixtures/status_fail.yml +0 -46
  89. data/spec/fixtures/status_success.yml +0 -109
  90. data/spec/midtrans_rename_spec.rb +0 -27
  91. data/spec/rails_plugin_spec.rb +0 -281
  92. data/spec/spec_helper.rb +0 -61
  93. data/spec/veritrans_client_spec.rb +0 -184
  94. data/spec/veritrans_config_spec.rb +0 -70
  95. data/spec/veritrans_events_spec.rb +0 -72
  96. data/spec/veritrans_logger_spec.rb +0 -46
  97. data/spec/veritrans_snap_spec.rb +0 -39
  98. data/testing_webhooks.md +0 -78
data/example/sinatra.rb DELETED
@@ -1,188 +0,0 @@
1
- $:.push(File.expand_path("../../lib", __FILE__))
2
-
3
- require 'json'
4
-
5
- require 'veritrans'
6
- require 'sinatra'
7
-
8
- begin
9
- require 'tilt/erubis'
10
- rescue LoadError => error
11
- puts "Warning: Can not load 'tilt', continue"
12
- end
13
-
14
- Veritrans.setup do
15
- config.load_yml File.dirname(__FILE__) + "/veritrans.yml#development"
16
-
17
- # config.server_key = "..."
18
- # config.client_key = "..."
19
- # config.api_host = "https://api.sandbox.veritrans.co.id" (default)
20
- end
21
-
22
- # Veritrans.config.server_key
23
- # Veritrans.config.client_key
24
- # Veritrans.config.api_host
25
-
26
- set :public_folder, File.dirname(__FILE__)
27
- set :views, File.dirname(__FILE__)
28
-
29
- set :run, $0 == __FILE__
30
-
31
- def generate_order_id
32
- "testing-#{rand.round(4)}-#{Time.now.to_i}"
33
- end
34
-
35
- get "/" do
36
- erb :index
37
- end
38
-
39
- get "/recurring" do
40
- erb :recurring
41
- end
42
-
43
- get "/localization" do
44
- erb :localization
45
- end
46
-
47
- get "/points" do
48
- erb :points
49
- end
50
-
51
- get "/widget" do
52
- response = Veritrans.create_widget_token(
53
- transaction_details: {
54
- order_id: generate_order_id,
55
- gross_amount: 30_000
56
- }
57
- )
58
- @token_id = response.data[:token_id]
59
- erb :widget
60
- end
61
-
62
- get "/widget/confirm/:transaction_id" do
63
- @result = Veritrans.status(params[:transaction_id])
64
- erb :response
65
- end
66
-
67
- post "/charge_vtdirect" do
68
- @charge_params = {
69
- payment_type: "credit_card",
70
- credit_card: {
71
- token_id: params[:token_id]
72
- },
73
- transaction_details: {
74
- order_id: generate_order_id,
75
- gross_amount: params[:gross_amount].to_f,
76
- }
77
- }
78
-
79
- if params[:recurring] == "1"
80
- @charge_params[:credit_card][:recurring] = true
81
- end
82
-
83
- if params[:points_amount]
84
- @charge_params[:credit_card][:point_redeem_amount] = params[:points_amount]
85
- @charge_params[:credit_card][:bank] = "bni"
86
- end
87
-
88
- @result = Veritrans.charge(@charge_params)
89
-
90
- if params[:format] == "json"
91
- content_type :json
92
- @result.response.body
93
- else
94
- erb :response
95
- end
96
- end
97
-
98
- get "/charge_vtweb" do
99
- vtweb_options = {}
100
-
101
- if params[:enabled_payments] && params[:enabled_payments].size > 0
102
- vtweb_options[:enabled_payments] = params[:enabled_payments]
103
- end
104
-
105
- if params[:credit_card_3d_secure] && params[:credit_card_3d_secure] != ""
106
- vtweb_options[:credit_card_3d_secure] = params[:credit_card_3d_secure] == "true"
107
- end
108
-
109
- if params[:bin_promo] && params[:bin_promo] != ""
110
- vtweb_options[:credit_card_bins] = params[:bin_promo]
111
- end
112
-
113
- if params[:installment]
114
- vtweb_options[:payment_options] = {
115
- installment: {
116
- required: true,
117
- installment_terms: {}
118
- }
119
- }
120
-
121
- if params[:installment]['bni']
122
- vtweb_options[:payment_options][:installment][:installment_terms][:bni] = [3, 6, 12]
123
- end
124
-
125
- if params[:installment][:mandiri]
126
- vtweb_options[:payment_options][:installment][:installment_terms][:mandiri] = [3, 6, 12]
127
- end
128
-
129
- if params[:installment]['bca']
130
- vtweb_options[:payment_options][:installment][:installment_terms][:bca] = [3, 6, 12]
131
- end
132
- end
133
-
134
- if request.env["HTTP_REFERER"]
135
- vtweb_options[:finish_redirect_url] = request.env["HTTP_REFERER"]
136
- vtweb_options[:unfinish_redirect_url] = request.env["HTTP_REFERER"]
137
- vtweb_options[:error_redirect_url] = request.env["HTTP_REFERER"]
138
- end
139
-
140
- @cahrge_params = {
141
- payment_type: "VTWEB",
142
- vtweb: vtweb_options,
143
- transaction_details: {
144
- order_id: generate_order_id,
145
- gross_amount: 100_000
146
- }
147
- }
148
-
149
- @result = Veritrans.charge(@cahrge_params)
150
-
151
- if @result.redirect_url
152
- if params[:locale].to_s != ""
153
- @vtweb_url = "#{@result.redirect_url}?locale=#{params[:locale]}"
154
- else
155
- @vtweb_url = @result.redirect_url
156
- end
157
- end
158
-
159
- erb :response
160
- end
161
-
162
- get "/check_points/:token_id" do
163
- @result = Veritrans.inquiry_points(params[:token_id])
164
- content_type :json
165
- @result.response.body
166
- end
167
-
168
- post "/webhook" do
169
- post_body = request.body.read
170
- request_data = Veritrans.decode_notification_json(post_body)
171
-
172
- #puts "Recieved #{post_body.size} bytes"
173
- #p request_data
174
-
175
- verified_data = Veritrans.status(request_data['transaction_id'])
176
-
177
- if verified_data.status_code != 404
178
- puts "--- Transaction callback ---"
179
- puts "Payment: #{verified_data.data[:order_id]}"
180
- puts "Payment type: #{verified_data.data[:payment_type]}"
181
- puts "Payment status: #{verified_data.data[:transaction_status]}"
182
- puts "Fraud status: #{verified_data.data[:fraud_status]}" if verified_data.data[:fraud_status]
183
- puts "Payment amount: #{verified_data.data[:gross_amount]}"
184
- puts "--- Transaction callback ---"
185
- end
186
-
187
- return "ok"
188
- end
data/example/style.css DELETED
@@ -1,126 +0,0 @@
1
- body {
2
- max-width: 900px;
3
- margin: 0 auto;
4
- font-size: 16px;
5
- background: white;
6
- }
7
- a {
8
- color: #00E;
9
- }
10
- a:hover, a:focus {
11
- color: #00E;
12
- }
13
-
14
- header {
15
- background: #F5FAFC;
16
- padding: 3px 5px;
17
- border-bottom: 1px solid #ccc;
18
- }
19
-
20
- section {
21
- padding: 1em 0;
22
- }
23
-
24
- section + section {
25
- border-top: 1px solid #ccc;
26
- }
27
-
28
- label {
29
- display: inline-block;
30
- min-width: 100px;
31
- vertical-align: top;
32
- }
33
- .card-numbers {
34
- margin-left: 100px;
35
- }
36
- .card-numbers a {
37
- text-decoration: none;
38
- border-bottom: 1px dotted #88f;
39
- margin-right: 10px;
40
- cursor: pointer;
41
- }
42
- .card-numbers a[href] {
43
- text-decoration: underline;
44
- border: none;
45
- }
46
-
47
- fieldset {
48
- margin: 25px 0 12px;
49
- }
50
-
51
- .white-popup {
52
- position: relative;
53
- background: #FFF;
54
- padding: 20px;
55
- width: auto;
56
- max-width: 600px;
57
- margin: 20px auto;
58
- }
59
-
60
- .white-popup pre code {
61
- white-space: pre-wrap;
62
- }
63
-
64
- #vtweb_form label {
65
- min-width: 180px;
66
- }
67
-
68
- #vtweb_form ul {
69
- display: inline-block;
70
- vertical-align: top;
71
- margin-top: 0;
72
- padding-left: 0px;
73
- }
74
-
75
- #vtweb_form ul li {
76
- list-style-type: none;
77
- margin-bottom: 1px;
78
- font-size: 15px;
79
- }
80
-
81
- #vtweb_form small {
82
- margin-left: 184px;
83
- }
84
-
85
- .recurring-page .cards {
86
- border: 1px dashed #acf;
87
- padding: 10px;
88
- }
89
-
90
- .recurring-page .cards ul {
91
- padding-left: 0;
92
- margin-bottom: 3px;
93
- }
94
-
95
- .recurring-page .cards ul li {
96
- list-style-type: none;
97
- display: block;
98
- background: #f5f5f5;
99
- padding: 7px 9px;
100
- box-shadow: inset 0px 0px 2px rgba(0, 0, 64, 0.25);
101
- }
102
-
103
- .recurring-page .cards ul li + li {
104
- margin-top: 10px;
105
- }
106
-
107
- .recurring-page .cards ul li code {
108
- margin: 0 18px 0 4px;
109
- }
110
- .recurring-page .cards ul li i {
111
- margin: 0 35px 0 4px;
112
- font-style: normal;
113
- }
114
-
115
- .recurring-page .cards ul li a {
116
- margin-right: 10px;
117
- }
118
-
119
- .recurring-page .cards ul li small {
120
- display: block;
121
- margin-top: 7px;
122
- color: #666;
123
- font-family: monospace;
124
- font-size: 10px;
125
- }
126
-
@@ -1,11 +0,0 @@
1
- development:
2
- # merchant_id: M000937
3
-
4
- client_key: VT-client-NArmatJZqzsmTmzR
5
- server_key: VT-server-9Htb-RxXkg7-7hznSCCjxvoY
6
-
7
- # For production use
8
- # api_host: https://api.veritrans.co.id
9
-
10
- # For sandbox use
11
- # api_host: https://api.sandbox.veritrans.co.id
data/example/widget.erb DELETED
@@ -1,51 +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.veritrans.co.id/favicon.ico" />
6
- <link rel="stylesheet" href="/style.css">
7
- </head>
8
- <body>
9
-
10
- <header>
11
- <h3>
12
- <a href="/">Veritrans sinatra app</a>
13
- </h3>
14
- </header>
15
-
16
- <section>
17
- <h4>Veritrans Widget</h4>
18
-
19
- <section>
20
- <p>
21
- <label>Token ID</label>
22
- <input type="text" id="token_id" value="<%= @token_id %>" readonly>
23
- </p>
24
- <button id="snap_pay">Pay Now</button>
25
- </section>
26
- </section>
27
-
28
- <script src="https://app.sandbox.veritrans.co.id/snap/snap.js"></script>
29
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
30
-
31
- <script type="text/javascript">
32
- $('#snap_pay').on('click', function (e) {
33
- e.preventDefault();
34
- snap.pay($('#token_id').val() + "?locale=en", {
35
- onSuccess: function (res) {
36
- console.log('onSuccess', res);
37
- alert(res.status_message + "\nRedirecting to confirm page...");
38
- window.location = "/widget/confirm/" + res.transaction_id;
39
- },
40
- onPending: function (res) {
41
- console.log('onPending', res);
42
- },
43
- onError: function (res) {
44
- console.log('onError', res);
45
- }
46
- });
47
- });
48
- </script>
49
-
50
- </body>
51
- </html>
@@ -1,51 +0,0 @@
1
- $(document).ready(function () {
2
-
3
- function VT_createTokenData() {
4
- return {
5
- // Optional params:
6
- // secure: true
7
- // bank: 'MANDIRI'
8
- // gross_amount: 1000
9
-
10
- card_number: $('#credit_card_number').val(),
11
- card_cvv: $('#credit_card_cvv').val(),
12
- card_exp_month: $('#credit_card_expire').val().match(/(\d+) \//)[1],
13
- card_exp_year: '20' + $('#credit_card_expire').val().match(/\/ (\d+)/)[1],
14
- gross_amount: $('#payment_amount').val(),
15
- secure: $('#payment_credit_card_secure')[0].checked
16
- };
17
- }
18
-
19
- $('.veritrans-payment-form').on('submit', function (event) {
20
- event.preventDefault();
21
-
22
- var form = this;
23
- var button = $(form).find('input[type=submit]:last');
24
- var buttonValBefore = button.val();
25
- button.val("Processing ...");
26
-
27
- Veritrans.token(VT_createTokenData, function (data) {
28
- //console.log('Get token response:');
29
- //console.log(JSON.stringify(VT_createTokenData()));
30
- //console.log(JSON.stringify(data));
31
-
32
- // if we get redirect_url then it's 3d-secure transaction
33
- // so we need to open that page
34
- // this callback function will be called again after user confirm 3d-secure
35
- // you can also redirect on server side
36
-
37
- if (data.redirect_url) {
38
- // it works nice with lightbox js libraries
39
- $('#3d-secure-iframe').attr('src', data.redirect_url).show();
40
- // if no redirect_url and we have token_id then just make charge request
41
- } else if (data.token_id) {
42
- $('#payment_token_id').val(data.token_id);
43
- form.submit();
44
- // if no redirect_url and no token_id, then it should be error
45
- } else {
46
- alert(data.validation_messages ? data.validation_messages.join("\n") : data.status_message);
47
- button.removeAttr('disabled').val(buttonValBefore);
48
- }
49
- });
50
- });
51
- });
@@ -1,85 +0,0 @@
1
- class PaymentsController < ApplicationController
2
- skip_before_filter :verify_authenticity_token, only: [:receive_webhook]
3
-
4
- def new
5
- @payment = make_payment
6
- end
7
-
8
- # Creating example payment
9
- def create
10
- @payment = make_payment
11
-
12
- if params[:type] == "vtweb"
13
- @result = Veritrans.charge(
14
- payment_type: "VTWEB",
15
- transaction_details: {
16
- order_id: @payment.order_id,
17
- gross_amount: @payment.amount
18
- }
19
- )
20
- redirect_to @result.redirect_url
21
- return
22
- end
23
-
24
- @result = Veritrans.charge(
25
- payment_type: "credit_card",
26
- credit_card: { token_id: params[:payment][:token_id] },
27
- transaction_details: {
28
- order_id: @payment.order_id,
29
- gross_amount: params[:payment][:amount].presence || @payment.amount
30
- }
31
- )
32
- end
33
-
34
- # Processing HTTP Notification from Veritrans
35
- # POST request with JSON-encoded body
36
- # If you using Veritrans::Events then you don't need this
37
- def receive_webhook
38
- post_body = request.body.read
39
-
40
- Veritrans.file_logger.info("Callback for order: " +
41
- "#{params[:order_id]} #{params[:transaction_status]}\n" +
42
- post_body + "\n"
43
- )
44
-
45
- verified_data = Veritrans.status(params["transaction_id"])
46
-
47
- if verified_data.status_code != 404
48
- puts "--- Transaction callback ---"
49
- puts "Payment: #{verified_data.data[:order_id]}"
50
- puts "Payment type: #{verified_data.data[:payment_type]}"
51
- puts "Payment status: #{verified_data.data[:transaction_status]}"
52
- puts "Fraud status: #{verified_data.data[:fraud_status]}" if verified_data.data[:fraud_status]
53
- puts "Payment amount: #{verified_data.data[:gross_amount]}"
54
- puts "--- Transaction callback ---"
55
-
56
- render text: "ok"
57
- else
58
- Veritrans.file_logger.info("Callback verification failed for order: " +
59
- "#{params[:order_id]} #{params[:transaction_status]}}\n" +
60
- verified_data.body + "\n"
61
- )
62
-
63
- render text: "ok", :status => :not_found
64
- end
65
-
66
- end
67
-
68
- # You should replace this with your own model
69
- private
70
- def make_payment
71
- @paymentKlass = Struct.new("Payment", :amount, :token_id, :order_id, :credit_card_secure) do
72
- extend ActiveModel::Naming
73
- include ActiveModel::Conversion
74
-
75
- def persisted?; false; end
76
-
77
- def self.name
78
- "Payment"
79
- end
80
- end
81
-
82
- @paymentKlass.new(100_000, '', "testing-#{rand.round(4)}-#{Time.now.to_i}", false)
83
- end
84
-
85
- end
@@ -1,46 +0,0 @@
1
- Veritrans.setup do
2
- config.load_config Rails.root.join("config/veritrans.yml"), Rails.env
3
-
4
- # Or set it manually...
5
- # config.server_key = ""
6
- # config.client_key = ""
7
- # config.api_host = ""
8
-
9
- # Veritrans::Events is rack application to handle http notifications from Veritrans
10
- # To enable it, add in config/routes.rb
11
- #
12
- # mount Veritrans::Events.new => '/vt_events'
13
- #
14
- # All possible events:
15
- #
16
- # 'payment.success' == ['authorize', 'capture', 'settlement']
17
- # 'payment.failed' == ['deny', 'cancel', 'expire']
18
- # 'payment.challenge' # when payment.fraud_status == 'challenge'
19
- #
20
- # 'payment.authorize'
21
- # 'payment.capture'
22
- # 'payment.settlement'
23
- # 'payment.deny'
24
- # 'payment.cancel'
25
- # 'payment.expire'
26
-
27
- # events.subscribe 'payment.success' do |payment|
28
- # payment is instance of Veritrans::Result
29
- # puts "Payment #{payment.data[:order_id]} is successful"
30
- # end
31
- #
32
- # events.subscribe 'payment.failed' do |payment|
33
- # puts "Payment #{payment.data[:order_id]} is failed"
34
- # end
35
- #
36
- # events.subscribe 'payment.challenge' do |payment|
37
- # puts "Payment #{payment.data[:order_id]} chellenged by fraud system"
38
- # payment.mark_challenge!
39
- # end
40
- #
41
- # events.subscribe /.+/ do |payment, event_name|
42
- # puts "Payment #{payment.data[:order_id]} has status #{payment.data[:transaction_status]}"
43
- # p payment
44
- # end
45
-
46
- end
@@ -1,18 +0,0 @@
1
- development:
2
- # Register in sandbox veritrans and get your keys here:
3
- # https://my.sandbox.veritrans.co.id/settings/config_info
4
- client_key: ""
5
- server_key: ""
6
- api_host: https://api.sandbox.veritrans.co.id
7
-
8
- production:
9
- # Register and get your keys here:
10
- # https://my.veritrans.co.id/settings/config_info
11
- client_key: <%= ENV['VERITRANS_CLIENT_KEY'] %>
12
- server_key: <%= ENV['VERITRANS_SERVER_KEY'] %>
13
- api_host: https://api.veritrans.co.id
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.veritrans.co.id
@@ -1,42 +0,0 @@
1
- <%= form_for @payment, html: {class: "veritrans-payment-form"} do |f| %>
2
- <%= f.hidden_field :token_id %>
3
- <input type="submit" style="display: none">
4
- <p>
5
- <%= f.label :amount %>
6
- <%= f.number_field :amount %>
7
- </p>
8
-
9
- <p>
10
- <%= label_tag :credit_card_number %>
11
- <%= text_field_tag :credit_card_number, '4811 1111 1111 1114', name: nil, size: 25 %>
12
- </p>
13
- <p>
14
- <button onclick="$('#credit_card_number').val('5810 1111 1111 1112'); return false">success MasterCard</button>
15
- <button onclick="$('#credit_card_number').val('4811 1111 1111 1114'); return false">success Visa</button>
16
- <button onclick="$('#credit_card_number').val('4511 1111 1111 1117'); return false">challenge</button>
17
- <button onclick="$('#credit_card_number').val('4611 1111 1111 1116'); return false">Deny by FDS</button>
18
- <button onclick="$('#credit_card_number').val('4911 1111 1111 1113'); return false">Deny by bank</button>
19
- <a href="http://docs.veritrans.co.id/sandbox/card_list.html" target="_blank">documentation</a>
20
- </p>
21
-
22
- <p>
23
- <%= label_tag :credit_card_cvv %>
24
- <%= text_field_tag :credit_card_cvv, '123', name: nil %>
25
- </p>
26
-
27
- <p>
28
- <%= label_tag :credit_card_expire %>
29
- <%= text_field_tag :credit_card_expire, '12 / 16', placeholder: "MM / YY", name: nil %>
30
- </p>
31
-
32
- <p>
33
- <%= f.label :credit_card_secure, "3D-secure" %>
34
- <%= f.check_box :credit_card_secure %>
35
- </p>
36
-
37
- <p>
38
- <%= f.submit "Pay via VT-Direct" %>
39
- </p>
40
- <% end %>
41
-
42
- <iframe id="3d-secure-iframe" style="display: none; width: 500px; height: 600px"></iframe>
@@ -1,10 +0,0 @@
1
- <%= javascript_include_tag "#{Veritrans.config.api_host}/v2/assets/veritrans.js" %>
2
-
3
- <script type="text/javascript">
4
- Veritrans.url = "<%= Veritrans.config.api_host %>/v2/token";
5
- Veritrans.client_key = "<%= Veritrans.config.client_key %>";
6
- </script>
7
-
8
- <% unless Veritrans.config.client_key.present? %>
9
- <h4 style="color: red">Please add client_key in config/veritrans.yml</h4>
10
- <% end %>
@@ -1,15 +0,0 @@
1
- <strong>
2
- <% if @result.success? %><span style="color: green"><% end %>
3
- <%= @result.status_message %>
4
- </span>
5
- </strong>
6
-
7
- <br>
8
-
9
- <code>
10
- <pre>
11
- <%= @result.response.body %>
12
- </pre>
13
- </code>
14
-
15
- <%= link_to "Go back", :new_payment %>
@@ -1,6 +0,0 @@
1
- <h3>New payment</h3>
2
-
3
- <%= link_to "Pay via VT-Web", payments_path(type: 'vtweb'), data: {method: 'post'} %>
4
-
5
- <%= render "shared/credit_card_form" %>
6
- <%= render "shared/veritrans_include" %>
@@ -1,32 +0,0 @@
1
- class Veritrans
2
- class InstallGenerator < ::Rails::Generators::Base
3
- source_root File.expand_path("../../templates", __FILE__)
4
-
5
- desc %{
6
- Description:
7
- Copies Veritrans configuration file to your application's initializer directory.
8
- }
9
-
10
- desc "copy veritrans.yml"
11
- def copy_config_file
12
- copy_file "veritrans.yml", "config/veritrans.yml"
13
- end
14
-
15
- desc "copy initializer veritrans.rb"
16
- def copy_initializer_file
17
- copy_file "./veritrans.rb", "config/initializers/veritrans.rb"
18
-
19
- say_status "", %{
20
-
21
- We copy configs in your rails application
22
- Please edit:
23
-
24
- config/veritrans.yml
25
-
26
- }
27
-
28
-
29
- end
30
-
31
- end
32
- end