👔 Add server-side onboarding profile details

This commit is contained in:
Philipp Stracker 2024-10-30 18:55:07 +01:00
parent e28b6e35aa
commit 4102ba285b
No known key found for this signature in database
2 changed files with 45 additions and 0 deletions

View file

@ -70,6 +70,8 @@ class OnboardingProfile extends AbstractDataModel {
'use_manual_connection' => false, 'use_manual_connection' => false,
'client_id' => '', 'client_id' => '',
'client_secret' => '', '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 ); $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 * Returns the list of read-only customization flags
* *

View file

@ -65,6 +65,13 @@ class OnboardingRestEndpoint extends RestEndpoint {
'js_name' => 'clientSecret', 'js_name' => 'clientSecret',
'sanitize' => 'sanitize_text_field', 'sanitize' => 'sanitize_text_field',
), ),
'is_casual_seller' => array(
'js_name' => 'isCasualSeller',
'sanitize' => 'to_boolean',
),
'products' => array(
'js_name' => 'products',
),
); );
/** /**