gmo 0.2.4 → 0.5.0

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/.travis.yml +9 -4
  3. data/CHANGELOG.md +42 -1
  4. data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_cancel_deposit_gets_data_about_a_deposit.yml +38 -0
  5. data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_cancel_mail_deposit_gets_data_about_a_mail_deposit.yml +38 -0
  6. data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_create_account_gets_data_about_an_account.yml +38 -0
  7. data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_create_deposit_gets_data_about_a_deposit.yml +38 -0
  8. data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_create_mail_deposit_gets_data_about_a_mail_deposit.yml +38 -0
  9. data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_delete_account_gets_data_about_an_account.yml +38 -0
  10. data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_search_account_gets_data_about_an_account.yml +38 -0
  11. data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_search_balance_gets_data_about_balance.yml +38 -0
  12. data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_search_deposit_gets_data_about_a_deposit.yml +38 -0
  13. data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_search_mail_deposit_gets_data_about_a_mail_deposit.yml +38 -0
  14. data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_update_account_gets_data_about_an_account.yml +38 -0
  15. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_change_tran_brandtoken_gets_data_about_order.yml +108 -0
  16. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_cvs_cancel_gets_data_about_a_transaction.yml +63 -0
  17. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_brandtoken_gets_data_about_a_transaction.yml +38 -0
  18. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_linepay_gets_data_about_a_transaction.yml +36 -0
  19. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_pay_easy_gets_data_about_a_transaction.yml +36 -0
  20. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_brandtoken_gets_data_about_a_transaction.yml +73 -0
  21. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_brandtoken_parameter_contains_Japanese_characters_should_correctly_handle_Japanese.yml +73 -0
  22. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_doesn_t_require_card_info_if_token_is_present.yml +69 -0
  23. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_linepay_gets_data_about_a_transaction.yml +69 -0
  24. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_pay_easy_gets_data_about_a_transaction.yml +69 -0
  25. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_refund_tran_brandtoken_gets_data_about_a_transaction.yml +108 -0
  26. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_sales_tran_brandtoken_gets_data_about_a_transaction.yml +143 -0
  27. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_void_tran_brandtoken_gets_data_about_order.yml +108 -0
  28. data/fixtures/vcr_cassettes/GMO_Payment_ShopAndSiteAPI/_exec_tran_brandtoken_got_data.yml +73 -0
  29. data/fixtures/vcr_cassettes/GMO_Payment_ShopAndSiteAPI/_trade_brandtoken_got_data.yml +108 -0
  30. data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_delete_brandtoken_gets_data_about_a_brandtoken.yml +73 -0
  31. data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_save_card_doesn_t_require_card_info_if_token_is_present.yml +36 -0
  32. data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_search_brandtoken_gets_data_about_a_brandtoken.yml +74 -0
  33. data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_search_card_detail_by_member_id_gets_data_about_card_detail.yml +36 -0
  34. data/gmo.gemspec +2 -2
  35. data/lib/gmo.rb +6 -1
  36. data/lib/gmo/const.rb +2297 -3
  37. data/lib/gmo/errors.rb +22 -4
  38. data/lib/gmo/http_services.rb +5 -5
  39. data/lib/gmo/remittance_api.rb +331 -0
  40. data/lib/gmo/shop_and_site_api.rb +79 -5
  41. data/lib/gmo/shop_api.rb +282 -10
  42. data/lib/gmo/site_api.rb +77 -7
  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 +87 -7
  47. data/spec/gmo/shop_api_spec.rb +509 -99
  48. data/spec/gmo/site_api_spec.rb +120 -23
  49. data/spec/support/config.example.yml +8 -1
  50. data/spec/support/config.yml +8 -1
  51. data/spec/support/config_loader.rb +1 -1
  52. data/spec/support/vcr.rb +12 -3
  53. metadata +40 -9
@@ -9,11 +9,19 @@
9
9
 
10
10
  module GMO
11
11
 
