payment dan navbar

This commit is contained in:
baghizadizn 2025-11-24 14:59:29 +07:00
parent 74e1536d2a
commit 6f4e5756e8
43 changed files with 151 additions and 2667 deletions

View File

@ -1,218 +0,0 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\Bootcamp;
use App\Models\BootcampPurchase;
use App\Models\CartItem;
use App\Models\Coupon;
use App\Models\Course;
use App\Models\Enrollment;
use App\Models\OfflinePayment;
use App\Models\Payment_history;
use App\Models\TeamPackagePurchase;
use App\Models\TeamTrainingPackage;
use App\Models\TutorBooking;
use App\Models\TutorSchedule;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Response;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
class OfflinePaymentController extends Controller
{
public function index(Request $request)
{
$payments = OfflinePayment::orderBY('id', 'DESC');
if ($request->status == 'approved') {
$payments->where('status', 1);
} elseif ($request->status == 'suspended') {
$payments->where('status', 2);
} elseif ($request->status == 'pending') {
$payments->where('status', 0)->orWhere('status', null);
}
$page_data['payments'] = $payments->paginate(10);
return view('admin.offline_payments.index', $page_data);
}
public function download_doc($id)
{
// validate id
if (empty($id)) {
Session::flash('error', get_phrase('Data not found.'));
return redirect()->back();
}
// payment details
$payment_details = OfflinePayment::where('id', $id)->first();
$filePath = public_path($payment_details->doc);
if (! file_exists($filePath)) {
Session::flash('error', get_phrase('Data not found.'));
return redirect()->back();
}
// download file
return Response::download($filePath);
}
public function accept_payment($id)
{
// validate id
if (empty($id)) {
Session::flash('error', get_phrase('Id can not be empty.'));
return redirect()->back();
}
// payment details
$query = OfflinePayment::where('id', $id)->where('status', 0);
if ($query->doesntExist()) {
Session::flash('error', get_phrase('Data not found.'));
return redirect()->back();
}
$payment_details = $query->first();
$payment['invoice'] = Str::random(20);
$payment['user_id'] = $payment_details['user_id'];
$payment['payment_type'] = 'offline';
$payment['coupon'] = $payment_details->coupon;
if ($payment_details->item_type == 'course') {
$items = json_decode($payment_details->items);
foreach ($items as $item) {
$course = Course::where('id', $item)->first();
$payment['course_id'] = $course->id;
// Calculate base amount
$amount = $course->discount_flag == 1 ? $course->discounted_price : $course->price;
// Apply coupon discount if applicable
$discounted_price = 0;
if ($payment_details->coupon) {
$coupon = Coupon::where('code', $payment_details->coupon)->first();
if ($coupon) {
$discounted_price = $amount * ($coupon->discount / 100);
}
}
// Final payment amount and tax
$final_amount = $amount - $discounted_price;
$payment['amount'] = $final_amount;
$payment['tax'] = (get_settings('course_selling_tax') / 100) * $final_amount;
// Calculate admin and instructor revenue
if (get_course_creator_id($course->id)->role == 'admin') {
$payment['admin_revenue'] = $final_amount;
} else {
$payment['instructor_revenue'] = $final_amount * (get_settings('instructor_revenue') / 100);
$payment['admin_revenue'] = $final_amount - $payment['instructor_revenue'];
}
// Insert payment record
$accept_payment = Payment_history::insert($payment);
// Enroll user in course if payment succeeds
if ($accept_payment) {
$enroll['user_id'] = $payment_details['user_id'];
$enroll['course_id'] = $course->id;
$enroll['enrollment_type'] = "paid";
$enroll['entry_date'] = time();
$enroll['created_at'] = date('Y-m-d H:i:s');
$enroll['updated_at'] = date('Y-m-d H:i:s');
if ($course->expiry_period > 0) {
$days = $course->expiry_period * 30;
$enroll['expiry_date'] = strtotime("+" . $days . " days");
} else {
$enroll['expiry_date'] = null;
}
Enrollment::insert($enroll);
}
}
} elseif ($payment_details->item_type == 'bootcamp') {
$bootcamps = Bootcamp::whereIn('id', json_decode($payment_details->items, true))->get();
foreach($bootcamps as $bootcamp){
$bootcamp_payment['invoice'] = '#' . Str::random(20);
$bootcamp_payment['user_id'] = $payment_details['user_id'];
$bootcamp_payment['bootcamp_id'] = $bootcamp->id;
$bootcamp_payment['price'] = $bootcamp->discount_flag == 1 ? $bootcamp->price - $bootcamp->discounted_price : $bootcamp->price;
$bootcamp_payment['tax'] = 0;
$bootcamp_payment['payment_method'] = 'offline';
$bootcamp_payment['status'] = 1;
// insert bootcamp purchase
BootcampPurchase::insert($bootcamp_payment);
}
} elseif ($payment_details->item_type == 'package') {
$packages = TeamTrainingPackage::whereIn('id', json_decode($payment_details->items, true))->get();
foreach($packages as $package){
$package_payment['invoice'] = '#' . Str::random(20);
$package_payment['user_id'] = $payment_details['user_id'];
$package_payment['package_id'] = $package->id;
$package_payment['price'] = $package->price;
$package_payment['tax'] = 0;
$package_payment['payment_method'] = 'offline';
$package_payment['status'] = 1;
// insert package purchase
TeamPackagePurchase::insert($package_payment);
}
} elseif ($payment_details->item_type == 'tutor_booking') {
$schedules = TutorSchedule::whereIn('id', json_decode($payment_details->items, true))->get();
foreach($schedules as $schedule){
$schedule_payment['invoice'] = '#' . Str::random(20);
$schedule_payment['student_id'] = $payment_details['user_id'];
$schedule_payment['schedule_id'] = $schedule->id;
$schedule_payment['price'] = $payment_details['total_amount'];
$schedule_payment['tax'] = $payment_details['tax'];
$schedule_payment['payment_method'] = 'offline';
$schedule = TutorSchedule::find($schedule->id);
if (get_user_info($schedule->tutor_id)->role == 'admin') {
$schedule_payment['admin_revenue'] = $payment_details['payable_amount'];
} else {
$schedule_payment['instructor_revenue'] = $payment_details['total_amount'] * (get_settings('instructor_revenue') / 100);
$schedule_payment['admin_revenue'] = $payment_details['total_amount'] - $schedule_payment['instructor_revenue'];
}
$schedule_payment['tutor_id'] = $schedule->tutor_id;
$schedule_payment['start_time'] = $schedule->start_time;
$schedule_payment['end_time'] = $schedule->end_time;
// insert tutor bookings
TutorBooking::insert($schedule_payment);
}
}
// remove items from offline payment
OfflinePayment::where('id', $id)->update(['status' => 1]);
// go back
Session::flash('success', 'Payment has been accepted.');
return redirect()->route('admin.offline.payments');
}
public function decline_payment($id)
{
// remove items from offline payment
OfflinePayment::where('id', $id)->update(['status' => 2]);
// go back
Session::flash('success', 'Payment has been suspended');
return redirect()->route('admin.offline.payments');
}
public function delete_payment($id)
{
OfflinePayment::where('id', $id)->delete();
Session::flash('success', get_phrase('Admin revenue delete successfully'));
return redirect()->route('admin.offline.payments');
}
}

View File

