当我尝试在Stripe测试模式帐户上进行付款时,我正在使用Payola-payments 1.5.1和Rails 5.0.1并遇到以下错误: 没有路线匹配[GET]“/ payola / events” Payola有一条通往“/ payola / events”的路线,通往Webhooks控制器,但它只响应Post方法。这是来自事务控制器的重定向,传递的参数是{“action”=>“new”,“controller”=>“users / sessions”}
Payola以前在我的电脑上运行良好。我能想到的唯一变化是一些gem更新,包括切换到5.0.1。
以前有人碰到过吗?任何帮助将不胜感激。
答案 0 :(得分:1)
覆盖Payola Engine提供的默认路由。我这样设置路线。它正在Rails 5.2上运行。
scope module: 'payola' do
mount StripeEvent::Engine => 'payola/events', as: :payola
post 'payola/buy/:product_class/:permalink' => 'transactions#create', as: :buy
get 'payola/confirm/:guid' => 'transactions#show', as: :confirm
get 'payola/status/:guid' => 'transactions#status', as: :status
post 'payola/subscribe/:plan_class/:plan_id' => 'subscriptions#create', as: :subscribe
get 'payola/confirm_subscription/:guid' => 'subscriptions#show', as: :confirm_subscription
get 'payola/subscription_status/:guid' => 'subscriptions#status', as: :subscription_status
delete 'payola/cancel_subscription/:guid' => 'subscriptions#destroy', as: :cancel_subscription
post 'payola/change_plan/:guid' => 'subscriptions#change_plan', as: :change_subscription_plan
post 'payola/change_quantity/:guid' => 'subscriptions#change_quantity', as: :change_subscription_quantity
post 'payola/update_card/:guid' => 'subscriptions#update_card', as: :update_card
post 'payola/update_customer/:id' => 'customers#update', as: :update_customer
post 'payola/create_card/:customer_id' => 'cards#create', as: :create_card
delete 'payola/destroy_card/:id/:customer_id' => 'cards#destroy', as: :destroy_card
end
最后,我相信请禁用disable_with,默认情况下,Rails 5.0+已启用该功能。它将停止Payola用于处理付款的JS表单代码。
<%= f.submit "Submit" data: {disable_with: false} %>