39 lines
1.1 KiB
PHP
39 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\Plan;
|
|
use App\Models\User;
|
|
use App\Models\Setting;
|
|
use App\Models\PlanOrder;
|
|
use App\Models\PaymentSetting;
|
|
use Illuminate\Http\Request;
|
|
|
|
class BankPaymentController extends Controller
|
|
{
|
|
public function processPayment(Request $request)
|
|
{
|
|
$validated = validatePaymentRequest($request, [
|
|
'amount' => 'required|numeric|min:0',
|
|
]);
|
|
|
|
try {
|
|
$plan = Plan::findOrFail($validated['plan_id']);
|
|
|
|
createPlanOrder([
|
|
'user_id' => auth()->id(),
|
|
'plan_id' => $plan->id,
|
|
'billing_cycle' => $validated['billing_cycle'],
|
|
'payment_method' => 'bank',
|
|
'coupon_code' => $validated['coupon_code'] ?? null,
|
|
'payment_id' => 'BANK_' . strtoupper(uniqid()),
|
|
'status' => 'pending',
|
|
]);
|
|
|
|
return back()->with('success', __('Payment request submitted. Your plan will be activated after payment verification.'));
|
|
|
|
} catch (\Exception $e) {
|
|
return handlePaymentError($e, 'bank');
|
|
}
|
|
}
|
|
} |