omarzina / substruct

Automatically exported from code.google.com/p/substruct
0 stars 0 forks source link

Refactor PayPal IPN code in Order.rb #193

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
The PayPal IPN methods are a bit strange in Order.rb. In each of them, you're 
passing in an order 
object.

This seems like a "duh" candidate to be an instance method. Anyone see a reason 
it shouldn't be 
switched?

Additionally, "matches_ipn" looks like it should be a ? method.

For example, take the following code in PaypalController

{{{
        if notification.complete? && 
          Order.matches_ipn(notification, order, params) 
          Order.pass_ipn(order, params[:txn_id])
        else
          Order.fail_ipn(order)
        end
}}}

Would be much cleaner as the following.

{{{
if notification.complete? && order.matches_ipn?(notification) 
  order.pass_ipn(params[:txn_id])
else
  order.fail_ipn()
end

}}}

Original issue reported on code.google.com by subim...@gmail.com on 26 Dec 2009 at 6:03

GoogleCodeExporter commented 8 years ago
Resolved with r205

Original comment by subim...@gmail.com on 7 Feb 2010 at 7:22