Class: TestVeritrans

Inherits:
Minitest::Test
  • Object
show all
Defined in:
lib/test/api_test.rb,
lib/test/snap_test.rb,
lib/test/config_test.rb,
lib/test/transaction_test.rb,
lib/test/subscription_test.rb,
lib/test/gopay_tokenization_test.rb

Instance Method Summary collapse

Instance Method Details

#setupObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/test/api_test.rb', line 6

def setup
  @mt_test = Veritrans.new(
    server_key: "SB-Mid-server-uQmMImQMeo0Ky3Svl90QTUj2",
    client_key: "SB-Mid-client-ArNfhrh7st9bQKmz",
    api_host: "https://api.sandbox.midtrans.com",
    logger: Logger.new(STDOUT),
    file_logger: Logger.new(STDOUT)
  )

  @mt_test_invalid_key = Veritrans.new(
    server_key: "invalid server key",
    client_key: "invalid client key",
    api_host: "https://api.sandbox.midtrans.com",
    logger: Logger.new(STDOUT),
    file_logger: Logger.new(STDOUT)
  )
end

#test_api_hostObject



15
16
17
# File 'lib/test/config_test.rb', line 15

def test_api_host
  assert_equal "https://api.sandbox.midtrans.com", Veritrans.config.api_host
end

#test_approve_transactionObject



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/test/transaction_test.rb', line 93

def test_approve_transaction
  card = {
    card_number: 5510111111111115,
    card_cvv: 123,
    card_exp_month: 12,
    card_exp_year: 2025
  }
  get_token = @mt_test.test_token(card)
  charge = @mt_test.charge(
    {
      "payment_type": "credit_card",
      "transaction_details": {
        "gross_amount": 10000,
        "order_id": "ruby-lib-test-#{Time.now.to_i}"
      },
      "credit_card": {
        "token_id": "#{get_token.token_id}",
        "authentication": "false"
      }
    }
  )
  result = @mt_test.approve(charge.transaction_id)
  assert_equal "Success, transaction is approved", result.status_message
  assert_equal 200, result.status_code
  assert_equal "accept", result.fraud_status
end

#test_cancel_permata_vaObject



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/test/transaction_test.rb', line 35

def test_cancel_permata_va
  charge = @mt_test.charge(
    {
      "payment_type": "bank_transfer",
      "transaction_details": {
        "gross_amount": 10000,
        "order_id": "ruby-lib-test-#{Time.now.to_i}"
      },
      "bank_transfer": {
        "bank": "permata",
        "va_number": "1234567891"
      }
    }
  )
  cancel = @mt_test.cancel(charge.transaction_id)
  assert_equal 200, cancel.status_code
  assert_equal "cancel", cancel.transaction_status
end

#test_charge_akulakuObject



228
229
230
231
232
233
234
235
236
237
238
239
# File 'lib/test/api_test.rb', line 228

def test_charge_akulaku
  result = @mt_test.charge(
    "payment_type": "akulaku",
    "transaction_details": {
      "order_id": "ruby-lib-test-#{Time.now.to_i}",
      "gross_amount": 44000
    }
  )
  assert_equal 201, result.status_code
  assert_equal "Success, Akulaku transaction is created", result.status_message
  assert_equal "pending", result.transaction_status
end

#test_charge_alfamartObject



175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# File 'lib/test/api_test.rb', line 175

def test_charge_alfamart
  result = @mt_test.charge(
    "payment_type": "cstore",
    "transaction_details": {
      "order_id": "ruby-lib-test-alfamart-#{Time.now.to_i}",
      "gross_amount": 44000
    },
    "cstore": {
      "store": "alfamart",
      "alfamart_free_text_1": "1st row of receipt",
      "alfamart_free_text_2": "2nd row",
      "alfamart_free_text_3": "3rd row"
    }
  )
  assert_equal 201, result.status_code
  assert_equal "Success, cstore transaction is successful", result.status_message
  assert_equal "alfamart", result.store
end

#test_charge_bca_vaObject



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/test/api_test.rb', line 61

def test_charge_bca_va
  result = @mt_test.charge(
    {
      "payment_type": "bank_transfer",
      "transaction_details": {
        "gross_amount": 10000,
        "order_id": "ruby-lib-test-bcava#{Time.now.to_i}"
      },
      "bank_transfer": {
        "bank": "bca",
        "va_number": "1234567891"
      }
    }
  )
  assert_equal 201, result.status_code
  assert_equal "Success, Bank Transfer transaction is created", result.status_message
end

#test_charge_bcaklikpayObject



211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# File 'lib/test/api_test.rb', line 211