@ -2,20 +2,9 @@
namespace App\Http\Controllers;
use Anand\LaravelPaytmWallet\Facades\PaytmWallet;
use App\Models\FileUploader;
use App\Models\payment_gateway\Paystack;
use App\Models\payment_gateway\Ccavenue;
use App\Models\payment_gateway\Pagseguro;
use App\Models\payment_gateway\Xendit;
use App\Models\payment_gateway\Doku;
use App\Models\payment_gateway\Skrill;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Str;
use paytm\paytmchecksum\PaytmChecksum;
class PaymentController extends Controller
{
@ -69,8 +58,6 @@ class PaymentController extends Controller
}
public function payment_create($identifier)
{
$payment_details = session('payment_details');
@ -82,13 +69,6 @@ class PaymentController extends Controller
return redirect()->to($created_payment_link);
}
public function payment_notification(Request $request, $identifier)
{
if ($identifier == 'doku') {
Doku::payment_status($identifier, $request->all(), $request->headers->all());
}
}
public function payment_razorpay($identifier)
{
$payment_details = session('payment_details');
@ -100,307 +80,6 @@ class PaymentController extends Controller
return view('payment.razorpay.payment', compact('data'));
}
public function make_paytm_order(Request $request)
{
//start common code of all payment gateway
// $identifier = 'paytm';
// $payment_details = session('payment_details');
// $model = $payment_details['success_method']['model_name'];
// $payment_gateway = DB::table('payment_gateways')->where('identifier', $identifier)->first();
// $user = auth()->user();
// $paytm_merchant_key = $paytm_merchant_mid = $paytm_merchant_website = $industry_type_id = $channel_id = '';
// if ($model == 'InstructorPayment') {
// $instructor_payment_keys = DB::table('users')
// ->where('id', $payment_details['items'][0]['id'])
// ->value('paymentkeys');
// $keys = isset($instructor_payment_keys) ? json_decode($instructor_payment_keys) : null;
// if ($keys) {
// $paytm_merchant_key = $keys->paytm->paytm_merchant_key;
// $paytm_merchant_mid = $keys->paytm->paytm_merchant_mid;
// $paytm_merchant_website = $keys->paytm->paytm_merchant_website;
// $industry_type_id = $keys->paytm->industry_type_id;
// $channel_id = $keys->paytm->channel_id;
// }
// } else {
// $keys = json_decode($payment_gateway->keys);
// $paytm_merchant_key = $keys->paytm_merchant_key;
// $paytm_merchant_mid = $keys->paytm_merchant_mid;
// $paytm_merchant_website = $keys->paytm_merchant_website;
// $industry_type_id = $keys->industry_type_id;
// $channel_id = $keys->channel_id;
// }
// if ($payment_gateway->test_mode == 1) {
// $PAYTM_STATUS_QUERY_NEW_URL = 'https://securegw-stage.paytm.in/merchant-status/getTxnStatus';
// $PAYTM_TXN_URL = 'https://securegw-stage.paytm.in/theia/processTransaction';
// } else {
// define('PAYTM_ENVIRONMENT', 'PROD'); // PROD or TEST
// $PAYTM_STATUS_QUERY_NEW_URL = 'https://securegw.paytm.in/merchant-status/getTxnStatus';
// $PAYTM_TXN_URL = 'https://securegw.paytm.in/theia/processTransaction';
// }
// $paramList = [];
// $paramList['MID'] = $paytm_merchant_mid;
// $paramList['ORDER_ID'] = 'ORDS2123' . $user->id;
// $paramList['CUST_ID'] = 'CUST' . $user->id;
// $paramList['INDUSTRY_TYPE_ID'] = $industry_type_id;
// $paramList['CHANNEL_ID'] = $channel_id;
// $paramList['TXN_AMOUNT'] = $payment_details['payable_amount'];
// $paramList['WEBSITE'] = $paytm_merchant_website;
// $paramList['CALLBACK_URL'] = $payment_details['success_url'] . '/' . $identifier;
// $paytmParams = array();
// $paytmParams["body"] = array(
// "requestType" => "Payment",
// "mid" => $paytm_merchant_mid,
// "websiteName" => $paytm_merchant_website,
// "orderId" => 'ORDS2123' . $user->id,
// "callbackUrl" => $payment_details['success_url'] . '/' . $identifier,
// "txnAmount" => array(
// "value" => round($payment_details['payable_amount'], 2),
// "currency" => "INR",
// ),
// "userInfo" => array(
// "custId" => "CUST_".$user->id,
// ),
// );
// $checksum = PaytmChecksum::generateSignature(json_encode($paramList, JSON_UNESCAPED_SLASHES), $paytm_merchant_key);
// echo PaytmChecksum::verifySignature($paramList, $paytm_merchant_key, $checksum);
// // $checksum = str_replace('/', '', $checksum);
// // $checksum = str_replace('=', '', $checksum);
// $paytmParams["head"] = array(
// "signature" => $checksum,
// "channelId" => $channel_id
// );
// $post_data = json_encode($paytmParams, JSON_UNESCAPED_SLASHES);
// /* for Staging */
// $url = "https://securegw-stage.paytm.in/theia/api/v1/initiateTransaction?mid=$paytm_merchant_mid&orderId=ORDS2123" . $user->id;
// $ch = curl_init($url);
// curl_setopt($ch, CURLOPT_POST, 1);
// curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
// curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
// $response = curl_exec($ch);
// print_r($response);
return view('payment.paytm.paytm_merchant_checkout');
}
public function paytm_paymentCallback()
{
$transaction = PaytmWallet::with('receive');
$response = $transaction->response();
$order_id = $transaction->getOrderId(); // return a order id
$transaction->getTransactionId(); // return a transaction id
// update the db data as per result from api call
if ($transaction->isSuccessful()) {
Paytm::where('order_id', $order_id)->update(['status' => 1, 'transaction_id' => $transaction->getTransactionId()]);
return redirect(route('initiate.payment'))->with('message', "Your payment is successfull.");
} else if ($transaction->isFailed()) {
Paytm::where('order_id', $order_id)->update(['status' => 0, 'transaction_id' => $transaction->getTransactionId()]);
return redirect(route('initiate.payment'))->with('message', "Your payment is failed.");
} else if ($transaction->isOpen()) {
Paytm::where('order_id', $order_id)->update(['status' => 2, 'transaction_id' => $transaction->getTransactionId()]);
return redirect(route('initiate.payment'))->with('message', "Your payment is processing.");
}
$transaction->getResponseMessage(); //Get Response Message If Available
}
public function doku_checkout($identifier)
{
$payment_gateway = DB::table('payment_gateways')->where('identifier', $identifier)->first();
$keys = json_decode($payment_gateway->keys, true);
$test_mode = $payment_gateway->test_mode == 1 ? 1 : 0;
$client_id = $keys['client_id'];
if ($test_mode == 1) {
$key = $keys['public_test_key'];
$secret_key = $keys['secret_test_key'];
} else {
$key = $keys['public_live_key'];
$secret_key = $keys['secret_live_key'];
}
$user_id = auth()->user()->id;
$user = DB::table('users')->where('id', $user_id)->first();
$currency = $payment_gateway->currency;
$payment_details = session('payment_details');
$product_title = $payment_details['items'][0]['title'];
$amount = $payment_details['items'][0]['price'];
//Store temporary data
Doku::storeTempData();
$requestBody = array(
'order' => array(
'amount' => $amount,
'invoice_number' => 'INV-' . rand(1, 10000), // Change to your business logic
'currency' => $currency,
'callback_url' => $payment_details["success_url"] . "/$identifier",
'line_items' => array(
0 => array(
'name' => $product_title,
'price' => $amount,
'quantity' => 1,
),
),
),
'payment' => array(
'payment_due_date' => 60,
),
'customer' => array(
'id' => 'CUST-' . rand(1, 1000), // Change to your customer ID mapping
'name' => $user->name,
'email' => $user->email,
'phone' => $user->phone,
'address' => $user->address,
'country' => 'ID',
),
);
$requestId = rand(1, 100000); // Change to UUID or anything that can generate unique value
$dateTime = gmdate("Y-m-d H:i:s");
$isoDateTime = date(DATE_ISO8601, strtotime($dateTime));
$dateTimeFinal = substr($isoDateTime, 0, 19) . "Z";
$clientId = $client_id; // Change with your Client ID
$secretKey = $secret_key; // Change with your Secret Key
// $getUrl = 'https://api-sandbox.doku.com';
if ($test_mode == 1) {
$getUrl = 'https://api-sandbox.doku.com';
} else {
$getUrl = 'https://api.doku.com';
}
$targetPath = '/checkout/v1/payment';
$url = $getUrl . $targetPath;
// Generate digest
$digestValue = base64_encode(hash('sha256', json_encode($requestBody), true));
// Prepare signature component
$componentSignature = "Client-Id:" . $clientId . "\n" .
"Request-Id:" . $requestId . "\n" .
"Request-Timestamp:" . $dateTimeFinal . "\n" .
"Request-Target:" . $targetPath . "\n" .
"Digest:" . $digestValue;
// Generate signature
$signature = base64_encode(hash_hmac('sha256', $componentSignature, $secretKey, true));
// Execute request
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($requestBody));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Client-Id:' . $clientId,
'Request-Id:' . $requestId,
'Request-Timestamp:' . $dateTimeFinal,
'Signature:' . "HMACSHA256=" . $signature,
));
// Set response json
$responseJson = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
// Echo the response
if (is_string($responseJson) && $httpCode == 200) {
return json_decode($responseJson, true);
} else {
return null;
}
}
public function webRedirectToPayFee(Request $request)
{
// Check if the 'auth' query parameter is present

View File

@ -257,159 +257,6 @@ class SettingController extends Controller
$razorpay = json_encode($razorpay);
$data = array_splice($data, 0, 4);
$data['keys'] = $razorpay;
} elseif ($request->identifier == 'flutterwave') {
$flutterwave = [
'public_key' => $data['public_key'],
'secret_key' => $data['secret_key'],
];
$flutterwave = json_encode($flutterwave);
$data = array_splice($data, 0, 4);
$data['keys'] = $flutterwave;
} elseif ($request->identifier == 'paytm') {
$paytm = [
'paytm_merchant_key' => $data['paytm_merchant_key'] ?? '',
'paytm_merchant_mid' => $data['paytm_merchant_mid'] ?? '',
'paytm_merchant_website' => $data['paytm_merchant_website'] ?? '',
'industry_type_id' => $data['industry_type_id'] ?? '',
'channel_id' => $data['channel_id'] ?? '',
];
$paytm = json_encode($paytm);
$data = array_splice($data, 0, 4);
$data['keys'] = $paytm;
} elseif ($request->identifier == 'offline') {
$offline = [
'bank_information' => $data['bank_information'],
];
$offline = json_encode($offline);
$data = array_splice($data, 0, 4);
$data['keys'] = $offline;
unset($data['bank_information']);
} elseif ($request->identifier == 'paystack') {
$paystack = [
'secret_test_key' => $data['secret_test_key'],
'public_test_key' => $data['public_test_key'],
'secret_live_key' => $data['secret_live_key'],
'public_live_key' => $data['public_live_key'],
];
$paystack = json_encode($paystack);
$data = array_splice($data, 0, 4);
$data['keys'] = $paystack;
} elseif ($request->identifier == 'ccavenue') {
$ccavenue = [
'ccavenue_merchant_id' => $data['ccavenue_merchant_id'],
'ccavenue_working_key' => $data['ccavenue_working_key'],
'ccavenue_access_code' => $data['ccavenue_access_code'],
];
$ccavenue = json_encode($ccavenue);
$data = array_splice($data, 0, 4);
$data['keys'] = $ccavenue;
} elseif ($request->identifier == 'pagseguro') {
$pagseguro = [
'api_key' => $data['api_key'],
'secret_key' => $data['secret_key'],
'other_parameter' => $data['other_parameter'],
];
$pagseguro = json_encode($pagseguro);
$data = array_splice($data, 0, 4);
$data['keys'] = $pagseguro;
} elseif ($request->identifier == 'iyzico') {
$iyzico = [
'api_test_key' => $data['api_test_key'],
'secret_test_key' => $data['secret_test_key'],
'api_live_key' => $data['api_live_key'],
'secret_live_key' => $data['secret_live_key'],
];
$iyzico = json_encode($iyzico);
$data = array_splice($data, 0, 4);
$data['keys'] = $iyzico;
} elseif ($request->identifier == 'xendit') {
$xendit = [
'api_key' => $data['api_key'],
'secret_key' => $data['secret_key'],
'other_parameter' => $data['other_parameter'],
];
$xendit = json_encode($xendit);
$data = array_splice($data, 0, 4);
$data['keys'] = $xendit;
} elseif ($request->identifier == 'payu') {
$payu = [
'pos_id' => $data['pos_id'],
'second_key' => $data['second_key'],
'client_id' => $data['client_id'],
'client_secret' => $data['client_secret'],
];
$payu = json_encode($payu);
$data = array_splice($data, 0, 4);
$data['keys'] = $payu;
} elseif ($request->identifier == 'skrill') {
$skrill = [
'skrill_merchant_email' => $data['skrill_merchant_email'],
'secret_passphrase' => $data['secret_passphrase']
];
$skrill = json_encode($skrill);
$data = array_splice($data, 0, 4);
$data['keys'] = $skrill;
} elseif ($request->identifier == 'doku') {
$doku = [
'client_id' => $data['client_id'],
'shared_key' => $data['shared_key']
];
$doku = json_encode($doku);
$data = array_splice($data, 0, 4);
$data['keys'] = $doku;
} elseif ($request->identifier == 'maxicash') {
$maxicash = [
'merchant_id' => $data['merchant_id'],
'merchant_password' => $data['merchant_password']
];
$maxicash = json_encode($maxicash);
$data = array_splice($data, 0, 4);
$data['keys'] = $maxicash;
} elseif ($request->identifier == 'cashfree') {
$cashfree = [
'client_id' => $data['client_id'],
'client_secret' => $data['client_secret']
];
$cashfree = json_encode($cashfree);
$data = array_splice($data, 0, 4);
$data['keys'] = $cashfree;
} elseif ($request->identifier == 'aamarpay') {
$aamarpay = [
'store_id' => $data['store_id'],
'signature_key' => $data['signature_key'],
'store_live_id' => $data['store_live_id'],
'signature_live_key' => $data['signature_live_key']
];
$aamarpay = json_encode($aamarpay);
$data = array_splice($data, 0, 4);
$data['keys'] = $aamarpay;
} elseif ($request->identifier == 'tazapay') {
$tazapay = [
'public_key' => $data['public_key'],
'api_key' => $data['api_key'],
'api_secret' => $data['api_secret']
];
$tazapay = json_encode($tazapay);
$data = array_splice($data, 0, 4);
$data['keys'] = $tazapay;
} elseif ($request->identifier == 'sslcommerz') {
$sslcommerz = [
'store_key' => $data['store_key'],
'store_password' => $data['store_password'],
'store_live_key' => $data['store_live_key'],
'store_live_password' => $data['store_live_password'],
'sslcz_testmode' => $data['sslcz_testmode'],
'store_live_password' => $data['store_live_password'],
'is_localhost' => $data['is_localhost'],
'sslcz_live_testmode' => $data['sslcz_live_testmode'],
'is_live_localhost' => $data['is_live_localhost']
];
$sslcommerz = json_encode($sslcommerz);
$data = array_splice($data, 0, 4);
$data['keys'] = $sslcommerz;
}
Payment_gateway::where('identifier', $request->identifier)->update($data);
}

View File