12
- class GMOError < StandardError; end
12
+ class GMOError < StandardError
13
+ ERROR_INFO_SEPARATOR = '|'.freeze
14
+
15
+ private
16
+
17
+ def error_message(info, locale)
18
+ ::GMO::Const::API_ERROR_MESSAGES[locale][info] || info
19
+ end
20
+ end
13
21
 
14
22
  module Payment
15
23
  class Error < ::GMO::GMOError
16
- attr_accessor :error_info, :response_body
24
+ attr_accessor :error_info, :response_body, :locale, :error_messages
17
25
 
18
26
  def initialize(response_body = "", error_info = nil)
19
27
  if response_body && response_body.is_a?(String)
@@ -38,14 +46,24 @@ module GMO
38
46
  end
39
47
 
40
48
  class APIError < Error
41
- def initialize(error_info = {})
49
+ def initialize(error_info = {}, locale = ::GMO::Const::DEFAULT_LOCALE)
42
50
  self.error_info = error_info
51
+ self.locale = locale
43
52
  self.response_body = "ErrCode=#{error_info["ErrCode"]}&ErrInfo=#{error_info["ErrInfo"]}"
53
+ set_error_messages
44
54
  message = self.response_body
45
55
  super(message)
46
56
  end
57
+
58
+ private
59
+
60
+ def set_error_messages
61
+ self.error_messages = self.error_info['ErrInfo'].to_s.split(ERROR_INFO_SEPARATOR)
62
+ .map { |e| error_message(e, locale) || e }
63
+ self.response_body += "&ErrMessage=#{self.error_messages.join(ERROR_INFO_SEPARATOR)}"
64
+ end
47
65
  end
48
66
 
49
67
  end
50
68
 
51
- end
69
+ end
@@ -38,11 +38,11 @@ module GMO
38
38
  http = create_http(server(options), options)
39
39
  http.use_ssl = true
40
40
 
41
- result = http.start do |http|
42
- response, body = if verb == "post"
43
- http.post(path, encode_params(args))
41
+ http.start do |h|
42
+ response = if verb == "post"
43
+ h.post(path, encode_params(args))
44
44
  else
45
- http.get("#{path}?#{encode_params(args)}")
45
+ h.get("#{path}?#{encode_params(args)}")
46
46
  end
47
47
  GMO::Response.new(response.code.to_i, response.body, response)
48
48
  end
@@ -79,4 +79,4 @@ module GMO
79
79
  end
80
80
  end
81
81
  end