def test_charge_bcaklikpay
  result = @mt_test.charge(
    "payment_type": "bca_klikpay",
    "transaction_details": {
      "order_id": "ruby-lib-test-bcaklikpay-#{Time.now.to_i}",
      "gross_amount": 44000
    },
    "bca_klikpay": {
      "type": "1",
      "description": "pembelian produk"
    }
  )
  assert_equal 201, result.status_code
  assert_equal "OK, BCA KlikPay transaction is successful", result.status_message
  assert_equal "pending", result.transaction_status
end

#test_charge_bni_vaObject



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/test/api_test.rb', line 79

def test_charge_bni_va
  result = @mt_test.charge(
    {
      "payment_type": "bank_transfer",
      "transaction_details": {
        "gross_amount": 10000,
        "order_id": "ruby-lib-test-bniva-#{Time.now.to_i}"
      },
      "bank_transfer": {
        "bank": "bni",
        "va_number": "1234567891"
      }
    }
  )
  assert_equal 201, result.status_code
  assert_equal "Success, Bank Transfer transaction is created", result.status_message
end

#test_charge_cimb_clicksObject



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/test/api_test.rb', line 109

def test_charge_cimb_clicks
  result = @mt_test.charge(
    {
      "payment_type": "cimb_clicks",
      "transaction_details": {
        "order_id": "ruby-lib-test-cimbclicks-#{Time.now.to_i}",
        "gross_amount": 44000
      },
      "cimb_clicks": {
        "description": "Purchase of a Food Delivery"
      }
    }
  )
  assert_equal 201, result.status_code
  assert_equal "Success, CIMB Clicks transaction is successful", result.status_message
end

#test_charge_credit_cardObject



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/test/api_test.rb', line 36

def test_charge_credit_card
  card = {
    card_number: 5211111111111117,
    card_cvv: 123,
    card_exp_month: 12,
    card_exp_year: 2025
  }
  get_token = @mt_test.test_token(card)
  result = @mt_test.charge(
    {
      "payment_type": "credit_card",
      "transaction_details": {
        "gross_amount": 10000,
        "order_id": "ruby-lib-test-creditcard-#{Time.now.to_i}"
      },
      "credit_card": {
        "token_id": "#{get_token.token_id}"
      }
    }
  )
  assert_equal "Success, Credit Card transaction is successful", result.status_message
  assert_equal 200, result.status_code
  assert_equal "Approved", result.channel_response_message
end

#test_charge_danamon_onlineObject



241
242
243
244
245
246
247
248
249
250
251
252
# File 'lib/test/api_test.rb', line 241

def test_charge_danamon_online
  result = @mt_test.charge(
    "payment_type": "danamon_online",
    "transaction_details": {
      "order_id": "ruby-lib-test-#{Time.now.to_i}",
      "gross_amount": 44000
    }
  )
  assert_equal "Success, Danamon Online transaction is successful", result.status_message
  assert_equal 201, result.status_code
  assert_equal "pending", result.transaction_status
end

#test_charge_epay_briObject



126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/test/api_test.rb', line 126

def test_charge_epay_bri
  result = @mt_test.charge(
    {
      "payment_type": "bri_epay",
      "transaction_details": {
        "order_id": "ruby-lib-test-epaybri-#{Time.now.to_i}",
        "gross_amount": 44000
      }
    }
  )
  assert_equal 201, result.status_code
  assert_equal "Success, BRI E-Pay transaction is successful", result.status_message
  assert_equal "pending", result.transaction_status
end

#test_charge_gopayObject



194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# File 'lib/test/api_test.rb', line 194

def test_charge_gopay
  result = @mt_test.charge(
    "payment_type": "gopay",
    "transaction_details": {
      "order_id": "ruby-lib-test-gopay-#{Time.now.to_i}",
      "gross_amount": 44000
    },
    "gopay": {
      "enable_callback": "true",
      "callback_url": "someapps://callback"
    }
  )
  assert_equal 201, result.status_code
  assert_equal "GoPay transaction is created", result.status_message
  assert_equal "pending", result.transaction_status
end

#test_charge_indomaretObject



158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'lib/test/api_test.rb', line 158

def test_charge_indomaret
  result = @mt_test.charge(
    "payment_type": "cstore",
    "transaction_details": {
      "order_id": "ruby-lib-test-indomaret-#{Time.now.to_i}",
      "gross_amount": 44000
    },
    "cstore": {
      "store": "Indomaret",
      "message": "Message to display"
    }
  )
  assert_equal 201, result.status_code
  assert_equal "Success, cstore transaction is successful", result.status_message
  assert_equal "indomaret", result.store
end

#test_charge_mandiri_billObject



