Example #1
0
 function __construct($method, $paypalPlugin)
 {
     parent::__construct($method, $paypalPlugin);
     //Set the credentials
     if ($this->_method->sandbox) {
         $this->api_login_id = $this->_method->sandbox_api_login_id;
         if ($this->_method->authentication == 'signature') {
             $this->api_signature = trim($this->_method->sandbox_api_signature);
             $this->api_certificate = '';
         } else {
             $this->api_signature = '';
             $this->api_certificate = trim($this->_method->sandbox_api_certificate);
         }
         $this->api_password = trim($this->_method->sandbox_api_password);
         $this->merchant_email = trim($this->_method->sandbox_merchant_email);
     } else {
         $this->api_login_id = trim($this->_method->api_login_id);
         $this->api_signature = trim($this->_method->api_signature);
         $this->api_certificate = trim($this->_method->api_certificate);
         $this->api_password = trim($this->_method->api_password);
         $this->merchant_email = trim($this->_method->paypal_merchant_email);
     }
     if (!$this->ExpCredentialsValid() or !$this->isAacceleratedOnboardingValid()) {
         $text = vmText::sprintf('VMPAYMENT_PAYPAL_CREDENTIALS_NOT_SET', $this->_method->payment_name, $this->_method->virtuemart_paymentmethod_id);
         vmError($text, $text);
     }
     if (empty($this->_method->expected_maxamount)) {
         $text = vmText::sprintf('VMPAYMENT_PAYPAL_PARAMETER_REQUIRED', vmText::_('VMPAYMENT_PAYPAL_EXPECTEDMAXAMOUNT'), $this->_method->payment_name, $this->_method->virtuemart_paymentmethod_id);
         vmError($text, $text);
     }
 }
 function __construct($method, $paypalPlugin)
 {
     parent::__construct($method, $paypalPlugin);
     //Set the credentials
     if ($this->_method->sandbox) {
         $this->api_login_id = trim($this->_method->sandbox_api_login_id);
         $this->api_signature = trim($this->_method->sandbox_api_signature);
         $this->api_password = trim($this->_method->sandbox_api_password);
         $this->payflow_partner = trim($this->_method->sandbox_payflow_partner);
         $this->payflow_vendor = trim($this->_method->sandbox_payflow_vendor);
     } else {
         $this->api_login_id = trim($this->_method->api_login_id);
         $this->api_signature = trim($this->_method->api_signature);
         $this->api_password = trim($this->_method->api_password);
     }
     if (empty($this->api_login_id) || empty($this->api_signature) || empty($this->api_password)) {
         $text = vmText::sprintf('VMPAYMENT_PAYPAL_CREDENTIALS_NOT_SET', $this->_method->payment_name, $this->_method->virtuemart_paymentmethod_id);
         vmError($text, $text);
     }
     if (empty($this->_method->payflow_partner) or empty($this->_method->sandbox_payflow_partner)) {
         $sandbox = "";
         if ($this->_method->sandbox) {
             $sandbox = 'SANDBOX_';
         }
         $text = vmText::sprintf('VMPAYMENT_PAYPAL_PARAMETER_REQUIRED', vmText::_('VMPAYMENT_PAYPAL_' . $sandbox . 'PAYFLOW_PARTNER'), $this->_method->payment_name, $this->_method->virtuemart_paymentmethod_id);
         vmError($text);
     }
 }
Example #3
0
 function saveJS()
 {
     vRequest::vmCheckToken();
     $model = VmModel::getModel($this->_cname);
     $data = vRequest::getRequest();
     $id = $model->store($data);
     $errors = $model->getErrors();
     if (empty($errors)) {
         $msg = vmText::sprintf('COM_VIRTUEMART_STRING_SAVED', $this->mainLangKey);
         $type = 'message';
     } else {
         $type = 'error';
     }
     foreach ($errors as $error) {
         $msg = $error . '<br />';
     }
     $json['msg'] = $msg;
     if ($id) {
         $json['product_id'] = $id;
         $json['ok'] = 1;
     } else {
         $json['ok'] = 0;
     }
     echo json_encode($json);
     jExit();
 }
Example #4
0
 function displayErrors($errors)
 {
     foreach ($errors as $error) {
         vmError(vmText::sprintf('VMPAYMENT_SOFORT_ERROR_FROM', $error['message'], $error['field'], $error['code']));
         vmInfo(vmText::sprintf('VMPAYMENT_SOFORT_ERROR_FROM', $error['message'], $error['field'], $error['code']));
         if ($error['message'] == 401) {
             vmdebug('check you payment parameters: custom_id, project_id, api key');
         }
     }
 }
 /**
  * Notify customers product is back in stock
  *
  * @author RolandD
  * @author Christopher Rouseel
  * @todo Add Itemid
  * @todo Do something if the mail cannot be send
  * @todo Update mail from
  * @todo Get the from name/email from the vendor
  */
 public function notifyList($virtuemart_product_id, $subject = '', $mailbody = '', $max_number = 0)
 {
     if (!$virtuemart_product_id) {
         return FALSE;
     }
     //sanitize id
     $virtuemart_product_id = (int) $virtuemart_product_id;
     $max_number = (int) $max_number;
     if (!class_exists('shopFunctionsF')) {
         require VMPATH_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
     }
     $vars = array();
     $waiting_users = $this->getWaitingusers($virtuemart_product_id);
     /* Load the product details */
     $db = JFactory::getDbo();
     $q = "SELECT l.product_name,product_in_stock FROM `#__virtuemart_products_" . VmConfig::$vmlang . "` l\r\r\n\t\t\t\tJOIN `#__virtuemart_products` p ON p.virtuemart_product_id=l.virtuemart_product_id\r\r\n\t\t\t   WHERE p.virtuemart_product_id = " . $virtuemart_product_id;
     $db->setQuery($q);
     $item = $db->loadObject();
     $vars['productName'] = $item->product_name;
     /*
     if ($item->product_in_stock <= 0) {
     	return FALSE;
     }
     */
     $url = JURI::root() . 'index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $virtuemart_product_id;
     $vars['link'] = '<a href="' . $url . '">' . $item->product_name . '</a>';
     if (empty($subject)) {
         $subject = vmText::sprintf('COM_VIRTUEMART_PRODUCT_WAITING_LIST_EMAIL_SUBJECT', $item->product_name);
     }
     $vars['subject'] = $subject;
     $vars['mailbody'] = $mailbody;
     $virtuemart_vendor_id = 1;
     $vendorModel = VmModel::getModel('vendor');
     $vendor = $vendorModel->getVendor($virtuemart_vendor_id);
     $vendorModel->addImages($vendor);
     $vars['vendor'] = $vendor;
     $vars['vendorAddress'] = shopFunctions::renderVendorAddress($virtuemart_vendor_id);
     $vendorEmail = $vendorModel->getVendorEmail($virtuemart_vendor_id);
     $vars['vendorEmail'] = $vendorEmail;
     $i = 0;
     foreach ($waiting_users as $waiting_user) {
         $vars['user'] = $waiting_user->name;
         if (shopFunctionsF::renderMail('productdetails', $waiting_user->notify_email, $vars, 'productdetails')) {
             $db->setQuery('UPDATE #__virtuemart_waitingusers SET notified=1 WHERE virtuemart_waitinguser_id=' . $waiting_user->virtuemart_waitinguser_id);
             $db->execute();
             $i++;
         }
         if (!empty($max_number) && $i >= $max_number) {
             break;
         }
     }
     return TRUE;
 }
	/**
	 * if synchronous, then should not update order status
	 * @param $order
	 * @param $payments
	 */
	function onNotificationUpdateOrderHistory ($order, $payments) {
		if ($this->_currentMethod->authorization_mode_erp_disabled == 'automatic_synchronous') {
			return;
		}
		$order_history = array();
		$amazonState = "";
		$reasonCode = "";
		if ($this->amazonData->isSetCaptureDetails()) {
			$details = $this->amazonData->getCaptureDetails();
			if ($details->isSetCaptureStatus()) {
				$status = $details->getCaptureStatus();
				if ($status->isSetState()) {
					$amazonState = $status->getState();
				} else {
					// TODO THIS IS AN ERROR
				}
				if ($status->isSetReasonCode()) {
					$reasonCode = $status->getReasonCode();
				}
			}
			// default value
			$order_history['customer_notified'] = 1;
			if ($amazonState == 'Completed') {
				$order_history['order_status'] = $this->_currentMethod->status_capture;
				$order_history['comments'] = vmText::_('VMPAYMENT_AMAZON_COMMENT_STATUS_CAPTURE_COMPLETED');

			} elseif ($amazonState == 'Declined') {
				if ($reasonCode == 'AmazonRejected') {
					$order_history['order_status'] = $this->_currentMethod->status_cancel;
				} elseif ($reasonCode == 'ProcessingFailure') {
					// TODO  retry the Capture again if in Open State, and then call the capture again
					$order_history['order_status'] = $this->_currentMethod->status_cancel;
				}
				$order_history['comments'] = vmText::sprintf('VMPAYMENT_AMAZON_COMMENT_STATUS_CAPTURE_DECLINED', $reasonCode);
			} elseif ($amazonState == 'Pending') {
				$order_history['order_status'] = $this->_currentMethod->status_orderconfirmed;
				$order_history['comments'] = vmText::_('VMPAYMENT_AMAZON_COMMENT_STATUS_CAPTURE_PENDING');
				$order_history['customer_notified'] = 0;

			} elseif ($amazonState == 'Closed') {
				// keep old status
				$order_history['customer_notified'] = 0;
				$order_history['order_status'] = $order['details']['BT']->order_status;
				$order_history['comments'] = vmText::sprintf('VMPAYMENT_AMAZON_COMMENT_STATUS_CAPTURE_CLOSED', $reasonCode);
			}

			$order_history['amazonState'] = $amazonState;
			$orderModel = VmModel::getModel('orders');
			$orderModel->updateStatusForOneOrder($order['details']['BT']->virtuemart_order_id, $order_history, false);
		}
	}
