diff --git a/app/Http/Controllers/Public/DonationController.php b/app/Http/Controllers/Public/DonationController.php index 86e9b3d..99aedbb 100644 --- a/app/Http/Controllers/Public/DonationController.php +++ b/app/Http/Controllers/Public/DonationController.php @@ -29,7 +29,7 @@ class DonationController extends Controller $validated = $request->validate([ 'customer_name' => ['required', 'string', 'max:120'], - 'customer_email' => ['required', 'email', 'max:200'], + 'customer_email' => ['nullable', 'email', 'max:200'], 'customer_phone' => ['required', 'string', 'max:30'], 'items' => ['required', 'array', 'min:1'], 'items.*.name' => ['required', 'string', 'max:200'], diff --git a/app/Services/Give/GiveDonationService.php b/app/Services/Give/GiveDonationService.php index 6f64337..c67140c 100644 --- a/app/Services/Give/GiveDonationService.php +++ b/app/Services/Give/GiveDonationService.php @@ -8,6 +8,7 @@ use App\Services\Billing\BillingClient; use App\Services\Billing\PaystackService; use App\Services\Billing\SmsService; use App\Services\Pay\PayClient; +use App\Support\LadillLink; use Illuminate\Support\Str; use RuntimeException; @@ -46,7 +47,7 @@ class GiveDonationService $amountMinor = (int) round($amountGhs * 100); $reference = 'GIVD-'.strtoupper(Str::random(16)); $orgName = $qrCode->content()['name'] ?? $qrCode->label ?? 'Giving page'; - $callbackUrl = route('qr.public.order.callback', ['shortCode' => $qrCode->short_code]); + $callbackUrl = LadillLink::path($qrCode->short_code, 'order/callback'); $donation = GiveDonation::create([ 'qr_code_id' => $qrCode->id, @@ -56,7 +57,7 @@ class GiveDonationService 'amount_minor' => $amountMinor, 'currency' => $qrCode->content()['currency'] ?? 'GHS', 'payer_name' => trim((string) ($data['customer_name'] ?? '')), - 'payer_email' => trim((string) ($data['customer_email'] ?? '')), + 'payer_email' => ($email = trim((string) ($data['customer_email'] ?? ''))) !== '' ? $email : null, 'payer_phone' => trim((string) ($data['customer_phone'] ?? '')), 'status' => GiveDonation::STATUS_PENDING, 'payment_reference' => null, diff --git a/resources/views/public/qr/event-confirmed.blade.php b/resources/views/public/qr/event-confirmed.blade.php index 222b28b..51242e5 100644 --- a/resources/views/public/qr/event-confirmed.blade.php +++ b/resources/views/public/qr/event-confirmed.blade.php @@ -44,7 +44,9 @@ @endif + @if($registration->attendee_email)

A receipt was sent to {{ $registration->attendee_email }}.

+ @endif @else

Hi {{ $registration->attendee_name }}, your spot is confirmed.

@@ -64,7 +66,11 @@ @endforeach + @if($registration->attendee_email)

Show this badge code at check-in. A confirmation was sent to {{ $registration->attendee_email }}.

+ @else +

Show this badge code at check-in.

+ @endif @endif diff --git a/resources/views/public/qr/landing.blade.php b/resources/views/public/qr/landing.blade.php index 8d38428..ed34eff 100644 --- a/resources/views/public/qr/landing.blade.php +++ b/resources/views/public/qr/landing.blade.php @@ -341,7 +341,6 @@ async give() { if (!this.amount || parseFloat(this.amount) <= 0) { this.errorMsg = 'Enter a valid amount.'; return; } if (!this.name.trim()) { this.errorMsg = 'Enter your name.'; return; } - if (!this.email.trim() || !this.email.includes('@')) { this.errorMsg = 'Enter a valid email.'; return; } if (!this.phone.trim()) { this.errorMsg = 'Enter your phone number.'; return; } this.errorMsg = ''; this.loading = true; const labels = @js($churchTypeLabels); @@ -592,9 +591,6 @@ - @@ -660,7 +656,7 @@ if (!this.tier) { this.errorMsg = this.mode === 'contributions' ? 'Select a category.' : 'Select a ticket type.'; return; } if (this.mode === 'contributions' && !(parseFloat(this.amount) > 0)) { this.errorMsg = 'Enter a contribution amount.'; return; } if (!this.name.trim()) { this.errorMsg = 'Enter your full name.'; return; } - if (!this.email.trim() || !this.email.includes('@')) { this.errorMsg = 'Enter a valid email.'; return; } + if (!this.phone.trim()) { this.errorMsg = 'Enter your phone number.'; return; } this.errorMsg = ''; this.loading = true; try { const res = await fetch(@js($evRegRoute), { @@ -855,9 +851,7 @@

Your details

- - @foreach($evFields as $field) Your details

-