Plugin Directory

Changeset 3149814


Ignore:
Timestamp:
09/11/2024 07:07:01 AM (19 months ago)
Author:
mobipaid
Message:

Add support woocommerce 9.2.3

Location:
mobipaid/trunk
Files:
3 added
4 edited

Legend:

Unmodified
Added
Removed
  • mobipaid/trunk/changelog.txt

    r2964082 r3149814  
    3737= 1.0.9 - 2023-09-02 =
    3838* support compatibility wordpress 6.3.1 and woocommerce 8.0.3.
     39
     40= 1.1.0 - 2024-09-08 =
     41* support HPOS
     42* support woocommerce checkout block
     43* support compatibility wordpress 6.6.2 and woocommerce 9.2.3
  • mobipaid/trunk/includes/class-mobipaid.php

    r2964082 r3149814  
    427427
    428428  // * save transaction_id and secret_key first before call get_payment_url function.
    429   update_post_meta($order->get_id(), '_mobipaid_transaction_id', $transaction_id);
    430   update_post_meta($order->get_id(), '_mobipaid_secret_key', $secret_key);
     429  $order->update_meta_data( '_mobipaid_transaction_id', $transaction_id );
     430  $order->update_meta_data( '_mobipaid_secret_key', $secret_key );
    431431
    432432  $payment_url = $this->get_payment_url($order_id, $transaction_id);
     
    453453  $order = wc_get_order($order_id);
    454454  if ($order && 'mobipaid' === $order->get_payment_method()) {
    455    $payment_id = get_post_meta($order->get_id(), '_mobipaid_payment_id', true);
     455   $payment_id = $order->get_meta( '_mobipaid_payment_id', true );
    456456   $body       = array(
    457457    'email'  => $order->get_billing_email(),
     
    487487   if (('processing' === $status_from || 'completed' === $status_from) && 'refunded' === $status_to) {
    488488    $amount     = (float) $this->get_order_prop($order, 'order_total');
    489     $payment_id = get_post_meta($order->get_id(), '_mobipaid_payment_id', true);
     489    $payment_id = $order->get_meta( '_mobipaid_payment_id', true );
    490490    $body       = array(
    491491     'email'  => $order->get_billing_email(),
     
    524524   if (('processing' === $status_from || 'completed' === $status_from) && 'refunded' === $status_to) {
    525525    $order_amount = (float) $this->get_order_prop($order, 'order_total');
    526     $payment_id   = get_post_meta($order->get_id(), '_mobipaid_payment_id', true);
     526    $payment_id   = $order->get_meta( '_mobipaid_payment_id', true );
    527527    $results      = Mobipaid_API::get_payment($payment_id);
    528528    $this->log('add_full_refund_notes - get_payment results: ' . wp_json_encode($results));
     
    564564 protected function generate_token($order_id, $currency)
    565565 {
    566   $transaction_id = get_post_meta($order_id, '_mobipaid_transaction_id', true);
    567   $secret_key     = get_post_meta($order_id, '_mobipaid_secret_key', true);
     566  $order          = wc_get_order($order_id);
     567  $transaction_id = $order->get_meta( '_mobipaid_transaction_id', true );
     568  $secret_key     = $order->get_meta( '_mobipaid_secret_key', true );
    568569
    569570  return md5((string) $order_id . $currency . $transaction_id . $secret_key);
     
    645646
    646647      $order_notes  = 'Mobipaid payment successfull:';
    647       update_post_meta($order->get_id(), '_mobipaid_payment_id', $payment_id);
    648       update_post_meta($order->get_id(), '_mobipaid_payment_result', 'succes');
     648      $order->update_meta_data( '_mobipaid_payment_id', $payment_id );
     649      $order->update_meta_data( '_mobipaid_payment_result', 'succes' );
    649650      $order->update_status($order_status, $order_notes);
    650651     } else {
     
    652653      $order_status = 'failed';
    653654      $order_notes  = 'Mobipaid payment failed:';
    654       update_post_meta($order->get_id(), '_mobipaid_payment_result', 'failed');
     655      $order->update_meta_data( '_mobipaid_payment_result', 'failed' );
    655656      $order->update_status($order_status, $order_notes);
    656657     }
  • mobipaid/trunk/mobipaid.php

    r2964088 r3149814  
    44 * Plugin URI:           https://github.com/MobipaidLLC/mobipaid-woocommerce
    55 * Description:          Receive payments using Mobipaid.
    6  * Version:              1.0.9
     6 * Version:              1.1.0
    77 * Requires at least:    5.0
    8  * Tested up to:         6.3.1
     8 * Tested up to:         6.6.2
    99 * WC requires at least: 3.9.0
    10  * WC tested up to:      6.5.1
     10 * WC tested up to:      9.2.3
    1111 * Requires PHP:         7.0
    1212 * Author:               Mobipaid
     
    2424}
    2525
    26 define( 'MOBIPAID_PLUGIN_VERSION', '1.0.9' );
     26define( 'MOBIPAID_PLUGIN_VERSION', '1.1.0' );
    2727
    2828register_activation_hook( __FILE__, 'mobipaid_activate_plugin' );
    2929register_uninstall_hook( __FILE__, 'mobipaid_uninstall_plugin' );
     30
     31// Declare compatibility with custom_order_tables and cart_checkout_blocks for WooCommerce.
     32add_action(
     33    'before_woocommerce_init',
     34    function () {
     35        if (class_exists('\Automattic\WooCommerce\Utilities\FeaturesUtil')) {
     36            \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility(
     37                'custom_order_tables',
     38                __FILE__,
     39                true
     40            );
     41            \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility(
     42                'cart_checkout_blocks',
     43                __FILE__,
     44                true
     45            );
     46        }
     47    }
     48);
    3049
    3150/**
     
    127146    return $mobipaid->response_page();
    128147}
     148
     149add_action( 'woocommerce_blocks_loaded', 'mobipaid_gateway_block_support' );
     150function mobipaid_gateway_block_support() {
     151
     152    if( ! class_exists( 'Automattic\WooCommerce\Blocks\Payments\Integrations\AbstractPaymentMethodType' ) ) {
     153        return;
     154    }
     155
     156    // here we're including our "gateway block support class"
     157    require_once __DIR__ . '/includes/class-mobipaid-blocks-support.php';
     158
     159    // registering the PHP class we have just included
     160    add_action(
     161        'woocommerce_blocks_payment_method_type_registration',
     162        function( Automattic\WooCommerce\Blocks\Payments\PaymentMethodRegistry $payment_method_registry ) {
     163            $payment_method_registry->register( new Mobipaid_Blocks_Support );
     164        }
     165    );
     166
     167}
  • mobipaid/trunk/readme.txt

    r2964088 r3149814  
    44Tags: credit card, mobipaid, google pay, apple pay, nedbank, payment method, payment gateway
    55Requires at least: 5.0
    6 Tested up to: 6.3.1
     6Tested up to: 6.6.2
    77Requires PHP: 7.0
    8 Stable tag: 1.0.9
     8Stable tag: 1.1.0
    99License: GPLv3
    1010License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    134134= 1.0.9 - 2023-09-02 =
    135135* support compatibility wordpress 6.3.1 and woocommerce 8.0.3.
     136
     137= 1.1.0 - 2024-09-08 =
     138* support HPOS
     139* support woocommerce checkout block
     140* support compatibility wordpress 6.6.2 and woocommerce 9.2.3
Note: See TracChangeset for help on using the changeset viewer.