This commit is contained in:
paoloar77
2024-07-11 15:10:13 +02:00
parent b49048aba8
commit ca95344bcb
2 changed files with 188 additions and 9 deletions

View File

@@ -1723,15 +1723,14 @@ function getClienteByIdInternet($idInternet)
{
try {
echo 'IdInternet=' . $idInternet;
$clienteinGM = Clientegm::where('IdInternet', $idInternet)->first();
if ($clienteinGM)
echo 'clienteinGM=' . json_encode($clienteinGM);
else {
echo 'Cliente non trovato... clienteinGM=' . $clienteinGM;
}
$clienteinGM = DB::table('T_WOO_Clienti')->where('IdInternet', $idInternet)->first();
Log::debug('RAW QUERY Result:', ['clienteinGM' => $clienteinGM]);
if (!$clienteinGM)
$clienteinGM = Clientegm::where('IdInternet', $idInternet)->first();
} catch (\Exception $e) {
echo 'Errore getClienteByIdInternet: ' . $e->getMessage();
Log::error('Errore durante la query: ' . $e->getMessage());
// echo 'Errore getClienteByIdInternet: ' . $e->getMessage();
return null;
}
return $clienteinGM;

View File

@@ -2149,7 +2149,7 @@ Route::post('/pao1', function (Request $request) {
dd($request->all());
});
Route::post('/updatecreate', function (Request $request) {
function updateCreate($request) {
// WEBHOOK DA GESTPAY A WOOCOMMERCE
@@ -2158,6 +2158,9 @@ Route::post('/updatecreate', function (Request $request) {
Log::info('/updatecreate');
try {
set_time_limit(0);
ini_set("memory_limit", "512M");
$productLogger = new ProductLogger(null, 'neworders');
$productLogger->addLog('', 'updatecreate: check se ARRIVATO ORDINE ' . $request->payment_method . ' ' . $request->status);
@@ -2346,6 +2349,10 @@ Route::post('/updatecreate', function (Request $request) {
$productLogger->addLog('', 'Errore Nuovo Ordine: ' . $e->getMessage());
$productLogger->setLogandSendEmail('ERRORE Nuovo Ordine !');
}
}
Route::post('/updatecreate', function (Request $request) {
updateCreate($request);
});
@@ -5904,6 +5911,179 @@ Route::get('/testclientegm/{id}', function ($id) {
echo "<br>Cliente:" . json_encode($cliente);
});
Route::get('/test_updatecreate', function ($id) {
$request = json_encode('{
"id": 68121,
"parent_id": 0,
"status": "processing",
"currency": "EUR",
"version": "9.0.2",
"prices_include_tax": true,
"date_created": "2024-07-11T12:48:56",
"date_modified": "2024-07-11T12:49:00",
"discount_total": "0.00",
"discount_tax": "0.00",
"shipping_total": "0.00",
"shipping_tax": "0.00",
"cart_tax": "0.00",
"total": "9.98",
"total_tax": "0.00",
"customer_id": 81,
"order_key": "wc_order_Uyz0DGlMoozIp",
"billing": {
"first_name": "TEST PAOLO",
"last_name": "TEST PAOLO",
"company": null,
"address_1": "TEST DI PAOLO NON SPEDIRE",
"address_2": null,
"city": "ROMA",
"state": "RM",
"postcode": "47900",
"country": "IT",
"email": "surya@riso.app",
"phone": null
},
"shipping": {
"first_name": "TEST PAOLO",
"last_name": "TEST PAOLO",
"company": null,
"address_1": "TEST DI PAOLO NON SPEDIRE",
"address_2": null,
"city": "ROMA",
"state": "RM",
"postcode": "47900",
"country": "IT",
"phone": null
},
"payment_method": "test",
"payment_method_title": "Test Pagamento per PROVE",
"transaction_id": null,
"customer_ip_address": "172.71.99.230",
"customer_user_agent": "Mozilla\/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/126.0.0.0 Safari\/537.36",
"created_via": "checkout",
"customer_note": null,
"date_completed": null,
"date_paid": "2024-07-11T12:49:00",
"cart_hash": "df374a92c5ab9fc0895aea1509930d7f",
"number": "68121",
"meta_data": [
{
"id": 1382750,
"key": "is_vat_exempt",
"value": "no"
},
{
"id": 1382751,
"key": "yaydp_product_pricing_rules",
"value": []
},
{
"id": 1382752,
"key": "yaydp_cart_discount_rules",
"value": []
},
{
"id": 1382753,
"key": "yaydp_checkout_fee_rules",
"value": []
}
],
"line_items": [
{
"id": 202,
"name": "Cos\u00ec come sei! - Nuovo",
"product_id": 64524,
"variation_id": 64525,
"quantity": 1,
"tax_class": null,
"subtotal": "9.98",
"subtotal_tax": "0.00",
"total": "9.98",
"total_tax": "0.00",
"taxes": [],
"meta_data": [
{
"id": 1733,
"key": "pa_versione",
"value": "nuovo",
"display_key": "Versione",
"display_value": "Nuovo"
},
{
"id": 1740,
"key": "_reduced_stock",
"value": "1",
"display_key": "_reduced_stock",
"display_value": "1"
}
],
"sku": "21897",
"price": 9.975,
"image": {
"id": 65079,
"src": "https:\/\/i0.wp.com\/www.fioredellavita.it\/wp-content\/uploads\/2024\/04\/cosi-come-sei.jpg?fit=450%2C369&ssl=1"
},
"parent_name": "Cos\u00ec come sei!"
}
],
"tax_lines": [],
"shipping_lines": [
{
"id": 203,
"method_title": "Spedizione gratuita",
"method_id": "free_shipping",
"instance_id": "2",
"total": "0.00",
"total_tax": "0.00",
"taxes": [],
"meta_data": [
{
"id": 1739,
"key": "Prodotti",
"value": "Cos\u00ec come sei! - Nuovo &times; 1",
"display_key": "Prodotti",
"display_value": "Cos\u00ec come sei! - Nuovo &times; 1"
}
]
}
],
"fee_lines": [],
"coupon_lines": [],
"refunds": [],
"payment_url": "https:\/\/www.fioredellavita.it\/pagamento\/order-pay\/68121\/?pay_for_order=true&key=wc_order_Uyz0DGlMoozIp",
"is_editable": false,
"needs_payment": false,
"needs_processing": true,
"date_created_gmt": "2024-07-11T10:48:56",
"date_modified_gmt": "2024-07-11T10:49:00",
"date_completed_gmt": null,
"date_paid_gmt": "2024-07-11T10:49:00",
"currency_symbol": "\u20ac",
"_links": {
"self": [
{
"href": "https:\/\/www.fioredellavita.it\/wp-json\/wc\/v3\/orders\/68121"
}
],
"collection": [
{
"href": "https:\/\/www.fioredellavita.it\/wp-json\/wc\/v3\/orders"
}
],
"customer": [
{
"href": "https:\/\/www.fioredellavita.it\/wp-json\/wc\/v3\/customers\/81"
}
]
}
}');
echo 'REQUEST: ' . json_decode($request);
updateCreate($request);
});
Route::get('/test31', function () {
$ora_update = Carbon::now();
$settingora = Setting::where('key', 'update_products')->first();