Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
 protected function preparePostVars($orderInfo)
 {
     $prepare = array();
     $pConfig = oseMscConfig::getConfig('payment', 'obj');
     $prepare['paypal_email'] = $pConfig->paypal_email;
     $prepare['test_mode'] = $pConfig->paypal_testmode;
     if ($prepare['test_mode']) {
         $url = "https://www.sandbox.paypal.com/cgi-bin/webscr";
     } else {
         $url = "https://www.paypal.com/cgi-bin/webscr";
     }
     $prepare['url'] = $url;
     $member = oseRegistry::call('member');
     $member->instance($orderInfo->user_id);
     $billinginfo = $member->getBillingInfo('obj');
     $amount = $orderInfo->payment_price;
     $currency = $orderInfo->payment_currency;
     $order_id = $orderInfo->order_id;
     $order_number = $orderInfo->order_number;
     //$billinginfo = OSEPAYMENTS::get_billinginfo($user_id);
     $user =& JFactory::getUser($orderInfo->user_id);
     $desc = parent::generateDesc($order_id);
     $msc_name = $desc;
     return $prepare;
 }
 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);
 }
Ejemplo n.º 4
0
	public function loadViewJs($type = null) {
		oseHTML::initCss();
		$config = oseMscConfig::getConfig('global', 'obj');
		oseHTML::stylesheet('components/com_osemsc/assets/css/' . $config->frontend_style . '.css', '1.5');
		oseHTML::initScript($type);
		$com = OSECPU_PATH_JS . '/com_ose_cpu/extjs';
		require_once(OSEMSC_F_HELPER . DS . "extLanguage.php");
		if (JOOMLA16 == true) {
			oseHTML::script($com . '/ose/app.msg.js', '1.6');
			$lang = JFactory::getLanguage();
			$arr = explode("-", $lang->get('tag'));
			$lang = JRequest::getCmd('ose_lang', $arr[0]);
			if (JFile::exists(OSECPU_F_PATH . DS . 'extjs' . DS . 'locale' . DS . "ext-lang-{$lang}.js")) {
				oseHTML::script($com . "/locale/ext-lang-{$lang}.js", '1.6');
			} else {
				oseHTML::script($com . "/locale/ext-lang-en.js", '1.6');
			}
		} else {
			oseHTML::script($com . '/ose/app.msg.js');
			$lang = JFactory::getLanguage();
			$arr = explode("-", $lang->get('tag'));
			$lang = JRequest::getCmd('lang', $arr[0]);
			if (JFile::exists(OSECPU_F_PATH . DS . 'extjs' . DS . 'locale' . DS . "ext-lang-{$lang}.js")) {
				oseHTML::script($com . "/locale/ext-lang-{$lang}.js", '1.5');
			}
			oseHTML::script('/components/com_osemsc/libraries/joomla.core.js', '1.5');
			$strings = oseJson::encode(oseText::jsStrings());
			$document = JFactory::getDocument();
			$document->addScriptDeclaration('var oseTrans = function(){var strings=' . $strings . ';Joomla.JText.load(strings)}; oseTrans();');
		}
		$lang = JFactory::getLanguage();
		$lang->load('com_osemsc');
		oseHTML::script('components/com_osemsc/libraries/init.js', '1.6');
	}
Ejemplo n.º 5
0
	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;
	}
 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 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;
 }
Ejemplo n.º 8
0
	function display($tpl = null) {
		$tpl = null;
		$config = oseMscConfig::getConfig('global', 'obj');
		$com = OSECPU_PATH_JS . '/com_ose_cpu/extjs';
		oseHTML::initScript();
		oseHTML::script($com . '/ose/app.msg.js', '1.5');
		oseHTML::script($com . '/grid/expander.js', '1.5');
		oseHTML::script(OSEMSC_F_URL . '/libraries/init.js', '1.5');
		oseHTML::stylesheet(OSEMSC_F_URL . '/assets/css/' . $config->frontend_style . '.css', (JOOMLA16) ? '1.6' : '1.5');
		$mainframe = JFactory::getApplication('SITE');
		$session = JFactory::getSession();
		$user = JFactory::getUser();
		if ($user->guest) {
			$ItemID = JRequest::getInt("Itemid");
			$return = base64_encode(str_replace("&amp;", "&", JRoute::_("index.php?option=com_osemsc&view=addons&Itemid=" . $ItemID)));
			if (JOOMLA16 == true) {
				$red = str_replace("&amp;", "&", JRoute::_("index.php?option=com_users&view=login&return=" . $return));
			} else {
				$red = str_replace("&amp;", "&", JRoute::_("index.php?option=com_user&view=login&return=" . $return));
			}
			$mainframe->redirect($red, "Please login first.");
		}
		$menu = &JSite::getMenu();
		$item = $menu->getActive();
		$addon_type = '';
		if (!empty($item)) {
			$params = &$menu->getParams($item->id);
			$addon_type = $params->get('addon_type');
		}
		$model = $this->getModel('addons');
		$items = array();
		switch ($addon_type) {
		case 'phoca':
			$items = $model->getAddonCats($addon_type);
			$link = 'index.php?option=com_phocadownload&view=category&id=';
			break;
		case 'roku':
			$items = $model->getAddonInfo($addon_type);
			$link = '';
			break;
		}
		$params = &$mainframe->getParams();
		$page_title = $params->get('page_title');
		$document = &JFactory::getDocument();
		$document->setTitle($params->get('page_title'));
		$this->assignRef('page_title', $page_title);
		$this->assignRef('addon_type', $addon_type);
		$this->assignRef('items', $items);
		$this->assignRef('link', $link);
		$this->prepareDocument();
		parent::display($tpl);
	}
 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 PagSeguroOneOffPay($orderInfo, $params = array())
 {
     require_once OSEMSC_B_LIB . DS . 'PagSeguroLibrary' . DS . 'PagSeguroLibrary.php';
     $pConfig = oseMscConfig::getConfig('payment', 'obj');
     $account = $pConfig->pagseguro_account;
     $token = $pConfig->pagseguro_token;
     $paymentRequest = new PaymentRequest();
     $payment = oseRegistry::call('payment');
     $paymentOrder = $payment->getInstance('Order');
     $billinginfo = $paymentOrder->getBillingInfo($orderInfo->user_id);
     $address = $billinginfo->addr1 . ' ' . $billinginfo->addr2;
     $orderInfoParams = oseJson::decode($orderInfo->params);
     $redirectUrl = urldecode(JROUTE::_(JURI::base() . "index.php?option=com_osemsc&view=thankyou&order_id=" . $orderInfo->order_id));
     $redirectUrl = $redirectUrl ? $redirectUrl : JURI::root() . "index.php?option=com_osemsc&view=member";
     $des = $this->generateDesc($orderInfo->order_id);
     // Sets the currency
     $paymentRequest->setCurrency($orderInfo->payment_currency);
     // Add an item for this payment request
     $paymentRequest->addItem($orderInfo->order_id, $des, 1, $orderInfo->payment_price);
     // Sets a reference code for this payment request, it is useful to identify this payment in future notifications.
     $paymentRequest->setReference($orderInfo->order_number);
     // Sets shipping information for this payment request
     $CODIGO_SEDEX = ShippingType::getCodeByType('SEDEX');
     $paymentRequest->setShippingType($CODIGO_SEDEX);
     $paymentRequest->setShippingAddress('', $address, $billinginfo->telephone, null, null, $billinginfo->city, $billinginfo->state, $billinginfo->country);
     // Sets your customer information.
     $paymentRequest->setSender($billinginfo->firstname . ' ' . $billinginfo->lastname, $billinginfo->email, null, null);
     $redirectUrl = str_replace('https://', '', $redirectUrl);
     $redirectUrl = str_replace('http://', '', $redirectUrl);
     $paymentRequest->setRedirectUrl($redirectUrl);
     $result = array();
     $result['payment_method'] = 'pagseguro';
     try {
         $credentials = new AccountCredentials($account, $token);
         $url = $paymentRequest->register($credentials);
         $result['success'] = true;
         $result['url'] = $url;
     } catch (PagSeguroServiceException $e) {
         $result['success'] = false;
         $result['title'] = 'Error';
         $result['content'] = $e->getMessage();
         //$result['url'] = '';
     }
     return $result;
 }
