|
|
@@ -391,6 +391,19 @@ class CarrelloController extends Controller
|
|
391
|
391
|
return back()->with('error', 'Tag ID obbligatorio per il metodo di pagamento Segresta Wallet');
|
|
392
|
392
|
}
|
|
393
|
393
|
|
|
|
394
|
+ $presi = Ordine::where('id', $ordine->id)
|
|
|
395
|
+ ->where('stato', Ordine::CARRELLO)
|
|
|
396
|
+ ->update(['stato' => Ordine::IN_ATTESA_PAGAMENTO]);
|
|
|
397
|
+
|
|
|
398
|
+ if ($presi === 0) {
|
|
|
399
|
+ return redirect()
|
|
|
400
|
+ ->route('punto-vendita.show', ['punto_vendita_id' => $ordine->dispositivo_id])
|
|
|
401
|
+ ->with('error', 'Ordine già in pagamento. Non confermare di nuovo.');
|
|
|
402
|
+ }
|
|
|
403
|
+
|
|
|
404
|
+ $ordine->refresh();
|
|
|
405
|
+
|
|
|
406
|
+
|
|
394
|
407
|
$pagamento = Pagamento::create([
|
|
395
|
408
|
'attivita_id' => $attivitaId,
|
|
396
|
409
|
'dispositivo_id' => $dispositivoId,
|
|
|
@@ -401,7 +414,7 @@ class CarrelloController extends Controller
|
|
401
|
414
|
'causale' => $ordine->attivita->nome.' - Pagamento ordine #'.$ordine->id,
|
|
402
|
415
|
]);
|
|
403
|
416
|
$ordine->pagamento_id = $pagamento->id;
|
|
404
|
|
- $ordine->stato = Ordine::IN_ATTESA_PAGAMENTO;
|
|
|
417
|
+ // $ordine->stato = Ordine::IN_ATTESA_PAGAMENTO;
|
|
405
|
418
|
|
|
406
|
419
|
$ordine->info = array_merge(
|
|
407
|
420
|
is_array($ordine->info) ? $ordine->info : [],
|