質問編集履歴
3
railsコンソールではなくbyebugだった
test
CHANGED
File without changes
|
test
CHANGED
@@ -488,7 +488,7 @@
|
|
488
488
|
|
489
489
|
|
490
490
|
|
491
|
-
|
491
|
+
byebugで取得したAccountオブジェクトの中身を確認したところ、individualの代わりにrepresatativeという要素があり、その要素がaddress_kanjiやfirst_name_kanjiの要素を持っていました。
|
492
492
|
|
493
493
|
上記した公式のページを見ると、business-typeがcompaniesになっているとそのように要素がindividualではなくrepresatativeになるようなのですが、コードでは以下のようにbusiness-typeをindividualと設定しているため何故こうした状況になっているのか分かりません。
|
494
494
|
|
2
質問に関係ないと思われる箇所を削除した
test
CHANGED
File without changes
|
test
CHANGED
@@ -128,25 +128,329 @@
|
|
128
128
|
|
129
129
|
|
130
130
|
|
131
|
+
end
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
```
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
```ruby
|
140
|
+
|
141
|
+
#ユーザBをAccountAPIを用いて作成しているコントローラ
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
class GiftsController < ApplicationController
|
146
|
+
|
147
|
+
require 'stripe'
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
def new
|
152
|
+
|
153
|
+
end
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
def index
|
158
|
+
|
159
|
+
end
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
def create
|
164
|
+
|
165
|
+
Stripe.api_key = '本来は秘密鍵を直書きしています'
|
166
|
+
|
167
|
+
@amount = 100
|
168
|
+
|
169
|
+
@post = Post.find_by(id: params[:post_id])
|
170
|
+
|
171
|
+
@reciever_local = User.find_by(id: @post.user_id)
|
172
|
+
|
173
|
+
@card_sender = Card.find_by(user_id: current_user.id)
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
# byebug
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
begin
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
reciever = Stripe::Account.create({
|
186
|
+
|
187
|
+
type: 'custom',
|
188
|
+
|
189
|
+
country: 'JP',
|
190
|
+
|
191
|
+
business_type: 'individual',
|
192
|
+
|
193
|
+
# name: @reciever_local.name,
|
194
|
+
|
195
|
+
# email: @reciever_local.email,
|
196
|
+
|
197
|
+
capabilities: {
|
198
|
+
|
199
|
+
card_payments: {requested: true},
|
200
|
+
|
201
|
+
transfers: {requested: true},
|
202
|
+
|
203
|
+
},
|
204
|
+
|
205
|
+
})
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
stripe_account = Stripe::Account.retrieve(reciever.id)
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
# 事業者の種類(法人 or 個人)
|
214
|
+
|
215
|
+
stripe_account.business_type = "individual" #個人
|
216
|
+
|
217
|
+
stripe_account.external_accounts.create({
|
218
|
+
|
219
|
+
:external_account => {
|
220
|
+
|
221
|
+
'object':'bank_account',
|
222
|
+
|
223
|
+
'account_number': '0001234',
|
224
|
+
|
225
|
+
'routing_number': '1100000', #銀行コード+支店コード
|
226
|
+
|
227
|
+
'account_holder_name':'トクテスト(カ',
|
228
|
+
|
229
|
+
'currency':'jpy',
|
230
|
+
|
231
|
+
'country':'jp'
|
232
|
+
|
233
|
+
}
|
234
|
+
|
235
|
+
})
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
# byebug
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
# 事業者の住所(漢字)
|
244
|
+
|
245
|
+
# stripe_account.individual.address_kanji.postal_code = "1234567"
|
246
|
+
|
247
|
+
stripe_account.individual.address_kanji.state = "東京"
|
248
|
+
|
249
|
+
stripe_account.individual.address_kanji.city = "渋谷区"
|
250
|
+
|
251
|
+
stripe_account.individual.address_kanji.town = "恵比寿"
|
252
|
+
|
253
|
+
stripe_account.individual.address_kanji.line1 = "1-1-1"
|
254
|
+
|
255
|
+
stripe_account.individual.address_kanji.line2 = "テストビルディング101号"
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
# 事業者の住所(かな)
|
260
|
+
|
261
|
+
# stripe_account.individual.address_kana.postal_code = "1234567"
|
262
|
+
|
263
|
+
stripe_account.individual.address_kana.state = "とうきょうと"
|
264
|
+
|
265
|
+
stripe_account.individual.address_kana.city = "しぶやく"
|
266
|
+
|
267
|
+
stripe_account.individual.address_kana.town = "えびす"
|
268
|
+
|
269
|
+
stripe_account.individual.address_kana.line1 = "1-1-1"
|
270
|
+
|
271
|
+
stripe_account.individual.address_kana.line2 = "てすとびるでぃんぐ101ごう"
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
# 事業責任者の名前(漢字)
|
276
|
+
|
277
|
+
stripe_account.individual.first_name_kanji = "太郎"
|
278
|
+
|
279
|
+
stripe_account.individual.last_name_kanji = "田中"
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
# 事業責任者の名前(かな)
|
284
|
+
|
285
|
+
stripe_account.individual.first_name_kana = "たろう"
|
286
|
+
|
287
|
+
stripe_account.individual.last_name_kana = "たなか"
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
# 事業者責任者の誕生日
|
292
|
+
|
293
|
+
stripe_account.individual.dob.day = "1"
|
294
|
+
|
295
|
+
stripe_account.individual.dob.month = "1"
|
296
|
+
|
297
|
+
stripe_account.individual.dob.year = "2000"
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
# # 事業責任者の性別
|
302
|
+
|
303
|
+
stripe_account.individual.gender = "male"
|
304
|
+
|
305
|
+
|
306
|
+
|
307
|
+
# # 事業責任者の電話番号
|
308
|
+
|
309
|
+
stripe_account.individual.phone = "090-0000-0000"
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
# 受理された日付とグローバルIPアドレス
|
314
|
+
|
315
|
+
stripe_account.tos_acceptance.date = Time.now.to_i
|
316
|
+
|
317
|
+
stripe_account.tos_acceptance.ip = "192.168.0.1" #グローバルIPアドレスを入力
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
# Stripeに画像ファイルをアップロードするための処理
|
322
|
+
|
323
|
+
# 免許証やパスポートなどをアップロードする
|
324
|
+
|
325
|
+
verification_document = Stripe::FileUpload.create(
|
326
|
+
|
327
|
+
{
|
328
|
+
|
329
|
+
purpose: 'identity_document',
|
330
|
+
|
331
|
+
file: File.new("/Users/yusaku/works/komarigoto_hiroba/app/assets/images/inu.png")
|
332
|
+
|
333
|
+
},
|
334
|
+
|
335
|
+
{
|
336
|
+
|
337
|
+
stripe_account: stripe_account_id
|
338
|
+
|
339
|
+
}
|
340
|
+
|
341
|
+
)
|
342
|
+
|
343
|
+
|
344
|
+
|
345
|
+
# アップロードされたドキュメントのID番号
|
346
|
+
|
347
|
+
stripe_account.individual.verification.document = verification_document.id
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
stripe_account.save
|
352
|
+
|
353
|
+
|
354
|
+
|
355
|
+
gift = Stripe::PaymentIntent.create({
|
356
|
+
|
357
|
+
payment_method_types: ['card'],
|
358
|
+
|
359
|
+
amount: @amount,
|
360
|
+
|
361
|
+
currency: "jpy",
|
362
|
+
|
363
|
+
customer: @sender_card.customer_id, #Stripe.jsで自動で付与されるカード情報のトークン
|
364
|
+
|
365
|
+
destination: {
|
366
|
+
|
367
|
+
account: reciever.id,
|
368
|
+
|
369
|
+
},
|
370
|
+
|
371
|
+
})
|
372
|
+
|
373
|
+
|
374
|
+
|
375
|
+
|
376
|
+
|
377
|
+
# stripe関連でエラーが起こった場合
|
378
|
+
|
379
|
+
rescue Stripe::CardError => e
|
380
|
+
|
381
|
+
flash[:error] = "#決済(stripe)でエラーが発生しました。{e.message}"
|
382
|
+
|
383
|
+
render :new
|
384
|
+
|
385
|
+
|
386
|
+
|
387
|
+
# Invalid parameters were supplied to Stripe's API
|
388
|
+
|
389
|
+
rescue Stripe::InvalidRequestError => e
|
390
|
+
|
391
|
+
flash.now[:error] = "決済(stripe)でエラーが発生しました(InvalidRequestError)#{e.message}"
|
392
|
+
|
393
|
+
render :new
|
394
|
+
|
395
|
+
|
396
|
+
|
397
|
+
# Authentication with Stripe's API failed(maybe you changed API keys recently)
|
398
|
+
|
399
|
+
rescue Stripe::AuthenticationError => e
|
400
|
+
|
401
|
+
flash.now[:error] = "決済(stripe)でエラーが発生しました(AuthenticationError)#{e.message}"
|
402
|
+
|
403
|
+
render :new
|
404
|
+
|
405
|
+
|
406
|
+
|
407
|
+
# Network communication with Stripe failed
|
408
|
+
|
409
|
+
rescue Stripe::APIConnectionError => e
|
410
|
+
|
411
|
+
flash.now[:error] = "決済(stripe)でエラーが発生しました(APIConnectionError)#{e.message}"
|
412
|
+
|
413
|
+
render :new
|
414
|
+
|
415
|
+
|
416
|
+
|
417
|
+
# Display a very generic error to the user, and maybe send yourself an email
|
418
|
+
|
419
|
+
rescue Stripe::StripeError => e
|
420
|
+
|
421
|
+
flash.now[:error] = "決済(stripe)でエラーが発生しました(StripeError)#{e.message}"
|
422
|
+
|
423
|
+
render :new
|
424
|
+
|
425
|
+
|
426
|
+
|
427
|
+
# stripe関連以外でエラーが起こった場合
|
428
|
+
|
429
|
+
rescue => e
|
430
|
+
|
431
|
+
flash.now[:error] = "エラーが発生しました#{e.message}"
|
432
|
+
|
433
|
+
render :new
|
434
|
+
|
435
|
+
end
|
436
|
+
|
437
|
+
|
438
|
+
|
439
|
+
posts_path and return
|
440
|
+
|
441
|
+
|
442
|
+
|
443
|
+
end
|
444
|
+
|
445
|
+
|
446
|
+
|
131
447
|
def delete
|
132
448
|
|
133
|
-
card = Card.where(user_id: current_user.id).first
|
134
|
-
|
135
|
-
if card.blank?
|
136
|
-
|
137
|
-
else
|
138
|
-
|
139
|
-
Payjp.api_key = 'sk_test_81f3183a95db326cb5db9158'
|
140
|
-
|
141
|
-
customer = Payjp::Customer.retrieve(card.customer_id)
|
142
|
-
|
143
|
-
customer.delete
|
144
|
-
|
145
|
-
card.delete
|
146
|
-
|
147
|
-
|
449
|
+
end
|
148
|
-
|
450
|
+
|
451
|
+
|
452
|
+
|
149
|
-
|
453
|
+
def show
|
150
454
|
|
151
455
|
end
|
152
456
|
|
@@ -160,364 +464,38 @@
|
|
160
464
|
|
161
465
|
```ruby
|
162
466
|
|
163
|
-
#
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
r
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
def
|
174
|
-
|
175
|
-
end
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
@post = Post.find_by(id: params[:post_id])
|
192
|
-
|
193
|
-
@reciever_local = User.find_by(id: @post.user_id)
|
194
|
-
|
195
|
-
@card_sender = Card.find_by(user_id: current_user.id)
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
# byebug
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
begin
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
reciever = Stripe::Account.create({
|
208
|
-
|
209
|
-
type: 'custom',
|
210
|
-
|
211
|
-
country: 'JP',
|
212
|
-
|
213
|
-
business_type: 'individual',
|
214
|
-
|
215
|
-
# name: @reciever_local.name,
|
216
|
-
|
217
|
-
# email: @reciever_local.email,
|
218
|
-
|
219
|
-
capabilities: {
|
220
|
-
|
221
|
-
card_payments: {requested: true},
|
222
|
-
|
223
|
-
transfers: {requested: true},
|
224
|
-
|
225
|
-
},
|
226
|
-
|
227
|
-
})
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
stripe_account = Stripe::Account.retrieve(reciever.id)
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
# 事業者の種類(法人 or 個人)
|
236
|
-
|
237
|
-
stripe_account.business_type = "individual" #個人
|
238
|
-
|
239
|
-
stripe_account.external_accounts.create({
|
240
|
-
|
241
|
-
:external_account => {
|
242
|
-
|
243
|
-
'object':'bank_account',
|
244
|
-
|
245
|
-
'account_number': '0001234',
|
246
|
-
|
247
|
-
'routing_number': '1100000', #銀行コード+支店コード
|
248
|
-
|
249
|
-
'account_holder_name':'トクテスト(カ',
|
250
|
-
|
251
|
-
'currency':'jpy',
|
252
|
-
|
253
|
-
'country':'jp'
|
254
|
-
|
255
|
-
}
|
256
|
-
|
257
|
-
})
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
# byebug
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
# 事業者の住所(漢字)
|
266
|
-
|
267
|
-
# stripe_account.individual.address_kanji.postal_code = "1234567"
|
268
|
-
|
269
|
-
stripe_account.individual.address_kanji.state = "東京"
|
270
|
-
|
271
|
-
stripe_account.individual.address_kanji.city = "渋谷区"
|
272
|
-
|
273
|
-
stripe_account.individual.address_kanji.town = "恵比寿"
|
274
|
-
|
275
|
-
stripe_account.individual.address_kanji.line1 = "1-1-1"
|
276
|
-
|
277
|
-
stripe_account.individual.address_kanji.line2 = "テストビルディング101号"
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
# 事業者の住所(かな)
|
282
|
-
|
283
|
-
# stripe_account.individual.address_kana.postal_code = "1234567"
|
284
|
-
|
285
|
-
stripe_account.individual.address_kana.state = "とうきょうと"
|
286
|
-
|
287
|
-
stripe_account.individual.address_kana.city = "しぶやく"
|
288
|
-
|
289
|
-
stripe_account.individual.address_kana.town = "えびす"
|
290
|
-
|
291
|
-
stripe_account.individual.address_kana.line1 = "1-1-1"
|
292
|
-
|
293
|
-
stripe_account.individual.address_kana.line2 = "てすとびるでぃんぐ101ごう"
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
# 事業責任者の名前(漢字)
|
298
|
-
|
299
|
-
stripe_account.individual.first_name_kanji = "太郎"
|
300
|
-
|
301
|
-
stripe_account.individual.last_name_kanji = "田中"
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
# 事業責任者の名前(かな)
|
306
|
-
|
307
|
-
stripe_account.individual.first_name_kana = "たろう"
|
308
|
-
|
309
|
-
stripe_account.individual.last_name_kana = "たなか"
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
# 事業者責任者の誕生日
|
314
|
-
|
315
|
-
stripe_account.individual.dob.day = "1"
|
316
|
-
|
317
|
-
stripe_account.individual.dob.month = "1"
|
318
|
-
|
319
|
-
stripe_account.individual.dob.year = "2000"
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
# # 事業責任者の性別
|
324
|
-
|
325
|
-
stripe_account.individual.gender = "male"
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
# # 事業責任者の電話番号
|
330
|
-
|
331
|
-
stripe_account.individual.phone = "090-0000-0000"
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
# 受理された日付とグローバルIPアドレス
|
336
|
-
|
337
|
-
stripe_account.tos_acceptance.date = Time.now.to_i
|
338
|
-
|
339
|
-
stripe_account.tos_acceptance.ip = "192.168.0.1" #グローバルIPアドレスを入力
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
# Stripeに画像ファイルをアップロードするための処理
|
344
|
-
|
345
|
-
# 免許証やパスポートなどをアップロードする
|
346
|
-
|
347
|
-
verification_document = Stripe::FileUpload.create(
|
348
|
-
|
349
|
-
{
|
350
|
-
|
351
|
-
purpose: 'identity_document',
|
352
|
-
|
353
|
-
file: File.new("/Users/yusaku/works/komarigoto_hiroba/app/assets/images/inu.png")
|
354
|
-
|
355
|
-
},
|
356
|
-
|
357
|
-
{
|
358
|
-
|
359
|
-
stripe_account: stripe_account_id
|
360
|
-
|
361
|
-
}
|
362
|
-
|
363
|
-
)
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
# アップロードされたドキュメントのID番号
|
368
|
-
|
369
|
-
stripe_account.individual.verification.document = verification_document.id
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
stripe_account.save
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
gift = Stripe::PaymentIntent.create({
|
378
|
-
|
379
|
-
payment_method_types: ['card'],
|
380
|
-
|
381
|
-
amount: @amount,
|
382
|
-
|
383
|
-
currency: "jpy",
|
384
|
-
|
385
|
-
customer: @sender_card.customer_id, #Stripe.jsで自動で付与されるカード情報のトークン
|
386
|
-
|
387
|
-
destination: {
|
388
|
-
|
389
|
-
account: reciever.id,
|
390
|
-
|
391
|
-
},
|
392
|
-
|
393
|
-
})
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
# stripe関連でエラーが起こった場合
|
400
|
-
|
401
|
-
rescue Stripe::CardError => e
|
402
|
-
|
403
|
-
flash[:error] = "#決済(stripe)でエラーが発生しました。{e.message}"
|
404
|
-
|
405
|
-
render :new
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
# Invalid parameters were supplied to Stripe's API
|
410
|
-
|
411
|
-
rescue Stripe::InvalidRequestError => e
|
412
|
-
|
413
|
-
flash.now[:error] = "決済(stripe)でエラーが発生しました(InvalidRequestError)#{e.message}"
|
414
|
-
|
415
|
-
render :new
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
# Authentication with Stripe's API failed(maybe you changed API keys recently)
|
420
|
-
|
421
|
-
rescue Stripe::AuthenticationError => e
|
422
|
-
|
423
|
-
flash.now[:error] = "決済(stripe)でエラーが発生しました(AuthenticationError)#{e.message}"
|
424
|
-
|
425
|
-
render :new
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
# Network communication with Stripe failed
|
430
|
-
|
431
|
-
rescue Stripe::APIConnectionError => e
|
432
|
-
|
433
|
-
flash.now[:error] = "決済(stripe)でエラーが発生しました(APIConnectionError)#{e.message}"
|
434
|
-
|
435
|
-
render :new
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
# Display a very generic error to the user, and maybe send yourself an email
|
440
|
-
|
441
|
-
rescue Stripe::StripeError => e
|
442
|
-
|
443
|
-
flash.now[:error] = "決済(stripe)でエラーが発生しました(StripeError)#{e.message}"
|
444
|
-
|
445
|
-
render :new
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
# stripe関連以外でエラーが起こった場合
|
450
|
-
|
451
|
-
rescue => e
|
452
|
-
|
453
|
-
flash.now[:error] = "エラーが発生しました#{e.message}"
|
454
|
-
|
455
|
-
render :new
|
456
|
-
|
457
|
-
end
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
posts_path and return
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
end
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
def delete
|
470
|
-
|
471
|
-
end
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
def show
|
476
|
-
|
477
|
-
end
|
478
|
-
|
479
|
-
end
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
```
|
467
|
+
#new.html.erb 送金ボタンを設置するためのコード
|
468
|
+
|
469
|
+
|
470
|
+
|
471
|
+
<% provide(:button_text, '100円ギフトする') %>
|
472
|
+
|
473
|
+
<%= button_to 'カード情報登録画面へ', new_post_card_path(id: params[:id]), method: :get, class: 'btn btn-outline-dark' %>
|
474
|
+
|
475
|
+
|
476
|
+
|
477
|
+
<%= form_with url: post_gifts_path(id: params[:id]), method: :post, local: true do |f| %>
|
478
|
+
|
479
|
+
<%= f.submit yield(:button_text), id: 'card_button', class: 'btn btn-primary' %>
|
480
|
+
|
481
|
+
<% end %>
|
482
|
+
|
483
|
+
```
|
484
|
+
|
485
|
+
|
486
|
+
|
487
|
+
### 試したこと
|
488
|
+
|
489
|
+
|
490
|
+
|
491
|
+
Railsコンソールで取得したAccountオブジェクトの中身を確認したところ、individualの代わりにrepresatativeという要素があり、その要素がaddress_kanjiやfirst_name_kanjiの要素を持っていました。
|
492
|
+
|
493
|
+
上記した公式のページを見ると、business-typeがcompaniesになっているとそのように要素がindividualではなくrepresatativeになるようなのですが、コードでは以下のようにbusiness-typeをindividualと設定しているため何故こうした状況になっているのか分かりません。
|
484
494
|
|
485
495
|
|
486
496
|
|
487
497
|
```ruby
|
488
498
|
|
489
|
-
#new.html.erb 送金ボタンを設置するためのコード
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
<% provide(:button_text, '100円ギフトする') %>
|
494
|
-
|
495
|
-
<%= button_to 'カード情報登録画面へ', new_post_card_path(id: params[:id]), method: :get, class: 'btn btn-outline-dark' %>
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
<%= form_with url: post_gifts_path(id: params[:id]), method: :post, local: true do |f| %>
|
500
|
-
|
501
|
-
<%= f.submit yield(:button_text), id: 'card_button', class: 'btn btn-primary' %>
|
502
|
-
|
503
|
-
<% end %>
|
504
|
-
|
505
|
-
```
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
### 試したこと
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
Railsコンソールで取得したAccountオブジェクトの中身を確認したところ、individualの代わりにrepresatativeという要素があり、その要素がaddress_kanjiやfirst_name_kanjiの要素を持っていました。
|
514
|
-
|
515
|
-
上記した公式のページを見ると、business-typeがcompaniesになっているとそのように要素がindividualではなくrepresatativeになるようなのですが、コードでは以下のようにbusiness-typeをindividualと設定しているため何故こうした状況になっているのか分かりません。
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
```ruby
|
520
|
-
|
521
499
|
#ユーザBをAccountAPIを用いて作成しているコントローラより再掲
|
522
500
|
|
523
501
|
|
1
秘密鍵を載せていたため
test
CHANGED
File without changes
|
test
CHANGED
@@ -84,7 +84,7 @@
|
|
84
84
|
|
85
85
|
def create
|
86
86
|
|
87
|
-
Stripe.api_key = '
|
87
|
+
Stripe.api_key = '本来は秘密鍵を直書きしています'
|
88
88
|
|
89
89
|
if params['stripeToken'].blank?
|
90
90
|
|
@@ -184,7 +184,7 @@
|
|
184
184
|
|
185
185
|
def create
|
186
186
|
|
187
|
-
Stripe.api_key = '
|
187
|
+
Stripe.api_key = '本来は秘密鍵を直書きしています'
|
188
188
|
|
189
189
|
@amount = 100
|
190
190
|
|