Sha256: cc47c5a5ee3f61c89d7b344ce62f1a2a366a00a9b24ea7a590ab7b055f65e61c

Contents?: true

Size: 842 Bytes

Versions: 3

Compression:

Stored size: 842 Bytes

Contents

class Wepay::IpnController < Wepay::ApplicationController
  include WepayRails::Payments
  def update
      record = WepayCheckoutRecord.find_by_checkout_id_and_security_token(params[:checkout_id],params[:security_token])

      if record.present?
        wepay_gateway = WepayRails::Payments::Gateway.new

        if record.checkout_id.present?
          checkout = wepay_gateway.lookup_checkout(record.checkout_id)
        else
          checkout = wepay_gateway.lookup_preapproval(record.preapproval_id)
        end
        checkout.delete_if {|k,v| !record.attributes.include? k.to_s}
        record.update_attributes(checkout)
        render :text => "ok"
      else
        raise StandardError.new("Wepay IPN: No record found for checkout_id #{params[:checkout_id]} and security_token #{params[:security_token]}")
      end

    end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
wepay-rails-2.6.0 app/controllers/wepay/ipn_controller.rb
wepay-rails-2.5.2 app/controllers/wepay/ipn_controller.rb
wepay-rails-2.5.1 app/controllers/wepay/ipn_controller.rb