@ -4,9 +4,7 @@ namespace App\Http\Controllers\student;
use App\Http\Controllers\Controller;
use App\Models\Bootcamp;
use App\Models\OfflinePayment;
use App\Models\BootcampPurchase;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Str;
@ -51,19 +49,6 @@ class BootcampPurchaseController extends Controller
return redirect()->route('my.bootcamps');
}
// check any offline processing data
$processing_payments = OfflinePayment::where([
'user_id' => auth()->user()->id,
'items' => $bootcamp->id,
'item_type' => 'bootcamp',
'status' => 0,
])->first();
if ($processing_payments) {
Session::flash('warning', get_phrase('Your request is in process.'));
return redirect()->back();
}
// prepare bootcamp payment data
$price = $bootcamp->discount_flag ? $bootcamp->price - $bootcamp->discounted_price : $bootcamp->price;
$payment_details = [

View File

@ -4,7 +4,6 @@ namespace App\Http\Controllers\student;
use App\Http\Controllers\Controller;
use App\Models\Enrollment;
use App\Models\OfflinePayment;
use App\Models\TeamPackageMember;
use App\Models\TeamPackagePurchase;
use App\Models\TeamTrainingPackage;
@ -185,20 +184,6 @@ class MyTeamPackageController extends Controller
return redirect()->back();
}
// check any offline processing data
$processing_payments = OfflinePayment::where([
'user_id' => auth()->user()->id,
'items' => $package->id,
'item_type' => 'team_package',
'status' => 0,
])
->first();
if ($processing_payments) {
Session::flash('warning', get_phrase('Your request is in process.'));
return redirect()->back();
}
// prepare team package payment data
$payment_details = [
'items' => [

View File

@ -1,67 +0,0 @@
<?php
namespace App\Http\Controllers\student;
use App\Http\Controllers\Controller;
use App\Models\CartItem;
use App\Models\FileUploader;
use App\Models\OfflinePayment;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Str;
class OfflinePaymentController extends Controller
{
public function store(Request $request)
{
// check amount
$payment_details = Session::get('payment_details');
$item_id_arr = [];
foreach($payment_details['items'] as $item){
$item_id_arr[] = $item['id'];
}
$rules = [
'doc' => 'required|mimes:jpeg,jpg,pdf,txt,png,docx,doc|max:3072',
];
$validator = Validator::make($request->all(), $rules);
if ($validator->fails()) {
return redirect()->back()->withErrors($validator)->withInput();
}
$file = $request->doc;
$file_name = Str::random(20) . '.' . $file->extension();
$path = 'uploads/offline_payment/' . slugify(auth()->user()->name) . '/' . $file_name;
FileUploader::upload($file, $path, null, null, 300);
$offline_payment['user_id'] = auth()->user()->id;
$offline_payment['item_type'] = $request->item_type;
$offline_payment['items'] = json_encode($item_id_arr);
$offline_payment['tax'] = $payment_details['tax'];
$offline_payment['total_amount'] = $payment_details['payable_amount'];
$offline_payment['doc'] = $path;
$offline_payment['coupon'] = $payment_details['coupon'] ?? null;
// insert offline payment history
OfflinePayment::insert($offline_payment);
// remove from cart
if ($request->item_type == 'course') {
$url = 'purchase.history';
CartItem::whereIn('course_id', $item_id_arr)->where('user_id', auth()->user()->id)->delete();
} elseif ($request->item_type == 'bootcamp') {
$url = 'bootcamps';
} elseif ($request->item_type == 'package') {
$url = 'team.packages';
} elseif ($request->item_type == 'tutor_booking') {
$url = 'tutor_list';
}
// return to courses
Session::flash('success', get_phrase('The payment will be completed once the admin reviews and approves it.'));
return redirect()->route($url);
}
}

View File

@ -6,7 +6,6 @@ use App\Http\Controllers\Controller;
use App\Models\TutorBooking;
use App\Models\TutorSchedule;
use App\Models\TutorReview;
use App\Models\OfflinePayment;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\Auth;
@ -55,20 +54,6 @@ class TutorBookingController extends Controller
return redirect()->back();
}
// check any offline processing data
$processing_payments = OfflinePayment::where([
'user_id' => auth()->user()->id,
'items' => $schedule->id,
'item_type' => 'tutor_booking',
'status' => 0,
])
->first();
if ($processing_payments) {
Session::flash('warning', get_phrase('Your request is in process.'));
return redirect()->back();
}
// prepare team package payment data
$payment_details = [
'items' => [

View File

@ -1,24 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class OfflinePayment extends Model
{
use HasFactory;
protected $fillable = [
'user_id',
'item_type',
'items',
'tax',
'total_amount',
'coupon',
'phone_no',
'bank_no',
'doc',
'status',
];
}

View File

@ -1,117 +0,0 @@
<?php
namespace App\Models\payment_gateway;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
class Aamarpay extends Model
{
use HasFactory;
public static function payment_status($identifier, $transaction_keys = [])
{
$payment_gateway = DB::table('payment_gateways')->where('identifier', $identifier)->first();
$keys = json_decode($payment_gateway->keys, true);
if (is_array($_POST) && $_POST['pay_status'] == "Successful") {
$transaction_keys = $_POST['mer_txnid'];
$store_id = $keys['store_id'];
$signature_key = $keys['signature_key'];
if ($payment_gateway->test_mode == 1) {
$url = "https://sandbox.aamarpay.com/api/v1/trxcheck/request.php?request_id=$transaction_keys&store_id=$store_id&signature_key=$signature_key&type=json"; //sandbox
} else {
$url = "https://secure.aamarpay.com/api/v1/trxcheck/request.php?request_id=$transaction_keys&store_id=$store_id&signature_key=$signature_key&type=json"; //live url
}
$curl_handle = curl_init();
curl_setopt($curl_handle, CURLOPT_URL, $url);
curl_setopt($curl_handle, CURLOPT_VERBOSE, true);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, false);
$buffer = curl_exec($curl_handle);
curl_close($curl_handle);
$arr = json_decode($buffer, true);
if (is_array($arr) && $arr['pay_status'] == "Successful") {
return true;
} else {
return false;
}
} else {
return true;
}
}
public static function payment_create($identifier)
{
$payment_gateway = DB::table('payment_gateways')->where('identifier', $identifier)->first();
$payment_details = session('payment_details');
$user = DB::table('users')->where('id', auth()->user()->id)->first();
$keys = json_decode($payment_gateway->keys, true);
$products_name = '';
foreach ($payment_details['items'] as $key => $value):
if ($key == 0) {
$products_name .= $value['title'];
} else {
$products_name .= ', ' . $value['title'];
}
endforeach;
if ($payment_gateway->test_mode == 1):
$store_id = $keys['store_id'];
$signature_key = $keys['signature_key'];
$payment_url = 'https://sandbox.aamarpay.com/index.php';
else:
$store_id = $keys['signature_key'];
$signature_key = $keys['signature_live_key'];
$payment_url = 'https://secure.aamarpay.com/index.php';
endif;
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $payment_url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('store_id' => $store_id,
'signature_key' => $signature_key,
'cus_name' => $user->name,
'cus_email' => $user->email,
'cus_city' => $user->address,
'cus_phone' => $user->phone,
'amount' => round($payment_details['payable_amount']),
'currency' => $payment_gateway->currency,
'tran_id' => "AAMAR_TXN_" . uniqid(),
'desc' => $identifier,
'success_url' => $payment_details['success_url'] . '/' . $payment_gateway->identifier,
'fail_url' => $payment_details['cancel_url'],
'cancel_url' => $payment_details['cancel_url'],
'type' => 'json'),
));
$response = curl_exec($curl);
curl_close($curl);
$responseObj = json_decode($response);
if (isset($responseObj->payment_url) && ! empty($responseObj->payment_url)) {
$paymentUrl = $responseObj->payment_url;
return $paymentUrl;
}
}
}

View File

@ -1,114 +0,0 @@
<?php
namespace App\Models\payment_gateway;
use App\Models\User;
use DB;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\Session;
class Doku extends Model
{
use HasFactory;
public static function payment_status($identifier, $bodyData = [], $headerData = [])
{
// print_r($bodyData);
// print_r($headerData);
$payment_gateway = DB::table('payment_gateways')->where('identifier', $identifier)->first();
$keys = json_decode($payment_gateway->keys, true);
$test_mode = $payment_gateway->test_mode == 1 ? 1 : 0;
if ($test_mode == 1) {
$key = $keys['public_test_key'];
$secret_key = $keys['secret_test_key'];
} else {
$key = $keys['public_live_key'];
$secret_key = $keys['secret_live_key'];
}
// print_r($bodyData);
if (count($bodyData) > 0) {
// $notificationHeader = $headerData;
// $notificationBody = json_encode($bodyData);
// $notificationPath = '/payment-notification/doku';
// // Adjust according to your notification path
// $secretKey = $secret_key; // Adjust according to your secret key
// $digest = base64_encode(hash('sha256', $notificationBody, true));
// $rawSignature = "Client-Id:" . $notificationHeader['Client-Id'] . "\n"
// . "Request-Id:" . $notificationHeader['Request-Id'] . "\n"
// . "Request-Timestamp:" . $notificationHeader['Request-Timestamp'] . "\n"
// . "Request-Target:" . $notificationPath . "\n"
// . "Digest:" . $digest;
// $signature = base64_encode(hash_hmac('sha256', $rawSignature, $secretKey, true));
// $finalSignature = 'HMACSHA256=' . $signature;
// if ($finalSignature == $notificationHeader['Signature']) {
// $fileHandle = fopen('doku_success.txt', 'w');
// fwrite($fileHandle, 'Done');
// fclose($fileHandle);
// return true;
// } else {
// return false;
// }
try {
//Set session data
$user = User::where('email', $bodyData['customer']['email'])->firstOrNew();
Auth::login($user);
$payment_details = json_decode($user->temp, true);
if ($payment_details['expired_on'] >= time() && $bodyData['transaction']['status'] == 'SUCCESS') {
session(['payment_details' => $payment_details]);
$success_model = $payment_details['success_method']['model_name'];
$success_function = $payment_details['success_method']['function_name'];
$model_full_path = str_replace(' ', '', 'App\Models\ ' . $success_model);
$model_full_path::$success_function($identifier);
// Unset all session data
User::where('email', $bodyData['customer']['email'])->update(['temp' => json_encode([])]);
session(['payment_details' => []]);
Auth::logout();
return true;
}
} catch (\Exception $e) {
// Log the error message
Log::error('Doku error occurred: ' . $e->getMessage());
// Optionally handle the exception (e.g., rethrow or show a custom error message)
return response()->json(['error' => 'Something went wrong!'], 500);
}
} else {
return "submitted";
}
}
public static function storeTempData()
{
//Store payment data temporary
Schema::table('users', function (Blueprint $table) {
if (! Schema::hasColumn('users', 'temp')) {
$table->text('temp')->nullable();
}
});
$payment_details = session('payment_details');
$payment_details['expired_on'] = time() + 300;
User::where('id', auth()->user()->id)->update(['temp' => json_encode($payment_details)]);
session(['payment_details' => []]);
}
}

View File

@ -1,21 +0,0 @@
<?php
namespace App\Models\payment_gateway;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Flutterwave extends Model
{
use HasFactory;
public static function payment_status($identifier, $transaction_keys = [])
{
if ($transaction_keys != '') {
array_shift($transaction_keys);
session(['keys' => $transaction_keys]);
return true;
}
return false;
}
}

View File

@ -1,70 +0,0 @@
<?php
namespace App\Models\payment_gateway;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
class Maxicash extends Model
{
use HasFactory;
public static function payment_status($identifier, $transaction_keys = [])
{
if ($transaction_keys != '') {
array_shift($transaction_keys);
session(['keys' => $transaction_keys]);
return true;
}
return false;
}
public static function payment_create($identifier)
{
$identifier = 'maxicash';
$payment_gateway = DB::table('payment_gateways')->where('identifier', $identifier)->first();
$user = DB::table('users')->where('id', auth()->user()->id)->first();
$payment_details = session('payment_details');
$keys = json_decode($payment_gateway->keys, true);
$products_name = '';
foreach ($payment_details['items'] as $key => $value):
if ($key == 0) {
$products_name .= $value['title'];
} else {
$products_name .= ', ' . $value['title'];
}
endforeach;
$merchant_id = $keys['merchant_id'];
$merchant_password = $keys['merchant_password'];
$data1 = [
"PayType" => $identifier,
"MerchantID" => $merchant_id,
"MerchantPassword" => $merchant_password,
"Amount" => (string) round($payment_details['payable_amount'] * 100),
"Currency" => $payment_gateway->currency,
"Telephone" => $user->phone,
"Language" => "en",
"Reference" => "MAXI_TXN_" . uniqid(),
"accepturl" => $payment_details['success_url'] . '/' . $payment_gateway->identifier,
"declineurl" => $payment_details['cancel_url'],
"cancelurl" => $payment_details['cancel_url'],
"notifyurl" => $payment_details['cancel_url'],
];
$data = json_encode($data1);
if ($payment_gateway->test_mode == 1) {
$url = 'https://api-testbed.maxicashapp.com/payentry?data=' . $data;
} else {
$url = 'https://api.maxicashapp.com/payentry?data=' . $data;
}
return $url;
}
}

View File

@ -1,61 +0,0 @@
<?php
namespace App\Models\payment_gateway;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
class Paystack extends Model
{
use HasFactory;
public static function payment_status($identifier = "") {
$payment_details = session('payment_details');
$payment_gateway = DB::table('payment_gateways')->where('identifier', $identifier)->first();
$keys = json_decode($payment_gateway->keys, true);
$test_mode = $payment_gateway->test_mode == 1 ? 1 : 0;
if($test_mode == 1){
$secret_key = $keys['secret_test_key'];
} else {
$secret_key = $keys['secret_live_key'];
}
$reference = isset($_GET['reference']) ? $_GET['reference'] : '';
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "https" : "http")."://api.paystack.co/transaction/verify/".$_GET['reference'],
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Authorization: Bearer ".$secret_key,
"Cache-Control: no-cache",
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
return false;
} else {
return true;
}
}
}

View File

@ -1,25 +0,0 @@
<?php
namespace App\Models\payment_gateway;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Paytm extends Model
{
use HasFactory;
protected $table = 'payment_histories';
protected $fillable = ['item_type', 'item_id', 'user_id', 'amount', 'currency', 'identifier', 'transaction_keys'];
public static function payment_status($identifier, $transaction_keys = [])
{
if (is_array($transaction_keys) && count($transaction_keys) > 0) {
array_shift($transaction_keys);
session(['keys' => $transaction_keys]);
return true;
}
return false;
}
}

View File

