gmo 0.2.6 → 0.5.2

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.
Files changed (55) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +1 -0
  3. data/.travis.yml +5 -5
  4. data/CHANGELOG.md +43 -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_linepay_gets_data_about_a_transaction.yml +36 -0
  21. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_rakuten_id_gets_data_about_a_transaction.yml +35 -0
  22. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_brandtoken_gets_data_about_a_transaction.yml +73 -0
  23. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_brandtoken_parameter_contains_Japanese_characters_should_correctly_handle_Japanese.yml +73 -0
  24. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_docomo_gets_data_about_a_transaction.yml +67 -0
  25. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_doesn_t_require_card_info_if_token_is_present.yml +69 -0
  26. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_linepay_gets_data_about_a_transaction.yml +69 -0
  27. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_rakuten_id_gets_data_about_a_transaction.yml +67 -0
  28. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_refund_tran_brandtoken_gets_data_about_a_transaction.yml +108 -0
  29. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_sales_tran_brandtoken_gets_data_about_a_transaction.yml +143 -0
  30. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_void_tran_brandtoken_gets_data_about_order.yml +108 -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/_save_card_doesn_t_require_card_info_if_token_is_present.yml +36 -0
  35. data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_search_brandtoken_gets_data_about_a_brandtoken.yml +74 -0
  36. data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_search_card_detail_by_member_id_gets_data_about_card_detail.yml +36 -0
  37. data/gmo.gemspec +1 -1
  38. data/lib/gmo.rb +6 -1
  39. data/lib/gmo/const.rb +2509 -3
  40. data/lib/gmo/errors.rb +22 -4
  41. data/lib/gmo/remittance_api.rb +331 -0
  42. data/lib/gmo/shop_and_site_api.rb +77 -2
  43. data/lib/gmo/shop_api.rb +329 -8
  44. data/lib/gmo/site_api.rb +75 -4
  45. data/lib/gmo/version.rb +2 -2
  46. data/spec/gmo/{error_spec.rb → errors_spec.rb} +11 -2
  47. data/spec/gmo/remittance_api_spec.rb +506 -0
  48. data/spec/gmo/shop_and_site_api_spec.rb +87 -7
  49. data/spec/gmo/shop_api_spec.rb +566 -109
  50. data/spec/gmo/site_api_spec.rb +120 -23
  51. data/spec/support/config.example.yml +8 -1
  52. data/spec/support/config.yml +8 -1
  53. data/spec/support/config_loader.rb +1 -1
  54. data/spec/support/vcr.rb +12 -3
  55. metadata +44 -11
@@ -6,7 +6,9 @@
6
6
  # gmo = GMO::Payment::ShopAPI.new({
7
7
  # shop_id: "foo",
8
8
  # shop_pass: "bar",
9
- # host: "mul-pay.com"
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と取引パスワードの発行を行い、取引を開始します。
@@ -71,6 +73,91 @@ module GMO
71
73
  post_request name, options
72
74
  end
73
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
+
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
+
74
161
  ## 2.2.2.2.決済実行
75
162
  # 指定されたサイトに会員を登録します。
76
163
  # return
@@ -135,7 +222,11 @@ module GMO
135
222
  # "ClientField3" => options[:client_field_3],
136
223
  # "ClientFieldFlag" => client_field_flg
137
224
  # }
138
- required = [:access_id, :access_pass, :order_id, :card_no, :expire]
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
139
230
  assert_required_options(required, options)
140
231
  post_request name, options
141
232
  end
@@ -145,7 +236,7 @@ module GMO
145
236
  # お客様が入力した情報で後続の決済センターと通信を行い決済を実施し、結果を返します。
146
237
  def exec_tran_cvs(options = {})
147
238
  name = "ExecTranCvs.idPass"
148
- required = [:access_id, :access_pass, :order_id, :convenience, :customer_name, :tel_no, :receipts_disp_11, :receipts_disp_12, :receipts_disp_13]
239
+ required = [:access_id, :access_pass, :order_id, :convenience, :customer_name, :customer_kana, :tel_no, :receipts_disp_11, :receipts_disp_12, :receipts_disp_13]
149
240
  assert_required_options(required, options)
