本文整理汇总了PHP中EnmasseHelper::getMinuteReleaseInvtyFromSetting方法的典型用法代码示例。如果您正苦于以下问题:PHP EnmasseHelper::getMinuteReleaseInvtyFromSetting方法的具体用法?PHP EnmasseHelper::getMinuteReleaseInvtyFromSetting怎么用?PHP EnmasseHelper::getMinuteReleaseInvtyFromSetting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EnmasseHelper
的用法示例。
在下文中一共展示了EnmasseHelper::getMinuteReleaseInvtyFromSetting方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: submitCheckOut
//.........这里部分代码省略.........
$payGty = JModel::getInstance('payGty', 'enmasseModel')->getById($payGtyId);
// checking gateway configuration
if (CartHelper::checkGty($payGty) == false) {
$msg = JText::_("PAYMENT_INCOMPLETE_MSG");
$link = JRoute::_("index.php?option=com_enmasse&controller=shopping&task=checkout&buy4friend={$bBuy4friend}", false);
JFactory::getApplication()->redirect($link, $msg);
}
// save gty info into session
JFactory::getSession()->set('payGty', serialize($payGty));
JFactory::getSession()->set('attribute_config', json_encode($payGty->attribute_config));
//--------If admin set the prepay_percent of the deal to 0.00, set the order status to 'Paid' (with paid_amount is 0.00)
if ($item->prepay_percent == 0.0) {
$status = EnmasseHelper::$ORDER_STATUS_LIST['Paid'];
$couponStatus = EnmasseHelper::$INVTY_STATUS_LIST['Hold'];
} else {
//------------------------------------
// generate name of payment gateway file and class
$payGtyFile = 'PayGty' . ucfirst($payGty->class_name) . '.class.php';
$className = 'PayGty' . ucfirst($payGty->class_name);
//---------------------------------------------------
// get payment gateway object
require_once JPATH_SITE . DS . "components" . DS . "com_enmasse" . DS . "helpers" . DS . "payGty" . DS . $payGty->class_name . DS . $payGtyFile;
$paymentClassObj = new $className();
$paymentReturnStatusObj = $paymentClassObj->returnStatus();
$status = $paymentReturnStatusObj->order;
$couponStatus = $paymentReturnStatusObj->coupon;
}
} else {
//deal is free
$payGty = "Free";
$status = 'Unpaid';
$couponStatus = 'Pending';
//save the payGty as free
JFactory::getSession()->set('payGty', 'Free');
}
//----------------------------------------
//determine information of coupon receiver
if ($bBuy4friend) {
$deliveryDetail = array('name' => $receiverName, 'email' => $receiverEmail, 'msg' => $receiverMsg, 'address' => $receiverAddress, 'phone' => $receiverPhone);
} else {
$deliveryDetail = array('name' => $buyerName, 'email' => $buyerEmail, 'msg' => '', 'address' => $receiverAddress, 'phone' => $receiverPhone);
}
//--------------------------
//generate order
$dvrGty = $item->prepay_percent < 100 ? 2 : 1;
$deliveryGty = JModel::getInstance('deliveryGty', 'enmasseModel')->getById($dvrGty);
$user = array();
$user['id'] = JFactory::getUser()->get('id', 0);
$user['name'] = $buyerName;
$user['email'] = $buyerEmail;
$order = CartHelper::saveOrder($cart, $user, $payGty, null, $deliveryGty, $deliveryDetail, $status);
$session =& JFactory::getSession();
$session->set('newOrderId', $order->id);
$orderItemList = CartHelper::saveOrderItem($cart, $order, $status);
//-----------------------------
// if this deal is set limited the coupon to sold out, go to invty and allocate coupons for this order
// if not create coupons for that order
if ($item->max_coupon_qty > 0) {
$now = DatetimeWrapper::getDatetimeOfNow();
$nunOfSecondtoAdd = EnmasseHelper::getMinuteReleaseInvtyFromSetting($payGty) * 60;
$intvy = CartHelper::allocatedInvty($orderItemList, DatetimeWrapper::mkFutureDatetimeSecFromNow($now, $nunOfSecondtoAdd), $couponStatus);
} else {
JModel::getInstance('invty', 'enmasseModel')->generateForOrderItem($orderItemList[0]->pdt_id, $orderItemList[0]->id, $orderItemList[0]->qty, $couponStatus);
}
//------------------------
//generate integration class
$isPointSystemEnabled = EnmasseHelper::isPointSystemEnabled();
if ($isPointSystemEnabled) {
$integrationClass = EnmasseHelper::getPointSystemClassFromSetting();
$integrateFileName = $integrationClass . '.class.php';
require_once JPATH_SITE . DS . "components" . DS . "com_enmasse" . DS . "helpers" . DS . "pointsystem" . DS . $integrationClass . DS . $integrateFileName;
$user = JFactory::getUser();
$user_id = $user->get('id');
$point = $cart->getPoint();
if ($point > 0) {
$integrationObject = new $integrationClass();
$integrationObject->integration($user_id, 'paybypoint', $point);
}
}
//validating is ok, flush user data
JFactory::getApplication()->setUserState("com_enmasse.checkout.data", null);
// --------------------------------
// if deal is free then directly do the notify
if ($cart->getTotalPrice() > 0) {
//deal is not free, check if buyer must prepay a specific amount
if ($item->prepay_percent > 0) {
$link = JRoute::_("index.php?option=com_enmasse&controller=payment&task=gateway&orderId=" . $order->id, false);
} else {
//do notify for the order that not to prepay
EnmasseHelper::doNotify($order->id);
$link = JRoute::_("index.php?option=com_enmasse&controller=deal&task=listing");
$msg = JText::_("PARTIAL_PAYMENT_NO_PREPAY_CHECKOUT_MSG");
JFactory::getApplication()->redirect($link, $msg);
}
} else {
//deal is free
$link = JRoute::_("index.php?option=com_enmasse&controller=payment&task=doNotify&orderId={$order->id}", false);
}
JFactory::getApplication()->redirect($link);
}