/**
     * This shows the plugin for choosing in the payment list of the checkout process.
     *
     * @author Valerie Cartan Isaksen
     */
    function plgVmDisplayListFEPayment(VirtueMartCart $cart, $selected = 0, &$htmlIn)
    {
        //JHTML::_ ('behavior.tooltip');
        if ($this->getPluginMethods($cart->vendorId) === 0) {
            if (empty($this->_name)) {
                $app = JFactory::getApplication();
                $app->enqueueMessage(vmText::_('COM_VIRTUEMART_CART_NO_' . strtoupper($this->_psType)));
                return FALSE;
            } else {
                return FALSE;
            }
        }
        $html = array();
        $method_name = $this->_psType . '_name';
        JHTML::script('vmcreditcard.js', 'components/com_virtuemart/assets/js/', FALSE);
        VmConfig::loadJLang('com_virtuemart', true);
        vmJsApi::jCreditCard();
        $htmla = '';
        $html = array();
        foreach ($this->methods as $this->_currentMethod) {
            if ($this->checkConditions($cart, $this->_currentMethod, $cart->cartPrices)) {
                $methodSalesPrice = $this->setCartPrices($cart, $cart->cartPrices, $this->_currentMethod);
                $this->_currentMethod->{$method_name} = $this->renderPluginName($this->_currentMethod);
                $html = $this->getPluginHtml($this->_currentMethod, $selected, $methodSalesPrice);
                if ($selected == $this->_currentMethod->virtuemart_paymentmethod_id) {
                    $this->_getAuthorizeNetFromSession();
                } else {
                    $this->_cc_type = '';
                    $this->_cc_number = '';
                    $this->_cc_cvv = '';
                    $this->_cc_expire_month = '';
                    $this->_cc_expire_year = '';
                }
                if (empty($this->_currentMethod->creditcards)) {
                    $this->_currentMethod->creditcards = self::getCreditCards();
                } elseif (!is_array($this->_currentMethod->creditcards)) {
                    $this->_currentMethod->creditcards = (array) $this->_currentMethod->creditcards;
                }
                $creditCards = $this->_currentMethod->creditcards;
                $creditCardList = '';
                if ($creditCards) {
                    $creditCardList = $this->_renderCreditCardList($creditCards, $this->_cc_type, $this->_currentMethod->virtuemart_paymentmethod_id, FALSE);
                }
                $sandbox_msg = "";
                if ($this->_currentMethod->sandbox) {
                    $sandbox_msg .= '<br />' . vmText::_('VMPAYMENT_AUTHORIZENET_SANDBOX_TEST_NUMBERS');
                }
                $cvv_images = $this->_displayCVVImages($this->_currentMethod);
                $html .= '<br /><span class="vmpayment_cardinfo">' . vmText::_('VMPAYMENT_AUTHORIZENET_COMPLETE_FORM') . $sandbox_msg . '
		    <table border="0" cellspacing="0" cellpadding="2" width="100%">
		    <tr valign="top">
		        <td nowrap width="10%" align="right">
		        	<label for="creditcardtype">' . vmText::_('VMPAYMENT_AUTHORIZENET_CCTYPE') . '</label>
		        </td>
		        <td>' . $creditCardList . '</td>
		    </tr>
		    <tr valign="top">
		        <td nowrap width="10%" align="right">
		        	<label for="cc_type">' . vmText::_('VMPAYMENT_AUTHORIZENET_CCNUM') . '</label>
		        </td>
		        <td>
				<script type="text/javascript">
				//<![CDATA[  
				  function checkAuthorizeNet(id, el)
				   {
				     ccError=razCCerror(id);
					CheckCreditCardNumber(el.value, id);
					if (!ccError) {
					el.value=\'\';}
				   }
				//]]> 
				</script>
		        <input type="text" class="inputbox" id="cc_number_' . $this->_currentMethod->virtuemart_paymentmethod_id . '" name="cc_number_' . $this->_currentMethod->virtuemart_paymentmethod_id . '" value="' . $this->_cc_number . '"    autocomplete="off"   onchange="javascript:checkAuthorizeNet(' . $this->_currentMethod->virtuemart_paymentmethod_id . ', this);"  />
		        <div id="cc_cardnumber_errormsg_' . $this->_currentMethod->virtuemart_paymentmethod_id . '"></div>
		    </td>
		    </tr>
		    <tr valign="top">
		        <td nowrap width="10%" align="right">
		        	<label for="cc_cvv">' . vmText::_('VMPAYMENT_AUTHORIZENET_CVV2') . '</label>
		        </td>
		        <td>
		            <input type="text" class="inputbox" id="cc_cvv_' . $this->_currentMethod->virtuemart_paymentmethod_id . '" name="cc_cvv_' . $this->_currentMethod->virtuemart_paymentmethod_id . '" maxlength="4" size="5" value="' . $this->_cc_cvv . '" autocomplete="off" />

			<span class="hasTip" title="' . vmText::_('VMPAYMENT_AUTHORIZENET_WHATISCVV') . '::' . vmText::sprintf("VMPAYMENT_AUTHORIZENET_WHATISCVV_TOOLTIP", $cvv_images) . ' ">' . vmText::_('VMPAYMENT_AUTHORIZENET_WHATISCVV') . '
			</span></td>
		    </tr>
		    <tr>
		        <td nowrap width="10%" align="right">' . vmText::_('VMPAYMENT_AUTHORIZENET_EXDATE') . '</td>
		        <td> ';
                $html .= shopfunctions::listMonths('cc_expire_month_' . $this->_currentMethod->virtuemart_paymentmethod_id, $this->_cc_expire_month);
                $html .= " / ";
                $html .= '
				<script type="text/javascript">
				//<![CDATA[  
				  function changeDate(id, el)
				   {
				     var month = document.getElementById(\'cc_expire_month_\'+id); if(!CreditCardisExpiryDate(month.value,el.value, id))
					 {el.value=\'\';
					 month.value=\'\';}
				   }
				//]]> 
				</script>';
                $html .= shopfunctions::listYears('cc_expire_year_' . $this->_currentMethod->virtuemart_paymentmethod_id, $this->_cc_expire_year, NULL, 2022, " onchange=\"javascript:changeDate(" . $this->_currentMethod->virtuemart_paymentmethod_id . ", this);\" ");
                $html .= '<div id="cc_expiredate_errormsg_' . $this->_currentMethod->virtuemart_paymentmethod_id . '"></div>';
                $html .= '</td>  </tr>  	</table></span>';
                $htmla[] = $html;
            }
        }
        $htmlIn[] = $htmla;
        return TRUE;
    }
Exemple #2
0
    ?>

	<?php 
    if (isset($ccData['cc_expire_month']) or isset($ccData['cc_expire_year'])) {
        ?>
		<div class="vmpayment_cc_info vmpayment_cc_date">
				<span class="vmpayment_label"><label
						for="creditcardtype"><?php 
        echo vmText::_('VMPAYMENT_REALEX_HPP_API_CC_EXPDATE');
        ?>
</label></span>
			<?php 
        if (!$viewData['dccinfo']) {
            ?>
				<?php 
            echo shopfunctions::listMonths('cc_expire_month', $ccData['cc_expire_month'], "class=\"inputbox vm-chzn-select\" style=\"width: 100px;\"", 'm');
            echo shopfunctions::listYears('cc_expire_year', $ccData['cc_expire_year'], null, null, "class=\"inputbox vm-chzn-select\" style=\"width: 100px;\"  onchange=\"var month = document.getElementById('cc_expire_month_'" . $viewData['virtuemart_paymentmethod_id'] . "); if(!CreditCardisExpiryDate(month.value,this.value, '" . $viewData['virtuemart_paymentmethod_id'] . "')){this.value='';month.value='';}\" ", "y");
            ?>
				<div id="cc_expiredate_errormsg"></div>
			<?php 
        } else {
            echo $ccData['cc_expire_month'] . '/' . $ccData['cc_expire_year'];
            ?>
				<input type="hidden" name="cc_expire_month" value="<?php 
            echo $ccData['cc_expire_month'];
            ?>
"/>
				<input type="hidden" name="cc_expire_year" value="<?php 
            echo $ccData['cc_expire_year'];
            ?>
"/>
				<?php 
    echo $storedCreditCard->realex_hpp_api_saved_pmt_digits;
    ?>

			</div>

			<div class="vmpayment_cc_info vmpayment_cc_date">
				<span class="vmpayment_label"><label
						for="creditcardtype"><?php 
    echo tsmText::_('VMPAYMENT_REALEX_HPP_API_CC_EXPDATE');
    ?>
</label></span>
				<?php 
    $exp_date = $this->explodeExpDate($storedCreditCard->realex_hpp_api_saved_pmt_expdate);
    if (count($exp_date) == 2) {
        echo shopfunctions::listMonths('cc_expire_month_' . $storedCreditCard->id, $exp_date['mm'], "class=\"inputbox vm-chzn-select\" style=\"width: 100px;\"", 'm');
        echo shopfunctions::listYears('cc_expire_year_' . $storedCreditCard->id, $exp_date['yy'], null, null, "class=\"inputbox vm-chzn-select\" style=\"width: 100px;\"  onchange=\"var month = document.getElementById('cc_expire_month_'" . $storedCreditCard->virtuemart_paymentmethod_id . "); if(!CreditCardisExpiryDate(month.value,this.value, '" . $storedCreditCard->virtuemart_paymentmethod_id . "')){this.value='';month.value='';}\" ", 'y');
    }
    ?>
				<div id="cc_expiredate_errormsg"></div>

			</div>
			<div class="vmpayment_cc_info vmpayment_cc_name">

				<span class="vmpayment_label"><label
						for="cc_name"><?php 
    echo tsmText::_('VMPAYMENT_REALEX_HPP_API_CC_CCNAME');
    ?>
</label></span>

				<input type="text" size="30" class="inputbox" id="cc_name"
::<?php 
echo vmText::sprintf("VMPAYMENT_PAYPAL_CC_WHATISCVV_TOOLTIP", $this->_displayCVVImages($viewData['method']));
?>
 ">
                        <?php 
echo vmText::_('VMPAYMENT_PAYPAL_CC_WHATISCVV');
?>
                    </span>
                </td>
            </tr>
            <tr>
                <td nowrap width="10%" align="right"><?php 
echo vmText::_('VMPAYMENT_PAYPAL_CC_EXDATE');
?>
</td>
                <td>
                    <?php 
echo shopfunctions::listMonths('cc_expire_month_' . $viewData['virtuemart_paymentmethod_id'], $customerData->getVar('cc_expire_month'));
echo " / ";
echo shopfunctions::listYears('cc_expire_year_' . $viewData['virtuemart_paymentmethod_id'], $customerData->getVar('cc_expire_year'), null, null, "onchange=\"var month = document.getElementById('cc_expire_month_'" . $viewData['virtuemart_paymentmethod_id'] . "); if(!CreditCardisExpiryDate(month.value,this.value, '" . $viewData['virtuemart_paymentmethod_id'] . "')){this.value='';month.value='';}\" ");
?>
                    <div id="cc_expiredate_errormsg_<?php 
echo $viewData['virtuemart_paymentmethod_id'];
?>
"></div>
                </td>
            </tr>
        </table>
    </span>
</div>
    /**
     * plgVmDisplayListFEPayment
     * This event is fired to display the pluginmethods in the cart (edit shipment/payment) for exampel
     *
     * @param object $cart Cart object
     * @param integer $selected ID of the method selected
     * @return boolean True on succes, false on failures, null when this plugin was not selected.
     * On errors, JError::raiseWarning (or JError::raiseError) must be used to set a message.
     *
     * @author Max Kimmel
     */
    public function plgVmDisplayListFEPayment(VirtueMartCart $cart, $selected = 0, &$htmlIn)
    {
        if ($this->getPluginMethods($cart->vendorId) === 0) {
            if (empty($this->_name)) {
                $app = JFactory::getApplication();
                $app->enqueueMessage(JText::_('COM_VIRTUEMART_CART_NO_' . strtoupper($this->_psType)));
                return FALSE;
            } else {
                return FALSE;
            }
        }
        JFactory::getLanguage()->load('com_virtuemart');
        //MAX: use loop if payment method is used multiple times (no limitation by VM possible at the moment)
        foreach ($this->methods as $method) {
            if ($this->checkConditions($cart, $method, $cart->pricesUnformatted)) {
                $methodSalesPrice = $this->calculateSalesPrice($cart, $method, $cart->pricesUnformatted);
                //$method->$method_name = $this->renderPluginName ($method);
                $html = $this->getPluginHtml($method, $selected, $methodSalesPrice);
                $html .= '
					<script type="text/javascript" src="https://bridge.paymill.de/"></script>
					<script type="text/javascript" src="' . JURI::root() . 'plugins/vmpayment/paymill/assets/js/paymill.js"></script>
					<script type="text/javascript">
						PAYMILL_PUBLIC_KEY = "' . $method->public_key . '";
						checkBridge();
					</script>
					<br />
					<span class="vmpayment_cardinfo">' . JText::_('VMPAYMENT_PAYMILL_COMPLETE_FORM') . '
		    		<div id="iframeerror"></div>

		    		<table border="0" cellspacing="0" cellpadding="2" width="100%">
		    			<tr valign="top">
					        <td nowrap width="10%" align="right">
					        	<label for="cardholdername">' . JText::_('VMPAYMENT_PAYMILL_CREDITCARDOWNER') . '</label>
					        </td>
					        <td>
					        	<input type="text" id="cardholdername" />
					        </td>
		    			</tr>
		    			<tr valign="top">
					        <td nowrap width="10%" align="right">
					        	<label for="cardnumber">' . JText::_('VMPAYMENT_PAYMILL_CREDITCARDNUMBER') . '</label>
					        </td>
					        <td>
					        	<input type="text" id="cardnumber" />
					        </td>
		    			</tr>
					    <tr valign="top">
					        <td nowrap width="10%" align="right">
					        	<label for="cardCvc">' . JText::_('VMPAYMENT_PAYMILL_CVC') . '</label>
					        </td>
					        <td>
			        			<input type="text" id="cardCvc" maxlength="4" size="5" />
								<span class="hasTip" title="' . JText::sprintf("VMPAYMENT_PAYMILL_WHATISCVC_TOOLTIP", $cvc_images) . ' ">' . JText::_('VMPAYMENT_PAYMILL_WHATISCVC') . '
								</span>
						    </td>
		    			</tr>
		    			<tr>
		        			<td nowrap width="10%" align="right">' . JText::_('VMPAYMENT_PAYMILL_EXDATE') . '</td>
		        			<td> ' . shopfunctions::listMonths('cardExpMonth', $this->_cc_expire_month) . ' / ' . shopfunctions::listYears('cardExpYear', $this->_cc_expire_year, NULL, 2022) . '</td>
		        		</tr>
		        	</table>
		        	<input type="hidden" id="pm_amount" name="pm_amount" value="' . $cart->pricesUnformatted["billTotal"] . '" />
		        	<input type="hidden" id="paymillTokenField" name="paymillToken" />
		        	<input type="hidden" id="pm_email" name="pm_email" />
		        	<input type="hidden" id="root_url" value="' . JURI::root() . '" />
		        	<input type="hidden" id="formerror" />
		        	<input type="hidden" name="vm_paymentmethod_id" id="vm_paymentmethod_id" value="' . $method->virtuemart_paymentmethod_id . '" />

		        	<div id="loader" style="display: none">' . JText::_('VMPAYMENT_PAYMILL_PAYMENT_IS_PROCEEDED') . '...</div>
		        	<div id="paymentErrors"></div>
		        	<div id="result" style="display: none"><span style="color: #009900">Daten erfolgreich eingegeben!</span></div>
		        	<img id="loadergif" src="plugins/vmpayment/paymill/assets/img/loader2.gif" style="display: none; margin: 0px 10px" />
		        	</span>';
                $htmla[] = $html;
            }
        }
        $htmlIn[] = $htmla;
        //return $this->displayListFE($cart, $selected, $htmlIn);
    }
    /**
     * This shows the plugin for choosing in the payment list of the checkout process.
     *
     * @author Valerie Cartan Isaksen
     */
    function plgVmDisplayListFEPayment(VirtueMartCart $cart, $selected = 0, &$htmlIn)
    {
        JHTML::_('behavior.tooltip');
        if ($this->getPluginMethods($cart->vendorId) === 0) {
            if (empty($this->_name)) {
                $app = JFactory::getApplication();
                $app->enqueueMessage(JText::_('COM_VIRTUEMART_CART_NO_' . strtoupper($this->_psType)));
                return false;
            } else {
                return false;
            }
        }
        $html = array();
        $method_name = $this->_psType . '_name';
        JHTML::script('vmcreditcard.js', 'components/com_virtuemart/assets/js/', false);
        JFactory::getLanguage()->load('com_virtuemart');
        vmJsApi::jCreditCard();
        $htmla = '';
        $html = array();
        foreach ($this->methods as $method) {
            if ($this->checkConditions($cart, $method, $cart->pricesUnformatted)) {
                $methodSalesPrice = $this->calculateSalesPrice($cart, $method, $cart->pricesUnformatted);
                $method->{$method_name} = $this->renderPluginName($method);
                $html = $this->getPluginHtml($method, $selected, $methodSalesPrice);
                if ($selected == $method->virtuemart_paymentmethod_id) {
                    if (!empty($authorizeSession->cc_type)) {
                        $this->_cc_type = $authorizeSession->cc_type;
                    }
                    if (!empty($authorizeSession->cc_number)) {
                        $this->_cc_number = $authorizeSession->cc_number;
                    }
                    if (!empty($authorizeSession->cc_cvv)) {
                        $this->_cc_cvv = $authorizeSession->cc_cvv;
                    }
                    if (!empty($authorizeSession->cc_expire_month)) {
                        $this->_cc_expire_month = $authorizeSession->cc_expire_month;
                    }
                    if (!empty($authorizeSession->cart_cc_expire_year)) {
                        $this->_cc_expire_year = $authorizeSession->_cc_expire_year;
                    }
                } else {
                    $this->_cc_type = '';
                    $this->_cc_number = '';
                    $this->_cc_cvv = '';
                    $this->_cc_expire_month = '';
                    $this->_cc_expire_year = '';
                }
                $creditCards = $method->creditcards;
                $creditCardList = '';
                if ($creditCards) {
                    $creditCardList = $this->_renderCreditCardList($creditCards, $this->_cc_type, $method->virtuemart_paymentmethod_id, false);
                }
                $sandbox_msg = "";
                if ($method->sandbox) {
                    $sandbox_msg .= '<br />' . JText::_('VMPAYMENT_AUTHORIZENET_SANDBOX_TEST_NUMBERS');
                }
                $cvv_images = $this->_displayCVVImages($method);
                $html .= '<br /><span class="vmpayment_cardinfo">' . JText::_('VMPAYMENT_AUTHORIZENET_COMPLETE_FORM') . $sandbox_msg . '
		    <table border="0" cellspacing="0" cellpadding="2" width="100%">
		    <tr valign="top">
		        <td nowrap width="10%" align="right">
		        	<label for="creditcardtype">' . JText::_('VMPAYMENT_AUTHORIZENET_CCTYPE') . '</label>
		        </td>
		        <td>' . $creditCardList . '</td>
		    </tr>

		    <tr valign="top">
		        <td nowrap width="10%" align="right">
		        	<label for="cc_type">' . JText::_('VMPAYMENT_AUTHORIZENET_CCNUM') . '</label>
		        </td>
		        <td>
		        <input type="text" class="inputbox" id="cc_number_' . $method->virtuemart_paymentmethod_id . '" name="cc_number_' . $method->virtuemart_paymentmethod_id . '" value="' . $this->_cc_number . '"    autocomplete="off"   onchange="ccError=razCCerror(' . $method->virtuemart_paymentmethod_id . ');
	CheckCreditCardNumber(this . value, ' . $method->virtuemart_paymentmethod_id . ');
	if (!ccError) {
	    this.value=\'\';}" />
		        <div id="cc_cardnumber_errormsg_' . $method->virtuemart_paymentmethod_id . '"></div>
		    </td>
		    </tr>
		    <tr valign="top">
		        <td nowrap width="10%" align="right">
		        	<label for="cc_cvv">' . JText::_('VMPAYMENT_AUTHORIZENET_CVV2') . '</label>
		        </td>
		        <td>
		            <input type="text" class="inputbox" id="cc_cvv_' . $method->virtuemart_paymentmethod_id . '" name="cc_cvv_' . $method->virtuemart_paymentmethod_id . '" maxlength="4" size="5" value="' . $this->_cc_cvv . '" autocomplete="off" />

			<span class="hasTip" title="' . JText::_('VMPAYMENT_AUTHORIZENET_WHATISCVV') . '::' . JText::sprintf("VMPAYMENT_AUTHORIZENET_WHATISCVV_TOOLTIP", $cvv_images) . ' ">' . JText::_('VMPAYMENT_AUTHORIZENET_WHATISCVV') . '
			</span></td>
		    </tr>
		    <tr>
		        <td nowrap width="10%" align="right">' . JText::_('VMPAYMENT_AUTHORIZENET_EXDATE') . '</td>
		        <td> ';
                $html .= shopfunctions::listMonths('cc_expire_month_' . $method->virtuemart_paymentmethod_id, $this->_cc_expire_month);
                $html .= " / ";
                $html .= shopfunctions::listYears('cc_expire_year_' . $method->virtuemart_paymentmethod_id, $this->_cc_expire_year, null, null, "onchange=\"var month = document.getElementById('cc_expire_month_'.{$method->virtuemart_paymentmethod_id}); if(!CreditCardisExpiryDate(month.value,this.value, '.{$method->virtuemart_paymentmethod_id}.')){this.value='';month.value='';}\" ");
                $html .= '<div id="cc_expiredate_errormsg_' . $method->virtuemart_paymentmethod_id . '"></div>';
                $html .= '</td>  </tr>  	</table></span>';
                $htmla[] = $html;
            }
        }
        $htmlIn[] = $htmla;
        return true;
    }