82
- end
82
+ end
@@ -0,0 +1,331 @@
1
+ # coding: utf-8
2
+
3
+ # A client for the GMO Remittance API.
4
+ #
5
+ # example
6
+ # gmo = GMO::Payment::RemittanceAPI.new({
7
+ # shop_id: "foo",
8
+ # shop_pass: "bar",
9
+ # host: "test-remittance.gmopg.jp",
10
+ # locale: "ja"
11
+ # })
12
+ module GMO
13
+ module Payment
14
+
15
+ module RemittanceAPIMethods
16
+
17
+ def initialize(options = {})
18
+ @shop_id = options[:shop_id]
19
+ @shop_pass = options[:shop_pass]
20
+ @host = options[:host]
21
+ @locale = options.fetch(:locale, GMO::Const::DEFAULT_LOCALE)
22
+ unless @shop_id && @shop_pass && @host
23
+ raise ArgumentError, "Initialize must receive a hash with :shop_id, :shop_pass and either :host! (received #{options.inspect})"
24
+ end
25
+ end
26
+ attr_reader :shop_id, :shop_pass, :host, :locale
27
+
28
+ #########
29
+ # Method
30
+ # Bank_ID
31
+ # Bank_Code
32
+ # Branch_Code
33
+ # Account_Type
34
+ # Account_Name
35
+ # Account_Number
36
+ # Branch_Code_Jpbank
37
+ # Account_Number_Jpbank
38
+ # Free
39
+ ### @return ###
40
+ # Bank_ID
41
+ # Method
42
+ # ErrCode
43
+ # ErrInfo
44
+ ### example ###
45
+ # gmo.create_account({
46
+ # bank_id: 'bank00000',
47
+ # bank_code: '0001',
48
+ # branch_code: '813',
49
+ # account_type: :normal,
50
+ # account_name: 'An Yutzy',
51
+ # account_number: '0012345',
52
+ # branch_code_jp: '00567',
53
+ # account_number_jp: '01234567',
54
+ # free: 'foobar' # Metadata
55
+ # })
56
+ # {"Bank_ID"=>"bank00000", "Method"=>"1"}
57
+ def create_account(options = {})
58
+ name = "/api/AccountRegistration.idPass"
59
+ options[:method] = 1
60
+ options[:account_type] = GMO::Const::ACCOUNT_TYPES_MAP[options[:account_type]]
61
+ required = %i(bank_id bank_code branch_code account_type account_name account_number)
62
+ assert_required_options(required, options)
63
+ post_request name, options
64
+ end
65
+
66
+ #########
67
+ # Method
68
+ # Bank_ID
69
+ # Bank_Code
70
+ # Branch_Code
71
+ # Account_Type
72
+ # Account_Name
73
+ # Account_Number
74
+ # Branch_Code_Jpbank
75
+ # Account_Number_Jpbank
76
+ # Free
77
+ ### @return ###
78
+ # Bank_ID
79
+ # Method
80
+ # ErrCode
81
+ # ErrInfo
82
+ ### example ###
83
+ # gmo.update_account({
84
+ # bank_id: 'bank00000',
85
+ # bank_code: '0001',
86
+ # branch_code: '813',
87
+ # account_type: :normal,
88
+ # account_name: 'An Yutzy',
89
+ # account_number: '0012345',
90
+ # branch_code_jp: '00567',
91
+ # account_number_jp: '01234567',
92
+ # free: 'foobar' # Metadata
93
+ # })
94
+ # {"Bank_ID"=>"bank00000", "Method"=>"2"}
95
+ def update_account(options = {})
96
+ name = "/api/AccountRegistration.idPass"
97
+ options[:method] = 2
98
+ options[:account_type] = GMO::Const::ACCOUNT_TYPES_MAP[options[:account_type]]
99
+ required = %i(bank_id bank_code branch_code account_type account_name account_number)
100
+ assert_required_options(required, options)
101
+ post_request name, options
102
+ end
103
+
104
+ #########
105
+ # Method
106
+ # Bank_ID
107
+ ### @return ###
108
+ # Bank_ID
109
+ # Method
110
+ # ErrCode
111
+ # ErrInfo
112
+ ### example ###
113
+ # gmo.delete_account({
114
+ # bank_id: 'bank00000',
115
+ # })
116
+ # {"Bank_ID"=>"bank00000", "Method"=>"3"}
117
+ def delete_account(options = {})
118
+ name = "/api/AccountRegistration.idPass"
119
+ options[:method] = 3
120
+ required = %i(bank_id)
121
+ assert_required_options(required, options)
122
+ post_request name, options
123
+ end
124
+
125
+ #########
126
+ # Bank_ID
127
+ ### @return ###
128
+ # Bank_ID
129
+ # Delete_Flag
130
+ # Bank_Name
131
+ # Bank_Code
132
+ # Branch_Name
133
+ # Branch_Code
134
+ # Account_Type
135
+ # Account_Number
136
+ # Account_Name
137
+ # Free
138
+ # Branch_Code_Jpbank
139
+ # Account_Number_Jpbank
140
+ ### example ###
141
+ # gmo.search_account({
142
+ # bank_id: 'bank12345'
143
+ # })
144
+ # {"Bank_ID"=>"bank12345", "Delete_Flag"=>"0", "Bank_Name"=>"みずほ銀行", "Bank_Code"=>"0001", "Branch_Name"=>"札幌支店", "Branch_Code"=>"813", "Account_Type"=>"1", "Account_Number"=>"0012345", "Account_Name"=>"An Yutzy", "Free"=>"", "Branch_Code_Jpbank"=>"", "Account_Number_Jpbank"=>""}
145
+ def search_account(options = {})
146
+ name = "/api/AccountSearch.idPass"
147
+ required = %i(bank_id)
148
+ assert_required_options(required, options)
149
+ post_request name, options
150
+ end
151
+
152
+ #########
153
+ # Method
154
+ # Deposit_ID
155
+ # Bank_ID
156
+ # Amount
157
+ ### @return ###
158
+ # Deposit_ID
159
+ # Bank_ID
160
+ # Method
161
+ # Amount
162
+ # Bank_Fee
163
+ ### example ###
164
+ # gmo.create_deposit({
165
+ # deposit_id: 'dep00000',
166
+ # bank_id: 'bank00000',
167
+ # amount: '1000'
168
+ # })
169
+ # {"Deposit_ID"=>"dep00000", "Bank_ID"=>"bank00000", "Method"=>"1", "Amount"=>"1000", "Bank_Fee"=>"27"}
170
+ def create_deposit(options = {})
171
+ name = "/api/DepositRegistration.idPass"
172
+ options[:method] = 1
173
+ required = %i(bank_id deposit_id amount)
174
+ assert_required_options(required, options)
175
+ post_request name, options
176
+ end
177
+
178
+ #########
179
+ # Method
180
+ # Deposit_ID
181
+ # Bank_ID
182
+ ### @return ###
183
+ # Deposit_ID
184
+ # Bank_ID
185
+ # Method
186
+ ### example ###
187
+ # gmo.cancel_deposit({
188
+ # deposit_id: 'dep00000',
189
+ # bank_id: 'bank00000',
190
+ # })
191
+ # {"Deposit_ID"=>"dep00000", "Bank_ID"=>"bank00000", "Method"=>"2"}
192
+ def cancel_deposit(options = {})
193
+ name = "/api/DepositRegistration.idPass"
194
+ options[:method] = 2
195
+ required = %i(bank_id deposit_id)
196
+ assert_required_options(required, options)
197
+ post_request name, options
198
+ end
199
+
200
+ #############
201
+ # Deposit_ID
202
+ ### @return ###
203
+ # Deposit_ID
204
+ # Bank_ID
205
+ # Bank_Name
206
+ # Bank_Code
207
+ # Branch_Name
208
+ # Branch_Code
209
+ # Account_Type
210
+ # Account_Number
211
+ # Account_Name
212
+ # Free
213
+ # Amount
214
+ # Bank_Fee
215
+ # Result
216
+ # Branch_Code_Jpbank
217
+ # Account_Number_Jpbank
218
+ # Deposit_Date
219
+ # Result_Detail
220
+ ### example ###
221
+ # gmo.search_deposit({
222
+ # deposit_id: 'dep00000'
223
+ # })
224
+ # {"Deposit_ID"=>"dep00000", "Bank_ID"=>"bank163144", "Bank_Name"=>"みずほ銀行", "Bank_Code"=>"0001", "Branch_Name"=>"札幌支店", "Branch_Code"=>"813", "Account_Type"=>"1", "Account_Number"=>"0012345", "Account_Name"=>"An Yutzy", "Free"=>"", "Amount"=>"181035", "Bank_Fee"=>"270", "Result"=>"0", "Branch_Code_Jpbank"=>"", "Account_Number_Jpbank"=>"", "Deposit_Date"=>"", "Result_Detail"=>""}
225
+ def search_deposit(options = {})
226
+ name = "/api/DepositSearch.idPass"
227
+ required = %i(deposit_id)
228
+ assert_required_options(required, options)
229
+ post_request name, options
230
+ end
231
+
232
+ #########
233
+ ### @return ###
234
+ # Shop_ID
235
+ # Balance
236
+ # Balance_Forecast
237
+ ### example ###
238
+ # gmo.search_balance
239
+ # {"Shop_ID"=>"rshop00000071", "Balance"=>"9818965", "Balance_Forecast"=>"9818965"}
240
+ def search_balance(options = {})
241
+ name = "/api/BalanceSearch.idPass"
242
+ post_request name, options
243
+ end
244
+
245
+ ###########
246
+ # Method
247
+ # Deposit_ID
248
+ # Mail_Address
249
+ # Amount
250
+ # Mail_Deposit_Account_Name
251
+ # Expire
252
+ # Shop_Mail_Address
253
+ ### @return ###
254
+ # Method
255
+ # Amount
256
+ # Deposit_ID
257
+ # Expire
258
+ ### example ###
259
+ # gmo.create_mail_deposit({
260
+ # deposit_id: 'dep00001',
261
+ # deposit_email: 'anyutzy@demo.com',
262
+ # amount: 1000,
263
+ # deposit_account_name: 'An Yutzy',
264
+ # expire: 5,
265
+ # deposit_shop_email: 'anyutzy@demo.com'
266
+ # })
267
+ # {"Deposit_ID"=>"dep00009", "Method"=>"1", "Amount"=>"1200", "Expire"=>"20170503"}
268
+ def create_mail_deposit(options = {})
269
+ name = "/api/MailDepositRegistration.idPass"
270
+ options[:method] = 1
271
+ required = %i(deposit_id deposit_email amount deposit_account_name expire deposit_shop_email)
272
+ assert_required_options(required, options)
273
+ post_request name, options
274
+ end
275
+
276
+ ###########
277
+ # Method
278
+ # Deposit_ID
279
+ ### @return ###
280
+ # Deposit_ID
281
+ # Method
282
+ ### example ###
283
+ # gmo.cancel_mail_deposit({
284
+ # deposit_id: 'dep00001',
285
+ # })
286
+ # {"Deposit_ID"=>"dep00001", "Method"=>"2"}
287
+ def cancel_mail_deposit(options = {})
288
+ name = "/api/MailDepositRegistration.idPass"
289
+ options[:method] = 2
290
+ required = %i(deposit_id)
291
+ assert_required_options(required, options)
292
+ post_request name, options
293
+ end
294
+
295
+ #########
296
+ # Deposit_ID
297
+ ### @return ###
298
+ # Deposit_ID
299
+ # Mail_Address
300
+ # Shop_Mail_Address
301
+ # Account_Name
302
+ # Amount
303
+ # Expire
304
+ # Status
305
+ ### example ###
306
+ # gmo.search_mail_deposit({
307
+ # deposit_id: 'dep00001'
308
+ # })
309
+ # {"Deposit_ID"=>"dep0001516", "Mail_Address"=>"anyutzy@demo.com", "Shop_Mail_Address"=>"anyutzy@demo.com", "Account_Name"=>"An Yutzy", "Amount"=>"1000", "Expire"=>"20170503", "Status"=>"0"}
310
+ def search_mail_deposit(options = {})
311
+ name = "/api/MailDepositSearch.idPass"
312
+ required = %i(deposit_id)
313
+ assert_required_options(required, options)
314
+ post_request name, options
315
+ end
316
+
317
+ private
318
+
319
+ def api_call(name, args = {}, verb = "post", options = {})
320
+ args.merge!({ "Shop_ID" => @shop_id, "Shop_Pass" => @shop_pass })
321
+ api(name, args, verb, options) do |response|
322
+ if response.is_a?(Hash) && !response["ErrInfo"].nil?
323
+ raise APIError.new(response, locale)
324
+ end
325
+ end
326
+ end
327
+
328
+ end
329
+
330
+ end
331
+ end
@@ -1,4 +1,16 @@
1
1
  # coding: utf-8