Ejemplo n.º 11
0
	function display($tpl = null) {
		$app = JFactory::getApplication('SITE');
		$config = oseMscConfig::getConfig('register', 'obj');
		$items = oseMscPublic::getCartItems();
		$this->checkUser();
		$this->assignRef('item', $items[0]);
		$model = $this->getModel('payment');
		$items = $model->getMemberships();
		$com = OSECPU_PATH_JS . '/com_ose_cpu/extjs';
		$msc = oseRegistry::call('msc');
		$regForm = empty($config->register_form) ? null : $config->register_form;
		if (!empty($config->payment_system)) {
			$this->setLayout($config->payment_system);
		}
		$tpl = $regForm;
		$this->prepareDocument();
		parent::display($tpl);
	}
	function onAfterDispatch() {
		$app = JFactory::getApplication('SITE');
		if ($app->isAdmin()) {
			return;
		}
		$document = JFactory::getDocument();
		if (!JFile::exists(JPATH_SITE . DS . 'components' . DS . 'com_osemsc' . DS . 'init.php')) {
			return false;
		} else {
			require_once(JPATH_SITE . DS . 'components' . DS . 'com_osemsc' . DS . 'init.php');
			require_once(JPATH_SITE . DS . 'components' . DS . 'com_osemsc' . DS . 'helpers' . DS . 'oseMscPublic.php');
		}
		$config = oseMscConfig::getConfig('thirdparty', 'obj');
		$account = oseObject::getValue($config, 'gag_account');
		$standard_type = oseObject::getValue($config, 'gag_domain_mode');
		$domain = oseObject::getValue($config, 'gag_domain');
		$order_id = JRequest::getCmd('orderID', null);
		$code = oseMscPublic::htmlTrack($account, $standard_type, $domain, $order_id);
		$document->addScriptDeclaration($code);
	}
Ejemplo n.º 13
0
	function display($tpl = null) {
		$tpl = null;
		$this->set('_layout', 'default');
		oseHTML::initCss();
		$com = OSECPU_PATH_JS . '/com_ose_cpu/extjs';
		oseHTML::initScript();
		oseHTML::script($com . '/ose/app.msg.js', '1.5');
		oseHTML::script($com . '/grid/expander.js', '1.5');
		oseHTML::script(OSEMSC_F_URL . '/libraries/init.js', '1.5');
		$config = oseMscConfig::getConfig('global', 'obj');
		oseHTML::stylesheet(OSEMSC_F_URL . '/assets/css/' . $config->frontend_style . '.css', (JOOMLA16) ? '1.6' : '1.5');
		$user = JFactory::getUser();
		$app = JFactory::getApplication('SITE');
		$session = JFactory::getSession();
		$db = oseDB::instance();
		$order_id = JRequest::getInt('order_id');
		$payment = oseRegistry::call('payment');
		$where = array();
		$where[] = "`order_id` = " . $db->quote($order_id);
		$order = $payment->getOrder($where, 'obj');
		$orderInfoParams = oseJson::decode($order->params);
		$redirectUrl = urldecode($orderInfoParams->returnUrl);
		$config = oseMscConfig::getConfig('thirdparty', 'obj');
		$account = oseObject::getValue($config, 'gag_account');
		$standard_type = oseObject::getValue($config, 'gag_domain_mode');
		$domain = oseObject::getValue($config, 'gag_domain');
		$htmlTrack = oseMscPublic::htmlTrack($account, $standard_type, $domain, $order_id);
		$code = oseMscPublic::ajaxOrderTrack($account, $order_id);
		if (empty($code)) {
			$code = false;
		} else {
			$code = implode("", $code);
		}
		$document = JFactory::getDocument();
		$document->addScriptDeclaration('var redirectUrl = "' . $redirectUrl . '";');
		$document->addScriptDeclaration($htmlTrack);
		$document->addScriptDeclaration($code);
		$this->assignRef('orderInfo', $order);
		$this->prepareDocument();
		parent::display($tpl);
	}
 function PayGateOneOffPay($orderInfo, $params = array())
 {
     $pConfig = oseMscConfig::getConfig('payment', 'obj');
     $paygate_id = $pConfig->paygate_id;
     $paygate_key = $pConfig->paygate_key;
     $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);
     $currency = 'ZAR';
     $user =& JFactory::getUser($orderInfo->user_id);
     $orderInfoParams = oseJson::decode($orderInfo->params);
     //$cancelUrl = JURI :: base()."index.php";
     $notifyUrl = JURI::base() . "components/com_osemsc/ipn/paygate_notify.php";
     $returnUrl = urldecode($orderInfoParams->returnUrl);
     $returnUrl = $returnUrl ? $returnUrl : JURI::base() . "index.php?option=com_osemsc&view=member&result=success&amount={$amount}&ordernumber={$order_number}";
     $date = oseHTML::getDateTime();
     $CHECKSUM = md5("{$paygate_id}|{$order_number}|{$amount}|{$currency}|{$notifyUrl}|{$date}|{$user->email}|{$paygate_key}");
     $url = "https://www.paygate.co.za/paywebv2/process.trans";
     $html['form'] = '<form action="' . $url . '" method="post">';
     // Construct variables for post
     $post_variables = array('PAYGATE_ID' => $paygate_id, 'REFERENCE' => $order_number, 'AMOUNT' => $amount, 'CURRENCY' => $currency, 'RETURN_URL' => $notifyUrl, 'TRANSACTION_DATE' => $date, 'EMAIL' => $user->email, 'CHECKSUM' => $CHECKSUM);
     //print_r($post_variables);exit;
     $html['form'] .= '<input type="image" id="paygate_image" name="cartImage" src="' . "components/com_osemsc/assets/images/checkout.png" . '" alt="' . JText::_('Click to pay with PayGate') . '" />';
     // 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 AlipayOneOffPay($orderInfo, $params = array())
 {
     $pConfig = oseMscConfig::getConfig('payment', 'obj');
     $alipay_partner = $pConfig->alipay_partner;
     $alipay_key = $pConfig->alipay_key;
     $seller_email = $pConfig->alipay_seller_email;
     $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;
     $desc = self::generateDesc($order_id);
     $user =& JFactory::getUser($orderInfo->user_id);
     $orderInfoParams = oseJson::decode($orderInfo->params);
     //$cancelUrl = JURI :: base()."index.php";
     $notifyUrl = JURI::base() . "components/com_osemsc/ipn/alipay_notify.php";
     $returnUrl = urldecode($orderInfoParams->returnUrl);
     $returnUrl = $returnUrl ? $returnUrl : JURI::base() . "index.php?option=com_osemsc&view=member&result=success&amount={$amount}&ordernumber={$order_number}";
     $date = oseHTML::getDateTime();
     $url = "https://mapi.alipay.com/gateway.do?";
     $html['form'] = '<form action="' . $url . '" method="post">';
     // Construct variables for post
     $variables = array('service' => 'create_direct_pay_by_user', 'payment_type' => 1, 'partner' => $alipay_partner, 'seller_email' => $seller_email, '_input_charset' => 'utf-8', 'notify_url' => $notifyUrl, 'return_url' => $returnUrl, 'out_trade_no' => $order_number, 'subject' => $desc, 'body' => $desc, 'total_fee' => $amount, 'sign_type' => 'MD5');
     $post_variables = $this->buildRequestPara($variables, $alipay_key);
     //print_r($post_variables);exit;
     $html['form'] .= '<input type="image" id="alipay_image" name="cartImage" src="' . "components/com_osemsc/assets/images/checkout.png" . '" alt="' . JText::_('Click to pay with Alipay') . '" />';
     // 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;
 }
