本文整理汇总了PHP中EnmasseHelper::getPointSystemClassFromSetting方法的典型用法代码示例。如果您正苦于以下问题:PHP EnmasseHelper::getPointSystemClassFromSetting方法的具体用法?PHP EnmasseHelper::getPointSystemClassFromSetting怎么用?PHP EnmasseHelper::getPointSystemClassFromSetting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EnmasseHelper
的用法示例。
在下文中一共展示了EnmasseHelper::getPointSystemClassFromSetting方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doRefund
function doRefund($userId, $orderId, $point)
{
$db = JFactory::getDBO();
$query = "UPDATE #__enmasse_order SET refunded_amount = '" . $point . "' WHERE id = '" . $orderId . "' AND refunded_amount = '0'";
$db->setQuery($query);
$db->query();
if ($this->_db->getErrorNum()) {
JError::raiseError(500, $this->_db->stderr());
return false;
}
//------------------------
//generate integration class
$isPointSystemEnabled = EnmasseHelper::isPointSystemEnabled();
if ($isPointSystemEnabled == true) {
$integrationClass = EnmasseHelper::getPointSystemClassFromSetting();
$integrateFileName = $integrationClass . '.class.php';
require_once JPATH_SITE . DS . "components" . DS . "com_enmasse" . DS . "helpers" . DS . "pointsystem" . DS . $integrationClass . DS . $integrateFileName;
$integrationObject = new $integrationClass();
$integrationObject->integration($userId, 'refunddeal', $point);
return true;
}
return false;
}
示例2: confirmDeal
function confirmDeal()
{
$db = JFactory::getDBO();
$option = 'com_enmasse';
$cid = JRequest::getVar('cid', array(), '', 'array');
$name = "";
$appication = JFactory::getApplication();
if ($cid == null) {
$appication->redirect('index.php?option=' . $option . '&controller=deal', JText::_('CHOOSE_DEAL_TO_CONFIRM'), 'error');
}
for ($i = 0; $i < count($cid); $i++) {
$status = JModel::getInstance('deal', 'enmasseModel')->getStatus($cid[$i]);
if ($status == "Confirmed") {
$appication->redirect('index.php?option=' . $option . '&controller=deal', JText::_('CANNOT_CONFIM_DEAL_CONFIRMED'), 'error');
} elseif ($status == "Voided") {
$appication->redirect('index.php?option=' . $option . '&controller=deal', JText::_('CANNOT_CONFIM_DEAL_VOIDED'), 'error');
} elseif ($status == "Pending") {
$appication->redirect('index.php?option=' . $option . '&controller=deal', JText::_('CANNOT_CONFIM_DEAL_PENDING'), 'error');
}
}
//------------------------
//generate integration class
$isPointSystemEnabled = EnmasseHelper::isPointSystemEnabled();
if ($isPointSystemEnabled == true) {
$integrationClass = EnmasseHelper::getPointSystemClassFromSetting();
$integrateFileName = $integrationClass . '.class.php';
require_once JPATH_SITE . DS . "components" . DS . "com_enmasse" . DS . "helpers" . DS . "pointsystem" . DS . $integrationClass . DS . $integrateFileName;
}
for ($i = 0; $i < count($cid); $i++) {
$dealId = $cid[$i];
$orderItemList = JModel::getInstance('orderItem', 'enmasseModel')->listByPdtIdAndStatus($dealId, "Paid");
foreach ($orderItemList as $orderItem) {
EnmasseHelper::orderItemDelivered($orderItem);
//------------------------
//generate integration class
if ($isPointSystemEnabled == true) {
$buyerId = EnmasseHelper::getUserIdByOrderId($orderItem->order_id);
$referralId = EnmasseHelper::getReferralIdByOrderId($orderItem->order_id);
$integrationObject = new $integrationClass();
$integrationObject->integration($buyerId, 'confirmdeal');
if (!empty($referralId)) {
$integrationObject->integration($referralId, 'referralbonus');
}
}
sleep(1);
}
JModel::getInstance('deal', 'enmasseModel')->updateStatus($dealId, 'Confirmed');
if ($isPointSystemEnabled == true) {
$buyerList = EnmasseHelper::getBuyerRefundConfirmDeal($dealId);
$integrationObject = new $integrationClass();
foreach ($buyerList as $buyer) {
$integrationObject->integration($buyer['buyer_id'], 'refunddeal', $buyer['point_used_to_pay']);
}
}
}
$appication->redirect('index.php?option=' . $option . '&controller=deal', JText::_('CONFIRM_DEAL_SUCCESS_MSG'));
}
示例3: myValidate
</form>
<!-- Begin Point Sytem Integration -->
<?php
if (EnmasseHelper::isPointSystemEnabled() && $item->pay_by_point && $item->prepay_percent == 100.0) {
?>
<div style="width:95%;float:none;margin-top:10px"></div>
<div class="pay_by_point">
<div class="apollo_title"><?php
echo JText::_('PAY_WITH_POINT');
?>
</div>
<div class="apollo_info">
<form action="index.php" id="changePoint" method="post" name="changePoint" class="form-validate" onSubmit="return myValidate(this);">
<?php
$integrationClass = EnmasseHelper::getPointSystemClassFromSetting();
$integrateFileName = $integrationClass . '.class.php';
require_once JPATH_SITE . DS . "components" . DS . "com_enmasse" . DS . "helpers" . DS . "pointsystem" . DS . $integrationClass . DS . $integrateFileName;
$integrationObject = new $integrationClass();
$user = JFactory::getUser();
$userid = $user->id;
$point = $integrationObject->getPoint($userid);
?>
<label><?php
echo JText::_('YOU_HAVE');
?>
<?php
echo number_format($point, 2);
?>
<?php
echo JText::_('POINTS');
示例4: 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);
}
示例5: doNotify
public static function doNotify($orderId)
{
$order = JModel::getInstance('order', 'enmasseModel')->getById($orderId);
JModel::getInstance('order', 'enmasseModel')->updateStatus($order->id, 'Paid');
$orderItemList = JModel::getInstance('orderItem', 'enmasseModel')->listByOrderId($orderId);
$totalQty = 0;
for ($count = 0; $count < count($orderItemList); $count++) {
$orderItem = $orderItemList[$count];
// only add total sold when order has status of delivered
//JModel::getInstance('deal', 'enmasseModel')->addQtySold($orderItem->pdt_id, $orderItem->qty);
JModel::getInstance('orderItem', 'enmasseModel')->updateStatus($orderItem->id, 'Paid');
JModel::getInstance('invty', 'enmasseModel')->updateStatusByOrderItemId($orderItem->id, 'Sold');
if ($count == 0) {
$dealName = $orderItem->description;
} elseif ($count == count($orderItemList) - 1) {
$dealName .= " & " . $orderItem->description;
} else {
$dealName .= " , " . $orderItem->description;
}
$totalQty += $orderItem->qty;
}
//---------------------------
//Create the receipt with pdf format
//just create bill if the order is not free and buyer have full paid
//remember full paid = order->status = "paid" and order->paid_amount == 0.0
if ($order->total_buyer_paid > 0 && $order->paid_amount == 0.0) {
$sBillName = BillHelper::createPDF($orderId);
} else {
$sBillName = "";
}
//--------------------------
// Sending email
$payment = json_decode($order->pay_detail);
$buyer = json_decode($order->buyer_detail);
$delivery = json_decode($order->delivery_detail);
$params = array();
$params['$buyerName'] = $buyer->name;
$params['$buyerEmail'] = $buyer->email;
$buyerEmail = $buyer->email;
$params['$deliveryName'] = $delivery->name;
$params['$deliveryEmail'] = $delivery->email;
$params['$orderId'] = self::displayOrderDisplayId($order->id);
$params['$dealName'] = $dealName;
$params['$totalPrice'] = self::displayCurrency($order->paid_amount);
$params['$totalQty'] = $totalQty;
$params['$createdAt'] = DatetimeWrapper::getDisplayDatetime($order->created_at);
if (self::getSetting()->sending_bill_auto == 1) {
self::sendMailByTemplate($buyerEmail, 'receipt', $params, $sBillName);
//send mail with bill attachment
} else {
self::sendMailByTemplate($buyerEmail, 'receipt', $params);
//send mail with no attachment
}
foreach ($orderItemList as $orderItem) {
$deal = JModel::getInstance('deal', 'enmasseModel')->getById($orderItem->pdt_id);
if ($deal->status == "Confirmed" && $deal->prepay_percent == 100.0) {
self::orderItemDelivered($orderItem);
}
//--- auto confirm deal
if ($deal->auto_confirm && $deal->status != "Confirmed" && $deal->min_needed_qty <= $deal->cur_sold_qty) {
//------------------------
//generate integration class
$isPointSystemEnabled = EnmasseHelper::isPointSystemEnabled();
if ($isPointSystemEnabled == true) {
$integrationClass = EnmasseHelper::getPointSystemClassFromSetting();
$integrateFileName = $integrationClass . '.class.php';
require_once JPATH_SITE . DS . "components" . DS . "com_enmasse" . DS . "helpers" . DS . "pointsystem" . DS . $integrationClass . DS . $integrateFileName;
}
//--- update deal status to "Confirmed"
JModel::getInstance('deal', 'enmasseModel')->updateStatus($deal->id, 'Confirmed');
//--- delivery coupon by email if the deal is not partial payment
if ($deal->prepay_percent == 100.0) {
$arOrderItemDelivery = JModel::getInstance('orderItem', 'enmasseModel')->listByPdtIdAndStatus($deal->id, "Paid");
foreach ($arOrderItemDelivery as $oOrderItem) {
EnmasseHelper::orderItemDelivered($oOrderItem);
//------------------------
//generate integration class
if ($isPointSystemEnabled == true) {
$buyerId = EnmasseHelper::getUserIdByOrderId($oOrderItem->order_id);
$referralId = EnmasseHelper::getReferralIdByOrderId($oOrderItem->order_id);
$integrationObject = new $integrationClass();
$integrationObject->integration($buyerId, 'confirmdeal');
if (!empty($referralId)) {
$integrationObject->integration($referralId, 'referralbonus');
}
}
sleep(1);
}
}
//--- Refund point to who paid with point but without paying by cash
if ($isPointSystemEnabled == true) {
$buyerList = EnmasseHelper::getBuyerRefundConfirmDeal($deal->id);
$integrationObject = new $integrationClass();
foreach ($buyerList as $buyer) {
$integrationObject->integration($buyer['buyer_id'], 'refunddeal', $buyer['point_used_to_pay']);
}
}
}
}
}