function indexAction() { $session = new Zend_Session_Namespace('user'); //var_dump($session->user->lastFundTransaction); if ($session->user->lastFundTransaction != NULL) { //make sure the transaction matches a previously stored one $fund = Fund_Models_FundAccount::getUsersLastFundAccount('complete'); if ($fund != NULL && $session->user->lastFundTransaction->transactionID == $fund->transactionID) { //top up the users balance $session->user->balance += $fund->amount; $session->user->update(array()); $session->user->lastFundTransaction = NULL; } } }
function indexAction() { $session = new Zend_Session_Namespace('user'); $form = new Fund_Models_Forms_Fund(); $minimum = Site::getResource('fund_minimum'); $maximum = Site::getResource('fund_maximum'); if ($this->getRequest()->isPost() && $form->isValid($_POST)) { $fund = Fund_Models_FundAccount::getUsersLastFundAccount('pending'); if ($fund == NULL) { $args = array('ownerID' => $session->user->accountID, 'startDate' => date('Y-m-d'), 'status' => 'pending', 'amount' => $form->getValue('amount')); $fund = new Fund_Models_FundAccount($args); } $fund->amount = $form->getValue('amount'); $fund->save(); $session->user->lastFundTransaction = $fund; //display pay button $paymentGateway = Site::getInstance(Site::getResource('payment_gateway')); $paymentGateway->returnUrl = 'http://www.project.supersaid.net/fund/complete'; $paymentGateway->cancelUrl = 'http://www.project.supersaid.net/fund/cancel'; $this->view->form = $paymentGateway->getForm($fund); } else { $this->view->form = $form; } }