Ejemplo n.º 16
0
	function display($tpl = null) {
		$model = $this->getModel('memberships');
		$items = $model->getMemberships();
		$session = JFactory::getSession();
		$osePaymentCurrency = $session->get('osePaymentCurrency', oseRegistry::call('msc')->getConfig('currency', 'obj')->primary_currency);
		$cards = array();
		$com = OSECPU_PATH_JS . '/com_ose_cpu/extjs';
		oseHTML::initScript();
		oseHTML::script($com . '/ose/app.msg.js', '1.5');
		oseHTML::script(OSEMSC_F_URL . '/libraries/init.js', '1.5');
		$register_form = oseRegistry::call('msc')->getConfig('register', 'obj')->register_form;
		$layout = JRequest::getCmd("layout");
		if (empty($register_form) || $register_form == 'default') {
			$layout = (!empty($layout) && ($layout == 'detail' || $layout == 'cartdetail')) ? "cartdetail" : 'cart';
			$this->setLayout($layout);
			$type = 'cart';
		} else {
			$layout = (!empty($layout) && ($layout == 'detail')) ? $layout : 'default';
			$this->setLayout($layout);
			$user = JFactory::getUser();
			$tpl = null;
			$type = 'os';
		}
		if ($layout == 'default' || $layout == 'cart') {
			$cards = $model->drawMscList($osePaymentCurrency, $items, $type);
		} else {
			foreach ($items as $item) {
				$msc_id = JRequest::getInt('msc_id', oseObject::getValue($item, 'id'));
				$cards = $model->getMembershipCard($msc_id);
				break;
			}
		}
		$config = oseMscConfig::getConfig('global', 'obj');
		oseHTML::stylesheet(OSEMSC_F_URL . '/assets/css/' . $config->frontend_style . '.css', (JOOMLA16) ? '1.6' : '1.5');
		$this->assignRef('cards', $cards);
		$this->prepareDocument();
		parent::display($tpl);
	}
