gmo_payment 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.coveralls.yml +1 -0
- data/.editorconfig +12 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +20 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +17 -0
- data/MIT-LICENSE +22 -0
- data/README.md +101 -0
- data/Rakefile +7 -0
- data/gmo_payment.gemspec +22 -0
- data/lib/generators/gmo_payment/install_generator.rb +15 -0
- data/lib/generators/gmo_payment/templates/ja.yml +246 -0
- data/lib/gmo_payment/client/options.rb +39 -0
- data/lib/gmo_payment/client/request.rb +294 -0
- data/lib/gmo_payment/client/response.rb +205 -0
- data/lib/gmo_payment/client.rb +538 -0
- data/lib/gmo_payment/configure.rb +30 -0
- data/lib/gmo_payment/errors.rb +95 -0
- data/lib/gmo_payment/glossary.rb +66 -0
- data/lib/gmo_payment/version.rb +3 -0
- data/lib/gmo_payment.rb +31 -0
- data/spec/cassettes/GmoPayment_Client/_auth_to_sales/return_6_items.yml +120 -0
- data/spec/cassettes/GmoPayment_Client/_call/with_ResponseHTTPError/raise_ResponseHTTPError.yml +46 -0
- data/spec/cassettes/GmoPayment_Client/_call/with_ResponseHasErrCodeError/raise_ResponseHTTPError.yml +48 -0
- data/spec/cassettes/GmoPayment_Client/_change_tran/return_6_items.yml +120 -0
- data/spec/cassettes/GmoPayment_Client/_delete_card/return_1_items.yml +114 -0
- data/spec/cassettes/GmoPayment_Client/_delete_member/return_1_items.yml +77 -0
- data/spec/cassettes/GmoPayment_Client/_delete_tran/return_6_items.yml +120 -0
- data/spec/cassettes/GmoPayment_Client/_entry_tran/return_2_items.yml +40 -0
- data/spec/cassettes/GmoPayment_Client/_entry_tran_btc/return_2_items.yml +42 -0
- data/spec/cassettes/GmoPayment_Client/_exec_tran/return_12_items.yml +83 -0
- data/spec/cassettes/GmoPayment_Client/_exec_tran_3d/return_4_items.yml +77 -0
- data/spec/cassettes/GmoPayment_Client/_exec_tran_btc/return_3_items.yml +81 -0
- data/spec/cassettes/GmoPayment_Client/_exec_tran_member/return_12_items.yml +157 -0
- data/spec/cassettes/GmoPayment_Client/_exec_tran_member_3d/return_4_items.yml +151 -0
- data/spec/cassettes/GmoPayment_Client/_get_rate_btc/return_1_item.yml +42 -0
- data/spec/cassettes/GmoPayment_Client/_re_exec_tran/return_6_items.yml +157 -0
- data/spec/cassettes/GmoPayment_Client/_save_card/return_3_items.yml +77 -0
- data/spec/cassettes/GmoPayment_Client/_save_member/return_1_items.yml +40 -0
- data/spec/cassettes/GmoPayment_Client/_save_traded_card/return_3_items.yml +157 -0
- data/spec/cassettes/GmoPayment_Client/_search_card/return_7_items.yml +114 -0
- data/spec/cassettes/GmoPayment_Client/_search_member/return_3_items.yml +77 -0
- data/spec/cassettes/GmoPayment_Client/_search_trade/return_21_items.yml +77 -0
- data/spec/cassettes/GmoPayment_Client/_search_trade_btc/return_11_items.yml +79 -0
- data/spec/cassettes/GmoPayment_Client/_secure_tran/return_11_items.yml +120 -0
- data/spec/cassettes/GmoPayment_Client/_update_card/return_3_items.yml +114 -0
- data/spec/cassettes/GmoPayment_Client/_update_member/return_1_items.yml +77 -0
- data/spec/cassettes/GmoPayment_Client_Response/GmoPayment_GLOSSARY_keys_to_method/return_body_values_if_body_match_Hash_keys_and_GLOSSARY_keys.yml +46 -0
- data/spec/cassettes/GmoPayment_Client_Response/_body/with_prebody_match_Hash_keys_and_GLOSSARY_keys/return_Hash_keys_Symbol_and_values_as_it_is.yml +46 -0
- data/spec/cassettes/GmoPayment_Client_Response/_body/without_prebody_match_Hash_keys_and_GLOSSARY_keys/return_Hash_keys_String_and_values_as_it_is.yml +46 -0
- data/spec/cassettes/GmoPayment_Client_Response/_encoded_raw_body/return_String_of_encoded_Shift_JIS_to_UTF-8.yml +46 -0
- data/spec/cassettes/GmoPayment_Client_Response/_error_/with_ErrCode/return_true.yml +46 -0
- data/spec/cassettes/GmoPayment_Client_Response/_error_/without_ErrCode/return_false.yml +46 -0
- data/spec/cassettes/GmoPayment_Client_Response/_http_code/return_Integer_of_HTTP_status_code.yml +46 -0
- data/spec/cassettes/GmoPayment_Client_Response/_http_error_/with_2xx/return_false.yml +46 -0
- data/spec/cassettes/GmoPayment_Client_Response/_http_error_/without_2xx/return_true.yml +44 -0
- data/spec/cassettes/GmoPayment_Client_Response/_http_header/return_Hash_of_HTTP_header.yml +46 -0
- data/spec/cassettes/GmoPayment_Client_Response/_http_message/return_String_of_HTTP_message.yml +46 -0
- data/spec/cassettes/GmoPayment_Client_Response/_prebody/with_ErrCode/behaves_like_getting_Hash_values_Array/return_Hash_keys_String_and_values_Array.yml +46 -0
- data/spec/cassettes/GmoPayment_Client_Response/_prebody/with_called_return_array_true/behaves_like_getting_Hash_values_Array/return_Hash_keys_String_and_values_Array.yml +46 -0
- data/spec/cassettes/GmoPayment_Client_Response/_prebody/with_no_ErroCode_and_called_return_array_false/return_Hash_keys_and_values_String.yml +46 -0
- data/spec/cassettes/GmoPayment_Client_Response/_raw_body/return_String_of_HTTP_response_body_as_it_is.yml +46 -0
- data/spec/cassettes/GmoPayment_Client_Response/_split_encoded_raw_body/behaves_like_URI_decode_www_form/with_response_body_have_invalid_parameters_to_split/return_empty_Array.yml +46 -0
- data/spec/cassettes/GmoPayment_Client_Response/_split_encoded_raw_body/behaves_like_URI_decode_www_form/with_response_body_have_only_GLOSSARY_keys/return_predefined_Array_format.yml +46 -0
- data/spec/cassettes/GmoPayment_Client_Response/_split_encoded_raw_body_/behaves_like_URI_decode_www_form/with_response_body_have_invalid_parameters_to_split/return_empty_Array.yml +46 -0
- data/spec/cassettes/GmoPayment_Client_Response/_split_encoded_raw_body_/behaves_like_URI_decode_www_form/with_response_body_have_only_GLOSSARY_keys/return_predefined_Array_format.yml +46 -0
- data/spec/cassettes/GmoPayment_Client_Response/_split_encoded_raw_body_/with_response_body_have_not_only_GLOSSARY_keys/returns_predefined_Array_format_without_GLOSSARY_keys.yml +46 -0
- data/spec/gmo_payment/client/options_spec.rb +107 -0
- data/spec/gmo_payment/client/request_spec.rb +403 -0
- data/spec/gmo_payment/client/response_spec.rb +280 -0
- data/spec/gmo_payment/client_spec.rb +809 -0
- data/spec/gmo_payment/configure_spec.rb +90 -0
- data/spec/gmo_payment/errors_spec.rb +118 -0
- data/spec/gmo_payment/glossary_spec.rb +15 -0
- data/spec/gmo_payment_spec.rb +22 -0
- data/spec/spec_helper.rb +70 -0
- data/spec/support/request_validation.rb +71 -0
- metadata +179 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
require 'spec_helper'
|
|
3
|
+
|
|
4
|
+
describe GmoPayment::Configure do
|
|
5
|
+
let(:configure) { GmoPayment::Configure }
|
|
6
|
+
|
|
7
|
+
describe '.setup' do
|
|
8
|
+
before { configure.reset! }
|
|
9
|
+
it 'set variables' do
|
|
10
|
+
expect {
|
|
11
|
+
configure.setup { |c| c.api_endpoint = 'example.com' }
|
|
12
|
+
}.to change { configure.api_endpoint }.from(nil).to('example.com')
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
describe '.reset!' do
|
|
16
|
+
before { configure.setup { |c| c.api_endpoint = 'example.com' } }
|
|
17
|
+
it 'reset variables' do
|
|
18
|
+
expect {
|
|
19
|
+
configure.reset!
|
|
20
|
+
}.to change { configure.api_endpoint }.from('example.com').to(nil)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
context 'with default' do
|
|
25
|
+
before { configure.reset! }
|
|
26
|
+
describe '.api_endpoint' do
|
|
27
|
+
it { expect(configure.api_endpoint).to be(nil) }
|
|
28
|
+
end
|
|
29
|
+
describe '.proxy' do
|
|
30
|
+
it { expect(configure.proxy).to be(nil) }
|
|
31
|
+
end
|
|
32
|
+
describe '.verify_mode' do
|
|
33
|
+
it { expect(configure.verify_mode).to be(nil) }
|
|
34
|
+
end
|
|
35
|
+
describe '.error_list' do
|
|
36
|
+
it { expect(configure.error_list).to be(nil) }
|
|
37
|
+
end
|
|
38
|
+
describe '.site_id' do
|
|
39
|
+
it { expect(configure.site_id).to be(nil) }
|
|
40
|
+
end
|
|
41
|
+
describe '.site_pass' do
|
|
42
|
+
it { expect(configure.site_pass).to be(nil) }
|
|
43
|
+
end
|
|
44
|
+
describe '.shop_id' do
|
|
45
|
+
it { expect(configure.shop_id).to be(nil) }
|
|
46
|
+
end
|
|
47
|
+
describe '.shop_pass' do
|
|
48
|
+
it { expect(configure.shop_pass).to be(nil) }
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
context 'after .setup' do
|
|
53
|
+
before do
|
|
54
|
+
configure.setup do |c|
|
|
55
|
+
c.api_endpoint = 'example.com'
|
|
56
|
+
c.proxy = 'https://user:password@proxy.com:443/'
|
|
57
|
+
c.verify_mode = 1
|
|
58
|
+
c.error_list = 'path/to/file.yml'
|
|
59
|
+
c.site_id = 'GMO_SITE_ID'
|
|
60
|
+
c.site_pass = 'GMO_SITE_PASS'
|
|
61
|
+
c.shop_id = 'GMO_SHOP_ID'
|
|
62
|
+
c.shop_pass = 'GMO_SHOP_PASS'
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
describe '.api_endpoint' do
|
|
66
|
+
it { expect(configure.api_endpoint).to eq('example.com') }
|
|
67
|
+
end
|
|
68
|
+
describe '.proxy' do
|
|
69
|
+
it { expect(configure.proxy).to eq('https://user:password@proxy.com:443/') }
|
|
70
|
+
end
|
|
71
|
+
describe '.verify_mode' do
|
|
72
|
+
it { expect(configure.verify_mode).to eq(1) }
|
|
73
|
+
end
|
|
74
|
+
describe '.error_list' do
|
|
75
|
+
it { expect(configure.error_list).to eq('path/to/file.yml') }
|
|
76
|
+
end
|
|
77
|
+
describe '.site_id' do
|
|
78
|
+
it { expect(configure.site_id).to eq('GMO_SITE_ID') }
|
|
79
|
+
end
|
|
80
|
+
describe '.site_pass' do
|
|
81
|
+
it { expect(configure.site_pass).to eq('GMO_SITE_PASS') }
|
|
82
|
+
end
|
|
83
|
+
describe '.shop_id' do
|
|
84
|
+
it { expect(configure.shop_id).to eq('GMO_SHOP_ID') }
|
|
85
|
+
end
|
|
86
|
+
describe '.shop_pass' do
|
|
87
|
+
it { expect(configure.shop_pass).to eq('GMO_SHOP_PASS') }
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
require 'spec_helper'
|
|
3
|
+
|
|
4
|
+
describe GmoPayment::Errors do
|
|
5
|
+
it { expect(GmoPayment::Errors.new).to be_a(::StandardError) }
|
|
6
|
+
|
|
7
|
+
let(:basic_error) { GmoPayment::Errors }
|
|
8
|
+
describe 'NetworkError' do
|
|
9
|
+
subject { GmoPayment::Errors::NetworkError.new('a', 'b', 'c') }
|
|
10
|
+
it { is_expected.to be_a(basic_error) }
|
|
11
|
+
it { is_expected.to respond_to(:called_method) }
|
|
12
|
+
it { is_expected.to respond_to(:request) }
|
|
13
|
+
it '#called_method return first argument as it is' do
|
|
14
|
+
expect(subject.called_method).to eq('a')
|
|
15
|
+
end
|
|
16
|
+
it '#request return second argument as it is' do
|
|
17
|
+
expect(subject.request).to eq('b')
|
|
18
|
+
end
|
|
19
|
+
it '#message return third argument as it is' do
|
|
20
|
+
expect(subject.message).to eq('c')
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
describe 'RequestMissingItemError' do
|
|
25
|
+
subject { GmoPayment::Errors::RequestMissingItemError.new('a', ['b', 'c']) }
|
|
26
|
+
it { is_expected.to be_a(basic_error) }
|
|
27
|
+
it { is_expected.to respond_to(:called_method) }
|
|
28
|
+
it { is_expected.to respond_to(:items) }
|
|
29
|
+
it '#called_method return first argument as it is' do
|
|
30
|
+
expect(subject.called_method).to eq('a')
|
|
31
|
+
end
|
|
32
|
+
it '#items return second argument as it is' do
|
|
33
|
+
expect(subject.items).to eq(['b', 'c'])
|
|
34
|
+
end
|
|
35
|
+
it '#message return second argument join ", "' do
|
|
36
|
+
expect(subject.message).to match('b, c')
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
describe 'RequestInvalidItemError' do
|
|
41
|
+
subject { GmoPayment::Errors::RequestInvalidItemError.new('a', { b: 'c', d: 'e' }) }
|
|
42
|
+
it { is_expected.to be_a(basic_error) }
|
|
43
|
+
it { is_expected.to respond_to(:called_method) }
|
|
44
|
+
it { is_expected.to respond_to(:items) }
|
|
45
|
+
it '#called_method return first argument as it is' do
|
|
46
|
+
expect(subject.called_method).to eq('a')
|
|
47
|
+
end
|
|
48
|
+
it '#items return second argument as it is' do
|
|
49
|
+
expect(subject.items).to eq({ b: 'c', d: 'e' })
|
|
50
|
+
end
|
|
51
|
+
it '#message return second argument join ":key (v)" and ","' do
|
|
52
|
+
expect(subject.message).to match(':b (c), :d (e)')
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
describe 'ResponseHTTPError' do
|
|
57
|
+
subject { GmoPayment::Errors::ResponseHTTPError.new('a', 'b') }
|
|
58
|
+
it { is_expected.to be_a(basic_error) }
|
|
59
|
+
it { is_expected.to respond_to(:called_method) }
|
|
60
|
+
it { is_expected.to respond_to(:request) }
|
|
61
|
+
it '#called_method return first argument as it is' do
|
|
62
|
+
expect(subject.called_method).to eq('a')
|
|
63
|
+
end
|
|
64
|
+
it '#request return second argument as it is' do
|
|
65
|
+
expect(subject.request).to eq('b')
|
|
66
|
+
end
|
|
67
|
+
it '#message return announce "called from {first argument}"' do
|
|
68
|
+
expect(subject.message).to match('called from `a\'')
|
|
69
|
+
expect(subject.message).to match('not 2xx')
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
describe 'ResponseHasErrCodeError' do
|
|
74
|
+
subject { GmoPayment::Errors::ResponseHasErrCodeError.new('a', 'b') }
|
|
75
|
+
it { is_expected.to be_a(basic_error) }
|
|
76
|
+
it { is_expected.to respond_to(:called_method) }
|
|
77
|
+
it { is_expected.to respond_to(:response) }
|
|
78
|
+
it { is_expected.to respond_to(:error_messages) }
|
|
79
|
+
it '#called_method return first argument as it is' do
|
|
80
|
+
expect(subject.called_method).to eq('a')
|
|
81
|
+
end
|
|
82
|
+
it '#response return second argument as it is' do
|
|
83
|
+
expect(subject.response).to eq('b')
|
|
84
|
+
end
|
|
85
|
+
it '#message return announce "called from {first argument}"' do
|
|
86
|
+
expect(subject.message).to match('called from `a\'')
|
|
87
|
+
expect(subject.message).to match('ErrCode')
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
describe '#error_messages' do
|
|
91
|
+
subject do
|
|
92
|
+
class Example; def err_info; ['E01010001']; end; end
|
|
93
|
+
GmoPayment::Errors::ResponseHasErrCodeError.new('a', Example.new).error_messages(args)
|
|
94
|
+
end
|
|
95
|
+
context 'with Hash format file that is given argument' do
|
|
96
|
+
let(:args) { File.expand_path('../../../lib/generators/gmo_payment/templates/ja.yml', __FILE__) }
|
|
97
|
+
it { is_expected.to be_a(Hash) }
|
|
98
|
+
it { is_expected.to including({ 'E01010001' => 'ショップIDが指定されていません。' }) }
|
|
99
|
+
end
|
|
100
|
+
context 'with Hash format file that is given Configure' do
|
|
101
|
+
let(:args) { nil }
|
|
102
|
+
before do
|
|
103
|
+
GmoPayment.setup do |c|
|
|
104
|
+
c.error_list = File.expand_path('../../../lib/generators/gmo_payment/templates/ja.yml', __FILE__)
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
after { GmoPayment.reset! }
|
|
108
|
+
it { is_expected.to be_a(Hash) }
|
|
109
|
+
it { is_expected.to including({ 'E01010001' => 'ショップIDが指定されていません。' }) }
|
|
110
|
+
end
|
|
111
|
+
context 'without file' do
|
|
112
|
+
let(:args) { nil }
|
|
113
|
+
it { expect { subject.error_messages }.to raise_error }
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
end
|
|
118
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
require 'spec_helper'
|
|
3
|
+
|
|
4
|
+
describe 'GmoPayment::GLOSSARY' do
|
|
5
|
+
subject { GmoPayment::GLOSSARY }
|
|
6
|
+
|
|
7
|
+
it 'is Hash<Symbol, String>' do
|
|
8
|
+
expect(subject.keys).to all be_a(Symbol)
|
|
9
|
+
expect(subject.values).to all be_a(String)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
it 'is 60 pairs' do
|
|
13
|
+
expect(subject.length).to eq(60)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
require 'spec_helper'
|
|
3
|
+
|
|
4
|
+
describe GmoPayment do
|
|
5
|
+
describe '.setup' do
|
|
6
|
+
before { GmoPayment.reset! }
|
|
7
|
+
it 'setup GmoPayment::Configure variables' do
|
|
8
|
+
expect {
|
|
9
|
+
GmoPayment.setup { |c| c.api_endpoint = 'example.com' }
|
|
10
|
+
}.to change{ GmoPayment::Configure.api_endpoint }.from(nil).to('example.com')
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
describe '.reset!' do
|
|
15
|
+
before { GmoPayment.setup { |c| c.api_endpoint = 'example.com' } }
|
|
16
|
+
it 'reset GmoPayment::Configure variables' do
|
|
17
|
+
expect {
|
|
18
|
+
GmoPayment.reset!
|
|
19
|
+
}.to change{ GmoPayment::Configure.api_endpoint }.from('example.com').to(nil)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
require 'simplecov'
|
|
3
|
+
require 'coveralls'
|
|
4
|
+
Coveralls.wear!
|
|
5
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
|
6
|
+
SimpleCov::Formatter::HTMLFormatter,
|
|
7
|
+
Coveralls::SimpleCov::Formatter
|
|
8
|
+
]
|
|
9
|
+
SimpleCov.start do
|
|
10
|
+
add_filter 'spec'
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
|
14
|
+
require 'gmo_payment'
|
|
15
|
+
|
|
16
|
+
Dir['./spec/support/**/*.rb'].sort.each { |f| require f }
|
|
17
|
+
RSpec.configure do |c|
|
|
18
|
+
c.raise_errors_for_deprecations!
|
|
19
|
+
c.around(:each, :vcr) do |example|
|
|
20
|
+
name = example.metadata[:full_description].split(/\s+/, 2).join("/").gsub(/[^\w\/]+/, "_")
|
|
21
|
+
VCR.use_cassette(name) { example.call }
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
require 'webmock/rspec'
|
|
26
|
+
require 'vcr'
|
|
27
|
+
PREFIX = 'GMO_TEST_'
|
|
28
|
+
VCR.configure do |c|
|
|
29
|
+
c.filter_sensitive_data('<API_ENDPOINT>') do
|
|
30
|
+
ENV["#{PREFIX}API_ENDPOINT"]
|
|
31
|
+
end
|
|
32
|
+
c.filter_sensitive_data('<SITE_ID>') do
|
|
33
|
+
ENV["#{PREFIX}SITE_ID"]
|
|
34
|
+
end
|
|
35
|
+
c.filter_sensitive_data('<SITE_PASS>') do
|
|
36
|
+
ENV["#{PREFIX}SITE_PASS"]
|
|
37
|
+
end
|
|
38
|
+
c.filter_sensitive_data('<SHOP_ID>') do
|
|
39
|
+
ENV["#{PREFIX}SHOP_ID"]
|
|
40
|
+
end
|
|
41
|
+
c.filter_sensitive_data('<SHOP_PASS>') do
|
|
42
|
+
ENV["#{PREFIX}SHOP_PASS"]
|
|
43
|
+
end
|
|
44
|
+
c.filter_sensitive_data('<CARD_EXPIRE>') do
|
|
45
|
+
ENV["#{PREFIX}CARD_EXPIRE"]
|
|
46
|
+
end
|
|
47
|
+
c.filter_sensitive_data('<CARD_NO_N>') do
|
|
48
|
+
ENV["#{PREFIX}CARD_NO_N"]
|
|
49
|
+
end
|
|
50
|
+
c.filter_sensitive_data('<CARD_NO_N_MASK>') do
|
|
51
|
+
ENV["#{PREFIX}CARD_NO_N_MASK"]
|
|
52
|
+
end
|
|
53
|
+
c.filter_sensitive_data('<CARD_NO_Y>') do
|
|
54
|
+
ENV["#{PREFIX}CARD_NO_Y"]
|
|
55
|
+
end
|
|
56
|
+
c.filter_sensitive_data('<CARD_NO_Y_MASK>') do
|
|
57
|
+
ENV["#{PREFIX}CARD_NO_Y_MASK"]
|
|
58
|
+
end
|
|
59
|
+
c.filter_sensitive_data('<ACS_URL>') do
|
|
60
|
+
ENV["#{PREFIX}ACS_URL"]
|
|
61
|
+
end
|
|
62
|
+
c.filter_sensitive_data('<BTC_URL>') do
|
|
63
|
+
ENV["#{PREFIX}BTC_URL"]
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
c.configure_rspec_metadata!
|
|
67
|
+
c.allow_http_connections_when_no_cassette = true
|
|
68
|
+
c.cassette_library_dir = 'spec/cassettes'
|
|
69
|
+
c.hook_into :webmock
|
|
70
|
+
end
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
shared_examples 'validation of length <= n' do |items, value_type, n|
|
|
4
|
+
context "with length <= #{n}" do
|
|
5
|
+
let(:value) { "#{value_type}" * n }
|
|
6
|
+
items.each do |key|
|
|
7
|
+
let(:key) { key }
|
|
8
|
+
it { is_expected.to be(true) }
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
context "with length > #{n}" do
|
|
12
|
+
let(:value) { "#{value_type}" * (n + 1) }
|
|
13
|
+
items.each do |key|
|
|
14
|
+
let(:key) { key }
|
|
15
|
+
it { is_expected.to be(false) }
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
shared_examples 'validation of length >= n' do |items, value_type, n|
|
|
21
|
+
context "with length >= #{n}" do
|
|
22
|
+
let(:value) { "#{value_type}" * n }
|
|
23
|
+
items.each do |key|
|
|
24
|
+
let(:key) { key }
|
|
25
|
+
it { is_expected.to be(true) }
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
context "with length < #{n}" do
|
|
29
|
+
let(:value) { "#{value_type}" * (n - 1) }
|
|
30
|
+
items.each do |key|
|
|
31
|
+
let(:key) { key }
|
|
32
|
+
it { is_expected.to be(false) }
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
shared_examples 'validation of number' do |items, n|
|
|
38
|
+
context 'with number' do
|
|
39
|
+
let(:value) { '1' * n }
|
|
40
|
+
items.each do |key|
|
|
41
|
+
let(:key) { key }
|
|
42
|
+
it { is_expected.to be(true) }
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
context 'with not number' do
|
|
46
|
+
let(:value) { 'not_number' }
|
|
47
|
+
items.each do |key|
|
|
48
|
+
let(:key) { key }
|
|
49
|
+
it { is_expected.to be(false) }
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
shared_examples 'validation of value including' do |items, array|
|
|
55
|
+
context "with #{array.join(' or ')}" do
|
|
56
|
+
items.each do |key|
|
|
57
|
+
let(:key) { key }
|
|
58
|
+
array.each do |value|
|
|
59
|
+
let(:value) { value }
|
|
60
|
+
it { is_expected.to be(true) }
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
context "with not #{array.join(' or ')}" do
|
|
65
|
+
items.each do |key|
|
|
66
|
+
let(:key) { key }
|
|
67
|
+
let(:value) { 'x' }
|
|
68
|
+
it { is_expected.to be(false) }
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: gmo_payment
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Kouhei Fujigaya
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2015-10-24 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: Ruby client for the protocol type API provided by GMO Payment Gateway.
|
|
14
|
+
email:
|
|
15
|
+
- kouhei.fujigaya@gmail.com
|
|
16
|
+
executables: []
|
|
17
|
+
extensions: []
|
|
18
|
+
extra_rdoc_files: []
|
|
19
|
+
files:
|
|
20
|
+
- ".coveralls.yml"
|
|
21
|
+
- ".editorconfig"
|
|
22
|
+
- ".gitignore"
|
|
23
|
+
- ".rspec"
|
|
24
|
+
- ".travis.yml"
|
|
25
|
+
- CHANGELOG.md
|
|
26
|
+
- Gemfile
|
|
27
|
+
- MIT-LICENSE
|
|
28
|
+
- README.md
|
|
29
|
+
- Rakefile
|
|
30
|
+
- gmo_payment.gemspec
|
|
31
|
+
- lib/generators/gmo_payment/install_generator.rb
|
|
32
|
+
- lib/generators/gmo_payment/templates/ja.yml
|
|
33
|
+
- lib/gmo_payment.rb
|
|
34
|
+
- lib/gmo_payment/client.rb
|
|
35
|
+
- lib/gmo_payment/client/options.rb
|
|
36
|
+
- lib/gmo_payment/client/request.rb
|
|
37
|
+
- lib/gmo_payment/client/response.rb
|
|
38
|
+
- lib/gmo_payment/configure.rb
|
|
39
|
+
- lib/gmo_payment/errors.rb
|
|
40
|
+
- lib/gmo_payment/glossary.rb
|
|
41
|
+
- lib/gmo_payment/version.rb
|
|
42
|
+
- spec/cassettes/GmoPayment_Client/_auth_to_sales/return_6_items.yml
|
|
43
|
+
- spec/cassettes/GmoPayment_Client/_call/with_ResponseHTTPError/raise_ResponseHTTPError.yml
|
|
44
|
+
- spec/cassettes/GmoPayment_Client/_call/with_ResponseHasErrCodeError/raise_ResponseHTTPError.yml
|
|
45
|
+
- spec/cassettes/GmoPayment_Client/_change_tran/return_6_items.yml
|
|
46
|
+
- spec/cassettes/GmoPayment_Client/_delete_card/return_1_items.yml
|
|
47
|
+
- spec/cassettes/GmoPayment_Client/_delete_member/return_1_items.yml
|
|
48
|
+
- spec/cassettes/GmoPayment_Client/_delete_tran/return_6_items.yml
|
|
49
|
+
- spec/cassettes/GmoPayment_Client/_entry_tran/return_2_items.yml
|
|
50
|
+
- spec/cassettes/GmoPayment_Client/_entry_tran_btc/return_2_items.yml
|
|
51
|
+
- spec/cassettes/GmoPayment_Client/_exec_tran/return_12_items.yml
|
|
52
|
+
- spec/cassettes/GmoPayment_Client/_exec_tran_3d/return_4_items.yml
|
|
53
|
+
- spec/cassettes/GmoPayment_Client/_exec_tran_btc/return_3_items.yml
|
|
54
|
+
- spec/cassettes/GmoPayment_Client/_exec_tran_member/return_12_items.yml
|
|
55
|
+
- spec/cassettes/GmoPayment_Client/_exec_tran_member_3d/return_4_items.yml
|
|
56
|
+
- spec/cassettes/GmoPayment_Client/_get_rate_btc/return_1_item.yml
|
|
57
|
+
- spec/cassettes/GmoPayment_Client/_re_exec_tran/return_6_items.yml
|
|
58
|
+
- spec/cassettes/GmoPayment_Client/_save_card/return_3_items.yml
|
|
59
|
+
- spec/cassettes/GmoPayment_Client/_save_member/return_1_items.yml
|
|
60
|
+
- spec/cassettes/GmoPayment_Client/_save_traded_card/return_3_items.yml
|
|
61
|
+
- spec/cassettes/GmoPayment_Client/_search_card/return_7_items.yml
|
|
62
|
+
- spec/cassettes/GmoPayment_Client/_search_member/return_3_items.yml
|
|
63
|
+
- spec/cassettes/GmoPayment_Client/_search_trade/return_21_items.yml
|
|
64
|
+
- spec/cassettes/GmoPayment_Client/_search_trade_btc/return_11_items.yml
|
|
65
|
+
- spec/cassettes/GmoPayment_Client/_secure_tran/return_11_items.yml
|
|
66
|
+
- spec/cassettes/GmoPayment_Client/_update_card/return_3_items.yml
|
|
67
|
+
- spec/cassettes/GmoPayment_Client/_update_member/return_1_items.yml
|
|
68
|
+
- spec/cassettes/GmoPayment_Client_Response/GmoPayment_GLOSSARY_keys_to_method/return_body_values_if_body_match_Hash_keys_and_GLOSSARY_keys.yml
|
|
69
|
+
- spec/cassettes/GmoPayment_Client_Response/_body/with_prebody_match_Hash_keys_and_GLOSSARY_keys/return_Hash_keys_Symbol_and_values_as_it_is.yml
|
|
70
|
+
- spec/cassettes/GmoPayment_Client_Response/_body/without_prebody_match_Hash_keys_and_GLOSSARY_keys/return_Hash_keys_String_and_values_as_it_is.yml
|
|
71
|
+
- spec/cassettes/GmoPayment_Client_Response/_encoded_raw_body/return_String_of_encoded_Shift_JIS_to_UTF-8.yml
|
|
72
|
+
- spec/cassettes/GmoPayment_Client_Response/_error_/with_ErrCode/return_true.yml
|
|
73
|
+
- spec/cassettes/GmoPayment_Client_Response/_error_/without_ErrCode/return_false.yml
|
|
74
|
+
- spec/cassettes/GmoPayment_Client_Response/_http_code/return_Integer_of_HTTP_status_code.yml
|
|
75
|
+
- spec/cassettes/GmoPayment_Client_Response/_http_error_/with_2xx/return_false.yml
|
|
76
|
+
- spec/cassettes/GmoPayment_Client_Response/_http_error_/without_2xx/return_true.yml
|
|
77
|
+
- spec/cassettes/GmoPayment_Client_Response/_http_header/return_Hash_of_HTTP_header.yml
|
|
78
|
+
- spec/cassettes/GmoPayment_Client_Response/_http_message/return_String_of_HTTP_message.yml
|
|
79
|
+
- spec/cassettes/GmoPayment_Client_Response/_prebody/with_ErrCode/behaves_like_getting_Hash_values_Array/return_Hash_keys_String_and_values_Array.yml
|
|
80
|
+
- spec/cassettes/GmoPayment_Client_Response/_prebody/with_called_return_array_true/behaves_like_getting_Hash_values_Array/return_Hash_keys_String_and_values_Array.yml
|
|
81
|
+
- spec/cassettes/GmoPayment_Client_Response/_prebody/with_no_ErroCode_and_called_return_array_false/return_Hash_keys_and_values_String.yml
|
|
82
|
+
- spec/cassettes/GmoPayment_Client_Response/_raw_body/return_String_of_HTTP_response_body_as_it_is.yml
|
|
83
|
+
- spec/cassettes/GmoPayment_Client_Response/_split_encoded_raw_body/behaves_like_URI_decode_www_form/with_response_body_have_invalid_parameters_to_split/return_empty_Array.yml
|
|
84
|
+
- spec/cassettes/GmoPayment_Client_Response/_split_encoded_raw_body/behaves_like_URI_decode_www_form/with_response_body_have_only_GLOSSARY_keys/return_predefined_Array_format.yml
|
|
85
|
+
- spec/cassettes/GmoPayment_Client_Response/_split_encoded_raw_body_/behaves_like_URI_decode_www_form/with_response_body_have_invalid_parameters_to_split/return_empty_Array.yml
|
|
86
|
+
- spec/cassettes/GmoPayment_Client_Response/_split_encoded_raw_body_/behaves_like_URI_decode_www_form/with_response_body_have_only_GLOSSARY_keys/return_predefined_Array_format.yml
|
|
87
|
+
- spec/cassettes/GmoPayment_Client_Response/_split_encoded_raw_body_/with_response_body_have_not_only_GLOSSARY_keys/returns_predefined_Array_format_without_GLOSSARY_keys.yml
|
|
88
|
+
- spec/gmo_payment/client/options_spec.rb
|
|
89
|
+
- spec/gmo_payment/client/request_spec.rb
|
|
90
|
+
- spec/gmo_payment/client/response_spec.rb
|
|
91
|
+
- spec/gmo_payment/client_spec.rb
|
|
92
|
+
- spec/gmo_payment/configure_spec.rb
|
|
93
|
+
- spec/gmo_payment/errors_spec.rb
|
|
94
|
+
- spec/gmo_payment/glossary_spec.rb
|
|
95
|
+
- spec/gmo_payment_spec.rb
|
|
96
|
+
- spec/spec_helper.rb
|
|
97
|
+
- spec/support/request_validation.rb
|
|
98
|
+
homepage: https://github.com/kouhei-fuji/gmo_payment
|
|
99
|
+
licenses:
|
|
100
|
+
- MIT
|
|
101
|
+
metadata: {}
|
|
102
|
+
post_install_message:
|
|
103
|
+
rdoc_options: []
|
|
104
|
+
require_paths:
|
|
105
|
+
- lib
|
|
106
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - ">="
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: 2.0.0
|
|
111
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
|
+
requirements:
|
|
113
|
+
- - ">="
|
|
114
|
+
- !ruby/object:Gem::Version
|
|
115
|
+
version: '0'
|
|
116
|
+
requirements: []
|
|
117
|
+
rubyforge_project:
|
|
118
|
+
rubygems_version: 2.4.5.1
|
|
119
|
+
signing_key:
|
|
120
|
+
specification_version: 4
|
|
121
|
+
summary: Ruby client for GMO-PG API.
|
|
122
|
+
test_files:
|
|
123
|
+
- spec/cassettes/GmoPayment_Client/_auth_to_sales/return_6_items.yml
|
|
124
|
+
- spec/cassettes/GmoPayment_Client/_call/with_ResponseHTTPError/raise_ResponseHTTPError.yml
|
|
125
|
+
- spec/cassettes/GmoPayment_Client/_call/with_ResponseHasErrCodeError/raise_ResponseHTTPError.yml
|
|
126
|
+
- spec/cassettes/GmoPayment_Client/_change_tran/return_6_items.yml
|
|
127
|
+
- spec/cassettes/GmoPayment_Client/_delete_card/return_1_items.yml
|
|
128
|
+
- spec/cassettes/GmoPayment_Client/_delete_member/return_1_items.yml
|
|
129
|
+
- spec/cassettes/GmoPayment_Client/_delete_tran/return_6_items.yml
|
|
130
|
+
- spec/cassettes/GmoPayment_Client/_entry_tran/return_2_items.yml
|
|
131
|
+
- spec/cassettes/GmoPayment_Client/_entry_tran_btc/return_2_items.yml
|
|
132
|
+
- spec/cassettes/GmoPayment_Client/_exec_tran/return_12_items.yml
|
|
133
|
+
- spec/cassettes/GmoPayment_Client/_exec_tran_3d/return_4_items.yml
|
|
134
|
+
- spec/cassettes/GmoPayment_Client/_exec_tran_btc/return_3_items.yml
|
|
135
|
+
- spec/cassettes/GmoPayment_Client/_exec_tran_member/return_12_items.yml
|
|
136
|
+
- spec/cassettes/GmoPayment_Client/_exec_tran_member_3d/return_4_items.yml
|
|
137
|
+
- spec/cassettes/GmoPayment_Client/_get_rate_btc/return_1_item.yml
|
|
138
|
+
- spec/cassettes/GmoPayment_Client/_re_exec_tran/return_6_items.yml
|
|
139
|
+
- spec/cassettes/GmoPayment_Client/_save_card/return_3_items.yml
|
|
140
|
+
- spec/cassettes/GmoPayment_Client/_save_member/return_1_items.yml
|
|
141
|
+
- spec/cassettes/GmoPayment_Client/_save_traded_card/return_3_items.yml
|
|
142
|
+
- spec/cassettes/GmoPayment_Client/_search_card/return_7_items.yml
|
|
143
|
+
- spec/cassettes/GmoPayment_Client/_search_member/return_3_items.yml
|
|
144
|
+
- spec/cassettes/GmoPayment_Client/_search_trade/return_21_items.yml
|
|
145
|
+
- spec/cassettes/GmoPayment_Client/_search_trade_btc/return_11_items.yml
|
|
146
|
+
- spec/cassettes/GmoPayment_Client/_secure_tran/return_11_items.yml
|
|
147
|
+
- spec/cassettes/GmoPayment_Client/_update_card/return_3_items.yml
|
|
148
|
+
- spec/cassettes/GmoPayment_Client/_update_member/return_1_items.yml
|
|
149
|
+
- spec/cassettes/GmoPayment_Client_Response/GmoPayment_GLOSSARY_keys_to_method/return_body_values_if_body_match_Hash_keys_and_GLOSSARY_keys.yml
|
|
150
|
+
- spec/cassettes/GmoPayment_Client_Response/_body/with_prebody_match_Hash_keys_and_GLOSSARY_keys/return_Hash_keys_Symbol_and_values_as_it_is.yml
|
|
151
|
+
- spec/cassettes/GmoPayment_Client_Response/_body/without_prebody_match_Hash_keys_and_GLOSSARY_keys/return_Hash_keys_String_and_values_as_it_is.yml
|
|
152
|
+
- spec/cassettes/GmoPayment_Client_Response/_encoded_raw_body/return_String_of_encoded_Shift_JIS_to_UTF-8.yml
|
|
153
|
+
- spec/cassettes/GmoPayment_Client_Response/_error_/with_ErrCode/return_true.yml
|
|
154
|
+
- spec/cassettes/GmoPayment_Client_Response/_error_/without_ErrCode/return_false.yml
|
|
155
|
+
- spec/cassettes/GmoPayment_Client_Response/_http_code/return_Integer_of_HTTP_status_code.yml
|
|
156
|
+
- spec/cassettes/GmoPayment_Client_Response/_http_error_/with_2xx/return_false.yml
|
|
157
|
+
- spec/cassettes/GmoPayment_Client_Response/_http_error_/without_2xx/return_true.yml
|
|
158
|
+
- spec/cassettes/GmoPayment_Client_Response/_http_header/return_Hash_of_HTTP_header.yml
|
|
159
|
+
- spec/cassettes/GmoPayment_Client_Response/_http_message/return_String_of_HTTP_message.yml
|
|
160
|
+
- spec/cassettes/GmoPayment_Client_Response/_prebody/with_ErrCode/behaves_like_getting_Hash_values_Array/return_Hash_keys_String_and_values_Array.yml
|
|
161
|
+
- spec/cassettes/GmoPayment_Client_Response/_prebody/with_called_return_array_true/behaves_like_getting_Hash_values_Array/return_Hash_keys_String_and_values_Array.yml
|
|
162
|
+
- spec/cassettes/GmoPayment_Client_Response/_prebody/with_no_ErroCode_and_called_return_array_false/return_Hash_keys_and_values_String.yml
|
|
163
|
+
- spec/cassettes/GmoPayment_Client_Response/_raw_body/return_String_of_HTTP_response_body_as_it_is.yml
|
|
164
|
+
- spec/cassettes/GmoPayment_Client_Response/_split_encoded_raw_body/behaves_like_URI_decode_www_form/with_response_body_have_invalid_parameters_to_split/return_empty_Array.yml
|
|
165
|
+
- spec/cassettes/GmoPayment_Client_Response/_split_encoded_raw_body/behaves_like_URI_decode_www_form/with_response_body_have_only_GLOSSARY_keys/return_predefined_Array_format.yml
|
|
166
|
+
- spec/cassettes/GmoPayment_Client_Response/_split_encoded_raw_body_/behaves_like_URI_decode_www_form/with_response_body_have_invalid_parameters_to_split/return_empty_Array.yml
|
|
167
|
+
- spec/cassettes/GmoPayment_Client_Response/_split_encoded_raw_body_/behaves_like_URI_decode_www_form/with_response_body_have_only_GLOSSARY_keys/return_predefined_Array_format.yml
|
|
168
|
+
- spec/cassettes/GmoPayment_Client_Response/_split_encoded_raw_body_/with_response_body_have_not_only_GLOSSARY_keys/returns_predefined_Array_format_without_GLOSSARY_keys.yml
|
|
169
|
+
- spec/gmo_payment/client/options_spec.rb
|
|
170
|
+
- spec/gmo_payment/client/request_spec.rb
|
|
171
|
+
- spec/gmo_payment/client/response_spec.rb
|
|
172
|
+
- spec/gmo_payment/client_spec.rb
|
|
173
|
+
- spec/gmo_payment/configure_spec.rb
|
|
174
|
+
- spec/gmo_payment/errors_spec.rb
|
|
175
|
+
- spec/gmo_payment/glossary_spec.rb
|
|
176
|
+
- spec/gmo_payment_spec.rb
|
|
177
|
+
- spec/spec_helper.rb
|
|
178
|
+
- spec/support/request_validation.rb
|
|
179
|
+
has_rdoc:
|