Loading kyc.info.yml +1 −1 Original line number Diff line number Diff line name: Know Your Customer type: module description: 'Know Your Customer allows businesses to manage KYC information.' description: 'Know Your Customer allows businesses to manage KYC (and KYB) information.' core_version_requirement: ^10 || ^11 dependencies: Loading src/Entity/Business.php +42 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,36 @@ class Business extends ContentEntityBase implements BusinessInterface { use EntityOwnerTrait; use EntityChangedTrait; /** * {@inheritdoc} */ public function getRemoteId() { return $this->get('remote_id')->value; } /** * {@inheritdoc} */ public function setRemoteId($remote_id) { $this->set('remote_id', $remote_id); return $this; } /** * {@inheritdoc} */ public function getRemoteState() { return $this->get('remote_state')->value; } /** * {@inheritdoc} */ public function setRemoteState($remote_state) { $this->set('remote_state', $remote_state); return $this; } /** * {@inheritdoc} */ Loading Loading @@ -137,6 +167,18 @@ class Business extends ContentEntityBase implements BusinessInterface { $fields = parent::baseFieldDefinitions($entity_type); $fields += static::ownerBaseFieldDefinitions($entity_type); $fields['remote_id'] = BaseFieldDefinition::create('string') ->setLabel(t('Remote ID')) ->setDescription(t('The remote ID.')) ->setSetting('max_length', 255) ->setDisplayConfigurable('view', TRUE); $fields['remote_state'] = BaseFieldDefinition::create('string') ->setLabel(t('Remote State')) ->setDescription(t('The remote state.')) ->setSetting('max_length', 255) ->setDisplayConfigurable('view', TRUE); $fields['type'] = BaseFieldDefinition::create('entity_reference') ->setLabel(t('Type')) ->setDescription(t('The business type.')) Loading src/Entity/BusinessInterface.php +36 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,42 @@ use Drupal\user\EntityOwnerInterface; */ interface BusinessInterface extends ContentEntityInterface, EntityOwnerInterface, EntityChangedInterface { /** * Gets the remote ID. * * @return string * The remote ID. */ public function getRemoteId(); /** * Sets the remote ID. * * @param string $remote_id * The remote ID. * * @return $this */ public function setRemoteId($remote_id); /** * Gets the remote state. * * @return string * The remote state. */ public function getRemoteState(); /** * Sets the remote state. * * @param string $remote_state * The remote state. * * @return $this */ public function setRemoteState($remote_state); /** * Gets the Business's name. * Loading src/Entity/Person.php +121 −8 Original line number Diff line number Diff line Loading @@ -56,7 +56,6 @@ use Drupal\Core\Field\BaseFieldDefinition; * "id" = "person_id", * "uuid" = "uuid", * "bundle" = "type", * "label" = "name", * "langcode" = "langcode", * "owner" = "uid", * "uid" = "uid", Loading @@ -82,15 +81,86 @@ class Person extends ContentEntityBase implements PersonInterface { /** * {@inheritdoc} */ public function getName() { return $this->get('name')->value; public function label() { return implode(' ', array_filter([ $this->get('first_name')->value, $this->get('middle_name')->value, $this->get('last_name')->value, ])); } /** * {@inheritdoc} */ public function setName($name) { $this->set('name', $name); public function getRemoteId() { return $this->get('remote_id')->value; } /** * {@inheritdoc} */ public function setRemoteId($remote_id) { $this->set('remote_id', $remote_id); return $this; } /** * {@inheritdoc} */ public function getRemoteState() { return $this->get('remote_state')->value; } /** * {@inheritdoc} */ public function setRemoteState($remote_state) { $this->set('remote_state', $remote_state); return $this; } /** * {@inheritdoc} */ public function getFirstName() { return $this->get('first_name')->value; } /** * {@inheritdoc} */ public function setFirstName($remote_id) { $this->set('first_name', $remote_id); return $this; } /** * {@inheritdoc} */ public function getMiddleName() { return $this->get('middle_name')->value; } /** * {@inheritdoc} */ public function setMiddleName($remote_id) { $this->set('middle_name', $remote_id); return $this; } /** * {@inheritdoc} */ public function getLastName() { return $this->get('last_name')->value; } /** * {@inheritdoc} */ public function setLastName($remote_id) { $this->set('last_name', $remote_id); return $this; } Loading Loading @@ -137,6 +207,18 @@ class Person extends ContentEntityBase implements PersonInterface { $fields = parent::baseFieldDefinitions($entity_type); $fields += static::ownerBaseFieldDefinitions($entity_type); $fields['remote_id'] = BaseFieldDefinition::create('string') ->setLabel(t('Remote ID')) ->setDescription(t('The remote ID.')) ->setSetting('max_length', 255) ->setDisplayConfigurable('view', TRUE); $fields['remote_state'] = BaseFieldDefinition::create('string') ->setLabel(t('Remote State')) ->setDescription(t('The remote state.')) ->setSetting('max_length', 255) ->setDisplayConfigurable('view', TRUE); $fields['type'] = BaseFieldDefinition::create('entity_reference') ->setLabel(t('Type')) ->setDescription(t('Person\'s type.')) Loading @@ -148,9 +230,40 @@ class Person extends ContentEntityBase implements PersonInterface { ->setDisplayConfigurable('view', TRUE) ->setDisplayConfigurable('form', TRUE); $fields['name'] = BaseFieldDefinition::create('string') ->setLabel(t('Name')) ->setDescription(t('Person\'s name.')) $fields['first_name'] = BaseFieldDefinition::create('string') ->setLabel(t('First name')) ->setDescription(t('Person\'s first name.')) ->setRequired(TRUE) ->setTranslatable(TRUE) ->setSettings([ 'default_value' => '', 'max_length' => 255, ]) ->setDisplayOptions('form', [ 'type' => 'string_textfield', 'weight' => 0, ]) ->setDisplayConfigurable('view', TRUE) ->setDisplayConfigurable('form', TRUE); $fields['middle_name'] = BaseFieldDefinition::create('string') ->setLabel(t('Middle name')) ->setDescription(t('Person\'s middle name.')) ->setTranslatable(TRUE) ->setSettings([ 'default_value' => '', 'max_length' => 255, ]) ->setDisplayOptions('form', [ 'type' => 'string_textfield', 'weight' => 0, ]) ->setDisplayConfigurable('view', TRUE) ->setDisplayConfigurable('form', TRUE); $fields['last_name'] = BaseFieldDefinition::create('string') ->setLabel(t('Last name')) ->setDescription(t('Person\'s last name.')) ->setRequired(TRUE) ->setTranslatable(TRUE) ->setSettings([ Loading src/Entity/PersonInterface.php +87 −15 Original line number Diff line number Diff line Loading @@ -7,59 +7,131 @@ use Drupal\Core\Entity\EntityChangedInterface; use Drupal\user\EntityOwnerInterface; /** * Defines the interface for Business'ss. * Defines the interface for Person'ss. */ interface PersonInterface extends ContentEntityInterface, EntityOwnerInterface, EntityChangedInterface { /** * Gets the Business's name. * Gets the remote ID. * * @return string * The Business's name. * The remote ID. */ public function getName(); public function getRemoteId(); /** * Sets the Business's name. * Sets the remote ID. * * @param string $remote_id * The remote ID. * * @return $this */ public function setRemoteId($remote_id); /** * Gets the remote state. * * @return string * The remote state. */ public function getRemoteState(); /** * Sets the remote state. * * @param string $remote_state * The remote state. * * @return $this */ public function setRemoteState($remote_state); /** * Gets the Person's first name. * * @return string * The Person's name. */ public function getFirstName(); /** * Sets the Person's first name. * * @param string $name * The Person's name. * * @return $this */ public function setFirstName($name); /** * Gets the Person's middle name. * * @return string * The Person's name. */ public function getMiddleName(); /** * Sets the Person's middle name. * * @param string $name * The Person's name. * * @return $this */ public function setMiddleName($name); /** * Gets the Person's last name. * * @return string * The Person's name. */ public function getLastName(); /** * Sets the Person's last name. * * @param string $name * The Business's name. * The Person's name. * * @return $this */ public function setName($name); public function setLastName($name); /** * Gets the Business's email. * Gets the Person's email. * * @return string * The Business's email. * The Person's email. */ public function getEmail(); /** * Sets the Business's email. * Sets the Person's email. * * @param string $mail * The Business's email. * The Person's email. * * @return $this */ public function setEmail($mail); /** * Gets the Business's creation timestamp. * Gets the Person's creation timestamp. * * @return int * The Business's creation timestamp. * The Person's creation timestamp. */ public function getCreatedTime(); /** * Sets the Business's creation timestamp. * Sets the Person's creation timestamp. * * @param int $timestamp * The Business's creation timestamp. * The Person's creation timestamp. * * @return $this */ Loading Loading
kyc.info.yml +1 −1 Original line number Diff line number Diff line name: Know Your Customer type: module description: 'Know Your Customer allows businesses to manage KYC information.' description: 'Know Your Customer allows businesses to manage KYC (and KYB) information.' core_version_requirement: ^10 || ^11 dependencies: Loading
src/Entity/Business.php +42 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,36 @@ class Business extends ContentEntityBase implements BusinessInterface { use EntityOwnerTrait; use EntityChangedTrait; /** * {@inheritdoc} */ public function getRemoteId() { return $this->get('remote_id')->value; } /** * {@inheritdoc} */ public function setRemoteId($remote_id) { $this->set('remote_id', $remote_id); return $this; } /** * {@inheritdoc} */ public function getRemoteState() { return $this->get('remote_state')->value; } /** * {@inheritdoc} */ public function setRemoteState($remote_state) { $this->set('remote_state', $remote_state); return $this; } /** * {@inheritdoc} */ Loading Loading @@ -137,6 +167,18 @@ class Business extends ContentEntityBase implements BusinessInterface { $fields = parent::baseFieldDefinitions($entity_type); $fields += static::ownerBaseFieldDefinitions($entity_type); $fields['remote_id'] = BaseFieldDefinition::create('string') ->setLabel(t('Remote ID')) ->setDescription(t('The remote ID.')) ->setSetting('max_length', 255) ->setDisplayConfigurable('view', TRUE); $fields['remote_state'] = BaseFieldDefinition::create('string') ->setLabel(t('Remote State')) ->setDescription(t('The remote state.')) ->setSetting('max_length', 255) ->setDisplayConfigurable('view', TRUE); $fields['type'] = BaseFieldDefinition::create('entity_reference') ->setLabel(t('Type')) ->setDescription(t('The business type.')) Loading
src/Entity/BusinessInterface.php +36 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,42 @@ use Drupal\user\EntityOwnerInterface; */ interface BusinessInterface extends ContentEntityInterface, EntityOwnerInterface, EntityChangedInterface { /** * Gets the remote ID. * * @return string * The remote ID. */ public function getRemoteId(); /** * Sets the remote ID. * * @param string $remote_id * The remote ID. * * @return $this */ public function setRemoteId($remote_id); /** * Gets the remote state. * * @return string * The remote state. */ public function getRemoteState(); /** * Sets the remote state. * * @param string $remote_state * The remote state. * * @return $this */ public function setRemoteState($remote_state); /** * Gets the Business's name. * Loading
src/Entity/Person.php +121 −8 Original line number Diff line number Diff line Loading @@ -56,7 +56,6 @@ use Drupal\Core\Field\BaseFieldDefinition; * "id" = "person_id", * "uuid" = "uuid", * "bundle" = "type", * "label" = "name", * "langcode" = "langcode", * "owner" = "uid", * "uid" = "uid", Loading @@ -82,15 +81,86 @@ class Person extends ContentEntityBase implements PersonInterface { /** * {@inheritdoc} */ public function getName() { return $this->get('name')->value; public function label() { return implode(' ', array_filter([ $this->get('first_name')->value, $this->get('middle_name')->value, $this->get('last_name')->value, ])); } /** * {@inheritdoc} */ public function setName($name) { $this->set('name', $name); public function getRemoteId() { return $this->get('remote_id')->value; } /** * {@inheritdoc} */ public function setRemoteId($remote_id) { $this->set('remote_id', $remote_id); return $this; } /** * {@inheritdoc} */ public function getRemoteState() { return $this->get('remote_state')->value; } /** * {@inheritdoc} */ public function setRemoteState($remote_state) { $this->set('remote_state', $remote_state); return $this; } /** * {@inheritdoc} */ public function getFirstName() { return $this->get('first_name')->value; } /** * {@inheritdoc} */ public function setFirstName($remote_id) { $this->set('first_name', $remote_id); return $this; } /** * {@inheritdoc} */ public function getMiddleName() { return $this->get('middle_name')->value; } /** * {@inheritdoc} */ public function setMiddleName($remote_id) { $this->set('middle_name', $remote_id); return $this; } /** * {@inheritdoc} */ public function getLastName() { return $this->get('last_name')->value; } /** * {@inheritdoc} */ public function setLastName($remote_id) { $this->set('last_name', $remote_id); return $this; } Loading Loading @@ -137,6 +207,18 @@ class Person extends ContentEntityBase implements PersonInterface { $fields = parent::baseFieldDefinitions($entity_type); $fields += static::ownerBaseFieldDefinitions($entity_type); $fields['remote_id'] = BaseFieldDefinition::create('string') ->setLabel(t('Remote ID')) ->setDescription(t('The remote ID.')) ->setSetting('max_length', 255) ->setDisplayConfigurable('view', TRUE); $fields['remote_state'] = BaseFieldDefinition::create('string') ->setLabel(t('Remote State')) ->setDescription(t('The remote state.')) ->setSetting('max_length', 255) ->setDisplayConfigurable('view', TRUE); $fields['type'] = BaseFieldDefinition::create('entity_reference') ->setLabel(t('Type')) ->setDescription(t('Person\'s type.')) Loading @@ -148,9 +230,40 @@ class Person extends ContentEntityBase implements PersonInterface { ->setDisplayConfigurable('view', TRUE) ->setDisplayConfigurable('form', TRUE); $fields['name'] = BaseFieldDefinition::create('string') ->setLabel(t('Name')) ->setDescription(t('Person\'s name.')) $fields['first_name'] = BaseFieldDefinition::create('string') ->setLabel(t('First name')) ->setDescription(t('Person\'s first name.')) ->setRequired(TRUE) ->setTranslatable(TRUE) ->setSettings([ 'default_value' => '', 'max_length' => 255, ]) ->setDisplayOptions('form', [ 'type' => 'string_textfield', 'weight' => 0, ]) ->setDisplayConfigurable('view', TRUE) ->setDisplayConfigurable('form', TRUE); $fields['middle_name'] = BaseFieldDefinition::create('string') ->setLabel(t('Middle name')) ->setDescription(t('Person\'s middle name.')) ->setTranslatable(TRUE) ->setSettings([ 'default_value' => '', 'max_length' => 255, ]) ->setDisplayOptions('form', [ 'type' => 'string_textfield', 'weight' => 0, ]) ->setDisplayConfigurable('view', TRUE) ->setDisplayConfigurable('form', TRUE); $fields['last_name'] = BaseFieldDefinition::create('string') ->setLabel(t('Last name')) ->setDescription(t('Person\'s last name.')) ->setRequired(TRUE) ->setTranslatable(TRUE) ->setSettings([ Loading
src/Entity/PersonInterface.php +87 −15 Original line number Diff line number Diff line Loading @@ -7,59 +7,131 @@ use Drupal\Core\Entity\EntityChangedInterface; use Drupal\user\EntityOwnerInterface; /** * Defines the interface for Business'ss. * Defines the interface for Person'ss. */ interface PersonInterface extends ContentEntityInterface, EntityOwnerInterface, EntityChangedInterface { /** * Gets the Business's name. * Gets the remote ID. * * @return string * The Business's name. * The remote ID. */ public function getName(); public function getRemoteId(); /** * Sets the Business's name. * Sets the remote ID. * * @param string $remote_id * The remote ID. * * @return $this */ public function setRemoteId($remote_id); /** * Gets the remote state. * * @return string * The remote state. */ public function getRemoteState(); /** * Sets the remote state. * * @param string $remote_state * The remote state. * * @return $this */ public function setRemoteState($remote_state); /** * Gets the Person's first name. * * @return string * The Person's name. */ public function getFirstName(); /** * Sets the Person's first name. * * @param string $name * The Person's name. * * @return $this */ public function setFirstName($name); /** * Gets the Person's middle name. * * @return string * The Person's name. */ public function getMiddleName(); /** * Sets the Person's middle name. * * @param string $name * The Person's name. * * @return $this */ public function setMiddleName($name); /** * Gets the Person's last name. * * @return string * The Person's name. */ public function getLastName(); /** * Sets the Person's last name. * * @param string $name * The Business's name. * The Person's name. * * @return $this */ public function setName($name); public function setLastName($name); /** * Gets the Business's email. * Gets the Person's email. * * @return string * The Business's email. * The Person's email. */ public function getEmail(); /** * Sets the Business's email. * Sets the Person's email. * * @param string $mail * The Business's email. * The Person's email. * * @return $this */ public function setEmail($mail); /** * Gets the Business's creation timestamp. * Gets the Person's creation timestamp. * * @return int * The Business's creation timestamp. * The Person's creation timestamp. */ public function getCreatedTime(); /** * Sets the Business's creation timestamp. * Sets the Person's creation timestamp. * * @param int $timestamp * The Business's creation timestamp. * The Person's creation timestamp. * * @return $this */ Loading