- Introduced a new configuration file for purchase settings, including checkout and payment expiration times. - Added a migration to include a `reservation_status` column in the `compra_items` table, defaulting to 'active' and updating existing records based on purchase status. - Created a migration to add an `expires_at` timestamp to the `compras` table, updating it for existing records based on their status. - Scoped unique indexes in the `carritos` table to only active carts, adding virtual columns for active user and guest tokens. - Implemented a console command to expire overdue purchases and release stock reservations, scheduled to run every minute. - Added tests for Google token exchange and login functionality, ensuring proper cart handling and user authentication. - Updated purchase-related tests to reflect changes in item handling and customer data validation.
22 lines
653 B
PHP
22 lines
653 B
PHP
<?php
|
|
|
|
use App\Domains\Purchase\Services\CheckoutService;
|
|
use Illuminate\Foundation\Inspiring;
|
|
use Illuminate\Support\Facades\Artisan;
|
|
use Illuminate\Support\Facades\Schedule;
|
|
|
|
Artisan::command('inspire', function () {
|
|
$this->comment(Inspiring::quote());
|
|
})->purpose('Display an inspiring quote');
|
|
|
|
Artisan::command('purchases:expire', function (): void {
|
|
$expiredCount = app(CheckoutService::class)
|
|
->expireOverduePurchases();
|
|
|
|
$this->info("Expired purchases: {$expiredCount}");
|
|
})->purpose('Release stock reservations from expired purchases');
|
|
|
|
Schedule::command('purchases:expire')
|
|
->everyMinute()
|
|
->withoutOverlapping();
|