gmo 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.
- data/.gitignore +8 -0
- data/Gemfile +22 -0
- data/README.ja.md +54 -0
- data/README.md +54 -0
- data/Rakefile +15 -0
- data/autotest/discover.rb +1 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_alter_tran_change_order_auth_to_sale.yml +90 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_alter_tran_gets_data_about_order.yml +90 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_alter_tran_got_error_if_missing_options.yml +32 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_change_tran_gets_data_about_order.yml +90 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_change_tran_got_error_if_missing_options.yml +32 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_gets_data_about_a_transaction.yml +32 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_got_error_if_missing_options.yml +32 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_gets_data_about_a_transaction.yml +32 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_got_error_if_missing_options.yml +32 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_search_trade_gets_data_about_order.yml +32 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_search_trade_got_error_if_missing_options.yml +32 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_search_trade_multi_gets_data_about_order.yml +34 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_search_trade_multi_got_error_if_missing_options.yml +34 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAndSiteAPI/_trade_card_got_error_if_missing_options.yml +32 -0
- data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_delete_card_gets_data_about_a_card.yml +34 -0
- data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_delete_member_gets_data_about_a_member.yml +34 -0
- data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_save_card_gets_data_about_a_card.yml +34 -0
- data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_save_member_gets_data_about_a_transaction.yml +32 -0
- data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_save_member_got_error_if_missing_options.yml +32 -0
- data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_search_card_gets_data_about_a_card.yml +65 -0
- data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_search_member_gets_data_about_a_member.yml +65 -0
- data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_update_member_gets_data_about_a_transaction.yml +32 -0
- data/gmo.gemspec +30 -0
- data/lib/gmo.rb +99 -0
- data/lib/gmo/errors.rb +51 -0
- data/lib/gmo/http_services.rb +77 -0
- data/lib/gmo/shop_and_site_api.rb +56 -0
- data/lib/gmo/shop_api.rb +218 -0
- data/lib/gmo/site_api.rb +146 -0
- data/lib/gmo/version.rb +3 -0
- data/spec/gmo/api_spec.rb +32 -0
- data/spec/gmo/error_spec.rb +25 -0
- data/spec/gmo/http_service_spec.rb +23 -0
- data/spec/gmo/shop_and_site_api_spec.rb +45 -0
- data/spec/gmo/shop_api_spec.rb +261 -0
- data/spec/gmo/site_api_spec.rb +140 -0
- data/spec/spec_helper.rb +21 -0
- data/spec/support/config.example.yml +4 -0
- data/spec/support/config.yml +4 -0
- data/spec/support/config_loader.rb +2 -0
- data/spec/support/factory.rb +8 -0
- data/spec/support/vcr.rb +21 -0
- data/travis.yml +11 -0
- metadata +202 -0
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GMO::Payment::Error do
|
4
|
+
it "is a GMO::GMOError" do
|
5
|
+
GMO::Payment::Error.new(nil, nil).should be_a(GMO::GMOError)
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
describe GMO::GMOError do
|
10
|
+
it "is a StandardError" do
|
11
|
+
GMO::GMOError.new.should be_a(StandardError)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe GMO::Payment::APIError do
|
16
|
+
it "is a GMO::Payment::Error" do
|
17
|
+
GMO::Payment::APIError.new({}).should be_a(GMO::Payment::Error)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe GMO::Payment::ServerError do
|
22
|
+
it "is a GMO::Payment::Error" do
|
23
|
+
GMO::Payment::ServerError.new(nil, nil).should be_a(GMO::Payment::Error)
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
class FakeHTTPService
|
4
|
+
include GMO::HTTPService
|
5
|
+
end
|
6
|
+
|
7
|
+
describe "GMO::HTTPService" do
|
8
|
+
|
9
|
+
describe "common methods" do
|
10
|
+
describe "server" do
|
11
|
+
it "should return the dev server if options[:development]" do
|
12
|
+
FakeHTTPService.server(:development => true).should == GMO::Payment::DEV_SERVER
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should return the pro server if !options[:development]" do
|
16
|
+
FakeHTTPService.server(:development => false).should == GMO::Payment::PRO_SERVER
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "GMO::Payment::ShopAndSiteAPI" do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
@service ||= GMO::Payment::ShopAndSiteAPI.new({
|
7
|
+
:shop_id => SPEC_CONF["shop_id"],
|
8
|
+
:shop_pass => SPEC_CONF["shop_pass"],
|
9
|
+
:site_id => SPEC_CONF["site_id"],
|
10
|
+
:site_pass => SPEC_CONF["site_pass"]
|
11
|
+
})
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should raise an ArgumentError if no options passed" do
|
15
|
+
lambda {
|
16
|
+
service = GMO::Payment::ShopAndSiteAPI.new()
|
17
|
+
}.should raise_error(ArgumentError)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "has an attr_reader for shop_id" do
|
21
|
+
@service.shop_id.should == SPEC_CONF["shop_id"]
|
22
|
+
end
|
23
|
+
|
24
|
+
it "has an attr_reader for shop_pass" do
|
25
|
+
@service.shop_pass.should == SPEC_CONF["shop_pass"]
|
26
|
+
end
|
27
|
+
|
28
|
+
it "has an attr_reader for site_id" do
|
29
|
+
@service.site_id.should == SPEC_CONF["site_id"]
|
30
|
+
end
|
31
|
+
|
32
|
+
it "has an attr_reader for site_pass" do
|
33
|
+
@service.site_pass.should == SPEC_CONF["site_pass"]
|
34
|
+
end
|
35
|
+
|
36
|
+
describe "#trade_card" do
|
37
|
+
|
38
|
+
it "got error if missing options", :vcr do
|
39
|
+
lambda {
|
40
|
+
result = @service.trade_card()
|
41
|
+
}.should raise_error
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
@@ -0,0 +1,261 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "GMO::Payment::ShopAPI" do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
@service ||= GMO::Payment::ShopAPI.new({
|
7
|
+
:shop_id => SPEC_CONF["shop_id"],
|
8
|
+
:shop_pass => SPEC_CONF["shop_pass"]
|
9
|
+
})
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should raise an ArgumentError if no options passed" do
|
13
|
+
lambda {
|
14
|
+
service = GMO::Payment::ShopAPI.new()
|
15
|
+
}.should raise_error(ArgumentError)
|
16
|
+
end
|
17
|
+
|
18
|
+
it "has an attr_reader for shop_id" do
|
19
|
+
@service.shop_id.should == SPEC_CONF["shop_id"]
|
20
|
+
end
|
21
|
+
|
22
|
+
it "has an attr_reader for shop_pass" do
|
23
|
+
@service.shop_pass.should == SPEC_CONF["shop_pass"]
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "#entry_tran" do
|
27
|
+
it "gets data about a transaction", :vcr do
|
28
|
+
result = @service.entry_tran({
|
29
|
+
:order_id => 100,
|
30
|
+
:job_cd => "AUTH",
|
31
|
+
:amount => 100
|
32
|
+
})
|
33
|
+
result["AccessID"].nil?.should_not be_true
|
34
|
+
result["AccessPass"].nil?.should_not be_true
|
35
|
+
end
|
36
|
+
|
37
|
+
it "got error if missing options", :vcr do
|
38
|
+
lambda {
|
39
|
+
result = @service.entry_tran()
|
40
|
+
}.should raise_error
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe "#exec_tran" do
|
45
|
+
it "gets data about a transaction", :vcr do
|
46
|
+
client_field1 = "client_field1"
|
47
|
+
result = @service.exec_tran({
|
48
|
+
:order_id => 100,
|
49
|
+
:access_id => ACCESS_ID,
|
50
|
+
:access_pass => ACCESS_PASS,
|
51
|
+
:method => 1,
|
52
|
+
:pay_times => 1,
|
53
|
+
:card_no => "4111111111111111",
|
54
|
+
:expire => "1405",
|
55
|
+
:client_field1 => client_field1
|
56
|
+
})
|
57
|
+
result["ACS"].nil?.should_not be_true
|
58
|
+
result["OrderID"].nil?.should_not be_true
|
59
|
+
result["Forward"].nil?.should_not be_true
|
60
|
+
result["Method"].nil?.should_not be_true
|
61
|
+
result["PayTimes"].nil?.should_not be_true
|
62
|
+
result["Approve"].nil?.should_not be_true
|
63
|
+
result["TranID"].nil?.should_not be_true
|
64
|
+
result["TranDate"].nil?.should_not be_true
|
65
|
+
result["CheckString"].nil?.should_not be_true
|
66
|
+
result["ClientField1"].nil?.should_not be_true
|
67
|
+
(result["ClientField1"] == client_field1).should be_true
|
68
|
+
result["ClientField3"].nil?.should_not be_true
|
69
|
+
end
|
70
|
+
|
71
|
+
it "got error if missing options", :vcr do
|
72
|
+
lambda {
|
73
|
+
result = @service.exec_tran()
|
74
|
+
}.should raise_error
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
describe "#alter_tran" do
|
79
|
+
it "gets data about order", :vcr do
|
80
|
+
order_id = 1001
|
81
|
+
result = @service.entry_tran({
|
82
|
+
:order_id => order_id,
|
83
|
+
:job_cd => "AUTH",
|
84
|
+
:amount => 100
|
85
|
+
})
|
86
|
+
access_id = result["AccessID"]
|
87
|
+
access_pass = result["AccessPass"]
|
88
|
+
result = @service.exec_tran({
|
89
|
+
:order_id => order_id,
|
90
|
+
:access_id => access_id,
|
91
|
+
:access_pass => access_pass,
|
92
|
+
:method => 1,
|
93
|
+
:pay_times => 1,
|
94
|
+
:card_no => "4111111111111111",
|
95
|
+
:expire => "1405"
|
96
|
+
})
|
97
|
+
result = @service.alter_tran({
|
98
|
+
:access_id => access_id,
|
99
|
+
:access_pass => access_pass,
|
100
|
+
:job_cd => "RETURN",
|
101
|
+
:amount => 100
|
102
|
+
})
|
103
|
+
result["AccessID"].nil?.should_not be_true
|
104
|
+
result["AccessPass"].nil?.should_not be_true
|
105
|
+
result["Forward"].nil?.should_not be_true
|
106
|
+
result["Approve"].nil?.should_not be_true
|
107
|
+
result["AccessPass"].nil?.should_not be_true
|
108
|
+
result["TranID"].nil?.should_not be_true
|
109
|
+
result["TranDate"].nil?.should_not be_true
|
110
|
+
end
|
111
|
+
|
112
|
+
it "change order auth to sale", :vcr do
|
113
|
+
order_id = 1002
|
114
|
+
result = @service.entry_tran({
|
115
|
+
:order_id => order_id,
|
116
|
+
:job_cd => "AUTH",
|
117
|
+
:amount => 100
|
118
|
+
})
|
119
|
+
access_id = result["AccessID"]
|
120
|
+
access_pass = result["AccessPass"]
|
121
|
+
result = @service.exec_tran({
|
122
|
+
:order_id => order_id,
|
123
|
+
:access_id => access_id,
|
124
|
+
:access_pass => access_pass,
|
125
|
+
:method => 1,
|
126
|
+
:pay_times => 1,
|
127
|
+
:card_no => "4111111111111111",
|
128
|
+
:expire => "1405"
|
129
|
+
})
|
130
|
+
result = @service.alter_tran({
|
131
|
+
:access_id => access_id,
|
132
|
+
:access_pass => access_pass,
|
133
|
+
:job_cd => "SALES",
|
134
|
+
:amount => 100
|
135
|
+
})
|
136
|
+
result["AccessID"].nil?.should_not be_true
|
137
|
+
result["AccessPass"].nil?.should_not be_true
|
138
|
+
result["Forward"].nil?.should_not be_true
|
139
|
+
result["Approve"].nil?.should_not be_true
|
140
|
+
result["AccessPass"].nil?.should_not be_true
|
141
|
+
result["TranID"].nil?.should_not be_true
|
142
|
+
result["TranDate"].nil?.should_not be_true
|
143
|
+
end
|
144
|
+
|
145
|
+
it "got error if missing options", :vcr do
|
146
|
+
lambda {
|
147
|
+
result = @service.alter_tran()
|
148
|
+
}.should raise_error
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
describe "#change_tran" do
|
153
|
+
it "gets data about order", :vcr do
|
154
|
+
order_id = 1003
|
155
|
+
result = @service.entry_tran({
|
156
|
+
:order_id => order_id,
|
157
|
+
:job_cd => "AUTH",
|
158
|
+
:amount => 100
|
159
|
+
})
|
160
|
+
access_id = result["AccessID"]
|
161
|
+
access_pass = result["AccessPass"]
|
162
|
+
result = @service.exec_tran({
|
163
|
+
:order_id => order_id,
|
164
|
+
:access_id => access_id,
|
165
|
+
:access_pass => access_pass,
|
166
|
+
:method => 1,
|
167
|
+
:pay_times => 1,
|
168
|
+
:card_no => "4111111111111111",
|
169
|
+
:expire => "1405"
|
170
|
+
})
|
171
|
+
result = @service.change_tran({
|
172
|
+
:access_id => access_id,
|
173
|
+
:access_pass => access_pass,
|
174
|
+
:job_cd => "AUTH",
|
175
|
+
:amount => 1000
|
176
|
+
})
|
177
|
+
result["AccessID"].nil?.should_not be_true
|
178
|
+
result["AccessPass"].nil?.should_not be_true
|
179
|
+
result["Forward"].nil?.should_not be_true
|
180
|
+
result["Approve"].nil?.should_not be_true
|
181
|
+
result["TranID"].nil?.should_not be_true
|
182
|
+
result["TranDate"].nil?.should_not be_true
|
183
|
+
end
|
184
|
+
|
185
|
+
it "got error if missing options", :vcr do
|
186
|
+
lambda {
|
187
|
+
result = @service.search_trade_multi()
|
188
|
+
}.should raise_error
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
|
193
|
+
describe "#search_trade" do
|
194
|
+
it "gets data about order", :vcr do
|
195
|
+
order_id = 1003
|
196
|
+
result = @service.search_trade({
|
197
|
+
:order_id => order_id
|
198
|
+
})
|
199
|
+
result["OrderID"].nil?.should_not be_true
|
200
|
+
result["Status"].nil?.should_not be_true
|
201
|
+
result["ProcessDate"].nil?.should_not be_true
|
202
|
+
result["JobCd"].nil?.should_not be_true
|
203
|
+
result["AccessID"].nil?.should_not be_true
|
204
|
+
result["AccessPass"].nil?.should_not be_true
|
205
|
+
result["ItemCode"].nil?.should_not be_true
|
206
|
+
result["Amount"].nil?.should_not be_true
|
207
|
+
result["Tax"].nil?.should_not be_true
|
208
|
+
result["SiteID"].nil?.should_not be_true
|
209
|
+
result["MemberID"].nil?.should_not be_true
|
210
|
+
result["CardNo"].nil?.should_not be_true
|
211
|
+
result["Expire"].nil?.should_not be_true
|
212
|
+
result["Method"].nil?.should_not be_true
|
213
|
+
result["PayTimes"].nil?.should_not be_true
|
214
|
+
result["Forward"].nil?.should_not be_true
|
215
|
+
result["TranID"].nil?.should_not be_true
|
216
|
+
result["Approve"].nil?.should_not be_true
|
217
|
+
end
|
218
|
+
|
219
|
+
it "got error if missing options", :vcr do
|
220
|
+
lambda {
|
221
|
+
result = @service.search_trade_multi()
|
222
|
+
}.should raise_error
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
226
|
+
describe "#search_trade_multi" do
|
227
|
+
it "gets data about order", :vcr do
|
228
|
+
client_field1 = "client_field1"
|
229
|
+
result = @service.search_trade_multi({
|
230
|
+
:order_id => 100,
|
231
|
+
:pay_type => "0"
|
232
|
+
})
|
233
|
+
result["Status"].nil?.should_not be_true
|
234
|
+
result["ProcessDate"].nil?.should_not be_true
|
235
|
+
result["JobCd"].nil?.should_not be_true
|
236
|
+
result["AccessID"].nil?.should_not be_true
|
237
|
+
result["AccessPass"].nil?.should_not be_true
|
238
|
+
result["ItemCode"].nil?.should_not be_true
|
239
|
+
result["Amount"].nil?.should_not be_true
|
240
|
+
result["Tax"].nil?.should_not be_true
|
241
|
+
result["SiteID"].nil?.should_not be_true
|
242
|
+
result["MemberID"].nil?.should_not be_true
|
243
|
+
result["CardNo"].nil?.should_not be_true
|
244
|
+
result["Expire"].nil?.should_not be_true
|
245
|
+
result["Method"].nil?.should_not be_true
|
246
|
+
result["PayTimes"].nil?.should_not be_true
|
247
|
+
result["Forward"].nil?.should_not be_true
|
248
|
+
result["TranID"].nil?.should_not be_true
|
249
|
+
result["Approve"].nil?.should_not be_true
|
250
|
+
result["PayType"].nil?.should_not be_true
|
251
|
+
result["PaymentTerm"].nil?.should_not be_true
|
252
|
+
end
|
253
|
+
|
254
|
+
it "got error if missing options", :vcr do
|
255
|
+
lambda {
|
256
|
+
result = @service.search_trade_multi()
|
257
|
+
}.should raise_error
|
258
|
+
end
|
259
|
+
end
|
260
|
+
|
261
|
+
end
|
@@ -0,0 +1,140 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "GMO::Payment::SiteAPI" do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
@service ||= GMO::Payment::SiteAPI.new({
|
7
|
+
:site_id => SPEC_CONF["site_id"],
|
8
|
+
:site_pass => SPEC_CONF["site_pass"]
|
9
|
+
})
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should raise an ArgumentError if no options passed" do
|
13
|
+
lambda {
|
14
|
+
service = GMO::Payment::SiteAPI.new()
|
15
|
+
}.should raise_error(ArgumentError)
|
16
|
+
end
|
17
|
+
|
18
|
+
it "has an attr_reader for site_id" do
|
19
|
+
@service.site_id.should == SPEC_CONF["site_id"]
|
20
|
+
end
|
21
|
+
|
22
|
+
it "has an attr_reader for site_pass" do
|
23
|
+
@service.site_pass.should == SPEC_CONF["site_pass"]
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "#save_member" do
|
27
|
+
it "gets data about a transaction", :vcr do
|
28
|
+
member_name = "John Smith"
|
29
|
+
result = @service.save_member({
|
30
|
+
:member_id => 100,
|
31
|
+
:member_name => member_name
|
32
|
+
})
|
33
|
+
result["MemberID"].nil?.should_not be_true
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe "#update_member" do
|
38
|
+
it "gets data about a transaction", :vcr do
|
39
|
+
member_id = 100
|
40
|
+
member_name = "John Smith2"
|
41
|
+
result = @service.update_member({
|
42
|
+
:member_id => member_id,
|
43
|
+
:member_name => member_name
|
44
|
+
})
|
45
|
+
result["MemberID"].nil?.should_not be_true
|
46
|
+
(result["MemberID"].to_i == member_id).should be_true
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
describe "#delete_member" do
|
51
|
+
it "gets data about a member", :vcr do
|
52
|
+
member_id = 100
|
53
|
+
result = @service.delete_member({
|
54
|
+
:member_id => member_id
|
55
|
+
})
|
56
|
+
result["MemberID"].nil?.should_not be_true
|
57
|
+
(result["MemberID"].to_i == member_id).should be_true
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe "#search_member" do
|
62
|
+
it "gets data about a member", :vcr do
|
63
|
+
member_name = "John Smith"
|
64
|
+
member_id = 101
|
65
|
+
result = @service.save_member({
|
66
|
+
:member_id => 101,
|
67
|
+
:member_name => member_name
|
68
|
+
})
|
69
|
+
result["MemberID"].nil?.should_not be_true
|
70
|
+
|
71
|
+
result = @service.search_member({
|
72
|
+
:member_id => member_id
|
73
|
+
})
|
74
|
+
result["MemberID"].nil?.should_not be_true
|
75
|
+
(result["MemberID"].to_i == member_id).should be_true
|
76
|
+
result["MemberName"].nil?.should_not be_true
|
77
|
+
(result["MemberName"].to_s == member_name).should be_true
|
78
|
+
result["DeleteFlag"].nil?.should_not be_true
|
79
|
+
(result["DeleteFlag"].to_i == 0).should be_true
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
describe "#save_card" do
|
84
|
+
it "gets data about a card", :vcr do
|
85
|
+
member_id = 101
|
86
|
+
card_no = "4111111111111111"
|
87
|
+
expire = "1405"
|
88
|
+
result = @service.save_card({
|
89
|
+
:member_id => member_id,
|
90
|
+
:card_no => card_no,
|
91
|
+
:expire => expire
|
92
|
+
})
|
93
|
+
result["CardNo"].nil?.should_not be_true
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
describe "#delete_card" do
|
98
|
+
it "gets data about a card", :vcr do
|
99
|
+
member_id = 101
|
100
|
+
card_seq = 0
|
101
|
+
result = @service.delete_card({
|
102
|
+
:member_id => member_id,
|
103
|
+
:card_seq => card_seq
|
104
|
+
})
|
105
|
+
result["CardSeq"].nil?.should_not be_true
|
106
|
+
(result["CardSeq"].to_i == card_seq).should be_true
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
describe "#search_card" do
|
111
|
+
it "gets data about a card", :vcr do
|
112
|
+
member_id = 101
|
113
|
+
card_no = "4111111111111111"
|
114
|
+
expire = "1405"
|
115
|
+
result = @service.save_card({
|
116
|
+
:member_id => member_id,
|
117
|
+
:card_no => card_no,
|
118
|
+
:expire => expire
|
119
|
+
})
|
120
|
+
card_seq = 0
|
121
|
+
seq_mode = 0
|
122
|
+
result = @service.search_card({
|
123
|
+
:member_id => member_id,
|
124
|
+
:card_seq => card_seq,
|
125
|
+
:seq_mode => seq_mode
|
126
|
+
})
|
127
|
+
result["CardSeq"].nil?.should_not be_true
|
128
|
+
(result["CardSeq"].to_i == card_seq).should be_true
|
129
|
+
result["DefaultFlag"].nil?.should_not be_true
|
130
|
+
(result["DefaultFlag"].to_i == 0).should be_true
|
131
|
+
result["CardName"].nil?.should_not be_true
|
132
|
+
result["CardNo"].nil?.should_not be_true
|
133
|
+
result["Expire"].nil?.should_not be_true
|
134
|
+
(result["Expire"].to_s == expire).should be_true
|
135
|
+
result["HolderName"].nil?.should_not be_true
|
136
|
+
result["DeleteFlag"].nil?.should_not be_true
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
end
|