Пример #1
0
 public function actionValidate_txn()
 {
     //  $propBooking=new PropBooking;
     $ipnObject = new \frontend\components\IpnListener();
     $ipnObject->use_sandbox = true;
     //$model = \common\models\User::findOne(['id'=>5]);
     //$model->save(FALSE);
     try {
         $ipnObject->requirePostMethod();
         $verified = $ipnObject->processIpn();
         //echo $verified;
     } catch (\Exception $e) {
         error_log($e->getMessage());
         exit(0);
     }
     if ($verified) {
         if (!empty($_REQUEST)) {
             //$txnId=$_REQUEST['txn_id'];
             // $bookingCheck=  PropBooking::model()->find("pb_txnno='$txnId'");
             $model = new \common\models\User();
             $user = $model->saveUser($_REQUEST);
             $userAddressModel = new \common\models\UserAddress();
             $userAddressModel->user_id = $user->id;
             $userAddressModel->save();
             $userProfileModel = new \common\models\UserProfile();
             $userProfileModel->user_id = $user->id;
             $userProfileModel->save();
             $transactionModel = new \common\models\UserTransaction();
             $transactionDetails = $transactionModel->saveTransaction($user->id, $_REQUEST);
             $subscriptionModel = new \common\models\Subscription();
             $subscriptionDetails = $subscriptionModel->saveSubscription($user->id, $transactionDetails->id, $_REQUEST);
             $customData = explode('||', $_REQUEST['custom']);
             if (isset($customData[5]) && $customData[5] != '') {
                 $couponModel = new \common\models\CouponHistory();
                 $couponModel->saveHistory($user->id, $_REQUEST, $transactionDetails->txn_id);
             }
         }
         return $this->redirect(['index']);
         //$resultAmnt=$this->property_model->check_price($price, $id);
     } else {
         //$this->payment_cancelled();
         //echo "payment is not verified";
     }
 }