本文整理汇总了PHP中BFCHelper::prepareOrderData方法的典型用法代码示例。如果您正苦于以下问题:PHP BFCHelper::prepareOrderData方法的具体用法?PHP BFCHelper::prepareOrderData怎么用?PHP BFCHelper::prepareOrderData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BFCHelper
的用法示例。
在下文中一共展示了BFCHelper::prepareOrderData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendOrder
function sendOrder($formData)
{
$formData['orderType'] = 'a';
$formData['cultureCode'] = $GLOBALS['bfi_lang'];
$customer = RSFormHelper::getCustomerData($formData);
$suggestedStay = json_decode(stripslashes($formData['staysuggested']));
$req = json_decode(stripslashes($formData['stayrequest']), true);
// $suggestedStay = json_decode($_SESSION['search.params']['suggestedstay']);
// $req = array('resourceId' => $_SESSION['search.params']['resourceId'], 'checkin' => $formData['checkin']['date'], 'checkout' =>$formData['checkout']['date'] , 'duration' => $_SESSION['search.params']['duration'], 'paxages' => '['.implode(',', $_SESSION['search.params']['paxages']).']', 'extras' => $_SESSION['search.params']['extras'], 'packages' => $_SESSION['search.params']['packages'], 'pricetype' => $_SESSION['search.params']['pricetype'], 'rateplanId' => $_SESSION['search.params']['rateplanId'], 'state' => 'booking' , 'variationPlanId' => $_SESSION['search.params']['variationPlanId'], 'gotCalculator' => false);
$redirect = $formData['Redirect'];
$redirecterror = $formData['Redirecterror'];
$isgateway = $formData['isgateway'];
$otherData = "paxages:" . str_replace("]", "", str_replace("[", "", $req['paxages'])) . "|" . "checkin_eta_hour:" . $formData['checkin_eta_hour'];
$ccdata = null;
if (RSFormHelper::canAcquireCCData($formData)) {
$ccdata = json_encode(RSFormHelper::getCCardData($formData));
$ccdata = BFCHelper::encrypt($ccdata);
}
$orderData = BFCHelper::prepareOrderData($formData, $customer, $suggestedStay, $otherData, $ccdata);
$orderData['pricetype'] = $req['pricetype'];
// $orderData['label'] = 'developerdemo';
$orderData['label'] = $formData['label'];
$processOrder = null;
/*
if(!empty($isgateway) && ($isgateway =="true" ||$isgateway =="1")){
$processOrder=false;
}
*/
$order = BFCHelper::setOrder($orderData['customerData'], $orderData['suggestedStay'], $orderData['creditCardData'], $orderData['otherNoteData'], $orderData['merchantId'], $orderData['orderType'], $orderData['userNotes'], $orderData['label'], $orderData['cultureCode'], $processOrder, $orderData['pricetype']);
if (empty($order)) {
$order = "";
$redirect = $redirecterror;
}
if (!empty($order)) {
if (!empty($isgateway) && ($isgateway == "true" || $isgateway == "1")) {
wp_redirect(get_site_url() . '/payment/?orderId=' . $order->OrderId);
exit;
} else {
$numAdults = 0;
$persons = explode("|", $suggestedStay->Paxes);
foreach ($persons as $person) {
$totper = explode(":", $person);
$numAdults += (int) $totper[1];
}
$startDate = DateTime::createFromFormat('Y-m-d', BFCHelper::parseJsonDate($order->StartDate, 'Y-m-d'));
$endDate = DateTime::createFromFormat('Y-m-d', BFCHelper::parseJsonDate($order->EndDate, 'Y-m-d'));
$redirect = $redirect . '?act=Order&orderid=' . $order->OrderId . '&merchantid=' . $order->MerchantId . '&OrderType=' . $order->OrderType . '&OrderTypeId=' . $order->OrderTypeId . '&totalamount=' . $order->TotalAmount * 100 . '&startDate=' . $startDate->format('Y-m-d') . '&endDate=' . $endDate->format('Y-m-d') . '&numAdults=' . $numAdults;
wp_redirect($redirect);
exit;
}
}
}
示例2: sendScalarRequest
function sendScalarRequest()
{
$formData = $_POST['form'];
$customer = RSFormHelper::getCustomerData($formData);
$redirect = $formData['Redirect'];
// create otherData (string)
$otherData = "adulti:" . RSFormHelper::getOptionsFromSelect($formData, 'TotPersons') . "|" . "bambini:" . RSFormHelper::getOptionsFromSelect($formData, 'Totchildrens') . "|" . "etabambini:" . $formData['ChildrenAge'] . "|" . "tipologiastruttura:" . RSFormHelper::getOptionsFromSelect($formData, 'merchantcategory') . "|" . "trattamento:" . RSFormHelper::getOptionsFromSelect($formData, 'treatments') . "|" . "maxrisposte:" . RSFormHelper::getOptionsFromSelect($formData, 'Maxresponse') . "|" . "accettazione:" . RSFormHelper::getOptionsFromSelect($formData, 'accettazione');
$suggestedStay = null;
// create SuggestedStay
if ($formData['CheckIn'] != null && $formData['CheckOut'] != null) {
$sStay = array('CheckIn' => DateTime::createFromFormat('d/m/Y', $formData['CheckIn'])->format('Y-m-d\\TH:i:sO'), 'CheckOut' => DateTime::createFromFormat('d/m/Y', $formData['CheckOut'])->format('Y-m-d\\TH:i:sO'));
$suggestedStay = new stdClass();
foreach ($sStay as $key => $value) {
$suggestedStay->{$key} = $value;
}
$otherData .= "|" . "CheckIn:" . DateTime::createFromFormat('d/m/Y', $formData['CheckIn'])->format('Y-m-d') . "|" . "CheckOut:" . DateTime::createFromFormat('d/m/Y', $formData['CheckOut'])->format('Y-m-d');
}
$orderData = BFCHelper::prepareOrderData($formData, $customer, $suggestedStay, $otherData, null);
$orderData['processOrder'] = true;
$orderData['label'] = $this->formlabel;
$order = BFCHelper::setOrder($orderData['customerData'], $orderData['suggestedStay'], $orderData['creditCardData'], $orderData['otherNoteData'], $orderData['merchantId'], $orderData['orderType'], $orderData['userNotes'], $orderData['label'], $orderData['cultureCode']);
/*if (isset($order))
$thankYouMessage = "Grazie";
else
$thankYouMessage = "Errore invio dati";*/
if (empty($order)) {
$order = "";
}
echo json_encode($order);
$app = JFactory::getApplication();
$app->redirect($redirect, false);
$app->close();
}