gmo 0.5.4 → 0.5.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +39 -0
- data/CHANGELOG.md +8 -0
- data/Gemfile +3 -4
- data/README.md +3 -3
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_cancel_deposit_gets_data_about_a_deposit.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_cancel_link_redirect_url_with_invalid_options_got_error.yml +53 -0
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_cancel_link_redirect_url_with_valid_options_gets_data_about_a_link_edirect_url.yml +103 -0
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_cancel_mail_deposit_gets_data_about_a_mail_deposit.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_create_account_gets_data_about_an_account.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_create_deposit_gets_data_about_a_deposit.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_create_link_redirect_url_with_valid_options_gets_data_about_link_redirect_url.yml +53 -0
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_create_mail_deposit_with_valid_options_gets_data_about_a_mail_deposit.yml +47 -0
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_create_mail_deposit_with_valid_options_makes_request_with_correct_parameters.yml +47 -0
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_delete_account_gets_data_about_an_account.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_search_account_gets_data_about_an_account.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_search_balance_gets_data_about_balance.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_search_deposit_gets_data_about_a_deposit.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_search_mail_deposit_gets_data_about_a_mail_deposit.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_update_account_gets_data_about_an_account.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_alter_tran_change_order_auth_to_sale.yml +3 -3
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_alter_tran_gets_data_about_order.yml +3 -3
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_alter_tran_got_error_if_missing_options.yml +1 -1
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_change_tran_brandtoken_gets_data_about_order.yml +6 -6
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_change_tran_gets_data_about_order.yml +3 -3
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_change_tran_got_error_if_missing_options.yml +1 -1
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_cvs_cancel_gets_data_about_a_transaction.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_brandtoken_gets_data_about_a_transaction.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_cvs_gets_data_about_a_transaction.yml +1 -1
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_cvs_got_error_if_missing_options.yml +1 -1
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_docomo_gets_data_about_a_transaction.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_edy_gets_data_about_a_transaction.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_ganb_gets_data_about_a_transaction.yml +35 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_gets_data_about_a_transaction.yml +1 -1
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_got_error_if_missing_options.yml +1 -1
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_linepay_gets_data_about_a_transaction.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_pay_easy_gets_data_about_a_transaction.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_paypal_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 +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_suica_gets_data_about_a_transaction.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_virtualaccount_gets_data_about_a_transaction.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_brandtoken_gets_data_about_a_transaction.yml +4 -4
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_brandtoken_parameter_contains_Japanese_characters_should_correctly_handle_Japanese.yml +5 -5
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_cvs_gets_data_about_a_transaction.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_docomo_gets_data_about_a_transaction.yml +4 -4
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_doesn_t_require_card_info_if_token_is_present.yml +4 -4
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_edy_gets_data_about_a_transaction.yml +4 -4
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_ganb_gets_data_about_a_transaction.yml +68 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_gets_data_about_a_transaction.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_got_error_if_missing_options.yml +1 -1
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_linepay_gets_data_about_a_transaction.yml +4 -4
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_parameter_contains_Japanese_characters_should_correctly_handle_Japanese.yml +3 -3
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_pay_easy_gets_data_about_a_transaction.yml +4 -4
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_paypal_gets_data_about_a_transaction.yml +67 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_rakuten_id_gets_data_about_a_transaction.yml +4 -4
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_suica_gets_data_about_a_transaction.yml +4 -4
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_virtualaccount_gets_data_about_a_transaction.yml +3 -3
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_refund_tran_brandtoken_gets_data_about_a_transaction.yml +6 -6
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_sales_tran_brandtoken_gets_data_about_a_transaction.yml +8 -8
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_search_trade_gets_data_about_order.yml +1 -1
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_search_trade_got_error_if_missing_options.yml +1 -1
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_search_trade_multi_gets_data_about_order.yml +1 -1
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_search_trade_multi_got_error_if_missing_options.yml +1 -1
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_secure_tran_gets_data_about_a_transaction.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_void_tran_brandtoken_gets_data_about_order.yml +6 -6
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAndSiteAPI/_exec_tran_brandtoken_got_data.yml +4 -4
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAndSiteAPI/_register_recurring_credit_got_data.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAndSiteAPI/_trade_brandtoken_got_data.yml +6 -6
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAndSiteAPI/_trade_card_got_data.yml +8 -8
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAndSiteAPI/_trade_card_got_error_if_missing_options.yml +1 -1
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAndSiteAPI/_unregister_recurring_success_unregister.yml +4 -4
- data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_delete_brandtoken_gets_data_about_a_brandtoken.yml +4 -4
- data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_delete_card_gets_data_about_a_card.yml +1 -1
- data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_delete_member_gets_data_about_a_member.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_save_card_doesn_t_require_card_info_if_token_is_present.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_save_card_gets_data_about_a_card.yml +1 -1
- data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_save_member_gets_data_about_a_transaction.yml +1 -1
- data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_search_brandtoken_gets_data_about_a_brandtoken.yml +4 -4
- data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_search_card_detail_by_member_id_gets_data_about_card_detail.yml +1 -1
- data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_search_card_gets_data_about_a_card.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_search_member_gets_data_about_a_member.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_update_member_gets_data_about_a_transaction.yml +1 -1
- data/lib/gmo/const.rb +15 -0
- data/lib/gmo/http_services.rb +6 -1
- data/lib/gmo/remittance_api.rb +63 -1
- data/lib/gmo/shop_api.rb +40 -0
- data/lib/gmo/version.rb +1 -1
- data/lib/gmo.rb +11 -4
- data/spec/gmo/remittance_api_spec.rb +123 -36
- data/spec/gmo/shop_api_spec.rb +108 -5
- data/spec/spec_helper.rb +2 -5
- metadata +16 -9
- data/.travis.yml +0 -21
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_create_mail_deposit_gets_data_about_a_mail_deposit.yml +0 -38
- data/spec/support/encoding.rb +0 -33
@@ -376,54 +376,76 @@ describe "GMO::Payment::RemittanceAPI" do
|
|
376
376
|
end
|
377
377
|
|
378
378
|
describe "#create_mail_deposit" do
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
379
|
+
subject(:do_api_call) { @service.create_mail_deposit(options) }
|
380
|
+
|
381
|
+
context 'with valid options', :vcr do
|
382
|
+
let(:options) do
|
383
|
+
{
|
384
|
+
:deposit_id => "dep00001",
|
385
|
+
:deposit_email => "anyutzy@demo.com",
|
386
|
+
:amount => 1000,
|
387
|
+
:deposit_account_name => "An Yutzy",
|
388
|
+
:expire => 5,
|
389
|
+
:deposit_shop_email => "anyutzy@demo.com",
|
390
|
+
:auth_code => "auth00001",
|
391
|
+
:auth_code_2 => "auth00002",
|
392
|
+
:auth_code_3 => "auth00003",
|
393
|
+
:remit_method_bank => "1",
|
394
|
+
:mail_template_free_1 => "mail_template_free_1",
|
395
|
+
:mail_template_free_2 => "mail_template_free_2",
|
396
|
+
:mail_template_free_3 => "mail_template_free_3",
|
397
|
+
:mail_template_number => 1,
|
398
|
+
:bank_id => "bank_id00001",
|
399
|
+
:select_key => "select00001",
|
400
|
+
:client_name => "イライニンタロウ",
|
401
|
+
}
|
402
|
+
end
|
389
403
|
|
390
|
-
|
391
|
-
result = do_api_call
|
392
|
-
result["Deposit_ID"].nil?.should_not be_truthy
|
393
|
-
result["Method"].nil?.should_not be_truthy
|
394
|
-
result["Amount"].nil?.should_not be_truthy
|
395
|
-
result["Expire"].nil?.should_not be_truthy
|
396
|
-
end
|
404
|
+
before { allow(GMO).to receive(:make_request).and_call_original }
|
397
405
|
|
398
|
-
|
399
|
-
|
400
|
-
|
406
|
+
it "gets data about a mail deposit" do
|
407
|
+
result = do_api_call
|
408
|
+
expect(result["Deposit_ID"]).to eq options[:deposit_id]
|
409
|
+
expect(result["Method"]).to eq "1"
|
410
|
+
expect(result["Amount"]).to eq options[:amount].to_s
|
411
|
+
expect(result["Expire"]).not_to be_nil
|
412
|
+
end
|
401
413
|
|
402
|
-
it "makes request with correct parameters"
|
414
|
+
it "makes request with correct parameters" do
|
415
|
+
do_api_call
|
403
416
|
path = "/api/MailDepositRegistration.idPass"
|
404
417
|
args = {
|
405
|
-
"Deposit_ID" =>
|
406
|
-
"Mail_Address" =>
|
407
|
-
"Amount" =>
|
408
|
-
"Mail_Deposit_Account_Name" =>
|
409
|
-
"Expire" =>
|
410
|
-
"Shop_Mail_Address" =>
|
418
|
+
"Deposit_ID" => options[:deposit_id],
|
419
|
+
"Mail_Address" => options[:deposit_email],
|
420
|
+
"Amount" => options[:amount],
|
421
|
+
"Mail_Deposit_Account_Name" => options[:deposit_account_name],
|
422
|
+
"Expire" => options[:expire],
|
423
|
+
"Shop_Mail_Address" => options[:deposit_shop_email],
|
424
|
+
"Auth_Code" => options[:auth_code],
|
425
|
+
"Auth_Code2" => options[:auth_code_2],
|
426
|
+
"Auth_Code3" => options[:auth_code_3],
|
427
|
+
"Remit_Method_Bank" => options[:remit_method_bank],
|
428
|
+
"Mail_Template_Free1" => options[:mail_template_free_1],
|
429
|
+
"Mail_Template_Free2" => options[:mail_template_free_2],
|
430
|
+
"Mail_Template_Free3" => options[:mail_template_free_3],
|
431
|
+
"Mail_Template_Number" => options[:mail_template_number],
|
432
|
+
"Bank_ID" => options[:bank_id],
|
433
|
+
"Select_Key" => options[:select_key],
|
434
|
+
"Client_Name" => options[:client_name],
|
411
435
|
"Method" => 1,
|
412
436
|
"Shop_ID" => @service.shop_id,
|
413
437
|
"Shop_Pass" => @service.shop_pass
|
414
438
|
}
|
415
|
-
|
416
|
-
options = { :host => @service.host }
|
417
|
-
expect(GMO).to receive(:make_request).with(path, args, verb, options)
|
439
|
+
expect(GMO).to have_received(:make_request).with(path, args, "post", { :host => @service.host })
|
418
440
|
end
|
419
|
-
|
420
|
-
after { do_api_call }
|
421
441
|
end
|
422
442
|
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
443
|
+
context "with invalid options" do
|
444
|
+
let(:options) { {} }
|
445
|
+
|
446
|
+
it "got error" do
|
447
|
+
expect { do_api_call }.to raise_error("Required deposit_id, deposit_email, amount, expire, deposit_shop_email were not provided.")
|
448
|
+
end
|
427
449
|
end
|
428
450
|
end
|
429
451
|
|
@@ -503,4 +525,69 @@ describe "GMO::Payment::RemittanceAPI" do
|
|
503
525
|
end
|
504
526
|
end
|
505
527
|
|
528
|
+
describe "#create_link_redirect_url" do
|
529
|
+
subject(:do_api_call) { @service.create_link_redirect_url(options) }
|
530
|
+
|
531
|
+
context 'with valid options', :vcr do
|
532
|
+
let(:deposit_id) { "dep00001" }
|
533
|
+
let(:options) do
|
534
|
+
{
|
535
|
+
deposit_id: deposit_id,
|
536
|
+
call_back_url: "https://example.com/callback",
|
537
|
+
amount: "1000",
|
538
|
+
auth_code: "auth00005",
|
539
|
+
auth_code_2: "auth00002",
|
540
|
+
auth_code_3: "auth00003",
|
541
|
+
remit_method_bank: "1",
|
542
|
+
remit_method_sevenatm: "1",
|
543
|
+
sevenatm_payment_term_day: "15",
|
544
|
+
remit_method_amazongift: "1",
|
545
|
+
remit_method_aupay: "1",
|
546
|
+
bank_id: "bank_id00001",
|
547
|
+
client_name: "リンクユーアールエル",
|
548
|
+
}
|
549
|
+
end
|
550
|
+
|
551
|
+
it "gets data about link redirect url" do
|
552
|
+
result = do_api_call
|
553
|
+
expect(result["Deposit_ID"]).to eq(deposit_id)
|
554
|
+
expect(result["Redirect_Url"]).not_to be_nil
|
555
|
+
expect(result["Method"]).to eq("1")
|
556
|
+
end
|
557
|
+
end
|
558
|
+
|
559
|
+
context "with invalid options", :vcr do
|
560
|
+
let(:options) { {} }
|
561
|
+
|
562
|
+
it "got error" do
|
563
|
+
expect { do_api_call }.to raise_error("Required deposit_id, call_back_url, amount, auth_code were not provided.")
|
564
|
+
end
|
565
|
+
end
|
566
|
+
end
|
567
|
+
|
568
|
+
describe "#cancel_link_redirect_url" do
|
569
|
+
subject (:do_api_call) { @service.cancel_link_redirect_url(options) }
|
570
|
+
|
571
|
+
before { @service.create_link_redirect_url(deposit_id: deposit_id, call_back_url: 'https://example.com/callback', amount: '100', auth_code: 'AUTH001') }
|
572
|
+
|
573
|
+
context 'with valid options', :vcr do
|
574
|
+
let(:options) { { deposit_id: deposit_id } }
|
575
|
+
let(:deposit_id) { "dep00001" }
|
576
|
+
|
577
|
+
it "gets data about a link edirect url" do
|
578
|
+
result = do_api_call
|
579
|
+
expect(result["Deposit_ID"]).not_to be_nil
|
580
|
+
expect(result["Method"]).to eq "2"
|
581
|
+
end
|
582
|
+
end
|
583
|
+
|
584
|
+
context "with invalid options", :vcr do
|
585
|
+
let(:options) { {} }
|
586
|
+
let(:deposit_id) { "dep00001" }
|
587
|
+
|
588
|
+
it "got error" do
|
589
|
+
expect { do_api_call }.to raise_error("Required deposit_id were not provided.")
|
590
|
+
end
|
591
|
+
end
|
592
|
+
end
|
506
593
|
end
|
data/spec/gmo/shop_api_spec.rb
CHANGED
@@ -98,6 +98,44 @@ describe "GMO::Payment::ShopAPI" do
|
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
101
|
+
describe "#entry_tran_paypal" do
|
102
|
+
it "gets data about a transaction", :vcr do
|
103
|
+
order_id = @order_id
|
104
|
+
result = @service.entry_tran_paypal({
|
105
|
+
:order_id => order_id,
|
106
|
+
:job_cd => 'CAPTURE',
|
107
|
+
:amount => 100
|
108
|
+
})
|
109
|
+
result["AccessID"].nil?.should_not be_truthy
|
110
|
+
result["AccessPass"].nil?.should_not be_truthy
|
111
|
+
end
|
112
|
+
|
113
|
+
it "got error if missing options", :vcr do
|
114
|
+
lambda {
|
115
|
+
result = @service.entry_tran_paypal()
|
116
|
+
}.should raise_error("Required order_id, job_cd, amount were not provided.")
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
describe "#entry_tran_ganb" do
|
121
|
+
it "gets data about a transaction", :vcr do
|
122
|
+
order_id = @order_id
|
123
|
+
result = @service.entry_tran_ganb({
|
124
|
+
:order_id => order_id,
|
125
|
+
:amount => 100
|
126
|
+
})
|
127
|
+
result["AccessID"].nil?.should_not be_truthy
|
128
|
+
result["AccessPass"].nil?.should_not be_truthy
|
129
|
+
end
|
130
|
+
|
131
|
+
it "got error if missing options", :vcr do
|
132
|
+
lambda {
|
133
|
+
result = @service.entry_tran_ganb()
|
134
|
+
}.should raise_error("Required order_id, amount were not provided.")
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
|
101
139
|
describe "#entry_tran_linepay" do
|
102
140
|
it "gets data about a transaction", :vcr do
|
103
141
|
order_id = @order_id
|
@@ -429,6 +467,72 @@ describe "GMO::Payment::ShopAPI" do
|
|
429
467
|
end
|
430
468
|
end
|
431
469
|
|
470
|
+
describe "#exec_tran_paypal" do
|
471
|
+
it "gets data about a transaction", :vcr do
|
472
|
+
order_id = generate_id
|
473
|
+
result = @service.entry_tran_paypal({
|
474
|
+
:order_id => order_id,
|
475
|
+
:job_cd => 'CAPTURE',
|
476
|
+
:amount => 100
|
477
|
+
})
|
478
|
+
access_id = result["AccessID"]
|
479
|
+
access_pass = result["AccessPass"]
|
480
|
+
result = @service.exec_tran_paypal({
|
481
|
+
:order_id => order_id,
|
482
|
+
:access_id => access_id,
|
483
|
+
:access_pass => access_pass,
|
484
|
+
:redirect_url => 'https://example.com/path/to/redirect',
|
485
|
+
:item_name => '購入する商品名'
|
486
|
+
})
|
487
|
+
result["OrderID"].nil?.should_not be_truthy
|
488
|
+
end
|
489
|
+
|
490
|
+
it "got error if missing options", :vcr do
|
491
|
+
lambda {
|
492
|
+
result = @service.exec_tran_paypal()
|
493
|
+
}.should raise_error("Required access_id, access_pass, order_id, item_name, redirect_url were not provided.")
|
494
|
+
end
|
495
|
+
end
|
496
|
+
|
497
|
+
describe "#exec_tran_ganb" do
|
498
|
+
it "gets data about a transaction", :vcr do
|
499
|
+
order_id = generate_id
|
500
|
+
result = @service.entry_tran_ganb({
|
501
|
+
:order_id => order_id,
|
502
|
+
:amount => 100
|
503
|
+
})
|
504
|
+
access_id = result["AccessID"]
|
505
|
+
access_pass = result["AccessPass"]
|
506
|
+
result = @service.exec_tran_ganb({
|
507
|
+
:order_id => order_id,
|
508
|
+
:access_id => access_id,
|
509
|
+
:access_pass => access_pass,
|
510
|
+
:client_field_1 => '加盟店自由項目1です。',
|
511
|
+
:client_field_2 => '加盟店自由項目2です。',
|
512
|
+
:client_field_3 => '加盟店自由項目3です。',
|
513
|
+
:account_holder_optional_name => 'コウザタロウ',
|
514
|
+
:trade_days => '3',
|
515
|
+
:trade_reason => '取引事由です。',
|
516
|
+
:trade_client_name => '依頼花子',
|
517
|
+
:trade_client_mailaddress => 'irai@example.com'
|
518
|
+
})
|
519
|
+
result["BankCode"].nil?.should_not be_truthy
|
520
|
+
result["BankName"].nil?.should_not be_truthy
|
521
|
+
result["BranchCode"].nil?.should_not be_truthy
|
522
|
+
result["BranchName"].nil?.should_not be_truthy
|
523
|
+
result["AccountType"].nil?.should_not be_truthy
|
524
|
+
result["AccountNumber"].nil?.should_not be_truthy
|
525
|
+
result["AccountHolderName"].nil?.should_not be_truthy
|
526
|
+
result["AvailableDate"].nil?.should_not be_truthy
|
527
|
+
end
|
528
|
+
|
529
|
+
it "got error if missing options", :vcr do
|
530
|
+
lambda {
|
531
|
+
result = @service.exec_tran_ganb()
|
532
|
+
}.should raise_error("Required access_id, access_pass, order_id were not provided.")
|
533
|
+
end
|
534
|
+
end
|
535
|
+
|
432
536
|
describe "#exec_tran_linepay" do
|
433
537
|
it "gets data about a transaction", :vcr do
|
434
538
|
order_id = generate_id
|
@@ -653,7 +757,7 @@ describe "GMO::Payment::ShopAPI" do
|
|
653
757
|
result["Approve"].nil?.should_not be true
|
654
758
|
result["TranID"].nil?.should_not be true
|
655
759
|
result["TranDate"].nil?.should_not be true
|
656
|
-
|
760
|
+
result["ClientField1"].should eq client_field_1
|
657
761
|
result["ClientField2"].nil?.should_not be true
|
658
762
|
result["ClientField3"].nil?.should_not be true
|
659
763
|
end
|
@@ -669,7 +773,6 @@ describe "GMO::Payment::ShopAPI" do
|
|
669
773
|
|
670
774
|
it "should correctly handle Japanese", :vcr do
|
671
775
|
order_id = generate_id
|
672
|
-
client_field_1 = "〜−¢£¬−‖①ほげほげhogehoge"
|
673
776
|
result = @service.entry_tran_brandtoken({
|
674
777
|
:order_id => order_id,
|
675
778
|
:job_cd => "AUTH",
|
@@ -683,7 +786,7 @@ describe "GMO::Payment::ShopAPI" do
|
|
683
786
|
:access_pass => access_pass,
|
684
787
|
:token_type => :apple_pay,
|
685
788
|
:token => 'base64encodedtoken',
|
686
|
-
:client_field_1 =>
|
789
|
+
:client_field_1 => 'カソウシテン'
|
687
790
|
})
|
688
791
|
result["Status"].nil?.should_not be true
|
689
792
|
result["OrderID"].nil?.should_not be true
|
@@ -691,8 +794,8 @@ describe "GMO::Payment::ShopAPI" do
|
|
691
794
|
result["Approve"].nil?.should_not be true
|
692
795
|
result["TranID"].nil?.should_not be true
|
693
796
|
result["TranDate"].nil?.should_not be true
|
694
|
-
|
695
|
-
|
797
|
+
result["ClientField1"].should eq "カソウシテン"
|
798
|
+
result["ClientField1"].encoding.name.should eq "UTF-8"
|
696
799
|
result["ClientField2"].nil?.should_not be true
|
697
800
|
result["ClientField3"].nil?.should_not be true
|
698
801
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -11,17 +11,14 @@ end
|
|
11
11
|
require 'gmo'
|
12
12
|
require 'rspec'
|
13
13
|
require 'vcr'
|
14
|
+
require 'pry'
|
14
15
|
require 'support/config_loader'
|
15
16
|
require 'support/factory'
|
16
17
|
require 'support/vcr'
|
17
18
|
|
18
|
-
if RUBY_VERSION < '1.9.0'
|
19
|
-
require 'support/encoding'
|
20
|
-
end
|
21
|
-
|
22
19
|
RSpec.configure do |config|
|
23
20
|
config.mock_with :rspec
|
24
21
|
config.treat_symbols_as_metadata_keys_with_true_values = true
|
25
22
|
config.filter_run :focus => true
|
26
23
|
config.run_all_when_everything_filtered = true
|
27
|
-
end
|
24
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gmo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tatsuo Kaniwa
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -102,8 +102,8 @@ extensions: []
|
|
102
102
|
extra_rdoc_files:
|
103
103
|
- README.md
|
104
104
|
files:
|
105
|
+
- ".github/workflows/ruby.yml"
|
105
106
|
- ".gitignore"
|
106
|
-
- ".travis.yml"
|
107
107
|
- CHANGELOG.md
|
108
108
|
- Gemfile
|
109
109
|
- LICENSE
|
@@ -112,10 +112,14 @@ files:
|
|
112
112
|
- Rakefile
|
113
113
|
- autotest/discover.rb
|
114
114
|
- fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_cancel_deposit_gets_data_about_a_deposit.yml
|
115
|
+
- fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_cancel_link_redirect_url_with_invalid_options_got_error.yml
|
116
|
+
- fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_cancel_link_redirect_url_with_valid_options_gets_data_about_a_link_edirect_url.yml
|
115
117
|
- fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_cancel_mail_deposit_gets_data_about_a_mail_deposit.yml
|
116
118
|
- fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_create_account_gets_data_about_an_account.yml
|
117
119
|
- fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_create_deposit_gets_data_about_a_deposit.yml
|
118
|
-
- fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/
|
120
|
+
- fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_create_link_redirect_url_with_valid_options_gets_data_about_link_redirect_url.yml
|
121
|
+
- fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_create_mail_deposit_with_valid_options_gets_data_about_a_mail_deposit.yml
|
122
|
+
- fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_create_mail_deposit_with_valid_options_makes_request_with_correct_parameters.yml
|
119
123
|
- fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_delete_account_gets_data_about_an_account.yml
|
120
124
|
- fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_search_account_gets_data_about_an_account.yml
|
121
125
|
- fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_search_balance_gets_data_about_balance.yml
|
@@ -134,10 +138,12 @@ files:
|
|
134
138
|
- fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_cvs_got_error_if_missing_options.yml
|
135
139
|
- fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_docomo_gets_data_about_a_transaction.yml
|
136
140
|
- fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_edy_gets_data_about_a_transaction.yml
|
141
|
+
- fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_ganb_gets_data_about_a_transaction.yml
|
137
142
|
- fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_gets_data_about_a_transaction.yml
|
138
143
|
- fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_got_error_if_missing_options.yml
|
139
144
|
- fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_linepay_gets_data_about_a_transaction.yml
|
140
145
|
- fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_pay_easy_gets_data_about_a_transaction.yml
|
146
|
+
- fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_paypal_gets_data_about_a_transaction.yml
|
141
147
|
- fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_rakuten_id_gets_data_about_a_transaction.yml
|
142
148
|
- fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_suica_gets_data_about_a_transaction.yml
|
143
149
|
- fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_virtualaccount_gets_data_about_a_transaction.yml
|
@@ -147,11 +153,13 @@ files:
|
|
147
153
|
- fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_docomo_gets_data_about_a_transaction.yml
|
148
154
|
- fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_doesn_t_require_card_info_if_token_is_present.yml
|
149
155
|
- fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_edy_gets_data_about_a_transaction.yml
|
156
|
+
- fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_ganb_gets_data_about_a_transaction.yml
|
150
157
|
- fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_gets_data_about_a_transaction.yml
|
151
158
|
- fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_got_error_if_missing_options.yml
|
152
159
|
- fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_linepay_gets_data_about_a_transaction.yml
|
153
160
|
- fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_parameter_contains_Japanese_characters_should_correctly_handle_Japanese.yml
|
154
161
|
- fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_pay_easy_gets_data_about_a_transaction.yml
|
162
|
+
- fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_paypal_gets_data_about_a_transaction.yml
|
155
163
|
- fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_rakuten_id_gets_data_about_a_transaction.yml
|
156
164
|
- fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_suica_gets_data_about_a_transaction.yml
|
157
165
|
- fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_virtualaccount_gets_data_about_a_transaction.yml
|
@@ -204,14 +212,13 @@ files:
|
|
204
212
|
- spec/support/config.example.yml
|
205
213
|
- spec/support/config.yml
|
206
214
|
- spec/support/config_loader.rb
|
207
|
-
- spec/support/encoding.rb
|
208
215
|
- spec/support/factory.rb
|
209
216
|
- spec/support/vcr.rb
|
210
217
|
homepage: https://github.com/t-k/gmo-payment-ruby
|
211
218
|
licenses:
|
212
219
|
- MIT
|
213
220
|
metadata: {}
|
214
|
-
post_install_message:
|
221
|
+
post_install_message:
|
215
222
|
rdoc_options:
|
216
223
|
- "--line-numbers"
|
217
224
|
- "--inline-source"
|
@@ -230,8 +237,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
230
237
|
- !ruby/object:Gem::Version
|
231
238
|
version: '0'
|
232
239
|
requirements: []
|
233
|
-
rubygems_version: 3.
|
234
|
-
signing_key:
|
240
|
+
rubygems_version: 3.4.1
|
241
|
+
signing_key:
|
235
242
|
specification_version: 4
|
236
243
|
summary: 'GMO Payment API client: Ruby client library for the GMO Payment Platform.'
|
237
244
|
test_files: []
|
data/.travis.yml
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
rvm:
|
3
|
-
- ruby-head
|
4
|
-
- 2.1
|
5
|
-
- 2.2
|
6
|
-
- 2.3
|
7
|
-
- 2.4
|
8
|
-
- 2.5
|
9
|
-
- 2.6
|
10
|
-
- 2.7
|
11
|
-
- jruby-18mode
|
12
|
-
- jruby-19mode
|
13
|
-
- jruby-head
|
14
|
-
before_install:
|
15
|
-
- gem update bundler
|
16
|
-
matrix:
|
17
|
-
allow_failures:
|
18
|
-
- rvm: ruby-head
|
19
|
-
- rvm: jruby-18mode
|
20
|
-
- rvm: jruby-19mode
|
21
|
-
- rvm: jruby-head
|
@@ -1,38 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: post
|
5
|
-
uri: https://<REMITTANCE_HOST>/api/MailDepositRegistration.idPass
|
6
|
-
body:
|
7
|
-
encoding: UTF-8
|
8
|
-
string: Deposit_ID=dep0000<SHOP_PASS>&Mail_Address=anyutzy%40demo.com&Amount=<SHOP_PASS>000&Mail_Deposit_Account_Name=An+Yutzy&Expire=5&Shop_Mail_Address=anyutzy%40demo.com&Method=<SHOP_PASS>&Shop_ID=<REMITTANCE_SHOP_ID>&Shop_Pass=<REMITTANCE_SHOP_PASS>
|
9
|
-
headers:
|
10
|
-
Accept-Encoding:
|
11
|
-
- gzip;q=<SHOP_PASS>.0,deflate;q=0.6,identity;q=0.3
|
12
|
-
Accept:
|
13
|
-
- "*/*"
|
14
|
-
User-Agent:
|
15
|
-
- Ruby
|
16
|
-
response:
|
17
|
-
status:
|
18
|
-
code: 200
|
19
|
-
message: OK
|
20
|
-
headers:
|
21
|
-
Server:
|
22
|
-
- nginx
|
23
|
-
Date:
|
24
|
-
- Mon, 0<SHOP_PASS> May 20<SHOP_PASS>7 05:58:27 GMT
|
25
|
-
Content-Type:
|
26
|
-
- text/plain;charset=Windows-3<SHOP_PASS>J
|
27
|
-
Transfer-Encoding:
|
28
|
-
- chunked
|
29
|
-
Connection:
|
30
|
-
- close
|
31
|
-
X-Frame-Options:
|
32
|
-
- SAMEORIGIN
|
33
|
-
body:
|
34
|
-
encoding: UTF-8
|
35
|
-
string: Deposit_ID=dep00001&Method=1&Amount=1000&Expire=20170503
|
36
|
-
http_version:
|
37
|
-
recorded_at: Mon, 01 May 2017 05:58:27 GMT
|
38
|
-
recorded_with: VCR 3.0.3
|
data/spec/support/encoding.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'kconv'
|
2
|
-
|
3
|
-
class String
|
4
|
-
@encoding = nil
|
5
|
-
|
6
|
-
def encoding
|
7
|
-
if @encoding != nil then
|
8
|
-
return @encoding
|
9
|
-
else
|
10
|
-
case Kconv.guess(self)
|
11
|
-
when Kconv::JIS
|
12
|
-
return "ISO-2022-JP"
|
13
|
-
when Kconv::SJIS
|
14
|
-
return "Shift_JIS"
|
15
|
-
when Kconv::EUC
|
16
|
-
return "EUC-JP"
|
17
|
-
when Kconv::ASCII
|
18
|
-
return "ASCII"
|
19
|
-
when Kconv::UTF8
|
20
|
-
return "UTF-8"
|
21
|
-
when Kconv::UTF16
|
22
|
-
return "UTF-16BE"
|
23
|
-
when Kconv::UNKNOWN
|
24
|
-
return nil
|
25
|
-
when Kconv::BINARY
|
26
|
-
return nil
|
27
|
-
else
|
28
|
-
return nil
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|