public function removeReservationCreditCardsFromBlackList($reservationId) { /** * @var $creditCardService Card */ $reservationsDao = new BookingDAO($this->getServiceLocator(), '\\ArrayObject'); $creditCardService = $this->getServiceLocator()->get('service_card'); $customerId = $reservationsDao->getCustomerIdByReservationId($reservationId); // When reservation was removed from blacklist manually, all credit cards should take status "Unknown" $creditCardService->changeCustomerCardStatuses($customerId, Card::CC_STATUS_UNKNOWN); }
/** * @param int $reservationId * @return bool */ public function isFraudReservation($reservationId) { $reservationsDao = new BookingDao($this->getServiceLocator(), '\\ArrayObject'); $customerId = $reservationsDao->getCustomerIdByReservationId($reservationId); /** * @var Token $tokenDao */ $tokenDao = $this->getServiceLocator()->get('dao_cc_token'); $customerFraudCreditCards = $tokenDao->fetchAll(['customer_id' => $customerId, 'status' => CardService::CC_STATUS_FRAUD], ['id']); /** * @var $blackListDao BlackList */ $blackListDao = $this->getServiceLocator()->get('dao_booking_black_list'); $data = $this->getFraudCombinationAndData($reservationId); $blackListResult = $blackListDao->getBlackList(['fullName' => $data['fullName'], 'fullNamePhone' => $data['fullNamePhone'], 'fullNameAddress' => $data['fullNameAddress'], 'email' => $data['guest_email'], 'phone' => $data['phone']]); if ($customerFraudCreditCards->count() || $blackListResult->count()) { return true; } return false; }