Ejemplo n.º 17
0
	function display($tpl = null) {
		$tpl = null;
		$this->set('_layout', 'default');
		oseHTML::initCss();
		$com = OSECPU_PATH_JS . '/com_ose_cpu/extjs';
		oseHTML::initScript();
		oseHTML::script($com . '/ose/app.msg.js', '1.5');
		oseHTML::script($com . '/grid/expander.js', '1.5');
		oseHTML::script(OSEMSC_F_URL . '/libraries/init.js', '1.5');
		$config = oseMscConfig::getConfig('global', 'obj');
		oseHTML::stylesheet(OSEMSC_F_URL . '/assets/css/' . $config->frontend_style . '.css', (JOOMLA16) ? '1.6' : '1.5');
		$user = JFactory::getUser();
		$app = JFactory::getApplication('SITE');
		$session = JFactory::getSession();
		$db = oseDB::instance();
		$token = (isset($_REQUEST['token'])) ? urlencode($_REQUEST['token']) : "";
		$payment = oseRegistry::call('payment');
		$payment_mode = JRequest::getVar('mode');
		$orderID = JRequest::getInt('orderID');
		if (empty($orderID) || !is_numeric($orderID)) {
			echo "Order data is interrupted, payment process is terminated.";
		}
		if ($payment_mode == 'm') {
			$orderInfo = $payment->PaypalAPIPay($orderID, $token);
		} else {
			$orderInfo = $payment->PaypalAPICreateProfile($orderID, $token);
		}
		$where = array();
		$where[] = "`order_id` = " . $db->quote($orderID);
		$order = $payment->getOrder($where, 'obj');
		$orderInfoParams = oseJson::decode($order->params);
		$redirectUrl = urldecode($orderInfoParams->returnUrl);
		$document = JFactory::getDocument();
		$document->addScriptDeclaration('var redirectUrl = "' . $redirectUrl . '";');
		$this->assignRef('orderInfo', $orderInfo);
		$this->prepareDocument();
		parent::display($tpl);
	}
 function LiqPayOneOffPay($orderInfo, $params = array())
 {
     $config = oseMscConfig::getConfig('', 'obj');
     $merchant_id = $config->liqpay_merchant_id;
     $signature = $config->liqpay_signature;
     $method = $config->liqpay_payment;
     $phone = $config->liqpay_phone;
     $orderId = $orderInfo->order_id;
     $amount = $orderInfo->payment_price;
     $currency = $orderInfo->payment_currency;
     $notify_url = JURI::base() . "components/com_osemsc/ipn/liqpay_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}";
     $url = "https://www.liqpay.com/?do=clickNbuy";
     $payment = oseRegistry::call('payment');
     $paymentOrder = $payment->getInstance('Order');
     $billinginfo = $paymentOrder->getBillingInfo($orderInfo->user_id);
     $desc = self::generateDesc($orderId, $orderInfo->user_id, $billinginfo);
     $user = JFactory::getUser($orderInfo->user_id);
     $xml = "<request>      \n\t\t\t<version>1.2</version>\n\t\t\t<result_url>{$notify_url}</result_url>\n\t\t\t<server_url>{$notify_url}</server_url>\n\t\t\t<merchant_id>{$merchant_id}</merchant_id>\n\t\t\t<order_id>{$orderId}</order_id>\n\t\t\t<amount>{$amount}</amount>\n\t\t\t<currency>{$currency}</currency>\n\t\t\t<description>{$desc}</description>\n\t\t\t<default_phone>{$phone}</default_phone>\n\t\t\t<pay_way>{$method}</pay_way> \n\t\t\t</request>\n\t\t";
     $xml_encoded = base64_encode($xml);
     $lqsignature = base64_encode(sha1($signature . $xml . $signature, 1));
     $html['form'] = '<form action="' . $url . '" method="post">';
     // Construct variables for post
     $post_variables = array('operation_xml' => $xml_encoded, 'signature' => $lqsignature);
     //print_r($post_variables);exit;
     $html['form'] .= '<input type="image" id="liqpay_image" name="cartImage" src="' . "components/com_osemsc/assets/images/checkout.png" . '" alt="' . JText::_('Click to pay with LiqPay') . '" />';
     // 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 ClickBankPostForm($orderInfo)
 {
     $pConfig = oseMscConfig::getConfig('payment', 'obj');
     $db = oseDB::instance();
     $query = "SELECT * FROM `#__osemsc_order_item` WHERE `order_id` = " . $orderInfo->order_id;
     $db->setQuery($query);
     $obj = $db->loadObject();
     $params = oseJson::decode($obj->params);
     $msc_option = $params->msc_option;
     $msc_id = $obj->entry_id;
     $query = "SELECT params FROM `#__osemsc_ext` WHERE `id` = " . $msc_id . " AND `type` = 'paymentAdv'";
     $db->setQuery($query);
     $ext = $db->loadResult();
     $ext = oseJson::decode($ext);
     $item_number = empty($ext->{$msc_option}->clickbank_productid) ? 0 : $ext->{$msc_option}->clickbank_productid;
     $test_mode = $pConfig->clickbank_testmode;
     $account = $pConfig->clickbank_account;
     $secret_key = $pConfig->clickbank_secret_key;
     $member = oseRegistry::call('member');
     $member->instance($orderInfo->user_id);
     $billingInfo = $member->getBillingInfo('obj');
     // Construct variables for post
     $post_variables = array('invoice' => $orderInfo->order_number, 'name' => $billingInfo->firstname . " " . $billingInfo->lastname, 'email' => $billingInfo->user_email, 'country' => $billingInfo->country, 'zipcode' => $billingInfo->postcode);
     $url = 'http://' . $item_number . '.' . $account . '.pay.clickbank.net';
     $html = array();
     $html['form'] = '<form action="' . $url . '" method="post">';
     $html['form'] .= '<input type="image" id="clickbank_image" name="cartImage" src="' . "components/com_osemsc/assets/images/checkout.png" . '" alt="' . JText::_('Click to pay with ClickBank') . '" />';
     // 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;
 }
Ejemplo n.º 20
0
 function confirmOrder($order_id, $params = array())
 {
     $db = oseDB::instance();
     $where = array();
     $where[] = '`order_id` = ' . $db->Quote($order_id);
     $orderInfo = $this->getOrder($where, 'obj');
     if (!isset($params['params'])) {
         $params['params'] = oseJson::decode($orderInfo->params);
         $params['params']->recurrence_times = 1 + oseObject::getValue($params['params'], 'recurrence_times', 0);
         $params['params'] = oseJson::encode($params['params']);
     }
     $this->updateOrder($order_id, "confirmed", $params);
     $user_id = $orderInfo->user_id;
     $payment_mode = $orderInfo->payment_mode;
     $payment_method = $orderInfo->payment_method;
     $user = new JUser($user_id);
     $email = $user->get('email');
     $query = " SELECT * FROM `#__osemsc_order_item`" . " WHERE `order_id` = '{$orderInfo->order_id}'";
     $db->setQuery($query);
     $items = oseDB::loadList('obj');
     foreach ($items as $item) {
         switch ($item->entry_type) {
             case 'license':
                 $license = oseRegistry::call('lic')->getInstance(0);
                 $licenseInfo = $license->getKeyInfo($item->entry_id, 'obj');
                 $licenseInfoParams = oseJson::decode($licenseInfo->params);
                 $msc_id = $licenseInfoParams->msc_id;
                 $updated = $this->joinMsc($order_id, $item->order_item_id, $msc_id, $user_id);
                 break;
             default:
             case 'msc':
                 $updated = $this->joinMsc($order_id, $item->order_item_id, $item->entry_id, $user_id);
                 break;
         }
         if (!$updated['success']) {
             return $updated;
         }
     }
     //Auto reucrring email control
     $emailConfig = oseMscConfig::getConfig('email', 'obj');
     $send = true;
     $orderparams = oseJson::decode($params['params']);
     $recurrence_times = oseObject::getValue($orderparams, 'recurrence_times', 1);
     if ($recurrence_times > 1 && oseObject::getValue($emailConfig, 'sendReceiptOnlyOneTime', false)) {
         if ($orderparams->has_trial) {
             $send = false;
         } else {
             if ($recurrence_times > 2) {
                 $send = false;
             }
         }
     }
     if ($send) {
         $memEmail = oseRegistry::call('member')->getInstance('Email');
         $receipt = $memEmail->getReceipt($orderInfo);
         $memEmail->sendEmail($receipt, $email);
         if (!empty($emailConfig->sendReceipt2Admin)) {
             $memEmail->sendToAdminGroup($receipt, $emailConfig->admin_group);
         }
     }
     /*
     $query= "SELECT id FROM `#__menu` WHERE `link` LIKE 'index.php?option=com_osemsc&view=member'";
     $db->setQuery($query);
     $result= $db->loadResult();
     
     if(empty($result))
     {
     	$return_url= "index.php?option=com_osemsc&view=member";
     }
     else
     {
     	$return_url= "index.php?option=com_osemsc&view=member&Itemid=".$result;
     }
     */
     $orderInfoParams = oseJson::decode($orderInfo->params);
     $session = JFactory::getSession();
     $return_url = isset($orderInfoParams->returnUrl) ? urldecode($orderInfoParams->returnUrl) : "index.php";
     //$session = JFactory::getSession();
     //$return_url = $session->get('oseReturnUrl');
     $return['success'] = true;
     $return['payment'] = $payment_method;
     $return['title'] = JText::_('Success');
     $return['content'] = JText::_(' Your membership is activated successfully. Please click the OK button to continue');
     $return['url'] = $return_url;
     $return['returnUrl'] = $return_url;
     $this->updateOrder($order_id, "confirmed");
     //osePayment::getInstance('Cart')->init();
     return $return;
 }
Ejemplo n.º 21
0
	function saveCart($post) {
		$result = array();
		$result['success'] = true;
		$result['reload'] = false;
		$result['script'] = false;
		$result['title'] = JText::_('SUCCESSFUL_ACTIVATION');
		$result['content'] = JText::_('MEMBERSHIP_ACTIVATED_CONTINUE');
		$juser = oseMscAddon::getPost('juser_', $post);
		$password1 = JRequest::getString('juser_password1', '', 'post', JREQUEST_ALLOWRAW);
		$password2 = JRequest::getString('juser_password2', '', 'post', JREQUEST_ALLOWRAW);
		if (oseObject::getValue($juser, 'firstname', false) && oseObject::getValue($juser, 'lastname', false)) {
			$juser['name'] = oseObject::getValue($juser, 'firstname', '') . ' ' . oseObject::getValue($juser, 'lastname', '');
		} else {
			$juser['name'] = oseObject::getValue($juser, 'username', false);
		}
		$juser['password'] = $juser['password1'] = $password1;
		$juser['password2'] = $password2;
		$juser['email1'] = $juser['email'];
		$juser['email2'] = $juser['email'];
		// check unique username
		$list = oseMscAddon::getAddonList('registerOS_body', false, 1, 'obj');
		foreach ($list as $addon) {
			$action_name = oseMscAddon::getActionName($addon, 'formValidate', 'register');
			$updated = oseMscAddon::runAction($action_name, array('inner' => true));
			if (!$updated['success']) {
				return $updated;
			}
		}
		if (!$updated['success']) {
			return $updated;
		}
		// check empty password
		if (empty($juser['password'])) {
			$result['success'] = false;
			$result['title'] = 'Error';
			$result['content'] = JText::_('MUST_SUPPLY_PASSWORD');
			return $result;
		}
		$register = oseMscPublic::juserRegister($juser);
		if (!oseObject::getValue($register, 'success', false)) {
			return $register;
		} else {
			$memConfig = oseMscConfig::getConfig('register', 'obj');
			if ($memConfig->auto_login) {
				$result['reload'] = true;
			}
			$list1 = oseMscAddon::getAddonList('registerOS_header', false, 1, 'obj');
			$list2 = oseMscAddon::getAddonList('registerOS_body', false, 1, 'obj');
			$list3 = oseMscAddon::getAddonList('registerOS_footer', false, 1, 'obj');
			$list = array_merge($list1, $list2, $list3);
			$user = oseObject::getValue($register, 'user');
			$cart = oseMscPublic::getCart();
			$items = $cart->get('items');
			$item = $items[0];
			$params = array();
			$params['msc_id'] = oseMscPublic::getEntryMscId($item);
			$params['msc_option'] = oseObject::getValue($item, 'msc_option');
			$params['payment_mode'] = $post['payment_payment_mode'];
			$params['member_id'] = $user->id;
			$params['payment_method'] = $post['payment_method'];
			foreach ($list as $addon) {
				$action_name = oseMscAddon::getActionName($addon, 'save', 'register');
				$updated = oseMscAddon::runAction($action_name, $params);
				if (!$updated['success']) {
					return $updated;
				}
			}
			$emailConfig = oseMscConfig::getConfig('email', 'obj');
			if (!empty($emailConfig->default_reg_email)) {
				$member = oseRegistry::call('member');
				$email = $member->getInstance('email');
				$emailTempDetail = $email->getDoc($emailConfig->default_reg_email, 'obj');
				if (!empty($emailTempDetail)) {
					$variables = $email->getEmailVariablesRegistration($user->id);
					$variables['user'] = oseObject::setValue($variables['user'], 'password', $juser['password1']);
					$emailParams = $email->buildEmailParams($emailTempDetail->type);
					$emailDetail = $email->transEmail($emailTempDetail, $variables, $emailParams);
					$email->sendEmail($emailDetail, $user->email);
					if ($emailConfig->sendReg2Admin) {
						$email->sendToAdminGroup($emailDetail, $emailConfig->admin_group);
					}
				}
			}
			if ($memConfig->auto_login) {
				$isLogin = $this->login($juser['username'], $juser['password']);
				if (!$isLogin['success']) {
					$session = JFactory::getSession();
					$return = $session->get('oseReturnUrl', base64_encode('index.php?option=com_osemsc&view=login'));
					$result['success'] = false;
					$result['title'] = 'Error';
					$result['content'] = $isLogin['content'];
					$result['returnUrl'] = $return;
					return $result;
				}
			}
			return $result;
		}
	}
Ejemplo n.º 22
0
<?php
/**
 * @version     5.0 +
 * @package        Open Source Membership Control - com_osemsc
 * @subpackage    Open Source Access Control - com_osemsc
 * @author        Open Source Excellence (R) {@link  http://www.opensource-excellence.com}
 * @author        Created on 15-Nov-2010
 * @license GNU/GPL http://www.gnu.org/copyleft/gpl.html
 *
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *  @Copyright Copyright (C) 2010- Open Source Excellence (R)
 */
defined('_JEXEC') or die("Direct Access Not Allowed");
?>
<div class='clr'></div>
<div id='osefooter'>
<?php $config = oseMscConfig::getConfig('global', 'obj');
if ((!isset($config->show_poweredby)) || $config->show_poweredby == true) {
Ejemplo n.º 23
0
 public static function cancel($params)
 {
     $result = array();
     $result['success'] = true;
     if (empty($params['allow_work'])) {
         $result['success'] = false;
         $result['title'] = 'Error';
         $result['content'] = JText::_("Error");
         return $result;
     }
     unset($params['allow_work']);
     $db = oseDB::instance();
     $msc_id = $params['msc_id'];
     $member_id = $params['member_id'];
     $msc = oseRegistry::call('msc');
     $member = oseRegistry::call('member');
     $payment = oseRegistry::call('payment');
     $ext = $msc->getExtInfo($msc_id, 'msc', 'obj');
     $member->instance($member_id);
     $userInfo = $member->getBasicInfo('obj');
     $member = oseRegistry::call('member');
     $email = $member->getInstance('email');
     $emailTempDetail = $email->getDoc($ext->cancel_email, 'obj');
     $variables = $email->getEmailVariablesCancel($member_id, $msc_id);
     $emailParams = $email->buildEmailParams($emailTempDetail->type);
     $emailDetail = $email->transEmail($emailTempDetail, $variables, $emailParams);
     $email->sendEmail($emailDetail, $userInfo->email);
     $emailConfig = oseMscConfig::getConfig('email', 'obj');
     if ($emailConfig->sendWel2Admin) {
         $email->sendToAdminGroup($emailDetail, $emailConfig->admin_group);
     }
     return $result;
 }
Ejemplo n.º 24
0
 function cancelMsc($member_ids, $msc_id)
 {
     $result = array();
     $result['success'] = false;
     $result['title'] = 'Error';
     $result['content'] = 'Fail removing';
     $member = oseRegistry::call('member');
     foreach ($member_ids as $member_id) {
         $member->instance($member_id);
         if (!$member->cancelMsc($msc_id)) {
             return $result;
         } else {
             $params = array();
             $params['msc_id'] = $msc_id;
             $params['member_id'] = $member_id;
             $params['join_from'] = 'payment';
             $params['allow_work'] = true;
             $params['master'] = true;
             $list = oseMscAddon::getAddonList('join', true, 1, 'obj');
             foreach ($list as $addon) {
                 $action_name = oseMscAddon::getActionName($addon, 'cancel', 'join');
                 $result = oseMscAddon::runAction($action_name, $params);
                 if (!$result['success']) {
                     $result['content'] = 'Member ID:' . $member_id . ' ' . $action_name . ' ' . $result['content'];
                     return $result;
                 }
             }
             //Cancel Emial
             $userInfo = $member->getUserInfo('obj');
             $msc = oseRegistry::call('msc');
             $ext = $msc->getExtInfo($msc_id, 'msc', 'obj');
             if ($ext->cancel_email) {
                 $email = $member->getInstance('email');
                 $emailTempDetail = $email->getDoc($ext->cancel_email, 'obj');
                 $variables = $email->getEmailVariablesCancel($member_id, $msc_id);
                 $emailParams = $email->buildEmailParams($emailTempDetail->type);
                 $emailDetail = $email->transEmail($emailTempDetail, $variables, $emailParams);
                 $email->sendEmail($emailDetail, $userInfo->email);
                 $emailConfig = oseMscConfig::getConfig('email', 'obj');
                 if ($emailConfig->sendCancel2Admin) {
                     $email->sendToAdminGroup($emailDetail, $emailConfig->admin_group);
                 }
             }
         }
     }
     $result['success'] = true;
     $result['title'] = 'Done';
     $result['content'] = 'Removed successfully!';
     return $result;
 }
Ejemplo n.º 25
0
 function eWaySharedHostingPostForm($orderInfo, $billingInfo)
 {
     $pConfig = oseMscConfig::getConfig('payment', 'obj');
     $user =& JFactory::getUser();
     if ($pConfig->ewaysh_testmode) {
         $CustomerID = '87654321';
         $UserName = '******';
     } else {
         $CustomerID = $pConfig->ewaysh_customer_id;
         $UserName = $pConfig->ewaysh_username;
     }
     $order_id = $orderInfo->order_id;
     $desc = self::generateDesc($order_id);
     //$session =& JFactory::getSession();
     //$session->set( 'oseOrder_id', $order_id);
     $ewayCustomerID = $CustomerID;
     $ewayUserName = $UserName;
     $ewayAmount = number_format($orderInfo->payment_price, 2, '.', ' ');
     //$ewayAmount = "100".".00";
     $ewayCurrency = $orderInfo->payment_currency;
     $ewayPageTitle = $pConfig->ewaysh_pagetitle;
     $ewayPageDesc = $pConfig->ewaysh_pagetitle;
     $ewayReturnUrl = JURI::base() . "components/com_osemsc/ipn/ewaysh_notify.php";
     $ewayCancelURL = JURI::base() . "index.php";
     $ewayLanguage = empty($pConfig->ewaysh_language) ? 'EN' : $pConfig->ewaysh_language;
     $ewayModified = $pConfig->ewaysh_mcd;
     $ewayFirstName = $billingInfo->firstname;
     $ewayLastName = $billingInfo->lastname;
     $ewayZipcode = $billingInfo->postcode;
     //$ewayCountry = $billingInfo->country;
     $ewayEmail = $billingInfo->email;
     $ewayLogourl = $pConfig->ewaysh_logourl;
     $ewayBanner = $pConfig->ewaysh_banner;
     $ewayCompanyName = $pConfig->ewaysh_companyname;
     $ewayfooter = $pConfig->ewaysh_pagefooter;
     $ewayCustomerAddress = $billingInfo->addr1 . "&nbsp;" . $billingInfo->addr1;
     $ewayCustomerPostCode = $billingInfo->postcode;
     $ewayCustomerCountry = $billingInfo->country;
     $ewayCustomerCity = $billingInfo->city;
     $ewayCustomerState = $billingInfo->state;
     $ewayCustomerPhone = $billingInfo->telephone;
     #$ewayCustomerAddress= $row['address_1'];
     $ewayurl = null;
     $ewayurl .= "?CustomerID=" . $ewayCustomerID;
     $ewayurl .= "&UserName="******"&Amount=" . $ewayAmount;
     $ewayurl .= "&Currency=" . $ewayCurrency;
     $ewayurl .= "&PageTitle=" . $ewayPageTitle;
     $ewayurl .= "&PageDescription=" . $ewayPageDesc;
     $ewayurl .= "&PageFooter=" . $ewayfooter;
     $ewayurl .= "&Language=" . $ewayLanguage;
     $ewayurl .= "&CompanyName=" . $ewayCompanyName;
     $ewayurl .= "&CustomerFirstName=" . $ewayFirstName;
     $ewayurl .= "&CustomerLastName=" . $ewayLastName;
     $ewayurl .= "&CustomerAddress=" . $ewayCustomerAddress;
     $ewayurl .= "&CustomerCity=" . $ewayCustomerCity;
     $ewayurl .= "&CustomerState=" . $ewayCustomerState;
     $ewayurl .= "&CustomerPostCode=" . $ewayZipcode;
     $ewayurl .= "&CustomerCountry=" . $ewayCustomerCountry;
     $ewayurl .= "&CustomerEmail=" . $ewayEmail;
     $ewayurl .= "&CustomerPhone=" . $ewayCustomerPhone;
     $ewayurl .= "&InvoiceDescription=" . $desc;
     $ewayurl .= "&CancelURL=" . $ewayCancelURL;
     $ewayurl .= "&ReturnUrl=" . $ewayReturnUrl;
     $ewayurl .= "&CompanyLogo=" . $ewayLogourl;
     $ewayurl .= "&PageBanner=" . $ewayBanner;
     #$ewayurl.="&MerchantReference=".$new_order_id;
     $ewayurl .= "&MerchantReference=" . $order_id;
     #$ewayurl.="&MerchantOption1=";
     #$ewayurl.="&MerchantOption2=";
     #$ewayurl.="&MerchantOption3=";
     $ewayurl .= "&ModifiableCustomerDetails=" . $ewayModified;
     /*$ewayurl.="?CustomerID=87654321&UserName=TestAccount&Amount=10.20&Currency=NZD&PageTitle=Webpage Title&PageDescription=Customised Page Description - Add a unique custom message for the customer here.&PageFooter=Customised Page Footer - Add a unique footer useful for contact information.&Language=EN&CompanyName=Merchant Company Name&CustomerFirstName=John&CustomerLastName=Doe&CustomerAddress=123 ABC Street&CustomerCity=Auckland&CustomerState=State&CustomerPostCode=1010&CustomerCountry=New Zealand&CustomerEmail=sample@eway.co.nz&CustomerPhone=0800 896 210&InvoiceDescription=Individual Invoice Description&CancelURL=http://www.yoursite.com/MerchantResponse.aspx&ReturnUrl=http://www.yoursite.com/MerchantResponse.aspx&MerchantReference=513456&MerchantInvoice=Inv 21540&MerchantOption1=Option1&MerchantOption2=Option2&MerchantOption3=Option3&ModifiableCustomerDetails=false";
     		$spacereplace = str_replace(" ", "%20", $ewayurl);	*/
     $spacereplace = str_replace(" ", "%20", $ewayurl);
     $posturl = "https://nz.ewaygateway.com/Request/{$spacereplace}";
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $posturl);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_HEADER, 1);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
     if (CURL_PROXY_REQUIRED == 'True') {
         $proxy_tunnel_flag = defined('CURL_PROXY_TUNNEL_FLAG') && strtoupper(CURL_PROXY_TUNNEL_FLAG) == 'FALSE' ? false : true;
         curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, $proxy_tunnel_flag);
         curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
         curl_setopt($ch, CURLOPT_PROXY, CURL_PROXY_SERVER_DETAILS);
     }
     $response = curl_exec($ch);
     #print_r($response);
     $responsemode = $this->fetch_data($response, '<result>', '</result>');
     $responseurl = $this->fetch_data($response, '<uri>', '</uri>');
     if ($responsemode == "True") {
         return $responseurl;
     } else {
         return JURI::base() . "index.php";
     }
 }
