Changeset 3405014
- Timestamp:
- 11/28/2025 10:04:00 AM (4 months ago)
- Location:
- mobipaid
- Files:
-
- 55 added
- 5 edited
-
tags/1.1.2 (added)
-
tags/1.1.2/assets (added)
-
tags/1.1.2/assets/img (added)
-
tags/1.1.2/assets/img/mp-logo.png (added)
-
tags/1.1.2/assets/js (added)
-
tags/1.1.2/assets/js/mobipaid-block.js (added)
-
tags/1.1.2/changelog.txt (added)
-
tags/1.1.2/includes (added)
-
tags/1.1.2/includes/class-mobipaid-api.php (added)
-
tags/1.1.2/includes/class-mobipaid-blocks-support.php (added)
-
tags/1.1.2/includes/class-mobipaid.php (added)
-
tags/1.1.2/index.php (added)
-
tags/1.1.2/languages (added)
-
tags/1.1.2/languages/mobipaid-ar.mo (added)
-
tags/1.1.2/languages/mobipaid-ar.po (added)
-
tags/1.1.2/languages/mobipaid-da_DK.mo (added)
-
tags/1.1.2/languages/mobipaid-da_DK.po (added)
-
tags/1.1.2/languages/mobipaid-de_DE.mo (added)
-
tags/1.1.2/languages/mobipaid-de_DE.po (added)
-
tags/1.1.2/languages/mobipaid-en_US.mo (added)
-
tags/1.1.2/languages/mobipaid-en_US.po (added)
-
tags/1.1.2/languages/mobipaid-es_ES.mo (added)
-
tags/1.1.2/languages/mobipaid-es_ES.po (added)
-
tags/1.1.2/languages/mobipaid-fi.mo (added)
-
tags/1.1.2/languages/mobipaid-fi.po (added)
-
tags/1.1.2/languages/mobipaid-fr_FR.mo (added)
-
tags/1.1.2/languages/mobipaid-fr_FR.po (added)
-
tags/1.1.2/languages/mobipaid-id_ID.mo (added)
-
tags/1.1.2/languages/mobipaid-id_ID.po (added)
-
tags/1.1.2/languages/mobipaid-it_IT.mo (added)
-
tags/1.1.2/languages/mobipaid-it_IT.po (added)
-
tags/1.1.2/languages/mobipaid-ja.mo (added)
-
tags/1.1.2/languages/mobipaid-ja.po (added)
-
tags/1.1.2/languages/mobipaid-ko_KR.mo (added)
-
tags/1.1.2/languages/mobipaid-ko_KR.po (added)
-
tags/1.1.2/languages/mobipaid-nl_NL.mo (added)
-
tags/1.1.2/languages/mobipaid-nl_NL.po (added)
-
tags/1.1.2/languages/mobipaid-pl_PL.mo (added)
-
tags/1.1.2/languages/mobipaid-pl_PL.po (added)
-
tags/1.1.2/languages/mobipaid-pt_PT.mo (added)
-
tags/1.1.2/languages/mobipaid-pt_PT.po (added)
-
tags/1.1.2/languages/mobipaid-ru_RU.mo (added)
-
tags/1.1.2/languages/mobipaid-ru_RU.po (added)
-
tags/1.1.2/languages/mobipaid-sv_SE.mo (added)
-
tags/1.1.2/languages/mobipaid-sv_SE.po (added)
-
tags/1.1.2/languages/mobipaid-tr_TR.mo (added)
-
tags/1.1.2/languages/mobipaid-tr_TR.po (added)
-
tags/1.1.2/languages/mobipaid-zh_CN.mo (added)
-
tags/1.1.2/languages/mobipaid-zh_CN.po (added)
-
tags/1.1.2/mobipaid.php (added)
-
tags/1.1.2/readme.txt (added)
-
tags/1.1.2/templates (added)
-
tags/1.1.2/templates/admin (added)
-
tags/1.1.2/templates/admin/order (added)
-
tags/1.1.2/templates/admin/order/cancel-recurring.php (added)
-
trunk/includes/class-mobipaid-api.php (modified) (6 diffs)
-
trunk/includes/class-mobipaid-blocks-support.php (modified) (1 diff)
-
trunk/includes/class-mobipaid.php (modified) (1 diff)
-
trunk/mobipaid.php (modified) (4 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
mobipaid/trunk/includes/class-mobipaid-api.php
r2964082 r3405014 3 3 * Mobipaid API Class 4 4 * 5 * Handles API communication with Mobipaid payment gateway. 6 * 5 7 * @package Mobipaid 8 * @since 1.0.0 6 9 */ 7 10 8 11 if (!defined('ABSPATH')) { 9 exit; 12 exit; // Exit if accessed directly. 10 13 } 11 14 12 15 /** 16 * Mobipaid API Class 17 * 13 18 * Handles POS Link, Refunds and other API requests. 14 19 * … … 26 31 27 32 /** 28 * Is use test server or not33 * Test mode flag 29 34 * 30 35 * @var bool … … 33 38 34 39 /** 35 * API live url40 * API live URL 36 41 * 37 42 * @var string … … 40 45 41 46 /** 42 * API test url47 * API test URL 43 48 * 44 49 * @var string … … 47 52 48 53 /** 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 52 59 */ 53 60 public static function get_api_url() … … 60 67 61 68 /** 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 69 78 */ 70 79 public static function send_request($url, $body = '', $method = 'GET') -
mobipaid/trunk/includes/class-mobipaid-blocks-support.php
r3149814 r3405014 1 1 <?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 11 if (! defined('ABSPATH')) { 12 exit; // Exit if accessed directly. 13 } 14 2 15 use Automattic\WooCommerce\Blocks\Payments\Integrations\AbstractPaymentMethodType; 3 16 17 /** 18 * Mobipaid Blocks Support Class. 19 * 20 * @since 1.1.0 21 */ 4 22 final class Mobipaid_Blocks_Support extends AbstractPaymentMethodType { 5 6 protected $name = 'mobipaid'; // payment gateway id7 23 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'; 12 30 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 } 16 37 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 } 18 46 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; 31 57 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 ); 33 70 34 } 71 return array('mobipaid-blocks-integration'); 72 } 35 73 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 } 44 86 } -
mobipaid/trunk/includes/class-mobipaid.php
r3301947 r3405014 91 91 { 92 92 $this->id = 'mobipaid'; 93 // title for backend.93 // Title for backend. 94 94 $this->method_title = __('Mobipaid', 'mobipaid'); 95 95 $this->method_description = __('Mobipaid redirects customers to Mobipaid to enter their payment information.', 'mobipaid'); 96 // titlefor 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__)); 98 98 $this->supports = array( 99 99 'subscriptions', -
mobipaid/trunk/mobipaid.php
r3301947 r3405014 5 5 * Plugin URI: https://github.com/MobipaidLLC/mobipaid-woocommerce 6 6 * Description: Receive payments using Mobipaid. 7 * Version: 1.1. 17 * Version: 1.1.2 8 8 * Requires at least: 5.0 9 * Tested up to: 6.8. 09 * Tested up to: 6.8.3 10 10 * WC requires at least: 3.9.0 11 * WC tested up to: 9.8.011 * WC tested up to: 10.3.5 12 12 * Requires PHP: 7.0 13 13 * Author: Mobipaid … … 25 25 } 26 26 27 define('MOBIPAID_PLUGIN_VERSION', '1.1. 1');27 define('MOBIPAID_PLUGIN_VERSION', '1.1.2'); 28 28 29 29 register_activation_hook(__FILE__, 'mobipaid_activate_plugin'); … … 135 135 add_filter('query_vars', 'mobipaid_add_query_vars_filter'); 136 136 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) 137 add_action('rest_api_init', 'mobipaid_register_rest_routes'); 138 139 /** 140 * Register REST API routes for Mobipaid. 141 */ 142 function 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 */ 160 function 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 */ 173 function mobipaid_handle_response_url($request) 150 174 { 151 175 require_once 'includes/class-mobipaid.php'; 152 $mobipaid = new Mobipaid();176 $mobipaid = new Mobipaid(); 153 177 154 178 return $mobipaid->response_page($request); … … 156 180 157 181 add_action('woocommerce_blocks_loaded', 'mobipaid_gateway_block_support'); 182 183 /** 184 * Register Mobipaid payment gateway with WooCommerce Blocks. 185 */ 158 186 function mobipaid_gateway_block_support() 159 187 { 160 161 188 if (! class_exists('Automattic\WooCommerce\Blocks\Payments\Integrations\AbstractPaymentMethodType')) { 162 189 return; 163 190 } 164 191 165 // here we're including our "gateway block support class"192 // Include gateway block support class. 166 193 require_once __DIR__ . '/includes/class-mobipaid-blocks-support.php'; 167 194 168 // registering the PHP class we have just included195 // Register the payment method with WooCommerce Blocks. 169 196 add_action( 170 197 'woocommerce_blocks_payment_method_type_registration', 171 198 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()); 173 200 } 174 201 ); -
mobipaid/trunk/readme.txt
r3301952 r3405014 4 4 Tags: credit card, mobipaid, google pay, apple pay, nedbank 5 5 Requires at least: 5.0 6 Tested up to: 6.8. 06 Tested up to: 6.8.3 7 7 Requires PHP: 7.0 8 Stable tag: 1.1. 18 Stable tag: 1.1.2 9 9 License: GPLv3 10 10 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 143 143 * refactor response handling logic to support api v2 144 144 * 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.