Make guest giving checkouts email-optional like Ladill Mini.
Deploy Ladill Give / deploy (push) Successful in 48s
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:
@@ -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'],
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user