141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/test/api_test.rb', line 141

def test_charge_mandiri_bill
  result = @mt_test.charge(
    "payment_type": "echannel",
    "transaction_details": {
      "order_id": "ruby-lib-test-mandiribill-#{Time.now.to_i}",
      "gross_amount": 44000
    },
    "echannel": {
      "bill_info1": "Payment for:",
      "bill_info2": "Item descriptions"
    }
  )
  assert_equal 201, result.status_code
  assert_equal "OK, Mandiri Bill transaction is successful", result.status_message
  assert_equal "pending", result.transaction_status
end

#test_charge_permata_vaObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/test/transaction_test.rb', line 16

def test_charge_permata_va
  result = @mt_test.charge(
    {
      "payment_type": "bank_transfer",
      "transaction_details": {
        "gross_amount": 10000,
        "order_id": "ruby-lib-test-#{Time.now.to_i}"
      },
      "bank_transfer": {
        "bank": "permata",
        "va_number": "1234567891"
      }
    }
  )
  assert_equal 201, result.status_code
  assert_equal "pending", result.transaction_status
  assert_equal "Success, PERMATA VA transaction is successful", result.status_message
end

#test_client_key_server_keyObject



19
20
21
22
23
24
25
# File 'lib/test/config_test.rb', line 19

def test_client_key_server_key
  Veritrans.config.client_key = "kk-1"
  Veritrans.config.server_key = "sk-1"

  assert_equal "kk-1", Veritrans.config.client_key
  assert_equal "sk-1", Veritrans.config.server_key
end

#test_create_snap_token_stringObject



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/test/snap_test.rb', line 29

def test_create_snap_token_string
  result = @mt_test.create_snap_token_string(
    transaction_details: {
      order_id: "ruby-lib-test-snap-#{Time.now.to_i}",
      gross_amount: 200000
    },
    "credit_card": {
      "secure": true
    }
  )
  assert result != nil
end

#test_create_subscriptionObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/test/subscription_test.rb', line 17

def test_create_subscription
  p 1
  param = {
    "name": "MONTHLY_2021",
    "amount": "17000",
    "currency": "IDR",
    "payment_type": "credit_card",
    "token": "dummy",
    "schedule": {
      "interval": 1,
      "interval_unit": "month",
      "max_interval": 12,
      "start_time": "2022-10-10 07:25:01 +0700"
    },
    "metadata": {
      "description": "Recurring payment for A"
    },
    "customer_details": {
      "first_name": "John",
      "last_name": "Doe",
      "email": "[email protected]",
      "phone": "+62812345678"
    }
  }
  result = @mt_test.create_subscription(param)
  assert_equal 200, result.status
  $testsubsid = result.id
end

#test_create_widget_tokenObject



254
255
256
257
258
259
260
261
262
263
264
265
# File 'lib/test/api_test.rb', line 254

def test_create_widget_token
  result = @mt_test.create_widget_token(
    transaction_details: {
      order_id: "ruby-lib-test-#{Time.now.to_i}",
      gross_amount: 200000
    },
    "credit_card": {
      "secure": true
    }
  )
  assert_equal 201, result.status_code
end

#test_deny_transactionObject



120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/test/transaction_test.rb', line 120

def test_deny_transaction
  card = {
    card_number: 5510111111111115,
    card_cvv: 123,
    card_exp_month: 12,
    card_exp_year: 2025
  }
  get_token = @mt_test.test_token(card)
  charge = @mt_test.charge(
    {
      "payment_type": "credit_card",
      "transaction_details": {
        "gross_amount": 10000,
        "order_id": "ruby-lib-test-#{Time.now.to_i}"
      },
      "credit_card": {
        "token_id": "#{get_token.token_id}",
        "authentication": "false"
      }
    }
  )
  result = @mt_test.deny(charge.transaction_id)
  assert_equal 200, result.status_code
  assert_equal "Success, transaction is denied", result.status_message
  assert_equal "deny", result.fraud_status
end

#test_disable_subscriptionObject



52
53
54
55
56
# File 'lib/test/subscription_test.rb', line 52

def test_disable_subscription
  p 3
  result = @mt_test.disable_subscription($testsubsid)
  assert_equal "Subscription is updated.", result.status_message
end

#test_disable_subscription_noneObject



88
89
90
91
92
93
94
95
# File 'lib/test/subscription_test.rb', line 88

def test_disable_subscription_none
  begin
    @mt_test.disable_subscription("dummy")
  rescue MidtransError => e
    assert_equal "404", e.status
    assert_match "Subscription doesn't exist.", e.data
  end
end

#test_enable_subscriptionObject



