Only ingest online orders for accounts running a POS kitchen
Deploy Ladill POS / deploy (push) Successful in 38s
Deploy Ladill POS / deploy (push) Successful in 38s
Guard ingestExternalOrder: skip (200, no ticket created) when the owner has no restaurant-mode POS location, so pushing from Merchant is harmless for accounts that don't use the POS kitchen. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
9780591e74
commit
e9d483394c
@@ -39,6 +39,11 @@ class KitchenIngestController extends Controller
|
||||
return response()->json(['message' => $e->getMessage()], 422);
|
||||
}
|
||||
|
||||
// Owner doesn't run a POS kitchen — accept and ignore.
|
||||
if ($sale === null) {
|
||||
return response()->json(['skipped' => true], 200);
|
||||
}
|
||||
|
||||
return response()->json(['id' => $sale->id, 'reference' => $sale->reference], 201);
|
||||
}
|
||||
|
||||
|
||||
@@ -376,7 +376,7 @@ class PosSaleService
|
||||
*
|
||||
* @param array{owner: string, reference: string, customer_name?: ?string, items: list<array{name: string, quantity?: int, unit_price_minor?: int, notes?: ?string}>} $data
|
||||
*/
|
||||
public function ingestExternalOrder(array $data): PosSale
|
||||
public function ingestExternalOrder(array $data): ?PosSale
|
||||
{
|
||||
$owner = (string) $data['owner'];
|
||||
$reference = (string) $data['reference'];
|
||||
@@ -387,6 +387,11 @@ class PosSaleService
|
||||
}
|
||||
|
||||
$location = PosLocation::owned($owner)->first();
|
||||
|
||||
// Only surface online orders for accounts that actually run a POS kitchen.
|
||||
if (! $location || ! $location->isRestaurant()) {
|
||||
return null;
|
||||
}
|
||||
$currency = strtoupper((string) ($location?->currency ?? config('pos.default_currency', 'GHS')));
|
||||
|
||||
$lines = [];
|
||||
|
||||
Reference in New Issue
Block a user