<?php
namespace App\Http\Controllers\Admin;
use Exception;
use Illuminate\Http\Request;
use App\Http\Helpers\Response;
use App\Http\Controllers\Controller;
use App\Models\Admin\CardMethodGateway;
use Illuminate\Support\Facades\Validator;
class CardMethodGatewayController extends Controller
{
/**
* Method for view the card method gateway page
* @return view
*/
public function index(){
$page_title = "Card Method Gateway";
$card_methods = CardMethodGateway::orderBy('id','desc')->get();
return view('admin.sections.card-method-gateway.index',compact(
'page_title',
'card_methods'
));
}
/**
* Method for view edit card method gateway page
* @return view $slug
* @param \Illuminate\Http\Request $request
*/
public function edit($slug){
$page_title = "Card Method Gateway Edit";
$data = CardMethodGateway::where('slug',$slug)->first();
if(!$data) return back()->with(['error' => ['Sorry! Data not found.']]);
return view('admin.sections.card-method-gateway.edit',compact(
'page_title',
'data'
));
}
/**
* Method for update send money gateway information
* @param $slug
* @param \Illuminate\Http\Request $request
*/
public function update(Request $request,$slug){
$data = CardMethodGateway::where('slug',$slug)->first();
if(!$data) return back()->with(['error' => ['Sorry! Data not found.']]);
$validator = Validator::make($request->all(),[
'slug' => 'required',
'name' => 'required',
'publishable_key' => 'required',
'secret_key' => 'required',
'image' => "nullable|mimes:png,jpg,jpeg,webp",
]);
if($validator->fails()) return back()->withErrors($validator)->withInput($request->all());
$update_data = array_filter($request->except('_token','image','slug','name','fileholder-image','_method','env'));
$data->name = $request->name;
$image = $data->image;
if($request->hasFile('image')) {
$image = get_files_from_fileholder($request,'image');
$upload_image = upload_files_from_path_dynamic($image,'send-money-gateway',$data->image);
$image = $upload_image;
}
$data->credentials = $update_data;
$data->update([
'credentials' => $update_data,
'image' => $image,
]);
return redirect()->route('admin.card.method.gateway.index')->with(['success' => ['Card Method Gateway Updated Successfully.']]);
}
/**
* Method for status update for Outside wallet
* @param string
* @param \Illuminate\Http\Request $request
*/
public function statusUpdate(Request $request) {
$validator = Validator::make($request->all(),[
'data_target' => 'required|numeric|exists:card_method_gateways,id',
'status' => 'required|boolean',
]);
if($validator->fails()) {
$errors = ['error' => $validator->errors() ];
return Response::error($errors);
}
$validated = $validator->validate();
$send_money = CardMethodGateway::find($validated['data_target']);
try{
$send_money->update([
'status' => ($validated['status']) ? false : true,
]);
}catch(Exception $e) {
$errors = ['error' => ['Something went wrong! Please try again.'] ];
return Response::error($errors,null,500);
}
$success = ['success' => [__('Card Method Gateway status updated successfully!')]];
return Response::success($success);
}
}
Service Section
Discover how our services are designed to enhance your NFC Pay experience with convenience, security, and innovative solutions. From managing transactions to secure payments, we are dedicated to providing seamless support every step of the way.
Easily save your credit and debit card details within our app for quick and secure transactions. This feature ensures that your payment information is protected with advanced encryption and can be used for future purchases with just a tap.
Transfer funds quickly and securely between users with our streamlined money transfer service. Simply select the recipient, enter the amount, and authorize the transaction for instant, hassle-free transfers.
Activate your merchant account effortlessly to start receiving payments. Our intuitive setup process ensures that you can begin accepting transactions smoothly, helping your business thrive with minimal setup time.
Keep track of all your transactions in real time through our app. Monitor payment statuses, view transaction history, and manage your account efficiently, ensuring complete control over your financial activities.
Our dedicated support team is available to assist you with any queries or issues. Whether you need help with setting up your account or resolving transaction-related questions, we’re here to provide prompt and reliable assistance.