gmo 0.2.4 → 0.5.0
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 +5 -5
- data/.travis.yml +9 -4
- data/CHANGELOG.md +42 -1
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_cancel_deposit_gets_data_about_a_deposit.yml +38 -0
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_cancel_mail_deposit_gets_data_about_a_mail_deposit.yml +38 -0
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_create_account_gets_data_about_an_account.yml +38 -0
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_create_deposit_gets_data_about_a_deposit.yml +38 -0
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_create_mail_deposit_gets_data_about_a_mail_deposit.yml +38 -0
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_delete_account_gets_data_about_an_account.yml +38 -0
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_search_account_gets_data_about_an_account.yml +38 -0
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_search_balance_gets_data_about_balance.yml +38 -0
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_search_deposit_gets_data_about_a_deposit.yml +38 -0
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_search_mail_deposit_gets_data_about_a_mail_deposit.yml +38 -0
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_update_account_gets_data_about_an_account.yml +38 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_change_tran_brandtoken_gets_data_about_order.yml +108 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_cvs_cancel_gets_data_about_a_transaction.yml +63 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_brandtoken_gets_data_about_a_transaction.yml +38 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_linepay_gets_data_about_a_transaction.yml +36 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_pay_easy_gets_data_about_a_transaction.yml +36 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_brandtoken_gets_data_about_a_transaction.yml +73 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_brandtoken_parameter_contains_Japanese_characters_should_correctly_handle_Japanese.yml +73 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_doesn_t_require_card_info_if_token_is_present.yml +69 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_linepay_gets_data_about_a_transaction.yml +69 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_pay_easy_gets_data_about_a_transaction.yml +69 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_refund_tran_brandtoken_gets_data_about_a_transaction.yml +108 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_sales_tran_brandtoken_gets_data_about_a_transaction.yml +143 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_void_tran_brandtoken_gets_data_about_order.yml +108 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAndSiteAPI/_exec_tran_brandtoken_got_data.yml +73 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAndSiteAPI/_trade_brandtoken_got_data.yml +108 -0
- data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_delete_brandtoken_gets_data_about_a_brandtoken.yml +73 -0
- data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_save_card_doesn_t_require_card_info_if_token_is_present.yml +36 -0
- data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_search_brandtoken_gets_data_about_a_brandtoken.yml +74 -0
- data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_search_card_detail_by_member_id_gets_data_about_card_detail.yml +36 -0
- data/gmo.gemspec +2 -2
- data/lib/gmo.rb +6 -1
- data/lib/gmo/const.rb +2297 -3
- data/lib/gmo/errors.rb +22 -4
- data/lib/gmo/http_services.rb +5 -5
- data/lib/gmo/remittance_api.rb +331 -0
- data/lib/gmo/shop_and_site_api.rb +79 -5
- data/lib/gmo/shop_api.rb +282 -10
- data/lib/gmo/site_api.rb +77 -7
- data/lib/gmo/version.rb +2 -2
- data/spec/gmo/{error_spec.rb → errors_spec.rb} +11 -2
- data/spec/gmo/remittance_api_spec.rb +506 -0
- data/spec/gmo/shop_and_site_api_spec.rb +87 -7
- data/spec/gmo/shop_api_spec.rb +509 -99
- data/spec/gmo/site_api_spec.rb +120 -23
- data/spec/support/config.example.yml +8 -1
- data/spec/support/config.yml +8 -1
- data/spec/support/config_loader.rb +1 -1
- data/spec/support/vcr.rb +12 -3
- metadata +40 -9
data/lib/gmo/shop_api.rb
CHANGED
@@ -6,7 +6,9 @@
|
|
6
6
|
# gmo = GMO::Payment::ShopAPI.new({
|
7
7
|
# shop_id: "foo",
|
8
8
|
# shop_pass: "bar",
|
9
|
-
# host:
|
9
|
+
# host: "mul-pay.com",
|
10
|
+
# locale: "ja"
|
11
|
+
|
10
12
|
# })
|
11
13
|
# result = gmo.post_request("EntryTran.idPass", options)
|
12
14
|
module GMO
|
@@ -18,11 +20,12 @@ module GMO
|
|
18
20
|
@shop_id = options[:shop_id]
|
19
21
|
@shop_pass = options[:shop_pass]
|
20
22
|
@host = options[:host]
|
23
|
+
@locale = options.fetch(:locale, GMO::Const::DEFAULT_LOCALE)
|
21
24
|
unless @shop_id && @shop_pass && @host
|
22
25
|
raise ArgumentError, "Initialize must receive a hash with :shop_id, :shop_pass and either :host! (received #{options.inspect})"
|
23
26
|
end
|
24
27
|
end
|
25
|
-
attr_reader :shop_id, :shop_pass, :host
|
28
|
+
attr_reader :shop_id, :shop_pass, :host, :locale
|
26
29
|
|
27
30
|
## 2.1.2.1.取引登録
|
28
31
|
# これ以降の決済取引で必要となる取引 ID と取引パスワードの発行を行い、取引を開始します。
|
@@ -50,7 +53,6 @@ module GMO
|
|
50
53
|
post_request name, options
|
51
54
|
end
|
52
55
|
|
53
|
-
|
54
56
|
# 【コンビニ払い】
|
55
57
|
# 2.1.2.1. 取引登録
|
56
58
|
# これ以降の決済取引で必要となる取引IDと取引パスワードの発行を行い、取引を開始します。
|
@@ -61,6 +63,51 @@ module GMO
|
|
61
63
|
post_request name, options
|
62
64
|
end
|
63
65
|
|
66
|
+
# 【Pay-easy決済】
|
67
|
+
# 5.1.2.1. 取引登録
|
68
|
+
# これ以降の決済取引で必要となる取引IDと取引パスワードの発行を行い、取引を開始します。
|
69
|
+
def entry_tran_pay_easy(options = {})
|
70
|
+
name = "EntryTranPayEasy.idPass"
|
71
|
+
required = [:order_id, :amount]
|
72
|
+
assert_required_options(required, options)
|
73
|
+
post_request name, options
|
74
|
+
end
|
75
|
+
|
76
|
+
# 【LINE Pay決済】
|
77
|
+
# 20.1.2.1. 取引登録
|
78
|
+
# これ以降の決済取引で必要となる取引IDと取引パスワードの発行を行い、取引を開始します。
|
79
|
+
def entry_tran_linepay(options = {})
|
80
|
+
name = "EntryTranLinepay.idPass"
|
81
|
+
required = [:order_id, :job_cd, :amount]
|
82
|
+
assert_required_options(required, options)
|
83
|
+
post_request name, options
|
84
|
+
end
|
85
|
+
|
86
|
+
### @params ###
|
87
|
+
# OrderID
|
88
|
+
# JobCd
|
89
|
+
# Amount
|
90
|
+
# ItemCode
|
91
|
+
# Tax
|
92
|
+
### @return ###
|
93
|
+
# AccessID
|
94
|
+
# AccessPass
|
95
|
+
### example ###
|
96
|
+
# gmo.entry_tran_brandtoken({
|
97
|
+
# order_id: "ord12345",
|
98
|
+
# job_cd: "AUTH",
|
99
|
+
# item_code: "1000001",
|
100
|
+
# tax: "0001001",
|
101
|
+
# amount: 100
|
102
|
+
# })
|
103
|
+
# => {"AccessID"=>"139f8ec33a07c55f406937c52ce4473d", "AccessPass"=>"2689b204d2c17192fa35f9269fa7e744"}
|
104
|
+
def entry_tran_brandtoken(options = {})
|
105
|
+
name = "EntryTranBrandtoken.idPass"
|
106
|
+
required = [:order_id, :job_cd, :amount]
|
107
|
+
assert_required_options(required, options)
|
108
|
+
post_request name, options
|
109
|
+
end
|
110
|
+
|
64
111
|
## 2.2.2.2.決済実行
|
65
112
|
# 指定されたサイトに会員を登録します。
|
66
113
|
# return
|
@@ -125,7 +172,11 @@ module GMO
|
|
125
172
|
# "ClientField3" => options[:client_field_3],
|
126
173
|
# "ClientFieldFlag" => client_field_flg
|
127
174
|
# }
|
128
|
-
|
175
|
+
if options[:token].nil?
|
176
|
+
required = [:access_id, :access_pass, :order_id, :card_no, :expire]
|
177
|
+
else
|
178
|
+
required = [:access_id, :access_pass, :token]
|
179
|
+
end
|
129
180
|
assert_required_options(required, options)
|
130
181
|
post_request name, options
|
131
182
|
end
|
@@ -135,7 +186,70 @@ module GMO
|
|
135
186
|
# お客様が入力した情報で後続の決済センターと通信を行い決済を実施し、結果を返します。
|
136
187
|
def exec_tran_cvs(options = {})
|
137
188
|
name = "ExecTranCvs.idPass"
|
138
|
-
required = [:access_id, :access_pass, :order_id, :convenience, :customer_name, :tel_no, :receipts_disp_11, :receipts_disp_12, :receipts_disp_13]
|
189
|
+
required = [:access_id, :access_pass, :order_id, :convenience, :customer_name, :customer_kana, :tel_no, :receipts_disp_11, :receipts_disp_12, :receipts_disp_13]
|
190
|
+
assert_required_options(required, options)
|
191
|
+
post_request name, options
|
192
|
+
end
|
193
|
+
|
194
|
+
# 【Pay-easy決済】
|
195
|
+
# 5.1.2.2. 決済実行
|
196
|
+
# お客様が入力した情報で後続の決済センターと通信を行い決済を実施し、結果を返します。
|
197
|
+
def exec_tran_pay_easy(options = {})
|
198
|
+
name = "ExecTranPayEasy.idPass"
|
199
|
+
required = [:access_id, :access_pass, :order_id, :customer_name, :customer_kana, :tel_no, :receipts_disp_11, :receipts_disp_12, :receipts_disp_13]
|
200
|
+
assert_required_options(required, options)
|
201
|
+
post_request name, options
|
202
|
+
end
|
203
|
+
|
204
|
+
# 【LINE Pay決済】
|
205
|
+
# 20.1.2.2. 決済実行
|
206
|
+
def exec_tran_linepay(options = {})
|
207
|
+
name = "ExecTranLinepay.idPass"
|
208
|
+
required = [:access_id, :access_pass, :order_id, :ret_url, :error_rcv_url, :product_name]
|
209
|
+
assert_required_options(required, options)
|
210
|
+
post_request name, options
|
211
|
+
end
|
212
|
+
|
213
|
+
### @params ###
|
214
|
+
# AccessID
|
215
|
+
# AccessPass
|
216
|
+
# OrderID
|
217
|
+
# TokenType
|
218
|
+
# Token
|
219
|
+
# MemberID
|
220
|
+
# SeqMode
|
221
|
+
# TokenSeq
|
222
|
+
# ClientField1
|
223
|
+
# ClientField2
|
224
|
+
# ClientField3
|
225
|
+
### @return ###
|
226
|
+
# Status
|
227
|
+
# OrderID
|
228
|
+
# Forward
|
229
|
+
# Approve
|
230
|
+
# TranID
|
231
|
+
# TranDate
|
232
|
+
# ClientField1
|
233
|
+
# ClientField2
|
234
|
+
# ClientField3
|
235
|
+
### example ###
|
236
|
+
# gmo.exec_tran_brandtoken({
|
237
|
+
# order_id: "597ae8c36120b23a3c00014e",
|
238
|
+
# access_id: "139f8ec33a07c55f406937c52ce4473d",
|
239
|
+
# access_pass: "2689b204d2c17192fa35f9269fa7e744",
|
240
|
+
# token_type: :apple_pay,
|
241
|
+
# token: <Base64 encoded payment data>,
|
242
|
+
# seq_mode: "1",
|
243
|
+
# token_seq: 1001,
|
244
|
+
# client_field_1: "Custom field value 1",
|
245
|
+
# client_field_2: "Custom field value 2",
|
246
|
+
# client_field_3: "Custom field value 3"
|
247
|
+
# })
|
248
|
+
# => {"Status"=>"CAPTURE", "OrderID"=>"597ae8c36120b23a3c00014e", "Forward"=>"2a99663", "Approve"=>"5487394", "TranID"=>"1707281634111111111111771216", "TranDate"=>"20170728163453", "ClientField1"=>"Custom field value 1", "ClientField2"=>"Custom field value 2", "ClientField3"=>"Custom field value 3"}
|
249
|
+
def exec_tran_brandtoken(options = {})
|
250
|
+
name = "ExecTranBrandtoken.idPass"
|
251
|
+
options[:token_type] = GMO::Const::TOKEN_TYPES_MAP[options[:token_type]]
|
252
|
+
required = [:access_id, :access_pass, :order_id]
|
139
253
|
assert_required_options(required, options)
|
140
254
|
post_request name, options
|
141
255
|
end
|
@@ -184,8 +298,8 @@ module GMO
|
|
184
298
|
# gmo.change_tran({
|
185
299
|
# access_id: "a41d83f1f4c908baeda04e6dc03e300c",
|
186
300
|
# access_pass: "d72eca02e28c88f98b9341a33ba46d5d",
|
187
|
-
#
|
188
|
-
#
|
301
|
+
# job_cd: "CAPTURE",
|
302
|
+
# amount: 100
|
189
303
|
# })
|
190
304
|
def change_tran(options = {})
|
191
305
|
name = "ChangeTran.idPass"
|
@@ -194,6 +308,133 @@ module GMO
|
|
194
308
|
post_request name, options
|
195
309
|
end
|
196
310
|
|
311
|
+
### @params ###
|
312
|
+
# AccessID
|
313
|
+
# AccessPass
|
314
|
+
# OrderID
|
315
|
+
# JobCd
|
316
|
+
# Amount
|
317
|
+
# Tax
|
318
|
+
### @return ###
|
319
|
+
# AccessID
|
320
|
+
# AccessPass
|
321
|
+
# Status
|
322
|
+
# Forward
|
323
|
+
# Approve
|
324
|
+
# TranID
|
325
|
+
# TranDate
|
326
|
+
### example ###
|
327
|
+
# gmo.change_tran_brandtoken({
|
328
|
+
# access_id: "21170701482c86c3b88ff72b83bfd363",
|
329
|
+
# access_pass: "51f36feba120de1e6e29532e5a3a5e3e",
|
330
|
+
# order_id: "ord10001",
|
331
|
+
# job_cd: "CAPTURE",
|
332
|
+
# amount: 2000
|
333
|
+
# })
|
334
|
+
# => {"AccessID"=>"21170701482c86c3b88ff72b83bfd363", "AccessPass"=>"51f36feba120de1e6e29532e5a3a5e3e", "Status"=>"CAPTURE", "Forward"=>"2a99663", "Approve"=>"5538477", "TranID"=>"1707311633111111111111771224", "TranDate"=>"20170731163343"}
|
335
|
+
def change_tran_brandtoken(options = {})
|
336
|
+
name = "ChangeTranBrandtoken.idPass"
|
337
|
+
required = [:access_id, :access_pass, :order_id, :job_cd, :amount]
|
338
|
+
assert_required_options(required, options)
|
339
|
+
post_request name, options
|
340
|
+
end
|
341
|
+
|
342
|
+
### @params ###
|
343
|
+
# AccessID
|
344
|
+
# AccessPass
|
345
|
+
# OrderID
|
346
|
+
### @return ###
|
347
|
+
# AccessID
|
348
|
+
# AccessPass
|
349
|
+
# Status
|
350
|
+
# Forward
|
351
|
+
# Approve
|
352
|
+
# TranID
|
353
|
+
# TranDate
|
354
|
+
### example ###
|
355
|
+
# gmo.void_tran_brandtoken({
|
356
|
+
# access_id: "139f8ec33a07c55f406937c52ce4473d",
|
357
|
+
# access_pass: "2689b204d2c17192fa35f9269fa7e744",
|
358
|
+
# order_id: "597ae8c36120b23a3c00014e"
|
359
|
+
# })
|
360
|
+
# => {"AccessID"=>"139f8ec33a07c55f406937c52ce4473d", "AccessPass"=>"2689b204d2c17192fa35f9269fa7e744", "Status"=>"VOID", "Forward"=>"2a99663", "Approve"=>"5537590", "TranID"=>"1707311610111111111111771219", "TranDate"=>"20170731161007"}
|
361
|
+
def void_tran_brandtoken(options = {})
|
362
|
+
name = "VoidTranBrandtoken.idPass"
|
363
|
+
required = [:access_id, :access_pass, :order_id]
|
364
|
+
assert_required_options(required, options)
|
365
|
+
post_request name, options
|
366
|
+
end
|
367
|
+
|
368
|
+
### @params ###
|
369
|
+
# AccessID
|
370
|
+
# AccessPass
|
371
|
+
# OrderID
|
372
|
+
# Amount
|
373
|
+
# Tax
|
374
|
+
### @return ###
|
375
|
+
# AccessID
|
376
|
+
# AccessPass
|
377
|
+
# Status
|
378
|
+
# Forward
|
379
|
+
# Approve
|
380
|
+
# TranID
|
381
|
+
# TranDate
|
382
|
+
### example ###
|
383
|
+
# gmo.sales_tran_brandtoken({
|
384
|
+
# access_id: "139f8ec33a07c55f406937c52ce4473d",
|
385
|
+
# access_pass: "2689b204d2c17192fa35f9269fa7e744",
|
386
|
+
# order_id: "597ae8c36120b23a3c00014e",
|
387
|
+
# amount: 1000,
|
388
|
+
# tax: "0001001"
|
389
|
+
# })
|
390
|
+
# => {"AccessID"=>"139f8ec33a07c55f406937c52ce4473d", "AccessPass"=>"2689b204d2c17192fa35f9269fa7e744", "Status"=>"SALES", "Forward"=>"2a99663", "Approve"=>"5537883", "TranID"=>"1707311620111111111111771220", "TranDate"=>"20170731162256"}
|
391
|
+
def sales_tran_brandtoken(options = {})
|
392
|
+
name = "SalesTranBrandtoken.idPass"
|
393
|
+
required = [:access_id, :access_pass, :order_id, :amount]
|
394
|
+
assert_required_options(required, options)
|
395
|
+
post_request name, options
|
396
|
+
end
|
397
|
+
|
398
|
+
### @params ###
|
399
|
+
# AccessID
|
400
|
+
# AccessPass
|
401
|
+
# OrderID
|
402
|
+
# Amount
|
403
|
+
# Tax
|
404
|
+
### @return ###
|
405
|
+
# AccessID
|
406
|
+
# AccessPass
|
407
|
+
# Status
|
408
|
+
# Forward
|
409
|
+
# Approve
|
410
|
+
# TranID
|
411
|
+
# TranDate
|
412
|
+
### example ###
|
413
|
+
# gmo.refund_tran_brandtoken({
|
414
|
+
# access_id: "139f8ec33a07c55f406937c52ce4473d",
|
415
|
+
# access_pass: "2689b204d2c17192fa35f9269fa7e744",
|
416
|
+
# order_id: "597ae8c36120b23a3c00014e",
|
417
|
+
# amount: 1000,
|
418
|
+
# tax: "0001001"
|
419
|
+
# })
|
420
|
+
# => {"AccessID"=>"139f8ec33a07c55f406937c52ce4473d", "AccessPass"=>"2689b204d2c17192fa35f9269fa7e744", "Status"=>"RETURN", "Forward"=>"2a99663", "Approve"=>"5537883", "TranID"=>"1707311620111111111111771220", "TranDate"=>"20170731162256"}
|
421
|
+
def refund_tran_brandtoken(options = {})
|
422
|
+
name = "RefundTranBrandtoken.idPass"
|
423
|
+
required = [:access_id, :access_pass, :order_id, :amount]
|
424
|
+
assert_required_options(required, options)
|
425
|
+
post_request name, options
|
426
|
+
end
|
427
|
+
|
428
|
+
# 【コンビニ払い】
|
429
|
+
## 2.2.2.1. 支払停止
|
430
|
+
# コンビニ決済センターとの通信を行い取引の支払停止処理を行います。
|
431
|
+
def cvs_cancel(options = {})
|
432
|
+
name = "CvsCancel.idPass"
|
433
|
+
required = [:access_id, :access_pass, :order_id]
|
434
|
+
assert_required_options(required, options)
|
435
|
+
post_request name, options
|
436
|
+
end
|
437
|
+
|
197
438
|
## 2.16.2.1.取引状態参照
|
198
439
|
# 指定したオーダーID の取引情報を取得します。
|
199
440
|
def search_trade(options = {})
|
@@ -205,6 +446,38 @@ module GMO
|
|
205
446
|
|
206
447
|
# 13.1.2.1.取引状態参照
|
207
448
|
# 指定したオーダーIDの取引情報を取得します。
|
449
|
+
### @params ###
|
450
|
+
# OrderID
|
451
|
+
# PayType
|
452
|
+
### @return ###
|
453
|
+
# OrderID
|
454
|
+
# Status
|
455
|
+
# ProcessDate
|
456
|
+
# JobCd
|
457
|
+
# AccessID
|
458
|
+
# AccessPass
|
459
|
+
# ItemCode
|
460
|
+
# Amount
|
461
|
+
# Tax
|
462
|
+
# SiteID
|
463
|
+
# MemberID
|
464
|
+
# CardNoToken
|
465
|
+
# Expire
|
466
|
+
# Method
|
467
|
+
# PayTimes
|
468
|
+
# Forward
|
469
|
+
# TranID
|
470
|
+
# Approve
|
471
|
+
# ClientField1
|
472
|
+
# ClientField2
|
473
|
+
# ClientField3
|
474
|
+
# PayType
|
475
|
+
### example ###
|
476
|
+
# gmo.search_trade_multi({
|
477
|
+
# order_id: '598066176120b2235300020b',
|
478
|
+
# pay_type: 27
|
479
|
+
# })
|
480
|
+
# => {"OrderID"=>"598066176120b2235300020b", "Status"=>"CAPTURE", "ProcessDate"=>"20170801202929", "JobCd"=>"CAPTURE", "AccessID"=>"228fc5bc02da46943300c12706d325a2", "AccessPass"=>"090a50ec2f77d92184a18018f07906e5", "ItemCode"=>"0000990", "Amount"=>"557", "Tax"=>"0", "SiteID"=>"", "MemberID"=>"", "CardNoToken"=>"************1111", "Expire"=>"2212", "Method"=>"1", "PayTimes"=>"", "Forward"=>"2a99663", "TranID"=>"1708012029111111111111771228", "Approve"=>"5689128", "ClientField1"=>"", "ClientField2"=>"", "ClientField3"=>"", "PayType"=>"27"}
|
208
481
|
def search_trade_multi(options = {})
|
209
482
|
name = "SearchTradeMulti.idPass"
|
210
483
|
required = [:order_id, :pay_type]
|
@@ -216,12 +489,11 @@ module GMO
|
|
216
489
|
|
217
490
|
def api_call(name, args = {}, verb = "post", options = {})
|
218
491
|
args.merge!({ "ShopID" => @shop_id, "ShopPass" => @shop_pass })
|
219
|
-
|
492
|
+
api(name, args, verb, options) do |response|
|
220
493
|
if response.is_a?(Hash) && !response["ErrInfo"].nil?
|
221
|
-
raise APIError.new(response)
|
494
|
+
raise APIError.new(response, locale)
|
222
495
|
end
|
223
496
|
end
|
224
|
-
response
|
225
497
|
end
|
226
498
|
|
227
499
|
end
|
data/lib/gmo/site_api.rb
CHANGED
@@ -6,7 +6,9 @@
|
|
6
6
|
# gmo = GMO::Payment::SiteAPI.new({
|
7
7
|
# site_id: "foo",
|
8
8
|
# site_pass: "bar",
|
9
|
-
# host:
|
9
|
+
# host: "mul-pay.com",
|
10
|
+
# locale: "ja"
|
11
|
+
|
10
12
|
# })
|
11
13
|
# result = gmo.post_request("EntryTran.idPass", options)
|
12
14
|
module GMO
|
@@ -18,14 +20,24 @@ module GMO
|
|
18
20
|
@site_id = options[:site_id]
|
19
21
|
@site_pass = options[:site_pass]
|
20
22
|
@host = options[:host]
|
23
|
+
@locale = options.fetch(:locale, GMO::Const::DEFAULT_LOCALE)
|
21
24
|
unless @site_id && @site_pass && @host
|
22
25
|
raise ArgumentError, "Initialize must receive a hash with :site_id, :site_pass and either :host! (received #{options.inspect})"
|
23
26
|
end
|
24
27
|
end
|
25
|
-
attr_reader :site_id, :site_pass, :host
|
28
|
+
attr_reader :site_id, :site_pass, :host, :locale
|
26
29
|
|
27
30
|
## 2.3.2.1.会員登録
|
28
31
|
# 指定されたサイトに会員を登録します。
|
32
|
+
### @params ###
|
33
|
+
# MemberID
|
34
|
+
### @return ###
|
35
|
+
# MemberID
|
36
|
+
### example ###
|
37
|
+
# gmo.save_member({
|
38
|
+
# member_id: 'mem10001'
|
39
|
+
# })
|
40
|
+
# => {"MemberID"=>"mem10001"}
|
29
41
|
def save_member(options = {})
|
30
42
|
name = "SaveMember.idPass"
|
31
43
|
required = [:member_id]
|
@@ -64,7 +76,11 @@ module GMO
|
|
64
76
|
# 指定した会員にカード情報を登録します。尚、サイトに設定されたショップ ID を使用してカード会社と通信を行い有効性の確認を行います。
|
65
77
|
def save_card(options = {})
|
66
78
|
name = "SaveCard.idPass"
|
67
|
-
|
79
|
+
if options[:token].nil?
|
80
|
+
required = [:member_id, :card_no, :expire]
|
81
|
+
else
|
82
|
+
required = [:member_id, :token]
|
83
|
+
end
|
68
84
|
assert_required_options(required, options)
|
69
85
|
post_request name, options
|
70
86
|
end
|
@@ -88,6 +104,51 @@ module GMO
|
|
88
104
|
post_request name, options
|
89
105
|
end
|
90
106
|
|
107
|
+
### @params ###
|
108
|
+
# MemberID
|
109
|
+
# SeqMode
|
110
|
+
# TokenSeq
|
111
|
+
### @return ###
|
112
|
+
# TokenSeq
|
113
|
+
# DefaultFlag
|
114
|
+
# CardName
|
115
|
+
# CardNoToken
|
116
|
+
# Expire
|
117
|
+
# HolderName
|
118
|
+
# DeleteFlag
|
119
|
+
### example ###
|
120
|
+
# gmo.search_brandtoken({
|
121
|
+
# member_id: '598066176120b2235300020b',
|
122
|
+
# seq_mode: 0
|
123
|
+
# })
|
124
|
+
# => {"TokenSeq"=>"0", "DefaultFlag"=>"0", "CardName"=>"", "CardNoToken"=>"*************111", "Expire"=>"2212", "HolderName"=>"", "DeleteFlag"=>"0"}
|
125
|
+
def search_brandtoken(options = {})
|
126
|
+
name = "SearchBrandtoken.idPass"
|
127
|
+
required = [:member_id, :seq_mode]
|
128
|
+
assert_required_options(required, options)
|
129
|
+
post_request name, options
|
130
|
+
end
|
131
|
+
|
132
|
+
### @params ###
|
133
|
+
# MemberID
|
134
|
+
# SeqMode
|
135
|
+
# TokenSeq
|
136
|
+
### @return ###
|
137
|
+
# TokenSeq
|
138
|
+
### example ###
|
139
|
+
# gmo.delete_brandtoken({
|
140
|
+
# member_id: '598066176120b2235300020b',
|
141
|
+
# seq_mode: 0,
|
142
|
+
# token_seq: 0
|
143
|
+
# })
|
144
|
+
# => {"TokenSeq"=>"0"}
|
145
|
+
def delete_brandtoken(options = {})
|
146
|
+
name = "DeleteBrandtoken.idPass"
|
147
|
+
required = [:member_id, :seq_mode, :token_seq]
|
148
|
+
assert_required_options(required, options)
|
149
|
+
post_request name, options
|
150
|
+
end
|
151
|
+
|
91
152
|
## 2.11.2.3. 決済実行
|
92
153
|
# お客様が選択したカード登録連番のカード情報を取得します。
|
93
154
|
# カード情報が本人認証サービスに対応していない場合は、カード会社との通信を行い決済を実行します。その際の出力パラメータは「2.10.2.3決済実行」の出力パラメータと同じになります。
|
@@ -99,19 +160,28 @@ module GMO
|
|
99
160
|
post_request name, options
|
100
161
|
end
|
101
162
|
|
163
|
+
## 2.19.2.1.カード属性照会(サイトID+会員ID(+カード登録連番モード・カード登録連番)を指定して呼び出す場合)
|
164
|
+
# 指定したクレジットカードの属性情報を取得します。
|
165
|
+
# /payment/SearchCardDetail.idPass
|
166
|
+
def search_card_detail_by_member_id(options = {})
|
167
|
+
name = "SearchCardDetail.idPass"
|
168
|
+
required = [:member_id, :seq_mode]
|
169
|
+
assert_required_options(required, options)
|
170
|
+
post_request name, options
|
171
|
+
end
|
172
|
+
|
102
173
|
private
|
103
174
|
|
104
175
|
def api_call(name, args = {}, verb = "post", options = {})
|
105
176
|
args.merge!({ "SiteID" => @site_id, "SitePass" => @site_pass })
|
106
|
-
|
177
|
+
api(name, args, verb, options) do |response|
|
107
178
|
if response.is_a?(Hash) && !response["ErrInfo"].nil?
|
108
|
-
raise APIError.new(response)
|
179
|
+
raise APIError.new(response, locale)
|
109
180
|
end
|
110
181
|
end
|
111
|
-
response
|
112
182
|
end
|
113
183
|
|
114
184
|
end
|
115
185
|
|
116
186
|
end
|
117
|
-
end
|
187
|
+
end
|