public function productFilter(Request $request) { $selectedcolorName = $request->input('selectedcolors'); $selectedbrandName = $request->input('selectedbrand'); $selectedsizeName = $request->input('selectedsize'); $selectedmaterialName = $request->input('selectedmaterial'); $selectedpatternName = $request->input('selectedpattern'); // echo"<pre>";print_r($sortbyName);die("xdgv"); return view('Campaign.Views.product.products'); die("szaf"); $objCurl = CurlRequestHandler::getInstance(); // $subcategoryName = $request->input(''); $url = env("API_URL") . '/' . "product-filter"; $mytoken = env("API_TOKEN"); $user_id = ''; if (Session::has('fs_customer')) { $user_id = Session::get('fs_customer')['id']; } $data = array('mytoken' => $mytoken, 'id' => $user_id, 'color' => $selectedcolorName, 'brand' => $selectedbrandName, 'size' => $selectedsizeName, 'material' => $selectedmaterialName, 'pattern' => $selectedpatternName); // echo "<pre>";print_r($data);die('ere'); DB::setFetchMode(PDO::FETCH_ASSOC); $curlResponse = $objCurl->curlUsingPost($url, $data); echo "<pre>"; print_r((array) $curlResponse->data); die("xdg"); if ($curlResponse->code == 200) { return view('Campaign.Views.product.products', ['productfilter' => (array) $curlResponse->data]); } }
public function profileAjaxHandler(Request $request) { $method = $request->input('method'); $api_url = env('API_URL'); $API_TOKEN = env('API_TOKEN'); $objCurlHandler = CurlRequestHandler::getInstance(); $user_id = ''; if (isset(Session::get('fs_user')['id'])) { $user_id = Session::get('fs_user')['id']; } if ($method) { switch ($method) { case "changegeneralinfo": $firstname = $request->input('fname'); $lastname = $request->input('lname'); $contact = $request->input('contact'); $email = $request->input('email'); $uname = $request->input('uname'); $data = array('user_id' => $user_id, 'api_token' => $API_TOKEN, 'method' => 'changegeneralinfo', 'firstname' => $firstname, 'lastname' => $lastname, 'contact_no' => $contact, 'email' => $email, 'username' => $uname); $url = $api_url . '/profile-ajax-handler'; $curlResponse = $objCurlHandler->curlUsingPost($url, $data); // echo "<pre>"; print_r($curlResponse); die; echo json_encode($curlResponse); break; case "changeshippinginfo": $City = $request->input('City'); $State = $request->input('State'); $Zipcode = $request->input('Zipcode'); $Address1 = $request->input('Address1'); $Address2 = $request->input('Address2'); $data = array('user_id' => $user_id, 'api_token' => $API_TOKEN, 'method' => 'changeshippinginfo', 'city' => $City, 'state' => $State, 'zipcode' => $Zipcode, 'address_line_1' => $Address1, 'address_line_2' => $Address2); $url = $api_url . '/profile-ajax-handler'; $curlResponse = $objCurlHandler->curlUsingPost($url, $data); // echo "<pre>"; print_r($curlResponse); die; echo json_encode($curlResponse); break; case "changepassword": $Old_password = $request->input('oldpassword'); $New_password = $request->input('newpassword'); $Re_new_password = $request->input('renewpassword'); $data = array('user_id' => $user_id, 'api_token' => $API_TOKEN, 'method' => 'changepassword', 'oldPassword' => $Old_password, 'newPassword' => $New_password, 'reNewPassword' => $Re_new_password); $url = $api_url . '/profile-ajax-handler'; $curlResponse = $objCurlHandler->curlUsingPost($url, $data); // echo "<pre>"; print_r($curlResponse); die; echo json_encode($curlResponse); break; default: break; } } }
public function productAjaxHandler(Request $request) { $method = $request->input('method'); $api_url = env('API_URL'); $API_TOKEN = env('API_TOKEN'); $objCurlHandler = CurlRequestHandler::getInstance(); if ($method) { switch ($method) { case 'getProductFilterOption': break; default: break; } } }
/** * @param Request $request */ public function flashsaleAjaxHandler(Request $request) { $inputData = $request->input(); $method = $inputData['method']; // $objProductOption = ProductOption::getInstance(); switch ($method) { case 'getProductDetailsForPopUp': $productId = $request->input('prodId'); $objCurl = CurlRequestHandler::getInstance(); $url = env("API_URL") . '/' . "product-popup"; $mytoken = env("API_TOKEN"); $user_id = ''; if (Session::has('fs_customer')) { $user_id = Session::get('fs_customer')['id']; } $flashId = $request->input('flashId'); $data = array('api_token' => $mytoken, 'id' => $user_id, 'product_id' => $productId); $curlResponse = $objCurl->curlUsingPost($url, $data); // print_a($curlResponse); if ($curlResponse->code == 200) { echo json_encode($curlResponse->data); } break; case 'getOptionVariantDetails': $variantId = $request->input('variantId'); $priceModifier = $request->input('priceModifier'); $prodId = $request->input('prodId'); $selectedCombination = implode("_", $request->input('selectedCombination')); $objCurl = CurlRequestHandler::getInstance(); $url = env("API_URL") . '/' . "/flashsale-ajax-handler"; $mytoken = env("API_TOKEN"); $user_id = ''; if (Session::has('fs_customer')) { $user_id = Session::get('fs_customer')['id']; } $data = array('api_token' => $mytoken, 'id' => $user_id, 'variant_id' => $variantId, 'product_id' => $prodId, 'selectedCombination' => $selectedCombination, 'method' => 'optionVariantDetails'); $curlResponse = $objCurl->curlUsingPost($url, $data); // $variationInfo['variant'] = $colorData; if ($curlResponse->code == 200) { echo json_encode($curlResponse->data); } break; default: break; } }
public function flashsaleDetails(Request $request) { $objCurl = CurlRequestHandler::getInstance(); $url = env("API_URL") . '/' . "flashsale-details"; $mytoken = env("API_TOKEN"); $user_id = ''; if (Session::has('fs_customer')) { $user_id = Session::get('fs_customer')['id']; } $data = array('mytoken' => $mytoken, 'id' => $user_id); // echo "<pre>";print_r($data);die('ere'); DB::setFetchMode(PDO::FETCH_ASSOC); $curlResponse = $objCurl->curlUsingPost($url, $data); // echo "<pre>";print_r((array)$curlResponse->data);die("xdg"); if ($curlResponse->code == 200) { return view('Campaign.Views.flashsale.flashsale-list', ['flashsaledetails' => (array) $curlResponse->data]); } }
public function shopDetails(Request $request) { $objCurl = CurlRequestHandler::getInstance(); $url = env("API_URL") . '/' . "shop-details"; $user_id = ''; if (Session::has('fs_customer')) { $user_id = Session::get('fs_customer')['id']; } $count = 10; $offset = $request->input('offset'); $mytoken = env("API_TOKEN"); $data = array('mytoken' => $mytoken, 'id' => $user_id, 'count' => $count, 'offset' => $offset); DB::setFetchMode(PDO::FETCH_ASSOC); $curlResponse = $objCurl->curlUsingPost($url, $data); // echo "<pre>";print_r((array)$curlResponse->data);die("xdg"); if ($curlResponse->code == 200) { return view('Campaign.Views.shops.shop-details', ['shopdetails' => (array) $curlResponse->data]); } }
public function orderHistory(Request $request) { $url = $this->API_URL . '/supplier/getOrderHistory'; $data['api_token'] = $this->API_TOKEN; $data['user_id'] = Session::get('ig_supplier')['id']; $objCurlHandler = CurlRequestHandler::getInstance(); $curlResponse = $objCurlHandler->curlUsingPost($url, $data); if ($curlResponse->code == 200) { return view('Supplier::order.orderHistory')->with(['orders' => $curlResponse->data]); } else { return view('Supplier::order.orderHistory'); } }
public function TwoCOpayment(Request $request) { if ($request->isMethod('post')) { $url = $this->apiurl . '/user/add-balance-2co'; // print_r($url); $data['api_token'] = $this->API_TOKEN; $this->validate($request, ['money' => 'required|regex:/^[0-9]+([.][0-9]{0,2}+)?$/', 'name' => 'required', 'addrLine1' => 'required', 'city' => 'required', 'state' => 'required', 'zipCode' => 'required', 'country' => 'required', 'email' => 'required', 'phoneNumber' => 'required'], ['money.required' => 'Please Enter Amount that you want to add to your wallet', 'money.regex' => 'Please Enter a valid Amount i.e. number or decimal value ', 'name.required' => 'please enter your name', 'addrLine1.required' => 'please enter address', 'city.required' => 'please enter city', 'state.required' => 'please enter state', 'zipCode.required' => 'please provide zip code', 'country.required' => 'please specify country name', 'email.required' => 'please enter your email', 'phoneNumber.required' => 'please enter your phone number']); $data['id'] = Session::get('ig_user')['id']; $data['token'] = $_POST['token']; $data['money'] = $request['money']; $data['name'] = $request['name']; $data['addrLine1'] = $request['addrLine1']; $data['city'] = $request['city']; $data['state'] = $request['state']; $data['zipCode'] = $request['zipCode']; $data['country'] = $request['country']; $data['email'] = $request['email']; $data['phoneNumber'] = $request['phoneNumber']; $objCurlHandler = CurlRequestHandler::getInstance(); $curlResponse = $objCurlHandler->curlUsingPost($url, $data); // print_r($curlResponse); //dd("asd"); if ($curlResponse->code == 200) { // $token = $curlResponse->data; // $token = json_decode($token); //// return $curlResponse->data; //// return redirect('https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_notify-validate'); // return redirect('https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=' . $token); $totalBalance = $curlResponse->data; Session::put("ig_user.account_bal", $totalBalance); Session::put('ig_user.notification', $curlResponse->message); Session::put('ig_user.count', 1); return redirect('/user/twoCO_payment')->with(['message' => 'Your Account is successfully credited with 2co payment method']); // return json_encode(array('status' => 1, 'successMessage' => $curlResponse->message)); } else { return json_encode(array('status' => 0, 'errorMessage' => $curlResponse->message)); } } return view('User::2CO.2checkout'); }
public function homeAjaxHandler(Request $request) { $method = $request->input('method'); $api_url = env('API_URL'); $API_TOKEN = env('API_TOKEN'); $objCurlHandler = CurlRequestHandler::getInstance(); if ($method) { switch ($method) { case "user_signup": $data['first_name'] = trim($request->input('fname')); $data['last_name'] = trim($request->input('lname')); $data['username'] = trim($request->input('uname')); $data['email'] = trim($request->input('email')); $data['api_token'] = $API_TOKEN; $url = $api_url . "/signup"; $curlResponse = $objCurlHandler->curlUsingPost($url, $data); // echo "<pre>";print_r($curlResponse);die; if ($curlResponse) { echo json_encode($curlResponse); die; } else { echo 0; die; } break; case "user_login": $data['username'] = trim($request->input('uname')); $data['password'] = trim($request->input('password')); $data['api_token'] = $API_TOKEN; $url = $api_url . "/login"; $curlResponse = $objCurlHandler->curlUsingPost($url, $data); // echo "<pre>";print_r($data);die(); if ($curlResponse->code == 200) { $sessionName = 'fs_user'; Session::put($sessionName, $curlResponse->data); // return redirect('/'); echo json_encode($curlResponse); // die(); } else { echo json_encode($curlResponse); die; } break; case "forgotpw": $fpwemail = trim($request->input('fpwemail')); $data['api_token'] = $API_TOKEN; $data['fpwemail'] = $fpwemail; $data['method'] = "EnterEmailId"; $url = $api_url . "/forgot-password"; $curlResponse = $objCurlHandler->curlUsingPost($url, $data); // echo '<pre>'; print_r($curlResponse);die; if ($curlResponse->code == 200) { echo json_encode($curlResponse); } else { echo json_encode($curlResponse); } break; case "verifyResetCode": $fpwemail = trim($request->input('fpwemail')); $resetcode = trim($request->input('resetcode')); $data['api_token'] = $API_TOKEN; $data['fpwemail'] = $fpwemail; $data['resetcode'] = $resetcode; $data['method'] = "verifyResetCode"; $url = $api_url . "/forgot-password"; $curlResponse = $objCurlHandler->curlUsingPost($url, $data); // echo '<pre>'; print_r($curlResponse); die; if ($curlResponse->code == 200) { echo json_encode($curlResponse); } else { echo json_encode($curlResponse); } break; case "resetPassword": $fpwemail = trim($request->input('fpwemail')); $resetcode = trim($request->input('reset_code')); $password = trim($request->input('password')); $re_password = trim($request->input('re_password')); $data['api_token'] = $API_TOKEN; $data['fpwemail'] = $fpwemail; $data['resetcode'] = $resetcode; $data['password'] = $password; $data['re_password'] = $re_password; $data['method'] = "resetPassword"; // echo '<pre>'; print_r($data); die; $url = $api_url . "/forgot-password"; $curlResponse = $objCurlHandler->curlUsingPost($url, $data); // echo '<pre>'; print_r($curlResponse); die; if ($curlResponse->code == 200) { echo json_encode($curlResponse); } else { echo json_encode($curlResponse); } break; default: break; } } else { echo 0; die; } }
public function pricingInformation() { $url = $this->API_URL . '/user/pricingInformation'; $data['api_token'] = $this->API_TOKEN; $objCurlHandler = CurlRequestHandler::getInstance(); $curlResponse = $objCurlHandler->curlUsingPost($url, $data); if ($curlResponse->code == 200) { return view('User::order.pricingInformation')->with(['plansList' => $curlResponse->data]); } else { return view('User::order.pricingInformation')->with(['errorMessage' => $curlResponse->message]); } }
public function changeAvatar(Request $request) { if (Input::hasFile('file')) { $validator = Validator::make($request->all(), ['file' => 'image']); if (!$validator->fails()) { $url = $this->apiurl . '/supplier/changeAvatar'; $data['user_id'] = Session::get('ig_supplier')['id']; $data['api_token'] = $this->API_TOKEN; $data['file'] = Input::file('file'); $objCurlHandler = CurlRequestHandler::getInstance(); $curlResponse = $objCurlHandler->curlUsingPost($url, $data); dd($curlResponse); } else { echo "eror"; echo json_encode(array('status' => 2, 'message' => $validator->messages()->all())); } } else { echo "false"; die; } }
public static function getCampaignsForMenu() { $api_url = env('API_URL'); $API_TOKEN = env('API_TOKEN'); $objCurlHandler = CurlRequestHandler::getInstance(); $url = env("API_URL") . '/' . "/flashsale-ajax-handler"; $mytoken = env("API_TOKEN"); $data = array('api_token' => $mytoken, 'method' => 'getCampaignsForMenu'); $curlResponse = $objCurlHandler->curlUsingPost($url, $data); // print_a($curlResponse->data); return $curlResponse->data; }