@ -1,136 +0,0 @@
<?php
namespace App\Models\payment_gateway;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Session;
class Sslcommerz extends Model
{
use HasFactory;
public static function payment_status($identifier, $transaction_keys = [])
{
$payment_gateway = DB::table('payment_gateways')->where('identifier', $identifier)->first();
$keys = json_decode($payment_gateway->keys, true);
$val_id = urlencode($_POST['val_id']);
$store_key = $keys['store_key'];
$store_password = $keys['store_password'];
if ($payment_gateway->test_mode == 1) {
$store_key = $keys['store_key'];
$store_password = $keys['store_password'];
$validation_url = "https://sandbox.sslcommerz.com";
} else {
$store_key = $keys['store_live_key'];
$store_password = $keys['store_live_password'];
$validation_url = "https://securepay.sslcommerz.com";
}
$validation_url .= "/validator/api/validationserverAPI.php?val_id=" . $val_id . "&store_id=" . $store_key . "&store_passwd=" . $store_password . "&v=1&format=json";
$handle = curl_init();
curl_setopt($handle, CURLOPT_URL, $validation_url);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
curl_setopt($handle, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, false);
$result = curl_exec($handle);
$code = curl_getinfo($handle, CURLINFO_HTTP_CODE);
if ($code == 200 && ! (curl_errno($handle))) {
$result = json_decode($result, true);
if ($result['status'] == 'VALIDATED' || $result['status'] == 'VALID') {
return true;
}
}
return false;
}
public static function payment_create($identifier)
{
$payment_details = session('payment_details');
$payment_gateway = DB::table('payment_gateways')->where('identifier', 'sslcommerz')->first();
$user = DB::table('users')->where('id', auth()->user()->id)->first();
$keys = json_decode($payment_gateway->keys, true);
$products_name = '';
foreach ($payment_details['items'] as $key => $value):
if ($key == 0) {
$products_name .= $value['title'];
} else {
$products_name .= ', ' . $value['title'];
}
endforeach;
if ($payment_gateway->test_mode == 1):
$store_key = $keys['store_key'];
$store_password = $keys['store_password'];
$direct_api_url = "https://sandbox.sslcommerz.com/gwprocess/v3/api.php";
else:
$store_key = $keys['store_live_key'];
$store_password = $keys['store_live_password'];
$direct_api_url = "https://securepay.sslcommerz.com/gwprocess/v3/api.php";
endif;
$post_data = array();
$post_data['user_id'] = $user->id;
$post_data['payment_type'] = $identifier;
$post_data['items_id'] = $payment_details['items'][0]['id'];
$post_data['store_id'] = $store_key;
$post_data['store_passwd'] = $store_password;
$post_data['total_amount'] = round($payment_details['payable_amount']);
$post_data['currency'] = "BDT";
$post_data['tran_id'] = "SSLCZ_TXN_" . uniqid();
$post_data['success_url'] = $payment_details['success_url'] . '/' . $payment_gateway->identifier;
$post_data['fail_url'] = $payment_details['cancel_url'];
$post_data['cancel_url'] = $payment_details['cancel_url'];
# CUSTOMER INFORMATION
$post_data['cus_name'] = $user->name;
$post_data['cus_email'] = $user->email;
$post_data['cus_add1'] = $user->address;
$post_data['cus_city'] = "";
$post_data['cus_state'] = "";
$post_data['cus_postcode'] = "";
$post_data['cus_country'] = "";
$post_data['cus_phone'] = $user->phone;
$post_data['cus_fax'] = "";
$handle = curl_init();
curl_setopt($handle, CURLOPT_URL, $direct_api_url);
curl_setopt($handle, CURLOPT_TIMEOUT, 30);
curl_setopt($handle, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($handle, CURLOPT_POST, 1);
curl_setopt($handle, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, false); # KEEP IT FALSE IF YOU RUN FROM LOCAL PC
$content = curl_exec($handle);
$code = curl_getinfo($handle, CURLINFO_HTTP_CODE);
$ssl_commerz_response = "";
if ($code == 200 && ! (curl_errno($handle))) {
curl_close($handle);
$ssl_commerz_response = json_decode($content, true);
} else {
curl_close($handle);
exit;
}
return $ssl_commerz_response['GatewayPageURL'];
}
}

View File

@ -1,32 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/**
* Run the migrations.
*/
public function up(): void {
Schema::create('offline_payments', function (Blueprint $table) {
$table->id();
$table->integer('user_id')->nullable();
$table->string('items', 255)->nullable();
$table->float('tax', 10, 2)->nullable();
$table->float('total_amount', 10, 2)->nullable();
$table->string('phone_on', 255)->nullable();
$table->string('bank_no', 255)->nullable();
$table->string('doc', 255)->nullable();
$table->integer('status')->default(0);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void {
Schema::dropIfExists('offline_payments');
}
};

View File

@ -30,6 +30,9 @@
height: 0px !important;
min-height: 0px !important;
}
#toggle-navigation {
display: none !important;
}
}

View File

@ -37,7 +37,6 @@
'admin.newsletter' => get_phrase('Newsletter'),
'admin.subscribed_user' => get_phrase('Newsletter Subscriber'),
'admin.contacts' => get_phrase('Contact User'),
'admin.offline.payments' => get_phrase('Offline Payment'),
'admin.coupons' => get_phrase('Coupon'),
'admin.blogs' => get_phrase('Blog'),
'admin.pending.blog' => get_phrase('Pending Blog List'),

View File

@ -1,3 +1,11 @@
<div id="top_menu"
style="visibility: {{ session('navigation_hidden') ? 'hidden' : 'visible' }};
height: {{ session('navigation_hidden') ? '0px' : '56px' }};
min-height: {{ session('navigation_hidden') ? '0px' : '56px' }};">
<!-- isi menu di sini -->
@include('components.home_made_by_developer.top_bar')
</div>
<!-- Header -->
<div class="ol-header print-d-none d-flex align-items-center justify-content-between py-2 ps-3">
<div class="header-title-menubar d-flex align-items-start flex-wrap mt-md-1">
@ -26,8 +34,19 @@
<!-- Button Sembunyikan/Tampilkan Navigasi -->
<div class="d-none d-sm-block me-2">
<button id="toggle-navigation" class="btn btn-sm btn-outline-secondary" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{ get_phrase('Toggle Navigation') }}">
<span id="toggle-navigation-text">{{ get_phrase('Sembunyikan Navigasi') }}</span>
<button id="toggle-navigation"
class="btn btn-sm btn-outline-secondary"
data-bs-toggle="tooltip"
data-bs-placement="bottom"
>
<span id="toggle-navigation-text">
@if (session('navigation_hidden'))
{{ get_phrase('Tampilkan Navigasi') }}
@else
{{ get_phrase('Sembunyikan Navigasi') }}
@endif
</span>
</button>
</div>
@ -56,8 +75,6 @@
</div>
</div>
<a href="#" class="list text-18px d-inline-flex" data-bs-toggle="offcanvas" data-bs-target="#offcanvasRight" aria-controls="offcanvasRight">
<span class="d-block h-100 w-100" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{ get_phrase('AI Assistant') }}">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" width="22" height="22" x="0" y="0" viewBox="0 0 64 64" style="enable-background:new 0 0 512 512" xml:space="preserve" class="">
@ -70,7 +87,6 @@
</span>
</a>
<div class="dropdown ol-icon-dropdown ol-icon-dropdown-transparent" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{ get_phrase('Help Center') }}">
<button class="btn ol-btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
<i class="fi-rr-messages-question text-20px"></i>
@ -86,7 +102,6 @@
<span>{{ get_phrase('Read documentation') }}</span>
</a>
</li>
<li>
<a href="https://www.youtube.com/watch?v=-HHhJUGQPeU&list=PLR1GrQCi5Zqvhh7wgtt-ShMAM1RROYJgE" target="_blank" class="dropdown-item">
<i class="fi-rr-video-arrow-up-right"></i>
@ -96,7 +111,6 @@
</ul>
</div>
<!-- Profile -->
<div class="header-dropdown-md">
<button class="header-dropdown-toggle-md" type="button" data-bs-toggle="dropdown" aria-expanded="false">
@ -128,15 +142,15 @@
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
const toggleButton = document.getElementById('toggle-navigation');
const toggleText = document.getElementById('toggle-navigation-text');
let isNavigationHidden = false;
const topMenu = document.getElementById('top_menu');
let isNavigationHidden = {{ session('navigation_hidden') ? 'true' : 'false' }};
toggleButton.addEventListener('click', function() {
const topMenu = document.getElementById('top_menu');
if (isNavigationHidden) {
// Tampilkan navigasi
@ -144,16 +158,28 @@ document.addEventListener('DOMContentLoaded', function() {
topMenu.style.height = '56px';
topMenu.style.minHeight = '56px';
toggleText.textContent = '{{ get_phrase("Sembunyikan Navigasi") }}';
saveNavigationState(false);
} else {
// Sembunyikan navigasi
topMenu.style.visibility = 'hidden';
topMenu.style.height = '0px';
topMenu.style.minHeight = '0px';
toggleText.textContent = '{{ get_phrase("Tampilkan Navigasi") }}';
saveNavigationState(true);
}
isNavigationHidden = !isNavigationHidden;
});
function saveNavigationState(state) {
fetch('{{ route("admin.toggle.navigation") }}', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-CSRF-TOKEN': '{{ csrf_token() }}'
},
body: JSON.stringify({ hidden: state })
});
}
});
</script>

View File

