Mark contact for reimport.

@param int $customerId

@return null
181357
public function setConnectorContactToReImport($customerId)
    {
        $contactModel = $this->contactFactory->create();
        $contactModel->loadByCustomerId($customerId)
            ->setEmailImported(
                \Dotdigitalgroup\Email\Model\Contact::EMAIL_CONTACT_NOT_IMPORTED
            );
        $this->contactResource->save($contactModel);
    }
370221
public function setContactData($customer)
    {
        $this->model = $customer;
        $this->setReviewCollection();
        parent::setContactData($customer);

        return $this;
    }
625754
function disable_($countryId, $customerId) {return dfc($this, function($countryId, $customerId) {return
		$this->b('enabled') && (
			$this->b('forAll')
			|| ($this->b('forReturning') && !df_customer_is_new($customerId))
			|| $this->countries($countryId)
		)
	;}, func_get_args());}
210241
public function markAsRead($userID)
    {
        if (!$this->old) {
            if (is_null($this->reader)) {
                $this->readers()->attach($userID);
            } elseif ($this->updatedSince($this->reader)) {
                $this->reader->touch();
            }
        }

        return $this;
    }
1096046
public static function create_contact_request(int $userid, int $requesteduserid) : \stdClass {
        global $DB, $PAGE;

        $request = new \stdClass();
        $request->userid = $userid;
        $request->requesteduserid = $requesteduserid;
        $request->timecreated = time();

        $request->id = $DB->insert_record('message_contact_requests', $request);

        // Send a notification.
        $userfrom = \core_user::get_user($userid);
        $userfromfullname = fullname($userfrom);
        $userto = \core_user::get_user($requesteduserid);
        $url = new \moodle_url('/message/pendingcontactrequests.php');

        $subject = get_string('messagecontactrequestsnotificationsubject', 'core_message', $userfromfullname);
        $fullmessage = get_string('messagecontactrequestsnotification', 'core_message', $userfromfullname);

        $message = new \core\message\message();
        $message->courseid = SITEID;
        $message->component = 'moodle';
        $message->name = 'messagecontactrequests';
        $message->notification = 1;
        $message->userfrom = $userfrom;
        $message->userto = $userto;
        $message->subject = $subject;
        $message->fullmessage = text_to_html($fullmessage);
        $message->fullmessageformat = FORMAT_HTML;
        $message->fullmessagehtml = $fullmessage;
        $message->smallmessage = '';
        $message->contexturl = $url->out(false);
        $userpicture = new \user_picture($userfrom);
        $userpicture->includetoken = $userto->id; // Generate an out-of-session token for the user receiving the message.
        $message->customdata = [
            'notificationiconurl' => $userpicture->get_url($PAGE)->out(false),
            'actionbuttons' => [
                'accept' => get_string_manager()->get_string('accept', 'moodle', null, $userto->lang),
                'reject' => get_string_manager()->get_string('reject', 'moodle', null, $userto->lang),
            ],
        ];

        message_send($message);

        return $request;
    }
56385
public function getSubscriptionByCustomerId($customerId)
    {
        /** @var SubscriptionFbApi $response */
        $response = $this->call(new Request('subscription.get', array('customer_id' => $customerId)), 'DVelopment\FastBill\Model\SubscriptionFbApi');
        $subscriptions = $response->getResponse()->getSubscriptions();

        return reset($subscriptions);
    }
746008
public function buildCustomerCollection($customerIds)
    {
        $customerLog = $this->getTable('customer_log');
        $customerCollection = $this->customerCollection->create()
            ->addAttributeToSelect('*')
            ->addNameToSelect();
        $customerCollection = $this->addBillingJoinAttributesToCustomerCollection($customerCollection);
        $customerCollection = $this->addShippingJoinAttributesToCustomerCollection($customerCollection);
        $customerCollection = $customerCollection->addAttributeToFilter('entity_id', ['in' => $customerIds]);

        // get the last login date from the log_customer table
        $customerCollection->getSelect()->columns([
            'last_logged_date' => $this->expressionFactory->create(
                ["expression" => "(
                    SELECT last_login_at 
                    FROM  $customerLog 
                    WHERE customer_id =e.entity_id ORDER BY log_id DESC LIMIT 1
                )"]
            ),
        ]);

        return $customerCollection;
    }
