/** * Create User Account * * @return User|null the saved model or null if saving fails */ public function createUser() { if ($this->validate()) { $user = new User(); $user->username = $this->username; $user->email = $this->email; $user->status = $this->status; $user->setPassword($this->password); $user->generateAuthKey(); if ($user->save()) { $profile = new \common\models\UserProfile(); $profile->user_id = $user->id; return $profile->save() ? $user : null; } } return null; }
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"; } }