### Eclipse Workspace Patch 1.0
#P SeededBuzz
Index: sites/all/modules/uc_recurring/modules/uc_recurring_hosted/uc_recurring_hosted.module
===================================================================
--- sites/all/modules/uc_recurring/modules/uc_recurring_hosted/uc_recurring_hosted.module	(revision 13)
+++ sites/all/modules/uc_recurring/modules/uc_recurring_hosted/uc_recurring_hosted.module	(working copy)
@@ -22,6 +22,7 @@
     $items['uc_recurring_hosted/paypal/ipn/%'] = array(
       'title' => 'PayPal IPN',
       'page callback' => 'uc_recurring_hosted_paypal_ipn',
+      'page arguments' => array(3),
       'access callback' => 'uc_paypal_ipn_access',
       'type' => MENU_CALLBACK,
     );
@@ -589,13 +590,14 @@
     watchdog('uc_recurring_hosted', 'IPN failed with HTTP error @error, code @code.', array('@error' => $response->error, '@code' => $response->code), WATCHDOG_ERROR);
     return;
   }
-
+  
+  
   if (strcmp($response->data, 'VERIFIED') == 0) {
     watchdog('uc_recurring_hosted', 'IPN transaction verified.');
 
     // subscription
     $subscr_id = check_plain($_POST['subscr_id']);
-
+  
     switch ($txn_type) {
       case 'subscr_signup':
         // first we need to setup the recurring fee, since paypal_wps overrides the submit order function we need to call uc_recurring_order submit function here
@@ -604,28 +606,23 @@
         break;
       case 'subscr_payment':
         if ($order->order_status == 'completed') {
-          if($payment_status == 'Completed' || $payment_status == 'Pending'){
-            //set a flag for when we call the renew handler
-            $fee->pp_payment_accepted = TRUE;
-          }else if($payment_status == 'Denied' || $payment_status == 'Failed' || $payment_status == 'Reversed'){
-            $fee->pp_payment_accepted = FALSE;
-          }
-          
           // Fetch fee from database.
           $fees = uc_recurring_get_fees($order);
           if ($fee = $fees[0]) {
+            if($payment_status == 'Completed' || $payment_status == 'Pending'){
+              //set a flag for when we call the renew handler
+              $fee->pp_payment_accepted = TRUE;
+            }else if($payment_status == 'Denied' || $payment_status == 'Failed' || $payment_status == 'Reversed'){
+              $fee->pp_payment_accepted = FALSE;
+            }
+            
             $order_id = uc_recurring_renew($fee);
             $order = uc_order_load($order_id);
           }
         }
         break;
       case 'subscr_failed':
-        //set a flag for when we call the renew handler
-        $fee->pp_payment_accepted = FALSE;
-        if ($fee = $fees[0]) {
-          $order_id = uc_recurring_renew($fee);
-          $order = uc_order_load($order_id);
-        }
+        //log that it failed, don't do anything else
         return;
       case 'subscr_eot':
       case 'subscr_cancel':