Ejemplo n.º 26
0
 function sendWelcomeEmail($params)
 {
     $orderItem = oseObject::getValue($params, 'orderItem');
     $user_id = oseObject::getValue($params, 'user_id');
     $member = oseRegistry::call('member');
     $member->instance($user_id);
     $userInfo = $member->getBasicInfo('obj');
     $msc_id = $orderItem->entry_id;
     $emailConfig = oseRegistry::call('msc')->getConfig('email', 'obj');
     if ($emailConfig->cancelorder_email) {
         $emailTempDetail = $this->getDoc($ext->cancel_email, 'obj');
         $variables = $this->getEmailVariablesCancel($user_id, $msc_id);
         $emailParams = $this->buildEmailParams($emailTempDetail->type);
         $emailDetail = $this->transEmail($emailTempDetail, $variables, $emailParams);
         $this->sendEmail($emailDetail, $userInfo->email);
         $emailConfig = oseMscConfig::getConfig('email', 'obj');
         if ($emailConfig->sendCancel2Admin) {
             $this->sendToAdminGroup($emailDetail, $emailConfig->admin_group);
         }
     }
 }
Ejemplo n.º 27
0
 function GetPaypalForm($orderInfo, $params = array())
 {
     $order = $this->getInstance('Order');
     $pConfig = oseMscConfig::getConfig('payment', 'obj');
     if ($pConfig->paypal_mode == 'paypal_paypalpro') {
         $html = $order->PaypalAPIPostForm($orderInfo, $params);
     } else {
         $html = $order->PaypalExpPostForm($orderInfo, $params);
     }
     return $html;
 }
