123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360 |
- <?php
- namespace Dotdigitalgroup\Email\Model\Connector;
- /**
- * Contact datafields information.
- *
- */
- class Datafield
- {
- /**
- * @var string
- */
- public $name;
- /**
- * @var string
- */
- public $type;
- /**
- * @var string
- */
- public $visibility;
- /**
- * @var string
- */
- public $defaultValue;
- /**
- * Contact datafields.
- *
- * @var array
- */
- public $datafields = [];
- /**
- * Contact default datafields.
- *
- * @var array
- */
- public $contactDatafields
- = [
- 'customer_id' => [
- 'name' => 'CUSTOMER_ID',
- 'type' => 'numeric',
- 'visibility' => 'private',
- ],
- 'firstname' => [
- 'name' => 'FIRSTNAME',
- 'type' => 'string',
- 'visibility' => 'private',
- ],
- 'lastname' => [
- 'name' => 'LASTNAME',
- 'type' => 'string',
- 'visibility' => 'private',
- ],
- 'gender' => [
- 'name' => 'GENDER',
- 'type' => 'string',
- 'visibility' => 'private',
- ],
- 'dob' => [
- 'name' => 'DOB',
- 'type' => 'date',
- 'visibility' => 'private',
- ],
- 'title' => [
- 'name' => 'TITLE',
- 'type' => 'string',
- 'visibility' => 'private',
- ],
- 'website_name' => [
- 'name' => 'WEBSITE_NAME',
- 'type' => 'string',
- 'visibility' => 'private',
- ],
- 'store_name' => [
- 'name' => 'STORE_NAME',
- 'type' => 'string',
- 'visibility' => 'private',
- ],
- 'created_at' => [
- 'name' => 'ACCOUNT_CREATED_DATE',
- 'type' => 'date',
- 'visibility' => 'private',
- ],
- 'last_logged_date' => [
- 'name' => 'LAST_LOGGEDIN_DATE',
- 'type' => 'date',
- 'visibility' => 'private',
- ],
- 'customer_group' => [
- 'name' => 'CUSTOMER_GROUP',
- 'type' => 'string',
- 'visibility' => 'private',
- ],
- 'billing_address_1' => [
- 'name' => 'BILLING_ADDRESS_1',
- 'type' => 'string',
- 'visibility' => 'private',
- 'defaultValue' => '',
- ],
- 'billing_address_2' => [
- 'name' => 'BILLING_ADDRESS_2',
- 'type' => 'string',
- 'visibility' => 'private',
- ],
- 'billing_state' => [
- 'name' => 'BILLING_STATE',
- 'type' => 'string',
- 'visibility' => 'private',
- ],
- 'billing_city' => [
- 'name' => 'BILLING_CITY',
- 'type' => 'string',
- 'visibility' => 'private',
- ],
- 'billing_country' => [
- 'name' => 'BILLING_COUNTRY',
- 'type' => 'string',
- 'visibility' => 'private',
- ],
- 'billing_postcode' => [
- 'name' => 'BILLING_POSTCODE',
- 'type' => 'string',
- 'visibility' => 'private',
- ],
- 'billing_telephone' => [
- 'name' => 'BILLING_TELEPHONE',
- 'type' => 'string',
- 'visibility' => 'private',
- ],
- 'delivery_address_1' => [
- 'name' => 'DELIVERY_ADDRESS_1',
- 'type' => 'string',
- 'visibility' => 'private',
- ],
- 'delivery_address_2' => [
- 'name' => 'DELIVERY_ADDRESS_2',
- 'type' => 'string',
- 'visibility' => 'private',
- ],
- 'delivery_state' => [
- 'name' => 'DELIVERY_STATE',
- 'type' => 'string',
- 'visibility' => 'private',
- ],
- 'delivery_city' => [
- 'name' => 'DELIVERY_CITY',
- 'type' => 'string',
- 'visibility' => 'private',
- ],
- 'delivery_country' => [
- 'name' => 'DELIVERY_COUNTRY',
- 'type' => 'string',
- 'visibility' => 'private',
- ],
- 'delivery_postcode' => [
- 'name' => 'DELIVERY_POSTCODE',
- 'type' => 'string',
- 'visibility' => 'private',
- ],
- 'delivery_telephone' => [
- 'name' => 'DELIVERY_TELEPHONE',
- 'type' => 'string',
- 'visibility' => 'private',
- ],
- 'number_of_orders' => [
- 'name' => 'NUMBER_OF_ORDERS',
- 'type' => 'numeric',
- 'visibility' => 'private',
- ],
- 'total_spend' => [
- 'name' => 'TOTAL_SPEND',
- 'type' => 'numeric',
- 'visibility' => 'private',
- ],
- 'average_order_value' => [
- 'name' => 'AVERAGE_ORDER_VALUE',
- 'type' => 'numeric',
- 'visibility' => 'private',
- ],
- 'last_order_date' => [
- 'name' => 'LAST_ORDER_DATE',
- 'type' => 'date',
- 'visibility' => 'private',
- ],
- 'last_order_id' => [
- 'name' => 'LAST_ORDER_ID',
- 'type' => 'numeric',
- 'visibility' => 'private',
- ],
- 'last_increment_id' => [
- 'name' => 'LAST_INCREMENT_ID',
- 'type' => 'numeric',
- 'visibility' => 'private',
- ],
- 'last_quote_id' => [
- 'name' => 'LAST_QUOTE_ID',
- 'type' => 'numeric',
- 'visibility' => 'private',
- ],
- 'total_refund' => [
- 'name' => 'TOTAL_REFUND',
- 'type' => 'numeric',
- 'visibility' => 'private',
- ],
- 'review_count' => [
- 'name' => 'REVIEW_COUNT',
- 'type' => 'numeric',
- 'visibility' => 'private',
- ],
- 'last_review_date' => [
- 'name' => 'LAST_REVIEW_DATE',
- 'type' => 'date',
- 'visibility' => 'private',
- ],
- 'subscriber_status' => [
- 'name' => 'SUBSCRIBER_STATUS',
- 'type' => 'string',
- 'visibility' => 'private',
- ],
- 'most_pur_category' => [
- 'name' => 'MOST_PUR_CATEGORY',
- 'type' => 'string',
- 'visibility' => 'private',
- ],
- 'most_pur_brand' => [
- 'name' => 'MOST_PUR_BRAND',
- 'type' => 'string',
- 'visibility' => 'private',
- ],
- 'most_freq_pur_day' => [
- 'name' => 'MOST_FREQ_PUR_DAY',
- 'type' => 'string',
- 'visibility' => 'private',
- ],
- 'most_freq_pur_mon' => [
- 'name' => 'MOST_FREQ_PUR_MON',
- 'type' => 'string',
- 'visibility' => 'private',
- ],
- 'first_category_pur' => [
- 'name' => 'FIRST_CATEGORY_PUR',
- 'type' => 'string',
- 'visibility' => 'private',
- ],
- 'last_category_pur' => [
- 'name' => 'LAST_CATEGORY_PUR',
- 'type' => 'string',
- 'visibility' => 'private',
- ],
- 'first_brand_pur' => [
- 'name' => 'FIRST_BRAND_PUR',
- 'type' => 'string',
- 'visibility' => 'private',
- ],
- 'last_brand_pur' => [
- 'name' => 'LAST_BRAND_PUR',
- 'type' => 'string',
- 'visibility' => 'private',
- ],
- 'abandoned_prod_name' => [
- 'name' => 'ABANDONED_PROD_NAME',
- 'type' => 'string',
- 'visibility' => 'private',
- ],
- 'billing_company' => [
- 'name' => 'BILLING_COMPANY',
- 'type' => 'string',
- 'visibility' => 'private',
- ],
- 'delivery_company' => [
- 'name' => 'DELIVERY_COMPANY',
- 'type' => 'string',
- 'visibility' => 'private',
- ],
- ];
- /**
- * @var \Dotdigitalgroup\Email\Helper\Data
- */
- private $helper;
- /**
- * Datafield constructor.
- *
- * @param \Dotdigitalgroup\Email\Helper\Data $helper
- */
- public function __construct(
- \Dotdigitalgroup\Email\Helper\Data $helper
- ) {
- $this->helper = $helper;
- }
- /**
- * Set contact datafields.
- *
- * @param array $contactDatafields
- *
- * @return null
- */
- public function setContactDatafields($contactDatafields)
- {
- $this->contactDatafields = $contactDatafields;
- }
- /**
- * Get contact datafields.
- *
- * @return array
- */
- public function getContactDatafields()
- {
- $contactDataFields = $this->contactDatafields;
- $extraDataFields = $this->getExtraDataFields();
- if (! empty($extraDataFields)) {
- $contactDataFields = array_merge($extraDataFields, $contactDataFields);
- }
- return $contactDataFields;
- }
- /**
- * Set a single datafield.
- *
- * @param string $name
- * @param string|int|boolean $value
- * @param string $type
- * @param string $visibility
- *
- * @return array
- */
- public function setDatafield(
- $name,
- $value,
- $type = 'string',
- $visibility = 'private'
- ) {
- $this->datafields[] = [
- 'name' => $name,
- 'value' => $value,
- 'type' => $type,
- 'visibility' => $visibility,
- ];
- return $this->datafields;
- }
- /**
- * @return array
- */
- public function getExtraDataFields()
- {
- return [];
- }
- }
|