Add mobile-only payment search for Ladill Mini.
Deploy Ladill Mini / deploy (push) Successful in 24s
Deploy Ladill Mini / deploy (push) Successful in 24s
Wire the mobile search tab to a payments search page and remove desktop header search shortcuts. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\MiniPayment;
|
||||
use App\Models\QrCode;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
@@ -17,25 +18,38 @@ class SearchTest extends TestCase
|
||||
return User::create(['public_id' => (string) Str::uuid(), 'name' => 'A', 'email' => 'a+'.uniqid().'@x.com']);
|
||||
}
|
||||
|
||||
public function test_user_can_search_owned_event_by_label(): void
|
||||
public function test_user_can_search_payments_by_payer_name(): void
|
||||
{
|
||||
$user = $this->user();
|
||||
|
||||
QrCode::query()->create([
|
||||
$qr = QrCode::query()->create([
|
||||
'user_id' => $user->id,
|
||||
'short_code' => 'summit',
|
||||
'type' => QrCode::TYPE_EVENT,
|
||||
'label' => 'NextGen Summit',
|
||||
'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('events.search', ['q' => 'NextGen']));
|
||||
->getJson(route('mini.search', ['q' => 'Ama']));
|
||||
|
||||
$response->assertOk();
|
||||
$response->assertJsonPath('results.0.type', 'event');
|
||||
$response->assertJsonPath('results.0.title', 'NextGen Summit');
|
||||
$response->assertJsonPath('results.0.type', 'payment');
|
||||
$response->assertJsonPath('results.0.title', 'Ama Mensah');
|
||||
}
|
||||
|
||||
public function test_search_page_renders_for_authenticated_user(): void
|
||||
@@ -43,8 +57,8 @@ class SearchTest extends TestCase
|
||||
$user = $this->user();
|
||||
|
||||
$this->actingAs($user)
|
||||
->get(route('events.search'))
|
||||
->get(route('mini.search'))
|
||||
->assertOk()
|
||||
->assertSee('Find events and programmes', false);
|
||||
->assertSee('Find payments', false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user