fix(purchase): unify expired checkout errors

This commit is contained in:
2026-08-20 17:01:06 -03:00
parent ae6149df84
commit 9fd34f900f
11 changed files with 174 additions and 18 deletions

View File

@@ -0,0 +1,24 @@
<?php
namespace Tests\Feature\Purchase;
use App\Domains\Purchase\Exceptions\PurchaseExpiredException;
use Illuminate\Support\Facades\Route;
use Tests\TestCase;
class PurchaseExpiredExceptionResponseTest extends TestCase
{
public function test_it_returns_a_stable_api_error_for_an_expired_purchase(): void
{
Route::get('/api/test/purchase-expired', function (): never {
throw new PurchaseExpiredException;
});
$this->getJson('/api/test/purchase-expired')
->assertUnprocessable()
->assertExactJson([
'code' => 'purchase.expired',
'message' => __('api.purchase.expired'),
]);
}
}