/**
  * Save a vendor in case there was an error.
  *
  * @param string $email
  * @param int $miraklId
  */
 public function recordVendor($email, $miraklId)
 {
     $miraklData = current($this->mirakl->getVendors(null, false, array($miraklId)));
     $hipayInfo = $this->hipay->getWalletInfo($miraklData['contact_informations']['email']);
     $vendor = $this->createVendor($email, $hipayInfo->getUserAccountld(), $hipayInfo->getUserSpaceld(), $hipayInfo->getIdentified(), $miraklId, $miraklData);
     $this->vendorManager->save($vendor);
 }
 /**
  * @param int             $hipayId
  * @param DateTime        $date
  * @param bool            $status
  */
 protected function identification($hipayId, $date, $status)
 {
     if ($status) {
         $eventName = 'identification.notification.success';
     } else {
         $eventName = 'identification.notification.failed';
     }
     $vendor = $this->vendorManager->findByHiPayId($hipayId);
     if ($vendor !== null) {
         $vendor->setHiPayIdentified($status);
         $this->vendorManager->save($vendor);
     }
     $event = new Identification($hipayId, $date);
     $this->dispatcher->dispatch($eventName, $event);
 }