From a622dac811dd460c2a2bcefb347ce8ea2b5a8395 Mon Sep 17 00:00:00 2001 From: Francesco Date: Tue, 3 Dec 2024 10:04:28 +0100 Subject: [PATCH] chore: PRB references to ECE (#9780) Co-authored-by: Samir Merchant --- .../chore-prb-references-in-ece-docs-and-logs | 4 ++ ...xpress-checkout-button-display-handler.php | 2 +- ...yments-express-checkout-button-handler.php | 4 +- ...ayments-express-checkout-button-helper.php | 38 +++++++++---------- 4 files changed, 26 insertions(+), 22 deletions(-) create mode 100644 changelog/chore-prb-references-in-ece-docs-and-logs diff --git a/changelog/chore-prb-references-in-ece-docs-and-logs b/changelog/chore-prb-references-in-ece-docs-and-logs new file mode 100644 index 00000000000..887525ff7bc --- /dev/null +++ b/changelog/chore-prb-references-in-ece-docs-and-logs @@ -0,0 +1,4 @@ +Significance: patch +Type: update + +chore: renamed PRB references in GooglePay/ApplePay implementation docs and logs files to ECE. diff --git a/includes/express-checkout/class-wc-payments-express-checkout-button-display-handler.php b/includes/express-checkout/class-wc-payments-express-checkout-button-display-handler.php index 1f9470bbf65..f9c978d43a1 100644 --- a/includes/express-checkout/class-wc-payments-express-checkout-button-display-handler.php +++ b/includes/express-checkout/class-wc-payments-express-checkout-button-display-handler.php @@ -123,7 +123,7 @@ public function display_express_checkout_buttons() { $should_show_woopay = $this->platform_checkout_button_handler->should_show_woopay_button(); $should_show_express_checkout_button = $this->express_checkout_helper->should_show_express_checkout_button(); - // When Payment Request button is enabled, we need the separator markup on the page, but hidden in case the browser doesn't have any payment request methods to display. + // When Express Checkout button is enabled, we need the separator markup on the page, but hidden in case the browser doesn't have any express payment methods to display. // More details: https://github.com/Automattic/woocommerce-payments/pull/5399#discussion_r1073633776. $separator_starts_hidden = ! $should_show_woopay; if ( $should_show_woopay || $should_show_express_checkout_button ) { diff --git a/includes/express-checkout/class-wc-payments-express-checkout-button-handler.php b/includes/express-checkout/class-wc-payments-express-checkout-button-handler.php index 03f0100cefa..f580cc45565 100644 --- a/includes/express-checkout/class-wc-payments-express-checkout-button-handler.php +++ b/includes/express-checkout/class-wc-payments-express-checkout-button-handler.php @@ -204,7 +204,7 @@ public function is_account_creation_possible() { $is_signup_from_checkout_allowed = 'yes' === get_option( 'woocommerce_enable_signup_from_checkout_for_subscriptions', 'no' ); } - // If automatically generate username/password are disabled, the Payment Request API + // If automatically generate username/password are disabled, the Express Checkout API // can't include any of those fields, so account creation is not possible. return ( $is_signup_from_checkout_allowed && @@ -311,7 +311,7 @@ public function scripts() { } /** - * Display the payment request button. + * Display the express checkout button. */ public function display_express_checkout_button_html() { if ( ! $this->express_checkout_helper->should_show_express_checkout_button() ) { diff --git a/includes/express-checkout/class-wc-payments-express-checkout-button-helper.php b/includes/express-checkout/class-wc-payments-express-checkout-button-helper.php index 561679882a7..285ce659d94 100644 --- a/includes/express-checkout/class-wc-payments-express-checkout-button-helper.php +++ b/includes/express-checkout/class-wc-payments-express-checkout-button-helper.php @@ -59,7 +59,7 @@ public function get_booking_id_from_cart() { } /** - * Builds the line items to pass to Payment Request + * Builds the line items to pass to Express Checkout * * @param boolean $itemized_display_items Indicates whether to show subtotals or itemized views. */ @@ -182,7 +182,7 @@ public function get_total_label() { * @return int */ public function get_quantity() { - // Payment Request Button sends the quantity as qty. WooPay sends it as quantity. + // Express Checkout Element sends the quantity as qty. WooPay sends it as quantity. if ( isset( $_POST['quantity'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing return absint( $_POST['quantity'] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing } elseif ( isset( $_POST['qty'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing @@ -245,7 +245,7 @@ public function is_available_at( $location, $option_name ) { } /** - * Gets settings that are shared between the Payment Request button and the WooPay button. + * Gets settings that are shared between the Express Checkout button and the WooPay button. * * @return array */ @@ -361,7 +361,7 @@ public function is_product_subscription( WC_Product $product ): bool { } /** - * Checks whether Payment Request Button should be available on this page. + * Checks whether Express Checkout Element Button should be available on this page. * * @return bool */ @@ -373,7 +373,7 @@ public function should_show_express_checkout_button() { // If no SSL, bail. if ( ! WC_Payments::mode()->is_test() && ! is_ssl() ) { - Logger::log( 'Stripe Payment Request live mode requires SSL.' ); + Logger::log( 'Stripe Express Checkout live mode requires SSL.' ); return false; } @@ -400,13 +400,13 @@ public function should_show_express_checkout_button() { // Product page, but has unsupported product type. if ( $this->is_product() && ! $this->is_product_supported() ) { - Logger::log( 'Product page has unsupported product type ( Payment Request button disabled )' ); + Logger::log( 'Product page has unsupported product type ( Express Checkout Element button disabled )' ); return false; } // Cart has unsupported product type. if ( ( $this->is_checkout() || $this->is_cart() ) && ! $this->has_allowed_items_in_cart() ) { - Logger::log( 'Items in the cart have unsupported product type ( Payment Request button disabled )' ); + Logger::log( 'Items in the cart have unsupported product type ( Express Checkout Element button disabled )' ); return false; } @@ -439,7 +439,7 @@ public function should_show_express_checkout_button() { ( $this->is_product() && 0.0 === (float) $this->get_product()->get_price() ) ) { - Logger::log( 'Order price is 0 ( Payment Request button disabled )' ); + Logger::log( 'Order price is 0 ( Express Checkout Element button disabled )' ); return false; } @@ -509,11 +509,11 @@ public function has_allowed_items_in_cart() { } /** - * Filter whether product supports Payment Request Button on cart page. + * Filter whether product supports Express Checkout Element Button on cart page. * * @since 6.9.0 * - * @param boolean $is_supported Whether product supports Payment Request Button on cart page. + * @param boolean $is_supported Whether product supports Express Checkout Element Button on cart page. * @param object $_product Product object. */ if ( ! apply_filters( 'wcpay_payment_request_is_cart_supported', true, $_product ) ) { @@ -530,7 +530,7 @@ public function has_allowed_items_in_cart() { } } - // We don't support multiple packages with Payment Request Buttons because we can't offer a good UX. + // We don't support multiple packages with Express Checkout Element Buttons because we can't offer a good UX. $packages = WC()->cart->get_shipping_packages(); if ( 1 < ( is_countable( $packages ) ? count( $packages ) : 0 ) ) { return false; @@ -618,7 +618,7 @@ public function get_shipping_options( $shipping_address, $itemized_display_items /** * Restores the shipping methods previously chosen for each recurring cart after shipping was reset and recalculated - * during the Payment Request get_shipping_options flow. + * during the Express Checkout get_shipping_options flow. * * When the cart contains multiple subscriptions with different billing periods, customers are able to select different shipping * methods for each subscription, however, this is not supported when purchasing with Apple Pay and Google Pay as it's @@ -888,7 +888,7 @@ public function get_normalized_state( $state, $country ) { return $state; } - // Try to match state from the Payment Request API list of states. + // Try to match state from the Express Checkout API list of states. $state = $this->get_normalized_state_from_ece_states( $state, $country ); // If it's normalized, return. @@ -902,11 +902,11 @@ public function get_normalized_state( $state, $country ) { } /** - * The Payment Request API provides its own validation for the address form. + * The Express Checkout Element API provides its own validation for the address form. * For some countries, it might not provide a state field, so we need to return a more descriptive - * error message, indicating that the Payment Request button is not supported for that country. + * error message, indicating that the Express Checkout Element button is not supported for that country. */ - public static function validate_state() { + public function validate_state() { $wc_checkout = WC_Checkout::instance(); $posted_data = $wc_checkout->get_posted_data(); $checkout_fields = $wc_checkout->get_checkout_fields(); @@ -927,7 +927,7 @@ public static function validate_state() { wc_add_notice( sprintf( /* translators: %s: country. */ - __( 'The payment request button is not supported in %s because some required fields couldn\'t be verified. Please proceed to the checkout page and try again.', 'woocommerce-payments' ), + __( 'The express checkout is not supported in %s because some required fields couldn\'t be verified. Please proceed to the checkout page and try again.', 'woocommerce-payments' ), $countries[ $posted_data['billing_country'] ] ?? $posted_data['billing_country'] ), 'error' @@ -969,7 +969,7 @@ public function is_normalized_state( $state, $country ) { } /** - * Get normalized state from Payment Request API dropdown list of states. + * Get normalized state from Express Checkout API dropdown list of states. * * @param string $state Full state name or state code. * @param string $country Two-letter country code. @@ -987,7 +987,7 @@ public function get_normalized_state_from_ece_states( $state, $country ) { foreach ( $pr_states[ $country ] as $wc_state_abbr => $pr_state ) { $sanitized_state_string = $this->sanitize_string( $state ); - // Checks if input state matches with Payment Request state code (0), name (1) or localName (2). + // Checks if input state matches with Express Checkout state code (0), name (1) or localName (2). if ( ( ! empty( $pr_state[0] ) && $sanitized_state_string === $this->sanitize_string( $pr_state[0] ) ) || ( ! empty( $pr_state[1] ) && $sanitized_state_string === $this->sanitize_string( $pr_state[1] ) ) ||