Plugin Directory

Changeset 3405014


Ignore:
Timestamp:
11/28/2025 10:04:00 AM (4 months ago)
Author:
mobipaid
Message:

update plugin version to 1.1.2

Location:
mobipaid
Files:
55 added
5 edited

Legend:

Unmodified
Added
Removed
  • mobipaid/trunk/includes/class-mobipaid-api.php

    r2964082 r3405014  
    33 * Mobipaid API Class
    44 *
     5 * Handles API communication with Mobipaid payment gateway.
     6 *
    57 * @package Mobipaid
     8 * @since   1.0.0
    69 */
    710
    811if (!defined('ABSPATH')) {
    9  exit;
     12 exit; // Exit if accessed directly.
    1013}
    1114
    1215/**
     16 * Mobipaid API Class
     17 *
    1318 * Handles POS Link, Refunds and other API requests.
    1419 *
     
    2631
    2732 /**
    28   * Is use test server or not
     33  * Test mode flag
    2934  *
    3035  * @var bool
     
    3338
    3439 /**
    35   * API live url
     40  * API live URL
    3641  *
    3742  * @var string
     
    4045
    4146 /**
    42   * API test url
     47  * API test URL
    4348  *
    4449  * @var string
     
    4752
    4853 /**
    49   * Get API url
    50   *
    51   * @return string
     54  * Get API URL based on test mode setting
     55  *
     56  * @since 1.0.0
     57  *
     58  * @return string API URL
    5259  */
    5360 public static function get_api_url()
     
    6067
    6168 /**
    62   * Send request to the API
    63   *
    64   * @param string $url Url.
    65   * @param array  $body Body.
    66   * @param string $method Method.
    67   *
    68   * @return array
     69  * Send request to the Mobipaid API
     70  *
     71  * @since 1.0.0
     72  *
     73  * @param string $url    API endpoint URL.
     74  * @param mixed  $body   Request body.
     75  * @param string $method HTTP method (GET, POST, PUT, DELETE).
     76  *
     77  * @return array API response
    6978  */
    7079 public static function send_request($url, $body = '', $method = 'GET')
  • mobipaid/trunk/includes/class-mobipaid-blocks-support.php

    r3149814 r3405014  
    11<?php
     2/**
     3 * Mobipaid Blocks Support Class
     4 *
     5 * Provides integration with WooCommerce Blocks checkout.
     6 *
     7 * @package Mobipaid
     8 * @since   1.1.0
     9 */
     10
     11if (! defined('ABSPATH')) {
     12 exit; // Exit if accessed directly.
     13}
     14
    215use Automattic\WooCommerce\Blocks\Payments\Integrations\AbstractPaymentMethodType;
    316
     17/**
     18 * Mobipaid Blocks Support Class.
     19 *
     20 * @since 1.1.0
     21 */
    422final class Mobipaid_Blocks_Support extends AbstractPaymentMethodType {
    5    
    6     protected $name = 'mobipaid'; // payment gateway id
    723
    8     public function initialize() {
    9         // get payment gateway settings
    10         $this->settings = get_option( "woocommerce_{$this->name}_settings", array() );     
    11     }
     24 /**
     25  * Payment method name/ID.
     26  *
     27  * @var string
     28  */
     29 protected $name = 'mobipaid';
    1230
    13     public function is_active() {
    14         return ! empty( $this->settings[ 'enabled' ] ) && 'yes' === $this->settings[ 'enabled' ];
    15     }
     31 /**
     32  * Initialize the payment method type.
     33  */
     34 public function initialize() {
     35  $this->settings = get_option("woocommerce_{$this->name}_settings", array());
     36 }
    1637
    17     public function get_payment_method_script_handles() {
     38 /**
     39  * Check if payment method is active.
     40  *
     41  * @return bool
     42  */
     43 public function is_active() {
     44  return ! empty($this->settings['enabled']) && 'yes' === $this->settings['enabled'];
     45 }
    1846
    19         wp_register_script(
    20             'mobipaid-blocks-integration',
    21             plugin_dir_url( __DIR__ ) . 'assets/js/mobipaid-block.js',
    22             array(
    23                 'wc-blocks-registry',
    24                 'wc-settings',
    25                 'wp-element',
    26                 'wp-html-entities',
    27             ),
    28             null, // or time() or filemtime( ... ) to skip caching
    29             true
    30         );
     47 /**
     48  * Register payment method scripts.
     49  *
     50  * @return array
     51  */
     52 public function get_payment_method_script_handles() {
     53  $script_path = 'assets/js/mobipaid-block.js';
     54  $script_url  = plugin_dir_url(__DIR__) . $script_path;
     55  $script_asset_path = dirname(__DIR__) . '/' . $script_path;
     56  $version = file_exists($script_asset_path) ? filemtime($script_asset_path) : MOBIPAID_PLUGIN_VERSION;
    3157
    32         return array( 'mobipaid-blocks-integration' );
     58  wp_register_script(
     59   'mobipaid-blocks-integration',
     60   $script_url,
     61   array(
     62    'wc-blocks-registry',
     63    'wc-settings',
     64    'wp-element',
     65    'wp-html-entities',
     66   ),
     67   $version,
     68   true
     69  );
    3370
    34     }
     71  return array('mobipaid-blocks-integration');
     72 }
    3573
    36     public function get_payment_method_data() {
    37         return array(
    38             'title'        => $this->get_setting( 'title' ),
    39             'description'  => $this->get_setting( 'description' ),
    40             'icon'         => plugin_dir_url( __DIR__ ) . 'assets/img/mp-logo.png'
    41         );
    42     }
    43 
     74 /**
     75  * Get payment method data for the client side.
     76  *
     77  * @return array
     78  */
     79 public function get_payment_method_data() {
     80  return array(
     81   'title'       => $this->get_setting('title'),
     82   'description' => $this->get_setting('description'),
     83   'icon'        => plugin_dir_url(__DIR__) . 'assets/img/mp-logo.png',
     84  );
     85 }
    4486}
  • mobipaid/trunk/includes/class-mobipaid.php

    r3301947 r3405014  
    9191 {
    9292  $this->id = 'mobipaid';
    93   // title for backend.
     93  // Title for backend.
    9494  $this->method_title       = __('Mobipaid', 'mobipaid');
    9595  $this->method_description = __('Mobipaid redirects customers to Mobipaid to enter their payment information.', 'mobipaid');
    96   // title for frontend.
    97   $this->icon     = WP_PLUGIN_URL . '/' . plugin_basename(dirname(dirname(__FILE__))) . '/assets/img/mp-logo.png';
     96  // Title and icon for frontend.
     97  $this->icon     = plugins_url('assets/img/mp-logo.png', dirname(__FILE__));
    9898  $this->supports = array(
    9999   'subscriptions',
  • mobipaid/trunk/mobipaid.php

    r3301947 r3405014  
    55 * Plugin URI:           https://github.com/MobipaidLLC/mobipaid-woocommerce
    66 * Description:          Receive payments using Mobipaid.
    7  * Version:              1.1.1
     7 * Version:              1.1.2
    88 * Requires at least:    5.0
    9  * Tested up to:         6.8.0
     9 * Tested up to:         6.8.3
    1010 * WC requires at least: 3.9.0
    11  * WC tested up to:      9.8.0
     11 * WC tested up to:      10.3.5
    1212 * Requires PHP:         7.0
    1313 * Author:               Mobipaid
     
    2525}
    2626
    27 define('MOBIPAID_PLUGIN_VERSION', '1.1.1');
     27define('MOBIPAID_PLUGIN_VERSION', '1.1.2');
    2828
    2929register_activation_hook(__FILE__, 'mobipaid_activate_plugin');
     
    135135add_filter('query_vars', 'mobipaid_add_query_vars_filter');
    136136
    137 add_action('rest_api_init', 'addResponseHandlerApi');
    138 
    139 function addResponseHandlerApi()
    140 {
    141  // use hook to receive response url.
    142  register_rest_route('woocommerce_mobipaid_api', 'response_url', [
    143   'methods'  => 'POST',
    144   'callback' => 'handleResponseUrl',
    145   'permission_callback' => '__return_true'
    146  ]);
    147 }
    148 
    149 function handleResponseUrl($request)
     137add_action('rest_api_init', 'mobipaid_register_rest_routes');
     138
     139/**
     140 * Register REST API routes for Mobipaid.
     141 */
     142function mobipaid_register_rest_routes()
     143{
     144 register_rest_route(
     145  'woocommerce_mobipaid_api',
     146  'response_url',
     147  array(
     148   'methods'             => 'POST',
     149   'callback'            => 'mobipaid_handle_response_url',
     150   'permission_callback' => 'mobipaid_response_permission_callback',
     151  )
     152 );
     153}
     154
     155/**
     156 * Permission callback for response URL endpoint.
     157 *
     158 * @return bool Always returns true as this endpoint receives webhooks from Mobipaid.
     159 */
     160function mobipaid_response_permission_callback()
     161{
     162 // This endpoint receives webhooks from Mobipaid gateway.
     163 // Authentication is handled via token validation in the response_page method.
     164 return true;
     165}
     166
     167/**
     168 * Handle response URL callback from Mobipaid.
     169 *
     170 * @param WP_REST_Request $request Request object.
     171 * @return mixed Response from Mobipaid handler.
     172 */
     173function mobipaid_handle_response_url($request)
    150174{
    151175 require_once 'includes/class-mobipaid.php';
    152  $mobipaid =  new Mobipaid();
     176 $mobipaid = new Mobipaid();
    153177
    154178 return $mobipaid->response_page($request);
     
    156180
    157181add_action('woocommerce_blocks_loaded', 'mobipaid_gateway_block_support');
     182
     183/**
     184 * Register Mobipaid payment gateway with WooCommerce Blocks.
     185 */
    158186function mobipaid_gateway_block_support()
    159187{
    160 
    161188 if (! class_exists('Automattic\WooCommerce\Blocks\Payments\Integrations\AbstractPaymentMethodType')) {
    162189  return;
    163190 }
    164191
    165  // here we're including our "gateway block support class"
     192 // Include gateway block support class.
    166193 require_once __DIR__ . '/includes/class-mobipaid-blocks-support.php';
    167194
    168  // registering the PHP class we have just included
     195 // Register the payment method with WooCommerce Blocks.
    169196 add_action(
    170197  'woocommerce_blocks_payment_method_type_registration',
    171198  function (Automattic\WooCommerce\Blocks\Payments\PaymentMethodRegistry $payment_method_registry) {
    172    $payment_method_registry->register(new Mobipaid_Blocks_Support);
     199   $payment_method_registry->register(new Mobipaid_Blocks_Support());
    173200  }
    174201 );
  • mobipaid/trunk/readme.txt

    r3301952 r3405014  
    44Tags: credit card, mobipaid, google pay, apple pay, nedbank
    55Requires at least: 5.0
    6 Tested up to: 6.8.0
     6Tested up to: 6.8.3
    77Requires PHP: 7.0
    8 Stable tag: 1.1.1
     8Stable tag: 1.1.2
    99License: GPLv3
    1010License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    143143* refactor response handling logic to support api v2
    144144* support compatibility wordpress 6.8.0 and woocommerce 9.8.0
     145
     146= 1.1.2 - 2025-11-28 =
     147* update compatibility with wordpress 6.8.3 and woocommerce 10.3.5
     148* improve code quality and best practices
     149* enhance security and compatibility declarations
Note: See TracChangeset for help on using the changeset viewer.