gmo 0.3.0 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +1 -0
  3. data/.travis.yml +5 -9
  4. data/CHANGELOG.md +37 -1
  5. data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_cancel_deposit_gets_data_about_a_deposit.yml +38 -0
  6. data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_cancel_mail_deposit_gets_data_about_a_mail_deposit.yml +38 -0
  7. data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_create_account_gets_data_about_an_account.yml +38 -0
  8. data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_create_deposit_gets_data_about_a_deposit.yml +38 -0
  9. data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_create_mail_deposit_gets_data_about_a_mail_deposit.yml +38 -0
  10. data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_delete_account_gets_data_about_an_account.yml +38 -0
  11. data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_search_account_gets_data_about_an_account.yml +38 -0
  12. data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_search_balance_gets_data_about_balance.yml +38 -0
  13. data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_search_deposit_gets_data_about_a_deposit.yml +38 -0
  14. data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_search_mail_deposit_gets_data_about_a_mail_deposit.yml +38 -0
  15. data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_update_account_gets_data_about_an_account.yml +38 -0
  16. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_change_tran_brandtoken_gets_data_about_order.yml +108 -0
  17. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_cvs_cancel_gets_data_about_a_transaction.yml +63 -0
  18. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_brandtoken_gets_data_about_a_transaction.yml +38 -0
  19. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_docomo_gets_data_about_a_transaction.yml +35 -0
  20. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_rakuten_id_gets_data_about_a_transaction.yml +35 -0
  21. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_brandtoken_gets_data_about_a_transaction.yml +73 -0
  22. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_brandtoken_parameter_contains_Japanese_characters_should_correctly_handle_Japanese.yml +73 -0
  23. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_docomo_gets_data_about_a_transaction.yml +67 -0
  24. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_doesn_t_require_card_info_if_token_is_present.yml +69 -0
  25. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_rakuten_id_gets_data_about_a_transaction.yml +67 -0
  26. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_refund_tran_brandtoken_gets_data_about_a_transaction.yml +108 -0
  27. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_sales_tran_brandtoken_gets_data_about_a_transaction.yml +143 -0
  28. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_secure_tran_gets_data_about_a_transaction.yml +36 -0
  29. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_void_tran_brandtoken_gets_data_about_order.yml +108 -0
  30. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/secure_tran_request_params.yml +2 -0
  31. data/fixtures/vcr_cassettes/GMO_Payment_ShopAndSiteAPI/_exec_tran_brandtoken_got_data.yml +73 -0
  32. data/fixtures/vcr_cassettes/GMO_Payment_ShopAndSiteAPI/_trade_brandtoken_got_data.yml +108 -0
  33. data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_delete_brandtoken_gets_data_about_a_brandtoken.yml +73 -0
  34. data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_search_brandtoken_gets_data_about_a_brandtoken.yml +74 -0
  35. data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_search_card_detail_by_member_id_gets_data_about_card_detail.yml +36 -0
  36. data/lib/gmo.rb +10 -3
  37. data/lib/gmo/const.rb +2502 -3
  38. data/lib/gmo/errors.rb +22 -4
  39. data/lib/gmo/remittance_api.rb +331 -0
  40. data/lib/gmo/shop_and_site_api.rb +77 -2
  41. data/lib/gmo/shop_api.rb +315 -5
  42. data/lib/gmo/site_api.rb +70 -3
  43. data/lib/gmo/version.rb +2 -2
  44. data/spec/gmo/{error_spec.rb → errors_spec.rb} +11 -2
  45. data/spec/gmo/remittance_api_spec.rb +506 -0
  46. data/spec/gmo/shop_and_site_api_spec.rb +83 -3
  47. data/spec/gmo/shop_api_spec.rb +429 -1
  48. data/spec/gmo/site_api_spec.rb +88 -1
  49. data/spec/support/config.example.yml +5 -0
  50. data/spec/support/config.yml +5 -0
  51. data/spec/support/config_loader.rb +1 -1
  52. data/spec/support/vcr.rb +9 -2
  53. metadata +41 -8
@@ -7,10 +7,21 @@ describe "GMO::Payment::SiteAPI" do
7
7
  end
8
8
 
9
9
  before(:each) do