150
241
  post_request name, options
151
242
  end
@@ -160,6 +251,77 @@ module GMO
160
251
  post_request name, options
161
252
  end
162
253
 
254
+ # 【LINE Pay決済】
255
+ # 20.1.2.2. 決済実行
256
+ def exec_tran_linepay(options = {})
257
+ name = "ExecTranLinepay.idPass"
258
+ required = [:access_id, :access_pass, :order_id, :ret_url, :error_rcv_url, :product_name]
259
+ assert_required_options(required, options)
260
+ post_request name, options
261
+ end
262
+
263
+ # 【楽天ペイ決済】
264
+ # 18.1.2.2. 決済実行
265
+ def exec_tran_rakuten_id(options = {})
266
+ name = "ExecTranRakutenId.idPass"
267
+ required = [:access_id, :access_pass, :order_id]
268
+ assert_required_options(required, options)
269
+ post_request name, options
270
+ end
271
+
272
+ # 【ドコモ払い決済】
273
+ # 18.1.2.2. 決済実行
274
+ def exec_tran_docomo(options = {})
275
+ name = "ExecTranDocomo.idPass"
276
+ required = [:access_id, :access_pass, :order_id]
277
+ assert_required_options(required, options)
278
+ post_request name, options
279
+ end
280
+
281
+ ### @params ###
282
+ # AccessID
283
+ # AccessPass
284
+ # OrderID
285
+ # TokenType
286
+ # Token
287
+ # MemberID
288
+ # SeqMode
289
+ # TokenSeq
290
+ # ClientField1
291
+ # ClientField2
292
+ # ClientField3
293
+ ### @return ###
294
+ # Status
295
+ # OrderID
296
+ # Forward
297
+ # Approve
298
+ # TranID
299
+ # TranDate
300
+ # ClientField1
301
+ # ClientField2
302
+ # ClientField3
303
+ ### example ###
304
+ # gmo.exec_tran_brandtoken({
305
+ # order_id: "597ae8c36120b23a3c00014e",
306
+ # access_id: "139f8ec33a07c55f406937c52ce4473d",
307
+ # access_pass: "2689b204d2c17192fa35f9269fa7e744",
308
+ # token_type: :apple_pay,
309
+ # token: <Base64 encoded payment data>,
310
+ # seq_mode: "1",
311
+ # token_seq: 1001,
312
+ # client_field_1: "Custom field value 1",
313
+ # client_field_2: "Custom field value 2",
314
+ # client_field_3: "Custom field value 3"
315
+ # })
316
+ # => {"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"}
317
+ def exec_tran_brandtoken(options = {})
318
+ name = "ExecTranBrandtoken.idPass"
319
+ options[:token_type] = GMO::Const::TOKEN_TYPES_MAP[options[:token_type]]
320
+ required = [:access_id, :access_pass, :order_id]
321
+ assert_required_options(required, options)
322
+ post_request name, options
323
+ end
324
+
163
325
  ## 2.14.2.1.決済変更
164
326
  # 仮売上の決済に対して実売上を行います。尚、実行時に仮売上時との金額チェックを行います。
165
327
  # /payment/AlterTran.idPass
@@ -204,8 +366,8 @@ module GMO
204
366
  # gmo.change_tran({
205
367
  # access_id: "a41d83f1f4c908baeda04e6dc03e300c",
206
368
  # access_pass: "d72eca02e28c88f98b9341a33ba46d5d",
207
- # JobCd: 100,
208
- # Amount: 100
369
+ # job_cd: "CAPTURE",
370
+ # amount: 100
209
371
  # })
210
372
  def change_tran(options = {})
211
373
  name = "ChangeTran.idPass"
@@ -214,6 +376,133 @@ module GMO
214
376
  post_request name, options
215
377
  end
216
378
 
