Get country code from seller status

This commit is contained in:
Emili Castells Guasch 2025-02-17 17:52:11 +01:00
parent 86317a63d1
commit 32c34e7b89
2 changed files with 12 additions and 3 deletions

View file

@ -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
*/

View file

@ -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 );