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; $this->api_signature = $this->_method->sandbox_api_signature; $this->api_password = $this->_method->sandbox_api_password; $this->payflow_partner = $this->_method->sandbox_payflow_partner; $this->payflow_vendor = $this->_method->sandbox_payflow_vendor; } else { $this->api_login_id = $this->_method->api_login_id; $this->api_signature = $this->_method->api_signature; $this->api_password = $this->_method->api_password; } if (empty($this->api_login_id) || empty($this->api_signature) || empty($this->api_password)) { $text = JText::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 = JText::sprintf('VMPAYMENT_PAYPAL_PARAMETER_REQUIRED', JText::_('VMPAYMENT_PAYPAL_' . $sandbox . 'PAYFLOW_PARTNER'), $this->_method->payment_name, $this->_method->virtuemart_paymentmethod_id); vmError($text); } }
protected function getOptions() { $creditcards = PaypalHelperPaypal::getPaypalCreditCards(); $prefix = 'VMPAYMENT_PAYPAL_CC_'; foreach ($creditcards as $creditcard) { $options[] = JHtml::_('select.option', $creditcard, vmText::_($prefix . strtoupper($creditcard))); } return $options; }
protected function getInput() { JFactory::getLanguage()->load('plg_vmpayment_paypal', JPATH_ADMINISTRATOR); $creditcards = PaypalHelperPaypal::getPaypalCreditCards(); $prefix = 'VMPAYMENT_PAYPAL_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_paypal', JPATH_ADMINISTRATOR); $creditcards = PaypalHelperPaypal::getPaypalCreditCards(); $prefix = 'VMPAYMENT_PAYPAL_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); }
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; } }
/** * * List payment methods selection * @param VirtueMartCart $cart * @param int $selected * @param $htmlIn * @return bool */ 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; } } $method_name = $this->_psType . '_name'; $htmla = array(); foreach ($this->methods as $this->_currentMethod) { if ($this->checkConditions($cart, $this->_currentMethod, $cart->pricesUnformatted)) { $html = ''; $cart_prices = array(); $cart_prices['withTax'] = ''; $cart_prices['salesPrice'] = ''; $methodSalesPrice = $this->setCartPrices($cart, $cart_prices, $this->_currentMethod); $this->_currentMethod->$method_name = $this->renderPluginName($this->_currentMethod); $html .= $this->getPluginHtml($this->_currentMethod, $selected, $methodSalesPrice); if ($this->_currentMethod->paypalproduct == 'api') { if (empty($this->_currentMethod->creditcards)) { $this->_currentMethod->creditcards = PaypalHelperPaypal::getPaypalCreditCards(); } elseif (!is_array($this->_currentMethod->creditcards)) { $this->_currentMethod->creditcards = (array)$this->_currentMethod->creditcards; } $html .= $this->renderByLayout('creditcardform', array('creditcards' => $this->_currentMethod->creditcards, 'virtuemart_paymentmethod_id' => $this->_currentMethod->virtuemart_paymentmethod_id, 'method' => $this->_currentMethod, 'sandbox' => $this->_currentMethod->sandbox, 'customerData' => $this->customerData)); } if ($this->_currentMethod->payment_type == '_xclick-auto-billing' && $this->_currentMethod->billing_max_amount_type == 'cust') { $html .= $this->renderByLayout('billingmax', array("method"=>$this->_currentMethod, "customerData"=>$this->customerData)); } if ($this->_currentMethod->payment_type == '_xclick-subscriptions') { $paypalInterface = $this->_loadPayPalInterface(); $html .= '<br/><span class="vmpayment_cardinfo">' . $paypalInterface->getRecurringProfileDesc() . '</span>'; } if ($this->_currentMethod->payment_type == '_xclick-payment-plan') { $paypalInterface = $this->_loadPayPalInterface(); $html .= '<br/><span class="vmpayment_cardinfo">' . $paypalInterface->getPaymentPlanDesc() . '</span>'; } $htmla[] = $html; } } $htmlIn[] = $htmla; return true; }
function getExtraPluginInfo() { $extraInfo = ''; //Are we coming back from Express Checkout? $expressCheckout = vRequest::getVar('expresscheckout', ''); if ($expressCheckout == 'cancel') { $this->customerData->clear(); if (!class_exists('VirtueMartCart')) { require JPATH_VM_SITE . DS . 'helpers' . DS . 'cart.php'; } $cart = VirtueMartCart::getCart(); $cart->virtuemart_paymentmethod_id = 0; $cart->setCartIntoSession(); } if (!$this->customerData->getVar('token')) { $this->getToken(); } elseif ($expressCheckout == 'done') { $this->getExpressCheckoutDetails(); } $extraInfo .= parent::getExtraPluginInfo(); return $extraInfo; }
function displayExtraPluginInfo() { $extraInfo = ''; //if ($this->customerData->getVar('cc_number') && $this->validate()) { if ($this->customerData->getVar('cc_number')) { $cc_number = "**** **** **** " . substr($this->customerData->getVar('cc_number'), -4); $creditCardInfos = '<br /><span class="vmpayment_cardinfo">' . tsmText::_('VMPAYMENT_PAYPAL_CC_CCTYPE') . $this->customerData->getVar('cc_type') . '<br />'; $creditCardInfos .= tsmText::_('VMPAYMENT_PAYPAL_CC_CCNUM') . $cc_number . '<br />'; $creditCardInfos .= tsmText::_('VMPAYMENT_PAYPAL_CC_CVV2') . '****' . '<br />'; $creditCardInfos .= tsmText::_('VMPAYMENT_PAYPAL_CC_EXDATE') . $this->customerData->getVar('cc_expire_month') . '/' . $this->customerData->getVar('cc_expire_year'); $creditCardInfos .= "</span>"; $extraInfo .= $creditCardInfos; } else { //$extraInfo .= '<br/><a href="' . JRoute::_('index.php?option=com_virtuemart&view=cart&task=editpayment&Itemid=' . vRequest::getInt('Itemid'), false) . '">' . vmText::_('VMPAYMENT_PAYPAL_CC_ENTER_INFO') . '</a>'; } $extraInfo .= parent::getExtraPluginInfo(); return $extraInfo; }
function getExtraPluginInfo () { $extraInfo = ''; //Are we coming back from Express Checkout? $expressCheckout = vRequest::getVar('SetExpressCheckout', ''); if (!$this->customerData->getVar('token')) { $this->getToken(); } elseif ($expressCheckout == 'done') { $this->getExpressCheckoutDetails(); } $extraInfo .= parent::getExtraPluginInfo(); return $extraInfo; }