Example #7
0
 function getOrderHistory($paybox_data, $order, $payments)
 {
     $amountInCurrency = vmPSPlugin::getAmountInCurrency($order['details']['BT']->order_total, $order['details']['BT']->order_currency);
     $order_history['comments'] = vmText::sprintf('VMPAYMENT_' . $this->plugin_name . '_PAYMENT_STATUS_CONFIRMED_RECURRING', $amountInCurrency['display'], $order['details']['BT']->order_number);
     $amountInCurrency = vmPSPlugin::getAmountInCurrency($paybox_data['M'] * 0.01, $order['details']['BT']->order_currency);
     $order_history['comments'] .= "<br />" . vmText::sprintf('VMPAYMENT_' . $this->plugin_name . '_PAYMENT_STATUS_CONFIRMED_RECURRING_2', $amountInCurrency['display']);
     $order_history['comments'] .= "<br />" . vmText::_('VMPAYMENT_' . $this->plugin_name . '_RESPONSE_S') . ' ' . $paybox_data['S'];
     $subscribe_comment = '';
     $order_history['customer_notified'] = true;
     $order_history['comments'] .= $subscribe_comment;
     $order_history['recurring'] = $subscribe_comment;
     $order_history['order_status'] = $this->_method->status_success_subscribe;
     return $order_history;
 }
Example #8
0
	function getOrderHistory ($paybox_data, $order, $payments) {
		$amountInCurrency = vmPSPlugin::getAmountInCurrency($order['details']['BT']->order_total, $order['details']['BT']->order_currency);
		$order_history['comments'] = vmText::sprintf('VMPAYMENT_'.$this->plugin_name.'_PAYMENT_STATUS_CONFIRMED_RECURRING', $amountInCurrency['display'], $order['details']['BT']->order_number);

		$amountInCurrency = vmPSPlugin::getAmountInCurrency($paybox_data['M'] * 0.01, $order['details']['BT']->order_currency);
		$order_history['comments'] .= "<br />" . vmText::sprintf('VMPAYMENT_'.$this->plugin_name.'_PAYMENT_STATUS_CONFIRMED_RECURRING_2', $amountInCurrency['display']);

		$order_history['comments'] .= "<br />" . vmText::_('VMPAYMENT_'.$this->plugin_name.'_RESPONSE_S') . ' ' . $paybox_data['S'];
		$recurring_comment = '';
		$payment = $payments[0];
		$recurring = json_decode($payment->recurring);

		if (count($payments) == 1) {
			$recurring_comment .= "<br />" . vmText::sprintf('VMPAYMENT_'.$this->plugin_name.'_COMMENT_RECURRING_INFO', $payment->recurring_number, $payment->recurring_periodicity);
			$recurring_comment .= "<br />" . vmText::_('VMPAYMENT_'.$this->plugin_name.'_COMMENT_NEXT_DEADLINES');

			$recurring_comment .= $this->getOrderRecurringTerms($payment, $order, 1);
			$status_success='status_success_'.$this->_method->debit_type;
			$order_history['order_status'] = $this->_method->$status_success;
		} else {
			$nbRecurringDone = $this->getNbRecurringDone($payments);
			$this->debugLog('getNbRecurringDone:' . $nbRecurringDone, 'getOrderHistoryRecurring', 'debug', false);
			if ($nbRecurringDone < $payment->recurring_number) {
				$recurring_comment .= $this->getOrderRecurringTerms($payment, $order, $nbRecurringDone);
				$order_history['order_status'] = $this->_method->status_success_recurring;
			} else {
				$order_history['order_status'] = $this->_method->status_success_recurring_end;
			}
			$this->debugLog('Next status:' . $order_history['order_status'], 'getOrderHistoryRecurring', 'debug', false);

			$index_mont = "PBX_2MONT" . $nbRecurringDone;
			$index_date = "PBX_DATE" . $nbRecurringDone;
			//$text_mont = vmText::_('VMPAYMENT_'.$this->plugin_name.'_PAYMENT_RECURRING_2MONT') ;
			//$text_date = vmText::_('VMPAYMENT_'.$this->plugin_name.'_PAYMENT_RECURRING_DATE');
			//$recurring_comment .= "<br />" . $text_date . " " . $recurring->$index_date . " ";
			$amountInCurrency = vmPSPlugin::getAmountInCurrency($recurring->$index_mont * 0.01, $order['details']['BT']->order_currency);
			//$recurring_comment .= $text_mont . " " . $amountInCurrency['display'];
			$recurring_comment .= "<br />" . $recurring->$index_date . " " . $amountInCurrency['display'];
		}
		$order_history['customer_notified'] = true;
		$order_history['comments'] .= $recurring_comment;
		$order_history['recurring'] = $recurring_comment;

		return $order_history;


	}
Example #9
0
	function __construct($method, $paypalPlugin) {
		parent::__construct($method, $paypalPlugin);
		//Set the credentials
		if ($this->_method->sandbox) {
			$this->merchant_email = $this->_method->sandbox_merchant_email;
		} else {
			$this->merchant_email = $this->_method->paypal_merchant_email;
		}
		if (empty($this->merchant_email)) {
			$sandbox = "";
			if ($this->_method->sandbox) {
				$sandbox = 'SANDBOX_';
			}
			$text = vmText::sprintf('VMPAYMENT_PAYPAL_PARAMETER_REQUIRED', vmText::_('VMPAYMENT_PAYPAL_' . $sandbox . 'MERCHANT'), $this->_method->payment_name, $this->_method->virtuemart_paymentmethod_id);
			vmError($text, $text);
			return FALSE;
		}
	}
Example #10
0
 function __construct($method, $paypalPlugin)
 {
     parent::__construct($method, $paypalPlugin);
     //Set the credentials
     if ($this->_method->sandbox) {
         $this->api_login_id = trim($this->_method->sandbox_api_login_id);
         $this->api_signature = trim($this->_method->sandbox_api_signature);
         $this->api_password = trim($this->_method->sandbox_api_password);
     } else {
         $this->api_login_id = trim($this->_method->api_login_id);
         $this->api_signature = trim($this->_method->api_signature);
         $this->api_password = trim($this->_method->api_password);
     }
     if (empty($this->api_login_id) || empty($this->api_signature) || empty($this->api_password)) {
         $text = vmText::sprintf('VMPAYMENT_PAYPAL_CREDENTIALS_NOT_SET', $this->_method->payment_name, $this->_method->virtuemart_paymentmethod_id);
         vmError($text, $text);
     }
 }
	function onNotificationUpdateOrderHistory ($order, $payments) {

		$order_history = array();
		$amazonState = "";
		$reasonCode = "";
		if (!$this->amazonData->isSetRefundDetails()) {
			$this->debugLog('NO isSetRefundDetails' . __FUNCTION__ . var_export($this->amazonData, true), 'error');
			return;
		}
		$details = $this->amazonData->getRefundDetails();
		if (!$details->isSetRefundStatus()) {
			$this->debugLog('NO isSetRefundStatus' . __FUNCTION__ . var_export($this->amazonData, true), 'error');
			return;
		}
		$status = $details->getRefundStatus();
		if (!$status->isSetState()) {
			$this->debugLog('NO isSetState' . __FUNCTION__ . var_export($this->amazonData, true), 'error');
			return;
		}
		$amazonState = $status->getState();

		if ($status->isSetReasonCode()) {
			$reasonCode = $status->getReasonCode();
		}
		// default value
		$order_history['customer_notified'] = 1;
		if ($amazonState == 'Completed') {
			$order_history['order_status'] = $this->_currentMethod->status_refunded;
			$order_history['comments'] = vmText::_('VMPAYMENT_AMAZON_COMMENT_STATUS_REFUND_COMPLETED');
		} elseif ($amazonState == 'Declined') {
			$order_history['customer_notified'] = 0;
			$order_history['comments'] = vmText::sprintf('VMPAYMENT_AMAZON_COMMENT_STATUS_REFUND_DECLINED', $reasonCode);
			$order_history['order_status'] = $order['details']['BT']->order_status;

		} elseif ($amazonState == 'Pending') {
			$order_history['comments'] = vmText::_('VMPAYMENT_AMAZON_COMMENT_STATUS_REFUND_PENDING');
			$order_history['order_status'] = $this->_currentMethod->status_orderconfirmed;
		}

		$orderModel = VmModel::getModel('orders');
		$orderModel->updateStatusForOneOrder($order['details']['BT']->virtuemart_order_id, $order_history, false);
		return $amazonState;
	}
