Split bills (restaurant tickets): - New pos_payments ledger; a tab is settled across one or more cash/Ladill Pay payments. The ticket shows total / paid / balance, an amount field with Full / ½ / ⅓ / ¼ helpers, and the payments taken. Partial payments keep the tab open; the sale finalises (and frees the table) only when the balance hits zero. Pay splits get their own checkout + callback (pos.payments.callback). Pipe online orders to the KDS: - POST /api/kitchen/orders — a first-party, service-keyed ingest (config pos.kitchen_api_keys, scoped by owner, idempotent by external_ref) that creates a paid, already-fired ticket (order_type=online, lines source=online). - The KDS feed is now payment-agnostic (any kitchen-active sale), so paid online orders sit on the board next to dine-in tabs and bump the same way; they're badged "online". Schema additive: pos_payments, pos_sales.external_ref. Suite green (14). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
6c42f18186
commit
9780591e74
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('pos_payments', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('pos_sale_id')->constrained('pos_sales')->cascadeOnDelete();
|
||||
$table->string('owner_ref')->index();
|
||||
$table->unsignedInteger('amount_minor');
|
||||
$table->string('method')->default('cash'); // cash | pay
|
||||
$table->string('status')->default('pending'); // pending | paid | failed
|
||||
$table->unsignedBigInteger('pay_order_id')->nullable();
|
||||
$table->string('payment_reference')->nullable()->index();
|
||||
$table->timestamp('paid_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('pos_payments');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('pos_sales', function (Blueprint $table) {
|
||||
// Source order id for ingested online orders (e.g. a Merchant order) — for idempotency.
|
||||
$table->string('external_ref')->nullable()->after('reference')->index();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('pos_sales', function (Blueprint $table) {
|
||||
$table->dropColumn('external_ref');
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user