gpt4 book ai didi

ruby-on-rails - 如何解决因不正确的Iban或Bic导致的Mangopay错误

转载 作者:行者123 更新时间:2023-12-03 08:54:37 26 4
gpt4 key购买 nike

嗨,我在Rails应用程序上安装了Mangopay付款解决方案。
即使我在用正则表达式更新其个人资料时检查了用户的Iban和Bic,有时我将数据发送到Mangopay时也会收到错误消息(我猜是因为即使iban和bic格式正确,mangopay还是发现他们没有实际存在):
“一个或几个必需的参数丢失或不正确。错误的资源ID也会引发这种错误。IBAN:IBAN或BIC无效”

我将这些信息发送到Mangopay的代码如下:

  def create_mangopay_bank_account
bank_account = MangoPay::BankAccount.create(current_user.mangopay_natural_user_id, mangopay_user_bank_attributes)
current_user.bank_account_id = bank_account["Id"]
current_user.save
end

如何解决此错误?我尝试了类似的东西:
 def create_mangopay_bank_account
if MangoPay::BankAccount.create(current_user.mangopay_natural_user_id, mangopay_user_bank_attributes)
bank_account = MangoPay::BankAccount.create(current_user.mangopay_natural_user_id, mangopay_user_bank_attributes)
current_user.bank_account_id = bank_account["Id"]
current_user.save
else
redirect_to user_path
end

但这不起作用...

最佳答案

找到了解决方案:

 def create_mangopay_bank_account

bank_account = MangoPay::BankAccount.create(current_user.mangopay_natural_user_id, mangopay_user_bank_attributes)
current_user.bank_account_id = bank_account["Id"]
current_user.save
rescue MangoPay::ResponseError => e
redirect_to root_path
flash[:alert] = "L'Iban ou le Bic que vous avez fourni n'est pas valide. Veuillez vérifier les informations fournies. Si le problème persiste n'hésitez pas à contacter l'équipe TennisMatch."

end

call 救援可以处理来自mangopay的错误

关于ruby-on-rails - 如何解决因不正确的Iban或Bic导致的Mangopay错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30535543/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com