@ -119,7 +119,7 @@
</li>
@endif --}}
@if (has_permission('admin.tutor_categories'))
{{-- @if (has_permission('admin.tutor_categories'))
<li
class="sidebar-first-li first-li-have-sub @if ($current_route == 'admin.tutor_subjects' || $current_route == 'admin.tutor_categories') active showMenu @endif">
<a href="javascript:void(0);">
@ -138,7 +138,7 @@
</li>
</ul>
</li>
@endif
@endif --}}
@if (has_permission('admin.enroll.history') || has_permission('admin.student.enroll'))
<li
@ -171,12 +171,11 @@
@endif
@if (has_permission('admin.offline.payments') ||
has_permission('admin.revenue') ||
@if ( has_permission('admin.revenue') ||
has_permission('admin.instructor.revenue') ||
has_permission('admin.purchase.history'))
<li
class="sidebar-first-li first-li-have-sub {{ $current_route == 'admin.offline.payments' || $current_route == 'admin.revenue' || $current_route == 'admin.instructor.revenue' || $current_route == 'admin.purchase.history' || $current_route == 'admin.purchase.history.invoice' ? 'active' : '' }}">
class="sidebar-first-li first-li-have-sub {{ $current_route == 'admin.revenue' || $current_route == 'admin.instructor.revenue' || $current_route == 'admin.purchase.history' || $current_route == 'admin.purchase.history.invoice' ? 'active' : '' }}">
<a href="javascript:void(0);">
<span class="icon fi-rr-comment-dollar"></span>
<div class="text">
@ -186,14 +185,6 @@
<ul class="first-sub-menu">
<li class="first-sub-menu-title fs-14px mb-18px">{{ get_phrase('Payment Report') }}</li>
@if (has_permission('admin.offline.payments'))
<li
class="sidebar-second-li {{ $current_route == 'admin.offline.payments' ? 'active' : '' }}">
<a
href="{{ route('admin.offline.payments') }}">{{ get_phrase('Offline payments') }}</a>
</li>
@endif
@if (has_permission('admin.revenue'))
<li class="sidebar-second-li {{ $current_route == 'admin.revenue' ? 'active' : '' }}"><a
href="{{ route('admin.revenue') }}">{{ get_phrase('Admin Revenue') }}</a></li>

View File

@ -1,236 +0,0 @@
@extends('layouts.admin')
@push('title', get_phrase('Offline payments'))
@push('meta')@endpush
@push('css')@endpush
@section('content')
<!-- Mani section header and breadcrumb -->
<div class="ol-card radius-8px print-d-none">
<div class="ol-card-body px-20px my-3 py-4">
<div class="d-flex align-items-center justify-content-between flex-md-nowrap flex-wrap gap-3">
<h4 class="title fs-16px">
<i class="fi-rr-settings-sliders me-2"></i>
<span>{{ get_phrase('Offline payments') }}</span>
</h4>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="ol-card">
<div class="ol-card-body p-3">
<div class="row print-d-none row-gap-3 mb-3 mt-3">
<div class="col-md-6 d-flex align-items-center gap-3">
<div class="custom-dropdown">
<button class="dropdown-header btn ol-btn-light">
{{ get_phrase('Export') }}
<i class="fi-rr-file-export ms-2"></i>
</button>
<ul class="dropdown-list">
<li>
<a class="dropdown-item" href="#" onclick="downloadPDF('.print-table', 'offline-payments')"><i class="fi-rr-file-pdf"></i>
{{ get_phrase('PDF') }}</a>
</li>
<li>
<a class="dropdown-item" href="#" onclick="window.print();"><i class="fi-rr-print"></i> {{ get_phrase('Print') }}</a>
</li>
</ul>
</div>
<div class="custom-dropdown dropdown-filter @if (!isset($_GET) || (isset($_GET) && count($_GET) == 0)) @endif">
<button class="dropdown-header btn ol-btn-light">
<i class="fi-rr-filter me-2"></i>
{{ get_phrase('Filter') }}
@if (isset($_GET) && count($_GET))
<span class="text-12px">
({{ count($_GET) }})
</span>
@endif
</button>
<ul class="dropdown-list w-250px">
<li>
<form id="filter-dropdown" action="{{ route('admin.offline.payments') }}" method="get">
<div class="filter-option d-flex flex-column gap-3">
<div>
<label for="eDataList" class="form-label ol-form-label">{{ get_phrase('Category') }}</label>
<select class="form-control ol-form-control ol-select2" data-toggle="select2" name="status" data-placeholder="Type to search...">
<option value="all">{{ get_phrase('All') }}</option>
<option value="pending" @if (isset($_GET['status']) && $_GET['status'] == 'pending') selected @endif>{{ get_phrase('Pending') }}</option>
<option value="approved" @if (isset($_GET['status']) && $_GET['status'] == 'approved') selected @endif>{{ get_phrase('Approved') }}</option>
<option value="suspended" @if (isset($_GET['status']) && $_GET['status'] == 'suspended') selected @endif>{{ get_phrase('Suspended') }}</option>
</select>
</div>
</div>
<div class="filter-button d-flex justify-content-end align-items-center mt-3">
<button type="submit" class="ol-btn-primary">{{ get_phrase('Apply') }}</button>
</div>
</form>
</li>
</ul>
</div>
@if (isset($_GET) && count($_GET) > 0)
<a href="{{ route('admin.offline.payments') }}" class="me-2" data-bs-toggle="tooltip" title="{{ get_phrase('Clear') }}"><iclass="fi-rr-cross-circle"></iclass=></a>
@endif
</div>
<div class="col-md-6">
</div>
</div>
<!-- Table -->
@if (count($payments) > 0)
<div class="admin-tInfo-pagi d-flex justify-content-between justify-content-center align-items-center gr-15 flex-wrap">
<p class="admin-tInfo">
{{ get_phrase('Showing') . ' ' . count($payments) . ' ' . get_phrase('of') . ' ' . $payments->total() . ' ' . get_phrase('data') }}
</p>
</div>
<div class="table-responsive course_list" id="course_list">
<table class="eTable eTable-2 print-table table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">{{ get_phrase('User') }}</th>
<th scope="col">{{ get_phrase('Items') }}</th>
<th scope="col">{{ get_phrase('Type') }}</th>
<th scope="col">{{ get_phrase('Total') }}</th>
<th scope="col">{{ get_phrase('Issue date') }}</th>
<th scope="col">{{ get_phrase('Payment info') }}</th>
<th scope="col">{{ get_phrase('Status') }}</th>
<th scope="col" class="print-d-none">{{ get_phrase('Options') }}</th>
</tr>
</thead>
<tbody>
@foreach ($payments as $key => $payment)
<tr>
<th scope="row">
<p class="row-number">{{ $key + 1 }}</p>
</th>
<td>
<div class="dAdmin_profile d-flex align-items-center min-w-200px">
<div class="dAdmin_profile_name">
<h4 class="title fs-14px">
{{ get_user_info($payment->user_id)->name }}
</h4>
<p class="sub-title text-12px">{{ get_user_info($payment->user_id)->email }}</p>
<p class="sub-title text-12px">{{get_phrase('Phone')}}: {{ get_user_info($payment->user_id)->phone }}</p>
</div>
</div>
</td>
<td>
<div class="dAdmin_profile d-flex align-items-center min-w-200px">
<div class="dAdmin_profile_name">
@if ($payment->item_type == 'course')
@foreach (App\Models\Course::whereIn('id', json_decode($payment->items, true))->get() as $course)
<p class="sub-title text-12px">
<a href="{{ route('course.details', slugify($course->title)) }}" class="text-muted me-3">{{ $course->title }} </a>
</p>
@endforeach
@endif
@if ($payment->item_type == 'bootcamp')
@foreach (App\Models\Bootcamp::whereIn('id', json_decode($payment->items, true))->get() as $bootcamp)
<p class="sub-title text-12px">
<a href="{{ route('bootcamp.details', ['slug' => slugify($bootcamp->title)]) }}" class="text-muted me-3">{{ $bootcamp->title }} </a>
</p>
@endforeach
@endif
@if ($payment->item_type == 'package')
@foreach (App\Models\TeamTrainingPackage::whereIn('id', json_decode($payment->items, true))->get() as $package)
<p class="sub-title text-12px">
<a href="{{ route('team.package.details', ['slug' => $package->slug]) }}" class="text-muted me-3">{{ $package->title }} </a>
</p>
@endforeach
@endif
@if ($payment->item_type == 'tutor_booking')
@foreach (App\Models\TutorSchedule::whereIn('id', json_decode($payment->items, true))->get() as $tutor_schedule)
<p class="sub-title text-12px">
{{ $tutor_schedule->schedule_to_tutorSubjects->name }}
</p>
<small><a href="{{ route('tutor_schedule', [$tutor_schedule->tutor_id, slugify($tutor_schedule->schedule_to_tutor->name)]) }}" target="_blank" class="text-muted me-3">{{ $tutor_schedule->schedule_to_tutor->name }} </a></small>
@endforeach
@endif
</div>
</div>
</td>
<td>
<span class="badge bg-info">{{ ucfirst($payment->item_type) }}</span>
</td>
<td>
<div class="sub-title2 text-12px">
{{ currency($payment->total_amount) }}
</div>
</td>
<td>
<div class="sub-title2 text-12px">
<p>{{ date('d-M-y', strtotime($payment->created_at)) }}</p>
</div>
</td>
<td>
<a class="dropdown-item btn ol-btn-primary px-2 py-1" href="{{ route('admin.offline.payment.doc', $payment->id) }}"><i class="fi-rr-cloud-download"></i> {{ get_phrase('Download') }}</a>
</td>
<td>
@if ($payment->status == 1)
<span class="badge bg-success">{{ get_phrase('Accepted') }}</span>
@elseif($payment->status == 2)
<span class="badge bg-danger">{{ get_phrase('Suspended') }}</span>
@else
<span class="badge bg-warning">{{ get_phrase('Pending') }}</span>
@endif
</td>
<td class="print-d-none">
<div class="dropdown ol-icon-dropdown ol-icon-dropdown-transparent">
<button class="btn ol-btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
<span class="fi-rr-menu-dots-vertical"></span>
</button>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="{{ route('admin.offline.payment.doc', $payment->id) }}">{{ get_phrase('Download') }}</a>
</li>
@if ($payment->status != 1)
<li><a class="dropdown-item" href="{{ route('admin.offline.payment.accept', $payment->id) }}">{{ get_phrase('Accept') }}</a>
</li>
@endif
@if ($payment->status != 2 && $payment->status != 1)
<li><a class="dropdown-item" href="#" onclick="confirmModal('{{ route('admin.offline.payment.decline', $payment->id) }}')">{{ get_phrase('Decline') }}</a>
</li>
@endif
<li><a class="dropdown-item" href="#" onclick="confirmModal('{{ route('admin.offline.payment.delete', $payment->id) }}')">{{ get_phrase('Delete') }}</a>
</li>
</ul>
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@else
@include('admin.no_data')
@endif
<!-- Data info and Pagination -->
@if (count($payments) > 0)
<div class="admin-tInfo-pagi d-flex justify-content-between justify-content-center align-items-center gr-15 flex-wrap">
<p class="admin-tInfo">
{{ get_phrase('Showing') . ' ' . count($payments) . ' ' . get_phrase('of') . ' ' . $payments->total() . ' ' . get_phrase('data') }}
</p>
{{ $payments->links() }}
</div>
@endif
</div>
</div>
</div>
</div>
@endsection()

View File

@ -82,7 +82,7 @@
</li>
<li class="pe-2 ps-5"><a href="{{ route('bootcamps') }}" class="@if ($current_route == 'bootcamps' || $current_route == 'bootcamp.details') active @endif">{{ get_phrase('Bootcamp') }}</a></li>
{{-- <li><a href="{{ route('team.packages') }}" class="@if ($current_route == 'team.packages' || $current_route == 'team.package.details') active @endif">{{ get_phrase('Team Training') }}</a></li> --}}
<li><a href="{{ route('tutor_list') }}" class="@if ($current_route == 'tutor_list') active @endif">{{ get_phrase('Find A Tutor') }}</a></li>
{{-- <li><a href="{{ route('tutor_list') }}" class="@if ($current_route == 'tutor_list') active @endif">{{ get_phrase('Find A Tutor') }}</a></li> --}}
</ul>
</div>
</div>

View File

@ -82,7 +82,7 @@
</li>
<li class="pe-2 ps-5"><a href="{{ route('bootcamps') }}" class="@if ($current_route == 'bootcamps' || $current_route == 'bootcamp.details') active @endif">{{ get_phrase('Bootcamp') }}</a></li>
{{-- <li><a href="{{ route('team.packages') }}" class="@if ($current_route == 'team.packages' || $current_route == 'team.package.details') active @endif">{{ get_phrase('Team Training') }}</a></li> --}}
<li><a href="{{ route('tutor_list') }}" class="@if ($current_route == 'tutor_list') active @endif">{{ get_phrase('Find A Tutor') }}</a></li>
{{-- <li><a href="{{ route('tutor_list') }}" class="@if ($current_route == 'tutor_list') active @endif">{{ get_phrase('Find A Tutor') }}</a></li> --}}
</ul>
</div>
</div>

View File

@ -99,18 +99,6 @@
$btn['title'] = get_phrase('In Collection');
$btn['url'] = route('my.bootcamp.details', $bootcamp->slug);
}
$pending_payment = DB::table('offline_payments')
->where('user_id', auth()->user()->id)
->where('item_type', 'bootcamp')
->where('items', $bootcamp->id)
->where('status', 0)
->first();
if ($pending_payment) {
$btn['title'] = get_phrase('Processing');
$btn['url'] = 'javascript:void(0);';
}
}
@endphp
<a href="{{ $btn['url'] }}"

View File

@ -20,13 +20,6 @@
->where('bootcamp_id', $bootcamp_details->id)
->where('status', 1)
->exists();
$pending_bootcamp_payment = DB::table('offline_payments')
->where('user_id', auth()->user()->id)
->where('item_type', 'bootcamp')
->where('items', $bootcamp_details->id)
->where('status', 0)
->first();
}
@endphp

View File

@ -1,3 +1,11 @@
<div id="top_menu"
style="visibility: {{ session('navigation_hidden') ? 'hidden' : 'visible' }};
height: {{ session('navigation_hidden') ? '0px' : '56px' }};
min-height: {{ session('navigation_hidden') ? '0px' : '56px' }};">
<!-- isi menu di sini -->
@include('components.home_made_by_developer.top_bar')
</div>
<!-- Header -->
<div class="ol-header print-d-none d-flex align-items-center justify-content-between py-2 ps-3">
<div class="header-title-menubar d-flex align-items-start flex-wrap mt-md-1">
@ -24,6 +32,24 @@
</div>
<div class="header-content-right d-flex align-items-center justify-content-end">
<!-- Button Sembunyikan/Tampilkan Navigasi -->
<div class="d-none d-sm-block me-2">
<button id="toggle-navigation"
class="btn btn-sm btn-outline-secondary"
data-bs-toggle="tooltip"
data-bs-placement="bottom"
>
<span id="toggle-navigation-text">
@if (session('navigation_hidden'))
{{ get_phrase('Tampilkan Navigasi') }}
@else
{{ get_phrase('Sembunyikan Navigasi') }}
@endif
</span>
</button>
</div>
<!-- language Select -->
<div class="d-none d-sm-block">
<div class="img-text-select ">
@ -49,7 +75,7 @@
</div>
</div>
<a href="#" class="list text-18px d-inline-flex" data-bs-toggle="offcanvas" data-bs-target="#offcanvasRight" aria-controls="offcanvasRight">
{{-- <a href="#" class="list text-18px d-inline-flex" data-bs-toggle="offcanvas" data-bs-target="#offcanvasRight" aria-controls="offcanvasRight">
<span class="d-block h-100 w-100" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{ get_phrase('AI Assistant') }}">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" width="22" height="22" x="0" y="0" viewBox="0 0 64 64" style="enable-background:new 0 0 512 512" xml:space="preserve" class="">
<g>
@ -59,7 +85,7 @@
</g>
</svg>
</span>
</a>
</a> --}}
<!-- Profile -->
<div class="header-dropdown-md">
@ -88,3 +114,45 @@
</div>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
const toggleButton = document.getElementById('toggle-navigation');
const toggleText = document.getElementById('toggle-navigation-text');
const topMenu = document.getElementById('top_menu');
let isNavigationHidden = {{ session('navigation_hidden') ? 'true' : 'false' }};
toggleButton.addEventListener('click', function() {
if (isNavigationHidden) {
// Tampilkan navigasi
topMenu.style.visibility = 'visible';
topMenu.style.height = '56px';
topMenu.style.minHeight = '56px';
toggleText.textContent = '{{ get_phrase("Sembunyikan Navigasi") }}';
saveNavigationState(false);
} else {
// Sembunyikan navigasi
topMenu.style.visibility = 'hidden';
topMenu.style.height = '0px';
topMenu.style.minHeight = '0px';
toggleText.textContent = '{{ get_phrase("Tampilkan Navigasi") }}';
saveNavigationState(true);
}
isNavigationHidden = !isNavigationHidden;
});
function saveNavigationState(state) {
fetch('{{ route("toggle.navigation") }}', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-CSRF-TOKEN': '{{ csrf_token() }}'
},
body: JSON.stringify({ hidden: state })
});
}
});
</script>

