Prune the upstream Mini/QR mobile subsystem from POS
Deploy Ladill POS / deploy (push) Successful in 33s

POS was forked from Ladill Mini and carried Mini's entire mobile/QR
subsystem (API, QR codes, wallet, payments, push, Afia) which polluted the
ladill_pos schema with 8 unused tables and left ~half the test suite red.

Remove the dead subsystem: Api/Mini/Qr/Public/Search/WellKnown controllers,
Mini/Qr/Afia/Notifications services, the 8 unused models, QrCodePolicy,
Support/Qr + Support/Events, the two mini: scheduled commands, the Mini/QR
view trees, and their (failing) tests. Empty routes/api.php (POS is web-only)
and strip dead schedules from routes/console.php.

Keep QrTeamMember — it is the platform team-membership model that POS's
SetActingAccount middleware and SSO login depend on for multi-account access.
Also keep notifications + personal_access_tokens (used by POS).

Drops 7 migrations (qr product/settings, mini_payments, push tokens); the 8
orphan tables are dropped from the live ladill_pos DB separately. Test suite
is green (8 passed) and all routes resolve.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
isaacclad
2026-06-24 00:08:16 +00:00
co-authored by Claude Opus 4.8
parent 57862acb47
commit 46b5091b1e
119 changed files with 3 additions and 15877 deletions
-54
View File
@@ -1,54 +0,0 @@
<?php
namespace Tests\Feature;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Str;
use Tests\TestCase;
class AfiaTest extends TestCase
{
use RefreshDatabase;
protected function setUp(): void
{
parent::setUp();
Http::preventStrayRequests();
}
private function user(): User
{
return User::create(['public_id' => (string) Str::uuid(), 'name' => 'A', 'email' => 'a+'.uniqid().'@x.com']);
}
public function test_requires_a_message(): void
{
config(['afia.api_key' => 'sk-test']);
$this->actingAs($this->user())->postJson('/afia/chat', [])->assertStatus(422);
}
public function test_returns_503_when_not_configured(): void
{
config(['afia.api_key' => '']);
$this->actingAs($this->user())->postJson('/afia/chat', ['message' => 'hi'])->assertStatus(503);
}
public function test_returns_reply_from_llm(): void
{
config(['afia.api_key' => 'sk-test', 'afia.provider' => 'openai', 'afia.model' => 'gpt-4o-mini']);
Http::fake([
'api.openai.com/*' => Http::response(['choices' => [['message' => ['content' => 'Create a Business QR under My Codes.']]]]),
]);
$this->actingAs($this->user())
->postJson('/afia/chat', ['message' => 'How do I create a business QR?'])
->assertOk()
->assertJson(['reply' => 'Create a Business QR under My Codes.']);
Http::assertSent(fn ($r) => str_contains($r->url(), 'openai.com')
&& collect($r['messages'])->first()['role'] === 'system'
&& str_contains(collect($r['messages'])->first()['content'], 'Ladill QR Plus'));
}
}
-41
View File
@@ -1,41 +0,0 @@
<?php
namespace Tests\Feature;
use Tests\TestCase;
class AssetLinksTest extends TestCase
{
public function test_assetlinks_returns_404_when_fingerprints_not_configured(): void
{
config(['android_app_links.sha256_cert_fingerprints' => []]);
$this->get('/.well-known/assetlinks.json')->assertNotFound();
}
public function test_assetlinks_returns_json_when_configured(): void
{
config([
'android_app_links.package_name' => 'com.ladill.mini',
'android_app_links.sha256_cert_fingerprints' => [
'AA:BB:CC:DD:EE:FF:00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD:EE:FF:00:11:22:33:44:55:66:77:88:99',
],
]);
$this->get('/.well-known/assetlinks.json')
->assertOk()
->assertHeader('Content-Type', 'application/json')
->assertJson([
[
'relation' => ['delegate_permission/common.handle_all_urls'],
'target' => [
'namespace' => 'android_app',
'package_name' => 'com.ladill.mini',
'sha256_cert_fingerprints' => [
'AA:BB:CC:DD:EE:FF:00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD:EE:FF:00:11:22:33:44:55:66:77:88:99',
],
],
],
]);
}
}
-82
View File
@@ -1,82 +0,0 @@
<?php
namespace Tests\Feature;
use App\Models\QrCode;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Storage;
use Tests\TestCase;
class ImportEventsCommandTest extends TestCase
{
use RefreshDatabase;
public function test_import_decodes_json_payload_and_remaps_programme_links(): void
{
Storage::fake('qr');
$owner = User::factory()->create(['public_id' => 'usr_events_owner']);
$payload = [
'qr_wallets' => [],
'qr_codes' => [
[
'platform_id' => 10,
'owner_public_id' => $owner->public_id,
'owner_email' => $owner->email,
'short_code' => 'demo-programme',
'type' => QrCode::TYPE_ITINERARY,
'label' => 'Demo Programme',
'payload' => json_encode(['content' => ['title' => 'Demo Programme'], 'style' => []]),
'is_active' => true,
'scans_total' => 0,
'created_at' => now()->toDateTimeString(),
'updated_at' => now()->toDateTimeString(),
'destination_updated_at' => now()->toDateTimeString(),
],
[
'platform_id' => 11,
'owner_public_id' => $owner->public_id,
'owner_email' => $owner->email,
'short_code' => 'demo-event',
'type' => QrCode::TYPE_EVENT,
'label' => 'Demo Event',
'payload' => json_encode([
'content' => ['name' => 'Demo Event', 'programme_qr_id' => 10],
'style' => [],
]),
'is_active' => true,
'scans_total' => 0,
'created_at' => now()->toDateTimeString(),
'updated_at' => now()->toDateTimeString(),
'destination_updated_at' => now()->toDateTimeString(),
],
],
'qr_event_registrations' => [],
'qr_scan_events' => [],
'qr_transactions' => [],
];
$exportPath = storage_path('framework/testing/events-import.json');
if (! is_dir(dirname($exportPath))) {
mkdir(dirname($exportPath), 0777, true);
}
file_put_contents($exportPath, json_encode($payload));
Artisan::call('events:import', [
'file' => $exportPath,
'--commit' => true,
]);
$event = QrCode::where('short_code', 'demo-event')->first();
$programme = QrCode::where('short_code', 'demo-programme')->first();
$this->assertNotNull($event);
$this->assertNotNull($programme);
$this->assertIsArray($event->payload);
$this->assertSame('Demo Event', $event->content()['name'] ?? null);
$this->assertSame($programme->id, $event->content()['programme_qr_id'] ?? null);
}
}
-108
View File
@@ -1,108 +0,0 @@
<?php
namespace Tests\Feature;
use App\Models\QrCode;
use App\Models\QrSetting;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Str;
use Tests\TestCase;
class QrSettingsTest extends TestCase
{
use RefreshDatabase;
protected function setUp(): void
{
parent::setUp();
Http::preventStrayRequests();
}
private function user(): User
{
return User::create(['public_id' => (string) Str::uuid(), 'name' => 'A', 'email' => 'a+'.uniqid().'@x.com']);
}
public function test_settings_page_renders_for_authenticated_user(): void
{
$this->actingAs($this->user())
->get(route('account.settings'))
->assertOk()
->assertSee('favicon.ico', false)
->assertSee('New event defaults')
->assertSee('QR code defaults')
->assertSee('New registrations')
->assertSee('Notifications');
}
public function test_can_save_qr_settings(): void
{
$user = $this->user();
$this->actingAs($user)
->put(route('account.settings.update'), [
'notify_email' => 'alerts@example.com',
'product_updates' => '1',
'low_balance_alerts' => '0',
'notify_registrations' => '1',
'notify_payouts' => '0',
'event_defaults' => [
'currency' => 'USD',
'mode' => 'free',
'badge_size' => '4x6',
'brand_color' => '#aabbcc',
'organizer' => 'CAPBuSS',
'registration_open' => '1',
'badge_fields' => ['Company', 'Title'],
],
'default_style' => [
'foreground' => '#112233',
'background' => '#ffffff',
'module_style' => 'dots',
'frame_style' => 'scan_me',
'frame_color' => '#445566',
'frame_text' => 'SCAN ME',
],
])
->assertRedirect(route('account.settings'));
$settings = QrSetting::where('user_id', $user->id)->first();
$this->assertNotNull($settings);
$this->assertSame('alerts@example.com', $settings->notify_email);
$this->assertTrue($settings->product_updates);
$this->assertFalse($settings->low_balance_alerts);
$this->assertTrue($settings->notify_registrations);
$this->assertFalse($settings->notify_payouts);
$this->assertSame('USD', $settings->resolvedEventDefaults()['currency']);
$this->assertSame('free', $settings->resolvedEventDefaults()['mode']);
$this->assertSame('CAPBuSS', $settings->resolvedEventDefaults()['organizer']);
$this->assertSame('#112233', $settings->resolvedDefaultStyle()['foreground']);
$this->assertSame('scan_me', $settings->resolvedDefaultStyle()['frame_style']);
}
public function test_create_page_uses_saved_defaults(): void
{
$user = $this->user();
QrSetting::create([
'user_id' => $user->id,
'default_type' => QrCode::TYPE_EVENT,
'default_style' => ['foreground' => '#aabbcc', 'module_style' => 'dots'],
'event_defaults' => ['mode' => 'contributions', 'organizer' => 'Test Org', 'brand_color' => '#ff00aa'],
]);
Http::fake([
config('billing.api_url').'/balance*' => Http::response(['balance_minor' => 50000]),
]);
$this->actingAs($user)
->get(route('events.create'))
->assertOk()
->assertSee('favicon.ico', false)
->assertSee('#aabbcc', false)
->assertSee('Test Org', false)
->assertSee('"event"', false);
}
}
-64
View File
@@ -1,64 +0,0 @@
<?php
namespace Tests\Feature;
use App\Models\MiniPayment;
use App\Models\QrCode;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Str;
use Tests\TestCase;
class SearchTest extends TestCase
{
use RefreshDatabase;
private function user(): User
{
return User::create(['public_id' => (string) Str::uuid(), 'name' => 'A', 'email' => 'a+'.uniqid().'@x.com']);
}
public function test_user_can_search_payments_by_payer_name(): void
{
$user = $this->user();
$qr = QrCode::query()->create([
'user_id' => $user->id,
'short_code' => 'till01',
'type' => QrCode::TYPE_PAYMENT,
'label' => 'Main till',
'destination_url' => 'https://example.com',
'is_active' => true,
]);
MiniPayment::query()->create([
'qr_code_id' => $qr->id,
'user_id' => $user->id,
'reference' => 'pay-'.Str::uuid(),
'amount_minor' => 5000,
'currency' => 'GHS',
'platform_fee_minor' => 250,
'merchant_amount_minor' => 4750,
'payer_name' => 'Ama Mensah',
'status' => MiniPayment::STATUS_PAID,
'paid_at' => now(),
]);
$response = $this->actingAs($user)
->getJson(route('mini.search', ['q' => 'Ama']));
$response->assertOk();
$response->assertJsonPath('results.0.type', 'payment');
$response->assertJsonPath('results.0.title', 'Ama Mensah');
}
public function test_search_page_renders_for_authenticated_user(): void
{
$user = $this->user();
$this->actingAs($user)
->get(route('mini.search'))
->assertOk()
->assertSee('Find payments', false);
}
}
@@ -1,57 +0,0 @@
<?php
namespace Tests\Unit\Services\Qr;
use App\Models\QrCode;
use App\Models\User;
use App\Services\Qr\QrCodeManagerService;
use App\Services\Qr\QrImageGeneratorService;
use App\Services\Qr\QrPayloadValidator;
use App\Services\Qr\QrWalletBillingService;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Str;
use Tests\TestCase;
class PaymentQrUpdateTest extends TestCase
{
use RefreshDatabase;
public function test_payment_qr_update_persists_business_fields(): void
{
$user = User::create([
'public_id' => (string) Str::uuid(),
'name' => 'Trader',
'email' => 'trader@example.com',
]);
$qrCode = QrCode::create([
'user_id' => $user->id,
'short_code' => 'paytest01',
'type' => QrCode::TYPE_PAYMENT,
'label' => 'Till 1',
'payload' => [
'content' => [
'business_name' => 'Old Shop',
'branch_label' => 'Main',
'currency' => 'GHS',
],
'style' => [],
],
'is_active' => true,
]);
$manager = new QrCodeManagerService(
$this->createMock(QrWalletBillingService::class),
$this->createMock(QrImageGeneratorService::class),
new QrPayloadValidator(),
);
$updated = $manager->update($qrCode, [
'business_name' => 'New Shop',
'branch_label' => 'Accra Mall',
]);
$this->assertSame('New Shop', $updated->content()['business_name']);
$this->assertSame('Accra Mall', $updated->content()['branch_label']);
}
}