2
+
3
+ # A client for the GMO Payment API.
4
+ #
5
+ # example
6
+ # gmo = GMO::Payment::ShopAndSiteAPI.new({
7
+ # site_id: "foo",
8
+ # site_pass: "bar",
9
+ # shop_id: "baz",
10
+ # shop_pass: "bax",
11
+ # host: "p01.mul-pay.jp",
12
+ # locale: "ja"
13
+ # })
2
14
  module GMO
3
15
  module Payment
4
16
 
@@ -9,11 +21,12 @@ module GMO
9
21
  @site_id = options[:site_id]
10
22
  @site_pass = options[:site_pass]
11
23
  @host = options[:host]
24
+ @locale = options.fetch(:locale, GMO::Const::DEFAULT_LOCALE)
12
25
  unless @site_id && @site_pass && @shop_id && @shop_pass && @host
13
26
  raise ArgumentError, "Initialize must receive a hash with :site_id, :site_pass, :shop_id, :shop_pass and either :host! (received #{options.inspect})"
14
27
  end
15
28
  end
16
- attr_reader :shop_id, :shop_pass, :site_id, :site_pass, :host
29
+ attr_reader :shop_id, :shop_pass, :site_id, :site_pass, :host, :locale
17
30
 
18
31
  # 2.17.2.1.決済後カード登録
