protected function getOptions() { $creditcards = RealexHelperRealex::getRealexCreditCards(); $prefix = 'VMPAYMENT_REALEX_HPP_API_CC_'; foreach ($creditcards as $creditcard) { $options[] = JHtml::_('select.option', $creditcard, vmText::_($prefix . strtoupper($creditcard))); } return $options; }
protected function getInput() { JFactory::getLanguage()->load('plg_vmpayment_realex_hpp_api', JPATH_ADMINISTRATOR); $creditcards = RealexHelperRealex::getRealexCreditCards(); $prefix = 'VMPAYMENT_REALEX_CC_'; $fields = array(); foreach ($creditcards as $creditcard) { $fields[$creditcard]['value'] = $creditcard; $fields[$creditcard]['text'] = vmText::_($prefix . strtoupper($fields[$creditcard]['value'])); } return JHTML::_('select.genericlist', $creditcards, $this->name, 'size="1"', 'value', 'title', $this->value); }
function fetchElement($name, $value, &$node, $control_name) { JFactory::getLanguage()->load('plg_vmpayment_realex_hpp_api', JPATH_ADMINISTRATOR); $creditcards = RealexHelperRealex::getRealexCreditCards(); $prefix = 'VMPAYMENT_REALEX_HPP_API_CC_'; $fields = array(); foreach ($creditcards as $creditcard) { $fields[$creditcard]['value'] = $creditcard; $fields[$creditcard]['text'] = vmText::_($prefix . strtoupper($fields[$creditcard]['value'])); } $attribs = ' '; $attribs .= ' multiple="multiple"'; $attribs .= $node->attributes('class') ? ' class="' . $node->attributes('class') . '"' : ''; return JHTML::_('select.genericlist', $fields, $control_name . '[' . $name . '][]', $attribs, 'value', 'text', $value, $control_name . $name); }
/** * Validate the response hash from Realex. * timestamp.merchantid.orderid.amount.curr.payerref.pmtref */ function validateResponseHash($post) { if (is_array($post)) { $message = stripslashes($post['MESSAGE']); $message = str_replace(''', "'", $message); $hash = $this->getSha1Hash($this->_method->shared_secret, $post['TIMESTAMP'], $post['MERCHANT_ID'], $post['ORDER_ID'], $post['RESULT'], $message, isset($post['PASREF']) ? $post['PASREF'] : "", isset($post['AUTHCODE']) ? $post['AUTHCODE'] : ""); if ($hash != $post['SHA1HASH']) { $this->debugLog('validateResponseHash :' . var_export($post, true), 'debug'); //$this->displayError(vmText::sprintf('VMPAYMENT_REALEX_HPP_API_ERROR_WRONG_HASH', $hash, print_r($post, true))); //echo vmText::sprintf('VMPAYMENT_REALEX_HPP_API_ERROR_WRONG_HASH', $hash, $post['SHA1HASH']); //print_r($_POST); return FALSE; } } else { return parent::validateResponseHash($post); } return true; }
function __construct($method, $plugin) { parent::__construct($method, $plugin); }
function getRemoteCCFormParams($xml_response_dcc = NULL, $error = FALSE) { $realvault = false; $useSSL = $this->useSSL(); $submit_url = JRoute::_('index.php?option=com_virtuemart&Itemid=' . vRequest::getInt('Itemid') . '&lang=' . vRequest::getCmd('lang', ''), $this->cart->useXHTML, $useSSL); $card_payment_button = $this->getPaymentButton(); if (!empty($xml_response_dcc)) { $notificationTask = "handleRemoteDccForm"; } elseif ($this->_method->threedsecure and $this->isCC3DSVerifyEnrolled() and !$error) { $notificationTask = "handleVerify3D"; } else { $notificationTask = "handleRemoteCCForm"; } if (empty($this->_method->creditcards)) { $this->_method->creditcards = RealexHelperRealex::getRealexCreditCards(); } elseif (!is_array($this->_method->creditcards)) { $this->_method->creditcards = (array) $this->_method->creditcards; } $ccDropdown = ""; $offer_save_card = false; if (!JFactory::getUser()->guest and $this->_method->realvault) { $selected_cc = $this->customerData->getVar('saved_cc_selected'); if (empty($selected_cc)) { $selected_cc = -1; } $use_another_cc = true; $ccDropdown = $this->getCCDropDown($this->_method->virtuemart_paymentmethod_id, JFactory::getUser()->id, $selected_cc, $use_another_cc, true); if ($selected_cc > 0) { $realvault = $this->getStoredCCsData($selected_cc); } $offer_save_card = $this->_method->offer_save_card; } $amountInCurrency = vmPSPlugin::getAmountInCurrency($this->order['details']['BT']->order_total, $this->_method->payment_currency); $order_amount = vmText::sprintf('VMPAYMENT_REALEX_HPP_API_PAYMENT_TOTAL', $amountInCurrency['display']); $cd = CurrencyDisplay::getInstance($this->cart->pricesCurrency); $payment_name = $this->plugin->renderPluginName($this->_method); $cvv_images = $this->_method->cvv_images; $cvv_info = ""; $dccinfo = ""; if ($xml_response_dcc) { $success = $this->isResponseSuccess($xml_response_dcc); if ($success and isset($xml_response_dcc->dccinfo)) { $dccinfo = $xml_response_dcc->dccinfo; } } if ($xml_response_dcc and $realvault) { $ccData['cc_type'] = $realvault->realex_hpp_api_saved_pmt_type; $ccData['cc_number'] = $realvault->realex_hpp_api_saved_pmt_digits; $ccData['cc_number_masked'] = $realvault->realex_hpp_api_saved_pmt_digits; $ccData['cc_name'] = $realvault->realex_hpp_api_saved_pmt_name; $ccData['cc_cvv_realvault'] = $this->customerData->getVar('cc_cvv_realvault'); $ccData['cc_cvv_masked'] = '***'; } else { $ccData['cc_type'] = $this->customerData->getVar('cc_type'); $ccData['cc_number'] = $this->customerData->getVar('cc_number'); $ccData['cc_number_masked'] = $this->customerData->getMaskedCCnumber(); $ccData['cc_cvv'] = $this->customerData->getVar('cc_cvv'); $ccData['cc_cvv_masked'] = '***'; $ccData['cc_expire_month'] = $this->customerData->getVar('cc_expire_month'); $ccData['cc_expire_year'] = $this->customerData->getVar('cc_expire_year'); $ccData['cc_name'] = $this->customerData->getVar('cc_name'); $ccData['save_card'] = $this->customerData->getVar('save_card'); } return array("order_amount" => $order_amount, "payment_name" => $payment_name, "submit_url" => $submit_url, "card_payment_button" => $card_payment_button, "notificationTask" => $notificationTask, 'creditcardsDropDown' => $ccDropdown, "dccinfo" => $dccinfo, "ccData" => $ccData, 'creditcards' => $this->_method->creditcards, 'offer_save_card' => $offer_save_card, 'order_number' => $this->order['details']['BT']->order_number, 'virtuemart_paymentmethod_id' => $this->_method->virtuemart_paymentmethod_id, 'integration' => $this->_method->integration, 'cvv_info' => $cvv_info, 'cvn_checking' => $this->_method->cvn_checking, 'cvv_images' => $cvv_images); }