Changeset 3029485
- Timestamp:
- 01/31/2024 11:48:18 AM (2 years ago)
- Location:
- woocommerce-quickpay
- Files:
-
- 10 added
- 12 edited
- 1 copied
-
tags/7.1.0 (copied) (copied from woocommerce-quickpay/trunk)
-
tags/7.1.0/README.txt (modified) (1 diff)
-
tags/7.1.0/assets/javascript/checkout-blocks.js (added)
-
tags/7.1.0/assets/stylesheets/checkout-blocks.css (added)
-
tags/7.1.0/classes/instances/anyday.php (modified) (2 diffs)
-
tags/7.1.0/classes/instances/apple-pay.php (modified) (2 diffs)
-
tags/7.1.0/classes/instances/blocks (added)
-
tags/7.1.0/classes/instances/blocks/quickpay-block.php (added)
-
tags/7.1.0/classes/instances/google-pay.php (modified) (3 diffs)
-
tags/7.1.0/classes/modules/woocommerce-quickpay-blocks-checkout.php (added)
-
tags/7.1.0/classes/woocommerce-quickpay-helper.php (modified) (1 diff)
-
tags/7.1.0/woocommerce-quickpay.php (modified) (6 diffs)
-
trunk/README.txt (modified) (1 diff)
-
trunk/assets/javascript/checkout-blocks.js (added)
-
trunk/assets/stylesheets/checkout-blocks.css (added)
-
trunk/classes/instances/anyday.php (modified) (2 diffs)
-
trunk/classes/instances/apple-pay.php (modified) (2 diffs)
-
trunk/classes/instances/blocks (added)
-
trunk/classes/instances/blocks/quickpay-block.php (added)
-
trunk/classes/instances/google-pay.php (modified) (3 diffs)
-
trunk/classes/modules/woocommerce-quickpay-blocks-checkout.php (added)
-
trunk/classes/woocommerce-quickpay-helper.php (modified) (1 diff)
-
trunk/woocommerce-quickpay.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
woocommerce-quickpay/tags/7.1.0/README.txt
r2975531 r3029485 28 28 29 29 == 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 30 37 = 7.0.4 = 31 38 * 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 18 18 $this->description = $this->s( 'description' ); 19 19 20 add_filter( 'woocommerce_available_payment_gateways', [ $this, 'maybe_disable_gateway' ] );21 20 add_filter( 'woocommerce_quickpay_cardtypelock_' . $this->id, [ $this, 'filter_cardtypelock' ] ); 22 21 } … … 71 70 } 72 71 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 ) ) { 78 76 $cart_total = (float) $cart->get_total( 'edit' ); 79 $cart_min = 1; 80 $cart_max = 30000; 77 78 $cart_min = 1; 79 $cart_max = 30000; 81 80 82 81 if ( ! ( $cart_total >= $cart_min && $cart_total <= $cart_max ) || 'DKK' !== strtoupper( get_woocommerce_currency() ) ) { 83 unset( $gateways[ $this->id ] );82 $available = false; 84 83 } 85 84 } 86 85 87 return $ gateways;86 return $available; 88 87 } 89 88 } -
woocommerce-quickpay/tags/7.1.0/classes/instances/apple-pay.php
r2924617 r3029485 20 20 add_filter( 'woocommerce_quickpay_cardtypelock_' . $this->id, [ $this, 'filter_cardtypelock' ] ); 21 21 add_filter( 'woocommerce_quickpay_checkout_gateway_icon', [ $this, 'filter_icon' ] ); 22 add_filter( 'woocommerce_available_payment_gateways', [ $this, 'maybe_disable_gateway' ] );23 22 } 24 23 … … 87 86 88 87 /** 89 * @ param array $gateways88 * @return bool 90 89 */ 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; 94 94 } 95 95 96 return $ gateways;96 return $available; 97 97 } 98 98 } -
woocommerce-quickpay/tags/7.1.0/classes/instances/google-pay.php
r2924617 r3029485 34 34 add_filter( 'woocommerce_quickpay_cardtypelock_' . $this->id, [ $this, 'filter_cardtypelock' ] ); 35 35 36 add_filter( 'woocommerce_available_payment_gateways', [ $this, 'maybe_disable_gateway' ] );37 36 add_filter( 'woocommerce_quickpay_checkout_gateway_icon', [ $this, 'filter_icon' ] ); 38 37 } … … 50 49 $this->form_fields = [ 51 50 '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' 57 56 ], 58 57 '_Shop_setup' => [ … … 102 101 103 102 /** 104 * @ param array $gateways103 * @return bool 105 104 */ 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; 109 109 } 110 110 111 return $ gateways;111 return $available; 112 112 } 113 113 } -
woocommerce-quickpay/tags/7.1.0/classes/woocommerce-quickpay-helper.php
r2975531 r3029485 425 425 return $random_string; 426 426 } 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 } 427 445 } -
woocommerce-quickpay/tags/7.1.0/woocommerce-quickpay.php
r2975531 r3029485 4 4 * Plugin URI: http://wordpress.org/plugins/woocommerce-quickpay/ 5 5 * Description: Integrates your QuickPay payment gateway into your WooCommerce installation. 6 * Version: 7. 0.46 * Version: 7.1.0 7 7 * Author: Perfect Solution 8 8 * Text Domain: woo-quickpay … … 14 14 */ 15 15 16 16 17 if ( ! defined( 'ABSPATH' ) ) { 17 18 exit; 18 19 } 19 20 20 define( 'WCQP_VERSION', '7. 0.4' );21 define( 'WCQP_VERSION', '7.1.0' ); 21 22 define( 'WCQP_URL', plugins_url( __FILE__ ) ); 22 23 define( 'WCQP_PATH', plugin_dir_path( __FILE__ ) ); … … 68 69 require_once WCQP_PATH . 'classes/utils/woocommerce-quickpay-requests-utils.php'; 69 70 require_once WCQP_PATH . 'classes/modules/woocommerce-quickpay-module.php'; 71 require_once WCQP_PATH . 'classes/modules/woocommerce-quickpay-blocks-checkout.php'; 70 72 require_once WCQP_PATH . 'classes/modules/woocommerce-quickpay-emails.php'; 71 73 require_once WCQP_PATH . 'classes/modules/woocommerce-quickpay-admin-ajax.php'; … … 112 114 public $log; 113 115 116 /** @var string */ 117 public $instructions = ''; 118 114 119 /** 115 120 * get_instance … … 239 244 WC_QuickPay_Admin_Orders_Lists_Table::get_instance(); 240 245 WC_QuickPay_Admin_Orders_Meta::get_instance(); 246 WC_QuickPay_Blocks_Checkout::get_instance(); 241 247 WC_QuickPay_Emails::get_instance(); 242 248 WC_QuickPay_Orders::get_instance(); … … 1071 1077 return plugins_url( $path, __FILE__ ); 1072 1078 } 1079 1080 /** 1081 * @param string $path 1082 * 1083 * @return string 1084 */ 1085 public function plugin_path( string $path ): string { 1086 return __DIR__ . $path; 1087 } 1073 1088 } 1074 1089 -
woocommerce-quickpay/trunk/README.txt
r2975531 r3029485 28 28 29 29 == 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 30 37 = 7.0.4 = 31 38 * 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 18 18 $this->description = $this->s( 'description' ); 19 19 20 add_filter( 'woocommerce_available_payment_gateways', [ $this, 'maybe_disable_gateway' ] );21 20 add_filter( 'woocommerce_quickpay_cardtypelock_' . $this->id, [ $this, 'filter_cardtypelock' ] ); 22 21 } … … 71 70 } 72 71 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 ) ) { 78 76 $cart_total = (float) $cart->get_total( 'edit' ); 79 $cart_min = 1; 80 $cart_max = 30000; 77 78 $cart_min = 1; 79 $cart_max = 30000; 81 80 82 81 if ( ! ( $cart_total >= $cart_min && $cart_total <= $cart_max ) || 'DKK' !== strtoupper( get_woocommerce_currency() ) ) { 83 unset( $gateways[ $this->id ] );82 $available = false; 84 83 } 85 84 } 86 85 87 return $ gateways;86 return $available; 88 87 } 89 88 } -
woocommerce-quickpay/trunk/classes/instances/apple-pay.php
r2924617 r3029485 20 20 add_filter( 'woocommerce_quickpay_cardtypelock_' . $this->id, [ $this, 'filter_cardtypelock' ] ); 21 21 add_filter( 'woocommerce_quickpay_checkout_gateway_icon', [ $this, 'filter_icon' ] ); 22 add_filter( 'woocommerce_available_payment_gateways', [ $this, 'maybe_disable_gateway' ] );23 22 } 24 23 … … 87 86 88 87 /** 89 * @ param array $gateways88 * @return bool 90 89 */ 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; 94 94 } 95 95 96 return $ gateways;96 return $available; 97 97 } 98 98 } -
woocommerce-quickpay/trunk/classes/instances/google-pay.php
r2924617 r3029485 34 34 add_filter( 'woocommerce_quickpay_cardtypelock_' . $this->id, [ $this, 'filter_cardtypelock' ] ); 35 35 36 add_filter( 'woocommerce_available_payment_gateways', [ $this, 'maybe_disable_gateway' ] );37 36 add_filter( 'woocommerce_quickpay_checkout_gateway_icon', [ $this, 'filter_icon' ] ); 38 37 } … … 50 49 $this->form_fields = [ 51 50 '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' 57 56 ], 58 57 '_Shop_setup' => [ … … 102 101 103 102 /** 104 * @ param array $gateways103 * @return bool 105 104 */ 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; 109 109 } 110 110 111 return $ gateways;111 return $available; 112 112 } 113 113 } -
woocommerce-quickpay/trunk/classes/woocommerce-quickpay-helper.php
r2975531 r3029485 425 425 return $random_string; 426 426 } 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 } 427 445 } -
woocommerce-quickpay/trunk/woocommerce-quickpay.php
r2975531 r3029485 4 4 * Plugin URI: http://wordpress.org/plugins/woocommerce-quickpay/ 5 5 * Description: Integrates your QuickPay payment gateway into your WooCommerce installation. 6 * Version: 7. 0.46 * Version: 7.1.0 7 7 * Author: Perfect Solution 8 8 * Text Domain: woo-quickpay … … 14 14 */ 15 15 16 16 17 if ( ! defined( 'ABSPATH' ) ) { 17 18 exit; 18 19 } 19 20 20 define( 'WCQP_VERSION', '7. 0.4' );21 define( 'WCQP_VERSION', '7.1.0' ); 21 22 define( 'WCQP_URL', plugins_url( __FILE__ ) ); 22 23 define( 'WCQP_PATH', plugin_dir_path( __FILE__ ) ); … … 68 69 require_once WCQP_PATH . 'classes/utils/woocommerce-quickpay-requests-utils.php'; 69 70 require_once WCQP_PATH . 'classes/modules/woocommerce-quickpay-module.php'; 71 require_once WCQP_PATH . 'classes/modules/woocommerce-quickpay-blocks-checkout.php'; 70 72 require_once WCQP_PATH . 'classes/modules/woocommerce-quickpay-emails.php'; 71 73 require_once WCQP_PATH . 'classes/modules/woocommerce-quickpay-admin-ajax.php'; … … 112 114 public $log; 113 115 116 /** @var string */ 117 public $instructions = ''; 118 114 119 /** 115 120 * get_instance … … 239 244 WC_QuickPay_Admin_Orders_Lists_Table::get_instance(); 240 245 WC_QuickPay_Admin_Orders_Meta::get_instance(); 246 WC_QuickPay_Blocks_Checkout::get_instance(); 241 247 WC_QuickPay_Emails::get_instance(); 242 248 WC_QuickPay_Orders::get_instance(); … … 1071 1077 return plugins_url( $path, __FILE__ ); 1072 1078 } 1079 1080 /** 1081 * @param string $path 1082 * 1083 * @return string 1084 */ 1085 public function plugin_path( string $path ): string { 1086 return __DIR__ . $path; 1087 } 1073 1088 } 1074 1089
Note: See TracChangeset
for help on using the changeset viewer.