veritrans 2.1.3 → 2.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +10 -1
- data/.idea/.gitignore +8 -0
- data/.rubocop.yml +35 -0
- data/.travis.yml +10 -5
- data/CHANGELOG.md +45 -0
- data/Gemfile +4 -7
- data/Gemfile.lock +24 -163
- data/Maintaining.md +17 -0
- data/README.md +350 -219
- data/api_reference.md +534 -143
- 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 +6 -0
- data/example/sinatra/index.erb +202 -0
- data/example/sinatra/response.erb +1 -0
- 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/example/subscription/credit_card_subscription_example.rb +138 -0
- data/example/subscription/gopay_subscription_example.rb +153 -0
- data/example/subscription/readme.md +4 -0
- data/example/tokenization/gopay_tokenization_example.rb +144 -0
- data/example/tokenization/readme.md +4 -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 +144 -20
- data/lib/veritrans/client.rb +48 -12
- data/lib/veritrans/config.rb +31 -6
- data/lib/veritrans/events.rb +46 -35
- data/lib/veritrans/midtrans_error.rb +15 -0
- data/lib/veritrans/result.rb +63 -2
- data/lib/veritrans/version.rb +1 -1
- data/lib/veritrans.rb +121 -12
- data/veritrans.gemspec +2 -9
- metadata +35 -146
- data/.rspec +0 -2
- data/Procfile +0 -1
- data/Rakefile +0 -16
- data/bin/midtrans +0 -3
- data/bin/veritrans +0 -68
- data/example/README.md +0 -8
- data/example/config.ru +0 -6
- data/example/index.erb +0 -213
- data/example/localization.erb +0 -248
- data/example/points.erb +0 -187
- data/example/recurring.erb +0 -201
- data/example/response.erb +0 -37
- data/example/sinatra.rb +0 -188
- data/example/style.css +0 -126
- data/example/veritrans.yml +0 -11
- data/example/widget.erb +0 -51
- data/lib/generators/templates/assets/credit_card_form.js +0 -51
- 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 -155
- data/lib/veritrans/core_extensions.rb +0 -32
- 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 -106
- 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/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/status_fail.yml +0 -46
- data/spec/fixtures/status_success.yml +0 -109
- data/spec/midtrans_rename_spec.rb +0 -27
- data/spec/rails_plugin_spec.rb +0 -281
- data/spec/spec_helper.rb +0 -61
- data/spec/veritrans_client_spec.rb +0 -184
- 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 -39
- data/testing_webhooks.md +0 -78
@@ -1,45 +0,0 @@
|
|
1
|
-
class Veritrans
|
2
|
-
class PaymentFormGenerator < ::Rails::Generators::Base
|
3
|
-
source_root File.expand_path("../../templates", __FILE__)
|
4
|
-
|
5
|
-
desc %{
|
6
|
-
Description:
|
7
|
-
Copies Veritrans payment form example to your rails application.
|
8
|
-
}
|
9
|
-
|
10
|
-
def copy_shared_views
|
11
|
-
copy_file "views/_veritrans_include.erb", "app/views/shared/_veritrans_include.erb"
|
12
|
-
copy_file "views/_credit_card_form.erb", "app/views/shared/_credit_card_form.erb"
|
13
|
-
end
|
14
|
-
|
15
|
-
def copy_controller
|
16
|
-
copy_file "payments_controller.rb", "app/controllers/payments_controller.rb"
|
17
|
-
|
18
|
-
route "resources :payments do\n" +
|
19
|
-
" collection do\n" +
|
20
|
-
" post :receive_webhook\n" +
|
21
|
-
" end\n" +
|
22
|
-
" end"
|
23
|
-
|
24
|
-
copy_file "views/payments/new.erb", "app/views/payments/new.erb"
|
25
|
-
copy_file "views/payments/create.erb", "app/views/payments/create.erb"
|
26
|
-
end
|
27
|
-
|
28
|
-
def append_javascript_file
|
29
|
-
copy_file "assets/credit_card_form.js", "app/assets/javascripts/credit_card_form.js"
|
30
|
-
insert_into_file "app/assets/javascripts/application.js", :after => %r{//= require +['"]?jquery['"]?$} do
|
31
|
-
"\n//= require credit_card_form"
|
32
|
-
end
|
33
|
-
|
34
|
-
say_status "", %{
|
35
|
-
|
36
|
-
Sample form installed in you app!
|
37
|
-
It contains example for VT-Web and VT-Direct
|
38
|
-
|
39
|
-
Now open http://localhost:3000/payments/new
|
40
|
-
|
41
|
-
}
|
42
|
-
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
data/lib/veritrans/cli.rb
DELETED
@@ -1,155 +0,0 @@
|
|
1
|
-
require 'json'
|
2
|
-
require 'securerandom'
|
3
|
-
require 'logger'
|
4
|
-
|
5
|
-
class Veritrans
|
6
|
-
module CLI
|
7
|
-
# can't find order
|
8
|
-
class OrderNotFound < Exception; end
|
9
|
-
class AuthenticationError < Exception; end
|
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 = order_info.data.except(:status_message, :signature_key)
|
123
|
-
data = data.except(: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
|
-
end
|
155
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# This is replacement for Hash#deep_merge in acive_support
|
2
|
-
# when acive_support not loaded
|
3
|
-
|
4
|
-
class Hash #:nodoc:
|
5
|
-
|
6
|
-
unless method_defined?(:deep_merge)
|
7
|
-
def deep_merge(second)
|
8
|
-
merger = proc { |key, v1, v2|
|
9
|
-
if Hash === v1 && Hash === v2
|
10
|
-
v1.merge(v2, &merger)
|
11
|
-
else
|
12
|
-
[:undefined, nil, :nil].include?(v2) ? v1 : v2
|
13
|
-
end
|
14
|
-
}
|
15
|
-
self.merge(second, &merger)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
unless method_defined?(:except!)
|
20
|
-
def except!(*keys)
|
21
|
-
keys.each { |key| delete(key) }
|
22
|
-
self
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
unless method_defined?(:except)
|
27
|
-
def except(*keys)
|
28
|
-
dup.except!(*keys)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
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/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/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.veritrans.co.id/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.veritrans.co.id/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:18:37 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:17:06 GMT
|
48
|
-
recorded_with: VCR 2.9.3
|
@@ -1,106 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: post
|
5
|
-
uri: https://api.sandbox.veritrans.co.id/v2/charge
|
6
|
-
body:
|
7
|
-
encoding: UTF-8
|
8
|
-
string: '{"payment_type":"permata","transaction_details":{"order_id":1415110696,"gross_amount":100000}}'
|
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:19:48 GMT
|
27
|
-
Content-Type:
|
28
|
-
- application/json
|
29
|
-
Content-Length:
|
30
|
-
- '381'
|
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" : "201",
|
44
|
-
"status_message" : "Success, PERMATA VA transaction is successful",
|
45
|
-
"transaction_id" : "d8757b8a-b97e-4881-9f55-69f6db6f4006",
|
46
|
-
"order_id" : "1415110696",
|
47
|
-
"payment_type" : "bank_transfer",
|
48
|
-
"transaction_time" : "2014-11-04 21:20:07",
|
49
|
-
"transaction_status" : "pending",
|
50
|
-
"permata_va_number" : "8778990000000023",
|
51
|
-
"gross_amount" : "100000.00"
|
52
|
-
}
|
53
|
-
http_version:
|
54
|
-
recorded_at: Tue, 04 Nov 2014 14:18:17 GMT
|
55
|
-
- request:
|
56
|
-
method: post
|
57
|
-
uri: https://api.sandbox.veritrans.co.id/v2/1415110696/cancel
|
58
|
-
body:
|
59
|
-
encoding: UTF-8
|
60
|
-
string: "{}"
|
61
|
-
headers:
|
62
|
-
User-Agent:
|
63
|
-
- Veritrans ruby gem 2.0.0beta
|
64
|
-
Authorization:
|
65
|
-
- Basic VlQtc2VydmVyLTlIdGItUnhYa2c3LTdoem5TQ0NqeHZvWTo=
|
66
|
-
Accept:
|
67
|
-
- application/json
|
68
|
-
Content-Type:
|
69
|
-
- application/json
|
70
|
-
response:
|
71
|
-
status:
|
72
|
-
code: 200
|
73
|
-
message: ''
|
74
|
-
headers:
|
75
|
-
Server:
|
76
|
-
- nginx/1.5.13
|
77
|
-
Date:
|
78
|
-
- Tue, 04 Nov 2014 14:19:48 GMT
|
79
|
-
Content-Type:
|
80
|
-
- application/json
|
81
|
-
Content-Length:
|
82
|
-
- '323'
|
83
|
-
Connection:
|
84
|
-
- keep-alive
|
85
|
-
Cache-Control:
|
86
|
-
- no-cache
|
87
|
-
Pragma:
|
88
|
-
- no-cache
|
89
|
-
Expires:
|
90
|
-
- Wed, 31 Dec 1969 17:00:00 GMT
|
91
|
-
body:
|
92
|
-
encoding: UTF-8
|
93
|
-
string: |-
|
94
|
-
{
|
95
|
-
"status_code" : "200",
|
96
|
-
"status_message" : "Success, transaction is canceled",
|
97
|
-
"transaction_id" : "d8757b8a-b97e-4881-9f55-69f6db6f4006",
|
98
|
-
"order_id" : "1415110696",
|
99
|
-
"payment_type" : "bank_transfer",
|
100
|
-
"transaction_time" : "2014-11-04 21:20:07",
|
101
|
-
"transaction_status" : "cancel",
|
102
|
-
"gross_amount" : "100000.00"
|
103
|
-
}
|
104
|
-
http_version:
|
105
|
-
recorded_at: Tue, 04 Nov 2014 14:18:17 GMT
|
106
|
-
recorded_with: VCR 2.9.3
|
@@ -1,48 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: post
|
5
|
-
uri: https://api.sandbox.veritrans.co.id/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
|
data/spec/fixtures/charge.yml
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: post
|
5
|
-
uri: https://api.sandbox.veritrans.co.id/v2/charge
|
6
|
-
body:
|
7
|
-
encoding: UTF-8
|
8
|
-
string: '{"payment_type":"VTWEB","transaction_details":{"order_id":"2014-11-04
|
9
|
-
20:58:14 +0700","gross_amount":100000}}'
|
10
|
-
headers:
|
11
|
-
User-Agent:
|
12
|
-
- excon/0.40.0
|
13
|
-
Authorization:
|
14
|
-
- Basic VlQtc2VydmVyLTlIdGItUnhYa2c3LTdoem5TQ0NqeHZvWTo=
|
15
|
-
Accept:
|
16
|
-
- application/json
|
17
|
-
Content-Type:
|
18
|
-
- application/json
|
19
|
-
response:
|
20
|
-
status:
|
21
|
-
code: 200
|
22
|
-
message: ''
|
23
|
-
headers:
|
24
|
-
Server:
|
25
|
-
- nginx/1.5.13
|
26
|
-
Date:
|
27
|
-
- Tue, 04 Nov 2014 13:59:46 GMT
|
28
|
-
Content-Type:
|
29
|
-
- application/json
|
30
|
-
Content-Length:
|
31
|
-
- '217'
|
32
|
-
Connection:
|
33
|
-
- keep-alive
|
34
|
-
Cache-Control:
|
35
|
-
- no-cache
|
36
|
-
Pragma:
|
37
|
-
- no-cache
|
38
|
-
Expires:
|
39
|
-
- Wed, 31 Dec 1969 17:00:00 GMT
|
40
|
-
body:
|
41
|
-
encoding: UTF-8
|
42
|
-
string: |-
|
43
|
-
{
|
44
|
-
"status_code" : "201",
|
45
|
-
"status_message" : "OK, success do VTWeb transaction, please go to redirect_url",
|
46
|
-
"redirect_url" : "https://vtweb.sandbox.veritrans.co.id/v2/vtweb/f523ecff-34e7-4791-a558-3f579f731b75"
|
47
|
-
}
|
48
|
-
http_version:
|
49
|
-
recorded_at: Tue, 04 Nov 2014 13:58:15 GMT
|
50
|
-
recorded_with: VCR 2.9.3
|
@@ -1,56 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: post
|
5
|
-
uri: https://api.sandbox.veritrans.co.id/v2/charge
|
6
|
-
body:
|
7
|
-
encoding: UTF-8
|
8
|
-
string: '{"payment_type":"permata","transaction_details":{"order_id":"2014-11-04
|
9
|
-
21:06:32 +0700","gross_amount":100000}}'
|
10
|
-
headers:
|
11
|
-
User-Agent:
|
12
|
-
- Veritrans ruby gem 2.0.0beta
|
13
|
-
Authorization:
|
14
|
-
- Basic VlQtc2VydmVyLTlIdGItUnhYa2c3LTdoem5TQ0NqeHZvWTo=
|
15
|
-
Accept:
|
16
|
-
- application/json
|
17
|
-
Content-Type:
|
18
|
-
- application/json
|
19
|
-
response:
|
20
|
-
status:
|
21
|
-
code: 200
|
22
|
-
message: ''
|
23
|
-
headers:
|
24
|
-
Server:
|
25
|
-
- nginx/1.5.13
|
26
|
-
Date:
|
27
|
-
- Tue, 04 Nov 2014 14:08:04 GMT
|
28
|
-
Content-Type:
|
29
|
-
- application/json
|
30
|
-
Content-Length:
|
31
|
-
- '396'
|
32
|
-
Connection:
|
33
|
-
- keep-alive
|
34
|
-
Cache-Control:
|
35
|
-
- no-cache
|
36
|
-
Pragma:
|
37
|
-
- no-cache
|
38
|
-
Expires:
|
39
|
-
- Wed, 31 Dec 1969 17:00:00 GMT
|
40
|
-
body:
|
41
|
-
encoding: UTF-8
|
42
|
-
string: |-
|
43
|
-
{
|
44
|
-
"status_code" : "201",
|
45
|
-
"status_message" : "Success, PERMATA VA transaction is successful",
|
46
|
-
"transaction_id" : "3544730a-e5ca-46b6-9512-233c37670500",
|
47
|
-
"order_id" : "2014-11-04 21:06:32 +0700",
|
48
|
-
"payment_type" : "bank_transfer",
|
49
|
-
"transaction_time" : "2014-11-04 21:08:23",
|
50
|
-
"transaction_status" : "pending",
|
51
|
-
"permata_va_number" : "8778990000000019",
|
52
|
-
"gross_amount" : "100000.00"
|
53
|
-
}
|
54
|
-
http_version:
|
55
|
-
recorded_at: Tue, 04 Nov 2014 14:06:33 GMT
|
56
|
-
recorded_with: VCR 2.9.3
|