/home/kueuepay/public_html/app/Http/Controllers/Admin/CardMethodGatewayController.php
<?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);
    }
}
Developer

Kueue Pay Payment Gateway Solutions Developer API Documentation

Welcome to the Kueue Pay Payment Gateway Solutions Developer API Documentation. This comprehensive guide will empower you to seamlessly integrate our advanced payment gateway into your website, enhancing your customers’ payment experience and enabling efficient transaction processing. The Kueue Pay Developer API is designed for developers and entrepreneurs who seek simplicity, security, and reliability in their payment processing solutions.

1. Introduction

The Kueue Pay Developer API allows you to seamlessly integrate Kueue Pay’s Payment Gateway Solutions into your website, enabling secure and efficient debit and credit card transactions. With our API, you can initiate payments, check payment statuses, and even process refunds, all while ensuring a smooth and streamlined payment experience for your customers.