Exemple #1
0
 /**
  * @param Customer $customer
  */
 public function toUser(Customer $customer)
 {
     $customer->setLastName($this->lastName);
     $customer->setFirstName($this->firstName);
     $customer->setPhone($this->phone);
     $customer->setBirthDate($this->birthDate);
     $customer->setEmail($this->email);
     $customer->setAddress($this->address);
     $customer->setAddress2($this->address2);
     $customer->setZipCode($this->zipCode);
     $customer->setCity($this->city);
     $customer->setCountry($this->country);
     $customer->setLocale($this->locale);
     $customer->setFacebookToken($this->facebookToken);
 }
Exemple #2
0
 /**
  * @param Customer $customer
  */
 public function toUser(Customer $customer)
 {
     $customer->setLastName($this->name);
     $customer->setFirstName($this->firstName);
     $customer->setPhone($this->phone);
     $customer->setEmail($this->email);
     $customer->setAddress($this->address);
     $customer->setAddress2($this->address2);
     $customer->setZipCode($this->zipcode);
     $customer->setCity($this->city);
     $customer->setCountry($this->country);
     $customer->setTempCardNumber($this->accentCardNumber);
 }
Exemple #3
0
 /**
  * @param $response
  * @return Customer Returns a Customer entity with data based on the response from getAccountFidelity webservice
  */
 protected function createCustomerFromResponse($response)
 {
     if (!($customer = $this->entityManager->getRepository('SehBundle:Customer')->findOneByEmail($response->emailClient))) {
         $customer = new Customer();
     }
     if (!$customer->getAccountOption()) {
         $customer->setAccountOption($response->nlCarteFidelite);
     }
     if (!$customer->getAddress()) {
         $customer->setAddress($response->adresseClient);
     }
     if (!$customer->getAddress2()) {
         $customer->setAddress2($response->cplAdresseClient);
     }
     if (!$customer->getBirthDate() && ($birthdate = \DateTime::createFromFormat('Ymd', $response->dateNaissance))) {
         $customer->setBirthDate($birthdate);
     }
     if (!$customer->getCity()) {
         $customer->setCity($response->villeClient);
     }
     if (!$customer->getCountry()) {
         $customer->setCountry($response->paysClient);
     }
     if (!$customer->getPhone()) {
         $customer->setPhone($response->telephone);
     }
     if (!$customer->getFirstName()) {
         $customer->setFirstName($response->prenom);
     }
     if (!$customer->getLastName()) {
         $customer->setLastName($response->nom);
     }
     if (!$customer->getMobile()) {
         $customer->setMobile($response->mobile);
     }
     if (!$customer->getLocale()) {
         $customer->setLocale($response->langueClient);
     }
     if (!$customer->getEmail()) {
         $customer->setEmail($response->emailClient);
     }
     if (!$customer->getZipCode()) {
         $customer->setZipCode($response->cpClient);
     }
     $customer->setGalittTitle($response->civilite);
     if (!$customer->getTitle()) {
         if ($galittTitle = $this->entityManager->getRepository('SehBundle:Customer\\GalittTitle')->findOneByValue($response->civilite)) {
             $customer->setTitle($galittTitle->getTitle());
         }
     }
     $hasMainCard = $customer->getMainAccentCard();
     foreach (explode(',', $response->listeCarteFidelite) as $accentCardNumber) {
         $cardResponse = $this->getCardInfo($accentCardNumber);
         if ($cardResponse) {
             $accentCard = $this->createAccentCardFromResponse($cardResponse, $accentCardNumber);
             if (AccentCard::ACTIF == $accentCard->getStatus() && !$hasMainCard) {
                 $accentCard->setMainCard(true);
                 $hasMainCard = true;
             }
             $customer->addAccentCard($accentCard);
             $accentCard->setCustomer($customer);
         }
     }
     if (!$hasMainCard && count($customer->getAccentCards()) > 0) {
         /** @var AccentCard $accentCard */
         $accentCard = $customer->getAccentCards()[0];
         if ($accentCard) {
             $accentCard->setMainCard(true);
         }
     }
     return $customer;
 }