Add PHP API to query seller-type

This commit is contained in:
Philipp Stracker 2025-02-10 18:42:05 +01:00
parent fa74ba97c3
commit c0bbd2a6f8
No known key found for this signature in database

View file

@ -11,6 +11,7 @@ namespace WooCommerce\PayPalCommerce\Settings\Data;
use RuntimeException;
use WooCommerce\PayPalCommerce\Settings\DTO\MerchantConnectionDTO;
use WooCommerce\PayPalCommerce\Settings\Enum\SellerTypeEnum;
/**
* Class GeneralSettings
@ -197,6 +198,30 @@ class GeneralSettings extends AbstractDataModel {
&& $this->data['client_secret'];
}
/**
* Whether the merchant uses a business account.
*
* Note: It's possible that the seller type is unknown, and both methods,
* `is_casual_seller()` and `is_business_seller()` return false.
*
* @return bool
*/
public function is_business_seller() : bool {
return SellerTypeEnum::BUSINESS === $this->data['seller_type'];
}
/**
* Whether the merchant is a casual seller using a personal account.
*
* Note: It's possible that the seller type is unknown, and both methods,
* `is_casual_seller()` and `is_business_seller()` return false.
*
* @return bool
*/
public function is_casual_seller() : bool {
return SellerTypeEnum::PERSONAL === $this->data['seller_type'];
}
/**
* Gets the currently connected merchant ID.
*