public function Settings() { $db = JFactory::getDBO(); $settings = array(); if (!empty($_POST['type']) && !empty($_POST['id']) && empty($_POST['edit'])) { $db = JFactory::getDBO(); $settings['edit'] = array('hidden', 1); $settings['type'] = array('hidden', $_POST['type']); $fixed = array(); switch ($_POST['type']) { case 'metauser': $fixed = array('userid'); $object = new metaUserDB(); $s = AECToolbox::searchUser($_POST['id']); if (!empty($s)) { $_POST['id'] = $object->getIDbyUserid($s[0]); } else { $_POST['id'] = $object->getIDbyUserid((int) $_POST['id']); } break; case 'processor': if (!is_numeric($_POST['id'])) { $query = 'SELECT `id`' . ' FROM #__acctexp_config_processors' . ' WHERE `name` = \'' . (int) $_POST['id'] . '\''; $db->setQuery($query); $_POST['id'] = $db->loadResult(); } $object = new processor(); break; case 'invoice': if (!is_numeric($_POST['id'])) { $_POST['id'] = aecInvoiceHelper::InvoiceIDfromNumber($_POST['id']); } $object = new Invoice(); break; } $object->load($_POST['id']); $vars = get_object_vars($object); $encoded = $object->declareParamFields(); foreach ($vars as $k => $v) { if (is_null($k)) { $k = ""; } if ($k == 'id') { $settings['id'] = array('hidden', $v); } elseif (in_array($k, $fixed)) { $settings[$k] = array('p', $k, $k, $v); } elseif (in_array($k, $encoded)) { $v = jsoonHandler::encode($v); if ($v === "null") { $v = ""; } $settings[$k] = array('inputD', $k, $k, $v); } elseif (strpos($k, '_') !== 0) { $settings[$k] = array('inputD', $k, $k, $v); } } } else { $settings['type'] = array('list', 'Item Type', 'The type of Item you want to edit'); $settings['id'] = array('inputC', 'Item ID', 'Identification for your Item'); $types = array('metauser' => 'MetaUser Information', 'processor' => 'Payment Processor', 'invoice' => 'Invoice'); $typelist = array(); foreach ($types as $type => $typename) { $typelist[] = JHTML::_('select.option', $type, $typename); } $settings['lists']['type'] = JHTML::_('select.genericlist', $typelist, 'type', 'size="3"', 'value', 'text', array()); } return $settings; }
public function touchInvoice($invoice_number = false, $storenew = false, $anystatus = false) { // Checking whether we are trying to repeat an invoice if (!empty($invoice_number)) { // Make sure the invoice really exists and that its the correct user carrying out this action if (aecInvoiceHelper::InvoiceIDfromNumber($invoice_number, $this->userid, $anystatus)) { $this->invoice_number = $invoice_number; } } $recurring = null; if (!empty($this->invoice_number)) { if ($this->loadInvoice() === false) { $recurring = $this->createInvoice($storenew); } } else { $recurring = $this->createInvoice($storenew); } if (is_null($recurring)) { $recurring = aecGetParam('recurring', null); } if (isset($this->userMIParams)) { if (empty($this->invoice->params['userMIParams'])) { $this->invoice->params['userMIParams'] = array(); } foreach ($this->userMIParams as $planid => $mis) { foreach ($mis as $miid => $content) { foreach ($content as $k => $v) { $this->invoice->params['userMIParams'][$planid][$miid][$k] = $v; } } } $this->invoice->storeload(); } if (isset($this->invoice->params['userselect_recurring'])) { $this->recurring = $this->invoice->params['userselect_recurring']; } elseif (!is_null($recurring)) { $this->invoice->addParams(array('userselect_recurring' => $recurring)); $this->invoice->storeload(); } return true; }
public function cancelEntity($invoice_number, $task) { $invoiceid = aecInvoiceHelper::InvoiceIDfromNumber($invoice_number, 0, true); $userid = ''; if ($invoiceid) { $objInvoice = new Invoice(); $objInvoice->load($invoiceid); $objInvoice->delete(); if (strcmp($task, 'editMembership') == 0) { $userid = '&userid=' . $objInvoice->userid; } } aecRedirect('index.php?option=com_acctexp&task=' . $task . $userid, JText::_('REMOVED')); }
function processNotification($option, $processor) { global $aecConfig; // Legacy naming support switch ($processor) { case 'vklix': $processor = 'viaklix'; break; case 'auth': $processor = 'authorize'; break; case '2co': $processor = '2checkout'; break; case 'eps': $processor = 'epsnetpay'; break; } if (!empty($aecConfig->cfg['debug_processor_notifications'])) { aecDebug("ResponseFunction:processNotification"); aecDebug($_GET); aecDebug($_POST); aecDebug($_REQUEST); aecDebug(file_get_contents("php://input")); } $response = array(); $response['fullresponse'] = aecPostParamClear($_POST); // parse processor notification $pp = new PaymentProcessor(); if ($pp->loadName($processor)) { $pp->init(); $response = array_merge($response, $pp->parseNotification($response['fullresponse'])); } else { $eventlog = new eventLog(); $eventlog->issue('processor loading failure', 'processor,loading,error', 'When receiving payment notification, tried to load processor: ' . $processor, 128); return; } // Get Invoice record if (!empty($response['invoice'])) { $id = aecInvoiceHelper::InvoiceIDfromNumber($response['invoice']); } else { $id = false; $response['invoice'] = 'empty'; } if (!$id) { $short = JText::_('AEC_MSG_PROC_INVOICE_FAILED_SH'); $event = ''; $tags = ''; if (isset($response['null'])) { if (isset($response['explanation'])) { $short = JText::_('AEC_MSG_PROC_INVOICE_ACTION_SH'); $event .= $response['explanation']; } else { $event .= JText::_('AEC_MSG_PROC_INVOICE_ACTION_EV_NULL'); } $tags .= 'invoice,processor,payment,null'; } else { $event = sprintf(JText::_('AEC_MSG_PROC_INVOICE_FAILED_EV'), $processor, $response['invoice']); $tags = 'invoice,processor,payment,error'; } $params = array(); $eventlog = new eventLog(); if (isset($response['null'])) { if (isset($response['error'])) { $eventlog->issue($short, $tags, $response['error'], 128, $params); } else { $eventlog->issue($short, $tags, $event, 8, $params); } } else { $eventlog->issue($short, $tags, $event, 128, $params); $error = 'Invoice Number not found. Invoice number provided: "' . $response['invoice'] . '"'; $pp->notificationError($response, $error); } return; } else { $iFactory = new InvoiceFactory(null, null, null, null, $response['invoice']); $iFactory->processorResponse($response); } }