Example #1
0
 /**
  * Finds the Sell model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Sell the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Sell::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Example #2
0
 public function actionDreturn()
 {
     //Yii::app()->request->enableCsrfValidation = false;
     $vector = "JbEFFDiOkRc=";
     $xmlGenerateKey = $_POST["XMLGENERATEKEY"];
     $filePubFI = Yii::getAlias('@app') . "/PUBLICA_FIRMA_INTERDIN.pem";
     $filePriKC = Yii::getAlias('@app') . "/PRIVADA_CIFRADA_ESTABLECIMIENTO.pem";
     $pluginr = new PlugInClientRecive();
     $pluginr->setIV($vector);
     $pluginr->setSignPublicKey("file://" . $filePubFI);
     $pluginr->setCipherPrivateKey("file://" . $filePriKC);
     $error = $pluginr->setXMLGENERATEKEY($xmlGenerateKey);
     $msg = "";
     if ($error != "") {
         $msg = "Error:" . $error;
         return;
     }
     $cadeEnc = $_POST["XMLRESPONSE"];
     $firmaCorrecta = $pluginr->XMLProcess($cadeEnc, $_POST["XMLDIGITALSIGN"]);
     if ($firmaCorrecta == 0) {
         //echo "<b>Los datos han sido alterados.</b><br>";
         return;
     } else {
         if ($firmaCorrecta != 1) {
             $msg = "<br><br>Error: {$firmaCorrecta}";
             return;
         } else {
             $msg = "<b>Los datos no han sido alterados.</b><br>";
         }
     }
     $transactionID = $pluginr->getTransacctionID();
     $tax1 = $pluginr->getTaxValue1() / 100;
     $tax2 = $pluginr->getTaxValue2() / 100;
     $tip = $pluginr->getTipValue();
     $value = $pluginr->getTransacctionValue() / 100;
     $status = $pluginr->getAuthorizationState();
     $auth = $pluginr->getAuthorizationCode();
     $referencia1 = $pluginr->getReferencia1();
     $sell = Sell::findOne($referencia1);
     $transactionid = $sell->transactionid;
     if ($status == "Y") {
         $xml = simplexml_load_file("https://www3.optar.ec/webmpi/qvpos?RucEstab=1790241483001&NoTransaccion={$transactionid}");
         if ($xml->TRANSACCION->RESULTADO == "OK") {
             Yii::$app->cart->removeAll();
         } else {
             $sell->status == "INCOMPLETE";
             $sell->save();
         }
     }
     return $this->render('response', ['transactionID' => $transactionID, 'tax1' => $tax1, 'tax2' => $tax2, 'tip' => $tip, 'value' => $value, 'status' => $status, 'auth' => $auth, 'xml' => $xml]);
 }
Example #3
0
 public function actionViewsell($id)
 {
     $model = Sell::findOne($id);
     $xml = $this->Consultsell($model->transactionid);
     return $this->render('sell', ['model' => $model, 'xml' => $xml]);
 }