From 4102ba285b601dc2eb5a24b1521452360eab2f39 Mon Sep 17 00:00:00 2001
From: Philipp Stracker
Date: Wed, 30 Oct 2024 18:55:07 +0100
Subject: [PATCH] =?UTF-8?q?=F0=9F=91=94=20Add=20server-side=20onboarding?=
=?UTF-8?q?=20profile=20details?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/Data/OnboardingProfile.php | 38 +++++++++++++++++++
.../src/Endpoint/OnboardingRestEndpoint.php | 7 ++++
2 files changed, 45 insertions(+)
diff --git a/modules/ppcp-settings/src/Data/OnboardingProfile.php b/modules/ppcp-settings/src/Data/OnboardingProfile.php
index df894e85a..e1f9e16b4 100644
--- a/modules/ppcp-settings/src/Data/OnboardingProfile.php
+++ b/modules/ppcp-settings/src/Data/OnboardingProfile.php
@@ -70,6 +70,8 @@ class OnboardingProfile extends AbstractDataModel {
'use_manual_connection' => false,
'client_id' => '',
'client_secret' => '',
+ 'is_casual_seller' => null,
+ 'products' => array(),
);
}
@@ -183,6 +185,42 @@ class OnboardingProfile extends AbstractDataModel {
$this->data['client_secret'] = sanitize_text_field( $client_secret );
}
+ /**
+ * Gets the casual seller flag.
+ *
+ * @return bool|null
+ */
+ public function get_casual_seller() : ?bool {
+ return $this->data['is_casual_seller'];
+ }
+
+ /**
+ * Sets the casual-seller flag.
+ *
+ * @param bool|null $casual_seller Whether the merchant uses a personal account for selling.
+ */
+ public function set_casual_seller( ?bool $casual_seller ) : void {
+ $this->data['is_casual_seller'] = $casual_seller;
+ }
+
+ /**
+ * Gets the active product types for this store.
+ *
+ * @return string[]
+ */
+ public function get_products() : array {
+ return $this->data['products'];
+ }
+
+ /**
+ * Sets the list of active product types.
+ *
+ * @param string[] $products Any of ['virtual'|'physical'|'subscriptions'].
+ */
+ public function set_products( array $products ) : void {
+ $this->data['products'] = $products;
+ }
+
/**
* Returns the list of read-only customization flags
*
diff --git a/modules/ppcp-settings/src/Endpoint/OnboardingRestEndpoint.php b/modules/ppcp-settings/src/Endpoint/OnboardingRestEndpoint.php
index bd8e57eee..afb2d7f1f 100644
--- a/modules/ppcp-settings/src/Endpoint/OnboardingRestEndpoint.php
+++ b/modules/ppcp-settings/src/Endpoint/OnboardingRestEndpoint.php
@@ -65,6 +65,13 @@ class OnboardingRestEndpoint extends RestEndpoint {
'js_name' => 'clientSecret',
'sanitize' => 'sanitize_text_field',
),
+ 'is_casual_seller' => array(
+ 'js_name' => 'isCasualSeller',
+ 'sanitize' => 'to_boolean',
+ ),
+ 'products' => array(
+ 'js_name' => 'products',
+ ),
);
/**