Ejemplo n.º 1
0
 public function actionSummary()
 {
     $modelsave = new Transferorder();
     $reference = Yii::$app->request->get('reference');
     $xml = simplexml_load_file('https://test.millikart.az:7444/gateway/payment/status?mid=transfer365&reference=' . $reference);
     $a = 'payment-description';
     if ($xml->{$a} == 'transfer') {
         $model = Transferorder::find()->where(['reference' => $reference])->one();
         $address = !empty($model->address) ? '<h5 style="font-weight:bold;">Address: ' . $model->address . '</h5>' : null;
         $faddress = !empty($model->faddress) ? '<h5 style="font-weight:bold;">Address: ' . $model->faddress . '</h5>' : null;
         $aaddress = !empty($model->aaddress) ? '<h5 style="font-weight:bold;">Address: ' . $model->aaddress . '</h5>' : null;
         $aaddress1 = !empty($model->aaddress1) ? '<h5 style="font-weight:bold;">Address: ' . $model->aaddress1 . '</h5>' : null;
         $aaddress2 = !empty($model->aaddress2) ? '<h5 style="font-weight:bold;">Address: ' . $model->aaddress2 . '</h5>' : null;
         $unvanlar[] = $model->from . $faddress . '➟' . $model->to . $address;
         $unvanlar[] = !empty($model->anotherd) ? $model->to . '➟' . $model->anotherd . $aaddress : null;
         $unvanlar[] = !empty($model->anotherd1) ? $model->anotherd . '➟' . $model->anotherd1 . $aaddress1 : null;
         $unvanlar[] = !empty($model->anotherd2) ? $model->anotherd1 . '➟' . $model->anotherd2 . $aaddress2 : null;
     } else {
         if ($xml->{$a} == 'ch') {
             $model = Rentorder::find()->where(['reference' => $reference])->one();
         }
     }
     //model asaqi dusur xml datadan description yoxlanilir eger shoferdirse shofer model caqirilir yada eksine transfer.
     if ($model->status == null) {
         if ($xml->RC == 00 and $xml->code == 0) {
             $model->status = '000';
             //                    $model->rrn = $xml->rrn;
             $model->save(false);
             if ($xml->{$a} == 'transfer') {
                 require __DIR__ . '/../views/site/mail.php';
             } elseif ($xml->{$a} == 'ch') {
                 require __DIR__ . '/../views/site/mailc.php';
             }
             $email = \Yii::$app->mailer->compose()->setFrom('*****@*****.**')->setTo(['*****@*****.**', '*****@*****.**', '*****@*****.**'])->setSubject('Yeni Sifariş')->setHtmlBody($html)->send();
             $email = \Yii::$app->mailer->compose()->setFrom('*****@*****.**')->setTo([$model->email])->setSubject('Your Order')->setHtmlBody($html)->send();
             return $this->render('summary');
         } elseif ($xml->RC == 101) {
             $model->status = $xml['RC'];
             $model->save();
         } elseif ($xml->RC == 119) {
             $model->status = $xml['RC'];
             $model->save();
         } elseif ($xml->RC == 100) {
             $model->status = $xml['RC'];
             $model->save();
         }
     }
     //$model =  Transferorder::find()->where(['reference' => $reference])->one();
     //return $this->render('summary',['model' => $model,'xml' => $xml]);
 }
Ejemplo n.º 2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getRent()
 {
     return $this->hasOne(Rentorder::className(), ['id' => 'rentid']);
 }