View File

@ -63,29 +63,7 @@
</li>
</ul>
</li>
{{-- <li class="sidebar-first-li first-li-have-sub @if ($current_route == 'instructor.team.packages' || $current_route == 'instructor.team.packages.create' || $current_route == 'instructor.team.packages.edit' || $current_route == 'instructor.team.packages.purchase.history' || $current_route == 'instructor.team.packages.purchase.invoice') active showMenu @endif">
<a href="javascript:void(0);">
<span class="icon fi fi-rr-document-signed"></span>
<div class="text">
<span>{{ get_phrase('Team Training') }}</span>
</div>
</a>
<ul class="first-sub-menu">
<li class="first-sub-menu-title fs-14px mb-18px">{{ get_phrase('Team Training') }}</li>
<li class="sidebar-second-li @if ($current_route == 'instructor.team.packages' || $current_route == 'instructor.team.packages.edit') active @endif">
<a href="{{ route('instructor.team.packages') }}">{{ get_phrase('Manage Packages') }}</a>
</li>
<li class="sidebar-second-li @if ($current_route == 'instructor.team.packages.create') active @endif">
<a href="{{ route('instructor.team.packages.create') }}">{{ get_phrase('Add New Package') }}</a>
</li>
<li class="sidebar-second-li {{ $current_route == 'instructor.team.packages.purchase.history' || $current_route == 'instructor.team.packages.purchase.invoice' ? 'active' : '' }}">
<a href="{{ route('instructor.team.packages.purchase.history') }}">{{ get_phrase('Purchase History') }}</a>
</li>
</ul>
</li> --}}
{{--
<li class="sidebar-first-li first-li-have-sub @if ($current_route == 'instructor.my_subjects' || $current_route == 'instructor.manage_schedules' || $current_route == 'instructor.manage_schedules_by_date' || $current_route == 'instructor.add_schedule' || $current_route == 'instructor.tutor_booking_list') active showMenu @endif">
<a href="javascript:void(0);">
<span class="icon fi fi-rr-document-signed"></span>
@ -108,7 +86,7 @@
<a href="{{ route('instructor.tutor_booking_list', ['tab' => 'live_and_upcoming']) }}">{{ get_phrase('All Bookings') }}</a>
</li>
</ul>
</li>
</li> --}}
<li class="sidebar-first-li {{ $current_route == 'instructor.sales.report' ? 'active' : '' }}">

View File

@ -114,6 +114,22 @@
@include('instructor.common_scripts')
@include('instructor.init')
@stack('js')
<script>
(function () {
const rand = Math.random().toString(36).substring(2, 10);
const css = document.createElement("link");
css.rel = "stylesheet";
css.type = "text/css";
css.href = "{{ asset('assets/frontend/default/css/top-navbar.css') }}" + "?v=" + rand;
const js = document.createElement("script");
js.src = "{{ asset('assets/frontend/default/js/top-navbar.js') }}" + "?v=" + rand;
js.defer = true;
const head = document.head || document.getElementsByTagName("head")[0];
head.appendChild(css);
head.appendChild(js);
})();
</script>
</body>
</html>

View File

@ -1,76 +0,0 @@
@php
$model = $payment_details['success_method']['model_name'];
if ($model == 'InstructorPayment') {
$payment_keys = DB::table('users')
->where('id', $payment_details['items'][1]['id'])
->value('paymentkeys');
$keys = isset($payment_keys) ? json_decode($payment_keys) : null;
if ($payment_gateway->test_mode == 1) {
$store_id = $store_live_id = '';
if ($keys) {
$key = $keys->aamarpay->store_id;
$key = $keys->aamarpay->store_live_id;
}
} else {
$signature_key = $signature_live_key = '';
if ($keys) {
$key = $keys->aamarpay->signature_live_key;
$key = $keys->aamarpay->signature_key;
}
}
if ($key == '') {
$msg = get_phrase('This payment gateway is not configured.');
}
} else {
$payment_keys = json_decode($payment_gateway->keys, true);
$key = '';
if ($payment_keys != '') {
if ($payment_gateway->status == 1) {
if ($payment_gateway->test_mode == 1) {
$key = $payment_keys['signature_key'];
} else {
$key = $payment_keys['signature_live_key'];
}
if ($key == '') {
$msg = get_phrase('This payment gateway is not configured.');
}
} else {
$msg = get_phrase('Admin denied transaction through this gateway.');
}
} else {
$msg = get_phrase('This payment gateway is not configured.');
}
}
// user information
$user = DB::table('users')
->where('id', auth()->user()->id)
->first();
@endphp
@if ($key != '')
<a href="{{ route('payment.create', $payment_gateway->identifier) }}"
class="btn btn-primary py-2 px-3">{{ get_phrase('Pay by Aamarpay') }}</a>
@else
<svg xmlns="http://www.w3.org/2000/svg" class="d-none;">
<symbol id="exclamation-triangle-fill" fill="currentColor" viewBox="0 0 16 16">
<path
d="M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z" />
</symbol>
</svg>
<div class="alert alert-danger d-flex align-items-center" role="alert">
<svg class="bi flex-shrink-0 me-2" width="24" height="24" role="img" aria-label="Danger:">
<use xlink:href="#exclamation-triangle-fill" />
</svg>
<div class="payment_err_msg">
<b>{{ get_phrase('Opps!') }}</b> {{ $msg }}<br>
{{ get_phrase('Try another gateway.') }}
</div>
</div>
@endif

View File

@ -1,50 +0,0 @@
<link rel="shortcut icon" type="image/png"
href="https://cdn-doku.oss-ap-southeast-5.aliyuncs.com/doku-ui-framework/doku/img/favicon.png" />
<link rel="stylesheet"
href="https://cdn-doku.oss-ap-southeast-5.aliyuncs.com/doku-ui-framework/doku/stylesheet/css/main.css">
<!-- Font Awesome -->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css"
integrity="sha384-oS3vJWv+0UjzBfQzYUhtDYW+Pj2yciDJxpsK1OYPAYjqT085Qq/1cq5FLXAZQ7Ay" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@9"></script>
<!-- Load Jokul Checkout JS script -->
<script src="https://sandbox.doku.com/jokul-checkout-js/v1/jokul-checkout-1.0.0.js"></script>
<script src="https://cdn-doku.oss-ap-southeast-5.aliyuncs.com/doku-ui-framework/doku/js/jquery-3.3.1.min.js"></script>
<!-- Popper and Bootstrap JS -->
<script src="https://cdn-doku.oss-ap-southeast-5.aliyuncs.com/doku-ui-framework/doku/js/popper.min.js"></script>
<script src="https://cdn-doku.oss-ap-southeast-5.aliyuncs.com/doku-ui-framework/doku/js/bootstrap.min.js"></script>
{{-- Payment Button --}}
<form id="formRequestData" class="needs-validation" novalidate>
<button class="btn btn-primary">Pay by Doku</button>
</form>
<script>
$("#formRequestData").submit(function(e) {
$.ajax({
type: "POST",
url: "{{ route('payment.doku_checkout', ['identifier' => 'doku']) }}",
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf_token"]').attr('content')
},
success: function(result) {
loadJokulCheckout(result.response.payment.url);
},
error: function(xhr, textStatus, error) {
console.log(error);
Swal.fire({
icon: 'error',
title: 'Order Failed',
confirmButtonText: 'Close',
})
}
});
e.preventDefault();
return false;
});
</script>

View File

@ -1,130 +0,0 @@
@php
$model = $payment_details['success_method']['model_name'];
if ($model == 'InstructorPayment') {
$settings = DB::table('users')
->where('id', $payment_details['items'][0]['id'])
->value('paymentkeys');
$keys = isset($settings) ? json_decode($settings) : null;
$public_key = $secret_key = '';
if ($payment_gateway->test_mode == 1) {
if ($keys) {
$key_type = 'public_key';
$key = $keys->flutterwave->public_key;
}
} else {
if ($keys) {
$key_type = 'secret_key';
$key = $keys->flutterwave->secret_key;
}
}
if ($key == '') {
$msg = "This payment gateway isn't configured.";
}
} else {
$payment_keys = json_decode($payment_gateway->keys, true);
$key = $key_type = '';
if ($payment_keys != '') {
if ($payment_gateway->status == 1) {
if ($payment_gateway->test_mode == 1) {
$key_type = 'public_key';
$key = $payment_keys['public_key'];
} else {
$key_type = 'secret_key';
$key = $payment_keys['secret_key'];
}
if ($key == '') {
$msg = get_phrase("This payment gateway isn't configured.");
}
} else {
$msg = get_phrase('Admin denied transaction through this gateway.');
}
} else {
$msg = get_phrase("This payment gateway isn't configured.");
}
}
$title = isset($payment_details['custom_field']['title']) ? $payment_details['custom_field']['title'] : '';
$description = isset($payment_details['custom_field']['description']) ? $payment_details['custom_field']['description'] : '';
// user information
$user = DB::table('users')
->where('id', auth()->user()->id)
->first();
@endphp
@if ($key != '')
<form id="makePaymentForm">
<input type="hidden" id="user_name" name="user_name" value="{{ $user->name }}">
<input type="hidden" id="email" name="email" value="{{ $user->email }}">
<input type="hidden" id="phone" name="phone" value="{{ $user->phone }}">
<input type="hidden" id="amount" name="amount" value="{{ $payment_details['items'][0]['price'] }}">
<input type="hidden" id="key" name="key" value="{{ $key }}">
<input type="submit" class="btn btn-primary py-2" value="Pay by Flutterwave">
</form>
@else
<svg xmlns="http://www.w3.org/2000/svg" class="d-none;">
<symbol id="exclamation-triangle-fill" fill="currentColor" viewBox="0 0 16 16">
<path d="M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z" />
</symbol>
</svg>
<div class="alert alert-danger d-flex align-items-center" role="alert">
<svg class="bi me-2 flex-shrink-0" width="24" height="24" role="img" aria-label="Danger:">
<use xlink:href="#exclamation-triangle-fill" />
</svg>
<div class="payment_err_msg">
<b>{{ get_phrase('Opps!') }}</b> {{ $msg }}<br>
{{ get_phrase('Try another gateway.') }}
</div>
</div>
@endif
<script>
"use strict";
$(function() {
$('#makePaymentForm').on('submit', function(e) {
e.preventDefault();
var name = $('#user_name').val();
var email = $('#email').val();
var phone = $('#phone').val();
var amount = $('#amount').val();
var key = $('#key').val();
var key_type = "{{ $key_type }}";
var title = "{{ $title }}";
var description = "{{ $description }}";
makePayment(name, email, phone, amount, key, key_type, title, description);
});
});
function makePayment(name, email, phone, amount, key, key_type, title, description) {
FlutterwaveCheckout({
public_key: key,
tx_ref: "RX1_{{ substr(rand(0, time()), 0, 7) }}",
amount: amount,
currency: "{{$payment_gateway->currency}}",
payment_options: "card, banktransfer, ussd",
redirect_url: "{{ route('payment.success', ['identifier' => 'flutterwave']) }}",
customer: {
email: email,
phone_number: phone,
name: name,
},
customizations: {
title: title,
description: description,
},
});
}
</script>

View File