Ejemplo n.º 28
0
	static function getUser() {
		$params = JComponentHelper::getParams('com_users');
		$useractivation = $params->get('useractivation');
		$session = JFactory::getSession();
		$oseUser = $session->get('ose_user', array());
		$user = JFactory::getUser();
		if ($user->guest) {
			if ($useractivation == 1 || $useractivation == 2) {
				if (oseObject::getValue($oseUser, 'block', false) && oseObject::getValue($oseUser, 'activation', false)) {
					$user = JFactory::getUser(oseObject::getValue($oseUser, 'user_id', null));
				}
			} else {
				$memConfig = oseMscConfig::getConfig('register', 'obj');
				if (!$memConfig->auto_login) {
					$user = JFactory::getUser(oseObject::getValue($oseUser, 'user_id', null));
				}
			}
		}
		return $user;
	}
 function USAePayCreateProfile($orderInfo, $creditInfo, $params = array())
 {
     require_once OSEMSC_B_LIB . DS . 'usaepay.php';
     $tran = new umTransaction();
     $pConfig = oseMscConfig::getConfig('payment', 'obj');
     $source_key = $pConfig->usaepay_source_key;
     $testmode = $pConfig->usaepay_testmode;
     $sendReceipt = empty($pConfig->usaepay_sendReceipt) ? 'no' : 'yes';
     $payment = oseRegistry::call('payment');
     $paymentOrder = $payment->getInstance('Order');
     $billinginfo = $paymentOrder->getBillingInfo($orderInfo->user_id);
     $orderInfoParams = oseJson::decode($orderInfo->params);
     $redirectUrl = urldecode($orderInfoParams->returnUrl);
     $redirectUrl = $redirectUrl ? $redirectUrl : JURI::base() . "index.php?option=com_osemsc&view=member";
     $tran->key = $source_key;
     $tran->testmode = $testmode;
     $tran->usesandbox = $pConfig->usaepay_usesandbox;
     $tran->custreceipt = $sendReceipt;
     //Credit Card Info
     $tran->cardholder = $creditInfo['creditcard_name'];
     $tran->card = $creditInfo['creditcard_number'];
     $tran->cvv2 = $creditInfo['creditcard_cvv'];
     $tran->exp = $creditInfo['creditcard_month'] . substr($creditInfo['creditcard_year'], 2, 2);
     $tran->street = $billinginfo->addr1 . ' ' . $billinginfo->addr2;
     $tran->zip = $billinginfo->postcode;
     //Item Info
     $tran->currency = $this->transCurrency($orderInfo->payment_currency);
     // international currency, full list of codes: http://wiki.usaepay.com/developer/currencycode
     if (empty($tran->currency)) {
         $result['success'] = false;
         $result['title'] = 'Error';
         $result['content'] = 'Currency Error';
         return $result;
     }
     $tran->amount = $orderInfo->payment_price;
     $tran->billamount = $orderInfoParams->next_total;
     $tran->invoice = $orderInfo->order_number;
     $tran->description = self::generateDesc($orderInfo->order_id);
     $tran->command = 'sale';
     $tran->addcustomer = 'yes';
     $tran->schedule = $this->transUnit($orderInfoParams->t3);
     //billing Info
     $tran->billfname = $billinginfo->firstname;
     $tran->billlname = $billinginfo->lastname;
     $tran->billcompany = $billinginfo->company;
     $tran->billstreet = $billinginfo->addr1;
     $tran->billstreet2 = $billinginfo->addr2;
     $tran->billcity = $billinginfo->city;
     $tran->billstate = $billinginfo->state;
     $tran->billzip = $billinginfo->postcode;
     $tran->billcountry = $billinginfo->country;
     $tran->billphone = $billinginfo->telephone;
     $tran->email = $billinginfo->email;
     $result = array();
     if ($tran->Process()) {
         $paymentOrder->confirmOrder($orderInfo->order_id, array());
         $result['success'] = true;
         $result['title'] = JText::_('SUCCESSFUL_ACTIVATION');
         $result['content'] = JText::_('MEMBERSHIP_ACTIVATED_CONTINUE');
         $result['returnUrl'] = $redirectUrl;
     } else {
         $result['success'] = false;
         $result['title'] = $tran->result;
         $result['content'] = $tran->error;
         $result['returnUrl'] = JURI::base() . "index.php?option=com_osemsc&view=register";
     }
     return $result;
 }
