本文整理汇总了PHP中Library\Utility\Helper::setLog方法的典型用法代码示例。如果您正苦于以下问题:PHP Helper::setLog方法的具体用法?PHP Helper::setLog怎么用?PHP Helper::setLog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Library\Utility\Helper
的用法示例。
在下文中一共展示了Helper::setLog方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveFrontierCharge
/**
* @param array $data
* @return bool
*/
public function saveFrontierCharge($data)
{
/**
* @var \DDD\Dao\Booking\Booking $bookingDao
* @var \Library\Authentication\BackofficeAuthenticationService $authenticationService
* @var \DDD\Dao\Booking\Charge $chargingDao
* @var BankTransaction $serviceTransaction
* @var Logger $logger
* @var \DDD\Service\Booking\BookingAddon $addonService
* @var \DDD\Dao\ApartmentGroup\ApartmentGroup $apartmentManagementDao
*/
$addonService = $this->getServiceLocator()->get('service_booking_booking_addon');
$serviceTransaction = $this->getServiceLocator()->get('service_booking_bank_transaction');
$bookingDao = $this->getServiceLocator()->get('dao_booking_booking');
$logger = $this->getServiceLocator()->get('ActionLogger');
$apartmentManagementDao = $this->getServiceLocator()->get('dao_apartment_group_apartment_group');
if (!isset($data['bookingId']) || !($rowBooking = $bookingDao->getBookingForFrontierCharge($data['bookingId'])) || !$data['cc_id']) {
return false;
}
$authenticationService = $this->getServiceLocator()->get('library_backoffice_auth');
$loggedInUserID = $authenticationService->getIdentity()->id;
$chargingDao = $this->getServiceLocator()->get('dao_booking_charge');
$parkingInventoryDao = $this->getServiceLocator()->get('dao_parking_spot_inventory');
$addons = $addonService->getAddonsArray();
$groupId = isset($data['groupId']) ? (int) $data['groupId'] : 0;
$pspId = $apartmentManagementDao->getPsp($groupId);
/**
* @var Psp $pspService
*/
$pspService = $this->getServiceLocator()->get('service_psp');
$pspInfo = $pspService->getPspInfo($pspId);
try {
$chargingDao->beginTransaction();
if (isset($data['accommodation_amount'])) {
foreach ($data['accommodation_amount'] as $key => $value) {
if (isset($data['entityId'][$key]) && (int) $data['entityId'][$key] > 0) {
if ((int) $data['addonstype'][$key] == Constants::ADDONS_PARKING) {
$isAvailable = $parkingInventoryDao->getSpotInventoryAvailability($data['entityId'][$key], $data['nightDate'][$key]);
if (!$isAvailable) {
return false;
}
}
}
}
$params = ['reservation_id' => $rowBooking['id'], 'date' => date('Y-m-d H:i:s'), 'user_id' => $loggedInUserID, 'comment' => Helper::setLog('commentWithoutData', $data['charge_comment']), 'acc_currency' => $rowBooking['apartment_currency_code'], 'type' => 'n', 'apartment_id' => $rowBooking['apartment_id_assigned']];
// set business model
if ($rowBooking['model'] == PartnerService::BUSINESS_MODEL_GINOSI_COLLECT) {
$params['money_direction'] = Charge::CHARGE_MONEY_DIRECTION_GINOSI_COLLECT;
} elseif (in_array($rowBooking['model'], PartnerService::partnerBusinessModel())) {
$params['money_direction'] = Charge::CHARGE_MONEY_DIRECTION_PARTNER_COLLECT;
}
$provideParking = [];
foreach ($data['accommodation_amount'] as $key => $row) {
//nightly data
if (isset($data['reservation_nightly_ids'][$key]) && (int) $data['reservation_nightly_ids'][$key] > 0) {
$params['reservation_nightly_id'] = (int) $data['reservation_nightly_ids'][$key];
$params['rate_name'] = $data['rateNames'][$key];
$params['reservation_nightly_date'] = $data['nightDate'][$key];
} else {
$params['reservation_nightly_id'] = 0;
$params['rate_name'] = NUll;
$params['reservation_nightly_date'] = NULL;
}
//entityId is being used for parking now
if (isset($data['entityId'][$key]) && (int) $data['entityId'][$key] > 0) {
$params['entity_id'] = (int) $data['entityId'][$key];
if ((int) $data['addonstype'][$key] == Constants::ADDONS_PARKING) {
//close spot availability
$parkingInventoryDao->save(['availability' => 0], ['spot_id' => $params['entity_id'], 'date' => $params['reservation_nightly_date']]);
}
} else {
$params['entity_id'] = 0;
}
$params['acc_amount'] = number_format((double) $row, 2, '.', '');
$params['addons_type'] = (int) $data['addonstype'][$key];
$params['addons_value'] = (int) $data['addons_value'][$key];
$params['tax_type'] = isset($data['taxtype'][$key]) ? (double) $data['taxtype'][$key] : 0;
if (isset($addons[$params['addons_type']]['default_commission']) && $addons[$params['addons_type']]['default_commission']) {
$params['commission'] = $rowBooking['partner_commission'];
} else {
$params['commission'] = 0;
}
$params['status'] = 0;
$chargingDao->save($params);
if ($params['addons_type'] == Constants::ADDONS_PARKING) {
if (!isset($provideParking[$params['rate_name']])) {
$provideParking[$params['rate_name']] = [];
}
array_push($provideParking[$params['rate_name']], $params['reservation_nightly_date']);
}
}
$parkingChargesByDateRanges = $this->calculateDateRangesForSpot($provideParking);
foreach ($parkingChargesByDateRanges as $parkingSpotRequested) {
$logger->save(Logger::MODULE_BOOKING, $rowBooking['id'], Logger::ACTION_PROVIDE_PARKING, 'Provide Parking on ' . $parkingSpotRequested['date'] . ' for ' . $parkingSpotRequested['spot']);
}
$bookingTicketService = $this->getServiceLocator()->get('service_booking_booking_ticket');
//.........这里部分代码省略.........
示例2: saveTransaction
/**
* @param array $data
* @param int $moneyDirection
* @param bool $isFrontier
*
* @return bool|string
*/
public function saveTransaction($data, $moneyDirection = self::TRANSACTION_MONEY_DIRECTION_GINOSI_COLLECT, $isFrontier = false)
{
/**
* @var \DDD\Dao\Booking\ChargeTransaction $bankTransactionDao
* @var \Library\Authentication\BackofficeAuthenticationService $authenticationService
* @var \DDD\Service\Booking\BookingTicket $bookingTicketService
* @var \DDD\Domain\Booking\ForCharge $rowBooking
* @var ForCharge $bookingDao
* @var \DDD\Service\Fraud $serviceFraud
* @var \DDD\Dao\Psp\Psp $pspDao
* @var Logger $logger
*/
$transactionDate = date('Y-m-d H:i:s');
$bankTransactionDao = $this->getServiceLocator()->get('dao_booking_change_transaction');
$pspDao = $this->getServiceLocator()->get('dao_psp_psp');
$transactionType = (int) $data['transaction_type'];
$transactionStatus = isset($data['transaction_status']) ? (int) $data['transaction_status'] : 0;
$errorRespond = ['status' => 'error', 'msg' => TextConstants::ERROR_CHARGED];
$error = '';
$transactionTypesWhichRequireCreditCard = [self::BANK_TRANSACTION_TYPE_COLLECT, self::BANK_TRANSACTION_TYPE_REFUND, self::BANK_TRANSACTION_TYPE_VALIDATION];
if (in_array($transactionType, $transactionTypesWhichRequireCreditCard) && (!isset($data['cardId']) || !(int) $data['cardId'])) {
return ['status' => 'error', 'msg' => TextConstants::ERROR_NO_CARD];
}
$creditCardId = intval($data['cardId']);
/**
* @var \DDD\Dao\Booking\Booking $bookingDao
*/
$bookingDao = $this->getServiceLocator()->get('dao_booking_booking');
$bookingDao->setEntity(new \DDD\Domain\Booking\ForCharge());
$rowBooking = $bookingDao->fetchOne(['res_number' => $data['res_number']], ['id', 'partner_id', 'customer_id']);
if (!$rowBooking) {
return $errorRespond;
}
try {
if (!$isFrontier) {
$bankTransactionDao->beginTransaction();
}
$authenticationService = $this->getServiceLocator()->get('library_backoffice_auth');
$bookingTicketService = $this->getServiceLocator()->get('service_booking_booking_ticket');
$loggedInUserID = $authenticationService->getIdentity()->id;
$transactionApartmentAmount = $data['transaction_acc_amount'];
$accAmount = number_format(doubleval($transactionApartmentAmount), 2, '.', '');
if ($transactionType == self::BANK_TRANSACTION_TYPE_DEDUCTED_SALARY) {
$bankAmount = 0;
$bankRate = 0;
$moneyAccountCurrency = $data['acc_currency'];
$cashUser = (int) $data['userCache_id'];
} else {
$moneyAccountCurrency = $data['transaction_money_account_currency'];
$bankRate = $data['transaction_money_account_currency_rate'];
$bankAmount = number_format($data['transaction_charge_amount'], 2, '.', '');
$cashUser = 0;
}
// Calculate exact bank amount
$bankAmount = $this->applyPercentDeductionByPSP($bankAmount, $data['transaction_psp']);
if ($transactionType == self::BANK_TRANSACTION_TYPE_DEDUCTED_SALARY) {
$moneyAccountId = 0;
} elseif (in_array($transactionType, [self::BANK_TRANSACTION_TYPE_CASH, self::BANK_TRANSACTION_TYPE_CASH_REFUND])) {
$moneyAccountId = (int) $data['personal_account_id'];
} elseif (in_array($transactionType, [self::BANK_TRANSACTION_TYPE_CHARGEBACK_DISPUTE, self::BANK_TRANSACTION_TYPE_CHARGEBACK_FRAUD, self::BANK_TRANSACTION_TYPE_CHARGEBACK_OTHER])) {
$moneyAccountId = (int) $data['transaction_chargeback_bank'];
} elseif ($transactionType == self::BANK_TRANSACTION_TYPE_BANK_DEPOSIT) {
$moneyAccountId = (int) $data['money_account_deposit_id'];
$moneyDirection = (int) $data['money_direction_received'];
} else {
$moneyAccountId = (int) $data['transaction_money_account_id'];
}
if ($transactionType == self::BANK_TRANSACTION_TYPE_BANK_DEPOSIT) {
$moneyDirection = self::TRANSACTION_MONEY_DIRECTION_GINOSI_COLLECT;
}
// All Refunds and Chargebacks
if (in_array($transactionType, [self::BANK_TRANSACTION_TYPE_REFUND, self::BANK_TRANSACTION_TYPE_CHARGEBACK_FRAUD, self::BANK_TRANSACTION_TYPE_CHARGEBACK_DISPUTE, self::BANK_TRANSACTION_TYPE_CHARGEBACK_OTHER, self::BANK_TRANSACTION_TYPE_CASH_REFUND])) {
if ($transactionType != self::BANK_TRANSACTION_TYPE_CASH_REFUND) {
$bankAmount = -$bankAmount;
}
$accAmount = -$accAmount;
}
$params = ['reservation_id' => $data['reservation_id'], 'money_account_id' => $moneyAccountId, 'date' => $transactionDate, 'user_id' => $loggedInUserID, 'bank_amount' => $bankAmount, 'money_account_currency' => $moneyAccountCurrency, 'acc_amount' => $accAmount, 'bank_rate' => $bankRate, 'comment' => Helper::setLog('commentWithoutData', Helper::stripTages($data['transaction_charge_comment'])), 'type' => $transactionType, 'cache_user' => $cashUser, 'apartment_id' => (int) $data['accId'], 'money_direction' => $moneyDirection];
if (in_array($transactionType, [self::BANK_TRANSACTION_TYPE_CASH, self::BANK_TRANSACTION_TYPE_CASH_REFUND, self::BANK_TRANSACTION_TYPE_BANK_DEPOSIT, self::BANK_TRANSACTION_TYPE_DEDUCTED_SALARY])) {
$params['cc_id'] = 0;
} else {
$params['cc_id'] = $creditCardId;
}
if ($transactionType == self::BANK_TRANSACTION_TYPE_COLLECT) {
$cardStatus = $transactionStatus + 1;
/**
* @var CardService $cardService
*/
$cardService = $this->getServiceLocator()->get('service_card');
$cardPartnerBusinessModel = $cardService->getCardPartnerBusinessModel($creditCardId);
// check card partner business model
if ($cardPartnerBusinessModel && $cardPartnerBusinessModel == Partners::BUSINESS_MODEL_GINOSI_COLLECT_PARTNER) {
$params['money_direction'] = self::TRANSACTION_MONEY_DIRECTION_PARTNER_COLLECT;
//.........这里部分代码省略.........