gmo 0.3.0 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/.travis.yml +5 -9
- data/CHANGELOG.md +37 -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_docomo_gets_data_about_a_transaction.yml +35 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_rakuten_id_gets_data_about_a_transaction.yml +35 -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_docomo_gets_data_about_a_transaction.yml +67 -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_rakuten_id_gets_data_about_a_transaction.yml +67 -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/_secure_tran_gets_data_about_a_transaction.yml +36 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_void_tran_brandtoken_gets_data_about_order.yml +108 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/secure_tran_request_params.yml +2 -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/_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/lib/gmo.rb +10 -3
- data/lib/gmo/const.rb +2502 -3
- data/lib/gmo/errors.rb +22 -4
- data/lib/gmo/remittance_api.rb +331 -0
- data/lib/gmo/shop_and_site_api.rb +77 -2
- data/lib/gmo/shop_api.rb +315 -5
- data/lib/gmo/site_api.rb +70 -3
- 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 +83 -3
- data/spec/gmo/shop_api_spec.rb +429 -1
- data/spec/gmo/site_api_spec.rb +88 -1
- data/spec/support/config.example.yml +5 -0
- data/spec/support/config.yml +5 -0
- data/spec/support/config_loader.rb +1 -1
- data/spec/support/vcr.rb +9 -2
- metadata +41 -8
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と取引パスワードの発行を行い、取引を開始します。
|
@@ -81,6 +83,81 @@ module GMO
|
|
81
83
|
post_request name, options
|
82
84
|
end
|
83
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
|
+
|
111
|
+
### @params ###
|
112
|
+
# OrderID
|
113
|
+
# JobCd
|
114
|
+
# Amount
|
115
|
+
# ItemCode
|
116
|
+
# Tax
|
117
|
+
### @return ###
|
118
|
+
# AccessID
|
119
|
+
# AccessPass
|
120
|
+
### example ###
|
121
|
+
# gmo.entry_tran_rakuten_id({
|
122
|
+
# order_id: "ord12345",
|
123
|
+
# job_cd: "AUTH",
|
124
|
+
# item_code: "1000001",
|
125
|
+
# tax: "0001001",
|
126
|
+
# amount: 100
|
127
|
+
# })
|
128
|
+
# => {"AccessID"=>"139f8ec33a07c55f406937c52ce4473d", "AccessPass"=>"2689b204d2c17192fa35f9269fa7e744"}
|
129
|
+
def entry_tran_rakuten_id(options = {})
|
130
|
+
name = "EntryTranRakutenId.idPass"
|
131
|
+
required = [:order_id, :job_cd, :amount]
|
132
|
+
assert_required_options(required, options)
|
133
|
+
post_request name, options
|
134
|
+
end
|
135
|
+
|
136
|
+
### @params ###
|
137
|
+
# OrderID
|
138
|
+
# JobCd
|
139
|
+
# Amount
|
140
|
+
# ItemCode
|
141
|
+
# Tax
|
142
|
+
### @return ###
|
143
|
+
# AccessID
|
144
|
+
# AccessPass
|
145
|
+
### example ###
|
146
|
+
# gmo.entry_tran_docomo({
|
147
|
+
# order_id: "ord12345",
|
148
|
+
# job_cd: "AUTH",
|
149
|
+
# item_code: "1000001",
|
150
|
+
# tax: "0001001",
|
151
|
+
# amount: 100
|
152
|
+
# })
|
153
|
+
# => {"AccessID"=>"139f8ec33a07c55f406937c52ce4473d", "AccessPass"=>"2689b204d2c17192fa35f9269fa7e744"}
|
154
|
+
def entry_tran_docomo(options = {})
|
155
|
+
name = "EntryTranDocomo.idPass"
|
156
|
+
required = [:order_id, :job_cd, :amount]
|
157
|
+
assert_required_options(required, options)
|
158
|
+
post_request name, options
|
159
|
+
end
|
160
|
+
|
84
161
|
## 2.2.2.2.決済実行
|
85
162
|
# 指定されたサイトに会員を登録します。
|
86
163
|
# return
|
@@ -145,7 +222,19 @@ module GMO
|
|
145
222
|
# "ClientField3" => options[:client_field_3],
|
146
223
|
# "ClientFieldFlag" => client_field_flg
|
147
224
|
# }
|
148
|
-
|
225
|
+
if options[:token].nil?
|
226
|
+
required = [:access_id, :access_pass, :order_id, :card_no, :expire]
|
227
|
+
else
|
228
|
+
required = [:access_id, :access_pass, :token]
|
229
|
+
end
|
230
|
+
assert_required_options(required, options)
|
231
|
+
post_request name, options
|
232
|
+
end
|
233
|
+
|
234
|
+
# 2.2.2.4 認証後決済実行
|
235
|
+
def secure_tran(options = {})
|
236
|
+
name = "SecureTran.idPass"
|
237
|
+
required = [:pa_res, :md]
|
149
238
|
assert_required_options(required, options)
|
150
239
|
post_request name, options
|
151
240
|
end
|
@@ -179,6 +268,68 @@ module GMO
|
|
179
268
|
post_request name, options
|
180
269
|
end
|
181
270
|
|
271
|
+
# 【楽天ペイ決済】
|
272
|
+
# 18.1.2.2. 決済実行
|
273
|
+
def exec_tran_rakuten_id(options = {})
|
274
|
+
name = "ExecTranRakutenId.idPass"
|
275
|
+
required = [:access_id, :access_pass, :order_id]
|
276
|
+
assert_required_options(required, options)
|
277
|
+
post_request name, options
|
278
|
+
end
|
279
|
+
|
280
|
+
# 【ドコモ払い決済】
|
281
|
+
# 18.1.2.2. 決済実行
|
282
|
+
def exec_tran_docomo(options = {})
|
283
|
+
name = "ExecTranDocomo.idPass"
|
284
|
+
required = [:access_id, :access_pass, :order_id]
|
285
|
+
assert_required_options(required, options)
|
286
|
+
post_request name, options
|
287
|
+
end
|
288
|
+
|
289
|
+
### @params ###
|
290
|
+
# AccessID
|
291
|
+
# AccessPass
|
292
|
+
# OrderID
|
293
|
+
# TokenType
|
294
|
+
# Token
|
295
|
+
# MemberID
|
296
|
+
# SeqMode
|
297
|
+
# TokenSeq
|
298
|
+
# ClientField1
|
299
|
+
# ClientField2
|
300
|
+
# ClientField3
|
301
|
+
### @return ###
|
302
|
+
# Status
|
303
|
+
# OrderID
|
304
|
+
# Forward
|
305
|
+
# Approve
|
306
|
+
# TranID
|
307
|
+
# TranDate
|
308
|
+
# ClientField1
|
309
|
+
# ClientField2
|
310
|
+
# ClientField3
|
311
|
+
### example ###
|
312
|
+
# gmo.exec_tran_brandtoken({
|
313
|
+
# order_id: "597ae8c36120b23a3c00014e",
|
314
|
+
# access_id: "139f8ec33a07c55f406937c52ce4473d",
|
315
|
+
# access_pass: "2689b204d2c17192fa35f9269fa7e744",
|
316
|
+
# token_type: :apple_pay,
|
317
|
+
# token: <Base64 encoded payment data>,
|
318
|
+
# seq_mode: "1",
|
319
|
+
# token_seq: 1001,
|
320
|
+
# client_field_1: "Custom field value 1",
|
321
|
+
# client_field_2: "Custom field value 2",
|
322
|
+
# client_field_3: "Custom field value 3"
|
323
|
+
# })
|
324
|
+
# => {"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"}
|
325
|
+
def exec_tran_brandtoken(options = {})
|
326
|
+
name = "ExecTranBrandtoken.idPass"
|
327
|
+
options[:token_type] = GMO::Const::TOKEN_TYPES_MAP[options[:token_type]]
|
328
|
+
required = [:access_id, :access_pass, :order_id]
|
329
|
+
assert_required_options(required, options)
|
330
|
+
post_request name, options
|
331
|
+
end
|
332
|
+
|
182
333
|
## 2.14.2.1.決済変更
|
183
334
|
# 仮売上の決済に対して実売上を行います。尚、実行時に仮売上時との金額チェックを行います。
|
184
335
|
# /payment/AlterTran.idPass
|
@@ -233,6 +384,133 @@ module GMO
|
|
233
384
|
post_request name, options
|
234
385
|
end
|
235
386
|
|
387
|
+
### @params ###
|
388
|
+
# AccessID
|
389
|
+
# AccessPass
|
390
|
+
# OrderID
|
391
|
+
# JobCd
|
392
|
+
# Amount
|
393
|
+
# Tax
|
394
|
+
### @return ###
|
395
|
+
# AccessID
|
396
|
+
# AccessPass
|
397
|
+
# Status
|
398
|
+
# Forward
|
399
|
+
# Approve
|
400
|
+
# TranID
|
401
|
+
# TranDate
|
402
|
+
### example ###
|
403
|
+
# gmo.change_tran_brandtoken({
|
404
|
+
# access_id: "21170701482c86c3b88ff72b83bfd363",
|
405
|
+
# access_pass: "51f36feba120de1e6e29532e5a3a5e3e",
|
406
|
+
# order_id: "ord10001",
|
407
|
+
# job_cd: "CAPTURE",
|
408
|
+
# amount: 2000
|
409
|
+
# })
|
410
|
+
# => {"AccessID"=>"21170701482c86c3b88ff72b83bfd363", "AccessPass"=>"51f36feba120de1e6e29532e5a3a5e3e", "Status"=>"CAPTURE", "Forward"=>"2a99663", "Approve"=>"5538477", "TranID"=>"1707311633111111111111771224", "TranDate"=>"20170731163343"}
|
411
|
+
def change_tran_brandtoken(options = {})
|
412
|
+
name = "ChangeTranBrandtoken.idPass"
|
413
|
+
required = [:access_id, :access_pass, :order_id, :job_cd, :amount]
|
414
|
+
assert_required_options(required, options)
|
415
|
+
post_request name, options
|
416
|
+
end
|
417
|
+
|
418
|
+
### @params ###
|
419
|
+
# AccessID
|
420
|
+
# AccessPass
|
421
|
+
# OrderID
|
422
|
+
### @return ###
|
423
|
+
# AccessID
|
424
|
+
# AccessPass
|
425
|
+
# Status
|
426
|
+
# Forward
|
427
|
+
# Approve
|
428
|
+
# TranID
|
429
|
+
# TranDate
|
430
|
+
### example ###
|
431
|
+
# gmo.void_tran_brandtoken({
|
432
|
+
# access_id: "139f8ec33a07c55f406937c52ce4473d",
|
433
|
+
# access_pass: "2689b204d2c17192fa35f9269fa7e744",
|
434
|
+
# order_id: "597ae8c36120b23a3c00014e"
|
435
|
+
# })
|
436
|
+
# => {"AccessID"=>"139f8ec33a07c55f406937c52ce4473d", "AccessPass"=>"2689b204d2c17192fa35f9269fa7e744", "Status"=>"VOID", "Forward"=>"2a99663", "Approve"=>"5537590", "TranID"=>"1707311610111111111111771219", "TranDate"=>"20170731161007"}
|
437
|
+
def void_tran_brandtoken(options = {})
|
438
|
+
name = "VoidTranBrandtoken.idPass"
|
439
|
+
required = [:access_id, :access_pass, :order_id]
|
440
|
+
assert_required_options(required, options)
|
441
|
+
post_request name, options
|
442
|
+
end
|
443
|
+
|
444
|
+
### @params ###
|
445
|
+
# AccessID
|
446
|
+
# AccessPass
|
447
|
+
# OrderID
|
448
|
+
# Amount
|
449
|
+
# Tax
|
450
|
+
### @return ###
|
451
|
+
# AccessID
|
452
|
+
# AccessPass
|
453
|
+
# Status
|
454
|
+
# Forward
|
455
|
+
# Approve
|
456
|
+
# TranID
|
457
|
+
# TranDate
|
458
|
+
### example ###
|
459
|
+
# gmo.sales_tran_brandtoken({
|
460
|
+
# access_id: "139f8ec33a07c55f406937c52ce4473d",
|
461
|
+
# access_pass: "2689b204d2c17192fa35f9269fa7e744",
|
462
|
+
# order_id: "597ae8c36120b23a3c00014e",
|
463
|
+
# amount: 1000,
|
464
|
+
# tax: "0001001"
|
465
|
+
# })
|
466
|
+
# => {"AccessID"=>"139f8ec33a07c55f406937c52ce4473d", "AccessPass"=>"2689b204d2c17192fa35f9269fa7e744", "Status"=>"SALES", "Forward"=>"2a99663", "Approve"=>"5537883", "TranID"=>"1707311620111111111111771220", "TranDate"=>"20170731162256"}
|
467
|
+
def sales_tran_brandtoken(options = {})
|
468
|
+
name = "SalesTranBrandtoken.idPass"
|
469
|
+
required = [:access_id, :access_pass, :order_id, :amount]
|
470
|
+
assert_required_options(required, options)
|
471
|
+
post_request name, options
|
472
|
+
end
|
473
|
+
|
474
|
+
### @params ###
|
475
|
+
# AccessID
|
476
|
+
# AccessPass
|
477
|
+
# OrderID
|
478
|
+
# Amount
|
479
|
+
# Tax
|
480
|
+
### @return ###
|
481
|
+
# AccessID
|
482
|
+
# AccessPass
|
483
|
+
# Status
|
484
|
+
# Forward
|
485
|
+
# Approve
|
486
|
+
# TranID
|
487
|
+
# TranDate
|
488
|
+
### example ###
|
489
|
+
# gmo.refund_tran_brandtoken({
|
490
|
+
# access_id: "139f8ec33a07c55f406937c52ce4473d",
|
491
|
+
# access_pass: "2689b204d2c17192fa35f9269fa7e744",
|
492
|
+
# order_id: "597ae8c36120b23a3c00014e",
|
493
|
+
# amount: 1000,
|
494
|
+
# tax: "0001001"
|
495
|
+
# })
|
496
|
+
# => {"AccessID"=>"139f8ec33a07c55f406937c52ce4473d", "AccessPass"=>"2689b204d2c17192fa35f9269fa7e744", "Status"=>"RETURN", "Forward"=>"2a99663", "Approve"=>"5537883", "TranID"=>"1707311620111111111111771220", "TranDate"=>"20170731162256"}
|
497
|
+
def refund_tran_brandtoken(options = {})
|
498
|
+
name = "RefundTranBrandtoken.idPass"
|
499
|
+
required = [:access_id, :access_pass, :order_id, :amount]
|
500
|
+
assert_required_options(required, options)
|
501
|
+
post_request name, options
|
502
|
+
end
|
503
|
+
|
504
|
+
# 【コンビニ払い】
|
505
|
+
## 2.2.2.1. 支払停止
|
506
|
+
# コンビニ決済センターとの通信を行い取引の支払停止処理を行います。
|
507
|
+
def cvs_cancel(options = {})
|
508
|
+
name = "CvsCancel.idPass"
|
509
|
+
required = [:access_id, :access_pass, :order_id]
|
510
|
+
assert_required_options(required, options)
|
511
|
+
post_request name, options
|
512
|
+
end
|
513
|
+
|
236
514
|
## 2.16.2.1.取引状態参照
|
237
515
|
# 指定したオーダーID の取引情報を取得します。
|
238
516
|
def search_trade(options = {})
|
@@ -244,6 +522,38 @@ module GMO
|
|
244
522
|
|
245
523
|
# 13.1.2.1.取引状態参照
|
246
524
|
# 指定したオーダーIDの取引情報を取得します。
|
525
|
+
### @params ###
|
526
|
+
# OrderID
|
527
|
+
# PayType
|
528
|
+
### @return ###
|
529
|
+
# OrderID
|
530
|
+
# Status
|
531
|
+
# ProcessDate
|
532
|
+
# JobCd
|
533
|
+
# AccessID
|
534
|
+
# AccessPass
|
535
|
+
# ItemCode
|
536
|
+
# Amount
|
537
|
+
# Tax
|
538
|
+
# SiteID
|
539
|
+
# MemberID
|
540
|
+
# CardNoToken
|
541
|
+
# Expire
|
542
|
+
# Method
|
543
|
+
# PayTimes
|
544
|
+
# Forward
|
545
|
+
# TranID
|
546
|
+
# Approve
|
547
|
+
# ClientField1
|
548
|
+
# ClientField2
|
549
|
+
# ClientField3
|
550
|
+
# PayType
|
551
|
+
### example ###
|
552
|
+
# gmo.search_trade_multi({
|
553
|
+
# order_id: '598066176120b2235300020b',
|
554
|
+
# pay_type: 27
|
555
|
+
# })
|
556
|
+
# => {"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"}
|
247
557
|
def search_trade_multi(options = {})
|
248
558
|
name = "SearchTradeMulti.idPass"
|
249
559
|
required = [:order_id, :pay_type]
|
@@ -257,7 +567,7 @@ module GMO
|
|
257
567
|
args.merge!({ "ShopID" => @shop_id, "ShopPass" => @shop_pass })
|
258
568
|
api(name, args, verb, options) do |response|
|
259
569
|
if response.is_a?(Hash) && !response["ErrInfo"].nil?
|
260
|
-
raise APIError.new(response)
|
570
|
+
raise APIError.new(response, locale)
|
261
571
|
end
|
262
572
|
end
|
263
573
|
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]
|
@@ -92,6 +104,51 @@ module GMO
|
|
92
104
|
post_request name, options
|
93
105
|
end
|
94
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
|
+
|
95
152
|
## 2.11.2.3. 決済実行
|
96
153
|
# お客様が選択したカード登録連番のカード情報を取得します。
|
97
154
|
# カード情報が本人認証サービスに対応していない場合は、カード会社との通信を行い決済を実行します。その際の出力パラメータは「2.10.2.3決済実行」の出力パラメータと同じになります。
|
@@ -103,13 +160,23 @@ module GMO
|
|
103
160
|
post_request name, options
|
104
161
|
end
|
105
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
|
+
|
106
173
|
private
|
107
174
|
|
108
175
|
def api_call(name, args = {}, verb = "post", options = {})
|
109
176
|
args.merge!({ "SiteID" => @site_id, "SitePass" => @site_pass })
|
110
177
|
api(name, args, verb, options) do |response|
|
111
178
|
if response.is_a?(Hash) && !response["ErrInfo"].nil?
|
112
|
-
raise APIError.new(response)
|
179
|
+
raise APIError.new(response, locale)
|
113
180
|
end
|
114
181
|
end
|
115
182
|
end
|