Example #12
0
 function fetchElement($name, $value, &$node, $control_name)
 {
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.file');
     $lang = JFactory::getLanguage();
     $lang->load('com_virtuemart', JPATH_ADMINISTRATOR);
     // path to images directory
     $folder = $node->attributes('directory');
     $safePath = VmConfig::get('forSale_path', '');
     $certificatePath = $safePath . $folder;
     $certificatePath = JPath::clean($certificatePath);
     $class = $node->attributes('class') ? 'class="' . $node->attributes('class') . '"' : '';
     // Is the path a folder?
     if (!is_dir($certificatePath)) {
         return '<span ' . $class . '>' . vmText::sprintf('VMPAYMENT_PAYPAL_CERTIFICATE_FOLDER_NOT_EXIST', $certificatePath) . '</span>';
     }
     $path = str_replace('/', DS, $certificatePath);
     $filter = $node->attributes('filter');
     $exclude = array($node->attributes('exclude'), '.svn', 'CVS', '.DS_Store', '__MACOSX', 'index.html');
     $pattern = implode("|", $exclude);
     $stripExt = $node->attributes('stripext');
     $files = JFolder::files($path, $filter, FALSE, FALSE, $exclude);
     $options = array();
     if (is_array($files)) {
         foreach ($files as $file) {
             if ($exclude) {
                 if (preg_match(chr(1) . $pattern . chr(1), $file)) {
                     continue;
                 }
             }
             if ($stripExt) {
                 $file = JFile::stripExt($file);
             }
             $options[] = JHTML::_('select.option', $file, $file);
         }
     }
     $class .= ' size="5" data-placeholder="' . vmText::_('COM_VIRTUEMART_DRDOWN_SELECT_SOME_OPTIONS') . '"';
     return JHTML::_('select.genericlist', $options, '' . $control_name . '[' . $name . ']', $class, 'value', 'text', $value, $control_name . $name);
 }
Example #13
0
 /**
  * Returns a Model object, always creating it
  *
  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
  * @license     GNU General Public License version 2 or later; see LICENSE
  *
  * @param   string  $type    The model type to instantiate
  * @param   string  $prefix  Prefix for the model class name. Optional.
  * @param   array   $config  Configuration array for model. Optional.
  *
  * @return  mixed   A model object or false on failure
  *
  * @since   11.1
  */
 public static function getInstance($type, $prefix = '', $config = array())
 {
     $type = preg_replace('/[^A-Z0-9_\\.-]/i', '', $type);
     $modelClass = $prefix . ucfirst($type);
     if (!class_exists($modelClass)) {
         $path = JPath::find(self::addIncludePath(null, $prefix), self::_createFileName('model', array('name' => $type)));
         if (!$path) {
             $path = JPath::find(self::addIncludePath(null, ''), self::_createFileName('model', array('name' => $type)));
         }
         if ($path) {
             require_once $path;
             if (!class_exists($modelClass)) {
                 vmWarn(vmText::sprintf('JLIB_APPLICATION_ERROR_MODELCLASS_NOT_FOUND', $modelClass));
                 return false;
             }
         } else {
             return false;
         }
     }
     return new $modelClass($config);
 }
Example #14
0
 private function checkShipmentMethodsConfigured()
 {
     //For the selection of the shipment method we need the total amount to pay.
     $shipmentModel = VmModel::getModel('Shipmentmethod');
     $shipments = $shipmentModel->getShipments();
     if (empty($shipments)) {
         $text = '';
         $user = JFactory::getUser();
         if ($user->authorise('core.admin', 'com_virtuemart') or $user->authorise('core.manage', 'com_virtuemart') or VmConfig::isSuperVendor()) {
             $uri = JFactory::getURI();
             $link = $uri->root() . 'administrator/index.php?option=com_virtuemart&view=shipmentmethod';
             $text = vmText::sprintf('COM_VIRTUEMART_NO_SHIPPING_METHODS_CONFIGURED_LINK', '<a href="' . $link . '" rel="nofollow">' . $link . '</a>');
         }
         vmInfo('COM_VIRTUEMART_NO_SHIPPING_METHODS_CONFIGURED', $text);
         $tmp = 0;
         $this->assignRef('found_shipment_method', $tmp);
         $this->cart->virtuemart_shipmentmethod_id = 0;
         return false;
     }
     return true;
 }
Example #15
0
"/>
	<?php 
if (!empty($this->virtuemart_userinfo_id)) {
    echo '<input type="hidden" name="shipto_virtuemart_userinfo_id" value="' . (int) $this->virtuemart_userinfo_id . '" />';
}
echo JHtml::_('form.token');
?>
		<div class="control-buttons">
		<?php 
if ($this->cart->getInCheckOut() || $this->address_type == 'ST') {
    $buttonclass = 'default';
} else {
    $buttonclass = 'button vm-button-correct';
}
if (VmConfig::get('oncheckout_show_register', 1) && $this->userDetails->JUser->id == 0 && !VmConfig::get('oncheckout_only_registered', 0) && $this->address_type == 'BT' and $rview == 'cart') {
    echo '<div id="reg_text">' . vmText::sprintf('COM_VIRTUEMART_ONCHECKOUT_DEFAULT_TEXT_REGISTER', vmText::_('COM_VIRTUEMART_REGISTER_AND_CHECKOUT'), vmText::_('COM_VIRTUEMART_CHECKOUT_AS_GUEST')) . '</div>';
} else {
    //echo vmText::_('COM_VIRTUEMART_REGISTER_ACCOUNT');
}
if (VmConfig::get('oncheckout_show_register', 1) && $this->userDetails->JUser->id == 0 && $this->address_type == 'BT' and $rview == 'cart') {
    ?>
			<button name="register" class="<?php 
    echo $buttonclass;
    ?>
" type="submit" onclick="javascript:return myValidator(userForm,true);"
					title="<?php 
    echo vmText::_('COM_VIRTUEMART_REGISTER_AND_CHECKOUT');
    ?>
"><?php 
    echo vmText::_('COM_VIRTUEMART_REGISTER_AND_CHECKOUT');
    ?>
Example #16
0
    function addStandardEditViewCommands($id = 0, $object = null)
    {
        $view = vRequest::getCmd('view', vRequest::getCmd('controller', 'virtuemart'));
        if (!class_exists('JToolBarHelper')) {
            require JPATH_ADMINISTRATOR . DS . 'includes' . DS . 'toolbar.php';
        }
        JToolBarHelper::divider();
        if ($this->canDo->get('core.admin') or $this->canDo->get('vm.' . $view . '.edit') or $this->canDo->get('vm.' . $view . '.create')) {
            JToolBarHelper::save();
            JToolBarHelper::apply();
        }
        JToolBarHelper::cancel();
        self::showHelp();
        self::showACLPref($view);
        if ($view == 'user' or $view == 'product') {
            $validate = true;
        } else {
            $validate = false;
        }
        $this->addJsJoomlaSubmitButton($validate);
        $editView = vRequest::getCmd('view', vRequest::getCmd('controller', ''));
        $params = JComponentHelper::getParams('com_languages');
        $selectedLangue = $params->get('site', 'en-GB');
        $this->lang = strtolower(strtr($selectedLangue, '-', '_'));
        // Get all the published languages defined in Language manager > Content
        $allLanguages = JLanguageHelper::getLanguages();
        foreach ($allLanguages as $jlang) {
            $languagesByCode[$jlang->lang_code] = $jlang;
        }
        // only add if ID and view not null
        if ($editView and $id and count(vmconfig::get('active_languages')) > 1) {
            if ($editView == 'user') {
                $editView = 'vendor';
            }
            jimport('joomla.language.helper');
            $this->lang = vRequest::getVar('vmlang', $this->lang);
            // list of languages installed in #__extensions (may be more than the ones in the Language manager > Content if the user did not added them)
            $languages = JLanguageHelper::createLanguageList($selectedLangue, constant('VMPATH_ROOT'), true);
            $activeVmLangs = vmconfig::get('active_languages');
            $flagCss = "";
            foreach ($languages as $k => &$joomlaLang) {
                if (!in_array($joomlaLang['value'], $activeVmLangs)) {
                    unset($languages[$k]);
                } else {
                    $key = $joomlaLang['value'];
                    if (!isset($languagesByCode[$key])) {
                        $img = substr($key, 0, 2);
                        //We try a fallback
                        vmdebug('COM_VIRTUEMART_MISSING_FLAG', $img, $joomlaLang['text']);
                    } else {
                        $img = $languagesByCode[$key]->image;
                    }
                    $image_flag = VMPATH_ROOT . "/media/mod_languages/images/" . $img . ".gif";
                    $image_flag_url = JURI::root() . "media/mod_languages/images/" . $img . ".gif";
                    if (!file_exists($image_flag)) {
                        vmerror(vmText::sprintf('COM_VIRTUEMART_MISSING_FLAG', $image_flag, $joomlaLang['text']));
                    } else {
                        $flagCss .= "td.flag-" . $key . ",.flag-" . $key . "{background: url( " . $image_flag_url . ") no-repeat 0 0; padding-left:20px !important;}\n";
                    }
                }
            }
            JFactory::getDocument()->addStyleDeclaration($flagCss);
            $this->langList = JHtml::_('select.genericlist', $languages, 'vmlang', 'class="inputbox" style="width:176px;"', 'value', 'text', $selectedLangue, 'vmlang');
            if ($editView == 'product') {
                $productModel = VmModel::getModel('product');
                $childproducts = $productModel->getProductChilds($id) ? $productModel->getProductChilds($id) : '';
            }
            $token = JSession::getFormToken();
            $j = '
			jQuery(function($) {
				var oldflag = "";
				$("select#vmlang").chosen().change(function() {
					langCode = $(this).find("option:selected").val();
					flagClass = "flag-"+langCode;
					jQuery.ajax({
						type: "GET",
						cache: false,
        				dataType: "json",
        				url: "index.php?option=com_virtuemart&view=translate&task=paste&format=json&lg="+langCode+"&id=' . $id . '&editView=' . $editView . '&' . $token . '=1",
    				}).done(
						function(data) {
							var items = [];

							var theForm = document.forms["adminForm"];
							if(typeof theForm.vmlang==="undefined"){
							 	var input = document.createElement("input");
								input.type = "hidden";
								input.name = "vmlang";
								input.value = langCode;
								theForm.appendChild(input);
							} else {
								theForm.vmlang.value = langCode;
							}
							if (data.fields !== "error" ) {
								if (data.structure == "empty") alert(data.msg);
								$.each(data.fields , function(key, val) {
									cible = jQuery("#"+key);
									if (oldflag !== "") cible.parent().removeClass(oldflag)
									var tmce_ver = 0;
									if(typeof window.tinyMCE!=="undefined"){
										var tmce_ver=window.tinyMCE.majorVersion;
									}
									if (tmce_ver>="4") {
										if (cible.parent().addClass(flagClass).children().hasClass("mce_editable") && data.structure !== "empty" ) tinyMCE.execCommand("mceSetContent", false,val);
										else if (data.structure !== "empty") cible.val(val);
									} else {
										if (cible.parent().addClass(flagClass).children().hasClass("mce_editable") && data.structure !== "empty" ) tinyMCE.execInstanceCommand(key,"mceSetContent",false,val);
										else if (data.structure !== "empty") cible.val(val);
									}
									});

							} else alert(data.msg);';
            if ($editView == 'product' && !empty($childproducts)) {
                foreach ($childproducts as $child) {
                    $j .= 'jQuery.ajax({
        						type: "GET",
								cache: false,
        						dataType: "json",
        						url: "index.php?option=com_virtuemart&view=translate&task=paste&format=json&lg="+langCode+"&id=' . $child->virtuemart_product_id . '&editView=' . $editView . '&' . $token . '=1",
    					}).done(
								//	$.getJSON( "index.php?option=com_virtuemart&view=translate&task=paste&format=json&lg="+langCode+"&id=' . $child->virtuemart_product_id . '&editView=' . $editView . '&' . $token . '=1" ,
										function(data) {
											cible = jQuery("#child' . $child->virtuemart_product_id . 'product_name");
											if (oldflag !== "") cible.parent().removeClass(oldflag)
											cible.parent().addClass(flagClass);
											cible.val(data.fields.product_name);
											jQuery("#child' . $child->virtuemart_product_id . 'slug").val(data.fields["slug"]);
										}
									)
								';
                }
            }
            $j .= 'oldflag = flagClass ;
						}
					)
				});
			})';
            vmJsApi::addJScript('vmlang', $j);
        } else {
            $jlang = JFactory::getLanguage();
            $langs = $jlang->getKnownLanguages();
            $defautName = $selectedLangue;
            $flagImg = $selectedLangue;
            if (isset($languagesByCode[$selectedLangue])) {
                $defautName = $langs[$selectedLangue]['name'];
                $flagImg = JHtml::_('image', 'mod_languages/' . $languagesByCode[$selectedLangue]->image . '.gif', $languagesByCode[$selectedLangue]->title_native, array('title' => $languagesByCode[$selectedLangue]->title_native), true);
            } else {
                vmWarn(vmText::sprintf('COM_VIRTUEMART_MISSING_FLAG', $selectedLangue, $selectedLangue));
            }
            $this->langList = '<input name ="vmlang" type="hidden" value="' . $selectedLangue . '" >' . $flagImg . ' <b> ' . $defautName . '</b>';
        }
        if (JFactory::getApplication()->isSite()) {
            $bar = JToolBar::getInstance('toolbar');
            $bar->appendButton('Link', 'back', 'COM_VIRTUEMART_LEAVE', 'index.php?option=com_virtuemart&manage=0');
        }
    }
