/**
  * @test
  */
 public function testPaymentDetails()
 {
     $paymentDetails = new PaymentDetails();
     $response = $paymentDetails->details();
     $this->assertEquals("Success", $response->responseEnvelope->ack);
     $this->assertNotNull($response->status);
 }
 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndex()
 {
     // renders the view file 'protected/views/site/index.php'
     // using the default layout 'protected/views/layouts/main.php'
     $model = new PaymentDetails();
     $modelPay = new PaymentInterswitch();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['PaymentDetails'])) {
         $model->attributes = $_POST['PaymentDetails'];
         if ($model->save()) {
             $modelPay->save();
         }
         $this->redirect(array('index'));
     }
     $this->render('index', array('model' => $model, 'modelPay' => $modelPay));
     //$this->render('index');
     //echo Yii::app()->session['transaction_id'];
 }
 public static function getTransaction($transaction_id)
 {
     $paymentDetails = PaymentDetails::model()->findByAttributes(array('transaction_id' => $transaction_id));
     return $paymentDetails;
 }
 /**
  * 
  * @param PaymentDetails $paymentDetails
  * @param int $orderId
  */
 private function storeIPNResponse($paymentDetails, $orderId)
 {
     $this->db->query("INSERT INTO " . DB_PREFIX . "payson_order SET \n\t  \t\t\t\t\t\torder_id                      = '" . $orderId . "', \n\t  \t\t\t\t\t\tvalid                         = '" . 1 . "', \n\t  \t\t\t\t\t\tadded \t\t\t\t\t\t  = NOW(), \n\t  \t\t\t\t\t\tupdated                       = NOW(), \n\t  \t\t\t\t\t\tipn_status                    = '" . $paymentDetails->getStatus() . "', \t\n\t  \t\t\t\t\t\tsender_email                  = '" . $paymentDetails->getSenderEmail() . "', \n\t  \t\t\t\t\t\tcurrency_code                 = '" . $paymentDetails->getCurrencyCode() . "',\n\t  \t\t\t\t\t\ttracking_id                   = '" . $paymentDetails->getTrackingId() . "',\n\t  \t\t\t\t\t\ttype                          = '" . $paymentDetails->getType() . "',\n\t  \t\t\t\t\t\tpurchase_id                   = '" . $paymentDetails->getPurchaseId() . "',\n\t  \t\t\t\t\t\tinvoice_status                = '" . $paymentDetails->getInvoiceStatus() . "',\n\t  \t\t\t\t\t\tcustomer                      = '" . $paymentDetails->getCustom() . "', \n\t  \t\t\t\t\t\tshippingAddress_name          = '" . $paymentDetails->getShippingAddressName() . "', \n\t  \t\t\t\t\t\tshippingAddress_street_ddress = '" . $paymentDetails->getShippingAddressStreetAddress() . "', \n\t  \t\t\t\t\t\tshippingAddress_postal_code   = '" . $paymentDetails->getShippingAddressPostalCode() . "', \n\t  \t\t\t\t\t\tshippingAddress_city \t\t  = '" . $paymentDetails->getShippingAddressPostalCode() . "', \n\t  \t\t\t\t\t\tshippingAddress_country       = '" . $paymentDetails->getShippingAddressCity() . "', \n\t  \t\t\t\t\t\ttoken                         =  '" . $paymentDetails->getToken() . "'");
 }
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return PaymentDetails the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = PaymentDetails::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }