From c0bbd2a6f89a8163c7b18613eace2e224884d6ee Mon Sep 17 00:00:00 2001
From: Philipp Stracker
Date: Mon, 10 Feb 2025 18:42:05 +0100
Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20PHP=20API=20to=20query=20sell?=
=?UTF-8?q?er-type?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/Data/GeneralSettings.php | 25 +++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/modules/ppcp-settings/src/Data/GeneralSettings.php b/modules/ppcp-settings/src/Data/GeneralSettings.php
index c8fc9608e..b06c518d2 100644
--- a/modules/ppcp-settings/src/Data/GeneralSettings.php
+++ b/modules/ppcp-settings/src/Data/GeneralSettings.php
@@ -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.
*