【发布时间】:2015-08-12 16:07:57
【问题描述】:
您好,我在我的 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
但它不起作用......
【问题讨论】:
标签: ruby-on-rails error-handling payment mangopay