Sha256: 69ec8d6b013ed2081f905ed1bb02312085b79f0c4cdd4179307b421530bf4f8a

Contents?: true

Size: 742 Bytes

Versions: 3

Compression:

Stored size: 742 Bytes

Contents

class Wepay::IpnController < Wepay::ApplicationController
  def index

    puts "*"*50
    puts @config.inspect
    puts "*"*50

    raise StandardError.new("Your wepay.yml isn't being read for some reason") if @config.blank?
    raise StandardError.new("A model needs to exist to trap the IPN messages from Wepay. Please create a model (eg. WepayCheckoutRecord) and set the class name in your wepay.yml, wepay_checkout_model directive") if @config[:wepay_checkout_model].blank?

    klass = @config[:wepay_checkout_model]
    record = klass.find_by_checkout_id(params[:checkout_id])

    if record.present?
      record.update_attributes(params)
    else
      model = klass.new
      model.save!
    end

    render :text => 'ok'
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
wepay-rails-0.1.77 app/controllers/wepay/ipn_controller.rb
wepay-rails-0.1.76 app/controllers/wepay/ipn_controller.rb
wepay-rails-0.1.75 app/controllers/wepay/ipn_controller.rb