Make guest giving checkouts email-optional like Ladill Mini.
Deploy Ladill Give / deploy (push) Successful in 48s

Donors without Ladill accounts no longer need to enter email at checkout; phone remains required for contact.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-06-27 14:18:45 +00:00
co-authored by Cursor
parent fff6c9f23a
commit bd16fb307b
4 changed files with 12 additions and 14 deletions
@@ -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'],
+3 -2
View File
@@ -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,
@@ -44,7 +44,9 @@
</div>
@endif
@if($registration->attendee_email)
<p class="mt-5 text-xs text-slate-400">A receipt was sent to {{ $registration->attendee_email }}.</p>
@endif
@else
<p class="text-sm text-slate-500">Hi <span class="font-semibold text-slate-800">{{ $registration->attendee_name }}</span>, your spot is confirmed.</p>
@@ -64,7 +66,11 @@
@endforeach
</div>
@if($registration->attendee_email)
<p class="mt-5 text-xs text-slate-400">Show this badge code at check-in. A confirmation was sent to {{ $registration->attendee_email }}.</p>
@else
<p class="mt-5 text-xs text-slate-400">Show this badge code at check-in.</p>
@endif
@endif
</div>
</div>
+2 -11
View File
@@ -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 @@
<input type="text" x-model="name" placeholder="Full name *" autocomplete="name"
class="church-input"
style="display:block; width:100%; box-sizing:border-box; border-radius:14px; border:1.5px solid #e2e8f0; padding:12px 16px; font-size:0.875rem; color:#0f172a; background:#fff;">
<input type="email" x-model="email" placeholder="Email address *" autocomplete="email"
class="church-input"
style="display:block; width:100%; box-sizing:border-box; border-radius:14px; border:1.5px solid #e2e8f0; padding:12px 16px; font-size:0.875rem; color:#0f172a; background:#fff;">
<input type="tel" x-model="phone" placeholder="Phone number *" autocomplete="tel"
class="church-input"
style="display:block; width:100%; box-sizing:border-box; border-radius:14px; border:1.5px solid #e2e8f0; padding:12px 16px; font-size:0.875rem; color:#0f172a; background:#fff;">
@@ -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 @@
<p class="text-[10px] font-bold uppercase tracking-widest" style="color:{{ $evColor }}">Your details</p>
<input type="text" x-model="name" placeholder="Full name *" autocomplete="name"
class="w-full rounded-xl border border-slate-200 px-4 py-3 text-sm placeholder:text-slate-400 focus:outline-none focus:ring-1">
<input type="email" x-model="email" placeholder="Email address *" autocomplete="email"
class="w-full rounded-xl border border-slate-200 px-4 py-3 text-sm placeholder:text-slate-400 focus:outline-none focus:ring-1">
<input type="tel" x-model="phone" placeholder="Phone number" autocomplete="tel"
<input type="tel" x-model="phone" placeholder="Phone number *" autocomplete="tel"
class="w-full rounded-xl border border-slate-200 px-4 py-3 text-sm placeholder:text-slate-400 focus:outline-none focus:ring-1">
@foreach($evFields as $field)
<input type="text" x-model="fields[@js($field)]" placeholder="{{ $field }}"
@@ -1186,7 +1180,6 @@
async submitOrder() {
if (this.cartCount === 0) { this.errorMsg = 'Add at least one item.'; return }
if (!this.name.trim()) { this.errorMsg = 'Enter your name.'; return }
if (!this.email.trim() || !this.email.includes('@')) { this.errorMsg = 'Enter a valid email address.'; return }
if (!this.phone.trim()) { this.errorMsg = 'Enter your phone number.'; return }
this.errorMsg = '';
this.loading = true;
@@ -1451,8 +1444,6 @@
<p class="text-xs font-semibold uppercase tracking-widest text-slate-400">Your details</p>
<input type="text" x-model="name" placeholder="Full name *"
class="w-full rounded-xl border border-slate-200 px-4 py-3 text-sm placeholder:text-slate-400 focus:border-indigo-400 focus:outline-none focus:ring-1 focus:ring-indigo-400/30">
<input type="email" x-model="email" placeholder="Email address *"
class="w-full rounded-xl border border-slate-200 px-4 py-3 text-sm placeholder:text-slate-400 focus:border-indigo-400 focus:outline-none focus:ring-1 focus:ring-indigo-400/30">
<input type="tel" x-model="phone" placeholder="Phone number *"
class="w-full rounded-xl border border-slate-200 px-4 py-3 text-sm placeholder:text-slate-400 focus:border-indigo-400 focus:outline-none focus:ring-1 focus:ring-indigo-400/30">
</div>