379
+ ### @params ###
380
+ # AccessID
381
+ # AccessPass
382
+ # OrderID
383
+ # JobCd
384
+ # Amount
385
+ # Tax
386
+ ### @return ###
387
+ # AccessID
388
+ # AccessPass
389
+ # Status
390
+ # Forward
391
+ # Approve
392
+ # TranID
393
+ # TranDate
394
+ ### example ###
395
+ # gmo.change_tran_brandtoken({
396
+ # access_id: "21170701482c86c3b88ff72b83bfd363",
397
+ # access_pass: "51f36feba120de1e6e29532e5a3a5e3e",
398
+ # order_id: "ord10001",
399
+ # job_cd: "CAPTURE",
400
+ # amount: 2000
401
+ # })
402
+ # => {"AccessID"=>"21170701482c86c3b88ff72b83bfd363", "AccessPass"=>"51f36feba120de1e6e29532e5a3a5e3e", "Status"=>"CAPTURE", "Forward"=>"2a99663", "Approve"=>"5538477", "TranID"=>"1707311633111111111111771224", "TranDate"=>"20170731163343"}
403
+ def change_tran_brandtoken(options = {})
404
+ name = "ChangeTranBrandtoken.idPass"
405
+ required = [:access_id, :access_pass, :order_id, :job_cd, :amount]
406
+ assert_required_options(required, options)
407
+ post_request name, options
408
+ end
409
+
410
+ ### @params ###
411
+ # AccessID
412
+ # AccessPass
413
+ # OrderID
414
+ ### @return ###
415
+ # AccessID
416
+ # AccessPass
417
+ # Status
418
+ # Forward
419
+ # Approve
420
+ # TranID
421
+ # TranDate
422
+ ### example ###
423
+ # gmo.void_tran_brandtoken({
424
+ # access_id: "139f8ec33a07c55f406937c52ce4473d",
425
+ # access_pass: "2689b204d2c17192fa35f9269fa7e744",
426
+ # order_id: "597ae8c36120b23a3c00014e"
427
+ # })
428
+ # => {"AccessID"=>"139f8ec33a07c55f406937c52ce4473d", "AccessPass"=>"2689b204d2c17192fa35f9269fa7e744", "Status"=>"VOID", "Forward"=>"2a99663", "Approve"=>"5537590", "TranID"=>"1707311610111111111111771219", "TranDate"=>"20170731161007"}
429
+ def void_tran_brandtoken(options = {})
430
+ name = "VoidTranBrandtoken.idPass"
431
+ required = [:access_id, :access_pass, :order_id]
432
+ assert_required_options(required, options)
433
+ post_request name, options
434
+ end
435
+
436
+ ### @params ###
437
+ # AccessID
438
+ # AccessPass
439
+ # OrderID
440
+ # Amount
441
+ # Tax
442
+ ### @return ###
443
+ # AccessID
444
+ # AccessPass
445
+ # Status
446
+ # Forward
447
+ # Approve
448
+ # TranID
449
+ # TranDate
450
+ ### example ###
451
+ # gmo.sales_tran_brandtoken({
452
+ # access_id: "139f8ec33a07c55f406937c52ce4473d",
453
+ # access_pass: "2689b204d2c17192fa35f9269fa7e744",
454
+ # order_id: "597ae8c36120b23a3c00014e",
455
+ # amount: 1000,
456
+ # tax: "0001001"
457
+ # })
458
+ # => {"AccessID"=>"139f8ec33a07c55f406937c52ce4473d", "AccessPass"=>"2689b204d2c17192fa35f9269fa7e744", "Status"=>"SALES", "Forward"=>"2a99663", "Approve"=>"5537883", "TranID"=>"1707311620111111111111771220", "TranDate"=>"20170731162256"}
459
+ def sales_tran_brandtoken(options = {})
460
+ name = "SalesTranBrandtoken.idPass"
461
+ required = [:access_id, :access_pass, :order_id, :amount]
462
+ assert_required_options(required, options)
463
+ post_request name, options
464
+ end
465
+
466
+ ### @params ###
467
+ # AccessID
468
+ # AccessPass
469
+ # OrderID
470
+ # Amount
471
+ # Tax
472
+ ### @return ###
473
+ # AccessID
474
+ # AccessPass
475
+ # Status
476
+ # Forward
477
+ # Approve
478
+ # TranID
479
+ # TranDate
480
+ ### example ###
481
+ # gmo.refund_tran_brandtoken({
482
+ # access_id: "139f8ec33a07c55f406937c52ce4473d",
483
+ # access_pass: "2689b204d2c17192fa35f9269fa7e744",
484
+ # order_id: "597ae8c36120b23a3c00014e",
485
+ # amount: 1000,
486
+ # tax: "0001001"
487
+ # })
488
+ # => {"AccessID"=>"139f8ec33a07c55f406937c52ce4473d", "AccessPass"=>"2689b204d2c17192fa35f9269fa7e744", "Status"=>"RETURN", "Forward"=>"2a99663", "Approve"=>"5537883", "TranID"=>"1707311620111111111111771220", "TranDate"=>"20170731162256"}
489
+ def refund_tran_brandtoken(options = {})
490
+ name = "RefundTranBrandtoken.idPass"
491
+ required = [:access_id, :access_pass, :order_id, :amount]
492
+ assert_required_options(required, options)
493
+ post_request name, options
494
+ end
495
+
496
+ # 【コンビニ払い】
497
+ ## 2.2.2.1. 支払停止
498
+ # コンビニ決済センターとの通信を行い取引の支払停止処理を行います。
499
+ def cvs_cancel(options = {})
500
+ name = "CvsCancel.idPass"
501
+ required = [:access_id, :access_pass, :order_id]
502
+ assert_required_options(required, options)
503
+ post_request name, options
504
+ end
505
+
217
506
  ## 2.16.2.1.取引状態参照
