add cart test

This commit is contained in:
Kerim 2023-06-21 02:16:55 +05:00
parent 4b007d112e
commit 2f42f6714a
1 changed files with 24 additions and 6 deletions

View File

@ -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;
}
}