gmo 0.3.0 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/.travis.yml +5 -9
- data/CHANGELOG.md +37 -1
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_cancel_deposit_gets_data_about_a_deposit.yml +38 -0
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_cancel_mail_deposit_gets_data_about_a_mail_deposit.yml +38 -0
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_create_account_gets_data_about_an_account.yml +38 -0
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_create_deposit_gets_data_about_a_deposit.yml +38 -0
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_create_mail_deposit_gets_data_about_a_mail_deposit.yml +38 -0
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_delete_account_gets_data_about_an_account.yml +38 -0
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_search_account_gets_data_about_an_account.yml +38 -0
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_search_balance_gets_data_about_balance.yml +38 -0
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_search_deposit_gets_data_about_a_deposit.yml +38 -0
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_search_mail_deposit_gets_data_about_a_mail_deposit.yml +38 -0
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_update_account_gets_data_about_an_account.yml +38 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_change_tran_brandtoken_gets_data_about_order.yml +108 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_cvs_cancel_gets_data_about_a_transaction.yml +63 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_brandtoken_gets_data_about_a_transaction.yml +38 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_docomo_gets_data_about_a_transaction.yml +35 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_rakuten_id_gets_data_about_a_transaction.yml +35 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_brandtoken_gets_data_about_a_transaction.yml +73 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_brandtoken_parameter_contains_Japanese_characters_should_correctly_handle_Japanese.yml +73 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_docomo_gets_data_about_a_transaction.yml +67 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_doesn_t_require_card_info_if_token_is_present.yml +69 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_rakuten_id_gets_data_about_a_transaction.yml +67 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_refund_tran_brandtoken_gets_data_about_a_transaction.yml +108 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_sales_tran_brandtoken_gets_data_about_a_transaction.yml +143 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_secure_tran_gets_data_about_a_transaction.yml +36 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_void_tran_brandtoken_gets_data_about_order.yml +108 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/secure_tran_request_params.yml +2 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAndSiteAPI/_exec_tran_brandtoken_got_data.yml +73 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAndSiteAPI/_trade_brandtoken_got_data.yml +108 -0
- data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_delete_brandtoken_gets_data_about_a_brandtoken.yml +73 -0
- data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_search_brandtoken_gets_data_about_a_brandtoken.yml +74 -0
- data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_search_card_detail_by_member_id_gets_data_about_card_detail.yml +36 -0
- data/lib/gmo.rb +10 -3
- data/lib/gmo/const.rb +2502 -3
- data/lib/gmo/errors.rb +22 -4
- data/lib/gmo/remittance_api.rb +331 -0
- data/lib/gmo/shop_and_site_api.rb +77 -2
- data/lib/gmo/shop_api.rb +315 -5
- data/lib/gmo/site_api.rb +70 -3
- data/lib/gmo/version.rb +2 -2
- data/spec/gmo/{error_spec.rb → errors_spec.rb} +11 -2
- data/spec/gmo/remittance_api_spec.rb +506 -0
- data/spec/gmo/shop_and_site_api_spec.rb +83 -3
- data/spec/gmo/shop_api_spec.rb +429 -1
- data/spec/gmo/site_api_spec.rb +88 -1
- data/spec/support/config.example.yml +5 -0
- data/spec/support/config.yml +5 -0
- data/spec/support/config_loader.rb +1 -1
- data/spec/support/vcr.rb +9 -2
- metadata +41 -8
@@ -8,17 +8,23 @@ describe "GMO::Payment::ShopAndSiteAPI" do
|
|
8
8
|
:shop_pass => SPEC_CONF["shop_pass"],
|
9
9
|
:site_id => SPEC_CONF["site_id"],
|
10
10
|
:site_pass => SPEC_CONF["site_pass"],
|
11
|
-
:host => SPEC_CONF["host"]
|
11
|
+
:host => SPEC_CONF["host"],
|
12
|
+
:locale => :ja
|
13
|
+
|
12
14
|
})
|
13
15
|
@shop_api ||= GMO::Payment::ShopAPI.new({
|
14
16
|
:shop_id => SPEC_CONF["shop_id"],
|
15
17
|
:shop_pass => SPEC_CONF["shop_pass"],
|
16
|
-
:host => SPEC_CONF["host"]
|
18
|
+
:host => SPEC_CONF["host"],
|
19
|
+
:locale => :ja
|
20
|
+
|
17
21
|
})
|
18
22
|
@site_api ||= GMO::Payment::SiteAPI.new({
|
19
23
|
:site_id => SPEC_CONF["site_id"],
|
20
24
|
:site_pass => SPEC_CONF["site_pass"],
|
21
|
-
:host => SPEC_CONF["host"]
|
25
|
+
:host => SPEC_CONF["host"],
|
26
|
+
:locale => :ja
|
27
|
+
|
22
28
|
})
|
23
29
|
end
|
24
30
|
|
@@ -91,4 +97,78 @@ describe "GMO::Payment::ShopAndSiteAPI" do
|
|
91
97
|
end
|
92
98
|
end
|
93
99
|
|
100
|
+
describe "#trade_brandtoken" do
|
101
|
+
|
102
|
+
it "got data", :vcr do
|
103
|
+
order_id = generate_id
|
104
|
+
result = @shop_api.entry_tran_brandtoken({
|
105
|
+
:order_id => order_id,
|
106
|
+
:job_cd => "AUTH",
|
107
|
+
:amount => 100
|
108
|
+
})
|
109
|
+
access_id = result["AccessID"]
|
110
|
+
access_pass = result["AccessPass"]
|
111
|
+
member_id = generate_id
|
112
|
+
result = @service.exec_tran_brandtoken({
|
113
|
+
:order_id => order_id,
|
114
|
+
:access_id => access_id,
|
115
|
+
:access_pass => access_pass,
|
116
|
+
:token_type => :apple_pay,
|
117
|
+
:token => 'base64encodedtoken',
|
118
|
+
:member_id => member_id
|
119
|
+
})
|
120
|
+
result = @service.trade_brandtoken({
|
121
|
+
:order_id => order_id,
|
122
|
+
:member_id => member_id
|
123
|
+
})
|
124
|
+
result["TokenSeq"].nil?.should_not be true
|
125
|
+
result["CardNoToken"].nil?.should_not be true
|
126
|
+
result["Forward"].nil?.should_not be true
|
127
|
+
end
|
128
|
+
|
129
|
+
it "got error if missing options", :vcr do
|
130
|
+
lambda {
|
131
|
+
result = @service.trade_brandtoken()
|
132
|
+
}.should raise_error('Required order_id, member_id were not provided.')
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
describe "#exec_tran_brandtoken" do
|
137
|
+
|
138
|
+
it "got data", :vcr do
|
139
|
+
order_id = generate_id
|
140
|
+
result = @shop_api.entry_tran_brandtoken({
|
141
|
+
:order_id => order_id,
|
142
|
+
:job_cd => "AUTH",
|
143
|
+
:amount => 100
|
144
|
+
})
|
145
|
+
access_id = result["AccessID"]
|
146
|
+
access_pass = result["AccessPass"]
|
147
|
+
member_id = generate_id
|
148
|
+
result = @service.exec_tran_brandtoken({
|
149
|
+
:order_id => order_id,
|
150
|
+
:access_id => access_id,
|
151
|
+
:access_pass => access_pass,
|
152
|
+
:token_type => :apple_pay,
|
153
|
+
:token => 'base64encodedtoken',
|
154
|
+
:member_id => member_id
|
155
|
+
})
|
156
|
+
result["Status"].nil?.should_not be true
|
157
|
+
result["OrderID"].nil?.should_not be true
|
158
|
+
result["Forward"].nil?.should_not be true
|
159
|
+
result["Approve"].nil?.should_not be true
|
160
|
+
result["TranID"].nil?.should_not be true
|
161
|
+
result["TranDate"].nil?.should_not be true
|
162
|
+
result["ClientField1"].nil?.should_not be true
|
163
|
+
result["ClientField2"].nil?.should_not be true
|
164
|
+
result["ClientField3"].nil?.should_not be true
|
165
|
+
end
|
166
|
+
|
167
|
+
it "got error if missing options", :vcr do
|
168
|
+
lambda {
|
169
|
+
result = @service.exec_tran_brandtoken()
|
170
|
+
}.should raise_error('Required access_id, access_pass, member_id, order_id were not provided.')
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
94
174
|
end
|
data/spec/gmo/shop_api_spec.rb
CHANGED
@@ -9,10 +9,19 @@ describe "GMO::Payment::ShopAPI" do
|
|
9
9
|
end
|
10
10
|
|
11
11
|
before(:each) do
|
12
|
+
@shop_site ||= GMO::Payment::ShopAndSiteAPI.new({
|
13
|
+
:site_id => SPEC_CONF["site_id"],
|
14
|
+
:site_pass => SPEC_CONF["site_pass"],
|
15
|
+
:shop_id => SPEC_CONF["shop_id"],
|
16
|
+
:shop_pass => SPEC_CONF["shop_pass"],
|
17
|
+
:host => SPEC_CONF["host"],
|
18
|
+
:locale => :ja
|
19
|
+
})
|
12
20
|
@service ||= GMO::Payment::ShopAPI.new({
|
13
21
|
:shop_id => SPEC_CONF["shop_id"],
|
14
22
|
:shop_pass => SPEC_CONF["shop_pass"],
|
15
|
-
:host => SPEC_CONF["host"]
|
23
|
+
:host => SPEC_CONF["host"],
|
24
|
+
:locale => :ja
|
16
25
|
})
|
17
26
|
end
|
18
27
|
|
@@ -108,6 +117,63 @@ describe "GMO::Payment::ShopAPI" do
|
|
108
117
|
end
|
109
118
|
end
|
110
119
|
|
120
|
+
describe "#entry_tran_brandtoken" do
|
121
|
+
it "gets data about a transaction", :vcr do
|
122
|
+
order_id = @order_id
|
123
|
+
result = @service.entry_tran_brandtoken({
|
124
|
+
:order_id => order_id,
|
125
|
+
:job_cd => "AUTH",
|
126
|
+
:amount => 100
|
127
|
+
})
|
128
|
+
result["AccessID"].nil?.should_not be true
|
129
|
+
result["AccessPass"].nil?.should_not be true
|
130
|
+
end
|
131
|
+
|
132
|
+
it "got error if missing options", :vcr do
|
133
|
+
lambda {
|
134
|
+
result = @service.entry_tran_brandtoken()
|
135
|
+
}.should raise_error('Required order_id, job_cd, amount were not provided.')
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
describe "#entry_tran_rakuten_id" do
|
140
|
+
it "gets data about a transaction", :vcr do
|
141
|
+
order_id = @order_id
|
142
|
+
result = @service.entry_tran_rakuten_id({
|
143
|
+
:order_id => order_id,
|
144
|
+
:job_cd => "AUTH",
|
145
|
+
:amount => 100
|
146
|
+
})
|
147
|
+
result["AccessID"].nil?.should_not be true
|
148
|
+
result["AccessPass"].nil?.should_not be true
|
149
|
+
end
|
150
|
+
|
151
|
+
it "got error if missing options", :vcr do
|
152
|
+
lambda {
|
153
|
+
result = @service.entry_tran_rakuten_id()
|
154
|
+
}.should raise_error('Required order_id, job_cd, amount were not provided.')
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
describe "#entry_tran_docomo" do
|
159
|
+
it "gets data about a transaction", :vcr do
|
160
|
+
order_id = @order_id
|
161
|
+
result = @service.entry_tran_docomo({
|
162
|
+
:order_id => order_id,
|
163
|
+
:job_cd => "AUTH",
|
164
|
+
:amount => 100
|
165
|
+
})
|
166
|
+
result["AccessID"].nil?.should_not be true
|
167
|
+
result["AccessPass"].nil?.should_not be true
|
168
|
+
end
|
169
|
+
|
170
|
+
it "got error if missing options", :vcr do
|
171
|
+
lambda {
|
172
|
+
result = @service.entry_tran_docomo()
|
173
|
+
}.should raise_error('Required order_id, job_cd, amount were not provided.')
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
111
177
|
describe "#exec_tran" do
|
112
178
|
it "gets data about a transaction", :vcr do
|
113
179
|
order_id = generate_id
|
@@ -149,6 +215,27 @@ describe "GMO::Payment::ShopAPI" do
|
|
149
215
|
}.should raise_error("Required access_id, access_pass, order_id, card_no, expire were not provided.")
|
150
216
|
end
|
151
217
|
|
218
|
+
it "doesn't require card info if token is present", :vcr do
|
219
|
+
lambda {
|
220
|
+
order_id = generate_id
|
221
|
+
result = @service.entry_tran({
|
222
|
+
:order_id => order_id,
|
223
|
+
:job_cd => "AUTH",
|
224
|
+
:amount => 100
|
225
|
+
})
|
226
|
+
access_id = result["AccessID"]
|
227
|
+
access_pass = result["AccessPass"]
|
228
|
+
result = @service.exec_tran({
|
229
|
+
:order_id => order_id,
|
230
|
+
:access_id => access_id,
|
231
|
+
:access_pass => access_pass,
|
232
|
+
:method => 1,
|
233
|
+
:pay_times => 1,
|
234
|
+
:token => "onetimetokenfromgmo"
|
235
|
+
})
|
236
|
+
}.should_not raise_error("Required card_no, expire were not provided.")
|
237
|
+
end
|
238
|
+
|
152
239
|
context "parameter contains Japanese characters" do
|
153
240
|
before { require "kconv" unless defined?(Kconv) }
|
154
241
|
|
@@ -189,6 +276,26 @@ describe "GMO::Payment::ShopAPI" do
|
|
189
276
|
end
|
190
277
|
end
|
191
278
|
|
279
|
+
describe "#secure_tran" do
|
280
|
+
it "gets data about a transaction", :vcr do
|
281
|
+
params = File.read("fixtures/vcr_cassettes/GMO_Payment_ShopAPI/secure_tran_request_params.yml")
|
282
|
+
params = YAML.load(params)
|
283
|
+
|
284
|
+
result = @service.secure_tran({
|
285
|
+
:pa_res => params["pa_res"],
|
286
|
+
:md => params["md"]
|
287
|
+
})
|
288
|
+
result["OrderID"].nil?.should_not be_truthy
|
289
|
+
result["Forward"].nil?.should_not be_truthy
|
290
|
+
result["Method"].nil?.should_not be_truthy
|
291
|
+
result["PayTimes"].nil?.should_not be_truthy
|
292
|
+
result["Approve"].nil?.should_not be_truthy
|
293
|
+
result["TranID"].nil?.should_not be_truthy
|
294
|
+
result["TranDate"].nil?.should_not be_truthy
|
295
|
+
result["CheckString"].nil?.should_not be_truthy
|
296
|
+
end
|
297
|
+
end
|
298
|
+
|
192
299
|
describe "#exec_tran_cvs" do
|
193
300
|
it "gets data about a transaction", :vcr do
|
194
301
|
order_id = generate_id
|
@@ -299,6 +406,141 @@ describe "GMO::Payment::ShopAPI" do
|
|
299
406
|
end
|
300
407
|
end
|
301
408
|
|
409
|
+
describe "#exec_tran_rakuten_id" do
|
410
|
+
it "gets data about a transaction", :vcr do
|
411
|
+
order_id = generate_id
|
412
|
+
result = @service.entry_tran_rakuten_id({
|
413
|
+
:order_id => order_id,
|
414
|
+
:job_cd => 'CAPTURE',
|
415
|
+
:amount => 100
|
416
|
+
})
|
417
|
+
access_id = result["AccessID"]
|
418
|
+
access_pass = result["AccessPass"]
|
419
|
+
result = @service.exec_tran_rakuten_id({
|
420
|
+
:order_id => order_id,
|
421
|
+
:access_id => access_id,
|
422
|
+
:access_pass => access_pass,
|
423
|
+
:ret_url => 'https://example.com/path/to/return/success',
|
424
|
+
:error_rcv_url => 'https://example.com/path/to/return/failure',
|
425
|
+
:item_id => '0001',
|
426
|
+
:item_name => '購入する商品名'
|
427
|
+
})
|
428
|
+
result["AccessID"].nil?.should_not be_truthy
|
429
|
+
result["Token"].nil?.should_not be_truthy
|
430
|
+
result["StartURL"].nil?.should_not be_truthy
|
431
|
+
result["StartLimitDate"].nil?.should_not be_truthy
|
432
|
+
end
|
433
|
+
|
434
|
+
it "got error if missing options", :vcr do
|
435
|
+
lambda {
|
436
|
+
result = @service.exec_tran_rakuten_id()
|
437
|
+
}.should raise_error("Required access_id, access_pass, order_id were not provided.")
|
438
|
+
end
|
439
|
+
end
|
440
|
+
|
441
|
+
describe "#exec_tran_docomo" do
|
442
|
+
it "gets data about a transaction", :vcr do
|
443
|
+
order_id = generate_id
|
444
|
+
result = @service.entry_tran_docomo({
|
445
|
+
:order_id => order_id,
|
446
|
+
:job_cd => 'CAPTURE',
|
447
|
+
:amount => 100
|
448
|
+
})
|
449
|
+
access_id = result["AccessID"]
|
450
|
+
access_pass = result["AccessPass"]
|
451
|
+
result = @service.exec_tran_docomo({
|
452
|
+
:order_id => order_id,
|
453
|
+
:access_id => access_id,
|
454
|
+
:access_pass => access_pass,
|
455
|
+
:ret_url => 'https://example.com/path/to/return/success',
|
456
|
+
:error_rcv_url => 'https://example.com/path/to/return/failure',
|
457
|
+
:item_id => '0001',
|
458
|
+
:item_name => '購入する商品名'
|
459
|
+
})
|
460
|
+
result["AccessID"].nil?.should_not be_truthy
|
461
|
+
result["Token"].nil?.should_not be_truthy
|
462
|
+
result["StartURL"].nil?.should_not be_truthy
|
463
|
+
result["StartLimitDate"].nil?.should_not be_truthy
|
464
|
+
end
|
465
|
+
|
466
|
+
it "got error if missing options", :vcr do
|
467
|
+
lambda {
|
468
|
+
result = @service.exec_tran_docomo()
|
469
|
+
}.should raise_error("Required access_id, access_pass, order_id were not provided.")
|
470
|
+
end
|
471
|
+
end
|
472
|
+
|
473
|
+
describe "#exec_tran_brandtoken" do
|
474
|
+
it "gets data about a transaction", :vcr do
|
475
|
+
order_id = generate_id
|
476
|
+
client_field_1 = "client_field1"
|
477
|
+
result = @service.entry_tran_brandtoken({
|
478
|
+
:order_id => order_id,
|
479
|
+
:job_cd => "AUTH",
|
480
|
+
:amount => 100
|
481
|
+
})
|
482
|
+
access_id = result["AccessID"]
|
483
|
+
access_pass = result["AccessPass"]
|
484
|
+
result = @service.exec_tran_brandtoken({
|
485
|
+
:order_id => order_id,
|
486
|
+
:access_id => access_id,
|
487
|
+
:access_pass => access_pass,
|
488
|
+
:token_type => :apple_pay,
|
489
|
+
:token => 'base64encodedtoken',
|
490
|
+
:client_field_1 => client_field_1
|
491
|
+
})
|
492
|
+
result["Status"].nil?.should_not be true
|
493
|
+
result["OrderID"].nil?.should_not be true
|
494
|
+
result["Forward"].nil?.should_not be true
|
495
|
+
result["Approve"].nil?.should_not be true
|
496
|
+
result["TranID"].nil?.should_not be true
|
497
|
+
result["TranDate"].nil?.should_not be true
|
498
|
+
(result["ClientField1"] == client_field_1).should be true
|
499
|
+
result["ClientField2"].nil?.should_not be true
|
500
|
+
result["ClientField3"].nil?.should_not be true
|
501
|
+
end
|
502
|
+
|
503
|
+
it "got error if missing options", :vcr do
|
504
|
+
lambda {
|
505
|
+
result = @service.exec_tran_brandtoken()
|
506
|
+
}.should raise_error("Required access_id, access_pass, order_id were not provided.")
|
507
|
+
end
|
508
|
+
|
509
|
+
context "parameter contains Japanese characters" do
|
510
|
+
before { require "kconv" unless defined?(Kconv) }
|
511
|
+
|
512
|
+
it "should correctly handle Japanese", :vcr do
|
513
|
+
order_id = generate_id
|
514
|
+
client_field_1 = "〜−¢£¬−‖①ほげほげhogehoge"
|
515
|
+
result = @service.entry_tran_brandtoken({
|
516
|
+
:order_id => order_id,
|
517
|
+
:job_cd => "AUTH",
|
518
|
+
:amount => 100
|
519
|
+
})
|
520
|
+
access_id = result["AccessID"]
|
521
|
+
access_pass = result["AccessPass"]
|
522
|
+
result = @service.exec_tran_brandtoken({
|
523
|
+
:order_id => order_id,
|
524
|
+
:access_id => access_id,
|
525
|
+
:access_pass => access_pass,
|
526
|
+
:token_type => :apple_pay,
|
527
|
+
:token => 'base64encodedtoken',
|
528
|
+
:client_field_1 => client_field_1
|
529
|
+
})
|
530
|
+
result["Status"].nil?.should_not be true
|
531
|
+
result["OrderID"].nil?.should_not be true
|
532
|
+
result["Forward"].nil?.should_not be true
|
533
|
+
result["Approve"].nil?.should_not be true
|
534
|
+
result["TranID"].nil?.should_not be true
|
535
|
+
result["TranDate"].nil?.should_not be true
|
536
|
+
(result["ClientField1"] == client_field_1).should be true
|
537
|
+
(result["ClientField1"].encoding.to_s == "UTF-8").should be true
|
538
|
+
result["ClientField2"].nil?.should_not be true
|
539
|
+
result["ClientField3"].nil?.should_not be true
|
540
|
+
end
|
541
|
+
end
|
542
|
+
end
|
543
|
+
|
302
544
|
describe "#alter_tran" do
|
303
545
|
it "gets data about order", :vcr do
|
304
546
|
order_id = generate_id
|
@@ -413,6 +655,192 @@ describe "GMO::Payment::ShopAPI" do
|
|
413
655
|
end
|
414
656
|
end
|
415
657
|
|
658
|
+
describe "#change_tran_brandtoken" do
|
659
|
+
it "gets data about order", :vcr do
|
660
|
+
order_id = generate_id
|
661
|
+
result = @service.entry_tran_brandtoken({
|
662
|
+
:order_id => order_id,
|
663
|
+
:job_cd => "AUTH",
|
664
|
+
:amount => 100
|
665
|
+
})
|
666
|
+
access_id = result["AccessID"]
|
667
|
+
access_pass = result["AccessPass"]
|
668
|
+
@service.exec_tran_brandtoken({
|
669
|
+
:order_id => order_id,
|
670
|
+
:access_id => access_id,
|
671
|
+
:access_pass => access_pass,
|
672
|
+
:token_type => :apple_pay,
|
673
|
+
:token => 'base64encodedtoken'
|
674
|
+
})
|
675
|
+
result = @service.change_tran_brandtoken({
|
676
|
+
:order_id => order_id,
|
677
|
+
:access_id => access_id,
|
678
|
+
:access_pass => access_pass,
|
679
|
+
:job_cd => "CAPTURE",
|
680
|
+
:amount => 1500
|
681
|
+
})
|
682
|
+
result["AccessID"].nil?.should_not be true
|
683
|
+
result["AccessPass"].nil?.should_not be true
|
684
|
+
result["Status"].nil?.should_not be true
|
685
|
+
result["Forward"].nil?.should_not be true
|
686
|
+
result["Approve"].nil?.should_not be true
|
687
|
+
result["TranID"].nil?.should_not be true
|
688
|
+
result["TranDate"].nil?.should_not be true
|
689
|
+
end
|
690
|
+
|
691
|
+
it "got error if missing options", :vcr do
|
692
|
+
lambda {
|
693
|
+
result = @service.change_tran_brandtoken()
|
694
|
+
}.should raise_error('Required access_id, access_pass, order_id, job_cd, amount were not provided.')
|
695
|
+
end
|
696
|
+
end
|
697
|
+
|
698
|
+
describe "#void_tran_brandtoken" do
|
699
|
+
it "gets data about order", :vcr do
|
700
|
+
order_id = generate_id
|
701
|
+
result = @service.entry_tran_brandtoken({
|
702
|
+
:order_id => order_id,
|
703
|
+
:job_cd => "AUTH",
|
704
|
+
:amount => 100
|
705
|
+
})
|
706
|
+
access_id = result["AccessID"]
|
707
|
+
access_pass = result["AccessPass"]
|
708
|
+
@service.exec_tran_brandtoken({
|
709
|
+
:order_id => order_id,
|
710
|
+
:access_id => access_id,
|
711
|
+
:access_pass => access_pass,
|
712
|
+
:token_type => :apple_pay,
|
713
|
+
:token => 'base64encodedtoken'
|
714
|
+
})
|
715
|
+
result = @service.void_tran_brandtoken({
|
716
|
+
:order_id => order_id,
|
717
|
+
:access_id => access_id,
|
718
|
+
:access_pass => access_pass
|
719
|
+
})
|
720
|
+
result["AccessID"].nil?.should_not be true
|
721
|
+
result["AccessPass"].nil?.should_not be true
|
722
|
+
result["Status"].nil?.should_not be true
|
723
|
+
result["Forward"].nil?.should_not be true
|
724
|
+
result["Approve"].nil?.should_not be true
|
725
|
+
result["TranID"].nil?.should_not be true
|
726
|
+
result["TranDate"].nil?.should_not be true
|
727
|
+
end
|
728
|
+
|
729
|
+
it "got error if missing options", :vcr do
|
730
|
+
lambda {
|
731
|
+
result = @service.void_tran_brandtoken()
|
732
|
+
}.should raise_error('Required access_id, access_pass, order_id were not provided.')
|
733
|
+
end
|
734
|
+
end
|
735
|
+
|
736
|
+
describe "#sales_tran_brandtoken" do
|
737
|
+
it "gets data about a transaction", :vcr do
|
738
|
+
order_id = generate_id
|
739
|
+
result = @service.entry_tran_brandtoken({
|
740
|
+
:order_id => order_id,
|
741
|
+
:job_cd => "AUTH",
|
742
|
+
:amount => 1000
|
743
|
+
})
|
744
|
+
access_id = result["AccessID"]
|
745
|
+
access_pass = result["AccessPass"]
|
746
|
+
@service.exec_tran_brandtoken({
|
747
|
+
:order_id => order_id,
|
748
|
+
:access_id => access_id,
|
749
|
+
:access_pass => access_pass,
|
750
|
+
:token_type => :apple_pay,
|
751
|
+
:token => 'base64encodedtoken'
|
752
|
+
})
|
753
|
+
member_id = generate_id
|
754
|
+
@shop_site.trade_brandtoken({
|
755
|
+
:member_id => member_id,
|
756
|
+
:order_id => order_id
|
757
|
+
})
|
758
|
+
result = @service.sales_tran_brandtoken({
|
759
|
+
:access_id => access_id,
|
760
|
+
:access_pass => access_pass,
|
761
|
+
:order_id => order_id,
|
762
|
+
:amount => 1000
|
763
|
+
})
|
764
|
+
result["AccessID"].nil?.should_not be true
|
765
|
+
result["AccessPass"].nil?.should_not be true
|
766
|
+
result["Status"].nil?.should_not be true
|
767
|
+
result["Forward"].nil?.should_not be true
|
768
|
+
result["Approve"].nil?.should_not be true
|
769
|
+
result["TranID"].nil?.should_not be true
|
770
|
+
result["TranDate"].nil?.should_not be true
|
771
|
+
end
|
772
|
+
|
773
|
+
it "got error if missing options", :vcr do
|
774
|
+
lambda {
|
775
|
+
result = @service.sales_tran_brandtoken()
|
776
|
+
}.should raise_error('Required access_id, access_pass, order_id, amount were not provided.')
|
777
|
+
end
|
778
|
+
end
|
779
|
+
|
780
|
+
describe "#refund_tran_brandtoken" do
|
781
|
+
it "gets data about a transaction", :vcr do
|
782
|
+
order_id = generate_id
|
783
|
+
result = @service.entry_tran_brandtoken({
|
784
|
+
:order_id => order_id,
|
785
|
+
:job_cd => "CAPTURE",
|
786
|
+
:amount => 1000
|
787
|
+
})
|
788
|
+
access_id = result["AccessID"]
|
789
|
+
access_pass = result["AccessPass"]
|
790
|
+
@service.exec_tran_brandtoken({
|
791
|
+
:order_id => order_id,
|
792
|
+
:access_id => access_id,
|
793
|
+
:access_pass => access_pass,
|
794
|
+
:token_type => :apple_pay,
|
795
|
+
:token => 'base64encodedtoken'
|
796
|
+
})
|
797
|
+
result = @service.refund_tran_brandtoken({
|
798
|
+
:access_id => access_id,
|
799
|
+
:access_pass => access_pass,
|
800
|
+
:order_id => order_id,
|
801
|
+
:amount => 1000
|
802
|
+
})
|
803
|
+
result["AccessID"].nil?.should_not be true
|
804
|
+
result["AccessPass"].nil?.should_not be true
|
805
|
+
result["Status"].nil?.should_not be true
|
806
|
+
result["Forward"].nil?.should_not be true
|
807
|
+
result["Approve"].nil?.should_not be true
|
808
|
+
result["TranID"].nil?.should_not be true
|
809
|
+
result["TranDate"].nil?.should_not be true
|
810
|
+
end
|
811
|
+
|
812
|
+
it "got error if missing options", :vcr do
|
813
|
+
lambda {
|
814
|
+
result = @service.refund_tran_brandtoken()
|
815
|
+
}.should raise_error('Required access_id, access_pass, order_id, amount were not provided.')
|
816
|
+
end
|
817
|
+
end
|
818
|
+
|
819
|
+
describe "#cvs_cancel" do
|
820
|
+
it "gets data about a transaction", :vcr do
|
821
|
+
order_id = generate_id
|
822
|
+
result = @service.entry_tran_cvs({
|
823
|
+
:order_id => order_id,
|
824
|
+
:amount => 100
|
825
|
+
})
|
826
|
+
access_id = result["AccessID"]
|
827
|
+
access_pass = result["AccessPass"]
|
828
|
+
result = @service.cvs_cancel({
|
829
|
+
:order_id => order_id,
|
830
|
+
:access_id => access_id,
|
831
|
+
:access_pass => access_pass,
|
832
|
+
})
|
833
|
+
|
834
|
+
result["OrderID"].nil?.should_not be_truthy
|
835
|
+
result["Status"].nil?.should_not be_truthy
|
836
|
+
end
|
837
|
+
|
838
|
+
it "got error if missing options", :vcr do
|
839
|
+
lambda {
|
840
|
+
result = @service.cvs_cancel()
|
841
|
+
}.should raise_error("Required access_id, access_pass, order_id were not provided.")
|
842
|
+
end
|
843
|
+
end
|
416
844
|
|
417
845
|
describe "#search_trade" do
|
418
846
|
it "gets data about order", :vcr do
|