logga il dettagli dell'ordine
This commit is contained in:
@@ -1670,7 +1670,8 @@ Route::get('/autori_test', function () {
|
||||
}
|
||||
});
|
||||
|
||||
function getvalstr($mystr, $value, $separato = false) {
|
||||
function getvalstr($mystr, $value, $separato = false)
|
||||
{
|
||||
$my = '';
|
||||
if ($mystr) {
|
||||
$my = " " . $mystr . ": " . $value;
|
||||
@@ -1686,7 +1687,6 @@ function getvalstr($mystr, $value, $separato = false) {
|
||||
}
|
||||
|
||||
return $my;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -2140,6 +2140,9 @@ Route::post('/updatecreate', function (Request $request) {
|
||||
|
||||
//dd($webhook);
|
||||
|
||||
try {
|
||||
|
||||
Log::info('updatecreate: ARRIVATO ORDINE');
|
||||
|
||||
if (($request->status == 'on-hold' && $request->payment_method == 'bacs') || ($request->status == 'processing' && $request->payment_method == 'wc_gateway_gestpay') || ($request->status == 'processing' && $request->payment_method == 'paypal')) {
|
||||
$changedest = false;
|
||||
@@ -2147,6 +2150,7 @@ Route::post('/updatecreate', function (Request $request) {
|
||||
$changedest = true;
|
||||
}
|
||||
//$orderold =
|
||||
Log::info('Creazione Ordine... codice=' . $request->id);
|
||||
$order = new Order();
|
||||
$order->IdInternet = $request->id;
|
||||
$order->CodClienteInternet = $request->customer_id;
|
||||
@@ -2171,6 +2175,8 @@ Route::post('/updatecreate', function (Request $request) {
|
||||
$order->CodDestInternet = $request->customer_id;
|
||||
}
|
||||
$order->save();
|
||||
Log::info('Order:' . json_encode($order));
|
||||
|
||||
|
||||
$prodotti = $request->line_items;
|
||||
foreach ($prodotti as $prodotto) {
|
||||
@@ -2182,11 +2188,13 @@ Route::post('/updatecreate', function (Request $request) {
|
||||
$codifica = true;
|
||||
}
|
||||
if ($codifica) {
|
||||
|
||||
} else {
|
||||
$orderdetail->CodArticoloGM = intval($prodotto['sku']);
|
||||
Log::info('$orderdetail->CodArticoloGM' . $orderdetail->CodArticoloGM);
|
||||
}
|
||||
|
||||
Log::info('sku=', $sku);
|
||||
Log::info('Dettaglio Ordine:' . json_encode($orderdetail));
|
||||
|
||||
$orderdetail->Qta = $prodotto['quantity'];
|
||||
$orderdetail->PrezzoLordo = $prodotto['total'];
|
||||
@@ -2196,6 +2204,7 @@ Route::post('/updatecreate', function (Request $request) {
|
||||
}
|
||||
|
||||
$customer = Customer::find($request->customer_id);
|
||||
Log::info('crea Cliente: ' . $customer['last_name'] . " " . $customer['first_name']);
|
||||
$cliente = new Clientegm();
|
||||
$cliente->CodClienteInternet = $customer['id'];
|
||||
$cliente->Nominativo = $customer['last_name'] . " " . $customer['first_name'];
|
||||
@@ -2218,6 +2227,8 @@ Route::post('/updatecreate', function (Request $request) {
|
||||
$cliente->IdInternet = $request->id;
|
||||
$cliente->save();
|
||||
|
||||
Log::info('Cliente:' . json_encode($cliente));
|
||||
|
||||
if ($changedest) {
|
||||
$clientedest = new Clientegmdest();
|
||||
$clientedest->CodDestInternet = $request->customer_id;
|
||||
@@ -2230,18 +2241,14 @@ Route::post('/updatecreate', function (Request $request) {
|
||||
$cliente->IdNazione = 227;
|
||||
$clientedest->IdInternet = $request->id;
|
||||
$clientedest->save();
|
||||
Log::info('Cliente Dest:' . json_encode($clientedest));
|
||||
}
|
||||
Log::debug($request->all());
|
||||
Log::info('Inserito ordine');
|
||||
} //end if status
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} catch (Exception $e) {
|
||||
Log::error($e->getMessage());
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -6020,4 +6027,3 @@ Route::get('/handle-article-action-pao/{id}/{action}', function ($id, $action) {
|
||||
|
||||
|
||||
Route::get('/product/{sku}', [TestPaoController::class, 'getProductBySku']);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user