Add Events Pro/Business and BYO ticket gateways.
Deploy Ladill Events / deploy (push) Successful in 42s

Cut ticket checkouts off Ladill Pay, settle to merchant gateways at 0% platform fee, and mirror Invoice freemium pricing (GHS 49 / 149).

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-15 01:26:28 +00:00
co-authored by Cursor
parent dda52722ce
commit 4c87c786da
26 changed files with 1376 additions and 105 deletions
+39 -1
View File
@@ -3,19 +3,25 @@
namespace App\Http\Controllers\Qr;
use App\Http\Controllers\Controller;
use App\Models\PaymentGatewaySetting;
use App\Models\QrSetting;
use App\Services\Billing\BillingClient;
use App\Services\Payments\MerchantGatewayService;
use App\Support\AccountBranding;
use App\Support\Qr\QrCornerStyleCatalog;
use App\Support\Qr\QrFrameStyleCatalog;
use App\Support\Qr\QrModuleStyleCatalog;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Validation\Rule;
use Illuminate\View\View;
class AccountController extends Controller
{
public function __construct(private BillingClient $billing) {}
public function __construct(
private BillingClient $billing,
private MerchantGatewayService $gateway,
) {}
private function topupUrl(): string
{
@@ -76,6 +82,7 @@ class AccountController extends Controller
'cornerOuterStyles' => QrCornerStyleCatalog::outerStyles(),
'cornerInnerStyles' => QrCornerStyleCatalog::innerStyles(),
'frameStyles' => QrFrameStyleCatalog::visible(),
'gateway' => $this->gateway->settingFor($account),
]);
}
@@ -115,6 +122,16 @@ class AccountController extends Controller
'default_style.gradient_rotation' => ['nullable', 'integer', 'min:0', 'max:360'],
'logo' => ['nullable', 'image', 'mimes:jpeg,png,jpg,webp,svg', 'max:2048'],
'remove_logo' => ['nullable', 'boolean'],
'gateway_provider' => ['nullable', Rule::in([
PaymentGatewaySetting::PROVIDER_PAYSTACK,
PaymentGatewaySetting::PROVIDER_FLUTTERWAVE,
PaymentGatewaySetting::PROVIDER_HUBTEL,
'',
])],
'gateway_public_key' => ['nullable', 'string', 'max:2000'],
'gateway_secret_key' => ['nullable', 'string', 'max:2000'],
'gateway_webhook_secret' => ['nullable', 'string', 'max:2000'],
'gateway_is_active' => ['nullable', 'boolean'],
]);
$eventDefaults = $data['event_defaults'] ?? [];
@@ -146,6 +163,27 @@ class AccountController extends Controller
],
);
$provider = (string) ($data['gateway_provider'] ?? '');
if ($provider !== '') {
$existing = PaymentGatewaySetting::query()->firstOrNew([
'owner_ref' => $account->public_id,
]);
$existing->provider = $provider;
$existing->is_active = $request->boolean('gateway_is_active', true);
if (filled($data['gateway_public_key'] ?? null)) {
$existing->public_key = $data['gateway_public_key'];
}
if (filled($data['gateway_secret_key'] ?? null)) {
$existing->secret_key = $data['gateway_secret_key'];
}
if (array_key_exists('gateway_webhook_secret', $data) && $data['gateway_webhook_secret'] !== null) {
$existing->webhook_secret = $data['gateway_webhook_secret'] !== ''
? $data['gateway_webhook_secret']
: null;
}
$existing->save();
}
return redirect()->route('account.settings')->with('success', 'Settings saved.');
}
}
+17 -1
View File
@@ -7,6 +7,7 @@ use App\Models\QrCode;
use App\Models\QrEventRegistration;
use App\Models\QrWallet;
use App\Services\Billing\BillingClient;
use App\Services\Events\SubscriptionService;
use App\Services\Qr\QrAnalyticsService;
use App\Services\Qr\QrCodeManagerService;
use App\Services\Qr\QrImageGeneratorService;
@@ -37,6 +38,7 @@ class QrCodeController extends Controller
private QrImageGeneratorService $imageGenerator,
private QrPdfExporter $pdfExporter,
private BillingClient $platformBilling,
private SubscriptionService $subscriptions,
) {}
public function index(Request $request): View
@@ -72,8 +74,15 @@ class QrCodeController extends Controller
]);
}
public function create(Request $request): View
public function create(Request $request): View|RedirectResponse
{
$account = ladill_account() ?? $request->user();
$requestedType = $request->query('type', QrCode::TYPE_EVENT);
if ($account && ($requestedType === QrCode::TYPE_EVENT) && ! $this->subscriptions->canCreateEvent($account)) {
return redirect()->route('events.pro.index')
->with('upsell', 'Free plan includes up to '.config('events.free.max_live_events', 2).' live events. Upgrade for unlimited.');
}
$account = ladill_account();
$wallet = $this->manager->walletFor($account);
$qrSettings = $account->getOrCreateQrSetting();
@@ -126,6 +135,13 @@ class QrCodeController extends Controller
public function store(Request $request): RedirectResponse
{
$account = ladill_account() ?? $request->user();
$requestedType = (string) $request->input('type', QrCode::TYPE_EVENT);
if ($account && $requestedType === QrCode::TYPE_EVENT && ! $this->subscriptions->canCreateEvent($account)) {
return redirect()->route('events.pro.index')
->with('upsell', 'Free plan includes up to '.config('events.free.max_live_events', 2).' live events. Upgrade for unlimited.');
}
$validated = $request->validate([
'label' => ['required', 'string', 'max:120'],
'type' => ['required', 'in:' . implode(',', QrTypeCatalog::keys())],