function login_post() { $userName = $this->post('email'); $userName = $this->post('password'); if (!filter_var($userName, FILTER_VALIDATE_EMAIL)) { //$this->response(array('error' => 'Please provide valid email.'), 400); return FALSE; $parram = array('error' => TRUE, 'message' => 'Invalid email address provided.'); success_response_after_post_get($parram); die; } if ($password == "") { $parram = array('error' => TRUE, 'message' => 'Please provide the password.'); success_response_after_post_get($parram); die; } $rs = $this->user->check_login_data($userName, $password, 'buyer'); if (count($rs) > 0) { $parram = array('uid' => $rs[0]->userId, 'error' => FALSE); $parram['user']['name'] = $rs[0]->firstName . ' ' . $rs[0]->lastName; $parram['user']['email'] = $rs[0]->email; $parram['user']['created_at'] = time(); $parram['user']['updaated_at'] = time(); success_response_after_post_get($parram); } }
function order_delivery_post() { $orderId = trim($this->post('orderId')); $userId = trim($this->post('userId')); $UDID = trim($this->post('UDID')); $deviceToken = trim($this->post('deviceToken')); $deviceType = "android"; $latitude = trim($this->post('latitude')); $longitude = trim($this->post('longitude')); $receiveStaffName = trim($this->input->post('receiveStaffName', TRUE)); $receiveStaffContactNo = trim($this->input->post('receiveStaffContactNo', TRUE)); $oldReceiveDateTime = trim($this->input->post('receiveDateTime', TRUE)); if ($receiveStaffName == "") { $this->response(array('error' => 'Please enter the receive staff name.'), 400); return FALSE; } if ($receiveStaffContactNo == "") { $this->response(array('error' => 'Please enter the receive staff contact number.'), 400); return FALSE; } $receiveDateTimeArr = explode(' ', $oldReceiveDateTime); $receiveDateArr = explode('-', $receiveDateTimeArr[0]); $receiveDateTime = $receiveDateArr[2] . '-' . $receiveDateArr[1] . '-' . $receiveDateArr[0] . ' ' . $receiveDateTimeArr[1] . ':00'; $defaultDataArr = array('UDID' => $UDID, 'deviceType' => $deviceType, 'deviceToken' => $deviceToken, 'latitude' => $latitude, 'longitude' => $longitude); $isValideDefaultData = $this->check_default_data($defaultDataArr); if ($isValideDefaultData['type'] == 'fail') { $this->response(array('error' => $isValideDefaultData['message']), 400); return FALSE; } $order = $this->order->get_single_order_by_id($orderId); if (empty($order)) { $this->response(array('error' => "Getting invalid order index"), 400); return FALSE; } if ($order->status != 5) { $this->response(array('error' => 'Selected order is yet not out for delivery or already delivered.'), 400); return FALSE; } /// need check payment has done or not. $logisticDetails = $this->user->get_logistics_details_by_user_id($userId); $logisticsId = $logisticDetails[0]['logisticsId']; $deliveryStaffName = $logisticDetails[0]['firstName'] . ' ' . $logisticDetails[0]['lastName']; $deliveryStaffContactNo = $logisticDetails[0]['contactNo']; $deliveryStaffEmail = $logisticDetails[0]['email']; $dataArr = array('orderId' => $orderId, 'logisticsId' => $logisticsId, 'deliveryStaffName' => $deliveryStaffName, 'deliveryStaffContactNo' => $deliveryStaffContactNo, 'IP' => $this->input->ip_address(), 'deliveryStaffEmail' => $deliveryStaffEmail, 'receiveStaffName' => $receiveStaffName, 'receiveStaffContactNo' => $receiveStaffContactNo, 'receiveDateTime' => $receiveDateTime); //$config['upload_path'] =$this->config->item('ResourcesPath').'order_delivery/original/'; $config['upload_path'] = MAIN_SERVER_RESOURCES_PATH . 'order_delivery/original/'; $config['allowed_types'] = 'jpg|png|jpeg'; $config['file_name'] = strtolower(my_seo_freindly_url($orderId)) . '-' . rand(1, 9) . '-' . time(); $config['max_size'] = '2047'; $config['max_width'] = '1550'; $config['max_height'] = '1550'; $upload_files = array(); $this->load->library('upload'); foreach ($_FILES as $fieldname => $fileObject) { //fieldname is the form field name //pre($fieldname); //pre($fileObject);die; $this->upload->initialize($config); if (!$this->upload->do_upload($fieldname)) { foreach ($upload_files as $k) { ///@unlink($this->config->item('ResourcesPath').'order_delivery/original/'.$k); @unlink(MAIN_SERVER_RESOURCES_PATH . 'order_delivery/original/' . $k); } $errors = $this->upload->display_errors(); //pre($errors);die; $this->response(array('error' => $errors), 400); return FALSE; } else { $data = $this->upload->data(); $this->order_delivery_image_resize($data['file_name']); $upload_files[] = $data['file_name']; } } if (empty($upload_files) || count($upload_files) < 2) { $this->response(array('error' => 'You must upload 2 photo for tidiit order delivery proof.'), 400); return FALSE; } $dataArr['photo1'] = $upload_files[0]; $dataArr['photo2'] = $upload_files[1]; //pre($dataArr);die; if (empty($oldDeliveryRequestDetails)) { $orderDeliveredRequestId = $this->Order_model->add_order_delivered_request($dataArr); } else { //pre($oldDeliveryRequestDetails);die; if ($oldDeliveryRequestDetails[0]['photo1'] != "") { if ($data['photo1'] != "") { $this->delete_delivery_image($oldDeliveryRequestDetails[0]['photo1']); } } if ($oldDeliveryRequestDetails[0]['photo2'] != "") { if ($data['photo2'] != "") { $this->delete_delivery_image($oldDeliveryRequestDetails[0]['photo2']); } } $this->Order_model->update_order_delivered_request($dataArr, $orderId); $orderDeliveredRequestId = $oldDeliveryRequestDetails[0]['orderDeliveredRequestId']; } if ($orderDeliveredRequestId) { $result = array(); $result['message'] = 'Delivery information updated successfully.'; success_response_after_post_get($result); } else { $this->response(array('error' => 'Unknown error arises, please try again'), 400); return FALSE; } }
function product_details_get() { $userId = $this->get('userId'); $this->config->load('product'); $latitude = $this->get('latitude'); $longitude = $this->get('longitude'); $deviceType = $this->get('deviceType'); $UDID = $this->get('UDID'); $deviceToken = $this->get('deviceToken'); $defaultDataArr = array('UDID' => $UDID, 'deviceType' => $deviceType, 'deviceToken' => $deviceToken, 'latitude' => $latitude, 'longitude' => $longitude); $isValideDefaultData = $this->check_default_data($defaultDataArr); if (strtoupper(get_counry_code_from_lat_long($latitude, $longitude)) != 'IN') { $this->response(array('error' => 'Invalid username or password,please try again.'), 400); return FALSE; } if ($isValideDefaultData['type'] == 'fail') { $this->response(array('error' => $isValideDefaultData['message']), 400); return FALSE; } $productId = $this->get('productId'); $productDetailsArr = $this->product->details($productId, TRUE); if (empty($productDetailsArr)) { $this->response(array('error' => 'Invalid product index. Please try again!'), 400); return FALSE; } //pre($productDetailsArr);die; if ($productDetailsArr[0]['status'] == 0) { $this->response(array('error' => 'This product is an inactive product. Please try again!'), 400); return FALSE; } $this->product->update_view($productId); $productImageArr = $this->product->get_products_images($productId, TRUE); $productPriceArr = $this->product->get_products_price($productId, TRUE); $result = array(); $result['is_loged_in'] = $userId; //$data['breadCrumbStr']=$this->breadCrumb($productDetailsArr[0]->categoryId, $productDetailsArr[0]->title); $result['productDetailsArr'] = $productDetailsArr; $result['productImageArr'] = $productImageArr; $result['productPriceArr'] = $productPriceArr; /*$mobileBoxContentsArr=$this->config->item('mobileBoxContents'); $mobileContentArr= explode(',', $productDetailsArr[0]['mobileBoxContent']); if(!empty($mobileContentArr)): $inBox=''; foreach($mobileContentArr AS $k){ if($inBox=='') $inBox=$mobileBoxContentsArr[$k]; else $inBox.= ', '.$mobileBoxContentsArr[$k]; } $result['mobileBoxContents']=$inBox; else: $result['mobileBoxContents']='No thing inside'; endif; $mobileColor=$this->config->item('mobileColor'); $mobileColorName='';if(array_key_exists($productDetailsArr[0]['color'], $mobileColor)){$mobileColorName=$mobileColor[$productDetailsArr[0]['color']];} $result['mobileColorName']=$mobileColorName; $mobileDisplayResolution=$this->config->item('mobileDisplayResolution'); $mobileDisplayResolutiontype='';if(array_key_exists($productDetailsArr[0]['displayResolution'], $mobileDisplayResolution)){$mobileDisplayResolutiontype=$mobileDisplayResolution[$productDetailsArr[0]['displayResolution']];} $result['mobileDisplayResolutionType']=$mobileDisplayResolutiontype; $mobileBatteryType=$this->config->item('mobileBatteryType'); $mobileBatteryName='';if(array_key_exists($productDetailsArr[0]['batteryType'], $mobileBatteryType)){$mobileBatteryName=$mobileBatteryType[$productDetailsArr[0]['batteryType']];} $result['mobileBatteryName']=$mobileBatteryName; $result['mobileOS']=$this->config->item('mobileOS')[$productDetailsArr[0]['os']]; $mobileConnectivity=$this->config->item('mobileConnectivity'); $connectivityArr= explode(',', $productDetailsArr[0]['mobileConnectivity']); $connectionStr=''; foreach($connectivityArr AS $k =>$v){ $connectionStr.=$mobileConnectivity[$v].', '; } $result['connectivityType']=$connectionStr; $mobileProcessorCores=$this->config->item('mobileProcessorCores'); $processorType="";if(array_key_exists($productDetailsArr[0]['processorCores'], $mobileProcessorCores)){$processorType=$mobileProcessorCores[$productDetailsArr[0]['processorCores']];} $result['processorType']=$processorType; $result['mobileProcessorBrand']=$this->config->item('mobileProcessorBrand')[$productDetailsArr[0]['processorBrand']]; $mobileCamera=$this->config->item('mobileCamera'); $rearCamera='';if(array_key_exists($productDetailsArr[0]['mobileRearCamera'], $mobileCamera)){$rearCamera=$mobileCamera[$productDetailsArr[0]['mobileRearCamera']];} $result['rearCamera']=$rearCamera; $frontCamera='';if(array_key_exists($productDetailsArr[0]['frontCamera'], $mobileCamera)){$frontCamera=$mobileCamera[$productDetailsArr[0]['frontCamera']];} $result['frontCamera']=$frontCamera; $ramData=$this->config->item('ramData'); $ram='';if(array_key_exists($productDetailsArr[0]['ram'], $ramData)){$ram=$ramData[$productDetailsArr[0]['ram']];} $result['ram']=$ram; $expandableMemory=$this->config->item('expandableMemory'); $expandableMemoryData='';if(array_key_exists($productDetailsArr[0]['expandableMemory'],$expandableMemory)){$expandableMemoryData=$expandableMemory[$productDetailsArr[0]['expandableMemory']];} $result['expandableMemoryData']=$expandableMemoryData; $warrantyDuration=$this->config->item('warrantyDuration'); $warrantyDurationData='';if(array_key_exists($productDetailsArr[0]['warrantyDuration'], $warrantyDuration)){$warrantyDurationData=$warrantyDuration[$productDetailsArr[0]['warrantyDuration']];} $result['warrantyDurationData']=$warrantyDurationData; $internalMemory=$this->config->item('internalMemory'); $internalMemoryData='';if(array_key_exists($productDetailsArr[0]['internalMemory'], $internalMemory)){$internalMemoryData=$internalMemory[$productDetailsArr[0]['internalMemory']];} $result['internalMemoryData']=$internalMemoryData;*/ $options = $this->option->get_product_display_option_values($productId); $optionsArr = array(); foreach ($options as $k => $option) { foreach ($option as $kk => $val) { //$temp= lcfirst(str_replace(" ","",ucwords(strtolower($kk)))); $optionsArr[$kk] = implode(',', $val); } } $topOptions = $this->option->get_product_display_top_option_values($productId); $topOptionsArr = array(); foreach ($topOptions as $k => $option) { foreach ($option as $kk => $val) { //$temp= lcfirst(str_replace(" ","",ucwords(strtolower($kk)))); $topOptionsArr[$kk] = implode(',', $val); } } $result['options'] = $optionsArr; $result['topOptions'] = $topOptionsArr; $result['tidiit_currency_simbol'] = get_currency_simble_from_lat_long($latitude, $longitude); //pre($result);die; success_response_after_post_get($result); }
function testing_push_notification_post() { $regId = $this->post('regId'); $message = $this->post('message'); $fields = array(); $regIdArr = array(); $regIdArr[] = $regId; $fields = array('registration_ids' => $regIdArr, 'data' => array('message' => $message)); $this->load->config('product'); //@mail('*****@*****.**','make ready for GoogleGSMKEY for message to GSM server ','make ready for GoogleGSMKEY for message to GSM server '); $GOOGLE_API_KEY = $this->config->item('GoogleGSMKEY'); @mail('*****@*****.**', 'GSM API Key is ' . $GOOGLE_API_KEY, 'GSM API Key is ' . $GOOGLE_API_KEY); $url = 'https://android.googleapis.com/gcm/send'; $headers = array('Authorization: key=' . $GOOGLE_API_KEY, 'Content-Type: application/json'); @mail('*****@*****.**', 'Opening conection for google GSM server ', 'Opening conection for google GSM server '); // Open connection $ch = curl_init(); @mail('*****@*****.**', 'reg ids are - ' . json_encode($fields), 'reg ids are - ' . json_encode($fields)); // Set the url, number of POST vars, POST data curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Disabling SSL Certificate support temporarly curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); // Execute post $result = curl_exec($ch); // Close connection curl_close($ch); $result = array(); if ($result === FALSE) { @mail('*****@*****.**', 'Google GSM server return fail', 'Google GSM server return fail'); //die('Curl failed: ' . curl_error($ch)); $result['message'] = curl_error($ch); } else { @mail('*****@*****.**', 'Google GSM server return success', 'Google GSM server return success'); $result['message'] = 'Google GSM server return success'; } success_response_after_post_get($result); }
function edit_group_post() { $groupId = $this->post('groupId'); $adminId = $this->post('userId'); $groupTitle = $this->post('groupTitle'); //$productType = $this->input->post('productType'); $groupUsersArr = $this->post('groupUsers'); $colors = array('red', 'maroon', 'purple', 'green', 'blue'); $rand_keys = array_rand($colors, 1); $groupColor = $colors[$rand_keys]; if (!$groupUsersArr) { $this->response(array('error' => 'Please select the at least one Buying Club member!'), 400); return FALSE; } $groupUsers = implode(",", $groupUsersArr); $bfrUpdateGroup = $this->user->get_group_by_id($groupId); $bfrUsers = explode(",", $bfrUpdateGroup->groupUsers); $olduser = array(); $deluser = array(); $newUser = array(); foreach ($groupUsersArr as $guser) { if (in_array($guser, $bfrUsers)) { $olduser[] = $guser; } else { $newUser[] = $guser; } } foreach ($bfrUsers as $bfruser) { if (!in_array($bfruser, $groupUsersArr)) { $deluser[] = $bfruser; } } $groupIdUpdate = $this->user->group_update(array('groupTitle' => $groupTitle, 'groupUsers' => $groupUsers, 'groupColor' => $groupColor), $groupId); if ($groupIdUpdate) { $adminDataArr = $this->user->get_details_by_id($adminId); foreach ($olduser as $ouser) { $receiverDetails = $this->user->get_details_by_id($ouser); $notify['senderId'] = $adminId; $notify['receiverId'] = $ouser; $notify['nType'] = "BUYING-CLUB-MODIFY"; $notify['receiverMobileNumber'] = $receiverDetails[0]->mobile; $notify['senderMobileNumber'] = $adminDataArr[0]->mobile; $notify['adminName'] = $adminDataArr[0]->firstName . ' ' . $adminDataArr[0]->lastName; $notify['adminEmail'] = $adminDataArr[0]->email; $notify['adminContactNo'] = $adminDataArr[0]->contactNo; $notify['nTitle'] = $groupTitle; $this->send_notification($notify); } foreach ($newUser as $nuser) { $receiverDetails = $this->user->get_details_by_id($nuser); $notify['senderId'] = $adminId; $notify['receiverId'] = $nuser; $notify['receiverMobileNumber'] = $receiverDetails[0]->mobile; $notify['senderMobileNumber'] = $adminDataArr[0]->mobile; $notify['nType'] = "BUYING-CLUB-MODIFY-NEW"; $notify['nTitle'] = $groupTitle; $notify['adminName'] = $adminDataArr[0]->firstName . ' ' . $adminDataArr[0]->lastName; $notify['adminEmail'] = $adminDataArr[0]->email; $notify['adminContactNo'] = $adminDataArr[0]->contactNo; $this->send_notification($notify); } foreach ($deluser as $duser) { $receiverDetails = $this->user->get_details_by_id($duser); $notify['senderId'] = $adminId; $notify['receiverId'] = $duser; $notify['nType'] = "BUYING-CLUB-MODIFY-DELETE"; $notify['receiverMobileNumber'] = $receiverDetails[0]->mobile; $notify['senderMobileNumber'] = $adminDataArr[0]->mobile; $notify['nTitle'] = $groupTitle; $notify['adminName'] = $adminDataArr[0]->firstName . ' ' . $adminDataArr[0]->lastName; $notify['adminEmail'] = $adminDataArr[0]->email; $notify['adminContactNo'] = $adminDataArr[0]->contactNo; $this->send_notification($notify); } $reorder = $this->post('reorder'); if ($reorder) { $this->load->model('Order_model', 'order'); $orderId = $this->post('orderId'); $order = $this->order->get_single_order_by_id($orderId); $pro = $this->product->details($order->productId); $orderinfo['pdetail'] = $pro[0]; $group = $this->user->get_group_by_id($groupId); $mail_template_data = array(); foreach ($group->users as $key => $usr) { $mail_template_data = array(); $data['senderId'] = $adminId; $data['receiverId'] = $usr->userId; $data['nType'] = 'BUYING-CLUB-ORDER'; $data['nTitle'] = 'Buying Club Re-order [TIDIIT-OD' . $order->orderId . '] running by <b>' . $group->admin->firstName . ' ' . $group->admin->lastName . '</b>'; $mail_template_data['TEMPLATE_GROUP_RE_ORDER_START_ORDER_ID'] = $order->orderId; $mail_template_data['TEMPLATE_GROUP_RE_ORDER_START_ADMIN_NAME'] = $group->admin->firstName . ' ' . $group->admin->lastName; $data['nMessage'] = "Hi, <br> You have requested to buy Buying Club order product.<br>"; $data['nMessage'] .= "Product is <a href=''>" . $orderinfo['pdetail']->title . "</a><br>"; $mail_template_data['TEMPLATE_GROUP_RE_ORDER_START_PRODUCT_TITLE'] = $orderinfo['pdetail']->title; $data['nMessage'] .= "Want to process the order ? <br>"; $data['nMessage'] .= "<a href='" . BASE_URL . "shopping/group-order-decline/" . base64_encode($orderId * 226201) . "' class='btn btn-danger btn-lg'>Decline</a> or <a href='" . BASE_URL . "shopping/group-re-order-accept-process/" . base64_encode($orderId * 226201) . "/" . base64_encode(100) . "' class='btn btn-success btn-lg'>Accept</a><br>"; $mail_template_data['TEMPLATE_GROUP_RE_ORDER_START_ORDER_ID1'] = $orderId; $data['nMessage'] .= "Thanks <br> Tidiit Team."; $data['isRead'] = 0; $data['status'] = 1; $data['createDate'] = date('Y-m-d H:i:s'); $data['adminName'] = $adminDataArr[0]->firstName . ' ' . $adminDataArr[0]->lastName; $data['adminEmail'] = $adminDataArr[0]->email; $data['adminContactNo'] = $adminDataArr[0]->contactNo; //Send Email message $recv_email = $usr->email; $sender_email = $group->admin->email; /// firing mail $mail_template_view_data = load_default_resources(); $mail_template_view_data['group_order_re_start'] = $mail_template_data; global_tidiit_mail($recv_email, "Buying Club Order Re-Invitation at Tidiit Inc Ltd", $mail_template_view_data, 'group_order_re_start'); $this->user->notification_add($data); } } success_response_after_post_get(array('message' => 'Selected group data updated successfully.')); } else { $this->response(array('error' => 'Some error happen. Please try again!'), 400); return FALSE; } }
function product_details_get() { $userId = $this->get('userId'); $this->config->load('product'); $productId = $this->get('productId'); $productDetailsArr = $this->product->details($productId, TRUE); //pre($productDetailsArr);die; if ($productDetailsArr[0]['status'] == 0) { $this->response(array('error' => 'Invalid product index. Please try again!'), 400); return FALSE; } $this->product->update_view($productId); $productImageArr = $this->product->get_products_images($productId, TRUE); $productPriceArr = $this->product->get_products_price($productId, TRUE); $result = array(); $result['is_loged_in'] = $userId; //$data['breadCrumbStr']=$this->breadCrumb($productDetailsArr[0]->categoryId, $productDetailsArr[0]->title); $result['productDetailsArr'] = $productDetailsArr; $result['productImageArr'] = $productImageArr; $result['productPriceArr'] = $productPriceArr; $mobileBoxContentsArr = $this->config->item('mobileBoxContents'); $mobileContentArr = explode(',', $productDetailsArr[0]['mobileBoxContent']); if (!empty($mobileContentArr)) { $inBox = ''; foreach ($mobileContentArr as $k) { if ($inBox == '') { $inBox = $mobileBoxContents[$k]; } else { $inBox .= ', ' . $mobileBoxContents[$k]; } } $result['mobileBoxContents'] = $inBox; } else { $result['mobileBoxContents'] = 'No thing inside'; } $mobileColor = $this->config->item('mobileColor'); $mobileColorName = ''; if (array_key_exists($productDetailsArr[0]['color'], $mobileColor)) { $mobileColorName = $mobileColor[$productDetailsArr[0]['color']]; } $result['mobileColorName'] = $mobileColorName; $mobileDisplayResolution = $this->config->item('mobileDisplayResolution'); $mobileDisplayResolutiontype = ''; if (array_key_exists($productDetailsArr[0]['displayResolution'], $mobileDisplayResolution)) { $mobileDisplayResolutiontype = $mobileDisplayResolution[$productDetailsArr[0]['displayResolution']]; } $result['mobileDisplayResolutionType'] = $mobileDisplayResolutiontype; $mobileBatteryType = $this->config->item('mobileBatteryType'); $mobileBatteryName = ''; if (array_key_exists($productDetailsArr[0]['batteryType'], $mobileBatteryType)) { $mobileBatteryName = $mobileBatteryType[$productDetailsArr[0]['batteryType']]; } $result['mobileBatteryName'] = $mobileBatteryName; $result['mobileOS'] = $this->config->item('mobileOS')[$productDetailsArr[0]['os']]; $mobileConnectivity = $this->config->item('mobileConnectivity'); $connectivityArr = explode(',', $productDetailsArr[0]['mobileConnectivity']); $connectionStr = ''; foreach ($connectivityArr as $k => $v) { $connectionStr .= $mobileConnectivity[$v] . ', '; } $result['connectivityType'] = $connectionStr; $mobileProcessorCores = $this->config->item('mobileProcessorCores'); $processorType = ""; if (array_key_exists($productDetailsArr[0]['processorCores'], $mobileProcessorCores)) { $processorType = $mobileProcessorCores[$productDetailsArr[0]['processorCores']]; } $result['processorType'] = $processorType; $result['mobileProcessorBrand'] = $this->config->item('mobileProcessorBrand')[$productDetailsArr[0]['processorBrand']]; $mobileCamera = $this->config->item('mobileCamera'); $rearCamera = ''; if (array_key_exists($productDetailsArr[0]['mobileRearCamera'], $mobileCamera)) { $rearCamera = $mobileCamera[$productDetailsArr[0]['mobileRearCamera']]; } $result['rearCamera'] = $rearCamera; $frontCamera = ''; if (array_key_exists($productDetailsArr[0]['frontCamera'], $mobileCamera)) { $frontCamera = $mobileCamera[$productDetailsArr[0]['frontCamera']]; } $result['frontCamera'] = $frontCamera; $ramData = $this->config->item('ramData'); $ram = ''; if (array_key_exists($productDetailsArr[0]['ram'], $ramData)) { $ram = $ramData[$productDetailsArr[0]['ram']]; } $result['ram'] = $ram; $expandableMemory = $this->config->item('expandableMemory'); $expandableMemoryData = ''; if (array_key_exists($productDetailsArr[0]['expandableMemory'], $expandableMemory)) { $expandableMemoryData = $expandableMemory[$productDetailsArr[0]['expandableMemory']]; } $result['expandableMemoryData'] = $expandableMemoryData; $warrantyDuration = $this->config->item('warrantyDuration'); $warrantyDurationData = ''; if (array_key_exists($productDetailsArr[0]['warrantyDuration'], $warrantyDuration)) { $warrantyDurationData = $warrantyDuration[$productDetailsArr[0]['warrantyDuration']]; } $result['warrantyDurationData'] = $warrantyDurationData; $internalMemory = $this->config->item('internalMemory'); $internalMemoryData = ''; if (array_key_exists($productDetailsArr[0]['internalMemory'], $internalMemory)) { $internalMemoryData = $internalMemory[$productDetailsArr[0]['internalMemory']]; } $result['internalMemoryData'] = $internalMemoryData; success_response_after_post_get($result); }
function show_all_brands_post() { $userId = $this->post('userId'); $UDID = $this->post('UDID'); $deviceType = $this->post('deviceType'); $deviceToken = $this->post('deviceToken'); $latitude = $this->post('latitude'); $longitude = $this->post('longitude'); $defaultDataArr = array('UDID' => $UDID, 'deviceType' => $deviceType, 'deviceToken' => $deviceToken, 'latitude' => $latitude, 'longitude' => $longitude); $isValideDefaultData = $this->check_default_data($defaultDataArr); if (strtoupper(get_counry_code_from_lat_long($latitude, $longitude)) != 'IN') { $this->response(array('error' => 'Invalid username or password,please try again.'), 400); return FALSE; } if ($isValideDefaultData['type'] == 'fail') { $this->response(array('error' => $isValideDefaultData['message']), 400); return FALSE; } $brands = $this->brand->get_all(); $data['brands'] = $brands; success_response_after_post_get($data); }
function process_razorpay_success_single_order_final($orderIdArr, $razorpayPaymentId, $logisticsData) { $orderId = 0; $tidiitStrChr = 'TIDIIT-OD'; $tidiitStr = ''; //Send Email message //send_sms_notification(array('receiverMobileNumber'=>'9556644964', 'nMessage'=>'select rajorpaypayment data from db')); $rajorpayDataArr = $this->order->get_rajorpay_id_by_rajorpay_pament_id($razorpayPaymentId); //send_sms_notification(array('receiverMobileNumber'=>'9556644964', 'nMessage'=>'foreach with order id arr')); foreach ($orderIdArr as $k => $v) { $orderId = $v; $tidiitStr = $tidiitStrChr . '-' . $v . ','; $order_update = array(); $order_update['isPaid'] = 1; //send_sms_notification(array('receiverMobileNumber'=>'9556644964', 'nMessage'=>'going to update order with id : '.$v)); $this->order->update($order_update, $v); //send_sms_notification(array('receiverMobileNumber'=>'9556644964', 'nMessage'=>'complete order update for order id :'.$v)); $order = $this->order->get_single_order_by_id($v); $orderinfo = unserialize(base64_decode($order->orderInfo)); $rsUser = $this->user->get_details_by_id($order->userId); $user = $rsUser[0]; $recv_email = $user->email; $recv_name = $user->firstName . ' ' . $user->lastName; $mail_template_data['TEMPLATE_ORDER_SUCCESS_ORDER_INFO'] = $orderinfo; $mail_template_data['TEMPLATE_ORDER_SUCCESS_ORDER_ID'] = $v; //send_sms_notification(array('receiverMobileNumber'=>'9556644964', 'nMessage'=>'getting razorpay payment id details')); $rajorpayDataArr = $this->order->get_rajorpay_id_by_rajorpay_pament_id($razorpayPaymentId); //send_sms_notification(array('receiverMobileNumber'=>'9556644964', 'nMessage'=>'going to update payment type for order id : '.$v)); $this->order->edit_payment(array('paymentType' => 'razorpay', 'razorpayId' => $rajorpayDataArr[0]->razorpayId), $v); //send_sms_notification(array('receiverMobileNumber'=>'9556644964', 'nMessage'=>'Payment type updated success.')); $mail_template_view_data = $this->load_default_resources(); $mail_template_view_data['single_order_success'] = $mail_template_data; //send_sms_notification(array('receiverMobileNumber'=>'9556644964', 'nMessage'=>'going to send mail to suer about payment')); global_tidiit_mail($recv_email, "Payment has completed for your Tidiit order TIDIIT-OD-" . $v, $mail_template_view_data, 'single_order_success_sod_final_payment', $recv_name); //send_sms_notification(array('receiverMobileNumber'=>'9556644964', 'nMessage'=>'going for _sent_single_order_complete_mail_sod_final_payment fun.')); $this->_sent_single_order_complete_mail_sod_final_payment($v); } //send_sms_notification(array('receiverMobileNumber'=>'9556644964', 'nMessage'=>'checking for logistic partner data')); /// here to preocess SMS to logistics partner if (!empty($logisticsData) && array_key_exists('deliveryStaffContactNo', $logisticsData)) { //send_sms_notification(array('receiverMobileNumber'=>'9556644964', 'nMessage'=>'cehcking delivery staff contact number')); $logisticMobileNo = $logisticsData['deliveryStaffContactNo']; if ($logisticMobileNo != "") { //send_sms_notification(array('receiverMobileNumber'=>'9556644964', 'nMessage'=>'going to send SMS to delivery staff for delivery')); $sms = $recv_name . ' has completed the payment for Tidiit order ' . $tidiitStr . ' please process the delivery.'; /// sendin SMS to allmember $sms_data = array('nMessage' => $sms, 'receiverMobileNumber' => $logisticMobileNo, 'senderId' => '', 'receiverId' => '', 'senderMobileNumber' => '', 'nType' => 'SINGLE-ORDER-FINAL-PAYMENT-BEFORE-DELIVERY-LOGISTICS'); send_sms_notification($sms_data); } else { //send_sms_notification(array('receiverMobileNumber'=>'9556644964', 'nMessage'=>'no deliery staff contact number found')); } } else { //send_sms_notification(array('receiverMobileNumber'=>'9556644964', 'nMessage'=>'not logistic partner data found')); } /// SMS to payer $sms = 'Thanks for the payment.We have received for Tidiit order ' . $tidiitStr . '.'; $sms_data = array('nMessage' => $sms, 'receiverMobileNumber' => $user->mobile, 'senderId' => '', 'receiverId' => $user->userId, 'senderMobileNumber' => '', 'nType' => 'SINGLE-ORDER-FINAL-PAYMENT-BEFORE-DELIVERY-PAYER'); send_sms_notification($sms_data); /// here send mail to logistic partner $mailBody = "Hi " . $logisticsData['deliveryStaffName'] . ",<br /> <b>{$recv_name}</b> has completed Tidiit payment for Order <b>" . $tidiitStr . '</b><br /><br /> Pleasee process the delivery for the above order.<br /><br />Thanks<br>Tidiit Team.'; global_tidiit_mail($logisticsData['deliveryStaffEmail'], 'Tidiit payment submited for Order ' . $tidiitStr, $mailBody, '', $recv_name); $result = array(); $result['message'] = 'Thanks for the payment before order is Out for delivery'; success_response_after_post_get($result); }
function update_order_buying_club_id_post() { $userId = $this->post('userId'); $orderId = $this->post('orderId'); $latitude = $this->post('latitude'); $longitude = $this->post('longitude'); $deviceType = $this->post('deviceType'); $UDID = $this->post('UDID'); $deviceToken = $this->post('deviceToken'); if ($userId == "" || $orderId == "" || $latitude == "" || $longitude == "" || ($deviceToken = "" || $UDID == "" || $deviceType == "")) { $this->response(array('error' => 'Please provide valid user index,order index,latitude,longitude,device type,devce token,UDID!'), 400); return FALSE; } //$rs=$this->get_user_details_from_model($userId); //pre($rs);die; $user = $this->user->app_get_details_by_id($userId); //pre($user);die; if (empty($user)) { $this->response(array('error' => 'Please provide valid user index!'), 400); return FALSE; } if ($this->order->is_valid_order_by_order_id_user_id($orderId, $userId) == FALSE) { $this->response(array('error' => 'Please provide valid user index and related order index!'), 400); return FALSE; } $groupId = $this->post('groupId'); $group = $this->user->get_group_by_id($groupId, TRUE); if (empty($group)) { $this->response(array('error' => 'Please provide valid group index!'), 400); return FALSE; } if (!$this->user->is_valid_admin_for_group($groupId, $userId)) { $this->response(array('error' => 'Invallid group index as you are not leader of the group.'), 400); return FALSE; } $data['groupId'] = $groupId; $this->order->update($data, $orderId); $group = json_decode(json_encode($group), true); $data['group'] = $group; $data['order'] = $this->order->get_single_order_by_id($orderId); $productId = $data['order']->productId; $productPriceId = $data['order']->productPriceId; if (isset($productId) && !$productId && (isset($productPriceId) && !$productPriceId)) { $this->response(array('error' => 'Please provide the product index, product price index.'), 400); } $data['orderId'] = $data['order']->orderId; $product = $this->product->details($productId); $product = $product[0]; $prod_price_info = $this->product->get_products_price_details_by_id($productPriceId); $a = $this->_get_available_order_quantity($data['orderId']); $data['availQty'] = $prod_price_info->qty - $a[0]->productQty; $data['dftQty'] = $prod_price_info->qty - $a[0]->productQty; $data['totalQty'] = $prod_price_info->qty; $data['priceInfo'] = $prod_price_info; $data['message'] = "success"; success_response_after_post_get($data); }