本文整理汇总了PHP中Library\Utility\Helper::getPenalty方法的典型用法代码示例。如果您正苦于以下问题:PHP Helper::getPenalty方法的具体用法?PHP Helper::getPenalty怎么用?PHP Helper::getPenalty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Library\Utility\Helper
的用法示例。
在下文中一共展示了Helper::getPenalty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareData
/**
* @param \DDD\Domain\Booking\BookingTicket $data
* @param array $formData
*
* @return array
*/
public function prepareData($data, $formData)
{
/**
* @var ReviewBooking $review
* @var \DDD\Service\Reservation\PartnerSpecific $partnerSpecificService
* @var \DDD\Service\Booking\Charge $bookingChargeService
* @var \DDD\Dao\Booking\Booking $bookingDao
*/
$partnerSpecificService = $this->getServiceLocator()->get('service_reservation_partner_specific');
$daoReview = new \DDD\Dao\Accommodation\Review($this->getServiceLocator(), 'DDD\\Domain\\Review\\ReviewBooking');
$bookingChargeService = $this->getServiceLocator()->get('service_booking_charge');
$cityService = $this->getServiceLocator()->get('service_location');
$bookingDao = $this->getServiceLocator()->get('dao_booking_booking');
$bookingDao->setEntity(new \DDD\Domain\Booking\PrepareData());
$dataOther = [];
$reservationId = $data->getId();
$startDate = $data->getDate_from();
$endDate = $data->getDate_to();
$review_res_number = $data->getResNumber();
$review = $daoReview->fetchOne(['res_number' => $review_res_number]);
if ($review) {
$data->setHas_review(true);
} else {
$data->setHas_review(false);
}
$auth = $this->getServiceLocator()->get('library_backoffice_auth');
$dataOther['credit_card_view'] = false;
if ($auth->hasRole(Roles::ROLE_CREDIT_CARD)) {
$dataOther['credit_card_view'] = true;
$dataOther['secure_url'] = "https://" . DomainConstants::WS_SECURE_DOMAIN_NAME . "/booking/update-cc-details?code=" . $formData['data']->getProvideCcPageHash();
}
if ($auth->hasRole(Roles::ROLE_RESERVATIONS)) {
$dataOther['reservation_role'] = true;
} else {
$bookingService = $this->getServiceLocator()->get('service_booking');
$part = $bookingService->getPartnerById($data->getPartnerId());
$dataOther['affiliate'] = $part->getPartnerName();
}
$keyPageStatus = '';
if (!Helper::checkDatesByDaysCount(1, $data->getDate_to())) {
$keyPageStatus = "Expired";
} elseif ($data->getKiPageStatus() == 1) {
$kiPageHash = $data->getKiPageHash();
$keyPageStatus = "<a target='_blank' href='https://" . DomainConstants::WS_SECURE_DOMAIN_NAME . '/key?view=0&code=' . $kiPageHash . "' >Key Entry Link</a>";
} elseif (!$data->getKiPageStatus()) {
$keyPageStatus = "Not set yet";
}
$is_penalty_applied = $this->isPenaltyApplied($data->getDate_from(), $data->getIsRefundable(), $data->getRefundableBeforeHours());
$penalty_period = $this->calculateCancelationPeriod($data->getStatus(), $data->getCancelation_date(), $data->getDate_to(), $is_penalty_applied);
$dataOther['keyPageStatus'] = $keyPageStatus;
$dataOther['penalty_period'] = $penalty_period;
$penalty_val = number_format(str_replace(",", ".", $data->getPenalty_val()), 2, '.', '');
$penalty = number_format(str_replace(",", ".", $data->getPenalty()), 2, '.', '');
if (Rate::APARTMENT_RATE_REFUNDABLE == $data->getIsRefundable()) {
if ($data->getRefundableBeforeHours() > 48) {
$dataOther['cancellation'] = "This deal can be canceled for FREE up to " . $data->getRefundableBeforeHours() / 24 . " days before arrival";
} else {
$dataOther['cancellation'] = "This deal can be canceled for FREE up to " . $data->getRefundableBeforeHours() . " hours before arrival";
}
} else {
$dataOther['cancellation'] = 'Non refundable';
}
$dataOther['panelty_type'] = Helper::getPenalty($penalty, $penalty_val, $data->getApartmentCurrencyCode());
foreach ($formData['options']['statuses'] as $row) {
if ($row->getId() == $data->getStatus()) {
$dataOther['status_name'] = $row->getName();
break;
}
}
foreach ($formData['options']['partners'] as $row) {
if ($row->getGid() == $data->getPartnerId()) {
$dataOther['partner_name'] = $row->getPartnerName();
$dataOther['partner_id'] = $data->getPartnerId();
break;
}
}
$customerReservations = $bookingDao->getCustomerReservationsStatuses($data->getGuestEmail());
$bookedReservationsCount = 0;
$cancelledReservationsCount = 0;
$hasDebtBalance = false;
foreach ($customerReservations as $customerReservation) {
if (!$hasDebtBalance && $customerReservation->getBalance() < 0 && $data->getResNumber() != $customerReservation->getResNumber()) {
$hasDebtBalance = true;
}
if ($customerReservation->getStatus() == BookingService::BOOKING_STATUS_BOOKED) {
$bookedReservationsCount++;
} else {
$cancelledReservationsCount++;
}
}
$dataOther['pendingCreditCardInQueue'] = false;
$pendingCreditCardInQueue = $bookingDao->getPendingInQueueCardsByReservationId($reservationId);
if ($pendingCreditCardInQueue->count()) {
$dataOther['pendingCreditCardInQueue'] = true;
//.........这里部分代码省略.........