tag. + __( + 'Allow your customers to pay in installments without interest while you receive the full payment in a single transaction.* + %3$sActivate your Installments without interest with PayPal.%4$s + %3$sYou will receive the full payment minus the applicable PayPal fee. See %1$sterms and conditions%2$s.%4$s', + 'woocommerce-paypal-payments' + ), + '', + '', + '
', + '
' + ) + ); + + $note->add_action( + 'enable-installments-action-link', + __( 'Enable Installments', 'woocommerce-paypal-payments' ), + esc_url( 'https://www.paypal.com/businessmanage/preferences/installmentplan' ), + Note::E_WC_ADMIN_NOTE_UNACTIONED, + true + ); + + return $note; + } + + /** + * Checks if a note can and should be added. + * + * @return bool + * @throws NotesUnavailableException Throws exception when notes are unavailable. + */ + public static function can_be_added(): bool { + $country = wc_get_base_location()['country'] ?? ''; + if ( $country !== 'MX' ) { + return false; + } + + /** + * The method exists in the NoteTraits trait. + * + * @psalm-suppress UndefinedMethod + */ + if ( self::note_exists() ) { + return false; + } + + return true; + } +} diff --git a/modules/ppcp-wc-gateway/services.php b/modules/ppcp-wc-gateway/services.php index 2113d36e1..ad9c5be7e 100644 --- a/modules/ppcp-wc-gateway/services.php +++ b/modules/ppcp-wc-gateway/services.php @@ -692,7 +692,7 @@ return array( assert( $dcc_configuration instanceof CardPaymentsConfiguration ); $fields = array( - 'checkout_settings_heading' => array( + 'checkout_settings_heading' => array( 'heading' => __( 'Standard Payments Settings', 'woocommerce-paypal-payments' ), 'type' => 'ppcp-heading', 'screens' => array( @@ -702,7 +702,7 @@ return array( 'requirements' => array(), 'gateway' => 'paypal', ), - 'title' => array( + 'title' => array( 'title' => __( 'Title', 'woocommerce-paypal-payments' ), 'type' => 'text', 'description' => __( @@ -718,7 +718,7 @@ return array( 'requirements' => array(), 'gateway' => 'paypal', ), - 'dcc_block_checkout_notice' => array( + 'dcc_block_checkout_notice' => array( 'heading' => '', 'html' => $container->get( 'wcgateway.notice.checkout-blocks' ), 'type' => 'ppcp-html', @@ -729,7 +729,7 @@ return array( 'requirements' => array( 'dcc' ), 'gateway' => 'dcc', ), - 'dcc_enabled' => array( + 'dcc_enabled' => array( 'title' => __( 'Enable/Disable', 'woocommerce-paypal-payments' ), 'desc_tip' => true, 'description' => __( 'Once enabled, the Credit Card option will show up in the checkout.', 'woocommerce-paypal-payments' ), @@ -744,7 +744,7 @@ return array( State::STATE_ONBOARDED, ), ), - 'dcc_gateway_title' => array( + 'dcc_gateway_title' => array( 'title' => __( 'Title', 'woocommerce-paypal-payments' ), 'type' => 'text', 'description' => __( @@ -761,7 +761,7 @@ return array( ), 'gateway' => 'dcc', ), - 'description' => array( + 'description' => array( 'title' => __( 'Description', 'woocommerce-paypal-payments' ), 'type' => 'text', 'desc_tip' => true, @@ -780,7 +780,7 @@ return array( 'requirements' => array(), 'gateway' => 'paypal', ), - 'intent' => array( + 'intent' => array( 'title' => __( 'Intent', 'woocommerce-paypal-payments' ), 'type' => 'select', 'class' => array(), @@ -802,7 +802,7 @@ return array( 'requirements' => array(), 'gateway' => 'paypal', ), - 'capture_on_status_change' => array( + 'capture_on_status_change' => array( 'title' => __( 'Capture On Status Change', 'woocommerce-paypal-payments' ), 'type' => 'checkbox', 'default' => false, @@ -819,7 +819,7 @@ return array( 'requirements' => array(), 'gateway' => 'paypal', ), - 'capture_for_virtual_only' => array( + 'capture_for_virtual_only' => array( 'title' => __( 'Capture Virtual-Only Orders ', 'woocommerce-paypal-payments' ), 'type' => 'checkbox', 'default' => false, @@ -836,7 +836,7 @@ return array( 'requirements' => array(), 'gateway' => 'paypal', ), - 'payee_preferred' => array( + 'payee_preferred' => array( 'title' => __( 'Instant Payments ', 'woocommerce-paypal-payments' ), 'type' => 'checkbox', 'default' => false, @@ -853,7 +853,7 @@ return array( 'requirements' => array(), 'gateway' => 'paypal', ), - 'brand_name' => array( + 'brand_name' => array( 'title' => __( 'Brand Name', 'woocommerce-paypal-payments' ), 'type' => 'text', 'default' => get_bloginfo( 'name' ), @@ -869,7 +869,7 @@ return array( 'requirements' => array(), 'gateway' => 'paypal', ), - 'landing_page' => array( + 'landing_page' => array( 'title' => __( 'Landing Page', 'woocommerce-paypal-payments' ), 'type' => 'select', 'class' => array(), @@ -891,7 +891,7 @@ return array( 'requirements' => array(), 'gateway' => 'paypal', ), - 'alternative_payment_methods' => array( + 'alternative_payment_methods' => array( 'heading' => __( 'Alternative Payment Methods', 'woocommerce-paypal-payments' ), 'description' => sprintf( // translators: %1$s, %2$s, %3$s and %4$s are a link tags. @@ -907,7 +907,7 @@ return array( 'requirements' => array(), 'gateway' => 'paypal', ), - 'disable_funding' => array( + 'disable_funding' => array( 'title' => __( 'Disable Alternative Payment Methods', 'woocommerce-paypal-payments' ), 'type' => 'ppcp-multiselect', 'class' => array(), @@ -931,7 +931,7 @@ return array( 'requirements' => array(), 'gateway' => 'paypal', ), - 'card_billing_data_mode' => array( + 'card_billing_data_mode' => array( 'title' => __( 'Send checkout billing data to card fields', 'woocommerce-paypal-payments' ), 'type' => 'select', 'class' => array(), @@ -951,7 +951,7 @@ return array( 'requirements' => array(), 'gateway' => array( 'paypal', CardButtonGateway::ID ), ), - 'allow_card_button_gateway' => array( + 'allow_card_button_gateway' => array( 'title' => __( 'Create gateway for Standard Card Button', 'woocommerce-paypal-payments' ), 'type' => 'checkbox', 'desc_tip' => true, @@ -965,7 +965,7 @@ return array( 'requirements' => array(), 'gateway' => 'paypal', ), - 'allow_local_apm_gateways' => array( + 'allow_local_apm_gateways' => array( 'title' => __( 'Create gateway for alternative payment methods', 'woocommerce-paypal-payments' ), 'type' => 'checkbox', 'desc_tip' => true, @@ -979,7 +979,7 @@ return array( 'requirements' => array(), 'gateway' => 'paypal', ), - 'disable_cards' => array( + 'disable_cards' => array( 'title' => __( 'Disable specific credit cards', 'woocommerce-paypal-payments' ), 'type' => 'ppcp-multiselect', 'class' => array(), @@ -1007,7 +1007,7 @@ return array( ), 'gateway' => 'dcc', ), - 'card_icons' => array( + 'card_icons' => array( 'title' => __( 'Show logo of the following credit cards', 'woocommerce-paypal-payments' ), 'type' => 'ppcp-multiselect', 'class' => array(), @@ -1046,7 +1046,7 @@ return array( ), 'gateway' => 'dcc', ), - 'dcc_name_on_card' => array( + 'dcc_name_on_card' => array( 'title' => __( 'Cardholder Name', 'woocommerce-paypal-payments' ), 'type' => 'select', 'default' => $dcc_configuration->show_name_on_card(), @@ -1060,7 +1060,7 @@ return array( 'gateway' => array( 'dcc', 'axo' ), 'requirements' => array( 'axo' ), ), - '3d_secure_heading' => array( + '3d_secure_heading' => array( 'heading' => __( '3D Secure', 'woocommerce-paypal-payments' ), 'type' => 'ppcp-heading', 'description' => wp_kses_post( @@ -1088,7 +1088,7 @@ return array( ), 'gateway' => 'dcc', ), - '3d_secure_contingency' => array( + '3d_secure_contingency' => array( 'title' => __( 'Contingency for 3D Secure', 'woocommerce-paypal-payments' ), 'type' => 'select', 'description' => sprintf( @@ -1116,7 +1116,7 @@ return array( ), 'gateway' => 'dcc', ), - 'saved_payments_heading' => array( + 'saved_payments_heading' => array( 'heading' => __( 'Saved Payments', 'woocommerce-paypal-payments' ), 'type' => 'ppcp-heading', 'description' => wp_kses_post( @@ -1143,7 +1143,7 @@ return array( ), 'gateway' => 'dcc', ), - 'vault_enabled_dcc' => array( + 'vault_enabled_dcc' => array( 'title' => __( 'Vaulting', 'woocommerce-paypal-payments' ), 'type' => 'checkbox', 'desc_tip' => true, @@ -1162,7 +1162,38 @@ return array( 'gateway' => 'dcc', 'input_class' => $container->get( 'wcgateway.helper.vaulting-scope' ) ? array() : array( 'ppcp-disabled-checkbox' ), ), - 'paypal_saved_payments' => array( + 'mexico_installments' => array( + 'heading' => __( 'Installments', 'woocommerce-paypal-payments' ), + 'type' => 'ppcp-heading', + 'screens' => array( + State::STATE_ONBOARDED, + ), + 'requirements' => array(), + 'gateway' => 'paypal', + 'description' => sprintf( + // translators: %1$s and %2$s are the opening and closing of HTML tag. %3$s and %4$s are the opening and closing of HTMLtag. + __( + 'Allow your customers to pay in installments without interest while you receive the full payment in a single transaction.* + %3$sTerms and conditions: *You will receive the full payment minus the applicable PayPal fee. See %1$sterms and conditions%2$s.%4$s', + 'woocommerce-paypal-payments' + ), + '', + '', + '
', + '
' + ), + ), + 'mexico_installments_action_link' => array( + 'title' => __( 'Activate your Installments', 'woocommerce-paypal-payments' ), + 'type' => 'ppcp-text', + 'text' => '' . esc_html__( 'Enable Installments', 'woocommerce-paypal-payments' ) . '', + 'screens' => array( + State::STATE_ONBOARDED, + ), + 'requirements' => array(), + 'gateway' => 'paypal', + ), + 'paypal_saved_payments' => array( 'heading' => __( 'Saved payments', 'woocommerce-paypal-payments' ), 'description' => sprintf( // translators: %1$s, %2$s, %3$s and %4$s are a link tags. @@ -1180,8 +1211,8 @@ return array( 'requirements' => array(), 'gateway' => 'paypal', ), - 'subscriptions_mode' => $container->get( 'wcgateway.settings.fields.subscriptions_mode' ), - 'vault_enabled' => array( + 'subscriptions_mode' => $container->get( 'wcgateway.settings.fields.subscriptions_mode' ), + 'vault_enabled' => array( 'title' => __( 'Vaulting', 'woocommerce-paypal-payments' ), 'type' => 'checkbox', 'desc_tip' => true, @@ -1200,7 +1231,7 @@ return array( 'gateway' => 'paypal', 'input_class' => $container->get( 'wcgateway.helper.vaulting-scope' ) ? array() : array( 'ppcp-disabled-checkbox' ), ), - 'digital_wallet_heading' => array( + 'digital_wallet_heading' => array( 'heading' => __( 'Digital Wallet Services', 'woocommerce-paypal-payments' ), 'type' => 'ppcp-heading', 'description' => wp_kses_post( @@ -1255,6 +1286,11 @@ return array( $fields['disable_cards']['options'] = $card_options; $fields['card_icons']['options'] = array_merge( $dark_versions, $card_options ); + if ( $container->get( 'api.shop.country' ) !== 'MX' ) { + unset( $fields['mexico_installments'] ); + unset( $fields['mexico_installments_action_link'] ); + } + return $fields; }, diff --git a/readme.txt b/readme.txt index 8228491f3..2671d46ba 100644 --- a/readme.txt +++ b/readme.txt @@ -163,6 +163,8 @@ If you encounter issues with the PayPal buttons not appearing after an update, p * Enhancement - Enhance the accessibility of the new Settings UI #3294 * Enhancement - Add capture pre-conditions for card payment source #3300 * Enhancement - Enable all/Disable all toggle next to Alternative Payment methods on Payment Methods tab #3321 +* Enhancement - Add installment notifications for Mexico store locations #3404, #3405 +* Fix - Various issues for Mexico store locations during onboarding & plugin configuration #3403 * Fix - APFS plugin triggers incorrect renewal date for simple products as subscriptions #3272 * Fix - PayPal Smart Button incompatible with WooCommerce Subscription Switching #3291 * Fix - Fastlane gateway visible on Pay for Order page #3293