594137
public function registerCard(string $customerId, string $urlReturn = null)
    {
        $this->flow->getLogger()->debug("Registering Card for $customerId, returns to $urlReturn");

        return BasicResponse::make(
            $this->flow->send('post',
                $this->endpoint . '/register',
                [
                    'customerId' => $customerId,
                    'url_return' => $urlReturn ?? $this->flow->getReturnUrls('card.url_return'),
                ]
            )
        );
    }
856925
public function getContact($contactID, $accountID)
    {
        $result = $this->httpHelper->get("accounts/" . intval($accountID) . "/contacts/" . intval($contactID));

        $phoneNumbers = [];
        if (is_object($result->phone_numbers))
        {
            foreach ($result->phone_numbers as $type => $phoneNumberResult)
            {
                $phoneNumber = new PhoneNumber([
                    'number' => $phoneNumberResult->number,
                    'extension' => $phoneNumberResult->extension,
                    'type' => $type,
                ]);
                array_push($phoneNumbers, $phoneNumber);
            }
        }

        $contact = new Contact([
            'contact_id' => $result->id,
            'account_id' => intval($accountID),
            'name' => $result->name,
            'role' => $result->role,
            'email_address' => $result->email_address,
            'phone_numbers' => $phoneNumbers,
        ]);

        return $contact;
    }
1366366
protected function checkExistingCustomerBasket($customerId)
    {
        $basket = $this->basketManager->findOneBy(['customer' => $customerId]);
        if ($basket instanceof BasketInterface) {
            throw new HttpException(400, sprintf('Customer (%d) already has a basket', $customerId));
        }
    }
695769
public static function confirm_contact_request(int $userid, int $requesteduserid) {
        global $DB;

        if ($request = $DB->get_record('message_contact_requests', ['userid' => $userid,
                'requesteduserid' => $requesteduserid])) {
            self::add_contact($userid, $requesteduserid);

            $DB->delete_records('message_contact_requests', ['id' => $request->id]);
        }
    }
915735
public function updateNotImportedByCustomerIds($customerIds)
    {
        $this->getConnection()->update(
            $this->getMainTable(),
            ['email_imported' => $this->expressionFactory->create(["expression" => 'null'])],
            ["customer_id IN (?)" => $customerIds]
        );
    }
1203210
private function _determineCustomerId($customerOrId)
    {
        $customerId = ($customerOrId instanceof Customer) ? $customerOrId->id : $customerOrId;
        $this->_validateCustomerId($customerId);
        return $customerId;

    }
1134110
public function setCustomerId( $customerid )
	{
		if ( $customerid === $this->getCustomerId() ) { return; }

		$this->_notifyListeners( 'setCustomerId.before', $customerid );

		$this->_values['customerid'] = (string) $customerid;
		$this->_modified = true;

		$this->_notifyListeners( 'setCustomerId.after', $customerid );
	}
166182
public function addCredits($customerId, $amount)
    {
        $requestData = new AddCredits\RequestData($customerId, $amount);
        $request = new AddCredits\Request($requestData);

        return $this->sendRequest($request, AddCredits\ApiResponse::class);
    }
76980
public function get($customerId, $optParams = array()) {
      $params = array('customerId' => $customerId);
      $params = array_merge($params, $optParams);
      $data = $this->__call('get', array($params));
      if ($this->useObjects()) {
        return new Customer($data);
      } else {
        return $data;
      }
    }
640835
public function updateCustomer(int $customerId, $customer) : array
    {
        Assert::that($customerId)->greaterThan(0, 'The $customerId has to be positive');

        return (array)$this->master->doRequest(
            'PUT',
            sprintf('/admin/WEBAPI/Endpoints/v1_0/CustomerService/{KEY}/%d', $customerId),
            $customer
        );
    }