I have a rails 7 app where when the user clicks the button, it redirects to a payment gateway for doing payments online via GET Request, in my development mode, in local machine (on localhost:3000), it works perfectly fine.
orders_controller.rb
def paye
@payment_response = Easebuzz::Payment.initiate({
"txnid" => "#{@order.id}",
"amount" => amount.to_f,
"firstname" => current_user.name,
"email" => current_user.email,
"phone" => current_user.phone_number,
"productinfo" => "Payment for Order#{@order.id}",
"surl" => "http://localhost:3000/orders/#{@order.id}/successE",
"furl" => "http://localhost:3000/orders/#{@order.id}/failedTransaction",
})
if @payment_response['status'] == 1
data = @payment_response['data']
redirect_to("https://testpay.easebuzz.in/pay/#{data}", allow_other_host: true, status: 303)
end
puts @payment_response
end
routes.rb:
resources :orders do
member do
get '/paye', to: 'orders#paye'
end
end
index.html.erb
<%= link_to paye_order_path(order) %>
so as i said, in develpment mode, it is working absolutely fine, but when i use it in production which i deployed using aws ec2, apache and passenger, and just changed
def paye
.....
"surl" => "http://(Main Domain.in)/orders/#{@order.id}/successE",
"furl" => "http://(Main Domain.in)/orders/#{@order.id}/failedTransaction",
......
.......
redirect_to("https://pay.easebuzz.in/pay/#{data}", allow_other_host: true, status: 303)
#using pay.easebuzz in production
.....
puts @payment_response
end
Only 1st time it worked in production, then from 2nd time, it wasn't working.
the GET request is showing (OrdersController#payE is missing a template for request formats: text/html)
but in development, it is working absolutely fine, why is it not doing GET request in production??
also puts @payment_response is not showing anything in the logs.
So my main problem is that The GET request (payE method in order_controller.rb) is working in development, but when using in production, it is not working, it is not reading the Easebuzz::Payment.initiate
also i changed from payE from GET to POST request to see if it will puts @payment_response, but it is showing No template found for OrdersController#payE in logs.
What dumb thing am i doing here?
"#{x}"andxare effectively the same ifxis a String. If you want to convert it to one,x.to_sis the typical method. The quoted style is abashthing.