veritrans 2.3.0 → 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.
- checksums.yaml +4 -4
- data/.gitignore +4 -0
- data/.idea/.gitignore +8 -0
- data/.rubocop.yml +1 -1
- data/.travis.yml +2 -1
- data/CHANGELOG.md +13 -0
- data/Gemfile +2 -11
- data/Gemfile.lock +116 -145
- data/Maintaining.MD +8 -0
- data/README.md +247 -278
- data/api_reference.md +482 -173
- data/example/coreapi/core_api_credit_card_example.rb +66 -0
- data/example/coreapi/readme.md +4 -0
- data/example/sinatra/Gemfile +7 -0
- data/example/sinatra/README.md +4 -6
- data/example/sinatra/index.erb +180 -192
- data/example/sinatra/response.erb +1 -40
- data/example/sinatra/snap.erb +33 -0
- data/example/sinatra/snap_redirect.erb +10 -0
- data/example/sinatra/webapp.rb +113 -0
- data/example/snap/readme.md +4 -0
- data/example/snap/snap_example.rb +39 -0
- data/lib/test/all.rb +1 -0
- data/lib/test/api_test.rb +319 -0
- data/lib/test/config_test.rb +26 -0
- data/lib/test/gopay_tokenization_test.rb +80 -0
- data/lib/test/snap_test.rb +79 -0
- data/lib/test/subscription_test.rb +116 -0
- data/lib/test/transaction_test.rb +160 -0
- data/lib/veritrans/api.rb +105 -8
- data/lib/veritrans/client.rb +40 -7
- data/lib/veritrans/config.rb +26 -3
- data/lib/veritrans/midtrans_error.rb +15 -0
- data/lib/veritrans/version.rb +1 -1
- data/lib/veritrans.rb +5 -6
- data/veritrans.gemspec +1 -2
- metadata +25 -248
- data/.rspec +0 -2
- data/Procfile +0 -1
- data/Rakefile +0 -16
- data/bin/midtrans +0 -3
- data/bin/veritrans +0 -68
- data/example/rails/cable/Gemfile +0 -48
- data/example/rails/cable/Gemfile.lock +0 -184
- data/example/rails/cable/README.md +0 -29
- data/example/rails/cable/Rakefile +0 -6
- data/example/rails/cable/app/assets/config/manifest.js +0 -3
- data/example/rails/cable/app/assets/images/.keep +0 -0
- data/example/rails/cable/app/assets/javascripts/application.js +0 -15
- data/example/rails/cable/app/assets/javascripts/cable.js +0 -13
- data/example/rails/cable/app/assets/javascripts/channels/.keep +0 -0
- data/example/rails/cable/app/assets/javascripts/chats.js +0 -39
- data/example/rails/cable/app/assets/javascripts/rooms.js +0 -55
- data/example/rails/cable/app/assets/stylesheets/application.css +0 -16
- data/example/rails/cable/app/assets/stylesheets/chatbox.scss +0 -31
- data/example/rails/cable/app/assets/stylesheets/peoplebox.scss +0 -6
- data/example/rails/cable/app/channels/application_cable/channel.rb +0 -4
- data/example/rails/cable/app/channels/application_cable/connection.rb +0 -4
- data/example/rails/cable/app/channels/rooms_texting_channel.rb +0 -13
- data/example/rails/cable/app/controllers/application_controller.rb +0 -3
- data/example/rails/cable/app/controllers/chats_controller.rb +0 -18
- data/example/rails/cable/app/controllers/concerns/.keep +0 -0
- data/example/rails/cable/app/controllers/pays_controller.rb +0 -28
- data/example/rails/cable/app/controllers/rooms_controller.rb +0 -4
- data/example/rails/cable/app/helpers/application_helper.rb +0 -2
- data/example/rails/cable/app/helpers/chats_helper.rb +0 -2
- data/example/rails/cable/app/helpers/rooms_helper.rb +0 -5
- data/example/rails/cable/app/jobs/application_job.rb +0 -2
- data/example/rails/cable/app/jobs/chat_broadcaster_job.rb +0 -15
- data/example/rails/cable/app/mailers/application_mailer.rb +0 -4
- data/example/rails/cable/app/models/application_record.rb +0 -3
- data/example/rails/cable/app/models/chat.rb +0 -41
- data/example/rails/cable/app/models/concerns/.keep +0 -0
- data/example/rails/cable/app/models/order.rb +0 -2
- data/example/rails/cable/app/models/user.rb +0 -2
- data/example/rails/cable/app/views/chats/_chat.html.erb +0 -18
- data/example/rails/cable/app/views/layouts/application.html.erb +0 -19
- data/example/rails/cable/app/views/layouts/mailer.html.erb +0 -13
- data/example/rails/cable/app/views/layouts/mailer.text.erb +0 -1
- data/example/rails/cable/app/views/rooms/_chatbox.html.erb +0 -13
- data/example/rails/cable/app/views/rooms/_online_people.html.erb +0 -53
- data/example/rails/cable/app/views/rooms/index.html.erb +0 -9
- data/example/rails/cable/bin/bundle +0 -3
- data/example/rails/cable/bin/rails +0 -9
- data/example/rails/cable/bin/rake +0 -9
- data/example/rails/cable/bin/setup +0 -34
- data/example/rails/cable/bin/spring +0 -16
- data/example/rails/cable/bin/update +0 -29
- data/example/rails/cable/config/application.rb +0 -16
- data/example/rails/cable/config/boot.rb +0 -3
- data/example/rails/cable/config/cable.yml +0 -9
- data/example/rails/cable/config/database.yml +0 -20
- data/example/rails/cable/config/environment.rb +0 -5
- data/example/rails/cable/config/environments/development.rb +0 -57
- data/example/rails/cable/config/environments/production.rb +0 -86
- data/example/rails/cable/config/environments/test.rb +0 -42
- data/example/rails/cable/config/initializers/application_controller_renderer.rb +0 -6
- data/example/rails/cable/config/initializers/assets.rb +0 -11
- data/example/rails/cable/config/initializers/backtrace_silencers.rb +0 -7
- data/example/rails/cable/config/initializers/cookies_serializer.rb +0 -5
- data/example/rails/cable/config/initializers/filter_parameter_logging.rb +0 -4
- data/example/rails/cable/config/initializers/inflections.rb +0 -16
- data/example/rails/cable/config/initializers/mime_types.rb +0 -4
- data/example/rails/cable/config/initializers/new_framework_defaults.rb +0 -24
- data/example/rails/cable/config/initializers/session_store.rb +0 -3
- data/example/rails/cable/config/initializers/sidekiq.rb +0 -2
- data/example/rails/cable/config/initializers/veritrans.rb +0 -46
- data/example/rails/cable/config/initializers/wrap_parameters.rb +0 -14
- data/example/rails/cable/config/locales/en.yml +0 -23
- data/example/rails/cable/config/puma.rb +0 -47
- data/example/rails/cable/config/routes.rb +0 -18
- data/example/rails/cable/config/secrets.yml +0 -22
- data/example/rails/cable/config/spring.rb +0 -6
- data/example/rails/cable/config/veritrans.yml +0 -13
- data/example/rails/cable/config.ru +0 -5
- data/example/rails/cable/db/development.sqlite3 +0 -0
- data/example/rails/cable/db/migrate/20161215070044_create_chats.rb +0 -10
- data/example/rails/cable/db/migrate/20161215072021_create_users.rb +0 -10
- data/example/rails/cable/db/migrate/20161219110219_create_orders.rb +0 -11
- data/example/rails/cable/db/schema.rb +0 -37
- data/example/rails/cable/db/seeds.rb +0 -41
- data/example/rails/cable/db/test.sqlite3 +0 -0
- data/example/rails/cable/lib/assets/.keep +0 -0
- data/example/rails/cable/lib/tasks/.keep +0 -0
- data/example/rails/cable/log/.keep +0 -0
- data/example/rails/cable/public/404.html +0 -67
- data/example/rails/cable/public/422.html +0 -67
- data/example/rails/cable/public/500.html +0 -66
- data/example/rails/cable/public/apple-touch-icon-precomposed.png +0 -0
- data/example/rails/cable/public/apple-touch-icon.png +0 -0
- data/example/rails/cable/public/favicon.ico +0 -0
- data/example/rails/cable/public/images/avatar1.jpg +0 -0
- data/example/rails/cable/public/images/avatar2.jpg +0 -0
- data/example/rails/cable/public/images/avatar3.jpg +0 -0
- data/example/rails/cable/public/images/avatar4.jpg +0 -0
- data/example/rails/cable/public/images/avatar5.jpg +0 -0
- data/example/rails/cable/public/images/avatar6.jpg +0 -0
- data/example/rails/cable/public/robots.txt +0 -5
- data/example/rails/cable/vendor/assets/javascripts/.keep +0 -0
- data/example/rails/cable/vendor/assets/stylesheets/.keep +0 -0
- data/example/rails/cable/vendor/assets/stylesheets/photon.css +0 -2333
- data/example/rails/simplepay/Gemfile +0 -54
- data/example/rails/simplepay/Gemfile.lock +0 -178
- data/example/rails/simplepay/README.md +0 -30
- data/example/rails/simplepay/Rakefile +0 -6
- data/example/rails/simplepay/app/assets/config/manifest.js +0 -3
- data/example/rails/simplepay/app/assets/images/.keep +0 -0
- data/example/rails/simplepay/app/assets/javascripts/application.js +0 -16
- data/example/rails/simplepay/app/assets/javascripts/cable.js +0 -13
- data/example/rails/simplepay/app/assets/javascripts/channels/.keep +0 -0
- data/example/rails/simplepay/app/assets/javascripts/pay.js +0 -18
- data/example/rails/simplepay/app/assets/stylesheets/application.css +0 -15
- data/example/rails/simplepay/app/assets/stylesheets/style.css +0 -254
- data/example/rails/simplepay/app/channels/application_cable/channel.rb +0 -4
- data/example/rails/simplepay/app/channels/application_cable/connection.rb +0 -4
- data/example/rails/simplepay/app/controllers/application_controller.rb +0 -3
- data/example/rails/simplepay/app/controllers/concerns/.keep +0 -0
- data/example/rails/simplepay/app/controllers/home_controller.rb +0 -16
- data/example/rails/simplepay/app/controllers/pay_controller.rb +0 -10
- data/example/rails/simplepay/app/helpers/application_helper.rb +0 -2
- data/example/rails/simplepay/app/helpers/pay_helper.rb +0 -2
- data/example/rails/simplepay/app/jobs/application_job.rb +0 -2
- data/example/rails/simplepay/app/mailers/application_mailer.rb +0 -4
- data/example/rails/simplepay/app/models/application_record.rb +0 -3
- data/example/rails/simplepay/app/models/concerns/.keep +0 -0
- data/example/rails/simplepay/app/models/order.rb +0 -2
- data/example/rails/simplepay/app/views/home/index.html.erb +0 -19
- data/example/rails/simplepay/app/views/layouts/application.html.erb +0 -15
- data/example/rails/simplepay/app/views/layouts/mailer.html.erb +0 -13
- data/example/rails/simplepay/app/views/layouts/mailer.text.erb +0 -1
- data/example/rails/simplepay/app/views/pay/notify.html.erb +0 -2
- data/example/rails/simplepay/bin/bundle +0 -3
- data/example/rails/simplepay/bin/rails +0 -9
- data/example/rails/simplepay/bin/rake +0 -9
- data/example/rails/simplepay/bin/setup +0 -34
- data/example/rails/simplepay/bin/spring +0 -16
- data/example/rails/simplepay/bin/update +0 -29
- data/example/rails/simplepay/config/application.rb +0 -15
- data/example/rails/simplepay/config/boot.rb +0 -3
- data/example/rails/simplepay/config/cable.yml +0 -9
- data/example/rails/simplepay/config/database.yml +0 -25
- data/example/rails/simplepay/config/environment.rb +0 -5
- data/example/rails/simplepay/config/environments/development.rb +0 -57
- data/example/rails/simplepay/config/environments/production.rb +0 -86
- data/example/rails/simplepay/config/environments/test.rb +0 -42
- data/example/rails/simplepay/config/initializers/application_controller_renderer.rb +0 -6
- data/example/rails/simplepay/config/initializers/assets.rb +0 -11
- data/example/rails/simplepay/config/initializers/backtrace_silencers.rb +0 -7
- data/example/rails/simplepay/config/initializers/cookies_serializer.rb +0 -5
- data/example/rails/simplepay/config/initializers/filter_parameter_logging.rb +0 -4
- data/example/rails/simplepay/config/initializers/inflections.rb +0 -16
- data/example/rails/simplepay/config/initializers/mime_types.rb +0 -4
- data/example/rails/simplepay/config/initializers/new_framework_defaults.rb +0 -24
- data/example/rails/simplepay/config/initializers/session_store.rb +0 -3
- data/example/rails/simplepay/config/initializers/veritrans.rb +0 -46
- data/example/rails/simplepay/config/initializers/wrap_parameters.rb +0 -14
- data/example/rails/simplepay/config/locales/en.yml +0 -23
- data/example/rails/simplepay/config/puma.rb +0 -47
- data/example/rails/simplepay/config/routes.rb +0 -5
- data/example/rails/simplepay/config/secrets.yml +0 -22
- data/example/rails/simplepay/config/spring.rb +0 -6
- data/example/rails/simplepay/config/veritrans.yml +0 -18
- data/example/rails/simplepay/config.ru +0 -5
- data/example/rails/simplepay/db/development.sqlite3 +0 -0
- data/example/rails/simplepay/db/migrate/20161221090855_create_orders.rb +0 -10
- data/example/rails/simplepay/db/schema.rb +0 -22
- data/example/rails/simplepay/db/seeds.rb +0 -7
- data/example/rails/simplepay/db/test.sqlite3 +0 -0
- data/example/rails/simplepay/lib/assets/.keep +0 -0
- data/example/rails/simplepay/lib/tasks/.keep +0 -0
- data/example/rails/simplepay/log/.keep +0 -0
- data/example/rails/simplepay/public/404.html +0 -67
- data/example/rails/simplepay/public/422.html +0 -67
- data/example/rails/simplepay/public/500.html +0 -66
- data/example/rails/simplepay/public/apple-touch-icon-precomposed.png +0 -0
- data/example/rails/simplepay/public/apple-touch-icon.png +0 -0
- data/example/rails/simplepay/public/favicon.ico +0 -0
- data/example/rails/simplepay/public/robots.txt +0 -5
- data/example/rails/simplepay/vendor/assets/javascripts/.keep +0 -0
- data/example/rails/simplepay/vendor/assets/stylesheets/.keep +0 -0
- data/example/sinatra/config.ru +0 -9
- data/example/sinatra/localization.erb +0 -249
- data/example/sinatra/points.erb +0 -188
- data/example/sinatra/recurring.erb +0 -201
- data/example/sinatra/sinatra.rb +0 -194
- data/example/sinatra/style.css +0 -137
- data/example/sinatra/veritrans.yml +0 -11
- data/example/sinatra/widget.erb +0 -63
- data/lib/generators/templates/assets/credit_card_form.js +0 -57
- data/lib/generators/templates/payments_controller.rb +0 -85
- data/lib/generators/templates/veritrans.rb +0 -46
- data/lib/generators/templates/veritrans.yml +0 -18
- data/lib/generators/templates/views/_credit_card_form.erb +0 -42
- data/lib/generators/templates/views/_veritrans_include.erb +0 -10
- data/lib/generators/templates/views/payments/create.erb +0 -15
- data/lib/generators/templates/views/payments/new.erb +0 -6
- data/lib/generators/veritrans/install_generator.rb +0 -32
- data/lib/generators/veritrans/payment_form_generator.rb +0 -45
- data/lib/veritrans/cli.rb +0 -161
- data/lib/veritrans/testing.rb +0 -156
- data/spec/cli_spec.rb +0 -83
- data/spec/configs/real_key.yml +0 -4
- data/spec/configs/veritrans.yml +0 -7
- data/spec/configs/veritrans_flat.yml +0 -2
- data/spec/configs/veritrans_with_erb.yml +0 -2
- data/spec/fixtures/approve_failed.yml +0 -48
- data/spec/fixtures/cancel_failed.yml +0 -48
- data/spec/fixtures/cancel_success.yml +0 -126
- data/spec/fixtures/capture_failed.yml +0 -48
- data/spec/fixtures/charge.yml +0 -50
- data/spec/fixtures/charge_direct.yml +0 -56
- data/spec/fixtures/charge_vtweb.yml +0 -50
- data/spec/fixtures/cli_test_1111-not-exists.yml +0 -45
- data/spec/fixtures/cli_test_not_exists.yml +0 -45
- data/spec/fixtures/cli_test_real_txn.yml +0 -55
- data/spec/fixtures/cli_test_unauthorized.yml +0 -47
- data/spec/fixtures/deny_failed.yml +0 -144
- data/spec/fixtures/events_test_real_txn.yml +0 -55
- data/spec/fixtures/expire_failed.yml +0 -50
- data/spec/fixtures/expire_success.yml +0 -56
- data/spec/fixtures/midtrans_status.yml +0 -117
- data/spec/fixtures/refund_failed.yml +0 -54
- data/spec/fixtures/status_fail.yml +0 -48
- data/spec/fixtures/status_success.yml +0 -128
- data/spec/fixtures/test_token.yml +0 -49
- data/spec/midtrans_rename_spec.rb +0 -27
- data/spec/rails_plugin_spec.rb +0 -317
- data/spec/spec_helper.rb +0 -71
- data/spec/veritrans_client_spec.rb +0 -235
- data/spec/veritrans_config_spec.rb +0 -70
- data/spec/veritrans_events_spec.rb +0 -72
- data/spec/veritrans_logger_spec.rb +0 -46
- data/spec/veritrans_snap_spec.rb +0 -54
- data/spec/veritrans_testing_spec.rb +0 -184
- data/testing_webhooks.md +0 -78
data/lib/veritrans/cli.rb
DELETED
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
require 'json'
|
|
2
|
-
require 'securerandom'
|
|
3
|
-
require 'logger'
|
|
4
|
-
|
|
5
|
-
class Veritrans
|
|
6
|
-
module CLI #:nodoc:
|
|
7
|
-
# can't find order
|
|
8
|
-
class OrderNotFound < Exception; end # :nodoc:
|
|
9
|
-
class AuthenticationError < Exception; end # :nodoc:
|
|
10
|
-
|
|
11
|
-
extend self
|
|
12
|
-
|
|
13
|
-
def test_webhook(args)
|
|
14
|
-
url = args.shift
|
|
15
|
-
raise ArgumentError, "missing required parameter URL" unless url && url != ""
|
|
16
|
-
|
|
17
|
-
options = {
|
|
18
|
-
body: json_data,
|
|
19
|
-
headers: {
|
|
20
|
-
:Accept => "application/json",
|
|
21
|
-
:"Content-Type" => "application/json",
|
|
22
|
-
:"User-Agent" => "Veritrans gem #{Veritrans::VERSION} - webhook tester"
|
|
23
|
-
},
|
|
24
|
-
read_timeout: 10,
|
|
25
|
-
write_timeout: 10,
|
|
26
|
-
connect_timeout: 10
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
puts "Sending #{options[:body].length} bytes to:"
|
|
30
|
-
puts " => #{cyan(url)}"
|
|
31
|
-
# Print body if it's custom
|
|
32
|
-
puts options[:body] + "\n\n" if CONFIG[:order]
|
|
33
|
-
|
|
34
|
-
s_time = Time.now
|
|
35
|
-
response = Excon.post(url, options)
|
|
36
|
-
response.body = response.body.to_s.encode('UTF-8', {:invalid => :replace, :undef => :replace, :replace => '?'})
|
|
37
|
-
|
|
38
|
-
puts "Got response: (#{((Time.now - s_time) * 1000).round}ms)"
|
|
39
|
-
puts " status: #{response.status}"
|
|
40
|
-
puts " body: #{response.body}"
|
|
41
|
-
|
|
42
|
-
if response.status >= 200 && response.status < 300
|
|
43
|
-
puts green("Success!")
|
|
44
|
-
else
|
|
45
|
-
puts red("Failed!")
|
|
46
|
-
puts "Response status is #{response.status} not 200"
|
|
47
|
-
end
|
|
48
|
-
#rescue Object => error
|
|
49
|
-
# puts red("Failed!")
|
|
50
|
-
# puts error.message
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
def load_local_config!
|
|
54
|
-
if CONFIG[:config_path]
|
|
55
|
-
if File.exists?(CONFIG[:config_path])
|
|
56
|
-
config_file = CONFIG[:config_path]
|
|
57
|
-
else
|
|
58
|
-
raise ArgumentError, "Can not find config at #{CONFIG[:config_path]}" unless config_file
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
if File.exists?("./veritrans.yml")
|
|
64
|
-
config_file = "./veritrans.yml"
|
|
65
|
-
end
|
|
66
|
-
if File.exists?("./config/veritrans.yml")
|
|
67
|
-
config_file = "./config/veritrans.yml"
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
raise ArgumentError, "Can not find config at ./config/veritrans.yml or ./veritrans.yml" unless config_file
|
|
71
|
-
|
|
72
|
-
puts "#{green('*')} Load config #{config_file}"
|
|
73
|
-
ENV['RAILS_ENV'] ||= 'development'
|
|
74
|
-
Veritrans.setup.load_yml("#{config_file}##{ENV['RAILS_ENV']}")
|
|
75
|
-
|
|
76
|
-
if !Veritrans.config.client_key || Veritrans.config.client_key == ""
|
|
77
|
-
puts red("Error")
|
|
78
|
-
raise ArgumentError, "Can not find client_key in #{config_file}"
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
if !Veritrans.config.server_key || Veritrans.config.server_key == ""
|
|
82
|
-
puts red("Error")
|
|
83
|
-
raise ArgumentError, "Can not find server_key in #{config_file}"
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
def get_order_info(order_id)
|
|
89
|
-
puts "#{green('*')} Getting order #{order_id}"
|
|
90
|
-
Veritrans.logger = Logger.new("/dev/null")
|
|
91
|
-
response = Veritrans.status(order_id)
|
|
92
|
-
if response.success?
|
|
93
|
-
return response
|
|
94
|
-
else
|
|
95
|
-
puts red("Error")
|
|
96
|
-
|
|
97
|
-
if response.status_code == 401
|
|
98
|
-
raise AuthenticationError, "Can not find order with id=#{order_id} (#{response.status_message})"
|
|
99
|
-
else
|
|
100
|
-
raise OrderNotFound, "Can not find order with id=#{order_id} (#{response.status_message})"
|
|
101
|
-
end
|
|
102
|
-
end
|
|
103
|
-
end
|
|
104
|
-
|
|
105
|
-
def json_data
|
|
106
|
-
data = {
|
|
107
|
-
status_code: "200",
|
|
108
|
-
status_message: "Veritrans payment notification",
|
|
109
|
-
transaction_id: SecureRandom.uuid,
|
|
110
|
-
order_id: "cli-testin-#{rand}",
|
|
111
|
-
payment_type: "credit_card",
|
|
112
|
-
transaction_time: Time.now.strftime("%Y-%m-%d %H:%M:%S"),
|
|
113
|
-
transaction_status: "capture",
|
|
114
|
-
fraud_status: "accept",
|
|
115
|
-
masked_card: "411111-1111",
|
|
116
|
-
gross_amount: "50000.0"
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
if CONFIG[:order]
|
|
120
|
-
load_local_config!
|
|
121
|
-
order_info = get_order_info(CONFIG[:order])
|
|
122
|
-
order_data = hash_except(order_info.data, :status_message, :signature_key)
|
|
123
|
-
data = hash_except(data, :fraud_status, :masked_card).merge(order_data)
|
|
124
|
-
end
|
|
125
|
-
|
|
126
|
-
JSON.pretty_generate(data)
|
|
127
|
-
end
|
|
128
|
-
|
|
129
|
-
def colorize(str, color_code)
|
|
130
|
-
"\e[#{color_code}m#{str}\e[0m"
|
|
131
|
-
end
|
|
132
|
-
|
|
133
|
-
def red(str)
|
|
134
|
-
colorize(str, 31)
|
|
135
|
-
end
|
|
136
|
-
|
|
137
|
-
def green(str)
|
|
138
|
-
colorize(str, 32)
|
|
139
|
-
end
|
|
140
|
-
|
|
141
|
-
def yellow(str)
|
|
142
|
-
colorize(str, 33)
|
|
143
|
-
end
|
|
144
|
-
|
|
145
|
-
def blue(str)
|
|
146
|
-
colorize(str, 34)
|
|
147
|
-
end
|
|
148
|
-
|
|
149
|
-
def pink(str)
|
|
150
|
-
colorize(str, 35)
|
|
151
|
-
end
|
|
152
|
-
def cyan(str); colorize(str, 36) end
|
|
153
|
-
|
|
154
|
-
def hash_except(hash, *except_keys)
|
|
155
|
-
copy = hash.dup
|
|
156
|
-
except_keys.each { |key| copy.delete(key) }
|
|
157
|
-
copy
|
|
158
|
-
end
|
|
159
|
-
|
|
160
|
-
end
|
|
161
|
-
end
|
data/lib/veritrans/testing.rb
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
require 'excon'
|
|
2
|
-
require 'json'
|
|
3
|
-
require 'uri'
|
|
4
|
-
|
|
5
|
-
# Client for Midtrans Testing API and some helper methods for SNAP API
|
|
6
|
-
#
|
|
7
|
-
# Status: still in development
|
|
8
|
-
#
|
|
9
|
-
class Veritrans::TestingLib
|
|
10
|
-
|
|
11
|
-
def initialize(server_url = "https://simulator.sandbox.midtrans.com")
|
|
12
|
-
@server_url = server_url
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def logger
|
|
16
|
-
@logger || Veritrans.logger
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def logger=(value)
|
|
20
|
-
@logger = value
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def GET(url, options = {})
|
|
24
|
-
logger.info("Veritrans::Testing GET #{url}")
|
|
25
|
-
result = Excon.get(url)
|
|
26
|
-
logger.info("Veritrans::Testing -> #{result.status}\n#{result.body}")
|
|
27
|
-
options[:return_raw] ? result : result_json(result)
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def POST(url, options = {})
|
|
31
|
-
logger.info("Veritrans::Testing POST #{url} #{options[:body]}")
|
|
32
|
-
result = Excon.post(url, options)
|
|
33
|
-
logger.info("Veritrans::Testing -> #{result.status}\n#{result.body}")
|
|
34
|
-
options[:return_raw] ? result : result_json(result)
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def get_permata_va(va_number)
|
|
38
|
-
GET(@server_url + "/api/permata_va/#{va_number}")
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
def pay_permata_va(va_number)
|
|
42
|
-
POST(@server_url + "/api/permata_va/#{va_number}/pay")
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def get_bca_va(va_number)
|
|
46
|
-
GET(@server_url + "/api/bca_va/#{va_number}")
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
def pay_bca_va(va_number)
|
|
50
|
-
POST(@server_url + "/api/bca_va/#{va_number}/pay")
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
def get_klik_bca(merchant_code, user_id)
|
|
54
|
-
GET(@server_url + "/api/klikbca/#{merchant_code}/#{user_id}")
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
def pay_klik_bca(merchant_code, user_id, order_id = nil)
|
|
58
|
-
POST(@server_url + "/api/klikbca/#{merchant_code}/#{user_id}/pay" + (order_id ? "?order_id=#{order_id}" : ''))
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
def get_mandiri_bill(bill_key)
|
|
62
|
-
GET(@server_url + "/api/mandiri_bill/#{bill_key}")
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
def pay_mandiri_bill(bill_key)
|
|
66
|
-
POST(@server_url + "/api/mandiri_bill/#{bill_key}/pay")
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
def get_indomaret(payment_code)
|
|
70
|
-
GET(@server_url + "/api/indomaret/#{payment_code}")
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
def pay_indomaret(payment_code)
|
|
74
|
-
POST(@server_url + "/api/indomaret/#{payment_code}/pay")
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
def get_cimb_clicks(redirect_url)
|
|
78
|
-
gateway_result = GET(redirect_url, return_raw: true)
|
|
79
|
-
|
|
80
|
-
form_result = extract_form(gateway_result.body)
|
|
81
|
-
|
|
82
|
-
POST(form_result[:url].sub("cimb/clicks/index", "api/cimb/inquiry"),
|
|
83
|
-
body: URI.encode_www_form(form_result[:fields].to_a),
|
|
84
|
-
headers: {'Content-Type' => 'application/x-www-form-urlencoded'}
|
|
85
|
-
)
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
def pay_cimb_clicks(redirect_url, user_id = "testuser00")
|
|
89
|
-
gateway_result = GET(redirect_url, return_raw: true)
|
|
90
|
-
|
|
91
|
-
form_result = extract_form(gateway_result.body)
|
|
92
|
-
|
|
93
|
-
form_result[:fields]["AccountId"] = user_id
|
|
94
|
-
|
|
95
|
-
result = POST(form_result[:url].sub("cimb/clicks/index", "api/cimb/pay"),
|
|
96
|
-
body: URI.encode_www_form(form_result[:fields].to_a),
|
|
97
|
-
headers: {'Content-Type' => 'application/x-www-form-urlencoded'}
|
|
98
|
-
)
|
|
99
|
-
|
|
100
|
-
result2 = POST(result['redirect_url'],
|
|
101
|
-
body: URI.encode_www_form(result['redirect_params'].to_a),
|
|
102
|
-
headers: {'Content-Type' => 'application/x-www-form-urlencoded'},
|
|
103
|
-
return_raw: true
|
|
104
|
-
)
|
|
105
|
-
|
|
106
|
-
result
|
|
107
|
-
end
|
|
108
|
-
|
|
109
|
-
# experimental
|
|
110
|
-
def pay_snap(snap_token, payment_type, transaction_params = {})
|
|
111
|
-
#snap_data = GET("https://app.sandbox.veritrans.co.id/snap/v1/payment_pages/#{snap_token}")
|
|
112
|
-
#snap_data = GET("https://app.sandbox.midtrans.com/snap/v1/transactions/#{snap_token}")
|
|
113
|
-
|
|
114
|
-
result = POST("https://app.sandbox.midtrans.com/snap/v1/transactions/#{snap_token}/pay",
|
|
115
|
-
body: JSON.pretty_generate({
|
|
116
|
-
payment_type: payment_type
|
|
117
|
-
}.merge(transaction_params)),
|
|
118
|
-
headers: json_headers
|
|
119
|
-
)
|
|
120
|
-
|
|
121
|
-
result
|
|
122
|
-
end
|
|
123
|
-
|
|
124
|
-
def extract_form(html)
|
|
125
|
-
form_html = html.match(/(<form.+<\/form>)/m)[1]
|
|
126
|
-
form_url = form_html.match(/action="(.+?)"/)[1]
|
|
127
|
-
form_method = form_html.match(/method="(.+?)"/)[1]
|
|
128
|
-
fields = {}
|
|
129
|
-
form_html.gsub(/<input(.+?)>/) do |token|
|
|
130
|
-
key = (token.match(/name="(.+?)"/) || [])[1]
|
|
131
|
-
value = (token.match(/value="(.+?)"/) || [])[1]
|
|
132
|
-
fields[key] = value
|
|
133
|
-
end
|
|
134
|
-
|
|
135
|
-
return {
|
|
136
|
-
method: form_method,
|
|
137
|
-
url: form_url,
|
|
138
|
-
fields: fields
|
|
139
|
-
}
|
|
140
|
-
end
|
|
141
|
-
|
|
142
|
-
def result_json(result) # :nodoc:
|
|
143
|
-
JSON.parse(result.body)
|
|
144
|
-
end
|
|
145
|
-
|
|
146
|
-
def json_headers # :nodoc:
|
|
147
|
-
{
|
|
148
|
-
'Content-Type' => 'application/json;charset=UTF-8',
|
|
149
|
-
'Accept' => 'application/json, text/plain, */*'
|
|
150
|
-
}
|
|
151
|
-
end
|
|
152
|
-
end
|
|
153
|
-
|
|
154
|
-
class Veritrans
|
|
155
|
-
Testing = Veritrans::TestingLib.new
|
|
156
|
-
end
|
data/spec/cli_spec.rb
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
describe Veritrans do
|
|
2
|
-
include ActiveSupport::Testing::Stream
|
|
3
|
-
|
|
4
|
-
before do
|
|
5
|
-
stub_const("CONFIG", {})
|
|
6
|
-
|
|
7
|
-
stub_request(:any, /.*example.*/).to_return(lambda { |req|
|
|
8
|
-
@request = req
|
|
9
|
-
{body: "ok", status: 200}
|
|
10
|
-
})
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
it "should send json" do
|
|
14
|
-
silence_stream(STDOUT) do
|
|
15
|
-
Veritrans::CLI.test_webhook(["http://example.com"])
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
data = ActiveSupport::JSON.decode(@request.body)
|
|
19
|
-
|
|
20
|
-
data["status_code"].should == "200"
|
|
21
|
-
data["status_message"].should == "Veritrans payment notification"
|
|
22
|
-
data["payment_type"].should == "credit_card"
|
|
23
|
-
|
|
24
|
-
@request.headers["Content-Type"].should == "application/json"
|
|
25
|
-
@request.headers["User-Agent"].should == "Veritrans gem #{Veritrans::VERSION} - webhook tester"
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
it "should raise error if payment not found" do
|
|
29
|
-
CONFIG[:order] = "1111-not-exists"
|
|
30
|
-
CONFIG[:config_path] = "./example/sinatra/veritrans.yml"
|
|
31
|
-
|
|
32
|
-
VCR.use_cassette("cli_test_not_exists") do
|
|
33
|
-
silence_stream(STDOUT) do
|
|
34
|
-
expect {
|
|
35
|
-
Veritrans::CLI.test_webhook(["http://example.com"])
|
|
36
|
-
}.to raise_error(Veritrans::CLI::OrderNotFound)
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
it "should raise error if can't find config" do
|
|
42
|
-
CONFIG[:order] = "1111-not-exists"
|
|
43
|
-
CONFIG[:config_path] = "./wrong/folder/veritrans.yml"
|
|
44
|
-
|
|
45
|
-
silence_stream(STDOUT) do
|
|
46
|
-
expect {
|
|
47
|
-
Veritrans::CLI.test_webhook(["http://example.com"])
|
|
48
|
-
}.to raise_error(ArgumentError, /Can not find config at .+/)
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
it "should raise error if authentication failed" do
|
|
53
|
-
CONFIG[:order] = "1111-not-exists"
|
|
54
|
-
CONFIG[:config_path] = "./spec/configs/veritrans.yml"
|
|
55
|
-
|
|
56
|
-
VCR.use_cassette("cli_test_unauthorized") do
|
|
57
|
-
silence_stream(STDOUT) do
|
|
58
|
-
expect {
|
|
59
|
-
Veritrans::CLI.test_webhook(["http://example.com"])
|
|
60
|
-
}.to raise_error(Veritrans::CLI::AuthenticationError, /Access denied due to unauthorized transaction/)
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
it "should send real data as json" do
|
|
66
|
-
CONFIG[:order] = "testing-0.2703-1415600236"
|
|
67
|
-
CONFIG[:config_path] = "./example/sinatra/veritrans.yml"
|
|
68
|
-
|
|
69
|
-
VCR.use_cassette("cli_test_real_txn") do
|
|
70
|
-
silence_stream(STDOUT) do
|
|
71
|
-
Veritrans::CLI.test_webhook(["http://example.com"])
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
data = ActiveSupport::JSON.decode(@request.body)
|
|
76
|
-
|
|
77
|
-
data["status_code"].should == "200"
|
|
78
|
-
data["status_message"].should == "Veritrans payment notification"
|
|
79
|
-
data["payment_type"].should == "credit_card"
|
|
80
|
-
data["transaction_status"].should == "settlement"
|
|
81
|
-
data["approval_code"].should == "1415600254322"
|
|
82
|
-
end
|
|
83
|
-
end
|
data/spec/configs/real_key.yml
DELETED
data/spec/configs/veritrans.yml
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
http_interactions:
|
|
3
|
-
- request:
|
|
4
|
-
method: post
|
|
5
|
-
uri: https://api.sandbox.midtrans.com/v2/not-exists/cancel
|
|
6
|
-
body:
|
|
7
|
-
encoding: UTF-8
|
|
8
|
-
string: "{}"
|
|
9
|
-
headers:
|
|
10
|
-
User-Agent:
|
|
11
|
-
- Veritrans ruby gem 2.0.0beta
|
|
12
|
-
Authorization:
|
|
13
|
-
- Basic VlQtc2VydmVyLTlIdGItUnhYa2c3LTdoem5TQ0NqeHZvWTo=
|
|
14
|
-
Accept:
|
|
15
|
-
- application/json
|
|
16
|
-
Content-Type:
|
|
17
|
-
- application/json
|
|
18
|
-
response:
|
|
19
|
-
status:
|
|
20
|
-
code: 200
|
|
21
|
-
message: ''
|
|
22
|
-
headers:
|
|
23
|
-
Server:
|
|
24
|
-
- nginx/1.5.13
|
|
25
|
-
Date:
|
|
26
|
-
- Tue, 04 Nov 2014 14:21:46 GMT
|
|
27
|
-
Content-Type:
|
|
28
|
-
- application/json
|
|
29
|
-
Content-Length:
|
|
30
|
-
- '87'
|
|
31
|
-
Connection:
|
|
32
|
-
- keep-alive
|
|
33
|
-
Cache-Control:
|
|
34
|
-
- no-cache
|
|
35
|
-
Pragma:
|
|
36
|
-
- no-cache
|
|
37
|
-
Expires:
|
|
38
|
-
- Wed, 31 Dec 1969 17:00:00 GMT
|
|
39
|
-
body:
|
|
40
|
-
encoding: UTF-8
|
|
41
|
-
string: |-
|
|
42
|
-
{
|
|
43
|
-
"status_code" : "404",
|
|
44
|
-
"status_message" : "The requested resource is not found"
|
|
45
|
-
}
|
|
46
|
-
http_version:
|
|
47
|
-
recorded_at: Tue, 04 Nov 2014 14:20:14 GMT
|
|
48
|
-
recorded_with: VCR 2.9.3
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
http_interactions:
|
|
3
|
-
- request:
|
|
4
|
-
method: post
|
|
5
|
-
uri: https://api.sandbox.midtrans.com/v2/not-exists/cancel
|
|
6
|
-
body:
|
|
7
|
-
encoding: UTF-8
|
|
8
|
-
string: "{}"
|
|
9
|
-
headers:
|
|
10
|
-
User-Agent:
|
|
11
|
-
- Veritrans ruby gem 2.3.0
|
|
12
|
-
Authorization:
|
|
13
|
-
- Basic VlQtc2VydmVyLTlIdGItUnhYa2c3LTdoem5TQ0NqeHZvWTo=
|
|
14
|
-
Accept:
|
|
15
|
-
- application/json
|
|
16
|
-
Content-Type:
|
|
17
|
-
- application/json
|
|
18
|
-
response:
|
|
19
|
-
status:
|
|
20
|
-
code: 200
|
|
21
|
-
message: OK
|
|
22
|
-
headers:
|
|
23
|
-
Date:
|
|
24
|
-
- Wed, 03 Apr 2019 18:44:32 GMT
|
|
25
|
-
Content-Type:
|
|
26
|
-
- application/json
|
|
27
|
-
Content-Length:
|
|
28
|
-
- '111'
|
|
29
|
-
Connection:
|
|
30
|
-
- keep-alive
|
|
31
|
-
Pragma:
|
|
32
|
-
- no-cache
|
|
33
|
-
Cache-Control:
|
|
34
|
-
- no-cache
|
|
35
|
-
X-Kong-Upstream-Latency:
|
|
36
|
-
- '19'
|
|
37
|
-
X-Kong-Proxy-Latency:
|
|
38
|
-
- '94'
|
|
39
|
-
Via:
|
|
40
|
-
- kong/0.14.0
|
|
41
|
-
Strict-Transport-Security:
|
|
42
|
-
- max-age=15724800; includeSubDomains;
|
|
43
|
-
body:
|
|
44
|
-
encoding: ASCII-8BIT
|
|
45
|
-
string: '{"status_code":"404","status_message":"Transaction doesn''t exist.","id":"37bb81e3-341f-4730-aaa6-8e985343fbb3"}'
|
|
46
|
-
http_version:
|
|
47
|
-
recorded_at: Wed, 03 Apr 2019 18:44:32 GMT
|
|
48
|
-
recorded_with: VCR 4.0.0
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
http_interactions:
|
|
3
|
-
- request:
|
|
4
|
-
method: post
|
|
5
|
-
uri: https://api.sandbox.midtrans.com/v2/charge
|
|
6
|
-
body:
|
|
7
|
-
encoding: UTF-8
|
|
8
|
-
string: '{"payment_type":"permata","transaction_details":{"order_id":1554317097,"gross_amount":100000}}'
|
|
9
|
-
headers:
|
|
10
|
-
User-Agent:
|
|
11
|
-
- Veritrans ruby gem 2.3.0
|
|
12
|
-
Authorization:
|
|
13
|
-
- Basic VlQtc2VydmVyLTlIdGItUnhYa2c3LTdoem5TQ0NqeHZvWTo=
|
|
14
|
-
Accept:
|
|
15
|
-
- application/json
|
|
16
|
-
Content-Type:
|
|
17
|
-
- application/json
|
|
18
|
-
response:
|
|
19
|
-
status:
|
|
20
|
-
code: 200
|
|
21
|
-
message: OK
|
|
22
|
-
headers:
|
|
23
|
-
Date:
|
|
24
|
-
- Wed, 03 Apr 2019 18:44:57 GMT
|
|
25
|
-
Content-Type:
|
|
26
|
-
- application/json
|
|
27
|
-
Content-Length:
|
|
28
|
-
- '432'
|
|
29
|
-
Connection:
|
|
30
|
-
- keep-alive
|
|
31
|
-
Vary:
|
|
32
|
-
- Accept-Encoding
|
|
33
|
-
Cache-Control:
|
|
34
|
-
- no-cache
|
|
35
|
-
Pragma:
|
|
36
|
-
- no-cache
|
|
37
|
-
Expires:
|
|
38
|
-
- Wed, 31 Dec 1969 17:00:00 GMT
|
|
39
|
-
X-Kong-Upstream-Latency:
|
|
40
|
-
- '200'
|
|
41
|
-
X-Kong-Proxy-Latency:
|
|
42
|
-
- '0'
|
|
43
|
-
Via:
|
|
44
|
-
- kong/0.14.0
|
|
45
|
-
Strict-Transport-Security:
|
|
46
|
-
- max-age=15724800; includeSubDomains;
|
|
47
|
-
body:
|
|
48
|
-
encoding: ASCII-8BIT
|
|
49
|
-
string: |-
|
|
50
|
-
{
|
|
51
|
-
"status_code" : "201",
|
|
52
|
-
"status_message" : "Success, PERMATA VA transaction is successful",
|
|
53
|
-
"transaction_id" : "f162dd28-c6a2-4357-a2ff-b942ba33d01e",
|
|
54
|
-
"order_id" : "1554317097",
|
|
55
|
-
"gross_amount" : "100000.00",
|
|
56
|
-
"currency" : "IDR",
|
|
57
|
-
"payment_type" : "bank_transfer",
|
|
58
|
-
"transaction_time" : "2019-04-04 01:44:57",
|
|
59
|
-
"transaction_status" : "pending",
|
|
60
|
-
"fraud_status" : "accept",
|
|
61
|
-
"permata_va_number" : "8778008906093609"
|
|
62
|
-
}
|
|
63
|
-
http_version:
|
|
64
|
-
recorded_at: Wed, 03 Apr 2019 18:44:57 GMT
|
|
65
|
-
- request:
|
|
66
|
-
method: post
|
|
67
|
-
uri: https://api.sandbox.midtrans.com/v2/1554317097/cancel
|
|
68
|
-
body:
|
|
69
|
-
encoding: UTF-8
|
|
70
|
-
string: "{}"
|
|
71
|
-
headers:
|
|
72
|
-
User-Agent:
|
|
73
|
-
- Veritrans ruby gem 2.3.0
|
|
74
|
-
Authorization:
|
|
75
|
-
- Basic VlQtc2VydmVyLTlIdGItUnhYa2c3LTdoem5TQ0NqeHZvWTo=
|
|
76
|
-
Accept:
|
|
77
|
-
- application/json
|
|
78
|
-
Content-Type:
|
|
79
|
-
- application/json
|
|
80
|
-
response:
|
|
81
|
-
status:
|
|
82
|
-
code: 200
|
|
83
|
-
message: OK
|
|
84
|
-
headers:
|
|
85
|
-
Date:
|
|
86
|
-
- Wed, 03 Apr 2019 18:44:58 GMT
|
|
87
|
-
Content-Type:
|
|
88
|
-
- application/json
|
|
89
|
-
Content-Length:
|
|
90
|
-
- '374'
|
|
91
|
-
Connection:
|
|
92
|
-
- keep-alive
|
|
93
|
-
Vary:
|
|
94
|
-
- Accept-Encoding
|
|
95
|
-
Cache-Control:
|
|
96
|
-
- no-cache
|
|
97
|
-
Pragma:
|
|
98
|
-
- no-cache
|
|
99
|
-
Expires:
|
|
100
|
-
- Wed, 31 Dec 1969 17:00:00 GMT
|
|
101
|
-
X-Kong-Upstream-Latency:
|
|
102
|
-
- '56'
|
|
103
|
-
X-Kong-Proxy-Latency:
|
|
104
|
-
- '87'
|
|
105
|
-
Via:
|
|
106
|
-
- kong/0.14.0
|
|
107
|
-
Strict-Transport-Security:
|
|
108
|
-
- max-age=15724800; includeSubDomains;
|
|
109
|
-
body:
|
|
110
|
-
encoding: ASCII-8BIT
|
|
111
|
-
string: |-
|
|
112
|
-
{
|
|
113
|
-
"status_code" : "200",
|
|
114
|
-
"status_message" : "Success, transaction is canceled",
|
|
115
|
-
"transaction_id" : "f162dd28-c6a2-4357-a2ff-b942ba33d01e",
|
|
116
|
-
"order_id" : "1554317097",
|
|
117
|
-
"gross_amount" : "100000.00",
|
|
118
|
-
"currency" : "IDR",
|
|
119
|
-
"payment_type" : "bank_transfer",
|
|
120
|
-
"transaction_time" : "2019-04-04 01:44:57",
|
|
121
|
-
"transaction_status" : "cancel",
|
|
122
|
-
"fraud_status" : "accept"
|
|
123
|
-
}
|
|
124
|
-
http_version:
|
|
125
|
-
recorded_at: Wed, 03 Apr 2019 18:44:58 GMT
|
|
126
|
-
recorded_with: VCR 4.0.0
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
http_interactions:
|
|
3
|
-
- request:
|
|
4
|
-
method: post
|
|
5
|
-
uri: https://api.sandbox.midtrans.com/v2/capture
|
|
6
|
-
body:
|
|
7
|
-
encoding: UTF-8
|
|
8
|
-
string: '{"transaction_id":"not-exists","gross_amount":1000}'
|
|
9
|
-
headers:
|
|
10
|
-
User-Agent:
|
|
11
|
-
- Veritrans ruby gem 2.0.0beta
|
|
12
|
-
Authorization:
|
|
13
|
-
- Basic VlQtc2VydmVyLTlIdGItUnhYa2c3LTdoem5TQ0NqeHZvWTo=
|
|
14
|
-
Accept:
|
|
15
|
-
- application/json
|
|
16
|
-
Content-Type:
|
|
17
|
-
- application/json
|
|
18
|
-
response:
|
|
19
|
-
status:
|
|
20
|
-
code: 200
|
|
21
|
-
message: ''
|
|
22
|
-
headers:
|
|
23
|
-
Server:
|
|
24
|
-
- nginx/1.5.13
|
|
25
|
-
Date:
|
|
26
|
-
- Tue, 04 Nov 2014 14:23:44 GMT
|
|
27
|
-
Content-Type:
|
|
28
|
-
- application/json
|
|
29
|
-
Content-Length:
|
|
30
|
-
- '87'
|
|
31
|
-
Connection:
|
|
32
|
-
- keep-alive
|
|
33
|
-
Cache-Control:
|
|
34
|
-
- no-cache
|
|
35
|
-
Pragma:
|
|
36
|
-
- no-cache
|
|
37
|
-
Expires:
|
|
38
|
-
- Wed, 31 Dec 1969 17:00:00 GMT
|
|
39
|
-
body:
|
|
40
|
-
encoding: UTF-8
|
|
41
|
-
string: |-
|
|
42
|
-
{
|
|
43
|
-
"status_code" : "404",
|
|
44
|
-
"status_message" : "The requested resource is not found"
|
|
45
|
-
}
|
|
46
|
-
http_version:
|
|
47
|
-
recorded_at: Tue, 04 Nov 2014 14:22:12 GMT
|
|
48
|
-
recorded_with: VCR 2.9.3
|