58
59
60
61
62
# File 'lib/test/subscription_test.rb', line 58

def test_enable_subscription
  p 4
  result = @mt_test.enable_subscription($testsubsid)
  assert_equal "Subscription is updated.", result.status_message
end

#test_enable_subscription_noneObject



97
98
99
100
101
102
103
104
# File 'lib/test/subscription_test.rb', line 97

def test_enable_subscription_none
  begin
    @mt_test.enable_subscription("dummy")
  rescue MidtransError => e
    assert_equal "404", e.status
    assert_match "Subscription doesn't exist.", e.data
  end
end

#test_expire_permata_vaObject



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/test/transaction_test.rb', line 54

def test_expire_permata_va
  charge = @mt_test.charge(
    {
      "payment_type": "bank_transfer",
      "transaction_details": {
        "gross_amount": 10000,
        "order_id": "ruby-lib-test-#{Time.now.to_i}"
      },
      "bank_transfer": {
        "bank": "permata",
        "va_number": "1234567891"
      }
    }
  )
  expire = @mt_test.expire(charge.transaction_id)
  assert_equal "Success, transaction has expired", expire.status_message
  assert_equal 407, expire.status_code
  assert_equal "expire", expire.transaction_status
end

#test_fail_charge_invalid_keyObject



267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
# File 'lib/test/api_test.rb', line 267

def test_fail_charge_invalid_key
  @mt_test_invalid_key = Veritrans.new(
    server_key: "invalid server key",
    client_key: "invalid client key",
    api_host: "https://api.sandbox.midtrans.com",
    logger: Logger.new(STDOUT),
    file_logger: Logger.new(STDOUT)
  )

  begin
  @mt_test_invalid_key.charge(
    {
      "payment_type": "bank_transfer",
      "transaction_details": {
        "gross_amount": 10000,
        "order_id": "ruby-lib-test-bcava-#{Time.now.to_i}"
      },
      "bank_transfer": {
        "bank": "bca",
        "va_number": "1234567891"
      }
    }
  )
  rescue MidtransError => e
  assert_equal "401", e.status
  assert_match "Transaction cannot be authorized with the current client/server key.", e.data
  end
end

#test_fail_get_tokenObject



296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
# File 'lib/test/api_test.rb', line 296

def test_fail_get_token
  @mt_test_invalid_key = Veritrans.new(
    server_key: "invalid server key",
    client_key: "invalid client key",
    api_host: "https://api.sandbox.midtrans.com",
    logger: Logger.new(STDOUT),
    file_logger: Logger.new(STDOUT)
  )

  card = {
    card_number: 4617006959746656,
    card_cvv: 123,
    card_exp_month: 12,
    card_exp_year: 2026
  }
  begin
    @mt_test_invalid_key.test_token(card)
  rescue MidtransError => e
    assert_equal "401", e.status
    assert_match "Transaction cannot be authorized with the current client/server key.", e.data
  end
end

#test_fail_refund_transactionObject



147
148
149
150
151
152
153
154
155
156
157
158
# File 'lib/test/transaction_test.rb', line 147

def test_fail_refund_transaction
  begin
  param = {
    "refund_key": "reference1",
    "amount": 5000,
    "reason": "for some reason"
  }
  @mt_test.refund("dummy-order-id", param)
  rescue MidtransError => e
    assert_equal "404", e.status
    end
end

#test_get_payment_acc_dummyObject



60
61
62
63
64
65
66
67
68
# File 'lib/test/gopay_tokenization_test.rb', line 60

def test_get_payment_acc_dummy
  p 4
  begin
  @mt_test.("dummy")
  rescue MidtransError => e
  assert_equal "404", e.status
  assert_match "Account doesn't exist.", e.data
  end
end

#test_get_payment_accountObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/test/gopay_tokenization_test.rb', line 33

def 
  p 2
  param = {
    "payment_type": "gopay",
    "gopay_partner": {
      "phone_number": "81987654321",
      "country_code": "62",
      "redirect_url": "https://www.gojek.com"
    }
  }
  charge = @mt_test.(param)
  result = @mt_test.(charge.)
  assert_equal 201, result.status_code
  assert_equal "PENDING", result.
end

#test_get_status_transactionObject



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/test/transaction_test.rb', line 74

def test_get_status_transaction
  charge = @mt_test.charge(
    {
      "payment_type": "bank_transfer",
      "transaction_details": {
        "gross_amount": 10000,
        "order_id": "ruby-lib-test-#{Time.now.to_i}"
      },
      "bank_transfer": {
        "bank": "permata",
        "va_number": "1234567891"
      }
    }
  )
  result = @mt_test.status(charge.transaction_id)
  assert_equal 201, result.status_code
  assert_equal "Success, transaction is found", result.status_message
