Plugin Directory

Changeset 3029485


Ignore:
Timestamp:
01/31/2024 11:48:18 AM (2 years ago)
Author:
PerfectSolution
Message:

Update trunk/ - 7.1.0

Location:
woocommerce-quickpay
Files:
10 added
12 edited
1 copied

Legend:

Unmodified
Added
Removed
  • woocommerce-quickpay/tags/7.1.0/README.txt

    r2975531 r3029485  
    2828
    2929== Changelog ==
     30= 7.1.0 =
     31* Feat: Add payment gateway support for WC Checkout Blocks
     32* Fix: Apple Pay - Rely on WC_Payment_Gateway::is_available when disabling gateways in checkout based on gateway specific criteria.
     33* Fix: Google Pay - Rely on WC_Payment_Gateway::is_available when disabling gateways in checkout based on gateway specific criteria.
     34* Fix: Anyday - Rely on WC_Payment_Gateway::is_available when disabling gateways in checkout based on gateway specific criteria.
     35* Fix: Deprecation notice of dynamically declared property $instructions in WC_QuickPay (PHP 8.2)
     36
    3037= 7.0.4 =
    3138* Fix: Remove ISK from list of non-decimal currencies as the QuickPay API requires ISK amount to be multiplied
  • woocommerce-quickpay/tags/7.1.0/classes/instances/anyday.php

    r2924617 r3029485  
    1818        $this->description = $this->s( 'description' );
    1919
    20         add_filter( 'woocommerce_available_payment_gateways', [ $this, 'maybe_disable_gateway' ] );
    2120        add_filter( 'woocommerce_quickpay_cardtypelock_' . $this->id, [ $this, 'filter_cardtypelock' ] );
    2221    }
     
    7170    }
    7271
    73     /**
    74      * @param array $gateways
    75      */
    76     public function maybe_disable_gateway( $gateways ) {
    77         if ( isset( $gateways[ $this->id ] ) && is_checkout() && ( $cart = WC()->cart ) ) {
     72    public function is_available() {
     73        $available = parent::is_available();
     74
     75        if ( $available && ( $cart = WC()->cart ) ) {
    7876            $cart_total = (float) $cart->get_total( 'edit' );
    79             $cart_min   = 1;
    80             $cart_max   = 30000;
     77
     78            $cart_min = 1;
     79            $cart_max = 30000;
    8180
    8281            if ( ! ( $cart_total >= $cart_min && $cart_total <= $cart_max ) || 'DKK' !== strtoupper( get_woocommerce_currency() ) ) {
    83                 unset( $gateways[ $this->id ] );
     82                $available = false;
    8483            }
    8584        }
    8685
    87         return $gateways;
     86        return $available;
    8887    }
    8988}
  • woocommerce-quickpay/tags/7.1.0/classes/instances/apple-pay.php

    r2924617 r3029485  
    2020        add_filter( 'woocommerce_quickpay_cardtypelock_' . $this->id, [ $this, 'filter_cardtypelock' ] );
    2121        add_filter( 'woocommerce_quickpay_checkout_gateway_icon', [ $this, 'filter_icon' ] );
    22         add_filter( 'woocommerce_available_payment_gateways', [ $this, 'maybe_disable_gateway' ] );
    2322    }
    2423
     
    8786
    8887    /**
    89      * @param array $gateways
     88     * @return bool
    9089     */
    91     public function maybe_disable_gateway( $gateways ) {
    92         if ( isset( $gateways[ $this->id ] ) && is_checkout() && ! WC_QuickPay_Helper::is_browser( 'safari' ) ) {
    93             unset( $gateways[ $this->id ] );
     90    public function is_available() {
     91        $available = parent::is_available();
     92        if ( $available && ! WC_QuickPay_Helper::is_browser( 'safari' ) && ! is_admin() ) {
     93            $available = false;
    9494        }
    9595
    96         return $gateways;
     96        return $available;
    9797    }
    9898}
  • woocommerce-quickpay/tags/7.1.0/classes/instances/google-pay.php

    r2924617 r3029485  
    3434        add_filter( 'woocommerce_quickpay_cardtypelock_' . $this->id, [ $this, 'filter_cardtypelock' ] );
    3535
    36         add_filter( 'woocommerce_available_payment_gateways', [ $this, 'maybe_disable_gateway' ] );
    3736        add_filter( 'woocommerce_quickpay_checkout_gateway_icon', [ $this, 'filter_icon' ] );
    3837    }
     
    5049        $this->form_fields = [
    5150            'enabled'     => [
    52                 'title'   => __( 'Enable', 'woo-quickpay' ),
    53                 'type'    => 'checkbox',
    54                 'label'   => sprintf( __( 'Enable %s payment', 'woo-quickpay' ), 'Google Pay' ),
    55                 'description' => sprintf(__( 'Works only in %s.', 'woo-quickpay' ), 'Chrome' ),
    56                 'default' => 'no'
     51                'title'       => __( 'Enable', 'woo-quickpay' ),
     52                'type'        => 'checkbox',
     53                'label'       => sprintf( __( 'Enable %s payment', 'woo-quickpay' ), 'Google Pay' ),
     54                'description' => sprintf( __( 'Works only in %s.', 'woo-quickpay' ), 'Chrome' ),
     55                'default'     => 'no'
    5756            ],
    5857            '_Shop_setup' => [
     
    102101
    103102    /**
    104      * @param array $gateways
     103     * @return bool
    105104     */
    106     public function maybe_disable_gateway( $gateways ) {
    107         if ( isset( $gateways[ $this->id ] ) && is_checkout() && ! WC_QuickPay_Helper::is_browser( 'chrome' ) ) {
    108             unset( $gateways[ $this->id ] );
     105    public function is_available() {
     106        $available = parent::is_available();
     107        if ( $available && ! WC_QuickPay_Helper::is_browser( 'chrome' ) ) {
     108            $available = false;
    109109        }
    110110
    111         return $gateways;
     111        return $available;
    112112    }
    113113}
  • woocommerce-quickpay/tags/7.1.0/classes/woocommerce-quickpay-helper.php

    r2975531 r3029485  
    425425        return $random_string;
    426426    }
     427
     428    /**
     429     * @param WC_Payment_Gateway $class
     430     *
     431     * @return bool
     432     */
     433    public static function is_plugin_gateway( WC_Payment_Gateway $class ) {
     434        return $class instanceof WC_QuickPay;
     435    }
     436
     437    /**
     438     * @return array
     439     */
     440    public static function get_plugin_gateways(): array {
     441        return array_filter( wc()->payment_gateways()->payment_gateways(), static function ( $gateway ) {
     442            return static::is_plugin_gateway( $gateway );
     443        } );
     444    }
    427445}
  • woocommerce-quickpay/tags/7.1.0/woocommerce-quickpay.php

    r2975531 r3029485  
    44 * Plugin URI: http://wordpress.org/plugins/woocommerce-quickpay/
    55 * Description: Integrates your QuickPay payment gateway into your WooCommerce installation.
    6  * Version: 7.0.4
     6 * Version: 7.1.0
    77 * Author: Perfect Solution
    88 * Text Domain: woo-quickpay
     
    1414 */
    1515
     16
    1617if ( ! defined( 'ABSPATH' ) ) {
    1718    exit;
    1819}
    1920
    20 define( 'WCQP_VERSION', '7.0.4' );
     21define( 'WCQP_VERSION', '7.1.0' );
    2122define( 'WCQP_URL', plugins_url( __FILE__ ) );
    2223define( 'WCQP_PATH', plugin_dir_path( __FILE__ ) );
     
    6869    require_once WCQP_PATH . 'classes/utils/woocommerce-quickpay-requests-utils.php';
    6970    require_once WCQP_PATH . 'classes/modules/woocommerce-quickpay-module.php';
     71    require_once WCQP_PATH . 'classes/modules/woocommerce-quickpay-blocks-checkout.php';
    7072    require_once WCQP_PATH . 'classes/modules/woocommerce-quickpay-emails.php';
    7173    require_once WCQP_PATH . 'classes/modules/woocommerce-quickpay-admin-ajax.php';
     
    112114        public $log;
    113115
     116        /** @var string */
     117        public $instructions = '';
     118
    114119        /**
    115120         * get_instance
     
    239244            WC_QuickPay_Admin_Orders_Lists_Table::get_instance();
    240245            WC_QuickPay_Admin_Orders_Meta::get_instance();
     246            WC_QuickPay_Blocks_Checkout::get_instance();
    241247            WC_QuickPay_Emails::get_instance();
    242248            WC_QuickPay_Orders::get_instance();
     
    10711077            return plugins_url( $path, __FILE__ );
    10721078        }
     1079
     1080        /**
     1081         * @param string $path
     1082         *
     1083         * @return string
     1084         */
     1085        public function plugin_path( string $path ): string {
     1086            return __DIR__ . $path;
     1087        }
    10731088    }
    10741089
  • woocommerce-quickpay/trunk/README.txt

    r2975531 r3029485  
    2828
    2929== Changelog ==
     30= 7.1.0 =
     31* Feat: Add payment gateway support for WC Checkout Blocks
     32* Fix: Apple Pay - Rely on WC_Payment_Gateway::is_available when disabling gateways in checkout based on gateway specific criteria.
     33* Fix: Google Pay - Rely on WC_Payment_Gateway::is_available when disabling gateways in checkout based on gateway specific criteria.
     34* Fix: Anyday - Rely on WC_Payment_Gateway::is_available when disabling gateways in checkout based on gateway specific criteria.
     35* Fix: Deprecation notice of dynamically declared property $instructions in WC_QuickPay (PHP 8.2)
     36
    3037= 7.0.4 =
    3138* Fix: Remove ISK from list of non-decimal currencies as the QuickPay API requires ISK amount to be multiplied
  • woocommerce-quickpay/trunk/classes/instances/anyday.php

    r2924617 r3029485  
    1818        $this->description = $this->s( 'description' );
    1919
    20         add_filter( 'woocommerce_available_payment_gateways', [ $this, 'maybe_disable_gateway' ] );
    2120        add_filter( 'woocommerce_quickpay_cardtypelock_' . $this->id, [ $this, 'filter_cardtypelock' ] );
    2221    }
     
    7170    }
    7271
    73     /**
    74      * @param array $gateways
    75      */
    76     public function maybe_disable_gateway( $gateways ) {
    77         if ( isset( $gateways[ $this->id ] ) && is_checkout() && ( $cart = WC()->cart ) ) {
     72    public function is_available() {
     73        $available = parent::is_available();
     74
     75        if ( $available && ( $cart = WC()->cart ) ) {
    7876            $cart_total = (float) $cart->get_total( 'edit' );
    79             $cart_min   = 1;
    80             $cart_max   = 30000;
     77
     78            $cart_min = 1;
     79            $cart_max = 30000;
    8180
    8281            if ( ! ( $cart_total >= $cart_min && $cart_total <= $cart_max ) || 'DKK' !== strtoupper( get_woocommerce_currency() ) ) {
    83                 unset( $gateways[ $this->id ] );
     82                $available = false;
    8483            }
    8584        }
    8685
    87         return $gateways;
     86        return $available;
    8887    }
    8988}
  • woocommerce-quickpay/trunk/classes/instances/apple-pay.php

    r2924617 r3029485  
    2020        add_filter( 'woocommerce_quickpay_cardtypelock_' . $this->id, [ $this, 'filter_cardtypelock' ] );
    2121        add_filter( 'woocommerce_quickpay_checkout_gateway_icon', [ $this, 'filter_icon' ] );
    22         add_filter( 'woocommerce_available_payment_gateways', [ $this, 'maybe_disable_gateway' ] );
    2322    }
    2423
     
    8786
    8887    /**
    89      * @param array $gateways
     88     * @return bool
    9089     */
    91     public function maybe_disable_gateway( $gateways ) {
    92         if ( isset( $gateways[ $this->id ] ) && is_checkout() && ! WC_QuickPay_Helper::is_browser( 'safari' ) ) {
    93             unset( $gateways[ $this->id ] );
     90    public function is_available() {
     91        $available = parent::is_available();
     92        if ( $available && ! WC_QuickPay_Helper::is_browser( 'safari' ) && ! is_admin() ) {
     93            $available = false;
    9494        }
    9595
    96         return $gateways;
     96        return $available;
    9797    }
    9898}
  • woocommerce-quickpay/trunk/classes/instances/google-pay.php

    r2924617 r3029485  
    3434        add_filter( 'woocommerce_quickpay_cardtypelock_' . $this->id, [ $this, 'filter_cardtypelock' ] );
    3535
    36         add_filter( 'woocommerce_available_payment_gateways', [ $this, 'maybe_disable_gateway' ] );
    3736        add_filter( 'woocommerce_quickpay_checkout_gateway_icon', [ $this, 'filter_icon' ] );
    3837    }
     
    5049        $this->form_fields = [
    5150            'enabled'     => [
    52                 'title'   => __( 'Enable', 'woo-quickpay' ),
    53                 'type'    => 'checkbox',
    54                 'label'   => sprintf( __( 'Enable %s payment', 'woo-quickpay' ), 'Google Pay' ),
    55                 'description' => sprintf(__( 'Works only in %s.', 'woo-quickpay' ), 'Chrome' ),
    56                 'default' => 'no'
     51                'title'       => __( 'Enable', 'woo-quickpay' ),
     52                'type'        => 'checkbox',
     53                'label'       => sprintf( __( 'Enable %s payment', 'woo-quickpay' ), 'Google Pay' ),
     54                'description' => sprintf( __( 'Works only in %s.', 'woo-quickpay' ), 'Chrome' ),
     55                'default'     => 'no'
    5756            ],
    5857            '_Shop_setup' => [
     
    102101
    103102    /**
    104      * @param array $gateways
     103     * @return bool
    105104     */
    106     public function maybe_disable_gateway( $gateways ) {
    107         if ( isset( $gateways[ $this->id ] ) && is_checkout() && ! WC_QuickPay_Helper::is_browser( 'chrome' ) ) {
    108             unset( $gateways[ $this->id ] );
     105    public function is_available() {
     106        $available = parent::is_available();
     107        if ( $available && ! WC_QuickPay_Helper::is_browser( 'chrome' ) ) {
     108            $available = false;
    109109        }
    110110
    111         return $gateways;
     111        return $available;
    112112    }
    113113}
  • woocommerce-quickpay/trunk/classes/woocommerce-quickpay-helper.php

    r2975531 r3029485  
    425425        return $random_string;
    426426    }
     427
     428    /**
     429     * @param WC_Payment_Gateway $class
     430     *
     431     * @return bool
     432     */
     433    public static function is_plugin_gateway( WC_Payment_Gateway $class ) {
     434        return $class instanceof WC_QuickPay;
     435    }
     436
     437    /**
     438     * @return array
     439     */
     440    public static function get_plugin_gateways(): array {
     441        return array_filter( wc()->payment_gateways()->payment_gateways(), static function ( $gateway ) {
     442            return static::is_plugin_gateway( $gateway );
     443        } );
     444    }
    427445}
  • woocommerce-quickpay/trunk/woocommerce-quickpay.php

    r2975531 r3029485  
    44 * Plugin URI: http://wordpress.org/plugins/woocommerce-quickpay/
    55 * Description: Integrates your QuickPay payment gateway into your WooCommerce installation.
    6  * Version: 7.0.4
     6 * Version: 7.1.0
    77 * Author: Perfect Solution
    88 * Text Domain: woo-quickpay
     
    1414 */
    1515
     16
    1617if ( ! defined( 'ABSPATH' ) ) {
    1718    exit;
    1819}
    1920
    20 define( 'WCQP_VERSION', '7.0.4' );
     21define( 'WCQP_VERSION', '7.1.0' );
    2122define( 'WCQP_URL', plugins_url( __FILE__ ) );
    2223define( 'WCQP_PATH', plugin_dir_path( __FILE__ ) );
     
    6869    require_once WCQP_PATH . 'classes/utils/woocommerce-quickpay-requests-utils.php';
    6970    require_once WCQP_PATH . 'classes/modules/woocommerce-quickpay-module.php';
     71    require_once WCQP_PATH . 'classes/modules/woocommerce-quickpay-blocks-checkout.php';
    7072    require_once WCQP_PATH . 'classes/modules/woocommerce-quickpay-emails.php';
    7173    require_once WCQP_PATH . 'classes/modules/woocommerce-quickpay-admin-ajax.php';
     
    112114        public $log;
    113115
     116        /** @var string */
     117        public $instructions = '';
     118
    114119        /**
    115120         * get_instance
     
    239244            WC_QuickPay_Admin_Orders_Lists_Table::get_instance();
    240245            WC_QuickPay_Admin_Orders_Meta::get_instance();
     246            WC_QuickPay_Blocks_Checkout::get_instance();
    241247            WC_QuickPay_Emails::get_instance();
    242248            WC_QuickPay_Orders::get_instance();
     
    10711077            return plugins_url( $path, __FILE__ );
    10721078        }
     1079
     1080        /**
     1081         * @param string $path
     1082         *
     1083         * @return string
     1084         */
     1085        public function plugin_path( string $path ): string {
     1086            return __DIR__ . $path;
     1087        }
    10731088    }
    10741089
Note: See TracChangeset for help on using the changeset viewer.