10
+ @shop_site ||= GMO::Payment::ShopAndSiteAPI.new({
11
+ :site_id => SPEC_CONF["site_id"],
12
+ :site_pass => SPEC_CONF["site_pass"],
13
+ :shop_id => SPEC_CONF["shop_id"],
14
+ :shop_pass => SPEC_CONF["shop_pass"],
15
+ :host => SPEC_CONF["host"],
16
+ :locale => :ja
17
+
18
+ })
10
19
  @service ||= GMO::Payment::SiteAPI.new({
11
20
  :site_id => SPEC_CONF["site_id"],
12
21
  :site_pass => SPEC_CONF["site_pass"],
13
- :host => SPEC_CONF["host"]
22
+ :host => SPEC_CONF["host"],
23
+ :locale => :ja
24
+
14
25
  })
15
26
  end
16
27
 
@@ -200,4 +211,80 @@ describe "GMO::Payment::SiteAPI" do
200
211
  end
201
212
  end
202
213
 
214
+ describe "#search_card_detail_by_member_id" do
215
+ it "gets data about card detail", :vcr do
216
+ member_id = generate_id
217
+ seq_mode = 0
218
+ result = @service.search_card_detail_by_member_id({
219
+ :member_id => member_id,
220
+ :seq_mode => seq_mode
221
+ })
222
+ result["CardNo"].nil?.should_not be_truthy
223
+ result["Brand"].nil?.should_not be_truthy
224
+ result["DomesticFlag"].nil?.should_not be_truthy
225
+ result["IssuerCode"].nil?.should_not be_truthy
226
+ result["DebitPrepaidFlag"].nil?.should_not be_truthy
227
+ result["DebitPrepaidIssuerName"].nil?.should_not be_truthy
228
+ result["ForwardFinal"].nil?.should_not be_truthy
229
+ end
230
+
231
+ it "got error if missing options", :vcr do
232
+ lambda {
233
+ result = @service.search_card_detail_by_member_id()
234
+ }.should raise_error("Required member_id, seq_mode were not provided.")
235
+ end
236
+ end
237
+
238
+ describe "#search_brandtoken" do
239
+ it "gets data about a brandtoken", :vcr do
240
+ order_id = generate_id
241
+ member_id = generate_id
242
+ @shop_site.trade_brandtoken({
243
+ :order_id => order_id,
244
+ :member_id => member_id
245
+ })
246
+
247
+ result = @service.search_brandtoken({
248
+ :member_id => member_id,
249
+ :seq_mode => 0
250
+ })
251
+ result["TokenSeq"].nil?.should_not be true
252
+ result["DefaultFlag"].nil?.should_not be true
253
+ result["CardName"].nil?.should_not be true
254
+ result["CardNoToken"].nil?.should_not be true
255
+ result["Expire"].nil?.should_not be true
256
+ result["HolderName"].nil?.should_not be true
257
+ result["DeleteFlag"].nil?.should_not be true
258
+ end
259
+
260
+ it "got error if missing options", :vcr do
261
+ lambda {
262
+ result = @service.search_brandtoken()
263
+ }.should raise_error("Required member_id, seq_mode were not provided.")
264
+ end
265
+ end
266
+
267
+ describe "#delete_brandtoken" do
268
+ it "gets data about a brandtoken", :vcr do
269
+ order_id = generate_id
270
+ member_id = generate_id
271
+ @shop_site.trade_brandtoken({
272
+ :order_id => order_id,
273
+ :member_id => member_id
274
+ })
275
+
276
+ result = @service.delete_brandtoken({
277
+ :member_id => member_id,
278
+ :seq_mode => 0,
279
+ :token_seq => 0
280
+ })
281
+ result["TokenSeq"].nil?.should_not be true
282
+ end
283
+
284
+ it "got error if missing options", :vcr do
285
+ lambda {
286
+ result = @service.delete_brandtoken()
287
+ }.should raise_error('Required member_id, seq_mode, token_seq were not provided.')
288
+ end
289
+ end
203
290
  end
@@ -5,3 +5,8 @@ site_pass: hoge
5
5
  host: pt01.mul-pay.jp
6
6
  token: token
7
7
  token_member_id: 1
8
+
9
+ remittance:
10
+ shop_id: tshophoge
11
+ shop_pass: hoge
12
+ host: test-remittance.gmopg.jp
@@ -5,3 +5,8 @@ site_pass: 1
5
5
  host: pt01.mul-pay.jp
6
6
  token_member_id: 1
7
7
  token: 1
8
+
9
+ remittance:
10
+ shop_id: rshop00000001
11
+ shop_pass: 1234abcd
12
+ host: test-remittance.gmopg.jp
@@ -1,2 +1,2 @@
1
1
  require 'yaml'
