Re: Calling a function inside app_controller

2009-09-18 Thread Bert Van den Brande
Debug your code to see what's happening ?


On Sat, Sep 19, 2009 at 4:05 AM, Dave Maharaj :: WidePixels.com <
d...@widepixels.com> wrote:

>  I am trying to call a simple function inside the app_controller but
> nothing is happening.
>
> function afterPaypalNotification($txnId) {
> if
> ($transaction['InstantPaymentNotification']['payment_status'] ==
> 'Completed') {
>  //get info from transaction
>  $user_id = $transaction['InstantPaymentNotification']['custom'];
>  $adding = $transaction['InstantPaymentNotification']['quantity'];
>
>  $credits = $this->User->getCredits($user_id);
>
>  $addCredits = $adding + $credits;
> $this->User->id = $user_id;
>  $this->User->saveField('credits', $addCredits);
>
>
>   } else {
>   //do something else Not Approved email
>   }
>   }
>
>
>
> public function getCredits($id)
>{
> $params = array(
> 'conditions' => array(
> 'User.id' => $id),
> 'fields' => array('User.id',
>'User.credits'),
> 'contain' => false);
>
> $q = $this->User->find('first', $params);
>   return $q['User']['credits'];
>
>}
>
> Where am I going wrong here?
>
> The IPN is being sent back when I test from PayPal sandbox, saved to mydb
> so there is a record. I am sending a real user id to test so it should be
> doing something.
>
> Dave
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Calling a function inside app_controller

2009-09-18 Thread Dave Maharaj :: WidePixels.com
I am trying to call a simple function inside the app_controller but nothing
is happening.
 
function afterPaypalNotification($txnId) {
if
($transaction['InstantPaymentNotification']['payment_status'] ==
'Completed') {
 //get info from transaction
 $user_id = $transaction['InstantPaymentNotification']['custom'];
 $adding = $transaction['InstantPaymentNotification']['quantity'];
  
 $credits = $this->User->getCredits($user_id);
 
 $addCredits = $adding + $credits;
$this->User->id = $user_id;
 $this->User->saveField('credits', $addCredits);
 
  
  } else {
  //do something else Not Approved email 
  }
  }
 
 
 
public function getCredits($id)
   {
$params = array(
'conditions' => array(
'User.id' => $id),
'fields' => array('User.id',
   'User.credits'),
'contain' => false);

$q = $this->User->find('first', $params);
  return $q['User']['credits'];
  
   }
 
Where am I going wrong here?
 
The IPN is being sent back when I test from PayPal sandbox, saved to mydb so
there is a record. I am sending a real user id to test so it should be doing
something.
 
Dave 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---