diff --git a/plugins/romanah/bagisto/components/Session.php b/plugins/romanah/bagisto/components/Session.php index d147b4f..8fbe993 100644 --- a/plugins/romanah/bagisto/components/Session.php +++ b/plugins/romanah/bagisto/components/Session.php @@ -55,15 +55,33 @@ class Session extends ComponentBase $getToken = SessionP::get('nurgulToken'); $data = post(); - $response = Http::withHeaders([ - 'Authorization' => $getToken, - 'Content-Type' => 'application/json' - ])->post('https://nurgul.com.tm/app/api/customer/cart/add/'.$data["product_id"], [ + // $response = Http::withHeaders([ + // 'Authorization' => $getToken, + // 'Content-Type' => 'application/json' + // ])->post('https://nurgul.com.tm/app/api/customer/cart/add/'.$data["product_id"], [ + // 'product_id' => $data["product_id"], + // 'quantity' => $data["quantity"] + // ]); + + $data = [ 'product_id' => $data["product_id"], 'quantity' => $data["quantity"] - ]); + ]; - return $response; + + $response = Http::post('http://nurgul.com.tm/app/api/customer/cart/add/'.$data["product_id"], function ($http) use($getToken, $data) { + // $http->header('Content-Type', 'application/json'); + $http->header('Authorization', 'Bearer '.$getToken); + $http->header('Accept', 'application/json'); + + $data = json_encode($data); + + $http->setOption(CURLOPT_POSTFIELDS, $data); + }); + + $dataqq = json_decode($response); + + return $dataqq; } }