218
507
  # 指定したオーダーID の取引情報を取得します。
219
508
  def search_trade(options = {})
@@ -225,6 +514,38 @@ module GMO
225
514
 
226
515
  # 13.1.2.1.取引状態参照
227
516
  # 指定したオーダーIDの取引情報を取得します。
517
+ ### @params ###
518
+ # OrderID
519
+ # PayType
520
+ ### @return ###
521
+ # OrderID
522
+ # Status
523
+ # ProcessDate
524
+ # JobCd
525
+ # AccessID
526
+ # AccessPass
527
+ # ItemCode
528
+ # Amount
529
+ # Tax
530
+ # SiteID
531
+ # MemberID
532
+ # CardNoToken
533
+ # Expire
534
+ # Method
535
+ # PayTimes
536
+ # Forward
537
+ # TranID
538
+ # Approve
539
+ # ClientField1
540
+ # ClientField2
541
+ # ClientField3
542
+ # PayType
543
+ ### example ###
544
+ # gmo.search_trade_multi({
545
+ # order_id: '598066176120b2235300020b',
546
+ # pay_type: 27
547
+ # })
548
+ # => {"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"}
228
549
  def search_trade_multi(options = {})
229
550
  name = "SearchTradeMulti.idPass"
230
551
  required = [:order_id, :pay_type]
@@ -238,7 +559,7 @@ module GMO
238
559
  args.merge!({ "ShopID" => @shop_id, "ShopPass" => @shop_pass })
239
560
  api(name, args, verb, options) do |response|
240
561
  if response.is_a?(Hash) && !response["ErrInfo"].nil?
241
- raise APIError.new(response)
562
+ raise APIError.new(response, locale)
242
563
  end
243
564
  end
244
565
  end
@@ -6,7 +6,9 @@
6
6
  # gmo = GMO::Payment::SiteAPI.new({
7
7
  # site_id: "foo",
8
8
  # site_pass: "bar",
9
- # host: "mul-pay.com"
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
- required = [:member_id, :card_no, :expire]
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,13 +160,23 @@ 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
182
  end