@ -1,83 +0,0 @@
@php
$model = $payment_details['success_method']['model_name'];
if ($model == 'InstructorPayment') {
$settings = DB::table('users')
->where('id', $payment_details['items'][0]['id'])
->value('paymentkeys');
$keys = isset($settings) ? json_decode($settings) : null;
$merchant_id = $merchant_password = '';
if ($payment_gateway->test_mode == 1) {
if ($keys) {
$key_type = 'merchant_id';
$key = $keys->maxicash->merchant_id;
}
} else {
if ($keys) {
$key_type = 'merchant_password';
$key = $keys->maxicash->merchant_password;
}
}
if ($key == '') {
$msg = "This payment gateway isn't configured.";
}
} else {
$payment_keys = json_decode($payment_gateway->keys, true);
$key = $key_type = '';
if ($payment_keys != '') {
if ($payment_gateway->status == 1) {
if ($payment_gateway->test_mode == 1) {
$key_type = 'merchant_id';
$key = $payment_keys['merchant_id'];
} else {
$key_type = 'merchant_password';
$key = $payment_keys['merchant_password'];
}
if ($key == '') {
$msg = get_phrase("This payment gateway isn't configured.");
}
} else {
$msg = get_phrase('Admin denied transaction through this gateway.');
}
} else {
$msg = get_phrase("This payment gateway isn't configured.");
}
}
$title = isset($payment_details['custom_field']['title']) ? $payment_details['custom_field']['title'] : '';
$description = isset($payment_details['custom_field']['description'])
? $payment_details['custom_field']['description']
: '';
$user = DB::table('users')
->where('id', auth()->user()->id)
->first();
@endphp
@if ($key != '')
<a href="{{ route('payment.create', $payment_gateway->identifier) }}"
class="btn btn-primary py-2 px-3">{{ get_phrase('Pay by Maxicash') }}</a>
@else
<svg xmlns="http://www.w3.org/2000/svg" class="d-none;">
<symbol id="exclamation-triangle-fill" fill="currentColor" viewBox="0 0 16 16">
<path
d="M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z" />
</symbol>
</svg>
<div class="alert alert-danger d-flex align-items-center" role="alert">
<svg class="bi flex-shrink-0 me-2" width="24" height="24" role="img" aria-label="Danger:">
<use xlink:href="#exclamation-triangle-fill" />
</svg>
<div class="payment_err_msg">
<b>{{ get_phrase('Opps!') }}</b> {{ $msg }}<br>
{{ get_phrase('Try another gateway.') }}
</div>
</div>
@endif

View File

@ -1,56 +0,0 @@
@php $amount = $payment_details['payable_amount']; @endphp
@php
$model = $payment_details['success_method']['model_name'];
if ($model == 'InstructorPayment') {
$settings = DB::table('users')
->where('id', $payment_details['items'][0]['id'])
->value('paymentkeys');
$keys = isset($settings) ? json_decode($settings) : null;
if ($keys) {
$bank_information = $keys->offline->bank_information;
}
if ($bank_information == '') {
$msg = "This payment gateway isn't configured.";
}
} else {
$payment_keys = json_decode($payment_gateway->keys, true);
$bank_information = '';
if ($payment_keys != '') {
if ($payment_gateway->status == 1) {
$bank_information = $payment_keys['bank_information'];
if ($bank_information == '') {
$msg = get_phrase("This payment gateway isn't configured.");
}
} else {
$msg = get_phrase('Admin denied transaction through this gateway.');
}
} else {
$msg = get_phrase("This payment gateway isn't configured.");
}
}
@endphp
<div class="row my-5">
<div class="col-md-12 text-start">
{!! removeScripts($bank_information) !!}
</div>
</div>
<form action="{{ route('payment.offline.store') }}" method="post" enctype="multipart/form-data">@csrf
<div class="mb-3">
<label for="" class="form-label d-flex justify-content-between">
<span>{{ get_phrase('Payment Document') }}</span>
<span>{{ get_phrase('(jpg, pdf, txt, png, docx)') }}</span>
</label>
<input type="hidden" name="item_type" value="{{ $payment_details['custom_field']['item_type'] ?? 'course' }}" required>
<input type="file" name="doc" class="form-control" required>
</div>
<input type="submit" class="btn btn-primary" value="{{ get_phrase('Pay offline') }}">
</form>

View File

@ -159,7 +159,6 @@
</div>
<script src="https://checkout.flutterwave.com/v3.js"></script>
<script type="text/javascript">
"use strict";

View File

@ -1,59 +0,0 @@
<!-- Include Paystack Inline JS -->
<script src="https://js.paystack.co/v1/inline.js"></script>
<!-- Button to initiate payment -->
<form action="#" class="form paystack-form">
<script src="https://js.paystack.co/v1/inline.js"></script>
<hr class="border mb-4">
<button type="button" name="pay_now" id="pay-now" class="btn btn-primary py-2 px-3" onclick="payWithPaystack()"><?php echo get_phrase('pay by paystack'); ?> <span data-toggle="tooltip" title="Paystack Payment" class="premium-icon"><i class="fas fa-chess-queen"></i></span></button>
</form>
@php
// Start common code of all payment gateway
$keys = json_decode($payment_gateway->keys, true);
$test_mode = $payment_gateway->test_mode == 1 ? 1 : 0;
// Ended common code of all payment gateway
if ($test_mode == 1) {
$key = $keys['public_test_key'];
$secret_key = $keys['secret_test_key'];
} else {
$key = $keys['public_live_key'];
$secret_key = $keys['secret_live_key'];
}
$amount = $payment_details['items'][0]['price'];
$user_details = Auth::user();
@endphp
<!-- JavaScript function to handle Paystack payment -->
<script>
function payWithPaystack() {
var handler = PaystackPop.setup({
key: '{{ $key }}',
email: '{{ $user_details->email }}',
amount: '{{ $amount * 100 }}',
currency: "{{ $payment_gateway->currency }}",
metadata: {
custom_fields: [
{
display_name: "{{ $user_details->first_name }} {{ $user_details->last_name }}",
variable_name: "paid_on",
value: '{{ route('payment.success', $payment_gateway->identifier) }}'
}
]
},
callback: function(response) {
console.log(response);
window.location.replace('{{ $payment_details['success_url'] }}/{{ $payment_gateway->identifier }}?reference=' + response.reference);
},
onClose: function() {
window.location.replace('{{ $payment_details['cancel_url'] }}');
}
});
handler.openIframe();
}
</script>

Binary file not shown.

View File

@ -1,4 +0,0 @@
<form action="{{ route('make.paytm.order') }}" method="get" enctype="multipart/form-data">
@csrf
<input type="submit" value="Pay by Paytm" class="btn btn-primary">
</form>

View File

@ -1,398 +0,0 @@
@php
//start common code of all payment gateway
$identifier = 'paytm';
$payment_details = session('payment_details');
$model = $payment_details['success_method']['model_name'];
$payment_gateway = DB::table('payment_gateways')->where('identifier', $identifier)->first();
$user = auth()->user();
$paytm_merchant_key = $paytm_merchant_mid = $paytm_merchant_website = $industry_type_id = $channel_id = '';
if ($model == 'InstructorPayment') {
$instructor_payment_keys = DB::table('users')
->where('id', $payment_details['items'][0]['id'])
->value('paymentkeys');
$keys = isset($instructor_payment_keys) ? json_decode($instructor_payment_keys) : null;
if ($keys) {
$paytm_merchant_key = $keys->paytm->paytm_merchant_key;
$paytm_merchant_mid = $keys->paytm->paytm_merchant_mid;
$paytm_merchant_website = $keys->paytm->paytm_merchant_website;
$industry_type_id = $keys->paytm->industry_type_id;
$channel_id = $keys->paytm->channel_id;
}
} else {
$keys = json_decode($payment_gateway->keys);
$paytm_merchant_key = $keys->paytm_merchant_key;
$paytm_merchant_mid = $keys->paytm_merchant_mid;
$paytm_merchant_website = $keys->paytm_merchant_website;
$industry_type_id = $keys->industry_type_id;
$channel_id = $keys->channel_id;
}
if ($payment_gateway->test_mode == 1) {
// define('PAYTM_ENVIRONMENT', 'TEST'); // PROD or TEST
$PAYTM_STATUS_QUERY_NEW_URL = 'https://securegw-stage.paytm.in/merchant-status/getTxnStatus';
$PAYTM_TXN_URL = 'https://securegw-stage.paytm.in/theia/processTransaction';
} else {
define('PAYTM_ENVIRONMENT', 'PROD'); // PROD or TEST
$PAYTM_STATUS_QUERY_NEW_URL = 'https://securegw.paytm.in/merchant-status/getTxnStatus';
$PAYTM_TXN_URL = 'https://securegw.paytm.in/theia/processTransaction';
}
define('PAYTM_MERCHANT_KEY', $paytm_merchant_key);
define('PAYTM_MERCHANT_MID', $paytm_merchant_mid);
define('PAYTM_MERCHANT_WEBSITE', $paytm_merchant_website);
define('PAYTM_REFUND_URL', '');
define('PAYTM_STATUS_QUERY_URL', $PAYTM_STATUS_QUERY_NEW_URL);
define('PAYTM_STATUS_QUERY_NEW_URL', $PAYTM_STATUS_QUERY_NEW_URL);
define('PAYTM_TXN_URL', $PAYTM_TXN_URL);
//ended common code of all payment gateway
if (!function_exists('encrypt_e_new_sads')) {
function encrypt_e_new_sads($input, $ky)
{
$key = html_entity_decode($ky);
$iv = "@@@@&&&&####$$$$";
$data = openssl_encrypt($input, 'AES-128-CBC', $key, 0, $iv);
return $data;
}
}
if (!function_exists('decrypt_e')) {
function decrypt_e($crypt, $ky)
{
$key = html_entity_decode($ky);
$iv = "@@@@&&&&####$$$$";
$data = openssl_decrypt($crypt, 'AES-128-CBC', $key, 0, $iv);
return $data;
}
}
if (!function_exists('generateSalt_e')) {
function generateSalt_e($length)
{
$random = '';
srand((float) microtime() * 1000000);
$data = 'AbcDE123IJKLMN67QRSTUVWXYZ';
$data .= 'aBCdefghijklmn123opq45rs67tuv89wxyz';
$data .= '0FGH45OP89';
for ($i = 0; $i < $length; $i++) {
$random .= substr($data, rand() % strlen($data), 1);
}
return $random;
}
}
if (!function_exists('checkString_e')) {
function checkString_e($value)
{
if ($value == 'null') {
$value = '';
}
return $value;
}
}
if (!function_exists('getChecksumFromArray')) {
function getChecksumFromArray($arrayList, $key, $sort = 1)
{
if ($sort != 0) {
ksort($arrayList);
}
$str = getArray2Str($arrayList);
$salt = generateSalt_e(4);
$finalString = $str . '|' . $salt;
$hash = hash('sha256', $finalString);
$hashString = $hash . $salt;
$checksum = encrypt_e_new_sads($hashString, $key);
return $checksum;
}
}
if (!function_exists('getChecksumFromString')) {
function getChecksumFromString($str, $key)
{
$salt = generateSalt_e(4);
$finalString = $str . '|' . $salt;
$hash = hash('sha256', $finalString);
$hashString = $hash . $salt;
$checksum = encrypt_e_new_sads($hashString, $key);
return $checksum;
}
}
if (!function_exists('verifychecksum_e')) {
function verifychecksum_e($arrayList, $key, $checksumvalue)
{
$arrayList = removeCheckSumParam($arrayList);
ksort($arrayList);
$str = getArray2StrForVerify($arrayList);
$paytm_hash = decrypt_e($checksumvalue, $key);
$salt = substr($paytm_hash, -4);
$finalString = $str . '|' . $salt;
$website_hash = hash('sha256', $finalString);
$website_hash .= $salt;
$validFlag = 'FALSE';
if ($website_hash == $paytm_hash) {
$validFlag = 'TRUE';
} else {
$validFlag = 'FALSE';
}
return $validFlag;
}
}
if (!function_exists('verifychecksum_eFromStr')) {
function verifychecksum_eFromStr($str, $key, $checksumvalue)
{
$paytm_hash = decrypt_e($checksumvalue, $key);
$salt = substr($paytm_hash, -4);
$finalString = $str . '|' . $salt;
$website_hash = hash('sha256', $finalString);
$website_hash .= $salt;
$validFlag = 'FALSE';
if ($website_hash == $paytm_hash) {
$validFlag = 'TRUE';
} else {
$validFlag = 'FALSE';
}
return $validFlag;
}
}
if (!function_exists('getArray2Str')) {
function getArray2Str($arrayList)
{
$findme = 'REFUND';
$findmepipe = '|';
$paramStr = '';
$flag = 1;
foreach ($arrayList as $key => $value) {
$pos = strpos($value, $findme);
$pospipe = strpos($value, $findmepipe);
if ($pos !== false || $pospipe !== false) {
continue;
}
if ($flag) {
$paramStr .= checkString_e($value);
$flag = 0;
} else {
$paramStr .= '|' . checkString_e($value);
}
}
return $paramStr;
}
}
if (!function_exists('getArray2StrForVerify')) {
function getArray2StrForVerify($arrayList)
{
$paramStr = '';
$flag = 1;
foreach ($arrayList as $key => $value) {
if ($flag) {
$paramStr .= checkString_e($value);
$flag = 0;
} else {
$paramStr .= '|' . checkString_e($value);
}
}
return $paramStr;
}
}
if (!function_exists('redirect2PG')) {
function redirect2PG($paramList, $key)
{
$hashString = getchecksumFromArray($paramList);
$checksum = encrypt_e_new_sads($hashString, $key);
}
}
if (!function_exists('removeCheckSumParam')) {
function removeCheckSumParam($arrayList)
{
if (isset($arrayList['CHECKSUMHASH'])) {
unset($arrayList['CHECKSUMHASH']);
}
return $arrayList;
}
}
if (!function_exists('getTxnStatus')) {
function getTxnStatus($requestParamList)
{
return callAPI(PAYTM_STATUS_QUERY_URL, $requestParamList);
}
}
if (!function_exists('getTxnStatusNew')) {
function getTxnStatusNew($requestParamList)
{
return callNewAPI(PAYTM_STATUS_QUERY_NEW_URL, $requestParamList);
}
}
if (!function_exists('initiateTxnRefund')) {
function initiateTxnRefund($requestParamList)
{
$CHECKSUM = getRefundChecksumFromArray($requestParamList, PAYTM_MERCHANT_KEY, 0);
$requestParamList['CHECKSUM'] = $CHECKSUM;
return callAPI(PAYTM_REFUND_URL, $requestParamList);
}
}
if (!function_exists('callAPI')) {
function callAPI($apiURL, $requestParamList)
{
$jsonResponse = '';
$responseParamList = [];
$JsonData = json_encode($requestParamList);
$postData = 'JsonData=' . urlencode($JsonData);
$ch = curl_init($apiURL);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json', 'Content-Length: ' . strlen($postData)]);
$jsonResponse = curl_exec($ch);
$responseParamList = json_decode($jsonResponse, true);
return $responseParamList;
}
}
if (!function_exists('callNewAPI')) {
function callNewAPI($apiURL, $requestParamList)
{
$jsonResponse = '';
$responseParamList = [];
$JsonData = json_encode($requestParamList);
$postData = 'JsonData=' . urlencode($JsonData);
$ch = curl_init($apiURL);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json', 'Content-Length: ' . strlen($postData)]);
$jsonResponse = curl_exec($ch);
$responseParamList = json_decode($jsonResponse, true);
return $responseParamList;
}
}
if (!function_exists('getRefundChecksumFromArray')) {
function getRefundChecksumFromArray($arrayList, $key, $sort = 1)
{
if ($sort != 0) {
ksort($arrayList);
}
$str = getRefundArray2Str($arrayList);
$salt = generateSalt_e(4);
$finalString = $str . '|' . $salt;
$hash = hash('sha256', $finalString);
$hashString = $hash . $salt;
$checksum = encrypt_e_new_sads($hashString, $key);
return $checksum;
}
}
if (!function_exists('getRefundArray2Str')) {
function getRefundArray2Str($arrayList)
{
$findmepipe = '|';
$paramStr = '';
$flag = 1;
foreach ($arrayList as $key => $value) {
$pospipe = strpos($value, $findmepipe);
if ($pospipe !== false) {
continue;
}
if ($flag) {
$paramStr .= checkString_e($value);
$flag = 0;
} else {
$paramStr .= '|' . checkString_e($value);
}
}
return $paramStr;
}
}
if (!function_exists('callRefundAPI')) {
function callRefundAPI($refundApiURL, $requestParamList)
{
$jsonResponse = '';
$responseParamList = [];
$JsonData = json_encode($requestParamList);
$postData = 'JsonData=' . urlencode($JsonData);
$ch = curl_init($apiURL);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_URL, $refundApiURL);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$headers = [];
$headers[] = 'Content-Type: application/json';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$jsonResponse = curl_exec($ch);
$responseParamList = json_decode($jsonResponse, true);
return $responseParamList;
}
}
// Create an array having all required parameters for creating checksum.
$paramList = [];
$paramList['MID'] = $paytm_merchant_mid;
$paramList['ORDER_ID'] = 'ORDS' . rand(10000, 99999999);
$paramList['CUST_ID'] = 'CUST' . $user->id;
$paramList['INDUSTRY_TYPE_ID'] = $industry_type_id;
$paramList['CHANNEL_ID'] = $channel_id;
$paramList['TXN_AMOUNT'] = $payment_details['payable_amount'];
$paramList['WEBSITE'] = $paytm_merchant_website;
$paramList['CALLBACK_URL'] = $payment_details['success_url'] . '/' . $identifier;
//Here checksum string will return by getChecksumFromArray() function.
$checkSum = getChecksumFromArray($paramList, $paytm_merchant_key);
@endphp
<html>
<head>
<title>Merchant Check Out Page</title>
</head>
<body>
<center>
<h1>{{ get_phrase('Please do not refresh this page') }}...</h1>
</center>
<form method='post' action='{{ PAYTM_TXN_URL }}' name='f1'>
<table border="f1">
<tbody>
@foreach ($paramList as $name => $value)
<input type="hidden" name="{{ $name }}" value="{{ $value }}">
@endforeach
<input type='hidden' name='CHECKSUMHASH' value='{{ $checkSum }}'>
</tbody>
</table>
<script type='text/javascript'>
document.f1.submit();
</script>
</form>
</body>
</html>

