function getThankPayment() { $app = JFactory::getApplication(); $oid = $app->input->get('oid', 0, 'int'); $buy = $app->input->get('buy', '', 'string'); //either buy deposit or plan $db = JFactory::getDbo(); $obj = new stdClass(); if ($buy == 'plan') { $row = JTable::getInstance('plansubscr', 'Table'); $row->load($oid); $query = "SELECT * FROM #__jblance_plan WHERE id = " . $db->quote($row->plan_id); $db->setQuery($query); $plan = $db->loadObject(); $obj->itemName = JText::_('COM_JBLANCE_BUY_SUBSCR') . ' - ' . $plan->name; $obj->invoiceNo = $row->invoiceNo; $obj->status = $row->approved; $obj->amount = (double) ($row->price + $row->price * ($row->tax_percent / 100)); $obj->gateway = JblanceHelper::getPaymodeInfo($row->gateway)->gateway_name; $obj->lnk_continue = JRoute::_('index.php?option=com_jblance&view=membership&layout=planhistory', false); $obj->lnk_invoice = JRoute::_('index.php?option=com_jblance&view=membership&layout=invoice&id=' . $row->id . '&tmpl=component&print=1&type=plan'); } elseif ($buy == 'deposit') { $row = JTable::getInstance('deposit', 'Table'); $row->load($oid); $obj->itemName = JText::_('COM_JBLANCE_DEPOSIT_FUNDS'); $obj->invoiceNo = $row->invoiceNo; $obj->status = $row->approved; $obj->amount = $row->total; $obj->gateway = JblanceHelper::getPaymodeInfo($row->gateway)->gateway_name; $obj->lnk_continue = JRoute::_('index.php?option=com_jblance&view=membership&layout=managepay', false); $obj->lnk_invoice = JRoute::_('index.php?option=com_jblance&view=membership&layout=invoice&id=' . $row->id . '&tmpl=component&print=1&type=deposit'); } $return[0] = $obj; return $return; }
echo JText::_('COM_JBLANCE_TOTAL'); ?> </th> </tr> </thead> <tr> <td><?php echo $this->plan->name; ?> </td> <td><?php echo $this->subscr->invoiceNo; ?> </td> <td><?php echo JblanceHelper::getPaymodeInfo($this->subscr->gateway)->gateway_name; ?> </td> <td><?php echo $this->plan->days . ' ' . getDaysType($this->plan->days_type); ?> </td> <td class="text-right"><?php echo JblanceHelper::formatCurrency($this->subscr->fund, false); ?> </td> <td class="text-right"><?php echo JblanceHelper::formatCurrency($this->subscr->price, false); ?> </td> </tr>
function returnAfterPayment() { // Check for request forgeries //JSession::checkToken('request') or jexit(JText::_('JINVALID_TOKEN')); // token cannot be check as return data will be different for different gateways make impossible. $app = JFactory::getApplication(); $rawDataPost = $app->input->post->getArray(); $rawDataGet = $app->input->get->getArray(); $data = array_merge($rawDataGet, $rawDataPost); $gwayName = $app->input->get('gateway', '', 'string'); $isValid = false; if (!empty($gwayName)) { $payconfig = JblanceHelper::getPaymodeInfo($gwayName); //get the payment config of the gateway require_once JPATH_SITE . '/components/com_jblance/gateways/class.' . $gwayName . '.php'; $className = $gwayName . '_class'; if (class_exists($className)) { $object = new $className($payconfig, null); $functionName = $gwayName . 'Return'; $result = $object->{$functionName}($data); //call the payment function to submit the form $isValid = $result['success']; if ($isValid) { $invoice_num = $result['invoice_num']; // based on the invoice number, identify if it is deposit or plan if ($invoice_num) { $result = JblanceHelper::identifyDepositOrPlan($invoice_num); //if invoice number is not found if ($result) { if ($result['type'] == 'plan') { $row = JblanceHelper::approveSubscription($result['id']); } elseif ($result['type'] == 'deposit') { $row = JblanceHelper::approveFundDeposit($result['id']); } //set the result type and id for redirection $app->input->set('buy', $result['type']); $app->input->set('oid', $result['id']); } else { $isValid = false; $data['jblance_failure_reason'] = JText::_('COM_JBLANCE_INVOICE_NUMBER_NOT_FOUND_PLAN_DEPOSIT_RECORDS'); } } else { $isValid = false; $data['jblance_failure_reason'] = JText::_('COM_JBLANCE_INVOICE_NUMBER_EMPTY_OR_INVALID'); } $oid = $app->input->get('oid', 0, 'int'); $buy = $app->input->get('buy', '', 'string'); //either buy deposit or plan } else { $data['jblance_failure_reason'] = JText::_('COM_JBLANCE_PAYMENT_VERIFICATION_FAILED'); } if ($isValid) { $msg = JText::sprintf('COM_JBLANCE_PAYMENT_SUCCESSFUL', ucfirst($gwayName)); $link = JRoute::_('index.php?option=com_jblance&view=membership&layout=thankpayment&oid=' . $oid . '&buy=' . $buy, false); } else { $msg = JText::_('COM_JBLANCE_PAYMENT_ERROR') . ' : ' . $data['jblance_failure_reason']; $link = JRoute::_('index.php?option=com_jblance&view=membership&layout=thankpayment&type=cancel', false); } $this->setRedirect($link, $msg); } //end of class name } //end of gateway }
* @author : Faisel * @description : Withdraw Fund Form (jblance) */ defined('_JEXEC') or die('Restricted access'); JHtml::_('jquery.framework'); JHtml::_('behavior.formvalidator'); $app = JFactory::getApplication(); $user = JFactory::getUser(); $config = JblanceHelper::getConfig(); $currencysym = $config->currencySymbol; $minWithdraw = $config->withdrawMin; $totalFund = JblanceHelper::getTotalFund($user->id); $step = $app->input->get('step', '1', 'int'); $gateway = $app->input->get('gateway', '', 'string'); if ($gateway) { $gwInfo = JblanceHelper::getPaymodeInfo($gateway); } ?> <script type="text/javascript"> <!-- function validateForm(f){ var valid = document.formvalidator.isValid(f); var minWithdraw = parseInt('<?php echo $minWithdraw; ?> '); if(jQuery("#amount").val() < minWithdraw){ alert('<?php echo JText::sprintf('COM_JBLANCE_MINIMUM_WITHDRAW_AMOUNT_IS', JblanceHelper::formatCurrency($minWithdraw), array('jsSafe' => true)); ?>