2
- SPEC_CONF = YAML.load_file(File.join(File.dirname(__FILE__), 'config.yml'))
2
+ SPEC_CONF = YAML.load_file(File.join(File.dirname(__FILE__), 'config.yml'))
data/spec/support/vcr.rb CHANGED
@@ -3,12 +3,19 @@ VCR.configure do |c|
3
3
  c.hook_into :webmock
4
4
  c.allow_http_connections_when_no_cassette = true
5
5
  c.default_cassette_options = { :record => :new_episodes }
6
+
7
+ # Filter remittance config before others to correctly hide config from vcr cassettes
8
+ # as its values are bigger in length than others and should completely be replaced with given strings.
9
+ c.filter_sensitive_data('<REMITTANCE_SHOP_ID>') { SPEC_CONF["remittance"]["shop_id"] }
10
+ c.filter_sensitive_data('<REMITTANCE_SHOP_PASS>') { SPEC_CONF["remittance"]["shop_pass"] }
11
+ c.filter_sensitive_data('<REMITTANCE_HOST>') { SPEC_CONF["remittance"]["host"] }
12
+
13
+ c.filter_sensitive_data('<HOST>') { SPEC_CONF["host"] }
6
14
  c.filter_sensitive_data('<SHOP_ID>') { SPEC_CONF["shop_id"] }
7
- c.filter_sensitive_data('<SHOP_PASS>') { SPEC_CONF["shop_pass"] }
8
15
  c.filter_sensitive_data('<SITE_ID>') { SPEC_CONF["site_id"] }
16
+ c.filter_sensitive_data('<SHOP_PASS>') { SPEC_CONF["shop_pass"] }
9
17
  c.filter_sensitive_data('<SITE_PASS>') { SPEC_CONF["site_pass"] }
10
18
  c.filter_sensitive_data('<SITE_PASS>') { SPEC_CONF["site_pass"] }
11
- c.filter_sensitive_data('<HOST>') { SPEC_CONF["host"] }
12
19
  c.filter_sensitive_data('<TOKEN>') { SPEC_CONF["token"] }
13
20
  c.filter_sensitive_data('<TOKEN_MEMBER_ID>') { SPEC_CONF["token_member_id"] }
14
21
  c.filter_sensitive_data('<ACCESS_ID>') { ACCESS_ID }
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.3.0
4
+ version: 0.5.3
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: 2017-02-10 00:00:00.000000000 Z
11
+ date: 2021-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -111,34 +111,65 @@ files:
111
111
  - README.md
112
112
  - Rakefile
113
113
  - autotest/discover.rb
114
+ - fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_cancel_deposit_gets_data_about_a_deposit.yml
115
+ - fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_cancel_mail_deposit_gets_data_about_a_mail_deposit.yml
116
+ - fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_create_account_gets_data_about_an_account.yml
117
+ - fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_create_deposit_gets_data_about_a_deposit.yml
118
+ - fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_create_mail_deposit_gets_data_about_a_mail_deposit.yml
119
+ - fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_delete_account_gets_data_about_an_account.yml
120
+ - fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_search_account_gets_data_about_an_account.yml
121
+ - fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_search_balance_gets_data_about_balance.yml
122
+ - fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_search_deposit_gets_data_about_a_deposit.yml
123
+ - fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_search_mail_deposit_gets_data_about_a_mail_deposit.yml
124
+ - fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_update_account_gets_data_about_an_account.yml
114
125
  - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_alter_tran_change_order_auth_to_sale.yml
115
126
  - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_alter_tran_gets_data_about_order.yml
116
127
  - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_alter_tran_got_error_if_missing_options.yml
128
+ - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_change_tran_brandtoken_gets_data_about_order.yml
117
129
  - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_change_tran_gets_data_about_order.yml
118
130
  - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_change_tran_got_error_if_missing_options.yml
131
+ - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_cvs_cancel_gets_data_about_a_transaction.yml
132
+ - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_brandtoken_gets_data_about_a_transaction.yml
119
133
  - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_cvs_gets_data_about_a_transaction.yml
120
134
  - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_cvs_got_error_if_missing_options.yml
135
+ - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_docomo_gets_data_about_a_transaction.yml
121
136
  - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_gets_data_about_a_transaction.yml
122
137
  - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_got_error_if_missing_options.yml
123
138
  - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_linepay_gets_data_about_a_transaction.yml
124
139
  - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_pay_easy_gets_data_about_a_transaction.yml
140
+ - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_rakuten_id_gets_data_about_a_transaction.yml
141
+ - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_brandtoken_gets_data_about_a_transaction.yml
142
+ - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_brandtoken_parameter_contains_Japanese_characters_should_correctly_handle_Japanese.yml
125
143
  - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_cvs_gets_data_about_a_transaction.yml
