veritrans 2.2.0 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +35 -0
- data/.travis.yml +11 -5
- data/CHANGELOG.md +12 -0
- data/Gemfile +14 -6
- data/Gemfile.lock +131 -109
- data/README.md +46 -24
- data/api_reference.md +85 -3
- data/lib/generators/templates/payments_controller.rb +1 -1
- data/lib/generators/templates/views/_credit_card_form.erb +1 -1
- data/lib/veritrans.rb +15 -6
- data/lib/veritrans/api.rb +33 -6
- data/lib/veritrans/client.rb +1 -1
- data/lib/veritrans/result.rb +5 -0
- data/lib/veritrans/testing.rb +1 -1
- data/lib/veritrans/version.rb +1 -1
- data/spec/fixtures/cancel_failed.yml +18 -18
- data/spec/fixtures/cancel_success.yml +48 -28
- data/spec/fixtures/deny_failed.yml +144 -0
- data/spec/fixtures/refund_failed.yml +54 -0
- data/spec/fixtures/status_fail.yml +19 -17
- data/spec/fixtures/status_success.yml +51 -32
- data/spec/fixtures/test_token.yml +49 -0
- data/spec/rails_plugin_spec.rb +105 -86
- data/spec/spec_helper.rb +18 -7
- data/spec/veritrans_client_spec.rb +60 -9
- data/spec/veritrans_snap_spec.rb +17 -2
- data/veritrans.gemspec +0 -6
- metadata +7 -79
@@ -0,0 +1,144 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.sandbox.midtrans.com/v2/token?card_cvv=123&card_exp_month=1&card_exp_year=2020&card_number=4811111111111114&client_key=VT-client-NArmatJZqzsmTmzR
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
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 19:45:47 GMT
|
25
|
+
Content-Type:
|
26
|
+
- application/json
|
27
|
+
Content-Length:
|
28
|
+
- '170'
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
Pragma:
|
32
|
+
- no-cache
|
33
|
+
Cache-Control:
|
34
|
+
- no-cache
|
35
|
+
X-Kong-Upstream-Latency:
|
36
|
+
- '71'
|
37
|
+
X-Kong-Proxy-Latency:
|
38
|
+
- '0'
|
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":"200","status_message":"Credit card token is created
|
46
|
+
as Token ID.","token_id":"481111-1114-af98ef7c-4d8e-4216-8027-d657bbaa3bf2","hash":"481111-1114-mami"}'
|
47
|
+
http_version:
|
48
|
+
recorded_at: Mon, 01 Apr 2019 00:00:00 GMT
|
49
|
+
- request:
|
50
|
+
method: post
|
51
|
+
uri: https://api.sandbox.midtrans.com/v2/charge
|
52
|
+
body:
|
53
|
+
encoding: UTF-8
|
54
|
+
string: '{"payment_type":"credit_card","credit_card":{"token_id":"481111-1114-af98ef7c-4d8e-4216-8027-d657bbaa3bf2"},"transaction_details":{"order_id":"1554076800","gross_amount":3000}}'
|
55
|
+
headers:
|
56
|
+
User-Agent:
|
57
|
+
- Veritrans ruby gem 2.3.0
|
58
|
+
Authorization:
|
59
|
+
- Basic VlQtc2VydmVyLTlIdGItUnhYa2c3LTdoem5TQ0NqeHZvWTo=
|
60
|
+
Accept:
|
61
|
+
- application/json
|
62
|
+
Content-Type:
|
63
|
+
- application/json
|
64
|
+
response:
|
65
|
+
status:
|
66
|
+
code: 200
|
67
|
+
message: OK
|
68
|
+
headers:
|
69
|
+
Date:
|
70
|
+
- Wed, 03 Apr 2019 19:45:48 GMT
|
71
|
+
Content-Type:
|
72
|
+
- application/json
|
73
|
+
Content-Length:
|
74
|
+
- '499'
|
75
|
+
Connection:
|
76
|
+
- keep-alive
|
77
|
+
Vary:
|
78
|
+
- Accept-Encoding
|
79
|
+
Pragma:
|
80
|
+
- no-cache
|
81
|
+
Cache-Control:
|
82
|
+
- no-cache
|
83
|
+
X-Kong-Upstream-Latency:
|
84
|
+
- '228'
|
85
|
+
X-Kong-Proxy-Latency:
|
86
|
+
- '1'
|
87
|
+
Via:
|
88
|
+
- kong/0.14.0
|
89
|
+
Strict-Transport-Security:
|
90
|
+
- max-age=15724800; includeSubDomains;
|
91
|
+
body:
|
92
|
+
encoding: ASCII-8BIT
|
93
|
+
string: '{"status_code":"200","status_message":"Success, Credit Card transaction
|
94
|
+
is successful","transaction_id":"af98ef7c-4d8e-4216-8027-d657bbaa3bf2","order_id":"1554076800","gross_amount":"3000.00","currency":"IDR","payment_type":"credit_card","transaction_time":"2019-04-04
|
95
|
+
02:45:47","transaction_status":"capture","fraud_status":"accept","approval_code":"1554320748048","masked_card":"481111-1114","bank":"mandiri","card_type":"credit","channel_response_code":"00","channel_response_message":"Approved"}'
|
96
|
+
http_version:
|
97
|
+
recorded_at: Mon, 01 Apr 2019 00:00:00 GMT
|
98
|
+
- request:
|
99
|
+
method: post
|
100
|
+
uri: https://api.sandbox.midtrans.com/v2/1554076800/deny
|
101
|
+
body:
|
102
|
+
encoding: UTF-8
|
103
|
+
string: "{}"
|
104
|
+
headers:
|
105
|
+
User-Agent:
|
106
|
+
- Veritrans ruby gem 2.3.0
|
107
|
+
Authorization:
|
108
|
+
- Basic VlQtc2VydmVyLTlIdGItUnhYa2c3LTdoem5TQ0NqeHZvWTo=
|
109
|
+
Accept:
|
110
|
+
- application/json
|
111
|
+
Content-Type:
|
112
|
+
- application/json
|
113
|
+
response:
|
114
|
+
status:
|
115
|
+
code: 200
|
116
|
+
message: OK
|
117
|
+
headers:
|
118
|
+
Date:
|
119
|
+
- Wed, 03 Apr 2019 19:45:48 GMT
|
120
|
+
Content-Type:
|
121
|
+
- application/json
|
122
|
+
Content-Length:
|
123
|
+
- '122'
|
124
|
+
Connection:
|
125
|
+
- keep-alive
|
126
|
+
Pragma:
|
127
|
+
- no-cache
|
128
|
+
Cache-Control:
|
129
|
+
- no-cache
|
130
|
+
X-Kong-Upstream-Latency:
|
131
|
+
- '24'
|
132
|
+
X-Kong-Proxy-Latency:
|
133
|
+
- '19'
|
134
|
+
Via:
|
135
|
+
- kong/0.14.0
|
136
|
+
Strict-Transport-Security:
|
137
|
+
- max-age=15724800; includeSubDomains;
|
138
|
+
body:
|
139
|
+
encoding: ASCII-8BIT
|
140
|
+
string: '{"status_code":"412","status_message":"Transaction status cannot be
|
141
|
+
updated.","id":"af98ef7c-4d8e-4216-8027-d657bbaa3bf2"}'
|
142
|
+
http_version:
|
143
|
+
recorded_at: Mon, 01 Apr 2019 00:00:00 GMT
|
144
|
+
recorded_with: VCR 4.0.0
|
@@ -0,0 +1,54 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api.sandbox.midtrans.com/v2/1415110696/refund
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: "{}"
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Veritrans ruby gem 2.2.1
|
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
|
+
- Mon, 01 Apr 2019 04:17:41 GMT
|
25
|
+
Content-Type:
|
26
|
+
- application/json
|
27
|
+
Content-Length:
|
28
|
+
- '104'
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
Cache-Control:
|
32
|
+
- no-cache
|
33
|
+
Pragma:
|
34
|
+
- no-cache
|
35
|
+
Expires:
|
36
|
+
- Wed, 31 Dec 1969 17:00:00 GMT
|
37
|
+
X-Kong-Upstream-Latency:
|
38
|
+
- '38'
|
39
|
+
X-Kong-Proxy-Latency:
|
40
|
+
- '4'
|
41
|
+
Via:
|
42
|
+
- kong/0.14.0
|
43
|
+
Strict-Transport-Security:
|
44
|
+
- max-age=15724800; includeSubDomains;
|
45
|
+
body:
|
46
|
+
encoding: ASCII-8BIT
|
47
|
+
string: |-
|
48
|
+
{
|
49
|
+
"status_code" : "412",
|
50
|
+
"status_message" : "Merchant cannot modify the status of the transaction"
|
51
|
+
}
|
52
|
+
http_version:
|
53
|
+
recorded_at: Mon, 01 Apr 2019 04:17:41 GMT
|
54
|
+
recorded_with: VCR 4.0.0
|
@@ -8,7 +8,7 @@ http_interactions:
|
|
8
8
|
string: ''
|
9
9
|
headers:
|
10
10
|
User-Agent:
|
11
|
-
- Veritrans ruby gem 2.0
|
11
|
+
- Veritrans ruby gem 2.3.0
|
12
12
|
Authorization:
|
13
13
|
- Basic VlQtc2VydmVyLTlIdGItUnhYa2c3LTdoem5TQ0NqeHZvWTo=
|
14
14
|
Accept:
|
@@ -18,29 +18,31 @@ http_interactions:
|
|
18
18
|
response:
|
19
19
|
status:
|
20
20
|
code: 200
|
21
|
-
message:
|
21
|
+
message: OK
|
22
22
|
headers:
|
23
|
-
Server:
|
24
|
-
- nginx/1.5.13
|
25
23
|
Date:
|
26
|
-
-
|
24
|
+
- Wed, 03 Apr 2019 18:42:27 GMT
|
27
25
|
Content-Type:
|
28
26
|
- application/json
|
27
|
+
Content-Length:
|
28
|
+
- '111'
|
29
29
|
Connection:
|
30
30
|
- keep-alive
|
31
|
-
Cache-Control:
|
32
|
-
- no-cache
|
33
31
|
Pragma:
|
34
32
|
- no-cache
|
35
|
-
|
36
|
-
-
|
33
|
+
Cache-Control:
|
34
|
+
- no-cache
|
35
|
+
X-Kong-Upstream-Latency:
|
36
|
+
- '14'
|
37
|
+
X-Kong-Proxy-Latency:
|
38
|
+
- '22'
|
39
|
+
Via:
|
40
|
+
- kong/0.14.0
|
41
|
+
Strict-Transport-Security:
|
42
|
+
- max-age=15724800; includeSubDomains;
|
37
43
|
body:
|
38
|
-
encoding:
|
39
|
-
string:
|
40
|
-
{
|
41
|
-
"status_code" : "404",
|
42
|
-
"status_message" : "The requested resource is not found"
|
43
|
-
}
|
44
|
+
encoding: ASCII-8BIT
|
45
|
+
string: '{"status_code":"404","status_message":"Transaction doesn''t exist.","id":"e12f60bc-fbc7-4fa7-a457-5d822ac61cd5"}'
|
44
46
|
http_version:
|
45
|
-
recorded_at:
|
46
|
-
recorded_with: VCR
|
47
|
+
recorded_at: Wed, 03 Apr 2019 18:42:27 GMT
|
48
|
+
recorded_with: VCR 4.0.0
|
@@ -5,10 +5,10 @@ http_interactions:
|
|
5
5
|
uri: https://api.sandbox.midtrans.com/v2/charge
|
6
6
|
body:
|
7
7
|
encoding: UTF-8
|
8
|
-
string: '{"payment_type":"permata","transaction_details":{"order_id":
|
8
|
+
string: '{"payment_type":"permata","transaction_details":{"order_id":1554320900,"gross_amount":100000}}'
|
9
9
|
headers:
|
10
10
|
User-Agent:
|
11
|
-
- Veritrans ruby gem 2.0
|
11
|
+
- Veritrans ruby gem 2.3.0
|
12
12
|
Authorization:
|
13
13
|
- Basic VlQtc2VydmVyLTlIdGItUnhYa2c3LTdoem5TQ0NqeHZvWTo=
|
14
14
|
Accept:
|
@@ -18,49 +18,59 @@ http_interactions:
|
|
18
18
|
response:
|
19
19
|
status:
|
20
20
|
code: 200
|
21
|
-
message:
|
21
|
+
message: OK
|
22
22
|
headers:
|
23
|
-
Server:
|
24
|
-
- nginx/1.5.13
|
25
23
|
Date:
|
26
|
-
-
|
24
|
+
- Wed, 03 Apr 2019 19:48:20 GMT
|
27
25
|
Content-Type:
|
28
26
|
- application/json
|
29
27
|
Content-Length:
|
30
|
-
- '
|
28
|
+
- '432'
|
31
29
|
Connection:
|
32
30
|
- keep-alive
|
31
|
+
Vary:
|
32
|
+
- Accept-Encoding
|
33
33
|
Cache-Control:
|
34
34
|
- no-cache
|
35
35
|
Pragma:
|
36
36
|
- no-cache
|
37
37
|
Expires:
|
38
38
|
- Wed, 31 Dec 1969 17:00:00 GMT
|
39
|
+
X-Kong-Upstream-Latency:
|
40
|
+
- '202'
|
41
|
+
X-Kong-Proxy-Latency:
|
42
|
+
- '1'
|
43
|
+
Via:
|
44
|
+
- kong/0.14.0
|
45
|
+
Strict-Transport-Security:
|
46
|
+
- max-age=15724800; includeSubDomains;
|
39
47
|
body:
|
40
|
-
encoding:
|
48
|
+
encoding: ASCII-8BIT
|
41
49
|
string: |-
|
42
50
|
{
|
43
51
|
"status_code" : "201",
|
44
52
|
"status_message" : "Success, PERMATA VA transaction is successful",
|
45
|
-
"transaction_id" : "
|
46
|
-
"order_id" : "
|
53
|
+
"transaction_id" : "4991d60f-c8d4-49b6-bfd9-2751681fdcab",
|
54
|
+
"order_id" : "1554320900",
|
55
|
+
"gross_amount" : "100000.00",
|
56
|
+
"currency" : "IDR",
|
47
57
|
"payment_type" : "bank_transfer",
|
48
|
-
"transaction_time" : "
|
58
|
+
"transaction_time" : "2019-04-04 02:48:20",
|
49
59
|
"transaction_status" : "pending",
|
50
|
-
"
|
51
|
-
"
|
60
|
+
"fraud_status" : "accept",
|
61
|
+
"permata_va_number" : "8778001842689488"
|
52
62
|
}
|
53
63
|
http_version:
|
54
|
-
recorded_at:
|
64
|
+
recorded_at: Wed, 03 Apr 2019 19:48:20 GMT
|
55
65
|
- request:
|
56
66
|
method: get
|
57
|
-
uri: https://api.sandbox.midtrans.com/v2/
|
67
|
+
uri: https://api.sandbox.midtrans.com/v2/1554320900/status
|
58
68
|
body:
|
59
69
|
encoding: US-ASCII
|
60
70
|
string: ''
|
61
71
|
headers:
|
62
72
|
User-Agent:
|
63
|
-
- Veritrans ruby gem 2.0
|
73
|
+
- Veritrans ruby gem 2.3.0
|
64
74
|
Authorization:
|
65
75
|
- Basic VlQtc2VydmVyLTlIdGItUnhYa2c3LTdoem5TQ0NqeHZvWTo=
|
66
76
|
Accept:
|
@@ -70,40 +80,49 @@ http_interactions:
|
|
70
80
|
response:
|
71
81
|
status:
|
72
82
|
code: 200
|
73
|
-
message:
|
83
|
+
message: OK
|
74
84
|
headers:
|
75
|
-
Server:
|
76
|
-
- nginx/1.5.13
|
77
85
|
Date:
|
78
|
-
-
|
86
|
+
- Wed, 03 Apr 2019 19:48:21 GMT
|
79
87
|
Content-Type:
|
80
88
|
- application/json
|
81
89
|
Content-Length:
|
82
|
-
- '
|
90
|
+
- '568'
|
83
91
|
Connection:
|
84
92
|
- keep-alive
|
93
|
+
Vary:
|
94
|
+
- Accept-Encoding, Accept-Encoding, User-Agent
|
85
95
|
Cache-Control:
|
86
96
|
- no-cache
|
87
97
|
Pragma:
|
88
98
|
- no-cache
|
89
99
|
Expires:
|
90
100
|
- Wed, 31 Dec 1969 17:00:00 GMT
|
91
|
-
|
92
|
-
-
|
101
|
+
X-Kong-Upstream-Latency:
|
102
|
+
- '45'
|
103
|
+
X-Kong-Proxy-Latency:
|
104
|
+
- '27'
|
105
|
+
Via:
|
106
|
+
- kong/0.14.0
|
107
|
+
Strict-Transport-Security:
|
108
|
+
- max-age=15724800; includeSubDomains;
|
93
109
|
body:
|
94
|
-
encoding:
|
110
|
+
encoding: ASCII-8BIT
|
95
111
|
string: |-
|
96
112
|
{
|
97
113
|
"status_code" : "201",
|
98
|
-
"status_message" : "Success, transaction found",
|
99
|
-
"transaction_id" : "
|
100
|
-
"order_id" : "
|
114
|
+
"status_message" : "Success, transaction is found",
|
115
|
+
"transaction_id" : "4991d60f-c8d4-49b6-bfd9-2751681fdcab",
|
116
|
+
"order_id" : "1554320900",
|
117
|
+
"gross_amount" : "100000.00",
|
118
|
+
"currency" : "IDR",
|
101
119
|
"payment_type" : "bank_transfer",
|
102
|
-
"transaction_time" : "
|
120
|
+
"transaction_time" : "2019-04-04 02:48:20",
|
103
121
|
"transaction_status" : "pending",
|
104
|
-
"
|
105
|
-
"
|
122
|
+
"fraud_status" : "accept",
|
123
|
+
"permata_va_number" : "8778001842689488",
|
124
|
+
"signature_key" : "9b0a7d1b2672b148d869c5b1135603f08cc043ef353602045df299712d1c858415ed2acada1c618a997a5a9e635791ecfda46d7d61a8d6dd13e6d5821a669a75"
|
106
125
|
}
|
107
126
|
http_version:
|
108
|
-
recorded_at:
|
109
|
-
recorded_with: VCR
|
127
|
+
recorded_at: Wed, 03 Apr 2019 19:48:21 GMT
|
128
|
+
recorded_with: VCR 4.0.0
|
@@ -0,0 +1,49 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.sandbox.midtrans.com/v2/token?card_cvv=123&card_exp_month=1&card_exp_year=2020&card_number=4811111111111114&client_key=VT-client-NArmatJZqzsmTmzR
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Veritrans ruby gem 2.2.1
|
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
|
+
- Mon, 01 Apr 2019 04:24:55 GMT
|
25
|
+
Content-Type:
|
26
|
+
- application/json
|
27
|
+
Content-Length:
|
28
|
+
- '170'
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
Pragma:
|
32
|
+
- no-cache
|
33
|
+
Cache-Control:
|
34
|
+
- no-cache
|
35
|
+
X-Kong-Upstream-Latency:
|
36
|
+
- '47'
|
37
|
+
X-Kong-Proxy-Latency:
|
38
|
+
- '1'
|
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":"200","status_message":"Credit card token is created
|
46
|
+
as Token ID.","token_id":"481111-1114-a901971f-2f1b-4781-802a-df326fbf0e9c","hash":"481111-1114-mami"}'
|
47
|
+
http_version:
|
48
|
+
recorded_at: Mon, 01 Apr 2019 04:24:55 GMT
|
49
|
+
recorded_with: VCR 4.0.0
|