Example #17
0
 */
defined('_JEXEC') or die;
vmJsApi::css('paybox', 'plugins/vmpayment/paybox/paybox/assets/css/');
?>


<div class="paybox response">


	<?php 
if ($viewData['success']) {
    ?>

		<div class="status_confirmed">
			<?php 
    echo vmText::sprintf('VMPAYMENT_' . $this->_name . '_PAYMENT_STATUS_CONFIRMED', $viewData['amount'] . " " . $viewData['currency'], $viewData["order_number"]);
    ?>

		</div>
		<div class="transaction_id">
			<?php 
    echo vmText::_('VMPAYMENT_' . $this->_name . '_RESPONSE_S') . ' ' . $viewData['transactionId'];
    ?>

		</div>
<?php 
    if (!empty($viewData['extra_comment'])) {
        ?>

<div class="extra_comment">
			<?php 
Example #18
0
 /**
  * Delete a stored card
  * To remove a card from the RealVault system
  */
 function updateStoredCards($card_ids)
 {
     $user = JFactory::getUser();
     $db = JFactory::getDBO();
     foreach ($card_ids as $card_id) {
         JLoader::import('joomla.plugin.helper');
         JPluginHelper::importPlugin('vmpayment');
         $app = JFactory::getApplication();
         $storedCC = $this->getStoredCCInfo($card_id);
         $updatedCCname = vRequest::getString('cc_name_' . $card_id);
         $updatedYear = vRequest::getInt('cc_expire_year_' . $card_id);
         $updatedMonth = vRequest::getInt('cc_expire_month_' . $card_id);
         $expDate = $this->explodeExpDate($storedCC['realex_hpp_api_saved_pmt_expdate']);
         if ($storedCC['realex_hpp_api_saved_pmt_name'] == $updatedCCname and $expDate['yy'] == $updatedYear and $expDate['mm'] == $updatedMonth) {
             continue;
         } else {
             $storedCC['realex_hpp_api_saved_pmt_name'] = $updatedCCname;
             $storedCC['realex_hpp_api_saved_pmt_expdate'] = $updatedMonth . $updatedYear;
         }
         $success = false;
         // the trigger will send the card-cancel-card to Releax
         $app->triggerEvent('plgVmOnRealexUpdateStoredCard', array('realex_hpp_api', $storedCC, &$success));
         if ($success) {
             $query = 'UPDATE  `' . $this->_tablename . '` SET `realex_hpp_api_saved_pmt_name`="' . $storedCC['realex_hpp_api_saved_pmt_name'] . '" , `realex_hpp_api_saved_pmt_expdate`="' . $storedCC['realex_hpp_api_saved_pmt_expdate'] . '" WHERE `id`=' . $card_id . ' AND `virtuemart_user_id`=' . $storedCC['virtuemart_user_id'];
             $db->setQuery($query);
             $db->query();
             vmInfo(vmText::sprintf('VMUSERFIELD_REALEX_HPP_API_CARD_UPDATED', $storedCC['realex_hpp_api_saved_pmt_name'], $storedCC['realex_hpp_api_saved_pmt_digits'], $updatedMonth, $updatedYear));
         } else {
             $vendorId = 1;
             $vendor_link = JRoute::_('index.php?option=com_virtuemart&view=vendor&layout=contact&virtuemart_vendor_id=' . $vendorId);
             vmInfo(vmText::sprintf('VMUSERFIELD_REALEX_HPP_API_CARD_NOT_UPDATED', $storedCC['realex_hpp_api_saved_pmt_name'], $storedCC['realex_hpp_api_saved_pmt_digits'], $updatedMonth, $updatedYear, $vendor_link));
         }
     }
 }
Example #19
0
	protected function validateIpnContent ($paypal_data) {
		$test_ipn = (array_key_exists('test_ipn', $paypal_data)) ? $paypal_data['test_ipn'] : 0;
		if ($test_ipn == 1) {
			//return true;
		}
		$paypal_data=$_POST;
		// Paypal wants to open the socket in SSL
		$port = 443;
		$paypal_url = $this->_getPaypalURL('ssl://', false);
		$paypal_url_header = $this->_getPaypalURL('', false);
		$protocol = 'ssl://';
		/*
		 * Before we can trust the contents of the message, we must first verify that the message came from PayPal.
		 * To verify the message, we must send back the contents in the exact order they
		*  were received and precede it with the command _notify-validate,
		 */

// read the post from PayPal system and add 'cmd'
		$post_msg = 'cmd=_notify-validate';
		if (function_exists('get_magic_quotes_gpc')) {
			$get_magic_quotes_exists = true;
		}
		foreach ($paypal_data as $key => $value) {
			if ($get_magic_quotes_exists == true && get_magic_quotes_gpc() == 1) {
				$value = str_replace('\r\n', "QQLINEBREAKQQ", $value);
				$value = urlencode(stripslashes($value));
				$value = str_replace("QQLINEBREAKQQ", "\r\n", $value);
			} else {
				$value = urlencode($value);
			}
			$post_msg .= "&$key=$value";
		}


		$header = "POST /cgi-bin/webscr HTTP/1.1\r\n";
		$header .= "User-Agent: PHP/" . phpversion() . "\r\n";
		$header .= "Referer: " . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . @$_SERVER['QUERY_STRING'] . "\r\n";
		$header .= "Server: " . $_SERVER['SERVER_SOFTWARE'] . "\r\n";
		$header .= "Host: " . $paypal_url_header . ":" . $port . "\r\n";
		$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
		$header .= "Content-Length: " . strlen($post_msg) . "\r\n";
		//$header .= "Accept: */*\r\n\r\n";
		$header .= "Connection: close\r\n\r\n";

		$fps = fsockopen($paypal_url, $port, $errno, $errstr, 30);
		$valid_ipn = false;
		if (!$fps) {
			$this->debugLog(vmText::sprintf('VMPAYMENT_PAYPAL_ERROR_POSTING_IPN', $errstr, $errno), 'validateIpnContent', 'error', false);
		} else {
			$return = fputs($fps, $header . $post_msg);
			if ($return === false) {
				$this->debugLog("FALSE", 'validateIpnContent FPUTS', 'error', false);
				return FALSE;
			}
			$res = '';
			while (!feof($fps)) {
				$res .= fgets($fps, 1024);
			}
			fclose($fps);

			// Inspect IPN validation result and act accordingly
			$valid_ipn = strstr($res, "VERIFIED");
			if (!$valid_ipn) {
				if (strstr($res, "INVALID")) {
					$errorInfo = array("paypal_data" => $paypal_data, 'post_msg' => $post_msg, 'paypal_res' => $res);
					$this->debugLog($errorInfo, vmText::_('VMPAYMENT_PAYPAL_ERROR_IPN_VALIDATION'), 'error', false);
				} else {
					$this->debugLog(vmText::_('VMPAYMENT_PAYPAL_ERROR_IPN_VALIDATION') . ": NO ANSWER FROM PAYPAL", 'validateIpnContent', 'error', false);
				}
			}
		}

		$this->debugLog('valid_ipn: ' . $valid_ipn, 'validateIpnContent', 'debug', false);
		return $valid_ipn;
	}
Example #20
0
/**
*
* Layout for the shopping cart, look in mailshopper for more details
*
* @package	VirtueMart
* @subpackage Order
* @author Max Milbers, Valerie Isaksen
*
* @link http://www.virtuemart.net
* @copyright Copyright (c) 2004 - 2010 VirtueMart Team. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
*
*/
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="html-email">
    <tr>
    <td>
<?php 
//	echo vmText::_('COM_VIRTUEMART_CART_MAIL_VENDOR_TITLE').$this->vendor->vendor_name.'<br/>';
echo vmText::sprintf('COM_VIRTUEMART_MAIL_VENDOR_CONTENT', $this->vendor->vendor_store_name, $this->shopperName, $this->currency->priceDisplay($this->orderDetails['details']['BT']->order_total, $this->currency), $this->orderDetails['details']['BT']->order_number);
if (!empty($this->orderDetails['details']['BT']->customer_note)) {
    echo '<br /><br />' . vmText::sprintf('COM_VIRTUEMART_CART_MAIL_VENDOR_SHOPPER_QUESTION', $this->orderDetails['details']['BT']->customer_note) . '<br />';
}
?>
</td></tr></table>
 /**
  * This event is fired after the payment method has been selected. It can be used to store
  * additional payment info in the cart.
  *
  * @author Valérie isaksen
  *
  * @param VirtueMartCart $cart : the actual cart
  * @return null if the payment was not selected, true if the data is valid, error message if the data is not vlaid
  *
  */
 public function plgVmOnSelectCheckPayment(VirtueMartCart $cart, &$msg)
 {
     if (!$this->selectedThisByMethodId($cart->virtuemart_paymentmethod_id)) {
         return NULL;
     }
     $klarnaPaymentMethodActive = $this->getKlarnaPaymentMethodActive();
     if ($klarnaPaymentMethodActive !== false and $klarnaPaymentMethodActive != $cart->virtuemart_paymentmethod_id) {
         $this->clearKlarnaParams($cart);
         return;
     }
     if (!($this->_currentMethod = $this->getVmPluginMethod($cart->virtuemart_paymentmethod_id))) {
         return NULL;
     }
     $cart->prepareAddressFieldsInCart();
     if (empty($cart->BT['email'])) {
         $this->updateCartWithDefaultKCOAddress($cart);
     }
     $cart->prepareCartData();
     $this->updateCartFields($cart);
     $cart->setCartIntoSession();
     if (!$this->initKlarnaParams($this->_currentMethod)) {
         return;
     }
     $klarnaCheckoutInterface = $this->_loadKlarnaCheckoutInterface();
     $klarna_checkout_order = null;
     $klarna_checkout_connector = $klarnaCheckoutInterface->getKlarnaConnector();
     $klarna_checkout_id = $this->getKlarnaCheckoutIdFromSession();
     jimport('joomla.environment.browser');
     $browser = JBrowser::getInstance();
     if ($klarna_checkout_id == null) {
         // Start new session
         $create['purchase_country'] = $this->country_code_2;
         $create['purchase_currency'] = $this->currency_code_3;
         $create['locale'] = $this->locale;
         $create['gui']['layout'] = $browser->isMobile() ? 'mobile' : 'desktop';
         $klarnaCheckoutInterface->getMerchantData($create, $cart);
         $this->getTemplateOptions($create);
         if (!isset($cart->BT['email'])) {
             $create['shipping_address']['email'] = $cart->BT['email'];
             $address = $cart->ST == 0 ? $cart->BT : $cart->ST;
             if (isset($address['zip']) and !empty($address['zip'])) {
                 $create['shipping_address']['postal_code'] = $cart->BT['zip'];
             }
         }
         $klarnaCheckoutInterface->getCartItems($cart, $create);
         try {
             $klarna_checkout_order = $klarnaCheckoutInterface->checkoutOrder($klarna_checkout_connector, $klarna_checkout_id);
             $klarna_checkout_order->create($create);
             $klarna_checkout_order->fetch();
         } catch (Exception $e) {
             $this->clearKlarnaParams($cart);
             $admin_msg = $e->getMessage();
             $this->KlarnacheckoutError($admin_msg, vmText::sprintf('VMPAYMENT_KLARNACHECKOUT_ERROR_OCCURRED', $this->_currentMethod->payment_name));
             return NULL;
         }
         $this->setKlarnaParamsInSession($klarnaCheckoutInterface->getCheckoutOrderId($klarna_checkout_order), $cart->virtuemart_paymentmethod_id, $cart->BT);
     }
     if ($this->_currentMethod->payment_form_position == 'specific') {
         $this->setCartLayout($cart, true);
     }
     return true;
 }
Example #22
0
 /**
  * Update an order status
  *
  * @author Max Milbers
  */
 public function updatestatus()
 {
     $app = Jfactory::getApplication();
     $lastTask = vRequest::getCmd('last_task');
     /* Load the view object */
     $view = $this->getView('orders', 'html');
     if (!$this->getPermOrderStatus()) {
         vmInfo('Restricted');
         $view->display();
         return true;
     }
     /* Update the statuses */
     $model = VmModel::getModel('orders');
     if ($lastTask == 'updatestatus') {
         // single order is in POST but we need an array
         $order = array();
         $virtuemart_order_id = vRequest::getInt('virtuemart_order_id');
         $order[$virtuemart_order_id] = vRequest::getRequest();
         $result = $model->updateOrderStatus($order);
     } else {
         $result = $model->updateOrderStatus();
     }
     $msg = '';
     if ($result['updated'] > 0) {
         $msg = vmText::sprintf('COM_VIRTUEMART_ORDER_UPDATED_SUCCESSFULLY', $result['updated']);
     } else {
         if ($result['error'] == 0) {
             $msg .= vmText::_('COM_VIRTUEMART_ORDER_NOT_UPDATED');
         }
     }
     if ($result['error'] > 0) {
         $msg .= vmText::sprintf('COM_VIRTUEMART_ORDER_NOT_UPDATED_SUCCESSFULLY', $result['error'], $result['total']);
     }
     if ('updatestatus' == $lastTask) {
         $app->redirect('index.php?option=com_virtuemart&view=orders&task=edit&virtuemart_order_id=' . $virtuemart_order_id, $msg);
     } else {
         $app->redirect('index.php?option=com_virtuemart&view=orders', $msg);
     }
 }
Example #23
0
 /**
  * As shortcat, Important the & MUST be there, even in php5.3
  *
  * @author Max Milbers
  * @param array/obj $data input data as assoc array or obj
  * @param boolean $preload You can preload the data here too preserve not updated data
  * @return array/obj $data the updated data
  */
 public function bindChecknStore(&$data, $preload = false)
 {
     $tblKey = $this->_tbl_key;
     $ok = true;
     if ($this->_translatable) {
         if (!class_exists('VmTableData')) {
             require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'vmtabledata.php';
         }
         $db = JFactory::getDBO();
         $dataTable = clone $this;
         $langTable = new VmTableData($this->_tbl_lang, $tblKey, $db);
         $langTable->setPrimaryKey($tblKey);
         $langData = array();
         $langObKeys = array();
         $langUniqueKeys = array();
         if (is_object($data)) {
             foreach ($this->_translatableFields as $name) {
                 if (isset($data->{$name})) {
                     //We directly store language stuff "escaped"
                     $langData[$name] = htmlentities($data->{$name}, ENT_QUOTES, "UTF-8");
                 } else {
                     //	$langData[$name] = '';
                 }
                 unset($dataTable->{$name});
                 if (!empty($this->_unique_name[$name])) {
                     $langUniqueKeys[$name] = vmText::sprintf('COM_VIRTUEMART_STRING_ERROR_NOT_UNIQUE_NAME', vmText::_('COM_VIRTUEMART_' . strtoupper($name)));
                     unset($dataTable->_unique_name[$name]);
                     $langObKeys[$name] = vmText::sprintf('COM_VIRTUEMART_STRING_ERROR_OBLIGATORY_KEY', vmText::_('COM_VIRTUEMART_' . strtoupper($name)));
                     unset($dataTable->_obkeys[$name]);
                 }
                 if (!empty($this->_obkeys[$name])) {
                     $langObKeys[$name] = vmText::sprintf('COM_VIRTUEMART_STRING_ERROR_OBLIGATORY_KEY', vmText::_('COM_VIRTUEMART_' . strtoupper($name)));
                     unset($dataTable->_obkeys[$name]);
                 }
             }
             // 				$langTable->$tblKey = $data->$tblKey;
         } else {
             foreach ($this->_translatableFields as $name) {
                 if (isset($data[$name])) {
                     //$langData[$name] = $data[$name];
                     $langData[$name] = htmlentities($data[$name], ENT_QUOTES, "UTF-8");
                 } else {
                     //	$langData[$name] = '';
                 }
                 unset($dataTable->{$name});
                 if (!empty($this->_unique_name[$name])) {
                     $langUniqueKeys[$name] = vmText::sprintf('COM_VIRTUEMART_STRING_ERROR_NOT_UNIQUE_NAME', vmText::_('COM_VIRTUEMART_' . strtoupper($name)));
                     unset($dataTable->_unique_name[$name]);
                     $langObKeys[$name] = vmText::sprintf('COM_VIRTUEMART_STRING_ERROR_OBLIGATORY_KEY', vmText::_('COM_VIRTUEMART_' . strtoupper($name)));
                     unset($dataTable->_obkeys[$name]);
                 }
                 if (!empty($this->_obkeys[$name])) {
                     $langObKeys[$name] = vmText::sprintf('COM_VIRTUEMART_STRING_ERROR_OBLIGATORY_KEY', vmText::_('COM_VIRTUEMART_' . strtoupper($name)));
                     unset($dataTable->_obkeys[$name]);
                 }
             }
             // 				$langTable->$tblKey = $data[$tblKey];
         }
         $langTable->_unique_name = $langUniqueKeys;
         $langTable->_obkeys = $langObKeys;
         $langTable->_slugAutoName = $this->_slugAutoName;
         unset($dataTable->_slugAutoName);
         $langTable->_slugName = 'slug';
         unset($dataTable->_slugName);
         $langTable->setProperties($langData);
         $langTable->_translatable = false;
         //We must check the langtable BEFORE we store the normal table, cause the langtable is often defining if there are enough data to store it (for exmple the name)
         if ($ok) {
             //vmdebug('my langtable before bind',$langTable->id);
             if (!$langTable->bind($data)) {
                 $ok = false;
                 $msg = 'bind';
                 // 			vmdebug('Problem in bind '.get_class($this).' '.$this->_db->getErrorMsg());
                 vmdebug('Problem in bind ' . get_class($this) . ' ');
             }
         }
         if ($ok) {
             if (!$langTable->check()) {
                 $ok = false;
                 vmdebug('Check returned false ' . get_class($langTable) . ' ' . $this->_tbl . ' ' . $langTable->_db->getErrorMsg());
             }
         }
         if ($ok) {
             $dataTable->bindChecknStoreNoLang($data, $preload);
             $this->bind($dataTable);
             $langTable->{$tblKey} = !empty($this->{$tblKey}) ? $this->{$tblKey} : 0;
             //vmdebug('bindChecknStoreNoLang my $tblKey '.$tblKey.' '.$langTable->$tblKey);
             if ($ok and $preload) {
                 if (!empty($langTable->{$tblKey})) {
                     $id = $langTable->{$tblKey};
                     if (!$langTable->load($id)) {
                         $ok = false;
                         vmdebug('Preloading of language table failed, no id given, cannot store ' . $this->_tbl);
                     }
                 } else {
                     if ($ok) {
                         if (!$langTable->bind($data)) {
                             $ok = false;
                             vmdebug('Problem in bind ' . get_class($this) . ' ');
                         }
                     }
                     if ($ok) {
                         if (!$langTable->check()) {
                             $ok = false;
                             vmdebug('Check returned false ' . get_class($langTable) . ' ' . $this->_tbl . ' ' . $langTable->_db->getErrorMsg());
                         }
                     }
                 }
             }
             if ($ok) {
                 if (!$langTable->store()) {
                     $ok = false;
                     // $msg .= ' store';
                     vmdebug('Problem in store with langtable ' . get_class($langTable) . ' with ' . $tblKey . ' = ' . $this->{$tblKey} . ' ' . $langTable->_db->getErrorMsg());
                 } else {
                     $this->bind($langTable);
                     if ($this->_lhash) {
                         self::$_cache['l'][$this->_lhash] = $this->loadFieldValues(false);
                     }
                 }
             }
         }
     } else {
         if (!$this->bindChecknStoreNoLang($data, $preload)) {
             $ok = false;
         }
     }
     return $ok;
 }
Example #24
0
defined('_JEXEC') or die('Restricted access');
?>


<form method="post" action="<?php 
echo JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $this->product->virtuemart_product_id . '&virtuemart_category_id=' . $this->product->virtuemart_category_id, FALSE);
?>
" name="notifyform" id="notifyform">
	<h4><?php 
echo vmText::_('COM_VIRTUEMART_CART_NOTIFY');
?>
</h4>

	<div class="list-reviews">
		<?php 
echo vmText::sprintf('COM_VIRTUEMART_CART_NOTIFY_DESC', $this->product->product_name);
?>
		<br /><br />
	<div class="clear"></div>
	</div>
	
	<div><span class="floatleft"><input type="text" name="notify_email" value="<?php 
echo $this->user->email;
?>
" /></span>
		 <span class="addtocart-button"><input type="submit" name="notifycustomer"  class="notify-button" value="<?php 
echo vmText::_('COM_VIRTUEMART_CART_NOTIFY');
?>
" title="<?php 
echo vmText::_('COM_VIRTUEMART_CART_NOTIFY');
?>
Example #25
0
 /**
  * Test userdata if valid
  *
  * @author Max Milbers
  * @param String if BT or ST
  * @param Object If given, an object with data address data that must be formatted to an array
  * @return redirectMsg, if there is a redirectMsg, the redirect should be executed after
  */
 public function validateUserData(&$data, $type = 'BT', $showInfo = false)
 {
     if (!class_exists('VirtueMartModelUserfields')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'userfields.php';
     }
     $userFieldsModel = VmModel::getModel('userfields');
     if ($type == 'BT') {
         $fieldtype = 'account';
     } else {
         if ($type == 'cartfields') {
             $fieldtype = 'cart';
         } else {
             $fieldtype = 'shipment';
         }
     }
     $neededFields = $userFieldsModel->getUserFields($fieldtype, array('required' => true, 'delimiters' => true, 'captcha' => true, 'system' => false), array('delimiter_userinfo', 'name', 'username', 'password', 'password2', 'address_type_name', 'address_type', 'user_is_vendor', 'agreed'));
     $i = 0;
     $return = true;
     $required = 0;
     $missingFields = array();
     $lang = JFactory::getLanguage();
     foreach ($neededFields as $field) {
         //This is a special test for the virtuemart_state_id. There is the speciality that the virtuemart_state_id could be 0 but is valid.
         if ($field->name == 'virtuemart_state_id') {
             if (!class_exists('VirtueMartModelState')) {
                 require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'state.php';
             }
             if (!empty($data['virtuemart_country_id'])) {
                 if (!isset($data['virtuemart_state_id'])) {
                     $data['virtuemart_state_id'] = 0;
                 }
                 if (!($msg = VirtueMartModelState::testStateCountry($data['virtuemart_country_id'], $data['virtuemart_state_id']))) {
                     //The state is invalid, so we set the state 0 here.
                     $data['virtuemart_state_id'] = 0;
                     vmdebug('State was not fitting to country, set virtuemart_state_id to 0');
                 } else {
                     if (empty($data['virtuemart_state_id'])) {
                         vmdebug('virtuemart_state_id is empty, but valid (country has not states, set to unrequired');
                         $field->required = false;
                     } else {
                         //vmdebug('validateUserData my country '.$data['virtuemart_country_id'].' my state '.$data['virtuemart_state_id']);
                     }
                 }
             }
         }
         if ($field->required) {
             $required++;
             if (empty($data[$field->name])) {
                 if ($lang->hasKey('COM_VIRTUEMART_MISSING_' . $field->name)) {
                     $missingFields[] = vmText::_('COM_VIRTUEMART_MISSING_' . $field->name);
                 } else {
                     //vmdebug('my field titel',$field->title);
                     $missingFields[] = vmText::sprintf('COM_VIRTUEMART_MISSING_VALUE_FOR_FIELD', $field->title);
                 }
                 $i++;
                 $return = false;
             } else {
                 if ($data[$field->name] == $field->default) {
                     $i++;
                 } else {
                 }
             }
         }
     }
     if (empty($required)) {
         vmdebug('Nothing to require');
         $return = true;
     } else {
         if ($i == $required) {
             $return = -1;
         }
     }
     //vmdebug('my i '.$i.' my data size '.$required,$return,$showInfo);
     if (!$return or $showInfo) {
         foreach ($missingFields as $fieldname) {
             vmInfo($fieldname);
         }
     }
     return $return;
 }
Example #26
0
 function plgVmOnUserPaymentCancel()
 {
     if (!class_exists('VirtueMartModelOrders')) {
         require VMPATH_ADMIN . DS . 'models' . DS . 'orders.php';
     }
     $virtuemart_paymentmethod_id = JRequest::getInt('pm', 0);
     $order_number = JRequest::getString('on', 0);
     if (!($method = $this->getVmPluginMethod($virtuemart_paymentmethod_id))) {
         return NULL;
         // Another method was selected, do nothing
     }
     if (!$this->selectedThisElement($method->payment_element)) {
         return NULL;
     }
     if (!($virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber($order_number))) {
         return NULL;
     }
     $db = JFactory::getDBO();
     $_q = 'SELECT * FROM `' . $this->_tablename . '` ' . 'WHERE `virtuemart_order_id` = ' . $virtuemart_order_id;
     $db->setQuery($_q);
     if (!($paymentData = $db->loadObject())) {
         // JError::raiseWarning(500, $db->getErrorMsg());
     }
     vmdebug('HEIDELPAY paymentdata', $paymentData);
     if ($paymentData->processing_result == "NOK") {
         vmError('VMPAYMENT_HEIDELPAY_PAYMENT_FAILED', 'VMPAYMENT_HEIDELPAY_PAYMENT_FAILED');
         vmError(" - " . $paymentData->comment, " - " . $paymentData->comment);
         $order['comments'] = "";
         if ($virtuemart_order_id) {
             $order['customer_notified'] = 0;
             $order['order_status'] = $this->getStatus($method, $paymentData->processing_result);
             $modelOrder = VmModel::getModel('orders');
             $orderitems = $modelOrder->getOrder($virtuemart_order_id);
             $nb_history = count($orderitems['history']);
             if ($orderitems['history'][$nb_history - 1]->order_status_code != $order['order_status']) {
                 if ($method->HEIDELPAY_CONFIRM_EMAIL == 1 or $method->HEIDELPAY_CONFIRM_EMAIL == 2 and $paymentData->processing_result == "ACK") {
                     $order['customer_notified'] = 1;
                     $order['comments'] = vmText::sprintf('VMPAYMENT_HEIDELPAY_EMAIL_SENT') . "<br />";
                 }
                 $order['comments'] .= $paymentData->comment;
                 $modelOrder->updateStatusForOneOrder($virtuemart_order_id, $order, TRUE);
             }
         }
     }
     $order_number = JRequest::getVar('on');
     if (!$order_number) {
         return FALSE;
     }
     $virtuemart_paymentmethod_id = vRequest::getInt('pm', '');
     if (empty($order_number) or empty($virtuemart_paymentmethod_id) or !$this->selectedThisByMethodId($virtuemart_paymentmethod_id)) {
         return NULL;
     }
     $db = JFactory::getDBO();
     $query = 'SELECT ' . $this->_tablename . '.`virtuemart_order_id` FROM ' . $this->_tablename . " WHERE  `order_number`= '" . $order_number . "'";
     $db->setQuery($query);
     $virtuemart_order_id = $db->loadResult();
     if (!$virtuemart_order_id) {
         return NULL;
     }
     return TRUE;
 }
    ?>
</th>
								<th style="text-align: left !important;"><?php 
    echo vmText::_('COM_VIRTUEMART_PRODUCT_FORM_IN_STOCK');
    ?>
</th>
								<th style="text-align: left !important;" width="5%"><?php 
    echo vmText::_('COM_VIRTUEMART_PRODUCT_FORM_ORDERED_STOCK');
    ?>
</th>
								<?php 
    foreach ($customs as $custom) {
        ?>
									<th>
										<?php 
        echo vmText::sprintf('COM_VIRTUEMART_PRODUCT_CUSTOM_FIELD_N', vmText::_('COM_VIRTUEMART_' . strtoupper($custom->custom_value)));
        ?>
									</th>
								<?php 
    }
    ?>
								<th><?php 
    echo vmText::_('COM_VIRTUEMART_ORDERING');
    ?>
</th>
								<th><?php 
    echo vmText::_('COM_VIRTUEMART_PUBLISHED');
    ?>
 foo</th>
							</tr>
							<?php 
Example #28
0
 /**
  * Save task for review
  *
  * @author Max Milbers
  */
 function cancelEditReview()
 {
     $virtuemart_product_id = vRequest::getInt('virtuemart_product_id');
     if (is_array($virtuemart_product_id) && count($virtuemart_product_id) > 0) {
         $virtuemart_product_id = (int) $virtuemart_product_id[0];
     } else {
         $virtuemart_product_id = (int) $virtuemart_product_id;
     }
     $msg = vmText::sprintf('COM_VIRTUEMART_STRING_CANCELLED', $this->mainLangKey);
     //'COM_VIRTUEMART_OPERATION_CANCELED'
     $this->setRedirect('index.php?option=com_virtuemart&view=ratings&task=listreviews&virtuemart_product_id=' . $virtuemart_product_id, $msg);
 }
 private function handle3DSRequest()
 {
     $realexInterface = $this->initRealexInterface(false);
     $cart = VirtueMartCart::getCart();
     $realexInterface->setCart($cart, false);
     $saved_cc_selected = $this->customerData->getVar('saved_cc_selected');
     $realvault = false;
     if ($saved_cc_selected > 0) {
         $realvault = $realexInterface->getStoredCCsData($saved_cc_selected);
         $realvault->cc_cvv_realvault = $this->customerData->getVar('cc_cvv_realvault');
         $this->customerData->saveCustomerRealVaultData((array) $realvault);
     }
     if (!($payments = $this->getDatasByOrderId($realexInterface->order['details']['BT']->virtuemart_order_id))) {
         $this->redirectToCart();
         return FALSE;
     }
     $dcc_payment = $realexInterface->getTransactionData($payments, array($realexInterface::REQUEST_TYPE_DCCRATE, $realexInterface::REQUEST_TYPE_REALVAULT_DCCRATE));
     if ($dcc_payment) {
         $xml_dcc_payment = simplexml_load_string($dcc_payment->realex_hpp_api_fullresponse);
     } else {
         $xml_dcc_payment = NULL;
     }
     $response3DSVerifysig = $realexInterface->request3DSVerifysig($realvault);
     $realexInterface->manageResponse3DSVerifysig($response3DSVerifysig);
     $eci = $realexInterface->getEciFrom3DSVerifysig($response3DSVerifysig, $this->_currentMethod->require_liability);
     $xml_response3DSVerifysig = simplexml_load_string($response3DSVerifysig);
     if ($eci !== false) {
         $xml_response3DSVerifysig->threedsecure->eci = $eci;
         if ($realvault) {
             $response = $realexInterface->requestReceiptIn($realvault, $xml_dcc_payment, $xml_response3DSVerifysig);
         } else {
             $response = $realexInterface->requestAuth($xml_dcc_payment, $xml_response3DSVerifysig);
         }
         $realexInterface->manageResponseRequestAuth($response);
         $xml_response = simplexml_load_string($response);
         $success = $realexInterface->isResponseSuccess($xml_response);
     } else {
         $success = false;
     }
     $order_history = array();
     $redirectToCart = false;
     if ($success) {
         $userfield = $realexInterface->handleCardStorage($saved_cc_selected);
         $realexInterface->storeNewPayment($userfield);
         $status = $this->_currentMethod->status_success;
         $amountValue = vmPSPlugin::getAmountInCurrency($realexInterface->order['details']['BT']->order_total, $realexInterface->order['details']['BT']->order_currency);
         $currencyDisplay = CurrencyDisplay::getInstance($realexInterface->cart->pricesCurrency);
         $order_history['comments'] = vmText::sprintf('VMPAYMENT_REALEX_HPP_API_PAYMENT_STATUS_CONFIRMED', $amountValue['display'], $realexInterface->order['details']['BT']->order_number);
         if (isset($xml_response->dccinfo) and isset($xml_response->dccinfo->cardholderrate)) {
             $order_history['comments'] .= "<br />";
             if ($xml_response->dccinfo->cardholderrate != 1.0) {
                 $order_history['comments'] .= vmText::sprintf('VMPAYMENT_REALEX_HPP_API_DCC_PAY_OWN_CURRENCY_CHARGED', $this->getCardHolderAmount($xml_response->dccinfo->merchantamount), $xml_response->dccinfo->merchantcurrency, $this->getCardHolderAmount($xml_response->dccinfo->cardholderamount), $xml_response->dccinfo->cardholdercurrency);
             } else {
                 $order_history['comments'] .= vmText::sprintf('VMPAYMENT_REALEX_HPP_API_DCC_PAY_MERCHANT_CURRENCY', $this->getCardHolderAmount($xml_response->dccinfo->merchantamount), $xml_response->dccinfo->merchantcurrency);
             }
             $order_history['comments'] .= "<br />";
         } else {
         }
     } else {
         $msgToShopper = '';
         $status = $this->_currentMethod->status_canceled;
         if ($realexInterface->isResponseDeclined($xml_response3DSVerifysig)) {
             $order_history['comments'] = vmText::sprintf('VMPAYMENT_REALEX_HPP_API_PAYMENT_DECLINED', $realexInterface->order['details']['BT']->order_number);
             $msgToShopper = $xml_response3DSVerifysig->message;
         } elseif ($realexInterface->isResponseWrongPhrase($xml_response3DSVerifysig)) {
             $order_history['comments'] = vmText::sprintf('VMPAYMENT_REALEX_HPP_API_PAYMENT_STATUS_CANCELLED', $realexInterface->order['details']['BT']->order_number);
             $msgToShopper = $xml_response3DSVerifysig->message;
         } elseif ($realexInterface->isResponseAlreadyProcessed($xml_response3DSVerifysig)) {
             $order_history['comments'] = $xml_response3DSVerifysig->message;
             $msgToShopper = $xml_response3DSVerifysig->message;
             // log this response, but do not change the order status
             $status = $realexInterface->order['details']['BT']->order_status;
             /* } elseif ($xml_response and $realexInterface->isResponseInvalidPaymentDetails($xml_response)) {
             
             					$order_history['comments'] =$xml_response->message;
             					if ($realvault) {
             						$accountURL=JRoute::_('index.php?option=com_virtuemart&view=user&layout=edit');
             						$msgToShopper=vmText::sprintf('VMPAYMENT_REALEX_HPP_API_INVALID_PAYMENT_DETAILS_REALVAULT',$xml_response->message, $accountURL);
             					} else {
             						$msgToShopper=vmText::sprintf('VMPAYMENT_REALEX_HPP_API_INVALID_PAYMENT_DETAILS',$xml_response->message);
             					}
             	*/
         } else {
             $order_history['comments'] = vmText::sprintf('VMPAYMENT_REALEX_HPP_API_PAYMENT_STATUS_CANCELLED', $realexInterface->order['details']['BT']->order_number);
         }
         $redirectToCart = true;
     }
     $order_history['customer_notified'] = true;
     $order_history['order_status'] = $status;
     //	$this->updateOrderStatus($realexInterface->order, $redirectToCart);
     $modelOrder = VmModel::getModel('orders');
     $modelOrder->updateStatusForOneOrder($realexInterface->order['details']['BT']->virtuemart_order_id, $order_history, false);
     /*
     		$payments = $this->getDatasByOrderId($realexInterface->order['details']['BT']->virtuemart_order_id);
     
     		$html = $realexInterface->getResponseHTML($payments);
     		$this->customerData->clear();
     		$cart = VirtueMartCart::getCart();
     		$cart->emptyCart();
     		vRequest::setVar('display_title', false);
     		vRequest::setVar('html', $html);
     		echo $html;
     */
     //$html = $realexInterface->getResponseHTML($payments);
     if ($redirectToCart) {
         $this->redirectToCart($msgToShopper);
     } else {
         $this->customerData->clear();
         $cart = VirtueMartCart::getCart();
         $cart->emptyCart();
         $submit_url = JURI::root() . 'index.php?option=com_virtuemart&view=pluginresponse&task=pluginresponsereceived&pm=' . $this->_currentMethod->virtuemart_paymentmethod_id . '&on=' . $realexInterface->order['details']['BT']->order_number . '&Itemid=' . vRequest::getInt('Itemid') . '&lang=' . vRequest::getCmd('lang', '');
         $app = JFactory::getApplication();
         $app->redirect(JRoute::_($submit_url));
     }
     return true;
 }
Example #30
0
 /**
  * Proceeds the simple payment
  * http://developer.authorize.net/guides/AIM/wwhelp/wwhimpl/js/html/wwhelp.htm#href=4_TransResponse.6.4.html
  * @param string $resp
  * @param array $submitted_values
  * @return object Message object
  *
  */
 function _handleResponse($response, $submitted_values, $order, $payment_name)
 {
     $delimiter = $this->_authorizenet_params['delim_char'];
     $encap_char = $this->_authorizenet_params['encap_char'];
     if ($response) {
         // Split Array
         if ($encap_char) {
             //$response_array = explode($encap_char . $delimiter . $encap_char, substr($response, 1, -1));
             $response_array = explode($encap_char, $response);
         } else {
             $response_array = explode($delimiter, $response);
         }
         /**
          * If AuthorizeNet doesn't return a delimited response.
          */
         if (count($response_array) < 10) {
             $this->approved = FALSE;
             $this->error = TRUE;
             $error_message = vmText::_('VMPAYMENT_AUTHORIZENET_UNKNOWN') . $response;
             $this->debugLog($error_message, 'getOrderIdByOrderNumber', 'error');
             return $error_message;
         }
         $authorizeNetResponse['response_code'] = $response_array[0];
         $this->approved = $authorizeNetResponse['response_code'] == self::APPROVED;
         $this->declined = $authorizeNetResponse['response_code'] == self::DECLINED;
         $this->error = $authorizeNetResponse['response_code'] == self::ERROR;
         $this->held = $authorizeNetResponse['response_code'] == self::HELD;
         $authorizeNetResponse['response_subcode'] = $response_array[1];
         $authorizeNetResponse['response_reason_code'] = $response_array[2];
         $authorizeNetResponse['response_reason_text'] = $response_array[3];
         $authorizeNetResponse['authorization_code'] = $response_array[4];
         $authorizeNetResponse['avs_response'] = $response_array[5];
         //Address Verification Service
         $authorizeNetResponse['transaction_id'] = $response_array[6];
         $authorizeNetResponse['invoice_number'] = $response_array[7];
         $authorizeNetResponse['description'] = $response_array[8];
         if ($this->approved) {
             $authorizeNetResponse['amount'] = $response_array[9];
             $authorizeNetResponse['method'] = $response_array[10];
             $authorizeNetResponse['transaction_type'] = $response_array[11];
             $authorizeNetResponse['customer_id'] = $response_array[12];
             $authorizeNetResponse['first_name'] = $response_array[13];
             $authorizeNetResponse['last_name'] = $response_array[14];
             $authorizeNetResponse['company'] = $response_array[15];
             $authorizeNetResponse['address'] = $response_array[16];
             $authorizeNetResponse['city'] = $response_array[17];
             $authorizeNetResponse['state'] = $response_array[18];
             $authorizeNetResponse['zip_code'] = $response_array[19];
             $authorizeNetResponse['country'] = $response_array[20];
             $authorizeNetResponse['phone'] = $response_array[21];
             $authorizeNetResponse['fax'] = $response_array[22];
             $authorizeNetResponse['email_address'] = $response_array[23];
             $authorizeNetResponse['ship_to_first_name'] = $response_array[24];
             $authorizeNetResponse['ship_to_last_name'] = $response_array[25];
             $authorizeNetResponse['ship_to_company'] = $response_array[26];
             $authorizeNetResponse['ship_to_address'] = $response_array[27];
             $authorizeNetResponse['ship_to_city'] = $response_array[28];
             $authorizeNetResponse['ship_to_state'] = $response_array[29];
             $authorizeNetResponse['ship_to_zip_code'] = $response_array[30];
             $authorizeNetResponse['ship_to_country'] = $response_array[31];
             $authorizeNetResponse['tax'] = $response_array[32];
             $authorizeNetResponse['duty'] = $response_array[33];
             $authorizeNetResponse['freight'] = $response_array[34];
             $authorizeNetResponse['tax_exempt'] = $response_array[35];
             $authorizeNetResponse['purchase_order_number'] = $response_array[36];
             $authorizeNetResponse['md5_hash'] = $response_array[37];
             $authorizeNetResponse['card_code_response'] = $response_array[38];
             $authorizeNetResponse['cavv_response'] = $response_array[39];
             //// cardholder_authentication_verification_response
             $authorizeNetResponse['account_number'] = $response_array[50];
             $authorizeNetResponse['card_type'] = $response_array[51];
             $authorizeNetResponse['split_tender_id'] = $response_array[52];
             $authorizeNetResponse['requested_amount'] = $response_array[53];
             $authorizeNetResponse['balance_on_card'] = $response_array[54];
         }
         if ($this->error or $this->declined) {
             // Prepare data that should be stored in the database
             $dbValues['authorizenet_response_response_code'] = $authorizeNetResponse['response_code'];
             $dbValues['authorizenet_response_response_subcode'] = $authorizeNetResponse['response_subcode'];
             $dbValues['authorizenet_response_response_reason_code'] = $authorizeNetResponse['response_reason_code'];
             $dbValues['authorizenet_response_response_reason_text'] = $authorizeNetResponse['response_reason_text'];
             //$this->storePSPluginInternalData($dbValues, 'id', true);
             $html = vmText::sprintf('VMPAYMENT_AUTHORIZENET_ERROR', $authorizeNetResponse['response_reason_text'], $authorizeNetResponse['response_code']) . "<br />";
             $this->debugLog($html, '_handleResponse PAYMENT DECLINED', 'message');
             return $html;
         }
         $virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber($authorizeNetResponse['invoice_number']);
         if (!$virtuemart_order_id) {
             $this->approved = FALSE;
             $this->error = TRUE;
             $this->debugLog(vmText::sprintf('VMPAYMENT_AUTHORIZENET_NO_ORDER_NUMBER', $authorizeNetResponse['invoice_number']), 'getOrderIdByOrderNumber', 'error');
             $html = vmText::sprintf('VMPAYMENT_AUTHORIZENET_ERROR', $authorizeNetResponse['response_reason_text'], $authorizeNetResponse['response_code']) . "<br />";
             $this->debugLog($html, '_handleResponse PAYMENT DECLINED', 'message');
             return $html;
         }
     } else {
         $this->approved = FALSE;
         $this->error = TRUE;
         $this->debugLog(vmText::_('VMPAYMENT_AUTHORIZENET_CONNECTING_ERROR'), '_handleResponse', 'error');
         return vmText::_('VMPAYMENT_AUTHORIZENET_CONNECTING_ERROR');
     }
     // Prep
     // get all know columns of the table
     $db = JFactory::getDBO();
     $query = 'SHOW COLUMNS FROM `' . $this->_tablename . '` ';
     $db->setQuery($query);
     $columns = $db->loadColumn(0);
     foreach ($authorizeNetResponse as $key => $value) {
         $table_key = 'authorizenet_response_' . $key;
         if (in_array($table_key, $columns)) {
             $response_fields[$table_key] = $value;
         }
     }
     $response_fields['virtuemart_order_id'] = $virtuemart_order_id;
     $response_fields['invoice_number'] = $authorizeNetResponse['invoice_number'];
     $response_fields['authorizeresponse_raw'] = $response;
     $this->storePSPluginInternalData($response_fields, 'virtuemart_order_id', TRUE);
     $html = '<table class="adminlist table">' . "\n";
     $html .= $this->getHtmlRow('AUTHORIZENET_PAYMENT_NAME', $payment_name);
     $html .= $this->getHtmlRow('AUTHORIZENET_ORDER_NUMBER', $authorizeNetResponse['invoice_number']);
     $html .= $this->getHtmlRow('AUTHORIZENET_AMOUNT', $authorizeNetResponse['amount'] . ' ' . self::AUTHORIZE_DEFAULT_PAYMENT_CURRENCY);
     //$html .= $this->getHtmlRow('AUTHORIZENET_RESPONSE_AUTHORIZATION_CODE', $authorizeNetResponse['authorization_code']);
     $html .= $this->getHtmlRow('AUTHORIZENET_RESPONSE_TRANSACTION_ID', $authorizeNetResponse['transaction_id']);
     $html .= '</table>' . "\n";
     $this->debugLog(vmText::_('VMPAYMENT_AUTHORIZENET_ORDER_NUMBER') . " " . $authorizeNetResponse['invoice_number'] . ' payment approved', '_handleResponse', 'debug');
     return $html;
 }