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); }
public static function processPayment($payment_method, $orderInfo, $post) { $switch = 1; if ($switch == 2) { // Testing Purpose; please do not delete; //$payment= oseRegistry :: call('payment'); //$gateway = $payment->getGateWay($payment_method); } $order_id = $orderInfo->order_id; $payment = oseRegistry::call('payment'); $config = oseRegistry::call('msc')->getConfig('', 'obj'); //check payment method $db = oseDB::instance(); $query = "SELECT entry_id FROM `#__osemsc_order_item` WHERE `order_id` = " . $order_id; $db->setQuery($query); $msc_id = $db->loadResult(); $query = "SELECT * FROM `#__osemsc_ext` WHERE `id` = '{$msc_id}' AND `type` = 'hidepayment'"; $db->setQuery($query); $data = $db->loadObject(); if (!empty($data->params)) { $data = oseJson::decode($data->params); if (!empty($data->enable) && !empty($data->value)) { $values = explode(",", $data->value); if (in_array($payment_method, $values)) { $result['success'] = false; $result['title'] = JText::_('ERROR'); $result['content'] = $payment_method . ' ' . JText::_('CAN_NOT_USE_ON_THIS_MEMBERSIHP'); $result['reload'] = ($config->error_registration == 'refresh') ? true : false; return $result; } } } $creditInfo = array(); if (isset($post['creditcard_number'])) { $creditInfo['creditcard_type'] = $post['creditcard_type']; $creditInfo['creditcard_name'] = $post['creditcard_name']; $creditInfo['creditcard_owner'] = $creditInfo['creditcard_name']; $creditInfo['creditcard_number'] = $post['creditcard_number']; $creditInfo['creditcard_year'] = $post['creditcard_year']; $creditInfo['creditcard_month'] = $post['creditcard_month']; $creditInfo['creditcard_expirationdate'] = $post['creditcard_year'] . '-' . $post['creditcard_month']; $creditInfo['creditcard_cvv'] = $post['creditcard_cvv']; } switch ($payment_method) { case ('authorize'): if (!$config->enable_authorize) { return false; } $updated = $payment->processCCForm($orderInfo, $creditInfo, 'authorize'); if ($updated['success']) { $updated['success'] = true; $updated['title'] = JText::_('SUCCESSFUL_ACTIVATION'); $updated['content'] = JText::_('MEMBERSHIP_ACTIVATED_CONTINUE'); $updated['payment_method'] = 'authorize'; } $updated['reload'] = ($config->error_registration == 'refresh') ? true : false; return $updated; break; case ('paypal_cc'): $expiration = $post['creditcard_year'] . '-' . $post['creditcard_month']; $creditInfo['creditcard_expirationdate'] = $expiration; $updated = $payment->processCCForm($orderInfo, $creditInfo, 'paypal_cc'); $updated['payment_method'] = 'paypal_cc'; if (JFile::exists(JPATH_SITE . DS . 'modules' . DS . 'mod_ose_gag' . DS . 'helper.php')) { require_once(JPATH_SITE . DS . 'modules' . DS . 'mod_ose_gag' . DS . 'helper.php'); $mod = JModuleHelper::getModule('ose_gag'); if (JOOMLA16) { $modParams = new JRegistry; $modParams->loadJSON($mod->params); } else { $modParams = new JParameter($mod->params); } $db = oseDB::instance(); $where = array('`order_id`=' . $db->Quote($orderInfo->order_id)); $code = osegagHelper::getOrderCode($modParams->get('account'), $where); $code = explode("\r\n", $code); array_shift($code); array_pop($code); if (empty($code)) { $code = false; } else { $code = implode("", $code); } $updated['code'] = $code; } if (class_exists('plgSystemoseMscGoogleAnalytics')) { $config = oseMscConfig::getConfig('thirdparty', 'obj'); $account = $config->gag_account; $code = oseMscPublic::ajaxOrderTrack($account, $order_id); if (empty($code)) { $code = false; } else { $code = implode("", $code); } $updated['code'] = $code; } $updated['reload'] = ($config->error_registration == 'refresh') ? true : false; return $updated; break; case ('paypal'): $html = $payment->getPaypalForm($orderInfo); $result = array(); $result['success'] = true; $result['html'] = $html; $result['payment_method'] = 'paypal'; $result['reload'] = ($config->error_registration == 'refresh') ? true : false; return $result; break; case ('eway'): $expiration = $post['creditcard_year'] . '-' . $post['creditcard_month']; $creditInfo['creditcard_expirationdate'] = $expiration; $updated = $payment->processCCForm($orderInfo, $creditInfo, 'eway'); $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); } if (!empty($code) && !empty($htmlTrack)) { $updated['code'] = $code; $updated['htmlTrack'] = $htmlTrack; } if ($updated['success']) { $updated['success'] = true; $updated['title'] = JText::_('SUCCESSFUL_ACTIVATION'); $updated['content'] = JText::_('MEMBERSHIP_ACTIVATED_CONTINUE'); $updated['payment_method'] = 'eway'; } $updated['reload'] = ($config->error_registration == 'refresh') ? true : false; return $updated; break; case ('epay'): if ($orderInfo->payment_mode == 'a') { $html = $payment->getInstance('Order')->ePayCreateProfile($orderInfo); if (!$html) { $result['success'] = false; $result['title'] = 'Epay Free Trial Banned'; $result['payment_method'] = 'It does not support free trial subscription yet. If it still has problem, please contact the webmaster!'; $result['reload'] = ($config->error_registration == 'refresh') ? true : false; return $result; } } else { $html = $payment->getInstance('Order')->ePayOneOffPay($orderInfo); } $result = array(); $result['success'] = true; $result['html'] = $html; $result['payment_method'] = 'epay'; return $result; break; case ('pnw'): if ($orderInfo->payment_mode == 'a') { $result['success'] = false; $result['title'] = 'Payment Network Error'; $result['payment_method'] = 'It does not support subscription.'; $result['reload'] = ($config->error_registration == 'refresh') ? true : false; return $result; } else { $html = $payment->getInstance('Order')->PNWOneOffPay($orderInfo); } $result = array(); $result['success'] = true; $result['html'] = $html; $result['payment_method'] = $payment_method; return $result; break; case ('beanstream'): $updated = $payment->processCCForm($orderInfo, $creditInfo, 'beanstream'); $updated['reload'] = ($config->error_registration == 'refresh') ? true : false; $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); } if (!empty($code) && !empty($htmlTrack)) { $updated['code'] = $code; $updated['htmlTrack'] = $htmlTrack; } return $updated; break; case ('vpcash_cc'): case ('vpcash'): if ($orderInfo->payment_mode == 'a') { $result['success'] = false; $result['title'] = 'VirtualPayCash Error'; $result['payment_method'] = 'It does not support subscription.'; $result['reload'] = ($config->error_registration == 'refresh') ? true : false; } else { $html = $payment->getInstance('Order')->VpcashOneOffPostForm($orderInfo, $payment_method); $result = array(); $result['success'] = true; $result['html'] = $html; $result['payment_mode'] = $orderInfo->payment_mode; $result['payment_method'] = $payment_method; } return $result; break; case ('bbva'): if ($orderInfo->payment_mode == 'a') { $result['success'] = false; $result['title'] = 'BBVA Error'; $result['payment_method'] = 'It does not support subscription.'; $result['reload'] = ($config->error_registration == 'refresh') ? true : false; } else { $html = $payment->getInstance('Order')->BBVAOneOffPostForm($orderInfo); $result = array(); $result['success'] = true; $result['html'] = $html; $result['payment_mode'] = $orderInfo->payment_mode; $result['payment_method'] = $payment_method; } return $result; break; case ('payfast'): if ($orderInfo->payment_mode == 'a') { $result['success'] = false; $result['title'] = 'Payfast Error'; $result['payment_method'] = 'It does not support subscription.'; $result['reload'] = ($config->error_registration == 'refresh') ? true : false; } else { $html = $payment->getInstance('Order')->PayFastOneOffPostForm($orderInfo); $result = array(); $result['success'] = true; $result['html'] = $html; $result['payment_mode'] = $orderInfo->payment_mode; $result['payment_method'] = $payment_method; } return $result; break; case ('gco'): if ($orderInfo->payment_mode == 'a') { $html = $payment->getInstance('Order')->GcoRecurringPostForm($orderInfo); $result = array(); $result['success'] = true; $result['html'] = $html; $result['payment_mode'] = $orderInfo->payment_mode; $result['payment_method'] = $payment_method; } else { $html = $payment->getInstance('Order')->GcoOneOffPostForm($orderInfo); $result = array(); $result['success'] = true; $result['html'] = $html; $result['payment_mode'] = $orderInfo->payment_mode; $result['payment_method'] = $payment_method; } return $result; break; case ('ewaysh'): if ($orderInfo->payment_mode == 'a') { $result['success'] = false; $result['title'] = 'Error'; $result['payment_method'] = 'It does not support subscription.'; $result['reload'] = ($config->error_registration == 'refresh') ? true : false; } else { $html = $payment->getInstance('Order')->eWaySharedHostingPostForm($orderInfo); $result = array(); $result['success'] = true; $result['html'] = $html; $result['payment_mode'] = $orderInfo->payment_mode; $result['payment_method'] = $payment_method; } return $result; break; case ('2co'): $html = $payment->get2COForm($orderInfo); $result = array(); $result['success'] = true; $result['html'] = $html; $result['payment_method'] = $payment_method; return $result; break; case ('poffline'): //send Pay 0fline notification email $member = oseRegistry::call('member'); $email = $member->getInstance('email'); $emailConfig = oseMscConfig::getConfig('email', 'obj'); $emailTempDetail = $email->getDoc($emailConfig->pay_offline_email, 'obj'); if (!empty($emailTempDetail)) { $juser = new JUser($orderInfo->user_id); $variables = $email->getEmailVariablesReceipt($order_id); $emailParams = $email->buildEmailParams($emailTempDetail->type); $emailDetail = $email->transEmail($emailTempDetail, $variables, $emailParams); $email->sendEmail($emailDetail, $juser->get('email')); if ($emailConfig->sendPayOffline2Admin) { $email->sendToAdminGroup($emailDetail, $emailConfig->admin_group); } } $result['payment_method'] = 'poffline'; $user = JFactory::getUser(); $params = JComponentHelper::getParams('com_users'); $useractivation = $params->get('useractivation'); if (($useractivation == 2 || $useractivation == 1) && $user->guest) { $result['title'] = JText::_('SUCCESSFUL_ACTIVATION'); $result['content'] = JText::_('MEMBERSHIP_PAYOFFLINE_CONTINUE'); } if (!empty($config->poffline_art_id)) { $link = JURI::root() . "index.php?option=com_content&view=article&id={$config->poffline_art_id}"; } else { $link = JURI::root() . "index.php"; } $result['success'] = true; $result['returnUrl'] = $link; $result['payment_method'] = $payment_method; return $result; break; case ('cp'): if ($orderInfo->payment_mode == 'a') { $result['success'] = false; $result['title'] = 'Error'; $result['payment_method'] = 'It does not support subscription.'; $result['reload'] = ($config->error_registration == 'refresh') ? true : false; } else { $html = $payment->getInstance('Order')->CPoneOffPostForm($orderInfo, $creditInfo); $result = array(); $result['success'] = true; $result['html'] = $html; $result['payment_mode'] = $orderInfo->payment_mode; $result['payment_method'] = $payment_method; } return $result; break; case ('clickbank'): $html = $payment->getInstance('Order')->getClickBankForm($orderInfo); $result = array(); $result['success'] = true; $result['html'] = $html; $result['payment_method'] = $payment_method; return $result; break; case ('ccavenue'): if ($orderInfo->payment_mode == 'a') { $result['success'] = false; $result['title'] = 'CCAvenue Error'; $result['payment_method'] = 'It does not support subscription.'; $result['reload'] = ($config->error_registration == 'refresh') ? true : false; } else { $html = $payment->getInstance('Order')->CCAvenueOneOffPostForm($orderInfo); $result = array(); $result['success'] = true; $result['html'] = $html; $result['payment_mode'] = $orderInfo->payment_mode; $result['payment_method'] = $payment_method; } return $result; break; case ('usaepay'): if ($orderInfo->payment_mode == 'a') { $update = array(); $updated['success'] = false; $updated['title'] = 'Error'; $updated['content'] = 'It does not support subscription.'; $updated['reload'] = ($config->error_registration == 'refresh') ? true : false; } else { $updated = $payment->getInstance('Order')->processUSAePayForm($orderInfo, $creditInfo); $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); } if (!empty($code) && !empty($htmlTrack)) { $updated['code'] = $code; $updated['htmlTrack'] = $htmlTrack; } } return $updated; break; case ('icepay'): if ($orderInfo->payment_mode == 'a') { $result = array(); $result['success'] = false; $result['title'] = 'Error'; $result['content'] = 'It does not support subscription.'; $result['reload'] = ($config->error_registration == 'refresh') ? true : false; } else { $html = $payment->getInstance('Order')->ICEPAYOffPostForm($orderInfo); $result = array(); $result['success'] = true; $result['html'] = $html; $result['payment_mode'] = $orderInfo->payment_mode; $result['payment_method'] = $payment_method; } return $result; break; case ('oospay'): if ($orderInfo->payment_mode == 'a') { $result = array(); $result['success'] = false; $result['title'] = 'Error'; $result['content'] = 'It does not support subscription.'; $result['reload'] = ($config->error_registration == 'refresh') ? true : false; } else { $html = $payment->getInstance('Order')->OOSPayOneOffPay($orderInfo); $result = array(); $result['success'] = true; $result['html'] = $html; $result['payment_mode'] = $orderInfo->payment_mode; $result['payment_method'] = $payment_method; } return $result; break; case ('ebs'): if ($orderInfo->payment_mode == 'a') { $result = array(); $result['success'] = false; $result['title'] = 'Error'; $result['content'] = 'It does not support subscription.'; $result['reload'] = ($config->error_registration == 'refresh') ? true : false; } else { $html = $payment->getInstance('Order')->EBSOneOffPay($orderInfo); $result = array(); $result['success'] = true; $result['html'] = $html; $result['payment_mode'] = $orderInfo->payment_mode; $result['payment_method'] = $payment_method; } return $result; break; case ('liqpay'): if ($orderInfo->payment_mode == 'a') { $result['success'] = false; $result['title'] = 'Error'; $result['payment_method'] = 'It does not support subscription.'; $result['reload'] = ($config->error_registration == 'refresh') ? true : false; } else { $html = $payment->getInstance('Order')->LiqPayOneOffPay($orderInfo); $result = array(); $result['success'] = true; $result['html'] = $html; $result['payment_mode'] = $orderInfo->payment_mode; $result['payment_method'] = $payment_method; } return $result; break; case ('virtualmerchant'): if ($orderInfo->payment_mode == 'a') { $update = array(); $updated['success'] = false; $updated['title'] = 'Error'; $updated['content'] = 'It does not support subscription.'; $updated['reload'] = ($config->error_registration == 'refresh') ? true : false; } else { $updated = $payment->getInstance('Order')->VirtualMerchantOneOffPay($orderInfo, $creditInfo); } return $updated; break; case ('realex_remote'): case ('realex_redirect'): if ($orderInfo->payment_mode == 'a') { $update = array(); $updated['success'] = false; $updated['title'] = 'Error'; $updated['content'] = 'It does not support subscription.'; $updated['reload'] = ($config->error_registration == 'refresh') ? true : false; } else { $updated = $payment->getInstance('Order')->RealexOneOffPay($orderInfo, $creditInfo); $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); } if (!empty($code) && !empty($htmlTrack)) { $updated['code'] = $code; $updated['htmlTrack'] = $htmlTrack; } } return $updated; break; case ('sisow'): $result = array(); if ($orderInfo->payment_mode == 'a') { $result['success'] = false; $result['title'] = 'Error'; $result['content'] = 'It does not support subscription.'; $result['payment_method'] = $payment_method; } else { $result = $payment->getInstance('Order')->SisowPostForm($orderInfo); } return $result; break; case ('pagseguro'): if ($orderInfo->payment_mode == 'a') { $result['success'] = false; $result['title'] = 'Error'; $result['content'] = 'It does not support subscription.'; $result['payment_method'] = $payment_method; } else { $result = $payment->getInstance('Order')->PagSeguroOneOffPay($orderInfo); } return $result; break; case ('paygate'): if ($orderInfo->payment_mode == 'a') { $result['success'] = false; $result['title'] = 'Error'; $result['payment_method'] = 'It does not support subscription.'; $result['reload'] = ($config->error_registration == 'refresh') ? true : false; } else { $html = $payment->getInstance('Order')->PayGateOneOffPay($orderInfo); $result = array(); $result['success'] = true; $result['html'] = $html; $result['payment_mode'] = $orderInfo->payment_mode; $result['payment_method'] = $payment_method; } return $result; break; case ('quickpay'): if ($orderInfo->payment_mode == 'a') { $result['success'] = false; $result['title'] = 'Error'; $result['payment_method'] = 'It does not support subscription.'; $result['reload'] = ($config->error_registration == 'refresh') ? true : false; } else { $html = $payment->getInstance('Order')->QuickpayOneOffPay($orderInfo); $result = array(); $result['success'] = true; $result['html'] = $html; $result['payment_mode'] = $orderInfo->payment_mode; $result['payment_method'] = $payment_method; } return $result; break; case ('sagepay'): if ($orderInfo->payment_mode == 'a') { $result['success'] = false; $result['title'] = 'Error'; $result['payment_method'] = 'It does not support subscription.'; $result['reload'] = ($config->error_registration == 'refresh') ? true : false; } else { $html = $payment->getInstance('Order')->sagepayOneOffPay($orderInfo); $result = array(); $result['success'] = true; $result['html'] = $html; $result['payment_mode'] = $orderInfo->payment_mode; $result['payment_method'] = $payment_method; } return $result; break; case ('alipay'): if ($orderInfo->payment_mode == 'a') { $result['success'] = false; $result['title'] = 'Error'; $result['payment_method'] = 'It does not support subscription.'; $result['reload'] = ($config->error_registration == 'refresh') ? true : false; } else { $html = $payment->getInstance('Order')->AlipayOneOffPay($orderInfo); $result = array(); $result['success'] = true; $result['html'] = $html; $result['payment_mode'] = $orderInfo->payment_mode; $result['payment_method'] = $payment_method; } return $result; break; default: $result = array(); $orderParams = oseJSON::decode($orderInfo->params); if ($orderParams->total == "0.00" && $orderParams->next_total == "0.00") { $result['success'] = true; $result['title'] = JText::_('SUCCESSFUL_ACTIVATION'); $result['content'] = JText::_('MEMBERSHIP_ACTIVATED_CONTINUE'); $result['payment_method'] = 'none'; } else { $result['success'] = false; $result['title'] = 'Error'; $result['content'] = JText::_('No Payment Method'); $result['payment_method'] = 'none'; $result['reload'] = ($config->error_registration == 'refresh') ? true : false; } return $result; break; } return $result; }