Ejemplo n.º 30
0
	function cancelOrder()
	{
		$result = array();
		$result['success']= false;
		$result['title']= 'Error';
		$result['content']= 'Error';

		$db = oseDB::instance();

		$msc= oseRegistry :: call('msc');
		$member = oseRegistry::call('member');
		$email = oseRegistry::call('member')->getInstance('Email');
		$payment= oseRegistry :: call('payment');
		$paymentOrder= $payment->getInstance('Order');

		$my = JFactory::getUser();
		$user_id = $my->id;
		$member->instance($user_id);

		$order_id = JRequest::getInt('order_id',0);

		$member->instance($user_id);
		$memberships = $member->getMemberOwnedMscInfo(false,1,'obj');

		$query = " SELECT * FROM `#__osemsc_order`"
				." WHERE `user_id` = '{$user_id}' AND `order_status` = 'confirmed' AND `payment_mode`='a'"
				;

		$db->setQuery($query);
		$list = oseDB::loadList('obj');
		$order_ids = array();
		foreach($list as $oItem)
		{
			//$memParams = oseJson::decode($membership->params);
			$order_ids[$oItem->order_id] = $oItem->order_id;
		}

		if( !in_array( $order_id,$order_ids ) )
		{
			$result['success']= false;
			$result['title']= 'Error';
			$result['content']= JText :: _('Error No this authority: ').$order_id;
		}

		$where= array();
		$where[]= "`order_id` = ".$db->Quote($order_id);
		$order = $payment->getOrder($where, 'obj');

		//$result['success']= true;
		$result['payment_mode']= $order->payment_mode;
		$result['payment_method'] = $order->payment_method;

		//$msc_id = $order->entry_id;

		switch($order->payment_method)
		{
			case('paypal_cc') :
				if($order->payment_mode == 'a') {

					$config= oseMscConfig :: getConfig('payment', 'obj');

					$updated = $paymentOrder->PaypalAPIDeleteProfile($order->payment_serial_number, substr($order->order_number, 0, 20), $user_id);

					if ($updated['success']==true)
					{
						$email->sendCancelOrderEmail(array('orderInfo'=>$order));
						$result['success']= true;
						$result['title']= JText :: _('SUB_PLAN_CANCEL_SUCCESSFULLY_TITLE');
						$result['content']= JText :: _('SUB_PLAN_CANCEL_SUCCESSFULLY');
					}
					else
					{
						$result['success']= false;
						$result['title']= 'Error';
						$result['content']= JText :: _('ERROR_CANCELLING_SUB_PLAN').' '.urldecode($order->payment_serial_number). "<br />".JText::_(' Error response from server: '). urldecode($updated['text']);
					}
				}
			break;

			case('paypal') :
				if($order->payment_mode == 'a') {

					$config= oseMscConfig :: getConfig('payment', 'obj');

					if($config->paypal_mode == 'paypal_express')
					{
						$test_mode= $config->paypal_testmode;
						$paypal_email = $config->paypal_email;
						if($test_mode == true)
						{
							$url= "https://www.sandbox.paypal.com/cgi-bin/webscr";
						} else {
							$url= "https://www.paypal.com/cgi-bin/webscr";
						}
						$url = $url.'?cmd=_subscr-find&alias='.$paypal_email;

						$result['success']= true;
						$result['payment_method'] = 'paypal';
						$result['paypal']= 'ipn';
						$result['url']= $url;
						return $result;
					}
					else
					{
						//$result['payment_method'] = 'paypal_pro';
						$updated= $paymentOrder->PaypalAPIDeleteProfile($order->payment_serial_number, substr($order->order_number, 0, 20), $user_id);
						if ($updated['success']==true)
						{
							$paymentOrder->updateOrder($order->order_id,'cancelled');
							$email->sendCancelOrderEmail(array('orderInfo'=>$order));
							$result['success']= true;
							$result['title']= JText :: _('SUB_PLAN_CANCEL_SUCCESSFULLY_TITLE');
							$result['content']= JText :: _('SUB_PLAN_CANCEL_SUCCESSFULLY');
						}
						else
						{
							$result['success']= false;
							$result['title']= 'Error';
							$result['content']= JText :: _('ERROR_CANCELLING_SUB_PLAN').' '.urldecode($order->payment_serial_number). "<br />".JText::_(' Error response from server: '). urldecode($updated['text']);
						}

					}
				}
				break;

			case('authorize') :
				if($order->payment_mode == 'a') {
					$updated= $paymentOrder->AuthorizeARBDeleteProfile($order->payment_serial_number, substr($order->order_number, 0, 20), $user_id);
					if ($updated['success']==true)
					{
						$email->sendCancelOrderEmail(array('orderInfo'=>$order));

						$result['success']= true;
						$result['title']= JText :: _('SUB_PLAN_CANCEL_SUCCESSFULLY_TITLE');
						$result['content']= JText :: _('SUB_PLAN_CANCEL_SUCCESSFULLY');
					}
					else
					{
						$result['success']= false;
						$result['title']= 'Error';

						if (strpos($order->payment_serial_number, "_")>0)
						{
							$tmpUID = explode("_", $order->payment_serial_number);
							if ($tmpUID[0] == $order->user_id)
							{
								$result['content']= JText :: _('CREDIT_CARD_EXPIRE_BEFORE_SUB_ENDS');
							}
							else
							{
								$result['content']= JText :: _('ERROR_CANCELLING_SUB_PLAN').' '.urldecode($order->payment_serial_number);
							}
						}
						else
						{
							$result['content']= $updated['text'];
						}
					}
				}
				break;

			case('eway'):
				if($order->payment_mode == 'a') {
					$updated= $paymentOrder->eWayDeleteProfile($order);
					if ($updated['success']==true)
					{
						$email->sendCancelOrderEmail(array('orderInfo'=>$order));

						$result['success']= true;
						$result['title']= JText :: _('SUB_PLAN_CANCEL_SUCCESSFULLY_TITLE');
						$result['content']= JText :: _('SUB_PLAN_CANCEL_SUCCESSFULLY');
					}
					else
					{
						$result['success']= false;
						$result['title']= 'Error';
						$result['content']= $updated['text'];//JText :: _('Error cancelling subscription plan! Please contact the web administrator and quote this profile ID: ').urldecode($order->payment_serial_number);
					}
				}
				break;

			case('beanstream') :
				if($order->payment_mode == 'a') {
					$updated= $paymentOrder->BeanStreamDeleteProfile($order);
					if ($updated['success']==true)
					{
						$email->sendCancelOrderEmail(array('orderInfo'=>$order));

						$result['success']= true;
						$result['title']= JText :: _('SUB_PLAN_CANCEL_SUCCESSFULLY_TITLE');
						$result['content']= JText :: _('SUB_PLAN_CANCEL_SUCCESSFULLY');
					}
					else
					{
						$result['success']= false;
						$result['title']= 'Error';
						$result['content']= $updated['text'];//JText :: _('Error cancelling subscription plan! Please contact the web administrator and quote this profile ID: ').urldecode($order->payment_serial_number);
					}
				}
				break;
			case('epay') :
				if($order->payment_mode == 'a') {
					require_once(OSEMSC_B_PATH.DS.'libraries'.DS.'epaysoap.php');
					$epay = new EpaySoap();
					$config = oseMscConfig::getConfig('payment','obj');
					$merchantnumber = $config->epay_merchantnumber;
					$subscriptionid = $order->payment_serial_number;
					$updated= $epay->deleteSubscription($merchantnumber, $subscriptionid);
					if($updated['deletesubscriptionResult'] == true && $result['epayresponse'] == '-1')

					//$updated= $paymentOrder->BeanStreamDeleteProfile($order);
					//if ($updated['success']==true)
					{
						$email->sendCancelOrderEmail(array('orderInfo'=>$order));

						$result['success']= true;
						$result['title']= JText :: _('SUB_PLAN_CANCEL_SUCCESSFULLY_TITLE');
						$result['content']= JText :: _('SUB_PLAN_CANCEL_SUCCESSFULLY');
					}
					else
					{
						$result['success']= false;
						$result['title']= 'Error';
						$result['content']= $updated['text'];//JText :: _('Error cancelling subscription plan! Please contact the web administrator and quote this profile ID: ').urldecode($order->payment_serial_number);
					}
				}
				break;
				
			case('2co') :
				if($order->payment_mode == 'a') {	
					$updated= $paymentOrder->twoCheckoutDeleteProfile($order);
					if ($updated['success']==true)
					{
						$email->sendCancelOrderEmail(array('orderInfo'=>$order));

						$result['success']= true;
						$result['title']= JText :: _('SUB_PLAN_CANCEL_SUCCESSFULLY_TITLE');
						$result['content']= JText :: _('SUB_PLAN_CANCEL_SUCCESSFULLY');
					}
					else
					{
						$result['success']= false;
						$result['title']= 'Error';
						$result['content']= $updated['text'];//JText :: _('Error cancelling subscription plan! Please contact the web administrator and quote this profile ID: ').urldecode($order->payment_serial_number);
					}
				}
			break;	
			default :
				$orderItems = $paymentOrder->getOrderItems($order->order_id,'obj');
				foreach($orderItems as $key=>$orderItem)
				{
					if($orderItem->entry_type == 'msc')
					{
						$msc_id = $orderItem->entry_id;

						$params= oseRegistry :: call('member')->getAddonParams($msc_id, $user_id, $order_id);
						$updated= $msc->runAddonAction('member.msc.cancelMsc', $params);
						if(!$updated['success']) {
							return $updated;
						}
					}
				}

				break;
		}

		if ($result['success']==true)
		{
			$orderItems = $paymentOrder->getOrderItems($order->order_id,'obj');
			foreach($orderItems as $key=>$orderItem)
			{
				if($orderItem->entry_type == 'msc')
				{
					$msc_id = $orderItem->entry_id;

					$arr = array('allow_work'=>true,'msc_id'=>$msc_id,'member_id'=>$user_id,'master'=>true);
					oseMscAddon::runAction('join.history.manualCancelOrder', $arr);
				}
			}

	    	$paymentOrder->updateOrder($order_id, 'cancelled', $params= array('payment_mode'=>'a'));
	    	//$paymentOrder->updateMembership($msc_id, $user_id, $order_id, 'm');
		}
		return $result;
	}