application/modules/api_v1/controllers/User.php
//Rating and Review by buyer to seller
Rating and Review by buyer to seller
Rating and Review by buyer to seller
function rating_review_post(){
        $this->check_service_auth();
        $user_id = $this->authData->userID;
        $full_name = $this->authData->full_name;
        $this->form_validation->set_rules('rating', 'Rating','trim|required');
        $this->form_validation->set_rules('rating_for', 'Rating For','trim|required|numeric');
        $this->form_validation->set_rules('review', 'Review','trim');
        $this->form_validation->set_rules('order_id', 'Order ID','trim|required|numeric');
        $orderID = $this->input->post('order_id');
        if($this->form_validation->run() == FALSE){
            $this->error_response(strip_tags(validation_errors())); 
        } 
        $datainsert = array(
            'rating_by' => $user_id, 
            'rating_for' => $this->input->post('rating_for'),
            'rating' => $this->input->post('rating'),
            'review' => ($this->input->post('review')) ? $this->input->post('review') : NULL,
            'updated_at' => datetime(),
            'created_at' => datetime(),
        );
        $insertReview = $this->common_model->insertData(RATINGS, $datainsert);
        if(!$insertReview){
            $this->error_response(get_response_message(107)); 
        }
        $ratingInfo = $this->common_model->is_data_exists(RATINGS,array('ratingID'=>$insertReview));
        $userDeviceTokens = $this->payment_model->getAllDeviceToken(array('user_id'=>$this->input->post('rating_for'), 'device_type !='=> '3'));
        $this->reviewNotification($userDeviceTokens,$user_id,$full_name,$insertReview,$ratingInfo,$orderID);
        $insertOrderRating = array(
            'rating_by' => $user_id, 
            'rating_for' => $this->input->post('rating_for'),
            'order_id' => $this->input->post('order_id'),
            'rating' => $this->input->post('rating'),
            'review' => ($this->input->post('review')) ? $this->input->post('review') : NULL,
            'updated_at' => datetime(),
            'created_at' => datetime(),
        );
        $insertOrderRating = $this->common_model->insertData(ORDER_RATINGS, $insertOrderRating);
        $this->success_response(get_response_message(181));
    }
function rating_review_post ( ) { $ this -> check_service_auth ( ) ; $ user_id = $ this -> authData -> userID ; $ full_name = $ this -> authData -> full_name ; $ this -> form_validation -> set_rules ( 'rating' , 'Rating' , 'trim|required' ) ; $ this -> form_validation -> set_rules ( 'rating_for' , 'Rating For' , 'trim|required|numeric' ) ; $ this -> form_validation -> set_rules ( 'review' , 'Review' , 'trim' ) ; $ this -> form_validation -> set_rules ( 'order_id' , 'Order ID' , 'trim|required|numeric' ) ; $ orderID = $ this -> input -> post ( 'order_id' ) ; if ( $ this -> form_validation -> run ( ) == FALSE ) { $ this -> error_response ( strip_tags ( validation_errors ( ) ) ) ; } $ datainsert = array ( 'rating_by' => $ user_id , 'rating_for' => $ this -> input -> post ( 'rating_for' ) , 'rating' => $ this -> input -> post ( 'rating' ) , 'review' => ( $ this -> input -> post ( 'review' ) ) ? $ this -> input -> post ( 'review' ) : NULL , 'updated_at' => datetime ( ) , 'created_at' => datetime ( ) , ) ; $ insertReview = $ this -> common_model -> insertData ( RATINGS , $ datainsert ) ; if ( ! $ insertReview ) { $ this -> error_response ( get_response_message ( 107 ) ) ; } $ ratingInfo = $ this -> common_model -> is_data_exists ( RATINGS , array ( 'ratingID' => $ insertReview ) ) ; $ userDeviceTokens = $ this -> payment_model -> getAllDeviceToken ( array ( 'user_id' => $ this -> input -> post ( 'rating_for' ) , 'device_type !=' => '3' ) ) ; $ this -> reviewNotification ( $ userDeviceTokens , $ user_id , $ full_name , $ insertReview , $ ratingInfo , $ orderID ) ; $ insertOrderRating = array ( 'rating_by' => $ user_id , 'rating_for' => $ this -> input -> post ( 'rating_for' ) , 'order_id' => $ this -> input -> post ( 'order_id' ) , 'rating' => $ this -> input -> post ( 'rating' ) , 'review' => ( $ this -> input -> post ( 'review' ) ) ? $ this -> input -> post ( 'review' ) : NULL , 'updated_at' => datetime ( ) , 'created_at' => datetime ( ) , ) ; $ insertOrderRating = $ this -> common_model -> insertData ( ORDER_RATINGS , $ insertOrderRating ) ; $ this -> success_response ( get_response_message ( 181 ) ) ; }
Rating and Review by buyer to seller
Rating and Review by buyer to seller
//set response msg  for form validation //error reponse //error reponse //Manage notification code start //user information //manage notiifcation code end