Skip to content

Conversation

@hoverlover
Copy link

This PR includes code that will ignore an IPN message if the invoice doesn't correspond with a Spree order. Sometimes, PayPal users will receive funds outside of Spree. With the current codebase, this will cause a 500 error because the order can't be found. The code I've included will simply return a 200 response for the IPN request if the invoice param doesn't match the format of the Spree order number.

@tomash
Copy link
Owner

tomash commented Mar 18, 2012

i don't like the params[:invoice].index condition

i don't like it because it's tied to default spree order numbering system, and doesn't guarantee that it's an actual order in the db.

what i did in my own store (haven't expected it to be useful to other people) :


private
  def return_for_inexisting_orders
    @order = Order.find_by_number(params[:invoice])
    if(@order.nil? || params[:invoice].nil?)
      render :text => 'not found', :status => 200, :layout => false
    end
  end

other than that, good job! i'd prefer feature-related commits and testing-environment-related ones to be in separate pull requests, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants