前提
djangoを使ってアプリを開発をしていて、stripeの決済サービスを導入しようと考えているものです。stripeではconnectのcustomアカウントを使用しています。
実現したいこと
customの子アカウント作成時に、本人証明書の画像を登録しようとしましたがエラーが発生してしまいました。以下の記事を参考にコーディングしていますが、アプリサーバーの管理にはおかずにフォームで受け取りそのままrequest.FILES['image']としてstripeに渡したいです。
参考サイト:https://qiita.com/kwashi/items/06e3c633b8c985f59bd6
発生している問題・エラーメッセージ
TypeError at /profile/required_information/1 'module' object is not callable
該当のソースコード
python
@login_requireddef RequiredInformationView(request, uid): user = CustomUser.objects.get(pk=uid) if request.method == 'POST': #内容省略。参考サイトをご覧ください。 def upload_identity_verification_file(acct_id, img_path): #https://stripe.com/docs/connect/identity-verification-api with open(img_path, "rb") as fp: res = stripe.FileUpload.create( purpose='identity_document', file=fp, stripe_account=acct_id ) verification_id = res["id"] res = stripe.Account.modify( acct_id, individual ={ "verification" :{ "document":{ "front": verification_id } }}) image_path = os.path(request.FILES['image']) upload_identity_verification_file(CONNECTED_STRIPE_ACCOUNT_ID, image_path) user.stripe = CONNECTED_STRIPE_ACCOUNT_ID user.save() params = { 'login_user': request.user, 'form':RequiredInformationForm, } return render(request, 'required_information.html', params)
試したこと
以上のようにエラーが出ていてもどのmoduleが足りてないのか理解していないので教えていただきたいです。そのままimg_path = request.FILES['image']で渡すとos.LikePathで渡してねとエラーが出てしまいました。
0 コメント