end

#test_get_subscriptionObject



46
47
48
49
50
# File 'lib/test/subscription_test.rb', line 46

def test_get_subscription
  p 2
  result = @mt_test.get_subscription($testsubsid)
  assert_equal 200, result.status
end

#test_get_subscription_none_accObject



79
80
81
82
83
84
85
86
# File 'lib/test/subscription_test.rb', line 79

def test_get_subscription_none_acc
  begin
    @mt_test.get_subscription("dummy")
  rescue MidtransError => e
    assert_equal "404", e.status
    assert_match "Subscription doesn't exist.", e.data
  end
end

#test_get_token_credit_cardObject



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/test/api_test.rb', line 24

def test_get_token_credit_card
  card = {
    card_number: 4811111111111114,
    card_cvv: 123,
    card_exp_month: 12,
    card_exp_year: 2025
  }
  result = @mt_test.test_token(card)
  assert_equal 200, result.status_code
  assert_equal "Credit card token is created as Token ID.", result.status_message
end


17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/test/gopay_tokenization_test.rb', line 17

def 
  p 1
  param = {
    "payment_type": "gopay",
    "gopay_partner": {
      "phone_number": "81987654321",
      "country_code": "62",
      "redirect_url": "https://www.gojek.com"
    }
  }
  result = @mt_test.(param)
  assert_equal 201, result.status_code
  assert_equal "PENDING", result.
  $test_gopay_id = result.
end

#test_point_inquiryObject



97
98
99
100
101
102
103
104
105
106
107
# File 'lib/test/api_test.rb', line 97

def test_point_inquiry
  card = {
    card_number: 4617006959746656,
    card_cvv: 123,
    card_exp_month: 12,
    card_exp_year: 2026
  }
  result = @mt_test.test_token(card)
  card_point_response = @mt_test.point_inquiry(result.token_id)
  assert_equal 200, card_point_response.status_code
end

#test_snap_invalid_serverkeyObject



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/test/snap_test.rb', line 55

def test_snap_invalid_serverkey
  @mt_test_invalid_key = Veritrans.new(
    server_key: "invalid server key",
    client_key: "invalid client key",
    api_host: "https://api.sandbox.midtrans.com",
    logger: Logger.new(STDOUT),
    file_logger: Logger.new(STDOUT)
  )
  begin
  @mt_test_invalid_key.create_widget_token(
    transaction_details: {
      order_id: "ruby-lib-test-#{Time.now.to_i}",
      gross_amount: 200000
    },
    "credit_card": {
      "secure": true
    }
  )
  rescue MidtransError => e
  assert_equal "401", e.status
  assert_match "please check client or server key", e.data
  end
end

#test_snap_redirect_url_strObject



42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/test/snap_test.rb', line 42

def test_snap_redirect_url_str
  result = @mt_test.create_snap_redirect_url_str(
    transaction_details: {
      order_id: "ruby-lib-test-snap#{Time.now.to_i}",
      gross_amount: 200000
    },
    "credit_card": {
      "secure": true
    }
  )
  assert_match "https://", result
end


70
71
72
73
74
75
76
77
78
# File 'lib/test/gopay_tokenization_test.rb', line 70

def 
  p 5
  begin
  @mt_test.("dummy")
  rescue MidtransError => e
  assert_equal "404", e.status
  assert_match "Account doesn't exist.", e.data
  end
end


49
50
51
52
53
54
55
56
57
58
# File 'lib/test/gopay_tokenization_test.rb', line 49

def 
  #expected the API call will fail because of not click activation from link_payment_account
  p 3
  begin
    @mt_test.($test_gopay_id)
  rescue MidtransError => e
    assert_equal "412", e.status
    assert_match "Account status cannot be updated.", e.data
  end
end

#test_update_subscriptionObject



64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/test/subscription_test.rb', line 64

def test_update_subscription
  p 5
  param = {
    "name": "MONTHLY_2021",
    "amount": "21000",
    "currency": "IDR",
    "token": "dummy",
    "schedule": {
      "interval": 1
    }
  }
  result = @mt_test.update_subscription($testsubsid, param)
  assert_equal "Subscription is updated.", result.status_message
end

#test_update_subscription_noneObject



106
107
108
109
110
111
112
113
114
# File 'lib/test/subscription_test.rb', line 106

def test_update_subscription_none
  begin
    param = {}
    @mt_test.update_subscription("dummy", param)
  rescue MidtransError => e
    assert_equal "404", e.status
    assert_match "Subscription doesn't exist.", e.data
  end
end