Initial Ladill Give extraction — online giving pages at give.ladill.com.
Donation checkout via Ladill Pay (9% fee), church/giving QR pages, SSO, and platform scan forwarding. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\GiveDonation;
|
||||
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,
|
||||
]);
|
||||
|
||||
GiveDonation::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' => GiveDonation::STATUS_PAID,
|
||||
'paid_at' => now(),
|
||||
]);
|
||||
|
||||
$response = $this->actingAs($user)
|
||||
->getJson(route('give.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('give.search'))
|
||||
->assertOk()
|
||||
->assertSee('Find payments', false);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user