Add Events Pro/Business and BYO ticket gateways.
Deploy Ladill Events / deploy (push) Successful in 42s
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:
@@ -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.');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user