Server IP : 192.158.238.246 / Your IP : 3.137.154.13 Web Server : LiteSpeed System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64 User : jenniferflocom ( 1321) PHP Version : 8.1.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/jenniferflocom/www/wp-content/plugins/mstore-api/controllers/ |
Upload File : |
<?php require_once(__DIR__ . '/flutter-base.php'); /* * Base REST Controller for flutter * * @since 1.4.0 * * @package Flutterwave */ class FlutterFlutterwave extends FlutterBaseController { /** * Endpoint namespace * * @var string */ protected $namespace = 'api/flutter_flutterwave'; /** * Register all routes releated with stores * * @return void */ public function __construct() { add_action('rest_api_init', array($this, 'register_flutter_flutterwave_routes')); } public function register_flutter_flutterwave_routes() { register_rest_route($this->namespace, '/flw_verify_payment', array( array( 'methods' => "GET", 'callback' => array($this, 'flw_verify_payment'), 'permission_callback' => function () { return parent::checkApiPermission(); } ), )); } public function flw_verify_payment($request) { if (!is_plugin_active('rave-woocommerce-payment-gateway/woocommerce-rave.php')) { return parent::sendError("invalid_plugin", "You need to install Flutterwave WooCommerce plugin to use this api", 404); } $_GET['txref'] = sanitize_text_field($request['txref']); $flutterwave = new FLW_WC_Payment_Gateway(); if (defined('WC_ABSPATH')) { // WC 3.6+ - Cart and other frontend functions are not included for REST requests. include_once WC_ABSPATH . 'includes/wc-cart-functions.php'; include_once WC_ABSPATH . 'includes/wc-notice-functions.php'; include_once WC_ABSPATH . 'includes/wc-template-hooks.php'; } if (null === WC()->session) { $session_class = apply_filters('woocommerce_session_handler', 'WC_Session_Handler'); WC()->session = new $session_class(); WC()->session->init(); } if (null === WC()->cart) { WC()->cart = new WC_Cart(); } return $flutterwave->flw_verify_payment(); } } new FlutterFlutterwave;