@param string $customerEmail
@param \Dotdigitalgroup\Email\Model\Apiconnector\Client $client
@param \Magento\Store\Model\Website $website

@return bool - success
771683
private function processContactDataFields($customerEmail, $client, $website)
    {
        $paramDataFields = $this->getRequest()->getParam('data_fields', []);

        if (!$this->helper->getCanShowDataFields($website) ||
            empty($paramDataFields)) {
            return true;
        }

        $data = $this->getDataFields($client, $paramDataFields);

        $contactResponse = $client->updateContactDatafieldsByEmail(
            $customerEmail,
            $data
        );

        return !isset($contactResponse->message);
    }
500360
public function sendShopownerConfirmation(
        $recipient,
        ApiOrderInterface $apiOrder,
        ContactInterface $customerContact = null
    ) {
        if (!$this->sendEmailConfirmationToShopowner) {
            return false;
        }

        if (empty($recipient)) {
            // fallback address for shop-owner order confirmations
            $recipient = $this->confirmationRecipientEmailAddress;
        }

        return $this->sendConfirmationEmail(
            $recipient,
            $apiOrder,
            $this->templateShopownerConfirmationPath,
            $customerContact
        );
    }
846636
public static function doExecute(Client $client, Request $req)
  {
    $httpRequest = $client->getIo()->makeRequest($req);
    $httpRequest->setExpectedClass($req->getExpectedClass());
    return self::decodeHttpResponse($httpRequest, $client);
  }
712331
public function createCustomer($customerExtId)
    {
        $request = $this
            ->apiRequestFactory
            ->createCustomerRequest($customerExtId);

        return $this->send($request);
    }
917259
public function sendInvite($customerId, CustomerInvite $invite = null)
    {
        $data = is_null($invite) ? array() : $invite->exportData();
        $endpoint = '/admin/customers/'.$customerId.'/send_invite.json';
        $response = $this->request(
            $endpoint, 'POST', array(
            'custom_invite' => $data
            )
        );
        return $response['customer_invite'];
    }
609671
public function sendCustomerConfirmation(
        $recipient,
        ApiOrderInterface $apiOrder,
        ContactInterface $customerContact = null
    ) {
        if (!$this->sendEmailConfirmationToCustomer) {
            return false;
        }

        return $this->sendConfirmationEmail(
            $recipient,
            $apiOrder,
            $this->templateCustomerConfirmationPath,
            $customerContact
        );
    }
1126564
public function connect($customerUUID, array $subscriptions)
    {
        $arr = [];
        for($i=0; $i < count($subscriptions); $i++) {
            $arr[$i] = $subscriptions[$i];
            if($subscriptions[$i] instanceof Subscription) {
                $arr[$i] = $subscriptions[$i]->toArray();
            }
        }

        array_unshift($arr, $this->toArray());

        $this->getClient()
            ->send('/v1/customers/'.$customerUUID.'/connect_subscriptions', 'POST', [
                'subscriptions' => $arr,
            ]);
        return true;
    }
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);
    }
634602
protected function checkClientCredentials($clientId, $clientSecret = null)
    {
        if (null === $application = $this->app['repo.api-applications']->findByClientId($clientId)) {
            return false;
        }

        if (null === $clientSecret) {
            return true;
        }

        return $application->getClientSecret() === $clientSecret;
    }
455531
public function getCustomer($customerId)
    {
        $requestData = new Get\RequestData();
        $requestData->setCustomerId($customerId);

        $customers = $this->getCustomers($requestData)->getResponse()->getCustomers();

        return isset($customers[0]) ? $customers[0] : null;
    }
367788
public function customer($customerFid = null, $visitorId = null)
  {
    if($visitorId === null)
    {
      $visitorId = $this->getVisitorIdCookie();
    }

    return Customer::newInstance($this)
      ->setVisitorId($visitorId)
      ->setCustomerFid($customerFid);
  }
517910
public function authenticatePassword($clientId, string $clientSecret, string $username, string $password): Token
    {
        $request = new Request('POST', $this->tokenUrl, [
            'Content-Type' => 'application/json',
        ], json_encode([
            'client_id' => $clientId,
            'client_secret' => $clientSecret,
            'username' => $username,
            'password' => $password,
            'grant_type' => 'password',
        ]));

        $response = $this->getClient()->sendRequest($request);
        $responseBody = $response->getBody()->getContents();
        $this->token = $this->denormalizeObject(Token::class, [json_decode($responseBody)], false);

        return $this->token;
    }
1239789
public function createCustomer(Customer $customer)
    {
        $request = new Create\Request($customer);

        return $this->sendRequest($request, Create\ApiResponse::class);
    }
1143965
public function checkClientCredentials($clientId, $clientSecret = null)
    {
        $client = $this->getClientDataMapper()->findByUuid($clientId);

        if (! $client instanceof Entity\Client) {
            return false;
        }

        return $this->password->verify($clientSecret, $client->getSecret());
    }
903810
public function enqueueForExport(
        \Magento\Store\Api\Data\WebsiteInterface $website,
        $customersFile,
        $customerNum,
        $customerIds,
        $resource
    ) {
        if (is_file($this->file->getFilePath($customersFile))) {
            if ($customerNum > 0) {
                //register in queue with importer
                $this->importerFactory->create()
                    ->registerQueue(
                        \Dotdigitalgroup\Email\Model\Importer::IMPORT_TYPE_CONTACT,
                        '',
                        \Dotdigitalgroup\Email\Model\Importer::MODE_BULK,
                        $website->getId(),
                        $customersFile
                    );

                //set imported
                $resource->setImportedByIds($customerIds);
            }
        }
    }
804472
static public function findByEMail($nb_customer, string $email)
    {
        $retval = null;

        if (is_numeric($nb_customer_id = nb_getMixedValue($nb_customer, NABU_CUSTOMER_FIELD_ID))) {
            $retval = CNabuUser::buildObjectFromSQL(
                'select u.* '
                . 'from nb_user u, nb_customer c '
               . 'where u.nb_customer_id=c.nb_customer_id '
                 . 'and c.nb_customer_id=%cust_id$d '
                 . 'and u.nb_user_email=\'%email$s\'',
                array(
                    'cust_id' => $nb_customer_id,
                    'email' => $email
                )
            );
            if ($retval instanceof CNabuUser && $nb_customer instanceof CNabuCustomer) {
                $retval->setCustomer($nb_customer);
            }
        }

        return $retval;
    }
343154
public static function create(ApiClientInterface $client, UserInterface $user = null)
    {
        $accessToken = new self();
        $accessToken->setUser($user);
        $accessToken->setClient($client);

        return $accessToken;
    }