Browse Source

Paypal test 3

development
Godwin 10 years ago
parent
commit
4007c8d4ce
  1. 14
      app/controllers/conferences_controller.rb

14
app/controllers/conferences_controller.rb

@ -470,6 +470,7 @@ class ConferencesController < ApplicationController
def register_pay_registration def register_pay_registration
set_conference set_conference
@conference_registration = ConferenceRegistration.find_by(confirmation_token: params[:confirmation_token]) @conference_registration = ConferenceRegistration.find_by(confirmation_token: params[:confirmation_token])
host = "#{request.protocol}#{request.host_with_port}"
if !@conference_registration.nil? && @conference_registration.conference_id == @conference.id && @conference_registration.complete if !@conference_registration.nil? && @conference_registration.conference_id == @conference.id && @conference_registration.complete
if params[:payment_amount].nil? if params[:payment_amount].nil?
session[:registration] = YAML.load(@conference_registration.data) session[:registration] = YAML.load(@conference_registration.data)
@ -478,13 +479,12 @@ class ConferencesController < ApplicationController
session[:registration_step] = 'pay_now' session[:registration_step] = 'pay_now'
redirect_to action: 'register' redirect_to action: 'register'
else else
host = "#{request.protocol}#{request.host_with_port}"
begin begin
paypal_info = get_secure_info(:paypal) paypal_info = get_secure_info(:paypal)
request = Paypal::Express::Request.new( request = Paypal::Express::Request.new(
:username => paypal_info[:username].strip!, :username => paypal_info[:username],
:password => paypal_info[:password].strip!, :password => paypal_info[:password],
:signature => paypal_info[:signature].strip! :signature => paypal_info[:signature]
) )
payment_request = Paypal::Payment::Request.new( payment_request = Paypal::Payment::Request.new(
:currency_code => 'USD', # if nil, PayPal use USD as default :currency_code => 'USD', # if nil, PayPal use USD as default
@ -509,9 +509,9 @@ class ConferencesController < ApplicationController
elsif params[:test] elsif params[:test]
paypal_info = get_secure_info(:paypal) paypal_info = get_secure_info(:paypal)
request = Paypal::Express::Request.new( request = Paypal::Express::Request.new(
:username => paypal_info[:username].strip!, :username => paypal_info[:username],
:password => paypal_info[:password].strip!, :password => paypal_info[:password],
:signature => paypal_info[:signature].strip! :signature => paypal_info[:signature]
) )
payment_request = Paypal::Payment::Request.new( payment_request = Paypal::Payment::Request.new(
:currency_code => 'USD', # if nil, PayPal use USD as default :currency_code => 'USD', # if nil, PayPal use USD as default

Loading…
Cancel
Save