144
+ - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_docomo_gets_data_about_a_transaction.yml
145
+ - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_doesn_t_require_card_info_if_token_is_present.yml
126
146
  - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_gets_data_about_a_transaction.yml
127
147
  - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_got_error_if_missing_options.yml
128
148
  - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_linepay_gets_data_about_a_transaction.yml
129
149
  - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_parameter_contains_Japanese_characters_should_correctly_handle_Japanese.yml
130
150
  - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_pay_easy_gets_data_about_a_transaction.yml
151
+ - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_rakuten_id_gets_data_about_a_transaction.yml
152
+ - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_refund_tran_brandtoken_gets_data_about_a_transaction.yml
153
+ - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_sales_tran_brandtoken_gets_data_about_a_transaction.yml
131
154
  - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_search_trade_gets_data_about_order.yml
132
155
  - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_search_trade_got_error_if_missing_options.yml
133
156
  - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_search_trade_multi_gets_data_about_order.yml
134
157
  - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_search_trade_multi_got_error_if_missing_options.yml
158
+ - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_secure_tran_gets_data_about_a_transaction.yml
159
+ - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_void_tran_brandtoken_gets_data_about_order.yml
160
+ - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/secure_tran_request_params.yml
161
+ - fixtures/vcr_cassettes/GMO_Payment_ShopAndSiteAPI/_exec_tran_brandtoken_got_data.yml
162
+ - fixtures/vcr_cassettes/GMO_Payment_ShopAndSiteAPI/_trade_brandtoken_got_data.yml
135
163
  - fixtures/vcr_cassettes/GMO_Payment_ShopAndSiteAPI/_trade_card_got_data.yml
136
164
  - fixtures/vcr_cassettes/GMO_Payment_ShopAndSiteAPI/_trade_card_got_error_if_missing_options.yml
165
+ - fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_delete_brandtoken_gets_data_about_a_brandtoken.yml
137
166
  - fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_delete_card_gets_data_about_a_card.yml
138
167
  - fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_delete_member_gets_data_about_a_member.yml
139
168
  - fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_save_card_doesn_t_require_card_info_if_token_is_present.yml
140
169
  - fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_save_card_gets_data_about_a_card.yml
141
170
  - fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_save_member_gets_data_about_a_transaction.yml
171
+ - fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_search_brandtoken_gets_data_about_a_brandtoken.yml
172
+ - fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_search_card_detail_by_member_id_gets_data_about_card_detail.yml
142
173
  - fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_search_card_gets_data_about_a_card.yml
143
174
  - fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_search_member_gets_data_about_a_member.yml
144
175
  - fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_update_member_gets_data_about_a_transaction.yml
@@ -148,14 +179,16 @@ files:
148
179
  - lib/gmo/errors.rb
149
180
  - lib/gmo/http_services.rb
150
181
  - lib/gmo/json.rb
182
+ - lib/gmo/remittance_api.rb
151
183
  - lib/gmo/shop_and_site_api.rb
152
184
  - lib/gmo/shop_api.rb
153
185
  - lib/gmo/site_api.rb
154
186
  - lib/gmo/version.rb
155
187
  - spec/gmo/api_spec.rb
156
- - spec/gmo/error_spec.rb
188
+ - spec/gmo/errors_spec.rb
157
189
  - spec/gmo/http_service_spec.rb
158
190
  - spec/gmo/json_spec.rb
191
+ - spec/gmo/remittance_api_spec.rb
159
192
  - spec/gmo/shop_and_site_api_spec.rb
160
193
  - spec/gmo/shop_api_spec.rb
161
194
  - spec/gmo/site_api_spec.rb
@@ -170,7 +203,7 @@ homepage: https://github.com/t-k/gmo-payment-ruby
170
203
  licenses:
171
204
  - MIT
172
205
  metadata: {}
173
- post_install_message:
206
+ post_install_message:
174
207
  rdoc_options:
175
208
  - "--line-numbers"
176
209
  - "--inline-source"
@@ -189,9 +222,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
189
222
  - !ruby/object:Gem::Version
190
223
  version: '0'
191
224
  requirements: []
192
- rubyforge_project:
193
- rubygems_version: 2.5.1
194
- signing_key:
225
+ rubyforge_project:
226
+ rubygems_version: 2.7.8
227
+ signing_key:
195
228
  specification_version: 4
196
229
  summary: 'GMO Payment API client: Ruby client library for the GMO Payment Platform.'
197
230
  test_files: []