add cart test
This commit is contained in:
parent
4b007d112e
commit
2f42f6714a
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue