Notifications: notification_preferences + Laravel notifications inbox.
SmsChannel adapter for our SmsService. RoutesByPreferences trait reads
per-user toggles. HouseholdApproved/Rejected, QrBalanceLow, and
CodesPurchased notifications wired in via auto-discovered listeners
or direct dispatch from controllers/StoreOperations.
Payments: payments table + PaymentDriver interface. ManualPaymentDriver
works out of the box; PayMongoDriver activates when
PAYMONGO_SECRET_KEY is set, falls back to manual otherwise. Resident
initiates code-purchase, admin can mark paid manually, webhook applies
real provider events. Fulfillment runs StoreOperations::sellToHousehold.
Live tracking (HTTP polling): truck_location_history (with SPATIAL
INDEX + 7-day retention plan). Driver POST /driver/trucks/{uuid}/location
writes history, updates trucks.last_known_coordinates, caches in Redis,
flags geofence-trigger when entering active trip dumpsite. Admin
GET /admin/live/trucks returns active truck positions. Reverb broadcast
deferred.
Flow corrections:
- QrAllocator now idempotent — re-approving a household no longer
re-dispenses free codes.
- arrive-dumpsite enforces dumpsite geofence via ST_Contains; can be
bypassed with override_geofence: true.
171 feature tests passing.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
55 lines
1.9 KiB
PHP
55 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Services\Payment\ManualPaymentDriver;
|
|
use App\Services\Payment\PayMongoDriver;
|
|
use App\Services\Payment\PaymentDriver;
|
|
use App\Services\Sms\FakeSmsService;
|
|
use App\Services\Sms\LogSmsService;
|
|
use App\Services\Sms\SemaphoreSmsService;
|
|
use App\Services\Sms\SmsService;
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
{
|
|
public function register(): void
|
|
{
|
|
$this->app->singleton(PaymentDriver::class, function ($app) {
|
|
$driver = config('services.payments.driver', 'manual');
|
|
$key = (string) config('services.paymongo.secret_key');
|
|
|
|
if ($driver === 'paymongo' && $key !== '') {
|
|
return new PayMongoDriver(
|
|
secretKey: $key,
|
|
webhookSecret: (string) config('services.paymongo.webhook_secret'),
|
|
successUrl: (string) config('services.paymongo.success_url'),
|
|
cancelUrl: (string) config('services.paymongo.cancel_url'),
|
|
);
|
|
}
|
|
|
|
return new ManualPaymentDriver();
|
|
});
|
|
|
|
$this->app->singleton(SmsService::class, function ($app) {
|
|
$driver = config('services.sms.driver', 'log');
|
|
|
|
return match ($driver) {
|
|
'semaphore' => new SemaphoreSmsService(
|
|
apiKey: (string) config('services.semaphore.api_key'),
|
|
senderName: (string) config('services.semaphore.sender_name', 'VERDE'),
|
|
),
|
|
'fake' => new FakeSmsService(),
|
|
default => new LogSmsService(),
|
|
};
|
|
});
|
|
}
|
|
|
|
public function boot(): void
|
|
{
|
|
// Listeners under App\Listeners are auto-discovered by Laravel 11
|
|
// based on their handle() method's type-hint. Don't register them
|
|
// explicitly here — that causes double-dispatch.
|
|
}
|
|
}
|