function ICEPAYOneOffPay($orderInfo, $params = array()) { require_once OSEMSC_B_LIB . DS . 'icepayAPI' . DS . 'icepay.php'; $pConfig = oseMscConfig::getConfig('payment', 'obj'); $merchant_id = $pConfig->icepay_merchant_id; $secret_code = $pConfig->icepay_secret_code; $icepay_country = $pConfig->icepay_country; $icepay_lang = $pConfig->icepay_lang; $db = oseDB::instance(); $payment = oseRegistry::call('payment'); $paymentOrder = $payment->getInstance('Order'); $billinginfo = $paymentOrder->getBillingInfo($orderInfo->user_id); if (empty($icepay_country)) { $query = "SELECT country_2_code FROM `#__osemsc_country` WHERE `country_3_code` = '{$billinginfo->country}'"; $db->setQuery($query); $icepay_country = $db->loadResult(); } if (empty($icepay_lang)) { $lang =& JFactory::getLanguage(); $arr = explode("-", $lang->get('tag')); $icepay_lang = strtoupper($arr[0]); } //$orderInfo->payment_price = "19.99"; $amount = intval(strval(100 * $orderInfo->payment_price)); $Desc = $this->generateDesc($orderInfo->order_id); $currency = $orderInfo->payment_currency; $tran = new ICEPAY($merchant_id, $secret_code); $tran->SetOrderID($orderInfo->order_id); $tran->SetReference($orderInfo->order_number); //$tran->assignCountry('US'); //$tran->assignLanguage('EN'); //$tran->assignCurrency($currency); //$tran->assignAmount($amount); return $tran->Pay($icepay_country, $icepay_lang, $currency, $amount, $Desc); }
function getItem() { $result = array(); $post = JRequest::get('post'); $post = oseMscAddon::getPost('licseat_', $post); if (!isset($post['contact_send'])) { $post['contact_send'] = 0; } if (!isset($post['internal_contact_send'])) { $post['internal_contact_send'] = 0; } $db = oseDB::instance(); $msc_id = JRequest::getInt('msc_id', 0); $member_id = JRequest::getInt('member_id', 0); $mscLicInfo = oseRegistry::call('msc')->getExtInfo($msc_id, 'lic', 'obj'); $mscLicInfoParams = oseObject::getParams($mscLicInfo); $where = array(); $where[] = "license_user_id = '{$member_id}'"; if (empty($mscLicInfoParams->id)) { $where[] = "license_id = '{$mscLicInfoParams->id}'"; } $where = oseDB::implodeWhere(); $query = " SELECT * FROM `#__oselic_license_seat`" . $where . " ORDER BY id DESC"; $db->setQuery($query); $item = oseDB::loadItem('obj'); $result['success'] = empty($item) ? false : true; $result['total'] = empty($item) ? 0 : 1; $result['result'] = empty($item) ? array() : $item; //$result = oseJson::encode($result); return $result; }
function getData() { $id = JRequest::getInt('id'); $db = & JFactory::getDBO(); $query = "SELECT * FROM #__k2_items WHERE id={$id}"; $db->setQuery($query, 0, 1); $row = $db->loadObject(); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // OSE Added - OSE and Open Source Excellence is the registered trade mark of the Open Source Excellence PTE LTD. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// require_once(JPATH_SITE.DS.'components'.DS.'com_osemsc'.DS.'init.php'); $content_ids = oseRegistry::call('content')->getRestrictedContent('k2','article'); if(in_array($id,$content_ids)) { $row->introtext = $row->introtext.'<br /> This content is members only, please <a href="'.JROUTE::_('index.php?option=com_osemsc&view=register').'">subscribe a membership plan first</a>'; $row->fulltext = ''; $row->mscControlled = true; $row->mscControlClass = 'osemsc-control'; } else { $row->mscControlClass = 'osemsc-free'; $row->mscControlled = false; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // OSE Added - OSE and Open Source Excellence is the registered trade mark of the Open Source Excellence PTE LTD. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// return $row; }
public static function create() { $msc_id = JRequest::getInt('msc_id', null); if (empty($msc_id)) { $result['success'] = false; $result['title'] = JText::_('ERROR'); $result['content'] = JText::_('ERROR'); return $result; } $mscItem = oseRegistry::call("msc")->getInfo($msc_id, $type = 'array'); if (empty($mscItem)) { $result['success'] = false; $result['title'] = JText::_('ERROR'); $result['content'] = JText::_('ERROR'); return $result; } $db = oseDB::instance(); $query = " SELECT `virtuemart_shoppergroup_id` FROM `#__virtuemart_shoppergroups` " . " WHERE `shopper_group_name` = " . $db->Quote($mscItem['title']); $db->setQuery($query); $items = oseDB::loadList(); if (empty($items)) { $query = " INSERT INTO `#__virtuemart_shoppergroups` (`virtuemart_shoppergroup_id`, `virtuemart_vendor_id`, `shopper_group_name`, `shopper_group_desc`, `published`) VALUES (NULL, 1, " . $db->Quote($mscItem['title']) . ", " . $db->Quote($mscItem['title']) . ", 1);"; $db->setQuery($query); if (!$db->query()) { $result['success'] = false; $result['title'] = JText::_('ERROR'); $result['content'] = $db->getErrorMsg(); return $result; } } $result['success'] = true; $result['title'] = JText::_('DONE'); $result['content'] = JText::_('SAVE_SUCCESSFULLY'); return $result; }
public static function activate($params) { $result = array(); $result['success'] = true; if (empty($params['allow_work'])) { $result['success'] = false; $result['title'] = 'Error'; $result['content'] = JText::_('Error Renew.History'); return $result; } unset($params['allow_work']); $db = oseDB::instance(); $post = JRequest::get('post'); $msc_id = $params['msc_id']; $member_id = $params['member_id']; $result = array(); $result['success'] = true; if (empty($msc_id)) { $result['success'] = false; $result['title'] = 'Error'; $result['content'] = JText::_(" History Error "); return $result; } $history = oseRegistry::call('member')->getInstance('History'); if (!$history->record($msc_id, $member_id, 'activate')) { $result['success'] = false; $result['title'] = 'Error'; $result['content'] = JText::_(" Fail Record Member's Footprint! "); } return $result; }
function getAddonCats($addon_type) { if (empty($addon_type)) { return false; } $user = &JFactory::getUser(); if ($user->guest) { return false; } require_once(JPATH_SITE . DS . 'components' . DS . 'com_osemsc' . DS . 'init.php'); $db = oseDB::instance(); $content_ids = oseRegistry::call('content')->getRestrictedContent($addon_type, 'category'); $content_ids = (!empty($content_ids)) ? "(" . implode(",", $content_ids) . ")" : "(0)"; $db = oseDB::instance(); switch ($addon_type) { case 'phoca': $query = " SELECT c.title as mscTitle, b.content_id, b.entry_id, cat.title " . " FROM `#__osemsc_member` as a, `#__osemsc_acl` as c, `#__osemsc_content` as b, `#__phocadownload_categories` AS cat" . " WHERE a.member_id = {$user->id} AND a.msc_id=b.entry_id " . " AND b.entry_type='msc' AND b.content_type = 'category' " . " AND b.type='phoca' AND b.content_id = cat.id " . " AND a.msc_id = c.id AND a.status = 1 AND cat.published=1" . " AND b.status = 1 " . " ORDER BY b.entry_id ASC "; break; default: $query = ''; break; } if (!empty($query)) { $db->setQuery($query); $items = $db->loadObjectList(); $items = self::reArrangeArray($items); return $items; } else { return false; } }
/** * Validates againt http://ec.europa.eu/taxation_customs/vies/ * if vat number is valid. If it's valid * returns Consultation Number for tracking porpuses * * @param string $vat * @param string $country_iso * @return string or boolean */ function is_valid_europa($vat, $country_iso) { $country_iso = strtoupper($country_iso); $vat = str_replace($country_iso, '', $vat); $post = array('ms' => $country_iso, 'iso' => $country_iso, 'vat' => $vat, 'requesterMs' => $this->config['requesterMs'], 'requesterIso' => $this->config['requesterIso'], 'requesterVat' => str_replace($this->config['requesterIso'], "", $this->config['requesterVat']), 'BtnSubmitVat' => 'Verify'); oseRegistry::call('remote')->getClientBridge('curl'); $host = 'ec.europa.eu'; $path = '/taxation_customs/vies/viesquer.do'; $connect = new OSERemoteConnector(); /* foreach ($post as $key => $value) { $data[]=$key ."=". urlencode($value); } $post = implode("&", $data); */ //$resp = $connect->send_httprequest_via_fsockopen($host, $path, $post,'urlencoded'); $resp = $connect->send_request_via_curl($host, $path, $post, false, 'urlencoded'); //$resp = $this->CI->curl->simple_post('http://ec.europa.eu/taxation_customs/vies/viesquer.do', $post); if (preg_match('/\\svalid\\sVAT\\s/', $resp)) { preg_match_all('/(WAPIAAAA.*)/', $resp, $match); return trim($match[0][0]); } else { return FALSE; } }
public static function getList($params = array()) { require_once OSEMSC_B_LIB . DS . 'MCAPI.class.php'; $oseMscConfig = oseRegistry::call('msc')->getConfig(null, 'obj'); $APIKey = $oseMscConfig->mailchimp_api_key; $api = new MCAPI($APIKey); $lists = $api->lists(); $data = $lists['data']; $items = array(); $item = array(); foreach ($data as $value) { $item['list_id'] = $value['id']; $item['name'] = $value['name']; $items[] = $item; } $result = array(); if (count($items) < 1) { $result['total'] = 0; $result['results'] = ''; } else { $result['total'] = count($items); $result['results'] = $items; } return $result; }
public static function getItem($params = array()) { $user = JFactory::getUser(); $member_id = $user->id; $member = oseRegistry::call('member'); $db= oseDB::instance(); $query = "SELECT * FROM #__osemsc_mailing WHERE user_id = ". (int)$member_id; $db->setQuery($query); $info = $db->loadObject(); if(empty($info)) { $result['total'] = 0; $result['result'] = ''; } else { $result['total'] = 1; $result['result'] = $info; } return $result; }
function EBSOneOffPay($orderInfo, $params = array()) { $config = oseMscConfig::getConfig('', 'obj'); $mode = $config->ebs_testmode ? "TEST" : "LIVE"; $ebs_merchantID = $config->ebs_merchantID; $md5 = $config->ebs_secretKey; $DeclineURL = JURI::base() . 'index.php?option=com_osemsc&view=confirm'; $AcceptURL = JURI::base() . "components/com_osemsc/ipn/ebs_notify.php?DR={DR}"; $orderId = $orderInfo->order_id; $currency = self::get_iso_code($orderInfo->payment_currency); $amount = $orderInfo->payment_price; $MD5key = md5($currency . $amount . $orderId . $md5); $url = "https://secure.ebs.in/pg/ma/sale/pay/"; $desc = self::generateDesc($orderId); $payment = oseRegistry::call('payment'); $paymentOrder = $payment->getInstance('Order'); $billinginfo = $paymentOrder->getBillingInfo($orderInfo->user_id); $user = JFactory::getUser($orderInfo->user_id); $html['form'] = '<form action="' . $url . '" method="post">'; // Construct variables for post $post_variables = array('windowstate' => '2', 'language' => '2', 'declineurl' => $DeclineURL, 'accepturl' => $AcceptURL, 'MD5key' => $MD5key, 'subscription' => '0', 'account_id' => $ebs_merchantID, 'reference_no' => $orderId, 'amount' => $amount, 'description' => $desc, 'name' => $billinginfo->firstname . ' ' . $billinginfo->lastname, 'address' => $billinginfo->addr1 . ' ' . $billinginfo->addr2, 'city' => $billinginfo->city, 'state' => $billinginfo->state, 'postal_code' => $billinginfo->postcode, 'country' => $billinginfo->country, 'email' => $user->email, 'phone' => $billinginfo->telephone, 'ship_name' => $billinginfo->firstname . ' ' . $billinginfo->lastname, 'ship_address' => $billinginfo->addr1 . ' ' . $billinginfo->addr2, 'ship_city' => $billinginfo->city, 'ship_state' => $billinginfo->state, 'ship_postal_code' => $billinginfo->postcode, 'ship_country' => $billinginfo->country, 'ship_phone' => $billinginfo->telephone, 'return_url' => $AcceptURL, 'mode' => $mode); //print_r($post_variables);exit; $html['form'] .= '<input type="image" id="ebs_image" name="cartImage" src="' . "components/com_osemsc/assets/images/checkout.png" . '" alt="' . JText::_('Click to pay with EBS') . '" />'; // Process payment variables; $html['url'] = $url . "?"; foreach ($post_variables as $name => $value) { $html['form'] .= '<input type="hidden" name="' . $name . '" value="' . htmlspecialchars($value) . '" />'; $html['url'] .= $name . "=" . urlencode($value) . "&"; } $html['form'] .= '</form>'; return $html; }
/** * Loads the entire menu table into memory. * * @return array */ public function load() { // Initialise variables. $db = JFactory::getDbo(); $app = JApplication::getInstance('site'); $query = $db->getQuery(true); $query->select('m.id, m.menutype, m.title, m.alias, m.note, m.path AS route, m.link, m.type, m.level, m.language'); $query->select('m.browserNav, m.access, m.params, m.home, m.img, m.template_style_id, m.component_id, m.parent_id'); $query->select('e.element as component'); $query->from('#__menu AS m'); $query->leftJoin('#__extensions AS e ON m.component_id = e.extension_id'); $query->where('m.published = 1'); $query->where('m.parent_id > 0'); $query->where('m.client_id = 0'); $query->order('m.lft'); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // OSE Added - OSE and Open Source Excellence is the registered trade mark of the Open Source Excellence PTE LTD. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// $where = null; if (file_exists(JPATH_SITE.DS.'components'.DS.'com_osemsc'.DS.'init.php') && file_exists(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_ose_cpu'.DS.'define.php') && !file_exists(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_osemsc'.DS.'installer.dummy.ini')) { require_once(JPATH_SITE.DS.'components'.DS.'com_osemsc'.DS.'init.php'); $content_ids = oseRegistry::call('content')->getRestrictedContent('joomla','menu'); $where = (COUNT($content_ids) > 0)?$query->where(' m.id NOT IN ('.implode(',',$content_ids).')'):null; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // OSE Added - OSE and Open Source Excellence is the registered trade mark of the Open Source Excellence PTE LTD. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Set the query $db->setQuery($query); if (!($this->_items = $db->loadObjectList('id'))) { JError::raiseWarning(500, JText::sprintf('JERROR_LOADING_MENUS', $db->getErrorMsg())); return false; } foreach($this->_items as &$item) { // Get parent information. $parent_tree = array(); if (isset($this->_items[$item->parent_id])) { $parent_tree = $this->_items[$item->parent_id]->tree; } // Create tree. $parent_tree[] = $item->id; $item->tree = $parent_tree; // Create the query array. $url = str_replace('index.php?', '', $item->link); $url = str_replace('&', '&', $url); parse_str($url, $item->query); } }
public static function save($params) { $result = array(); $result['success'] = true; if (empty($params['allow_work'])) { $result['success'] = false; $result['title'] = 'Error'; $result['content'] = JText::_('Error Join.Order.1'); return $result; } unset($params['allow_work']); if ($params['join_from'] != 'payment') { $result['success'] = true; $result['title'] = JText::_('Done'); $result['content'] = JText::_('Done Join.Order'); return $result; } $db = oseDB::instance(); $msc_id = $params['msc_id']; $member_id = $params['member_id']; $order_id = $params['order_id']; $order_item_id = $params['order_item_id']; $where = array(); $where[] = "order_id = {$order_id}"; $payment = oseRegistry::call('payment'); $curOrder = $payment->getOrder($where, 'obj'); $member = oseRegistry::call('member'); $member->instance($member_id); $memParams = $member->getMemberInfo($msc_id, 'obj')->memParams; if (empty($memParams)) { $memParams = new stdClass(); } else { $memParams = oseJSON::decode($memParams); } $memParams->order_id = $order_id; $memParams->payment_mode = $curOrder->payment_mode; $memParams->order_item_id = $order_item_id; // Order problem for system add $memParams = oseJSON::encode($memParams); $query = " UPDATE `#__osemsc_member`" . " SET `params` = " . $db->Quote($memParams) . " WHERE msc_id = {$msc_id} AND member_id = {$member_id}"; $memConfig = oseMscConfig::getConfig('register', 'obj'); $db->setQuery($query); if (!oseDB::query()) { $result['success'] = false; $result['title'] = 'Error'; $result['content'] = JText::_('Error Join.Order.2'); } // User activation function; $params = JComponentHelper::getParams('com_users'); $useractivation = $params->get('useractivation'); if (oseObject::getValue($memConfig, 'disabled_non_paid', false) == true) { if ($useractivation == 0) { $query = " UPDATE `#__users` SET `block` = 0 where `id` = " . $member_id; $db->setQuery($query); $db->query(); } } return $result; }
public static function getGroups($params = array()) { $msc_id = JRequest::getInt('msc_id', 0); $msc = oseRegistry::call('msc'); $item = $msc->getExtInfo($msc_id, 'jgroup', 'obj'); $jgroup_id = oseObject::getValue($item, 'jgroup_id', null); $gid = JHtml::_('access.usergroups', 'jgroup_jgroup_id', $jgroup_id, true); oseExit($gid); }
function PayFastOneOffPostForm($orderInfo, $params = array()) { $pConfig = oseMscConfig::getConfig('payment', 'obj'); $merchantId = $pConfig->payfast_merchant_id; $merchantKey = $pConfig->payfast_merchant_key; $html = array(); $test_mode = $pConfig->payfast_testmode; if (!$test_mode) { if (empty($merchantId) || empty($merchantKey)) { $html['form'] = ""; $html['url'] = ""; return $html; } } if ($test_mode == true) { $merchantId = '10000100'; $merchantKey = '46f0cd694581a'; $url = "https://sandbox.payfast.co.za/eng/process"; } else { $url = "https://www.payfast.co.za/eng/process"; } $db = oseDB::instance(); $member = oseRegistry::call('member'); $member->instance($orderInfo->user_id); $payment = oseRegistry::call('payment'); $paymentOrder = $payment->getInstance('Order'); $billinginfo = $paymentOrder->getBillingInfo($orderInfo->user_id); $amount = $orderInfo->payment_price; $currency = $orderInfo->payment_currency; $order_id = $orderInfo->order_id; $order_number = $orderInfo->order_number; $user =& JFactory::getUser($orderInfo->user_id); $orderInfoParams = oseJson::decode($orderInfo->params); $cancelUrl = JURI::base() . "index.php"; $notifyUrl = JURI::base() . "components/com_osemsc/ipn/payfast_notify.php"; $returnUrl = urldecode(JROUTE::_(JURI::base() . "index.php?option=com_osemsc&view=thankyou&order_id=" . $orderInfo->order_id)); $returnUrl = $returnUrl ? $returnUrl : JURI::base() . "index.php?option=com_osemsc&view=member&result=success&amount={$amount}&ordernumber={$order_number}"; // Create description $description = ''; $vendor_image_url = ""; $app =& JFactory::getApplication(); $currentSession = JSession::getInstance('none', array()); $stores = $currentSession->getStores(); $html['form'] = '<form action="' . $url . '" method="post">'; // Construct variables for post $post_variables = array('merchant_id' => $merchantId, 'merchant_key' => $merchantKey, 'return_url' => $returnUrl, 'cancel_url' => $cancelUrl, 'notify_url' => $notifyUrl, 'name_first' => substr($billinginfo->firstname, 0, 100), 'name_last' => substr($billinginfo->lastname, 0, 100), 'email_address' => substr($billinginfo->email, 0, 255), 'item_name' => JText::_('Order ID: ') . $order_id, 'item_description' => $description, 'amount' => number_format($amount, 2, '.', ''), 'm_payment_id' => $order_id, 'currency_code' => $currency, 'custom_str1' => $order_number, 'user_agent' => 'Open Source Membership Control V5'); $html['form'] .= '<input type="image" id="payfast_image" name="cartImage" src="' . "components/com_osemsc/assets/images/checkout.png" . '" alt="' . JText::_('Click to pay with PayFast') . '" />'; // Process payment variables; $html['url'] = $url . "?"; foreach ($post_variables as $name => $value) { $html['form'] .= '<input type="hidden" name="' . $name . '" value="' . htmlspecialchars($value) . '" />'; $html['url'] .= $name . "=" . urlencode($value) . "&"; } $html['form'] .= '</form>'; return $html; }
function getTerm() { $id = JRequest::getInt('id',0); $terms = oseRegistry::call('member')->getInstance('Email')->getTerm($id); $terms = str_replace("../", JURI::root(), $terms); $result = empty($terms)?'':$terms; $result = oseJson::encode($result); oseExit($result); }
function remove($msc_ids) { $msc = oseRegistry::call('msc'); foreach ($msc_ids as $msc_id) { if (!$msc->remove($msc_id)) { return false; } } return true; }
public static function checkOSE($fileName) { if (file_exists(JPATH_SITE.DS.'components'.DS.'com_osemsc'.DS.'init.php') && file_exists(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_ose_cpu'.DS.'define.php')) { require_once(JPATH_SITE.DS.'components'.DS.'com_osemsc'.DS.'init.php'); oseRegistry :: call('content')->checkAccess('phoca', 'category', $fileName->catid); } else if (file_exists(JPATH_ADMINISTRATOR . DS . "components" . DS . "com_osemsc" . DS . "warehouse" . DS . "api.php")) { require_once (JPATH_ADMINISTRATOR . DS . "components" . DS . "com_osemsc" . DS . "warehouse" . DS . "api.php"); $checkmsc = new OSEMSCAPI(); $checkmsc->ACLCheck("phoca", "cat", $fileName->catid, true); } }
function getAddons($addon_type) { $user = JFactory::getUser(); $member = oseRegistry::call('member'); $view = $member->getInstance('PanelView'); $member->instance($user->id); $result = $member->getMemberPanelView('Member', $addon_type); if ($result['addons']) { $items = array_values($result['addons']); return $items; } }
function sagepayOneOffPay($orderInfo, $params = array()) { $config = oseMscConfig::getConfig('', 'obj'); $vendorname = $config->sagepay_vendorname; $password = $config->sagepay_password; $sagepay_mode = $config->sagepay_mode; $vendoremail = $config->sagepay_vendoremail; $txtype = $config->sagepay_txtype; $order_id = $orderInfo->order_id; $order_number = $orderInfo->order_number; $amount = number_format($orderInfo->payment_price, 2); $currency = $orderInfo->payment_currency; $notify_url = JURI::base() . "components/com_osemsc/ipn/sagepay_notify.php"; $orderInfoParams = oseJson::decode($orderInfo->params); $returnUrl = urldecode($orderInfoParams->returnUrl); $returnUrl = $returnUrl ? $returnUrl : JURI::base() . "index.php?option=com_osemsc&view=member&result=success&amount={$amount}&ordernumber={$order_number}"; $payment = oseRegistry::call('payment'); $paymentOrder = $payment->getInstance('Order'); $billinginfo = $paymentOrder->getBillingInfo($orderInfo->user_id); $db = oseDB::instance(); $query = "SELECT country_2_code FROM `#__osemsc_country` WHERE `country_3_code` = '{$billinginfo->country}'"; $db->setQuery($query); $billinginfo->country = $db->loadResult(); $desc = self::generateDesc($order_id); $user = JFactory::getUser($orderInfo->user_id); if ($sagepay_mode == 'simulator') { $url = "https://test.sagepay.com/simulator/vspformgateway.asp"; } elseif ($sagepay_mode == 'test') { $url = "https://test.sagepay.com/gateway/service/vspform-register.vsp"; } elseif ($sagepay_mode == 'live') { $url = "https://live.sagepay.com/gateway/service/vspform-register.vsp"; } $post_variables = array('VendorTxCode' => $order_number, 'Amount' => $amount, 'Currency' => $currency, 'Description' => $desc, 'SuccessURL' => $notify_url, 'FailureURL' => $notify_url, 'CustomerName' => $billinginfo->firstname . " " . $billinginfo->lastname, 'CustomerEMail' => $user->email, 'VendorEMail' => $vendoremail, 'BillingFirstnames' => $billinginfo->firstname, 'BillingSurname' => $billinginfo->lastname, 'BillingAddress1' => $billinginfo->addr1, 'BillingAddress2' => $billinginfo->addr2, 'BillingCity' => $billinginfo->city, 'BillingPostCode' => $billinginfo->postcode, 'BillingCountry' => $billinginfo->country, 'BillingState' => $billinginfo->state, 'DeliveryFirstnames' => $billinginfo->firstname, 'DeliverySurname' => $billinginfo->lastname, 'DeliveryAddress1' => $billinginfo->addr1, 'DeliveryAddress2' => $billinginfo->addr2, 'DeliveryCity' => $billinginfo->city, 'DeliveryPostCode' => $billinginfo->postcode, 'DeliveryCountry' => $billinginfo->country, 'DeliveryState' => $billinginfo->state, 'DeliveryPhone' => $billinginfo->telephone, 'Basket' => '1:' . $desc . ':1:' . $orderInfoParams->subtotal . ':' . $orderInfoParams->gross_tax . ':' . $amount . ':' . $amount); if ($billinginfo->country != 'US') { unset($post_variables['BillingState']); unset($post_variables['DeliveryState']); } $strIn = null; foreach ($post_variables as $name => $value) { $strIn .= $name . "=" . $value . "&"; } $strIn = trim($strIn, "&"); $Crypt = self::encryptAndEncode($strIn, 'AES', $password); //print_r($post_variables);exit; $html['form'] = '<form action="' . $url . '" method="post">'; $html['form'] .= '<input type="image" id="sagepay_image" name="cartImage" src="' . "components/com_osemsc/assets/images/checkout.png" . '" alt="' . JText::_('Click to pay with PayGate') . '" />'; $html['form'] .= '<input type="hidden" name="VPSProtocol" value="2.23" />'; $html['form'] .= '<input type="hidden" name="TxType" value="' . $txtype . '" />'; $html['form'] .= '<input type="hidden" name="Vendor" value="' . $vendorname . '" />'; $html['form'] .= '<input type="hidden" name="Crypt" value="' . $Crypt . '" />'; $html['form'] .= '</form>'; return $html; }
public static function save($params) { $result = array(); $result['success'] = true; //oseExit($params); if (empty($params['allow_work'])) { $result['success'] = false; $result['title'] = 'Error'; $result['content'] = JText::_('Error Join.Idev'); return $result; } unset($params['allow_work']); if ($params['join_from'] != 'payment') { $result['success'] = true; $result['title'] = JText::_('Done'); $result['content'] = JText::_('Done Join.Order'); return $result; } $oseMscConfig = oseRegistry::call('msc')->getConfig('thirdparty', 'obj'); if (empty($oseMscConfig->idev_enable)) { return $result; } if (empty($oseMscConfig->idev_url)) { return $result; } $db = oseDB::instance(); //$post = JRequest::get('post'); $msc_id = $params['msc_id']; $member_id = $params['member_id']; $order_id = $params['order_id']; $order_item_id = $params['order_item_id']; $where = array(); $where[] = "order_id = {$order_id}"; $payment = oseRegistry::call('payment'); $curOrder = $payment->getOrder($where, 'obj'); $curOrderParams = oseJson::decode($curOrder->params); $member = oseRegistry::call('member'); $member->instance($member_id); $userInfo = $member->getUserInfo('obj'); $memParams = $member->getMemberInfo($msc_id, 'obj')->memParams; $memParams = oseJSON::decode($memParams); $memParams->first_ip = $curOrderParams->first_ip; try { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $oseMscConfig->idev_url . "/sale.php?profile=72198&idev_saleamt={$curOrder->payment_price}&idev_ordernum={$order_id}&ip_address={$memParams->first_ip}"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_exec($ch); curl_close($ch); return $result; } catch (Exception $e) { return $result; } }
function changeStatus() { $db = oseDB::instance(); $msc_id = JRequest::getInt('msc_id', 0); $catids = JRequest::getVar('catids', array()); $newStatus = JRequest::getInt('status', 0); $content = oseRegistry::call('content')->getInstance('msc'); $contentIds = array(); foreach ($catids as $catid) { $contentIds[] = $catid; $query = "SELECT * FROM `#__rokdownloads` WHERE `id` = '{$catid}'"; $db->setQuery($query); $node = $db->loadObject(); $query = "SELECT * FROM `#__rokdownloads` WHERE lft >= '{$node->lft}' and rgt <= '{$node->rgt}' AND `folder` = '1'"; $db->setQuery($query); $objs = $db->loadObjectList(); foreach ($objs as $obj) { $contentIds[] = $obj->id; } } $contentIds = array_unique($contentIds); foreach ($contentIds as $content_id) { $item = $content->getItem('rokdownload', 'category', $content_id, 'msc', $msc_id, '', 'obj'); if (empty($item)) { $updated = $content->insert('rokdownload', 'category', $content_id, 'msc', $msc_id, $newStatus); if (!$updated) { $result = array(); $result['success'] = false; $result['title'] = JText::_('ERROR'); $result['content'] = JText::_('ERROR'); return $result; } } else { $status = $item->status; if ($status != $newStatus) { $updated = $content->update($item, $newStatus); if (!$updated) { $result = array(); $result['success'] = false; $result['title'] = JText::_('ERROR'); $result['content'] = JText::_('ERROR'); return $result; } } } } $result = array(); $result['success'] = true; $result['title'] = JText::_('DONE'); $result['content'] = JText::_('SUCCESSFULLY'); return $result; }
function QuickpayOneOffPay($orderInfo, $params = array()) { $pConfig = oseMscConfig::getConfig('payment', 'obj'); $merchant = $pConfig->quickpay_merchant; $secret = $pConfig->quickpay_secret; $test_mode = $pConfig->quickpay_testmode; $cardtypelock = $pConfig->quickpay_cardtypelock; $autocapture = $pConfig->quickpay_autocapture; $autofee = $pConfig->quickpay_autofee; $lang = empty($pConfig->quickpay_lang) ? 'en' : $pConfig->quickpay_lang; $db = oseDB::instance(); $member = oseRegistry::call('member'); $member->instance($orderInfo->user_id); $payment = oseRegistry::call('payment'); $paymentOrder = $payment->getInstance('Order'); $billinginfo = $paymentOrder->getBillingInfo($orderInfo->user_id); $amount = $orderInfo->payment_price * 100; $currency = $orderInfo->payment_currency; $order_id = $orderInfo->order_id; $order_number = $orderInfo->order_number; $desc = self::generateDesc($order_id); $user =& JFactory::getUser($orderInfo->user_id); $order_id = sprintf("%04d", $order_id); $orderInfoParams = oseJson::decode($orderInfo->params); //$cancelUrl = JURI :: base()."index.php"; $notifyUrl = JURI::base() . "components/com_osemsc/ipn/quickpay_notify.php"; $returnUrl = urldecode(JROUTE::_(JURI::base() . "index.php?option=com_osemsc&view=thankyou&order_id=" . $orderInfo->order_id)); $returnUrl = $returnUrl ? $returnUrl : JURI::base() . "index.php?option=com_osemsc&view=member&result=success&amount={$amount}&ordernumber={$order_number}"; $date = oseHTML::getDateTime(); $url = "https://secure.quickpay.dk/form/"; $html['form'] = '<form action="' . $url . '" method="post">'; // Construct variables for post $post_variables = array('protocol' => 5, 'msgtype' => 'authorize', 'merchant' => $merchant, 'language' => $lang, 'ordernumber' => $order_id, 'amount' => $amount, 'currency' => $currency, 'continueurl' => $returnUrl, 'continueurl' => $returnUrl, 'cancelurl' => $returnUrl, 'callbackurl' => $notifyUrl, 'autocapture' => $autocapture, 'autofee' => $autofee, 'cardtypelock' => $cardtypelock, 'description' => $desc, 'testmode' => $test_mode); $md5String = ''; foreach ($post_variables as $name => $value) { $md5String .= $value; } $md5String .= $secret; $post_variables['md5check'] = md5($md5String); //print_r($post_variables);exit; $html['form'] .= '<input type="image" id="quickpay_image" name="cartImage" src="' . "components/com_osemsc/assets/images/checkout.png" . '" alt="' . JText::_('Click to pay with Quickpay') . '" />'; // Process payment variables; $html['url'] = $url . "?"; foreach ($post_variables as $name => $value) { $html['form'] .= '<input type="hidden" name="' . $name . '" value="' . htmlspecialchars($value) . '" />'; $html['url'] .= $name . "=" . urlencode($value) . "&"; } $html['form'] .= '</form>'; return $html; }
function getOrderMemInfo() { $order_id = JRequest::getInt('order_id', 0); $db = oseDB::instance(); $where = array(); $where[] = "`order_id` = " . $db->quote($order_id); $payment = oseRegistry::call('payment'); $orderInfo = $payment->getOrder($where, 'obj'); $orderInfoParams = oseJson::decode($orderInfo->params); $orderItems = $payment->getOrderItems($order_id, 'obj'); $orderItem = $orderItems[0]; $orderItemParams = oseJson::decode($orderItem->params); $msc_id = $orderItemParams->msc_id; $msc_option = $orderItemParams->msc_option; $msc = oseRegistry::call('msc'); $mscInfo = $msc->getInfo($msc_id, 'obj'); $paymentInfos = $msc->getExtInfo($msc_id, 'payment'); $paymentInfo = $paymentInfos[$msc_option]; if (!empty($paymentInfo['optionname'])) { $optionname = $paymentInfo['optionname']; } else { $optionname = $paymentInfo['recurrence_num'] . ' ' . $paymentInfo['recurrence_unit'] . ' membership'; } $paymentOrder = $payment->getInstance('Order'); $billinginfo = $paymentOrder->getBillingInfo($orderInfo->user_id); $query = " SELECT f.name,v.value FROM `#__osemsc_fields` AS f " . " INNER JOIN `#__osemsc_fields_values` AS v" . " ON f.`id` = v.`field_id`" . " WHERE `member_id` = " . $orderInfo->user_id; $db->setQuery($query); $profiles = $db->loadObjectList(); echo "<div style=\"color: #238db4; font-weight: bold; font-size:12px;\">" . JText::_('MEMBERSHIP_INFORMATION') . ":</div>"; echo "<div>" . JText::_('MEMBERSHIP') . " : " . $mscInfo->title . "</div>"; echo "<div>" . JText::_('MEMBERSHIP_OPTION') . " : " . $optionname . "</div>"; echo "</br>"; echo "<div style=\"color: #238db4; font-weight: bold; font-size:12px;\">" . JText::_('BILLING_INFORMATION') . ":</div>"; echo "<div>" . JText::_('FIRST_NAME') . " : " . $billinginfo->firstname . "</div>"; echo "<div>" . JText::_('LAST_NAME') . " : " . $billinginfo->lastname . "</div>"; echo "<div>" . JText::_('EMAIL') . " : " . $billinginfo->email . "</div>"; echo "<div>" . JText::_('ADDRESS') . " : " . $billinginfo->addr1 . " " . $billinginfo->addr2 . "</div>"; echo "<div>" . JText::_('CITY') . " : " . $billinginfo->city . "</div>"; echo "<div>" . JText::_('STATE') . " : " . $billinginfo->state . "</div>"; echo "<div>" . JText::_('COUNTRY') . " : " . $billinginfo->country . "</div>"; echo "<div>" . JText::_('ZIP_POSTAL_CODE') . " : " . $billinginfo->postcode . "</div>"; echo "<div>" . JText::_('PHONE') . " : " . $billinginfo->telephone . "</div>"; echo "</br>"; echo "<div style=\"color: #238db4; font-weight: bold; font-size:12px;\">" . JText::_('ADDITIONAL_INFORMATION') . ":</div>"; foreach ($profiles as $profile) { echo "<div>" . $profile->name . " : " . $profile->value . "</div>"; } oseExit(); }
public static function save($params) { $result = array(); $result['success'] = true; //oseExit($params); if(empty($params['allow_work'])) { $result['success'] = false; $result['title'] = 'Error'; $result['content'] = JText::_('Error Join.Order.1'); return $result; } unset($params['allow_work']); if( $params['join_from'] != 'payment') { $result['success'] = true; $result['title'] = JText::_('Done'); $result['content'] = JText::_('Done Join.Order'); return $result; } $db = oseDB::instance(); //$post = JRequest::get('post'); $msc_id = $params['msc_id']; $member_id = $params['member_id']; $order_id = $params['order_id']; $order_item_id = $params['order_item_id']; $payment= oseRegistry :: call('payment'); $orderInfo= $payment->getInstance('Order')->getOrder(array("order_id = {$order_id}"), 'obj'); $orderInfoParams = oseJson::decode($orderInfo->params); $array = array(); $array['id'] = $orderInfoParams->coupon_user_id; if(!empty($array['id'])) { $array['paid'] = 1; $array['user_id'] = $member_id; $updated = oseDB::update('#__osemsc_coupon_user','id',$array); } return $result; }
function changeStatus() { $db = oseDB::instance(); $msc_id = JRequest::getInt('msc_id', 0); $item_ids = JRequest::getVar('item_ids', array()); $newStatus = JRequest::getInt('status', 0); if (empty($item_ids[0])) { $result = array(); $result['success'] = false; $result['title'] = JText::_('ERROR'); $result['content'] = JText::_('PLEASE_CHOOSE_A_ITEM_FIRST'); return $result; } foreach ($item_ids as $item_id) { $content = oseRegistry::call('content')->getInstance('msc'); $item = $content->getItem('k2', 'article', $item_id, 'msc', $msc_id, '', 'obj'); if (empty($item)) { $updated = $content->insert('k2', 'article', $item_id, 'msc', $msc_id, $newStatus); $db = oseDB::instance(); if (!$updated) { $result = array(); $result['success'] = false; $result['title'] = JText::_('ERROR'); $result['content'] = JText::_('ERROR'); return $result; } } else { $status = $item->status; if ($status == $newStatus) { continue; } else { $updated = $content->update($item, $newStatus); if (!$updated) { $result = array(); $result['success'] = false; $result['title'] = JText::_('ERROR'); $result['content'] = JText::_('ERROR'); return $result; } } } } $result = array(); $result['success'] = true; $result['title'] = JText::_('DONE'); $result['content'] = JText::_('SUCCESSFULLY'); return $result; }
function fetchElement($name, $value, &$node, $control_name) { require_once(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_ose_cpu' . DS . 'define.php'); require_once(OSECPU_B_PATH . DS . 'oseregistry' . DS . 'oseregistry.php'); oseRegistry::register('registry', 'oseregistry'); oseRegistry::call('registry'); oseRegistry::register('msc', 'membership'); oseRegistry::call('msc', 'membership'); $objs = oseMscTree::getSubTreeDepth(0, 0, 'obj'); $option = array(); $option[] = '<option value ="">N/A</option>'; foreach ($objs as $obj) { @$option[] = JHTML::_('select.option', $obj->id, $obj->title); } $return = JHTML::_('select.genericlist', $option, '' . $control_name . '[' . $name . '][]', ' class="inputbox" style="width:90%;" multiple="multiple" size="15"','value', 'text', $value); return $return; }
function checkUser() { $user = JFactory::getUser(); if ($user->guest) { $app = JFactory::getApplication('SITE'); $session = &JFactory::getSession(); $session->set('oseReturnUrl', base64_encode(JRoute::_('index.php?option=com_osemsc&view=payment'))); $app->redirect(JRoute::_('index.php?option=com_osemsc&view=login')); } else { $member = oseRegistry::call('member'); $member->instance($user->id); $result = $member->getMemberPanelView('Payment'); if (!$result) { $app = JFactory::getApplication('SITE'); } } }
public static function getItem($params = array()) { $member_id = JRequest::getInt('member_id', 0); $member = oseRegistry::call('member'); $member->instance($member_id); $info = $member->getBillingInfo(); if (empty($info)) { $result['success'] = false; $result['total'] = 0; $result['result'] = ''; } else { $result['success'] = true; $result['total'] = 1; $result['result'] = $info; } return $result; }
protected function getInput() { require_once(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_ose_cpu' . DS . 'define.php'); require_once(OSECPU_B_PATH . DS . 'oseregistry' . DS . 'oseregistry.php'); oseRegistry::register('registry', 'oseregistry'); oseRegistry::call('registry'); oseRegistry::register('msc', 'membership'); oseRegistry::call('msc', 'membership'); $objs = oseMscTree::getSubTreeDepth(0, 0, 'obj'); $option = array(); foreach ($objs as $obj) { if ($obj->published) { @$option[] = JHTML::_('select.option', $obj->id, $obj->title); } } $name = "{$this->name}[]"; return JHTML::_('select.genericlist', $option, $name, ' class="inputbox" style="width:90%;" multiple="multiple" size="15"', 'value', 'text', $this->value); }
public static function save($params) { $result = array(); $result['success'] = true; //oseExit($params); if (empty($params['allow_work'])) { $result['success'] = false; $result['title'] = 'Error'; $result['content'] = JText::_('Error Join.Order.1'); return $result; } unset($params['allow_work']); if ($params['join_from'] != 'payment') { $result['success'] = true; $result['title'] = JText::_('Done'); $result['content'] = JText::_('Done Join.Order'); return $result; } $db = oseDB::instance(); //$post = JRequest::get('post'); $msc_id = $params['msc_id']; $member_id = $params['member_id']; $order_id = $params['order_id']; $where = array(); $where[] = "order_id = {$order_id}"; $payment = oseRegistry::call('payment'); $curOrder = $payment->getOrder($where, 'obj'); $member = oseRegistry::call('member'); $member->instance($member_id); $memParams = $member->getMemberInfo($msc_id, 'obj')->memParams; $memParams = oseJSON::decode($memParams); $memParams->order_id = $order_id; $memParams->payment_mode = $curOrder->payment_mode; // Order problem for system add $memParams = oseJSON::encode($memParams); $query = " UPDATE `#__osemsc_member`" . " SET params = " . $db->Quote($memParams) . " WHERE msc_id = {$msc_id} AND member_id = {$member_id}"; $db->setQuery($query); //oseExit($db->_sql); if (!oseDB::query()) { $result['success'] = false; $result['title'] = 'Error'; $result['content'] = JText::_('Error Join.Order.2'); } return $result; }