From 25709e2f8dcbb611b7dc910d79daf2704255a482 Mon Sep 17 00:00:00 2001 From: carmenmaymo Date: Mon, 17 Feb 2025 14:04:34 +0100 Subject: [PATCH 01/11] Add wp_set_script_translations to settings module --- modules/ppcp-settings/src/SettingsModule.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/modules/ppcp-settings/src/SettingsModule.php b/modules/ppcp-settings/src/SettingsModule.php index 1e6c1f818..6c84c5964 100644 --- a/modules/ppcp-settings/src/SettingsModule.php +++ b/modules/ppcp-settings/src/SettingsModule.php @@ -106,7 +106,11 @@ class SettingsModule implements ServiceModule, ExecutableModule { ) ); - wp_enqueue_script( 'ppcp-switch-settings-ui' ); + wp_enqueue_script( 'ppcp-switch-settings-ui','',['wp-i18n'] ); + wp_set_script_translations( + 'ppcp-switch-settings-ui', + 'woocommerce-paypal-payments', + ); } ); @@ -159,7 +163,11 @@ class SettingsModule implements ServiceModule, ExecutableModule { true ); - wp_enqueue_script( 'ppcp-admin-settings' ); + wp_enqueue_script('ppcp-admin-settings', '', ['wp-i18n']); + wp_set_script_translations( + 'ppcp-admin-settings', + 'woocommerce-paypal-payments', + ); /** * Require resolves. @@ -198,11 +206,14 @@ class SettingsModule implements ServiceModule, ExecutableModule { wp_enqueue_script( 'ppcp-paylater-configurator-lib', 'https://www.paypalobjects.com/merchant-library/merchant-configurator.js', - array(), + ['wp-i18n'], $script_asset_file['version'], true ); - + wp_set_script_translations( + 'ppcp-paylater-configurator-lib', + 'woocommerce-paypal-payments', + ); $script_data['PcpPayLaterConfigurator'] = array( 'config' => array(), 'merchantClientId' => $settings->get( 'client_id' ), From 86317a63d1274c2baa916a68634f82472ec566f3 Mon Sep 17 00:00:00 2001 From: Emili Castells Guasch Date: Mon, 17 Feb 2025 16:19:00 +0100 Subject: [PATCH 02/11] Add PayPal merchant country to seller status --- .../src/Endpoint/PartnersEndpoint.php | 2 +- modules/ppcp-api-client/src/Entity/SellerStatus.php | 12 +++++++++++- .../src/Factory/SellerStatusFactory.php | 4 ++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/modules/ppcp-api-client/src/Endpoint/PartnersEndpoint.php b/modules/ppcp-api-client/src/Endpoint/PartnersEndpoint.php index b7624d2de..2a5f321bc 100644 --- a/modules/ppcp-api-client/src/Endpoint/PartnersEndpoint.php +++ b/modules/ppcp-api-client/src/Endpoint/PartnersEndpoint.php @@ -160,7 +160,7 @@ class PartnersEndpoint { $this->failure_registry->clear_failures( FailureRegistry::SELLER_STATUS_KEY ); - $status = $this->seller_status_factory->from_paypal_reponse( $json ); + $status = $this->seller_status_factory->from_paypal_response( $json ); return $status; } } diff --git a/modules/ppcp-api-client/src/Entity/SellerStatus.php b/modules/ppcp-api-client/src/Entity/SellerStatus.php index 5b972efc7..0fb18aa0a 100644 --- a/modules/ppcp-api-client/src/Entity/SellerStatus.php +++ b/modules/ppcp-api-client/src/Entity/SellerStatus.php @@ -28,15 +28,23 @@ class SellerStatus { */ private $capabilities; + /** + * Merchant country on PayPal. + * + * @var string + */ + private $country; + /** * SellerStatus constructor. * * @param SellerStatusProduct[] $products The products. * @param SellerStatusCapability[] $capabilities The capabilities. + * @param string $country Merchant country on PayPal. * * @psalm-suppress RedundantConditionGivenDocblockType */ - public function __construct( array $products, array $capabilities ) { + public function __construct( array $products, array $capabilities, string $country = '' ) { foreach ( $products as $key => $product ) { if ( is_a( $product, SellerStatusProduct::class ) ) { continue; @@ -52,6 +60,7 @@ class SellerStatus { $this->products = $products; $this->capabilities = $capabilities; + $this->country = $country; } /** @@ -95,6 +104,7 @@ class SellerStatus { return array( 'products' => $products, 'capabilities' => $capabilities, + 'country' => $this->country, ); } } diff --git a/modules/ppcp-api-client/src/Factory/SellerStatusFactory.php b/modules/ppcp-api-client/src/Factory/SellerStatusFactory.php index 9f1ff31f4..4182b5815 100644 --- a/modules/ppcp-api-client/src/Factory/SellerStatusFactory.php +++ b/modules/ppcp-api-client/src/Factory/SellerStatusFactory.php @@ -25,7 +25,7 @@ class SellerStatusFactory { * * @return SellerStatus */ - public function from_paypal_reponse( \stdClass $json ) : SellerStatus { + public function from_paypal_response( \stdClass $json ) : SellerStatus { $products = array_map( function( $json ) : SellerStatusProduct { $product = new SellerStatusProduct( @@ -49,6 +49,6 @@ class SellerStatusFactory { isset( $json->capabilities ) ? (array) $json->capabilities : array() ); - return new SellerStatus( $products, $capabilities ); + return new SellerStatus( $products, $capabilities, $json->country ?? '' ); } } From 32c34e7b89d38899829c7b1998c107143c49c73b Mon Sep 17 00:00:00 2001 From: Emili Castells Guasch Date: Mon, 17 Feb 2025 17:52:11 +0100 Subject: [PATCH 03/11] Get country code from seller status --- modules/ppcp-api-client/src/Entity/SellerStatus.php | 6 +++++- modules/ppcp-settings/src/SettingsModule.php | 9 +++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/modules/ppcp-api-client/src/Entity/SellerStatus.php b/modules/ppcp-api-client/src/Entity/SellerStatus.php index 0fb18aa0a..23f05016d 100644 --- a/modules/ppcp-api-client/src/Entity/SellerStatus.php +++ b/modules/ppcp-api-client/src/Entity/SellerStatus.php @@ -81,8 +81,12 @@ class SellerStatus { return $this->capabilities; } + public function country() : string { + return $this->country; + } + /** - * Returns the enitity as array. + * Returns the entity as array. * * @return array */ diff --git a/modules/ppcp-settings/src/SettingsModule.php b/modules/ppcp-settings/src/SettingsModule.php index 1e6c1f818..785d28a41 100644 --- a/modules/ppcp-settings/src/SettingsModule.php +++ b/modules/ppcp-settings/src/SettingsModule.php @@ -10,6 +10,7 @@ declare( strict_types = 1 ); namespace WooCommerce\PayPalCommerce\Settings; use WC_Payment_Gateway; +use WooCommerce\PayPalCommerce\ApiClient\Endpoint\PartnersEndpoint; use WooCommerce\PayPalCommerce\ApiClient\Helper\DccApplies; use WooCommerce\PayPalCommerce\Applepay\Assets\AppleProductStatus; use WooCommerce\PayPalCommerce\Googlepay\Helper\ApmProductStatus; @@ -302,8 +303,12 @@ class SettingsModule implements ServiceModule, ExecutableModule { $flags = new ConfigurationFlagsDTO(); - // TODO: Get the merchant country from PayPal here! - $flags->country_code = 'US'; + $partners_endpoint = $container->get( 'api.endpoint.partners' ); + assert( $partners_endpoint instanceof PartnersEndpoint ); + + $seller_status = $partners_endpoint->seller_status(); + + $flags->country_code = $seller_status->country() ?: 'US'; $flags->is_business_seller = $general_settings->is_business_seller(); $flags->use_card_payments = $onboarding_profile->get_accept_card_payments(); $flags->use_subscriptions = in_array( ProductChoicesEnum::SUBSCRIPTIONS, $onboarding_profile->get_products(), true ); From 4fcfdde316f75128c9fbeb0a0d0253ea6e66eda9 Mon Sep 17 00:00:00 2001 From: Emili Castells Guasch Date: Tue, 18 Feb 2025 12:34:22 +0100 Subject: [PATCH 04/11] Add try catch for seller status endpoint --- modules/ppcp-settings/src/SettingsModule.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/ppcp-settings/src/SettingsModule.php b/modules/ppcp-settings/src/SettingsModule.php index 785d28a41..6ff33a371 100644 --- a/modules/ppcp-settings/src/SettingsModule.php +++ b/modules/ppcp-settings/src/SettingsModule.php @@ -11,6 +11,7 @@ namespace WooCommerce\PayPalCommerce\Settings; use WC_Payment_Gateway; use WooCommerce\PayPalCommerce\ApiClient\Endpoint\PartnersEndpoint; +use WooCommerce\PayPalCommerce\ApiClient\Exception\PayPalApiException; use WooCommerce\PayPalCommerce\ApiClient\Helper\DccApplies; use WooCommerce\PayPalCommerce\Applepay\Assets\AppleProductStatus; use WooCommerce\PayPalCommerce\Googlepay\Helper\ApmProductStatus; @@ -306,9 +307,13 @@ class SettingsModule implements ServiceModule, ExecutableModule { $partners_endpoint = $container->get( 'api.endpoint.partners' ); assert( $partners_endpoint instanceof PartnersEndpoint ); - $seller_status = $partners_endpoint->seller_status(); + try { + $seller_status = $partners_endpoint->seller_status(); + } catch ( PayPalApiException $exception ) { + $seller_status = null; + } - $flags->country_code = $seller_status->country() ?: 'US'; + $flags->country_code = ! is_null( $seller_status ) ? $seller_status->country() : 'US'; $flags->is_business_seller = $general_settings->is_business_seller(); $flags->use_card_payments = $onboarding_profile->get_accept_card_payments(); $flags->use_subscriptions = in_array( ProductChoicesEnum::SUBSCRIPTIONS, $onboarding_profile->get_products(), true ); From c7b3cda2c410b902dbd0c1c397015b6bb71be470 Mon Sep 17 00:00:00 2001 From: Emili Castells Guasch Date: Tue, 18 Feb 2025 12:44:31 +0100 Subject: [PATCH 05/11] Fix phpcs --- modules/ppcp-api-client/src/Entity/SellerStatus.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/ppcp-api-client/src/Entity/SellerStatus.php b/modules/ppcp-api-client/src/Entity/SellerStatus.php index 23f05016d..3697f9d39 100644 --- a/modules/ppcp-api-client/src/Entity/SellerStatus.php +++ b/modules/ppcp-api-client/src/Entity/SellerStatus.php @@ -81,6 +81,11 @@ class SellerStatus { return $this->capabilities; } + /** + * Returns merchant's country on PayPal. + * + * @return string + */ public function country() : string { return $this->country; } From c69e56e6423baca83aa7aaa61c8a49c355c11c5a Mon Sep 17 00:00:00 2001 From: carmenmaymo Date: Wed, 19 Feb 2025 10:58:16 +0100 Subject: [PATCH 06/11] Fix CI --- modules/ppcp-settings/src/SettingsModule.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/ppcp-settings/src/SettingsModule.php b/modules/ppcp-settings/src/SettingsModule.php index 6c84c5964..01ca16f0d 100644 --- a/modules/ppcp-settings/src/SettingsModule.php +++ b/modules/ppcp-settings/src/SettingsModule.php @@ -106,7 +106,7 @@ class SettingsModule implements ServiceModule, ExecutableModule { ) ); - wp_enqueue_script( 'ppcp-switch-settings-ui','',['wp-i18n'] ); + wp_enqueue_script( 'ppcp-switch-settings-ui', '', array( 'wp-i18n' ), $script_asset_file['version'] ); wp_set_script_translations( 'ppcp-switch-settings-ui', 'woocommerce-paypal-payments', @@ -163,7 +163,7 @@ class SettingsModule implements ServiceModule, ExecutableModule { true ); - wp_enqueue_script('ppcp-admin-settings', '', ['wp-i18n']); + wp_enqueue_script( 'ppcp-admin-settings', '', array( 'wp-i18n' ), $script_asset_file['version'] ); wp_set_script_translations( 'ppcp-admin-settings', 'woocommerce-paypal-payments', @@ -206,7 +206,7 @@ class SettingsModule implements ServiceModule, ExecutableModule { wp_enqueue_script( 'ppcp-paylater-configurator-lib', 'https://www.paypalobjects.com/merchant-library/merchant-configurator.js', - ['wp-i18n'], + array( 'wp-i18n' ), $script_asset_file['version'], true ); From ffaf1eb142e7d8d1aeb2db519569c0b2746ef829 Mon Sep 17 00:00:00 2001 From: Narek Zakarian Date: Wed, 19 Feb 2025 19:29:15 +0400 Subject: [PATCH 07/11] Force the fraudnet to be enabled when the new settings module is active --- modules/ppcp-wc-gateway/services.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/ppcp-wc-gateway/services.php b/modules/ppcp-wc-gateway/services.php index 920be9f0a..9bb5ae0c9 100644 --- a/modules/ppcp-wc-gateway/services.php +++ b/modules/ppcp-wc-gateway/services.php @@ -1854,6 +1854,13 @@ return array( $settings = $container->get( 'wcgateway.settings' ); assert( $settings instanceof Settings ); + if ( apply_filters( + 'woocommerce.feature-flags.woocommerce_paypal_payments.settings_enabled', + getenv( 'PCP_SETTINGS_ENABLED' ) === '1' + ) ) { + return true; + } + return $settings->has( 'fraudnet_enabled' ) && $settings->get( 'fraudnet_enabled' ); }, 'wcgateway.fraudnet-assets' => function( ContainerInterface $container ) : FraudNetAssets { From 37e26026ce013505d0daf7635c3eb47a5b6b6f1e Mon Sep 17 00:00:00 2001 From: Emili Castells Guasch Date: Wed, 19 Feb 2025 17:01:33 +0100 Subject: [PATCH 08/11] Set merchant country in authentication manager --- modules/ppcp-settings/services.php | 3 +- .../src/DTO/MerchantConnectionDTO.php | 22 +++++--- .../src/Data/GeneralSettings.php | 13 +++++ .../src/Service/AuthenticationManager.php | 53 +++++++++++++++---- modules/ppcp-settings/src/SettingsModule.php | 11 +--- 5 files changed, 75 insertions(+), 27 deletions(-) diff --git a/modules/ppcp-settings/services.php b/modules/ppcp-settings/services.php index e9621e4ef..ea9ab6a6e 100644 --- a/modules/ppcp-settings/services.php +++ b/modules/ppcp-settings/services.php @@ -308,7 +308,8 @@ return array( $container->get( 'api.env.endpoint.login-seller' ), $container->get( 'api.repository.partner-referrals-data' ), $container->get( 'settings.connection-state' ), - $container->get( 'woocommerce.logger.woocommerce' ), + $container->get( 'api.endpoint.partners' ), + $container->get( 'woocommerce.logger.woocommerce' ) ); }, 'settings.service.sanitizer' => static function ( ContainerInterface $container ) : DataSanitizer { diff --git a/modules/ppcp-settings/src/DTO/MerchantConnectionDTO.php b/modules/ppcp-settings/src/DTO/MerchantConnectionDTO.php index c565f1b44..ed9098b48 100644 --- a/modules/ppcp-settings/src/DTO/MerchantConnectionDTO.php +++ b/modules/ppcp-settings/src/DTO/MerchantConnectionDTO.php @@ -52,6 +52,13 @@ class MerchantConnectionDTO { */ public string $merchant_email = ''; + /** + * Merchant's country. + * + * @var string + */ + public string $merchant_country = ''; + /** * Whether the merchant is a business or personal account. * Possible values: ['business'|'personal'|'unknown'] @@ -68,6 +75,7 @@ class MerchantConnectionDTO { * @param string $client_secret API client secret. * @param string $merchant_id PayPal's 13-character merchant ID. * @param string $merchant_email Email address of the merchant account. + * @param string $merchant_country Merchant's country. * @param string $seller_type Whether the merchant is a business or personal account. */ public function __construct( @@ -76,13 +84,15 @@ class MerchantConnectionDTO { string $client_secret, string $merchant_id, string $merchant_email, + string $merchant_country, string $seller_type = SellerTypeEnum::UNKNOWN ) { - $this->is_sandbox = $is_sandbox; - $this->client_id = $client_id; - $this->client_secret = $client_secret; - $this->merchant_id = $merchant_id; - $this->merchant_email = $merchant_email; - $this->seller_type = $seller_type; + $this->is_sandbox = $is_sandbox; + $this->client_id = $client_id; + $this->client_secret = $client_secret; + $this->merchant_id = $merchant_id; + $this->merchant_email = $merchant_email; + $this->merchant_country = $merchant_country; + $this->seller_type = $seller_type; } } diff --git a/modules/ppcp-settings/src/Data/GeneralSettings.php b/modules/ppcp-settings/src/Data/GeneralSettings.php index b06c518d2..7953d6d95 100644 --- a/modules/ppcp-settings/src/Data/GeneralSettings.php +++ b/modules/ppcp-settings/src/Data/GeneralSettings.php @@ -74,6 +74,7 @@ class GeneralSettings extends AbstractDataModel { 'sandbox_merchant' => false, 'merchant_id' => '', 'merchant_email' => '', + 'merchant_country' => '', 'client_id' => '', 'client_secret' => '', 'seller_type' => 'unknown', @@ -138,6 +139,7 @@ class GeneralSettings extends AbstractDataModel { $this->data['sandbox_merchant'] = $connection->is_sandbox; $this->data['merchant_id'] = sanitize_text_field( $connection->merchant_id ); $this->data['merchant_email'] = sanitize_email( $connection->merchant_email ); + $this->data['merchant_country'] = sanitize_text_field( $connection->merchant_country ); $this->data['client_id'] = sanitize_text_field( $connection->client_id ); $this->data['client_secret'] = sanitize_text_field( $connection->client_secret ); $this->data['seller_type'] = sanitize_text_field( $connection->seller_type ); @@ -156,6 +158,7 @@ class GeneralSettings extends AbstractDataModel { $this->data['client_secret'], $this->data['merchant_id'], $this->data['merchant_email'], + $this->data['merchant_country'], $this->data['seller_type'] ); } @@ -171,6 +174,7 @@ class GeneralSettings extends AbstractDataModel { $this->data['sandbox_merchant'] = $defaults['sandbox_merchant']; $this->data['merchant_id'] = $defaults['merchant_id']; $this->data['merchant_email'] = $defaults['merchant_email']; + $this->data['merchant_country'] = $defaults['merchant_country']; $this->data['client_id'] = $defaults['client_id']; $this->data['client_secret'] = $defaults['client_secret']; $this->data['seller_type'] = $defaults['seller_type']; @@ -239,4 +243,13 @@ class GeneralSettings extends AbstractDataModel { public function get_merchant_email() : string { return $this->data['merchant_email']; } + + /** + * Gets the currently connected merchant's country. + * + * @return string + */ + public function get_merchant_country() : string { + return $this->data['merchant_country']; + } } diff --git a/modules/ppcp-settings/src/Service/AuthenticationManager.php b/modules/ppcp-settings/src/Service/AuthenticationManager.php index f8b04a096..9e55ee838 100644 --- a/modules/ppcp-settings/src/Service/AuthenticationManager.php +++ b/modules/ppcp-settings/src/Service/AuthenticationManager.php @@ -12,6 +12,8 @@ namespace WooCommerce\PayPalCommerce\Settings\Service; use JsonException; use Throwable; use Psr\Log\LoggerInterface; +use WooCommerce\PayPalCommerce\ApiClient\Endpoint\PartnersEndpoint; +use WooCommerce\PayPalCommerce\ApiClient\Exception\PayPalApiException; use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException; use WooCommerce\PayPalCommerce\ApiClient\Authentication\PayPalBearer; use WooCommerce\PayPalCommerce\ApiClient\Endpoint\LoginSeller; @@ -72,6 +74,13 @@ class AuthenticationManager { */ private ConnectionState $connection_state; + /** + * Partners endpoint. + * + * @var PartnersEndpoint + */ + private PartnersEndpoint $partners_endpoint; + /** * Constructor. * @@ -80,6 +89,7 @@ class AuthenticationManager { * @param EnvironmentConfig $login_endpoint API handler to fetch merchant credentials. * @param PartnerReferralsData $referrals_data Partner referrals data. * @param ConnectionState $connection_state Connection state manager. + * @param PartnersEndpoint $partners_endpoint Partners endpoint. * @param ?LoggerInterface $logger Logging instance. */ public function __construct( @@ -88,14 +98,16 @@ class AuthenticationManager { EnvironmentConfig $login_endpoint, PartnerReferralsData $referrals_data, ConnectionState $connection_state, + PartnersEndpoint $partners_endpoint, ?LoggerInterface $logger = null ) { - $this->common_settings = $common_settings; - $this->connection_host = $connection_host; - $this->login_endpoint = $login_endpoint; - $this->referrals_data = $referrals_data; - $this->connection_state = $connection_state; - $this->logger = $logger ?: new NullLogger(); + $this->common_settings = $common_settings; + $this->connection_host = $connection_host; + $this->login_endpoint = $login_endpoint; + $this->referrals_data = $referrals_data; + $this->connection_state = $connection_state; + $this->partners_endpoint = $partners_endpoint; + $this->logger = $logger ?: new NullLogger(); } /** @@ -196,12 +208,19 @@ class AuthenticationManager { $payee = $this->request_payee( $client_id, $client_secret, $use_sandbox ); + try { + $seller_status = $this->partners_endpoint->seller_status(); + } catch ( PayPalApiException $exception ) { + $seller_status = null; + } + $connection = new MerchantConnectionDTO( $use_sandbox, $client_id, $client_secret, $payee['merchant_id'], $payee['email_address'], + ! is_null( $seller_status ) ? $seller_status->country() : '', SellerTypeEnum::BUSINESS ); @@ -267,10 +286,17 @@ class AuthenticationManager { */ $connection = $this->common_settings->get_merchant_data(); - $connection->is_sandbox = $use_sandbox; - $connection->client_id = $credentials['client_id']; - $connection->client_secret = $credentials['client_secret']; - $connection->merchant_id = $credentials['merchant_id']; + try { + $seller_status = $this->partners_endpoint->seller_status(); + } catch ( PayPalApiException $exception ) { + $seller_status = null; + } + + $connection->is_sandbox = $use_sandbox; + $connection->client_id = $credentials['client_id']; + $connection->client_secret = $credentials['client_secret']; + $connection->merchant_id = $credentials['merchant_id']; + $connection->merchant_country = ! is_null( $seller_status ) ? $seller_status->country() : ''; $this->update_connection_details( $connection ); } @@ -306,6 +332,13 @@ class AuthenticationManager { $connection->seller_type = $seller_type; } + try { + $seller_status = $this->partners_endpoint->seller_status(); + } catch ( PayPalApiException $exception ) { + $seller_status = null; + } + $connection->merchant_country = ! is_null( $seller_status ) ? $seller_status->country() : ''; + $this->update_connection_details( $connection ); } diff --git a/modules/ppcp-settings/src/SettingsModule.php b/modules/ppcp-settings/src/SettingsModule.php index bebf25662..7519f390a 100644 --- a/modules/ppcp-settings/src/SettingsModule.php +++ b/modules/ppcp-settings/src/SettingsModule.php @@ -304,16 +304,7 @@ class SettingsModule implements ServiceModule, ExecutableModule { $flags = new ConfigurationFlagsDTO(); - $partners_endpoint = $container->get( 'api.endpoint.partners' ); - assert( $partners_endpoint instanceof PartnersEndpoint ); - - try { - $seller_status = $partners_endpoint->seller_status(); - } catch ( PayPalApiException $exception ) { - $seller_status = null; - } - - $flags->country_code = ! is_null( $seller_status ) ? $seller_status->country() : 'US'; + $flags->country_code = $general_settings->get_merchant_country(); $flags->is_business_seller = $general_settings->is_business_seller(); $flags->use_card_payments = $onboarding_profile->get_accept_card_payments(); $flags->use_subscriptions = in_array( ProductChoicesEnum::SUBSCRIPTIONS, $onboarding_profile->get_products(), true ); From 38126dcc27bdeba0c6c79bc72501a7bf06fbecf2 Mon Sep 17 00:00:00 2001 From: Philipp Stracker Date: Wed, 19 Feb 2025 17:38:44 +0100 Subject: [PATCH 09/11] =?UTF-8?q?=F0=9F=90=9B=20Fix=20invalid=20navigation?= =?UTF-8?q?=20button=20states?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../js/Components/Screens/Onboarding/Steps/StepBusiness.js | 5 +++++ .../js/Components/Screens/Onboarding/Steps/index.js | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/ppcp-settings/resources/js/Components/Screens/Onboarding/Steps/StepBusiness.js b/modules/ppcp-settings/resources/js/Components/Screens/Onboarding/Steps/StepBusiness.js index 580ff475c..4154e8baa 100644 --- a/modules/ppcp-settings/resources/js/Components/Screens/Onboarding/Steps/StepBusiness.js +++ b/modules/ppcp-settings/resources/js/Components/Screens/Onboarding/Steps/StepBusiness.js @@ -22,8 +22,13 @@ const StepBusiness = ( {} ) => { ); useEffect( () => { + if ( ! businessChoice ) { + return; + } + setIsCasualSeller( BUSINESS_TYPES.CASUAL_SELLER === businessChoice ); }, [ businessChoice, setIsCasualSeller ] ); + const { canUseSubscriptions } = OnboardingHooks.useFlags(); const businessChoices = [ { diff --git a/modules/ppcp-settings/resources/js/Components/Screens/Onboarding/Steps/index.js b/modules/ppcp-settings/resources/js/Components/Screens/Onboarding/Steps/index.js index 2162add6c..ec9330f0a 100644 --- a/modules/ppcp-settings/resources/js/Components/Screens/Onboarding/Steps/index.js +++ b/modules/ppcp-settings/resources/js/Components/Screens/Onboarding/Steps/index.js @@ -36,8 +36,7 @@ const ALL_STEPS = [ id: 'methods', title: __( 'Choose checkout options', 'woocommerce-paypal-payments' ), StepComponent: StepPaymentMethods, - canProceed: ( { methods } ) => - methods.areOptionalPaymentMethodsEnabled !== null, + canProceed: ( { methods } ) => methods.optionalMethods !== null, }, { id: 'complete', From eb034e364001d5c9b88011a295be39b817aefbff Mon Sep 17 00:00:00 2001 From: Philipp Stracker Date: Wed, 19 Feb 2025 17:44:22 +0100 Subject: [PATCH 10/11] =?UTF-8?q?=F0=9F=90=9B=20Fix=20incorrect=20identifi?= =?UTF-8?q?er=20of=20read-more=20URL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/ppcp-settings/resources/js/utils/countryInfoLinks.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ppcp-settings/resources/js/utils/countryInfoLinks.js b/modules/ppcp-settings/resources/js/utils/countryInfoLinks.js index 9562a3963..7d03cb147 100644 --- a/modules/ppcp-settings/resources/js/utils/countryInfoLinks.js +++ b/modules/ppcp-settings/resources/js/utils/countryInfoLinks.js @@ -24,7 +24,7 @@ export const learnMoreLinks = { 'https://www.paypal.com/uk/business/paypal-business-fees', PayPalCheckout: 'https://www.paypal.com/uk/business/accept-payments/checkout', - PayLater: + PayInThree: 'https://www.paypal.com/uk/business/accept-payments/checkout/installments', }, FR: { From fe4ae4211e434ead25680a6aa2347e1b655d6e50 Mon Sep 17 00:00:00 2001 From: Emili Castells Guasch Date: Thu, 20 Feb 2025 15:03:15 +0100 Subject: [PATCH 11/11] Add type to property definition --- modules/ppcp-api-client/src/Entity/SellerStatus.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ppcp-api-client/src/Entity/SellerStatus.php b/modules/ppcp-api-client/src/Entity/SellerStatus.php index 3697f9d39..fd948b276 100644 --- a/modules/ppcp-api-client/src/Entity/SellerStatus.php +++ b/modules/ppcp-api-client/src/Entity/SellerStatus.php @@ -33,7 +33,7 @@ class SellerStatus { * * @var string */ - private $country; + private string $country; /** * SellerStatus constructor.