Welcome Guest, Not a member yet? Register   Sign In
PayPal IPN Response and Table Updates
#1

[eluser]johnnyletrois[/eluser]
Hi,

I'm trying to get the final piece of my backend running, and I'm having a problem. After making a payment, the database is not updating at all.

There appears to be a disconnect between the IPN listener and the updateTableData model. I've tested the IPN listener from the PayPal Sandbox and it is working fine. I have also confirmed that payment status is being returned as "Completed" so that is also fine.

======================================
Payment controller IPN listener
-----------------------------------------------------------
Code:
function paypal_ipn()
    {
        if($_REQUEST['payment_status'] == 'Completed')
        {
        $custom              = $_REQUEST['custom'];
        $data                = array();
        $list                = array();
        $data                = explode('@', $custom);
      
        $list_id             = $data[0];
        $reservation_id      = $data[1];
        $email_id            = $data[2];
      
        $price               = $_REQUEST['mc_gross'];
      
        $result              = $this->Common_model->getTableData( 'reservation',array('id' => $list_id) )->row();
        $checkin             = $result->checkin;
        $checkout            = $result->checkout;
      
        $admin_email         = $this->dx_auth->get_site_sadmin();
        $admin_name          = $this->dx_auth->get_site_title();
      
        $query               = $this->Users_model->get_user_by_id($result->userto);
     $hotelier_name       = $query->row()->username;
        $hotelier_email      = $query->row()->email;
      
        $list['payed_date']  = date('d-m-Y H:i:s');
        $list['is_payed']    = 1;
      
         //Notification
            $email_name = 'admin_payment';
            $splVars = array("{site_name}" => $this->dx_auth->get_site_title(), "{username}" => ucfirst($hotelier_name), "{list_title}" => get_list_by_id($list_id)->title, "{payed_date}}" => $list['payed_date'], "{pay_id}" => $email_id, "{checkin}" => $checkin, "{checkout}" => $checkout, "{payed_price}" => $price);
            //Send Mail
            $this->Email_model->sendMail($hotelier_email,$admin_email,ucfirst($admin_name),$email_name,$splVars);
      
        $condition = array("id" => $reservation_id);
        $this->Common_model->updateTableData('reservation', NULL, $condition, $list);
        }
    }
My first thought was that the $list array is being passed from the controller to the model and the model is looking for the $updateData array so I changed the controller to

Code:
$updateData    =    $list;

but that did nothing.

==============================================
Model common_model
--------------------------------------------------------------------------------------------
Code:
function updateTableData($table='',$id=0, $conditions=array(), $updateData=array())
     {
         if(is_array($conditions) and count($conditions)>0)      
             $this->db->where($conditions);
        else  
            $this->db->where('id', $id);
         $this->db->update($table, $updateData);
        
     }//End of updateTableData Function

I'm banging my head against my desk trying to get this to work. Thanks for looking.

-John


Messages In This Thread
PayPal IPN Response and Table Updates - by El Forum - 04-07-2013, 03:26 PM
PayPal IPN Response and Table Updates - by El Forum - 04-08-2013, 02:19 AM
PayPal IPN Response and Table Updates - by El Forum - 04-09-2013, 09:20 AM
PayPal IPN Response and Table Updates - by El Forum - 04-09-2013, 11:39 AM
PayPal IPN Response and Table Updates - by El Forum - 04-09-2013, 01:37 PM
PayPal IPN Response and Table Updates - by El Forum - 04-10-2013, 03:03 AM
PayPal IPN Response and Table Updates - by El Forum - 04-11-2013, 03:08 PM
PayPal IPN Response and Table Updates - by El Forum - 04-12-2013, 01:16 AM



Theme © iAndrew 2016 - Forum software by © MyBB