Server IP : 192.158.238.246 / Your IP : 3.138.140.5 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 PayTm */ class FlutterPayTm extends FlutterBaseController { /** * Endpoint namespace * * @var string */ protected $namespace = 'api/flutter_paytm'; /** * Register all routes releated with stores * * @return void */ public function __construct() { add_action('rest_api_init', array($this, 'register_flutter_paytm_routes')); } public function register_flutter_paytm_routes() { register_rest_route($this->namespace, '/generate_txn_token', array( array( 'methods' => "POST", 'callback' => array($this, 'generate_txn_token'), 'permission_callback' => function () { return parent::checkApiPermission(); } ), )); } public function generate_txn_token($request) { if (!is_plugin_active('paytm-payments/woo-paytm.php')) { return parent::sendError("invalid_plugin", "You need to install Paytm WooCommerce Payment Gateway plugin to use this api", 404); } $json = file_get_contents('php://input'); $body = json_decode($json, TRUE); $params = ['order_id'=>sanitize_text_field($body['order_id']), 'amount'=>sanitize_text_field($body['amount']), 'cust_id'=>sanitize_text_field($body['cust_id'])]; $payTm = new WC_paytm(); return $payTm->blinkCheckoutSend($params); } } new FlutterPayTm;