Plugin Directory

Changeset 3043145


Ignore:
Timestamp:
02/29/2024 12:31:53 PM (2 years ago)
Author:
spanrig
Message:

Added support for Woocommerce Blocks.

Location:
wc-westpac-payway-with-recurring
Files:
13 added
3 edited

Legend:

Unmodified
Added
Removed
  • wc-westpac-payway-with-recurring/trunk/classes/payway-gateway-rest.php

    r2560321 r3043145  
    3333       
    3434            // Default values
    35             $this->enabled              = isset( $this->settings['enabled'] ) && $this->settings['enabled'] == 'yes' ? 'yes' : $this->default_enabled;
     35            $this->enabled              = isset( $this->settings['enabled'] ) && $this->settings['enabled'] == 'yes' ? 'yes' : 'no';
    3636            $this->title                = sanitize_text_field($this->settings['title'], 'woo_payway_recurring_net' );
    3737            $this->description          = sanitize_text_field($this->settings['description'], 'woo_payway_recurring_net' );
  • wc-westpac-payway-with-recurring/trunk/readme.txt

    r2803081 r3043145  
    55Requires at least: 4.9
    66Tested up to: 6.0
    7 Stable tag: 1.3
     7Stable tag: 1.4
    88Requires PHP: 7.4
    99License: GPLv2 or later
  • wc-westpac-payway-with-recurring/trunk/wc-westpac-payway-with-recurring.php

    r2803082 r3043145  
    33 * Plugin Name: Payment gateway for Westpac PayWay NET on Woocommerce with Recurring Billing
    44 * Description: The plugin gives the functionality of processing Credit and Debit Cards on WooCommerce using Westpac PayWay NET along with Recurring Payments.
    5  * Version: 1.3
     5 * Version: 1.4
    66 * Author: Spanrig Technologies
    77 * Author URI: https://www.upwork.com/fl/hncvj
     
    139139    add_action( 'woocommerce_process_product_meta', 'payway_custom_fields_save' );
    140140
     141
     142    /**
     143    * Custom function to declare compatibility with cart_checkout_blocks feature
     144    */
     145    function declare_cart_checkout_blocks_compatibility() {
     146        // Check if the required class exists
     147        if (class_exists('\Automattic\WooCommerce\Utilities\FeaturesUtil')) {
     148            // Declare compatibility for 'cart_checkout_blocks'
     149            \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility('cart_checkout_blocks', __FILE__, true);
     150        }
     151    }
     152    // Hook the custom function to the 'before_woocommerce_init' action
     153    add_action('before_woocommerce_init', 'declare_cart_checkout_blocks_compatibility');
     154
     155    // Hook the custom function to the 'woocommerce_blocks_loaded' action
     156    add_action( 'woocommerce_blocks_loaded', 'register_paywaynetrecurring_payment_method_type' );
     157
     158    /**
     159     * Custom function to register a payment method type
     160
     161    */
     162    function register_paywaynetrecurring_payment_method_type() {
     163        // Check if the required class exists
     164        if ( ! class_exists( 'Automattic\WooCommerce\Blocks\Payments\Integrations\AbstractPaymentMethodType' ) ) {
     165            return;
     166        }
     167
     168        // Include the custom Blocks Checkout class
     169        require_once PAYWAYRESTRECURRINGPLUGINPATH . 'includes/class-payway-woocommerce-block-checkout.php';
     170
     171        // Hook the registration function to the 'woocommerce_blocks_payment_method_type_registration' action
     172        add_action(
     173            'woocommerce_blocks_payment_method_type_registration',
     174            function( Automattic\WooCommerce\Blocks\Payments\PaymentMethodRegistry $payment_method_registry ) {
     175                // Register an instance of WC_Payway_Blocks
     176                $payment_method_registry->register( new WC_Payway_Blocks );
     177            }
     178        );
     179    }
     180
    141181}
Note: See TracChangeset for help on using the changeset viewer.