Skip to content

Commit

Permalink
銀行振込(バーチャル口座 あおぞら)の追加
Browse files Browse the repository at this point in the history
  • Loading branch information
ken1flan committed Oct 4, 2023
1 parent c1921d0 commit ddc0c95
Show file tree
Hide file tree
Showing 4 changed files with 181 additions and 0 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions lib/gmo/shop_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,16 @@ def entry_tran_paypal(options = {})
post_request name, options
end

# 【銀行振込(バーチャル口座 あおぞら)】
# 取引登録
# オーダーIDを指定して取引を登録します。
def entry_tran_ganb(options = {})
name = "EntryTranGANB.idPass"
required = [:order_id, :amount]
assert_required_options(required, options)
post_request name, options
end

# 【LINE Pay決済】
# 20.1.2.1. 取引登録
# これ以降の決済取引で必要となる取引IDと取引パスワードの発行を行い、取引を開始します。
Expand Down Expand Up @@ -342,6 +352,16 @@ def exec_tran_paypal(options = {})
post_request name, options
end

# 【銀行振込(バーチャル口座 あおぞら)】
# 決済実行
# 登録された取引に対してバーチャル口座を発行します。
def exec_tran_ganb(options = {})
name = "ExecTranGANB.idPass"
required = [:access_id, :access_pass, :order_id]
assert_required_options(required, options)
post_request name, options
end

# 【LINE Pay決済】
# 20.1.2.2. 決済実行
def exec_tran_linepay(options = {})
Expand Down
58 changes: 58 additions & 0 deletions spec/gmo/shop_api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,25 @@
end
end

describe "#entry_tran_ganb" do
it "gets data about a transaction", :vcr do
order_id = @order_id
result = @service.entry_tran_ganb({
:order_id => order_id,
:amount => 100
})
result["AccessID"].nil?.should_not be_truthy
result["AccessPass"].nil?.should_not be_truthy
end

it "got error if missing options", :vcr do
lambda {
result = @service.entry_tran_ganb()
}.should raise_error("Required order_id, amount were not provided.")
end
end


describe "#entry_tran_linepay" do
it "gets data about a transaction", :vcr do
order_id = @order_id
Expand Down Expand Up @@ -475,6 +494,45 @@
end
end

describe "#exec_tran_ganb" do
it "gets data about a transaction", :vcr do
order_id = generate_id
result = @service.entry_tran_ganb({
:order_id => order_id,
:amount => 100
})
access_id = result["AccessID"]
access_pass = result["AccessPass"]
result = @service.exec_tran_ganb({
:order_id => order_id,
:access_id => access_id,
:access_pass => access_pass,
:client_field_1 => '加盟店自由項目1です。',
:client_field_2 => '加盟店自由項目2です。',
:client_field_3 => '加盟店自由項目3です。',
:account_holder_optional_name => 'コウザタロウ',
:trade_days => '3',
:trade_reason => '取引事由です。',
:trade_client_name => '依頼花子',
:trade_client_mailaddress => 'irai@example.com'
})
result["BankCode"].nil?.should_not be_truthy
result["BankName"].nil?.should_not be_truthy
result["BranchCode"].nil?.should_not be_truthy
result["BranchName"].nil?.should_not be_truthy
result["AccountType"].nil?.should_not be_truthy
result["AccountNumber"].nil?.should_not be_truthy
result["AccountHolderName"].nil?.should_not be_truthy
result["AvailableDate"].nil?.should_not be_truthy
end

it "got error if missing options", :vcr do
lambda {
result = @service.exec_tran_ganb()
}.should raise_error("Required access_id, access_pass, order_id were not provided.")
end
end

describe "#exec_tran_linepay" do
it "gets data about a transaction", :vcr do
order_id = generate_id
Expand Down

0 comments on commit ddc0c95

Please sign in to comment.