19
32
  # 指定されたオーダーID の取引に使用したカードを登録します。
@@ -28,6 +41,68 @@ module GMO
28
41
  post_request name, options
29
42
  end
30
43
 
44
+ ### @params ###
45
+ # MemberID
46
+ # OrderID
47
+ # DefaultFlag
48
+ # SeqMode
49
+ ### @return ###
50
+ # TokenSeq
51
+ # CardNoToken
52
+ # Forward
53
+ ### example ###
54
+ # gmo.trade_brandtoken({
55
+ # member_id: 'mem10001',
56
+ # order_id: 'ord10001'
57
+ # })
58
+ # => {"TokenSeq"=>"0", "CardNoToken"=>"*************111", "Forward"=>"2a99663"}
59
+ def trade_brandtoken(options = {})
60
+ name = "TradedBrandtoken.idPass"
61
+ required = [:order_id, :member_id]
62
+ assert_required_options(required, options)
63
+ post_request name, options
64
+ end
65
+
66
+ ### @params ###
67
+ # AccessID
68
+ # AccessPass
69
+ # OrderID
70
+ # TokenType
71
+ # Token
72
+ # MemberID
73
+ # SeqMode
74
+ # TokenSeq
75
+ # ClientField1
76
+ # ClientField2
77
+ # ClientField3
78
+ ### @return ###
79
+ # Status
80
+ # OrderID
81
+ # Forward
82
+ # Approve
83
+ # TranID
84
+ # TranDate
85
+ # ClientField1
86
+ # ClientField2
87
+ # ClientField3
88
+ ### example ###
89
+ # gmo.exec_tran_brandtoken({
90
+ # order_id: "597ae8c36120b23a3c00014e",
91
+ # access_id: "139f8ec33a07c55f406937c52ce4473d",
92
+ # access_pass: "2689b204d2c17192fa35f9269fa7e744",
93
+ # token_type: :apple_pay,
94
+ # token: <Base64 encoded payment data>,
95
+ # member_id: "mem10001"
96
+ # })
97
+ # => {"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"}
98
+ def exec_tran_brandtoken(options = {})
99
+ name = "ExecTranBrandtoken.idPass"
100
+ options[:token_type] = GMO::Const::TOKEN_TYPES_MAP[options[:token_type]]
101
+ required = [:access_id, :access_pass, :member_id, :order_id]
102
+ assert_required_options(required, options)
103
+ post_request name, options
104
+ end
105
+
31
106
  private
32
107
 
33
108
  def api_call(name, args = {}, verb = "post", options = {})
@@ -37,14 +112,13 @@ module GMO
37
112
  "SiteID" => @site_id,
38
113
  "SitePass" => @site_pass
39
114
  })
40
- response = api(name, args, verb, options) do |response|
115
+ api(name, args, verb, options) do |response|
41
116
  if response.is_a?(Hash) && !response["ErrInfo"].nil?
42
- raise APIError.new(response)
117
+ raise APIError.new(response, locale)
43
118
  end
44
119
  end
45
- response
46
120
  end
47
121
 
48
122
  end
49
123
  end
50
- end
124
+ end