View File

@ -1,66 +0,0 @@
@php
$model = $payment_details['success_method']['model_name'];
if ($model == 'InstructorPayment') {
$payment_keys = DB::table('users')
->where('id', $payment_details['items'][1]['id'])
->value('paymentkeys');
$keys = isset($payment_keys) ? json_decode($payment_keys) : null;
if ($payment_gateway->test_mode == 1) {
$store_key = $store_live_key = '';
if ($keys) {
$key = $keys->sslcommerz->store_key;
$key = $keys->sslcommerz->store_live_key;
}
} else {
$store_password = $store_live_password = '';
if ($keys) {
$key = $keys->sslcommerz->store_live_password;
$key = $keys->sslcommerz->store_password;
}
}
if ($key == '') {
$msg = get_phrase('This payment gateway is not configured.');
}
} else {
$payment_keys = json_decode($payment_gateway->keys, true);
$key = '';
if ($payment_keys != '') {
if ($payment_gateway->status == 1) {
if ($payment_gateway->test_mode == 1) {
$key = $payment_keys['store_password'];
} else {
$key = $payment_keys['store_live_password'];
}
if ($key == '') {
$msg = get_phrase('This payment gateway is not configured.');
}
} else {
$msg = get_phrase('Admin denied transaction through this gateway.');
}
} else {
$msg = get_phrase('This payment gateway is not configured.');
}
}
// user information
$user = DB::table('users')
->where('id', auth()->user()->id)
->first();
@endphp
<form action="{{ route('payment.create', $payment_gateway->identifier) }}" method="GET">
@csrf
<input type="hidden" id="payable_amount" name="payable_amount" value="{{ $payment_details['payable_amount'] }}">
<input type="hidden" id="user_id" name="user_id" value="{{ $user->id }}">
<input type="hidden" name="currency" value="{{ $payment_gateway->currency }}">
<input type="hidden" id="payment_type" name="payment_type" value="{{ $payment_gateway->title }}">
<input type="hidden" id="items_id" name="items_id" value="{{ $payment_details['items'][0]['id'] }}">
<input type="hidden" id="sslcz_storeid" name="sslcz_storeid" value="{{ $key }}">
<button class="btn btn-primary" type="submit">Pay by SSLcommerz</button>
</form>

View File

@ -7,7 +7,6 @@ use App\Http\Controllers\Admin\BootcampModuleController;
use App\Http\Controllers\Admin\BootcampResourceController;
use App\Http\Controllers\Admin\CategoryController;
use App\Http\Controllers\Admin\MessageController;
use App\Http\Controllers\Admin\OfflinePaymentController;
use App\Http\Controllers\Admin\OpenAiController;
use App\Http\Controllers\Admin\PageBuilderController;
use App\Http\Controllers\Admin\QuestionController;
@ -33,6 +32,7 @@ use App\Http\Controllers\Admin\TutorBookingController;
use App\Http\Controllers\Admin\KnowledgeBaseController;
use App\Http\Controllers\Admin\ArticleController;
use Illuminate\Support\Facades\Route;
use Illuminate\Http\Request;
/*
|--------------------------------------------------------------------------
@ -326,15 +326,6 @@ Route::name('admin.')->prefix('admin')->middleware('admin')->group(function () {
Route::get('api/configurations', [SettingController::class, 'api_configurations'])->name('api.configurations');
Route::post('api/configuration/update/{type}', [SettingController::class, 'api_configuration_update'])->name('api.configuration.update');
// offline payment
Route::controller(OfflinePaymentController::class)->group(function () {
Route::get('offline-payments', 'index')->name('offline.payments');
Route::get('offline-payment/doc/{id}', 'download_doc')->name('offline.payment.doc');
Route::get('offline-payment/accept/{id}', 'accept_payment')->name('offline.payment.accept');
Route::get('offline-payment/decline/{id}', 'decline_payment')->name('offline.payment.decline');
Route::get('offline-payment/delete/{id}', 'delete_payment')->name('offline.payment.delete');
});
// coupon
Route::controller(CouponController::class)->group(function () {
Route::get('coupons', 'index')->name('coupons');
@ -479,5 +470,10 @@ Route::name('admin.')->prefix('admin')->middleware('admin')->group(function () {
Route::post('article/update/{id}', 'update')->name('articles.update');
});
Route::post('/toggle-navigation', function () {
session(['navigation_hidden' => request()->hidden]);
return response()->json(['status' => 'ok']);
})->name('toggle.navigation');
Route::get('select-language/{language}', [LanguageController::class, 'select_lng'])->name('select.language');
});

View File

@ -230,3 +230,7 @@ Route::name('instructor.')->prefix('instructor')->middleware(['instructor'])->gr
});
Route::get('instructor/select-language/{language}', [LanguageController::class, 'select_lng'])->name('instructor.select.language');
Route::post('/toggle-navigation', function () {
session(['navigation_hidden' => request()->hidden]);
return response()->json(['status' => 'ok']);
})->name('toggle.navigation');

View File

@ -1,6 +1,5 @@
<?php
use App\Http\Controllers\OfflinePaymentController;
use App\Http\Controllers\PaymentController;
use Illuminate\Support\Facades\Route;
@ -12,15 +11,6 @@ Route::controller(PaymentController::class)->middleware('auth')->group(function
// razor pay
Route::post('payment/{identifier}/order', 'payment_razorpay')->name('razorpay.order');
// paytm pay
Route::get('payment/make/paytm/order', 'make_paytm_order')->name('make.paytm.order');
Route::get('payment/make/{identifier}/status', 'paytm_paymentCallback')->name('payment.status');
// doku pay
Route::post('payment/doku_checkout/{identifier}', 'doku_checkout')->name('payment.doku_checkout');
});
Route::any('payment-notification/{identifier?}', [PaymentController::class, 'payment_notification'])->name('payment.notification');

View File

@ -6,14 +6,12 @@ use App\Http\Controllers\student\BlogCommentController;
use App\Http\Controllers\student\BlogController;
use App\Http\Controllers\student\BootcampPurchaseController;
use App\Http\Controllers\student\CartController;
use App\Http\Controllers\student\InvoiceController;
use App\Http\Controllers\student\LiveClassController;
use App\Http\Controllers\student\MessageController;
use App\Http\Controllers\student\MyBootcampsController;
use App\Http\Controllers\student\MyCoursesController;
use App\Http\Controllers\student\MyProfileController;
use App\Http\Controllers\student\MyTeamPackageController;
use App\Http\Controllers\student\OfflinePaymentController;
use App\Http\Controllers\student\PurchaseController;
use App\Http\Controllers\student\QuizController;
use App\Http\Controllers\student\ReviewController;
@ -148,6 +146,3 @@ Route::middleware(['auth'])->group(function () {
//Certificate download
Route::get('certificate/{identifier}', [HomeController::class, 'download_certificate'])->name('certificate');
// offline payment
Route::post('payment/offline/store', [OfflinePaymentController::class, 'store'])->name('payment.offline.store');