Exemplo n.º 1
0
 function getExtraPluginNameInfo()
 {
     if (!class_exists('VirtueMartCart')) {
         require VMPATH_SITE . DS . 'helpers' . DS . 'cart.php';
     }
     $cart = VirtueMartCart::getCart();
     //if (!isset($cart->cartPrices)) {
     $cart->getCartPrices();
     //}
     $pbxTotalVendorCurrency = $this->getPbxAmount($cart->cartPrices['salesPrice']);
     $subscribe = $this->getSubscribeProducts($cart, $pbxTotalVendorCurrency);
     $extraInfo = false;
     if (!empty($subscribe)) {
         $extraInfo['subscribe'] = true;
         $amount2montInCurrency = vmPSPlugin::getAmountInCurrency($subscribe['PBX_2MONT'] * 0.01, $this->_method->payment_currency);
         $amount1montInCurrency = vmPSPlugin::getAmountInCurrency($subscribe['PBX_TOTAL'] * 0.01, $this->_method->payment_currency);
         $extraInfo['subscribe_2mont'] = $amount2montInCurrency['display'];
         $extraInfo['subscribe_1mont'] = $amount1montInCurrency['display'];
         $extraInfo['subscribe_nbpaie'] = $subscribe['PBX_NBPAIE'];
         $extraInfo['subscribe_freq'] = $subscribe['PBX_FREQ'];
         $extraInfo['subscribe_quand'] = $this->_method->subscribe_quand;
         $extraInfo['subscribe_delais'] = $this->_method->subscribe_delais;
     }
     return $extraInfo;
 }
Exemplo n.º 2
0
 /**
  *
  * тут выводится форма для перехода на сайт оплаты
  * @author Alexius
  */
 function plgVmConfirmedOrder($cart, $order)
 {
     //echo'<pre>salt = ';print_r($this);echo'</pre>';
     if (!($method = $this->getVmPluginMethod($order['details']['BT']->virtuemart_paymentmethod_id))) {
         return NULL;
         // Another method was selected, do nothing
     }
     if (!$this->selectedThisElement($method->payment_element)) {
         return FALSE;
     }
     VmConfig::loadJLang('com_virtuemart', true);
     if (!class_exists('VirtueMartModelOrders')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
     }
     $this->getPaymentCurrency($method);
     $currency_code_3 = shopFunctions::getCurrencyByID($method->payment_currency, 'currency_code_3');
     $email_currency = $this->getEmailCurrency($method);
     $new_status = $method->status_pending;
     $totalInPaymentCurrency = vmPSPlugin::getAmountInCurrency($order['details']['BT']->order_total, $method->payment_currency);
     $dbValues['payment_name'] = $this->renderPluginName($method) . '<br />' . $method->payment_info;
     $dbValues['order_number'] = $order['details']['BT']->order_number;
     $dbValues['virtuemart_paymentmethod_id'] = $order['details']['BT']->virtuemart_paymentmethod_id;
     $dbValues['cost_per_transaction'] = $method->cost_per_transaction;
     $dbValues['cost_percent_total'] = $method->cost_percent_total;
     $dbValues['payment_currency'] = $currency_code_3;
     $dbValues['email_currency'] = $email_currency;
     $dbValues['payment_order_total'] = $totalInPaymentCurrency['value'];
     $dbValues['tax_id'] = $method->tax_id;
     $this->storePSPluginInternalData($dbValues);
     /*
     $order1 = $this->getDataByOrderNumber('1419045');
     $orderModel = VmModel::getModel('orders');
     $order = $orderModel->getOrder($order1->virtuemart_order_id);
     echo'<pre>';var_dump($order1);echo'</pre>';//die;
     //echo'<pre>';var_dump($order);echo'</pre>';
     die;
     */
     //echo'<pre>';print_r($order['items']);echo'</pre>';
     //die;
     $session = JFactory::getSession();
     $session->set('virtuemart_order_number', $order['details']['BT']->order_number);
     //Формирование POST заголовка для отправки на Ipay
     $post_variables = array('srv_no' => $method->srv_no, 'pers_acc' => $order['details']['BT']->order_number, 'amount' => (int) $order['details']['BT']->order_total, 'amount_editable' => 'N', 'provider_url' => $method->provider_url);
     $url = $method->server;
     //$url = 'https://stand.besmart.by:4443/pls/ipay/!iSOU.Login';
     $html = '';
     $html = '<div class="erip-ipay-frm">';
     $html .= '<p>Номер вашего заказа: ' . $order['details']['BT']->order_number . '.</p>';
     $html .= '<p>Для оплаты через систему ЕРИП запишите данный номер заказа.</p><br><br>';
     $html .= '<p>Для оплаты через систему iPay - нажмите на кнопку ниже.</p>';
     $html .= '<form action="' . $url . '" method="post" name="ipay-frm">';
     foreach ($post_variables as $name => $value) {
         $html .= '<input type="hidden" name="' . $name . '" value="' . htmlspecialchars($value) . '" />';
     }
     $html .= '<button type="submit" class="button">Оплатить через iPay</button>';
     $html .= '</form>';
     $html .= '</div>';
     //return $html;
     return $this->processConfirmedOrderPaymentResponse(2, $cart, $order, $html, $method->payment_name, $new_status);
 }
Exemplo n.º 3
0
 /**
  *
  *
  * @author Valérie Isaksen
  */
 function plgVmConfirmedOrder($cart, $order)
 {
     if (!($method = $this->getVmPluginMethod($order['details']['BT']->virtuemart_paymentmethod_id))) {
         return NULL;
         // Another method was selected, do nothing
     }
     if (!$this->selectedThisElement($method->payment_element)) {
         return FALSE;
     }
     VmConfig::loadJLang('com_virtuemart', true);
     if (!class_exists('VirtueMartModelOrders')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
     }
     $this->getPaymentCurrency($method);
     $currency_code_3 = shopFunctions::getCurrencyByID($method->payment_currency, 'currency_code_3');
     $email_currency = $this->getEmailCurrency($method);
     $totalInPaymentCurrency = vmPSPlugin::getAmountInCurrency($order['details']['BT']->order_total, $method->payment_currency);
     $dbValues['payment_name'] = $this->renderPluginName($method) . '<br />' . $method->payment_info;
     $dbValues['order_number'] = $order['details']['BT']->order_number;
     $dbValues['virtuemart_paymentmethod_id'] = $order['details']['BT']->virtuemart_paymentmethod_id;
     $dbValues['cost_per_transaction'] = $method->cost_per_transaction;
     $dbValues['cost_percent_total'] = $method->cost_percent_total;
     $dbValues['payment_currency'] = $currency_code_3;
     $dbValues['email_currency'] = $email_currency;
     $dbValues['payment_order_total'] = $totalInPaymentCurrency['value'];
     $dbValues['tax_id'] = $method->tax_id;
     $this->storePSPluginInternalData($dbValues);
     $html = '<table class="vmorder-done">' . "\n";
     $html .= $this->getHtmlRow('STANDARD_PAYMENT_INFO', $dbValues['payment_name'], 'class="vmorder-done-payinfo"');
     if (!empty($payment_info)) {
         $lang = JFactory::getLanguage();
         if ($lang->hasKey($method->payment_info)) {
             $payment_info = vmText::_($method->payment_info);
         } else {
             $payment_info = $method->payment_info;
         }
         $html .= $this->getHtmlRow('STANDARD_PAYMENTINFO', $payment_info, 'class="vmorder-done-payinfo"');
     }
     if (!class_exists('VirtueMartModelCurrency')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'currency.php';
     }
     $currency = CurrencyDisplay::getInstance('', $order['details']['BT']->virtuemart_vendor_id);
     $html .= $this->getHtmlRow('STANDARD_ORDER_NUMBER', $order['details']['BT']->order_number, 'class="vmorder-done-nr"');
     $html .= $this->getHtmlRow('STANDARD_AMOUNT', $currency->priceDisplay($order['details']['BT']->order_total), 'class="vmorder-done-amount"');
     if ($method->payment_currency != $order['details']['BT']->order_currency) {
         $html .= $this->getHtmlRow('COM_VIRTUEMART_CART_TOTAL_PAYMENT', $totalInPaymentCurrency['display'], 'class="vmorder-done-amount"');
     }
     //$html .= $this->getHtmlRow('STANDARD_INFO', $method->payment_info);
     //$html .= $this->getHtmlRow('STANDARD_AMOUNT', $totalInPaymentCurrency.' '.$currency_code_3);
     $html .= '</table>' . "\n";
     $modelOrder = VmModel::getModel('orders');
     $order['order_status'] = $this->getNewStatus($method);
     $order['customer_notified'] = 1;
     $order['comments'] = '';
     $modelOrder->updateStatusForOneOrder($order['details']['BT']->virtuemart_order_id, $order, TRUE);
     //We delete the old stuff
     $cart->emptyCart();
     vRequest::setVar('html', $html);
     return TRUE;
 }
Exemplo n.º 4
0
 /**
  *
  *
  * @author Valérie Isaksen
  */
 function plgVmConfirmedOrder($cart, $order)
 {
     if (!($method = $this->getVmPluginMethod($order['details']['BT']->virtuemart_paymentmethod_id))) {
         return NULL;
         // Another method was selected, do nothing
     }
     if (!$this->selectedThisElement($method->payment_element)) {
         return FALSE;
     }
     VmConfig::loadJLang('com_virtuemart', true);
     VmConfig::loadJLang('com_virtuemart_orders', TRUE);
     if (!class_exists('VirtueMartModelOrders')) {
         require VMPATH_ADMIN . DS . 'models' . DS . 'orders.php';
     }
     $this->getPaymentCurrency($method);
     $currency_code_3 = shopFunctions::getCurrencyByID($method->payment_currency, 'currency_code_3');
     $email_currency = $this->getEmailCurrency($method);
     $totalInPaymentCurrency = vmPSPlugin::getAmountInCurrency($order['details']['BT']->order_total, $method->payment_currency);
     $dbValues['payment_name'] = $this->renderPluginName($method) . '<br />' . $method->payment_info;
     $dbValues['order_number'] = $order['details']['BT']->order_number;
     $dbValues['virtuemart_paymentmethod_id'] = $order['details']['BT']->virtuemart_paymentmethod_id;
     $dbValues['cost_per_transaction'] = $method->cost_per_transaction;
     $dbValues['cost_min_transaction'] = $method->cost_min_transaction;
     $dbValues['cost_percent_total'] = $method->cost_percent_total;
     $dbValues['payment_currency'] = $currency_code_3;
     $dbValues['email_currency'] = $email_currency;
     $dbValues['payment_order_total'] = $totalInPaymentCurrency['value'];
     $dbValues['tax_id'] = $method->tax_id;
     $this->storePSPluginInternalData($dbValues);
     $payment_info = '';
     if (!empty($method->payment_info)) {
         $lang = JFactory::getLanguage();
         if ($lang->hasKey($method->payment_info)) {
             $payment_info = vmText::_($method->payment_info);
         } else {
             $payment_info = $method->payment_info;
         }
     }
     if (!class_exists('VirtueMartModelCurrency')) {
         require VMPATH_ADMIN . DS . 'models' . DS . 'currency.php';
     }
     $currency = CurrencyDisplay::getInstance('', $order['details']['BT']->virtuemart_vendor_id);
     $html = $this->renderByLayout('post_payment', array('order_number' => $order['details']['BT']->order_number, 'order_pass' => $order['details']['BT']->order_pass, 'payment_name' => $dbValues['payment_name'], 'displayTotalInPaymentCurrency' => $totalInPaymentCurrency['display']));
     $modelOrder = VmModel::getModel('orders');
     $order['order_status'] = $this->getNewStatus($method);
     $order['customer_notified'] = 1;
     $order['comments'] = '';
     $modelOrder->updateStatusForOneOrder($order['details']['BT']->virtuemart_order_id, $order, TRUE);
     //We delete the old stuff
     $cart->emptyCart();
     vRequest::setVar('html', $html);
     return TRUE;
 }
Exemplo n.º 5
0
 function getCartItems($cart, &$klarnaOrderData)
 {
     //vmdebug('getProductItems', $cart->pricesUnformatted);
     //self::includeKlarnaFiles();
     $i = 0;
     if (!class_exists('CurrencyDisplay')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'currencydisplay.php';
     }
     foreach ($cart->products as $pkey => $product) {
         // Possible values: physical (default) , discount, shipping_fee
         $items[$i]['type'] = 'physical';
         $items[$i]['reference'] = !empty($product->sku) ? $product->sku : $product->virtuemart_product_id;
         //Article number, SKU or similar.
         $items[$i]['name'] = substr(strip_tags($product->product_name), 0, 127);
         $items[$i]['quantity'] = (int) $product->quantity;
         if (!empty($product->product_unit)) {
             // quantity_unit: Max 10 characters. Unit used to describe the quantity, e.g. kg, pcs.
             $items[$i]['quantity_unit'] = $product->product_unit;
         }
         $price = !empty($product->prices['basePriceWithTax']) ? $product->prices['basePriceWithTax'] : $product->prices['basePriceVariant'];
         $itemInPaymentCurrency = vmPSPlugin::getAmountInCurrency($price, $this->_currentMethod->payment_currency);
         $items[$i]['unit_price'] = round($itemInPaymentCurrency['value'] * 100, 0);
         // Minor units. Includes tax, excludes discount.
         $tax_rate = round($this->getVatTaxProduct($cart->cartPrices[$pkey]['VatTax']));
         $items[$i]['tax_rate'] = $tax_rate * 100;
         // Non-negative. In percent, two implicit decimals. I.e 2500 = 25%.
         // ADD A DISCOUNT AS A NEGATIVE VALUE FOR THAT PRODUCT
         if ($cart->cartPrices[$pkey]['discountAmount'] != 0.0) {
             $discount_tax_percent = 0.0;
             $discountInPaymentCurrency = vmPSPlugin::getAmountInCurrency(abs($cart->cartPrices[$pkey]['discountAmount']), $this->_currentMethod->payment_currency);
             $discountAmount = -abs(round($discountInPaymentCurrency['value'] * 100, 0));
             $items[$i]['discount_rate'] = round($discountAmount * (1 + $tax_rate * 0.01), 0);
         }
         // total_discount_amount	integer	O	Non-negative minor units. Includes tax.
         $items[$i]['total_discount_amount'] = 0;
         //total_tax_amount Must be within ±1 of total_amount - total_amount * 10000 / (10000 + tax_rate). Negative when type is discount.
         $totalTaxInPaymentCurrency = vmPSPlugin::getAmountInCurrency($product->prices['taxAmount'] * $product->quantity, $this->_currentMethod->payment_currency);
         $items[$i]['total_tax_amount'] = round($totalTaxInPaymentCurrency['value'] * 100, 0);
         // total_amount: Includes tax and discount. Must match (quantity * unit_price) - total_discount_amount within ±quantity.
         $totalAmountInPaymentCurrency = vmPSPlugin::getAmountInCurrency($product->prices['salesPrice'] * $product->quantity, $this->_currentMethod->payment_currency);
         $items[$i]['total_amount'] = round($totalAmountInPaymentCurrency['value'] * 100, 0);
         $i++;
     }
     $i--;
     if ($cart->cartPrices['salesPriceCoupon']) {
         $i++;
         $items[$i]['type'] = 'physical';
         $items[$i]['reference'] = 'COUPON';
         $items[$i]['name'] = 'Coupon discount';
         // TODO GET coupon NAME
         $items[$i]['quantity'] = 1;
         $couponInPaymentCurrency = vmPSPlugin::getAmountInCurrency($cart->cartPrices['salesPriceCoupon'], $this->_currentMethod->payment_currency);
         $items[$i]['unit_price'] = round($couponInPaymentCurrency['value'] * 100, 0);
         $items[$i]['tax_rate'] = 0;
         //$this->debugLog($cart->cartPrices['salesPriceCoupon'], 'getCartItems Coupon', 'debug');
         //$this->debugLog($items[$i], 'getCartItems', 'debug');
         $i++;
     }
     if ($cart->cartPrices['salesPriceShipment']) {
         $i++;
         $items[$i]['type'] = 'shipping_fee';
         $items[$i]['reference'] = 'SHIPPING';
         $items[$i]['name'] = substr(strip_tags($cart->cartData['shipmentName']), 0, 127);
         $items[$i]['quantity'] = 1;
         $shipmentInPaymentCurrency = vmPSPlugin::getAmountInCurrency($cart->cartPrices['salesPriceShipment'], $this->_currentMethod->payment_currency);
         $items[$i]['unit_price'] = round($shipmentInPaymentCurrency['value'] * 100, 0);
         $items[$i]['tax_rate'] = $this->getTaxShipment($cart);
         $shipmentTaxInPaymentCurrency = vmPSPlugin::getAmountInCurrency($cart->cartPrices['shipmentTax'], $this->_currentMethod->payment_currency);
         $items[$i]['total_tax_amount'] = round($shipmentTaxInPaymentCurrency['value'] * 100, 0);
         $items[$i]['total_amount'] = $items[$i]['unit_price'];
         //$this->debugLog($cart->cartPrices['salesPriceShipment'], 'getCartItems Shipment', 'debug');
         //$this->debugLog($items[$i], 'getCartItems', 'debug');
     }
     $klarnaOrderData['order_lines'] = $items;
     $orderAmountInPaymentCurrency = vmPSPlugin::getAmountInCurrency($cart->cartPrices['billTotal'], $this->_currentMethod->payment_currency);
     $klarnaOrderData['order_amount'] = round($orderAmountInPaymentCurrency['value'] * 100, 0);
     $orderTaxAmountInPaymentCurrency = vmPSPlugin::getAmountInCurrency($cart->cartPrices['billTaxAmount'], $this->_currentMethod->payment_currency);
     $klarnaOrderData['order_tax_amount'] = round($orderTaxAmountInPaymentCurrency['value'] * 100, 0);
     $currency = CurrencyDisplay::getInstance($cart->paymentCurrency);
     return;
 }
Exemplo n.º 6
0
 function plgVmConfirmedOrder($cart, $order)
 {
     if (!($method = $this->getVmPluginMethod($order['details']['BT']->virtuemart_paymentmethod_id))) {
         return NULL;
         // Another method was selected, do nothing
     }
     if (!$this->selectedThisElement($method->payment_element)) {
         return FALSE;
     }
     $session = JFactory::getSession();
     $return_context = $session->getId();
     $this->_debug = $method->HEIDELPAY_DEBUG;
     if (!class_exists('VirtueMartModelOrders')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
     }
     if (!class_exists('VirtueMartModelCurrency')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'currency.php';
     }
     $address = isset($order['details']['ST']) ? $order['details']['ST'] : $order['details']['BT'];
     if (!class_exists('TableVendors')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'tables' . DS . 'vendors.php';
     }
     $vendorModel = VmModel::getModel('Vendor');
     $vendorModel->setId(1);
     $vendor = $vendorModel->getVendor();
     $vendorModel->addImages($vendor, 1);
     $this->getPaymentCurrency($method);
     $currency_code_3 = shopFunctions::getCurrencyByID($method->payment_currency, 'currency_code_3');
     $totalInPaymentCurrency = vmPSPlugin::getAmountInCurrency($order['details']['BT']->order_total, $method->payment_currency);
     $cd = CurrencyDisplay::getInstance($cart->pricesCurrency);
     // prepare the post var values:
     $languageTag = $this->getLang();
     $params = array();
     $params['PRESENTATION.AMOUNT'] = $totalInPaymentCurrency['value'];
     $params['PRESENTATION.CURRENCY'] = $currency_code_3;
     $params['FRONTEND.LANGUAGE'] = $languageTag;
     $params['CRITERION.LANG'] = $params['FRONTEND.LANGUAGE'];
     $params['IDENTIFICATION.TRANSACTIONID'] = $order['details']['BT']->order_number;
     /*
      * Set payment methode to PA for online transfer, invoice and prepayment
      */
     $PaymentTypePA = array('OT', 'PP', 'IV');
     if (in_array(substr($method->HEIDELPAY_PAYMENT_TYPE, 0, 2), $PaymentTypePA)) {
         $method->HEIDELPAY_PAYMENT_METHOD = "PA";
     } else {
         $method->HEIDELPAY_PAYMENT_METHOD = $method->HEIDELPAY_PAYMENT_METHOD;
     }
     $params['PAYMENT.CODE'] = substr($method->HEIDELPAY_PAYMENT_TYPE, 0, 2) . "." . $method->HEIDELPAY_PAYMENT_METHOD;
     $params['TRANSACTION.CHANNEL'] = $method->HEIDELPAY_CHANNEL_ID;
     /*
      * Special case for paypal without hco iframe
      */
     if ($method->HEIDELPAY_PAYMENT_TYPE == "VAPAYPAL") {
         $params['PAYMENT.CODE'] = "VA.DB";
         $params['ACCOUNT.BRAND'] = "PAYPAL";
         $params['FRONTEND.PM.DEFAULT_DISABLE_ALL'] = "true";
         $params['FRONTEND.PM.0.ENABLED'] = "true";
         $params['FRONTEND.PM.0.METHOD'] = "VA";
         $params['FRONTEND.PM.0.SUBTYPES'] = "PAYPAL";
     }
     /*
      * Special case for MangirKart without hco iframe
      */
     if ($method->HEIDELPAY_PAYMENT_TYPE == "PCMANGIR") {
         $params['PAYMENT.CODE'] = "PC.PA";
         $params['ACCOUNT.BRAND'] = "MANGIRKART";
     }
     /*
      * Special case for BarPay without hco iframe
      */
     if ($method->HEIDELPAY_PAYMENT_TYPE == "PPBARPAY") {
         $params['PAYMENT.CODE'] = "PP.PA";
         $params['ACCOUNT.BRAND'] = "BARPAY";
     }
     /*
      *  User account information
      */
     $params['ACCOUNT.HOLDER'] = $address->first_name . " " . $address->last_name;
     $params['NAME.GIVEN'] = $address->first_name;
     $params['NAME.FAMILY'] = $address->last_name;
     $params['ADDRESS.STREET'] = $address->address_1;
     isset($address->address_2) ? $params['ADDRESS.STREET'] .= " " . $address->address_2 : '';
     $params['ADDRESS.ZIP'] = $address->zip;
     $params['ADDRESS.CITY'] = $address->city;
     $params['ADDRESS.COUNTRY'] = ShopFunctions::getCountryByID($address->virtuemart_country_id, 'country_2_code');
     $params['CONTACT.EMAIL'] = $order['details']['BT']->email;
     $params['CONTACT.IP'] = $_SERVER['REMOTE_ADDR'];
     /*
      * Add debug informations for merchiant support
      */
     $params['SHOP.TYPE'] = 'VirtueMart2.0.24b';
     $params['SHOPMODUL.VERSION'] = $this->version;
     $params['CRITERION.PAYMENT_NAME'] = JText::_('VMPAYMENT_HEIDELPAY_' . $method->HEIDELPAY_PAYMENT_TYPE);
     $params['CRITERION.PAYMENT_NAME'] = strip_tags($params['CRITERION.PAYMENT_NAME']);
     /*
      * Create hash to secure the response
      */
     $params['CRITERION.SECRET'] = $this->createSecretHash($order['details']['BT']->order_number, $method->HEIDELPAY_SECRET);
     /*
      * Set transaction mode
      */
     if ($method->HEIDELPAY_TRANSACTION_MODE == 2) {
         $params['TRANSACTION.MODE'] = "LIVE";
     } elseif ($method->HEIDELPAY_TRANSACTION_MODE == 0) {
         $params['TRANSACTION.MODE'] = "INTEGRATOR_TEST";
     } else {
         $params['TRANSACTION.MODE'] = "CONNECTOR_TEST";
     }
     /*
      * Default configuration for hco
      */
     $params['FRONTEND.MODE'] = "DEFAULT";
     $params['FRONTEND.ENABLED'] = "true";
     $params['FRONTEND.POPUP'] = "false";
     $params['FRONTEND.REDIRECT_TIME'] = "0";
     $params['REQUEST.VERSION'] = "1.0";
     $params['FRONTEND.NEXTTARGET'] = "top.location.href";
     /*
      * Add response and css path
      */
     $params['FRONTEND.RESPONSE_URL'] = JROUTE::_(JURI::root(), $xhtml = true, $ssl = 0) . 'plugins/vmpayment/heidelpay/heidelpay/heidelpay_response.php?option=com_virtuemart&view=pluginresponse&task=pluginresponsereceived&on=' . urlencode($order['details']['BT']->order_number) . '&pm=' . $order['details']['BT']->virtuemart_paymentmethod_id;
     $cssFile = "heidelpay_default.css";
     if (!empty($method->HEIDELPAY_STYLE)) {
         $cssFile = $method->HEIDELPAY_STYLE;
     }
     $params['FRONTEND.CSS_PATH'] = JROUTE::_(JURI::root(), $xhtml = true, $ssl = 0) . 'plugins/vmpayment/heidelpay/heidelpay/' . $cssFile;
     $requestUrl = $method->HEIDELPAY_PAYMENT_URL;
     $params['SECURITY.SENDER'] = $method->HEIDELPAY_SECURITY_SENDER;
     $params['USER.LOGIN'] = $method->HEIDELPAY_USER_LOGIN;
     $params['USER.PWD'] = $method->HEIDELPAY_USER_PW;
     /*
      * send request to payment server
      */
     $response = $this->doRequest($requestUrl, $params, $method->HEIDELPAY_DEBUG);
     if ($params['TRANSACTION.MODE'] != "LIVE") {
         vmInfo('VMPAYMENT_HEIDELPAY_PAYMENT_TESTMODE');
     }
     /*
      * On success show iframe or show error information for your customer
      */
     $returnValue = 0;
     if ($response['PROCESSING_RESULT'] == "ACK" || $response['POST_VALIDATION'] == "ACK") {
         $returnValue = 2;
         $html = $this->renderByLayout('displaypayment', array('response' => $response['FRONTEND_REDIRECT_URL']));
     } else {
         $html = JText::_('VMPAYMENT_HEIDELPAY_TECHNICAL_ERROR') . " <br /> - " . addslashes($response[PROCESSING_RETURN]) . "<br />" . JText::_('VMPAYMENT_HEIDELPAY_CONTACT_SHOPOWNER');
     }
     /*
      * Show debug information
      */
     if ($method->HEIDELPAY_DEBUG == 1) {
         vmDebug('HEIDELPAY plgVmConfirmedOrder', $params);
     }
     return $this->processConfirmedOrderPaymentResponse($returnValue, $cart, $order, $html, '', '');
 }
Exemplo n.º 7
0
 /**
  * Reimplementation of vmPaymentPlugin::plgVmOnConfirmedOrder()
  *
  * @link http://www.authorize.net/support/AIM_guide.pdf
  * Credit Cards Test Numbers
  * Visa Test Account           4007000000027
  * Amex Test Account           370000000000002
  * Master Card Test Account    6011000000000012
  * Discover Test Account       5424000000000015
  * @author Valerie Isaksen
  */
 function plgVmConfirmedOrder(VirtueMartCart $cart, $order)
 {
     if (!($this->_currentMethod = $this->getVmPluginMethod($order['details']['BT']->virtuemart_paymentmethod_id))) {
         return NULL;
         // Another method was selected, do nothing
     }
     if (!$this->selectedThisElement($this->_currentMethod->payment_element)) {
         return FALSE;
     }
     $this->setInConfirmOrder($cart);
     $usrBT = $order['details']['BT'];
     $usrST = isset($order['details']['ST']) ? $order['details']['ST'] : '';
     $session = JFactory::getSession();
     $return_context = $session->getId();
     $payment_currency_id = shopFunctions::getCurrencyIDByName(self::AUTHORIZE_DEFAULT_PAYMENT_CURRENCY);
     $totalInPaymentCurrency = vmPSPlugin::getAmountInCurrency($order['details']['BT']->order_total, $payment_currency_id);
     $cd = CurrencyDisplay::getInstance($cart->pricesCurrency);
     // Set up data
     $formdata = array();
     $formdata = array_merge($this->_setHeader(), $formdata);
     $formdata = array_merge($this->_setResponseConfiguration(), $formdata);
     $formdata = array_merge($this->_setBillingInformation($usrBT), $formdata);
     if (!empty($usrST)) {
         $formdata = array_merge($this->_setShippingInformation($usrST), $formdata);
     }
     $formdata = array_merge($this->_setTransactionData($order['details']['BT'], $totalInPaymentCurrency['value']), $formdata);
     $formdata = array_merge($this->_setMerchantData(), $formdata);
     // prepare the array to post
     $poststring = '';
     foreach ($formdata as $key => $val) {
         $poststring .= urlencode($key) . "=" . urlencode($val) . "&";
     }
     $poststring = rtrim($poststring, "& ");
     // Prepare data that should be stored in the database
     $dbValues['order_number'] = $order['details']['BT']->order_number;
     $dbValues['virtuemart_order_id'] = $order['details']['BT']->virtuemart_order_id;
     $dbValues['payment_method_id'] = $order['details']['BT']->virtuemart_paymentmethod_id;
     $dbValues['return_context'] = $return_context;
     $dbValues['payment_name'] = parent::renderPluginName($this->_currentMethod);
     $dbValues['cost_per_transaction'] = $this->_currentMethod->cost_per_transaction;
     $dbValues['cost_percent_total'] = $this->_currentMethod->cost_percent_total;
     $dbValues['payment_order_total'] = $totalInPaymentCurrency['value'];
     $dbValues['payment_currency'] = $payment_currency_id;
     $this->debugLog("before store", "plgVmConfirmedOrder", 'debug');
     $this->storePSPluginInternalData($dbValues);
     // send a request
     $response = $this->_sendRequest($poststring);
     $this->debugLog($response, "plgVmConfirmedOrder", 'debug');
     $authnet_values = array();
     // to check the values???
     // evaluate the response
     $html = $this->_handleResponse($response, $authnet_values, $order, $dbValues['payment_name']);
     if ($this->error) {
         $new_status = $this->_currentMethod->payment_declined_status;
         $this->_handlePaymentCancel($order['details']['BT']->virtuemart_order_id, $html);
         return;
         // will not process the order
     } else {
         if ($this->approved) {
             $this->_clearAuthorizeNetSession();
             $new_status = $this->_currentMethod->payment_approved_status;
         } else {
             if ($this->declined) {
                 vRequest::setVar('html', $html);
                 $new_status = $this->_currentMethod->payment_declined_status;
                 $this->_handlePaymentCancel($order['details']['BT']->virtuemart_order_id, $html);
                 return;
             } else {
                 if ($this->held) {
                     $this->_clearAuthorizeNetSession();
                     $new_status = $this->_currentMethod->payment_held_status;
                 }
             }
         }
     }
     $modelOrder = VmModel::getModel('orders');
     $order['order_status'] = $new_status;
     $order['customer_notified'] = 1;
     $order['comments'] = '';
     $modelOrder->updateStatusForOneOrder($order['details']['BT']->virtuemart_order_id, $order, TRUE);
     //We delete the old stuff
     $cart->emptyCart();
     vRequest::setVar('html', $html);
 }
Exemplo n.º 8
0
 /**
  * @param $method
  * @param $order
  * @return string
  */
 function _getPaymentResponseHtml($method, $order, $payments)
 {
     VmConfig::loadJLang('com_virtuemart_orders', TRUE);
     if (!class_exists('CurrencyDisplay')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'currencydisplay.php';
     }
     if (!class_exists('VirtueMartCart')) {
         require VMPATH_SITE . DS . 'helpers' . DS . 'cart.php';
     }
     VmConfig::loadJLang('com_virtuemart_orders', TRUE);
     $totalInPaymentCurrency = vmPSPlugin::getAmountInCurrency($order['details']['BT']->order_total, $order['details']['BT']->order_currency);
     $cart = VirtueMartCart::getCart();
     $currencyDisplay = CurrencyDisplay::getInstance($cart->pricesCurrency);
     $payment = end($payments);
     $pluginName = $this->renderPluginName($method, $where = 'post_payment');
     $html = $this->renderByLayout('post_payment', array('order' => $order, 'paymentInfos' => $payment, 'pluginName' => $pluginName, 'displayTotalInPaymentCurrency' => $totalInPaymentCurrency['display']));
     //vmdebug('_getPaymentResponseHtml', $html,$pluginName,$paypalTable );
     return $html;
 }
Exemplo n.º 9
0
 function setComment1()
 {
     $amountValue = vmPSPlugin::getAmountInCurrency($this->order['details']['BT']->order_total, $this->order['details']['BT']->order_currency);
     $currencyDisplay = CurrencyDisplay::getInstance($this->cart->pricesCurrency);
     $shop_name = $this->getVendorInfo('vendor_store_name');
     return vmText::sprintf('VMPAYMENT_REALEX_HPP_API_COMMENT1', $amountValue['display'], $this->order['details']['BT']->order_number, $shop_name);
 }
Exemplo n.º 10
0
 /**
  * @param $amount
  * @param $currencyId
  * @return array
  */
 static function getAmountValueInCurrency($amount, $currencyId)
 {
     $return = vmPSPlugin::getAmountInCurrency($amount, $currencyId);
     return $return['value'];
 }
Exemplo n.º 11
0
 /**
  * If we are going back to the cart because of InvalidPaymentMethod, then the order reference is not anylonger in a draft state
  * @return bool
  */
 private function setOrderReferenceDetails($client, $cart, $order = NULL)
 {
     $this->loadAmazonClass('OffAmazonPaymentsService_Model_OrderReferenceAttributes');
     $this->loadAmazonClass('OffAmazonPaymentsService_Model_OrderTotal');
     $this->loadAmazonClass('OffAmazonPaymentsService_Model_SellerOrderAttributes');
     if ($order) {
         $amountInCurrency = vmPSPlugin::getAmountInCurrency($order['details']['BT']->order_total, $order['details']['BT']->user_currency_id);
         $amount = $amountInCurrency['value'];
     } else {
         $amount = $this->getTotalInPaymentCurrency($client, $cart->pricesUnformatted['billTotal'], $cart->pricesCurrency);
     }
     //$_amazonOrderReferenceId = $this->getAmazonOrderReferenceIdFromSession();
     if (empty($this->_amazonOrderReferenceId)) {
         $this->amazonError(__FUNCTION__ . ' setOrderReferenceDetails, No $_amazonOrderReferenceId');
         return FALSE;
     }
     try {
         $setOrderReferenceDetailsRequest = new OffAmazonPaymentsService_Model_SetOrderReferenceDetailsRequest();
         $setOrderReferenceDetailsRequest->setSellerId($this->_currentMethod->sellerId);
         $setOrderReferenceDetailsRequest->setAmazonOrderReferenceId($this->_amazonOrderReferenceId);
         $setOrderReferenceDetailsRequest->setOrderReferenceAttributes(new OffAmazonPaymentsService_Model_OrderReferenceAttributes());
         $setOrderReferenceDetailsRequest->getOrderReferenceAttributes()->setOrderTotal(new OffAmazonPaymentsService_Model_OrderTotal());
         $setOrderReferenceDetailsRequest->getOrderReferenceAttributes()->getOrderTotal()->setCurrencyCode($this->getCurrencyCode3($client));
         $setOrderReferenceDetailsRequest->getOrderReferenceAttributes()->getOrderTotal()->setAmount($amount);
         $setOrderReferenceDetailsRequest->getOrderReferenceAttributes()->setSellerNote($this->getSellerNote());
         $setOrderReferenceDetailsRequest->getOrderReferenceAttributes()->setSellerOrderAttributes(new OffAmazonPaymentsService_Model_SellerOrderAttributes());
         if ($order) {
             $setOrderReferenceDetailsRequest->getOrderReferenceAttributes()->getSellerOrderAttributes()->setSellerOrderId($order['details']['BT']->order_number);
         }
         $setOrderReferenceDetailsRequest->getOrderReferenceAttributes()->getSellerOrderAttributes()->setStoreName($this->getStoreName());
         //$setOrderReferenceDetailsRequest->getOrderReferenceAttributes()->getSellerOrderAttributes()->setCustomInformation($order['details']['BT']->customer_note);
         $setOrderReferenceDetailsRequest->getOrderReferenceAttributes()->setPlatformId($this->getPlatformId());
         $setOrderReferenceDetailsResponse = $client->setOrderReferenceDetails($setOrderReferenceDetailsRequest);
     } catch (Exception $e) {
         $this->amazonError(__FUNCTION__ . ' ' . $e->getMessage(), $e->getCode());
         $this->clearAmazonSession();
         return FALSE;
     }
     $this->debugLog("<pre>" . var_export($setOrderReferenceDetailsRequest, true) . "</pre>", __FUNCTION__, 'debug');
     $this->debugLog("<pre>" . var_export($setOrderReferenceDetailsResponse, true) . "</pre>", __FUNCTION__, 'debug');
     return $setOrderReferenceDetailsResponse;
 }
Exemplo n.º 12
0
 /**
  * Reimplementation of vmPaymentPlugin::plgVmOnConfirmedOrder()
  *
  * @link http://nabvelocity.com/
  * Credit Cards Test Numbers
  * Visa Test Account           4007000000027
  * Amex Test Account           370000000000002
  * Master Card Test Account    6011000000000012
  * Discover Test Account       5424000000000015
  * @author Velocity Team
  */
 function plgVmConfirmedOrder(VirtueMartCart $cart, $order)
 {
     if (!($this->_currentMethod = $this->getVmPluginMethod($order['details']['BT']->virtuemart_paymentmethod_id))) {
         return NULL;
         // Another method was selected, do nothing
     }
     if (!$this->selectedThisElement($this->_currentMethod->payment_element)) {
         return FALSE;
     }
     $this->setInConfirmOrder($cart);
     $usrBT = $order['details']['BT'];
     $usrST = isset($order['details']['ST']) ? $order['details']['ST'] : '';
     $session = JFactory::getSession();
     $return_context = $session->getId();
     $payment_currency_id = shopFunctions::getCurrencyIDByName(self::VELOCITY_DEFAULT_PAYMENT_CURRENCY);
     $totalInPaymentCurrency = vmPSPlugin::getAmountInCurrency($order['details']['BT']->order_total, $payment_currency_id);
     $cd = CurrencyDisplay::getInstance($cart->pricesCurrency);
     if (!class_exists('ShopFunctions')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'shopfunctions.php';
     }
     $statecode = self::get2cStateByID($usrBT->virtuemart_state_id);
     $countrycode = self::get3cCountryByID($usrBT->virtuemart_country_id) == 'USA' ? self::get3cCountryByID($usrBT->virtuemart_country_id) : 'USA';
     $avsData = array('Street' => $usrBT->address_1 . ' ' . $usrBT->address_2, 'City' => $usrBT->city, 'StateProvince' => $statecode, 'PostalCode' => $usrBT->zip, 'Country' => $countrycode);
     $cardData = array('cardtype' => str_replace(' ', '', $this->_cc_type), 'pan' => $this->_cc_number, 'expire' => sprintf("%02d", $this->_cc_expire_month) . substr($this->_cc_expire_year, -2), 'cvv' => $this->_cc_cvv, 'track1data' => '', 'track2data' => '');
     $identitytoken = $this->_vmpCtable->identitytoken;
     $workflowid = $this->_vmpCtable->workflowid;
     $applicationprofileid = $this->_vmpCtable->applicationprofileid;
     $merchantprofileid = $this->_vmpCtable->merchantprofileid;
     if ($this->_vmpCtable->payment_mode) {
         $isTestAccount = TRUE;
     } else {
         $isTestAccount = FALSE;
     }
     include_once 'sdk' . DS . 'configuration.php';
     include_once 'sdk' . DS . 'Velocity.php';
     // Prepare data that should be stored in the database
     $dbValues['order_number'] = $order['details']['BT']->order_number;
     $dbValues['virtuemart_order_id'] = $order['details']['BT']->virtuemart_order_id;
     $dbValues['payment_method_id'] = $order['details']['BT']->virtuemart_paymentmethod_id;
     $dbValues['return_context'] = $return_context;
     $dbValues['payment_name'] = parent::renderPluginName($this->_currentMethod);
     $dbValues['cost_per_transaction'] = $this->_currentMethod->cost_per_transaction;
     $dbValues['cost_percent_total'] = $this->_currentMethod->cost_percent_total;
     $dbValues['payment_order_total'] = $totalInPaymentCurrency['value'];
     $dbValues['payment_currency'] = $payment_currency_id;
     $this->debugLog("before store", "plgVmConfirmedOrder", 'debug');
     $this->storePSPluginInternalData($dbValues);
     $errMsg = '';
     try {
         $velocityProcessor = new VelocityProcessor($applicationprofileid, $merchantprofileid, $workflowid, $isTestAccount, $identitytoken);
     } catch (Exception $e) {
         $this->error = TRUE;
         $errMsg .= '<br>' . vmText::_($e->getMessage());
     }
     /* Request for the verify avsdata and card data*/
     try {
         $response = $velocityProcessor->verify(array('amount' => $totalInPaymentCurrency['value'], 'avsdata' => $avsData, 'carddata' => $cardData, 'entry_mode' => 'Keyed', 'IndustryType' => 'Ecommerce', 'Reference' => 'xyz', 'EmployeeId' => '11'));
     } catch (Exception $e) {
         $this->error = TRUE;
         $errMsg .= '<br>' . vmText::_($e->getMessage());
     }
     if (is_array($response) && isset($response['Status']) && $response['Status'] == 'Successful') {
         /* Request for the authrizeandcapture transaction */
         try {
             $xml = VelocityXmlCreator::authorizeandcaptureXML(array('amount' => $totalInPaymentCurrency['value'], 'avsdata' => $avsData, 'token' => $response['PaymentAccountDataToken'], 'order_id' => $order['details']['BT']->order_number, 'entry_mode' => 'Keyed', 'IndustryType' => 'Ecommerce', 'Reference' => 'xyz', 'EmployeeId' => '11'));
             // got authorizeandcapture xml object.
             $req = $xml->saveXML();
             $obj_req = serialize($req);
             $cap_response = $velocityProcessor->authorizeAndCapture(array('amount' => $totalInPaymentCurrency['value'], 'avsdata' => $avsData, 'token' => $response['PaymentAccountDataToken'], 'order_id' => $order['details']['BT']->order_number, 'entry_mode' => 'Keyed', 'IndustryType' => 'Ecommerce', 'Reference' => 'xyz', 'EmployeeId' => '11'));
             if (is_array($cap_response) && !empty($cap_response) && isset($cap_response['Status']) && $cap_response['Status'] == 'Successful') {
                 /* save the authandcap response into 'virtuemart_payment_plg_velocity' custom table.*/
                 $response_fields['transaction_id'] = $cap_response['TransactionId'];
                 $response_fields['transaction_status'] = $cap_response['TransactionState'];
                 $response_fields['virtuemart_order_id'] = $order['details']['BT']->virtuemart_order_id;
                 $response_fields['request_obj'] = $obj_req;
                 $response_fields['response_obj'] = serialize($cap_response);
                 $this->storePSPluginInternalData($response_fields, 'virtuemart_order_id', TRUE);
                 $html = '<table class="adminlist table">' . "\n";
                 $html .= $this->getHtmlRow('VELOCITY_PAYMENT_NAME', $this->_vmpCtable->payment_name);
                 $html .= $this->getHtmlRow('VELOCITY_ORDER_NUMBER', $order['details']['BT']->order_number);
                 $html .= $this->getHtmlRow('VELOCITY_AMOUNT', $cap_response['Amount']);
                 $html .= $this->getHtmlRow('VMPAYMENT_VELOCITY_APPROVAL_CODE', $cap_response['ApprovalCode']);
                 if ($cap_response['TransactionId']) {
                     $html .= $this->getHtmlRow('VELOCITY_RESPONSE_TRANSACTION_ID', $cap_response['TransactionId']);
                 }
                 $html .= '</table>' . "\n";
                 $this->debugLog(vmText::_('VMPAYMENT_VELOCITY_ORDER_NUMBER') . " " . $order['details']['BT']->order_number . ' payment approved', '_handleResponse', 'debug');
                 $comment = 'ApprovalCode: ' . $cap_response['ApprovalCode'] . '<br>Transaction_Id: ' . $cap_response['TransactionId'];
                 $this->_clearVelocitySession();
                 $new_status = 'U';
             } else {
                 if (is_array($cap_response) && !empty($cap_response)) {
                     $this->error = TRUE;
                     $errMsg .= vmText::_($cap_response['StatusMessage']);
                 } else {
                     if (is_string($cap_response)) {
                         $this->error = TRUE;
                         $errMsg .= '<br>' . vmText::_($cap_response);
                     } else {
                         $this->error = TRUE;
                         $errMsg .= '<br>' . vmText::_('VMPAYMENT_VELOCITY_UNKNOWN_ERROR');
                     }
                 }
             }
         } catch (Exception $e) {
             $errMsg .= '<br>' . vmText::_($e->getMessage());
         }
     } else {
         if (is_array($response) && (isset($response['Status']) && $response['Status'] != 'Successful')) {
             $this->error = TRUE;
             $errMsg .= '<br>' . vmText::_($response['StatusMessage']);
         } else {
             if (is_string($response)) {
                 $this->error = TRUE;
                 $errMsg .= '<br>' . vmText::_($response);
             } else {
                 $this->error = TRUE;
                 $errMsg .= '<br>' . vmText::_('VMPAYMENT_VELOCITY_UNKNOWN_ERROR');
             }
         }
     }
     $this->debugLog($response, "plgVmConfirmedOrder", 'debug');
     $modelOrder = VmModel::getModel('orders');
     if ($this->error) {
         $this->debugLog($errMsg, 'getOrderIdByOrderNumber', 'message');
         $this->_handlePaymentCancel($order['details']['BT']->virtuemart_order_id, $errMsg);
         return;
     }
     $order['order_status'] = $new_status;
     $order['customer_notified'] = 1;
     $order['comments'] = $comment;
     $modelOrder->updateStatusForOneOrder($order['details']['BT']->virtuemart_order_id, $order, TRUE);
     //We delete the old stuff
     $cart->emptyCart();
     vRequest::setVar('html', $html);
 }
Exemplo n.º 13
0
 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);
 }
Exemplo n.º 14
0
 function plgVmConfirmedOrder($cart, $order)
 {
     if (!($method = $this->getVmPluginMethod($order['details']['BT']->virtuemart_paymentmethod_id))) {
         return NULL;
         // Another method was selected, do nothing
     }
     if (!$this->selectedThisElement($method->payment_element)) {
         return FALSE;
     }
     $session = JFactory::getSession();
     $return_context = $session->getId();
     $this->logInfo('plgVmConfirmedOrder order number: ' . $order['details']['BT']->order_number, 'message');
     if (!class_exists('VirtueMartModelOrders')) {
         require VMPATH_ADMIN . DS . 'models' . DS . 'orders.php';
     }
     if (!class_exists('VirtueMartModelCurrency')) {
         require VMPATH_ADMIN . DS . 'models' . DS . 'currency.php';
     }
     $usrBT = $order['details']['BT'];
     $address = isset($order['details']['ST']) ? $order['details']['ST'] : $order['details']['BT'];
     if (!class_exists('TableVendors')) {
         require VMPATH_ADMIN . DS . 'tables' . DS . 'vendors.php';
     }
     $vendorModel = VmModel::getModel('Vendor');
     $vendorModel->setId(1);
     $vendor = $vendorModel->getVendor();
     $vendorModel->addImages($vendor, 1);
     $this->getPaymentCurrency($method);
     $q = 'SELECT `currency_code_3` FROM `#__virtuemart_currencies` WHERE `virtuemart_currency_id`="' . $method->payment_currency . '" ';
     $db = JFactory::getDBO();
     $db->setQuery($q);
     $currency_code_3 = $db->loadResult();
     $totalInPaymentCurrency = vmPSPlugin::getAmountInCurrency($order['details']['BT']->order_total, $method->payment_currency);
     $cartCurrency = CurrencyDisplay::getInstance($cart->pricesCurrency);
     if ($totalInPaymentCurrency['value'] <= 0) {
         vmInfo(vmText::_('VMPAYMENT_TODOPAGO_PAYMENT_AMOUNT_INCORRECT'));
         return FALSE;
     }
     $lang = JFactory::getLanguage();
     $tag = substr($lang->get('tag'), 0, 2);
     $post_variables = array();
     require_once 'cs/TPConnector.php';
     $tpconnector = new TPConnector();
     $connector_data = $tpconnector->createTPConnector($method);
     $this->logInfo("tpconnector" . json_encode($connector_data), "message");
     $connector = $connector_data['connector'];
     $security_code = $connector_data['security'];
     $merchant = $connector_data['merchant'];
     $return_url = JURI::root() . 'index.php?option=com_virtuemart&view=pluginresponse&task=pluginresponsereceived&on=' . $order['details']['BT']->order_number . '&pm=' . $order['details']['BT']->virtuemart_paymentmethod_id . '&Itemid=' . vRequest::getInt('Itemid') . '&lang=' . vRequest::getCmd('lang', '');
     $cancel_url = JURI::root() . 'index.php?option=com_virtuemart&view=pluginresponse&task=pluginUserPaymentCancel&on=' . $order['details']['BT']->order_number . '&pm=' . $order['details']['BT']->virtuemart_paymentmethod_id . '&Itemid=' . vRequest::getInt('Itemid') . '&lang=' . vRequest::getCmd('lang', '');
     $status_url = JURI::root() . 'index.php?option=com_virtuemart&view=pluginresponse&task=pluginnotification&tmpl=component&lang=' . vRequest::getCmd('lang', '');
     $optionsSAR_comercio = array('Security' => $security_code, 'EncodingMethod' => 'XML', 'Merchant' => $merchant, 'PUSHNOTIFYENDPOINT' => $return_url = JURI::root() . 'index.php?option=com_virtuemart&view=pluginresponse&task=pluginresponsereceived&on=' . $order['details']['BT']->order_number . '&pm=' . $order['details']['BT']->virtuemart_paymentmethod_id, 'URL_OK' => $return_url, 'URL_ERROR' => $cancel_url);
     $customFieldsModel = VmModel::getModel('Customfields');
     $optionsSAR_operacion = $this->getCommonFields($cart, $customFieldsModel, $this->tp_states);
     $currency_model = VmModel::getModel('currency');
     $currency = $currency_model->getCurrency($order['details']['BT']->user_currency_id);
     $countryIso = ShopFunctions::getCountryByID($order['details']['BT']->virtuemart_country_id, 'country_2_code');
     $countryName = ShopFunctions::getCountryByID($order['details']['BT']->virtuemart_country_id);
     $extra_fields = array();
     require 'cs/FactoryTodopago.php';
     $extra_fields = FactoryTodopago::get_extractor($method->tp_vertical_type, $cart, $customFieldsModel);
     $optionsSAR_operacion = array_merge($optionsSAR_operacion, $extra_fields);
     $optionsSAR_operacion['MERCHANT'] = $merchant;
     $optionsSAR_operacion['CURRENCYCODE'] = "032";
     $optionsSAR_operacion['CSPTCURRENCY'] = "ARS";
     $optionsSAR_operacion['OPERATIONID'] = $order['details']['BT']->order_number;
     $optionsSAR_operacion['CSBTCOUNTRY'] = $countryIso;
     $optionsSAR_operacion['CSMDD9'] = JFactory::getUser()->password;
     $optionsSAR_operacion['CSSTSTATE'] = $this->tp_states;
     $optionsSAR_operacion['CSSTCOUNTRY'] = $countryIso;
     $optionsSAR_operacion['CSMDD12'] = $method->tp_dead_line;
     $optionsSAR_operacion['CSMDD13'] = $this->_sanitize_string($cart->cartData['shipmentName']);
     $this->logInfo("TP - SARcomercio - " . json_encode($optionsSAR_comercio), "message");
     $this->logInfo("TP - SARoperacion - " . json_encode($optionsSAR_operacion), "message");
     $rta = $connector->sendAuthorizeRequest($optionsSAR_comercio, $optionsSAR_operacion);
     $this->logInfo("TP - SAR rta - " . json_encode($rta), "message");
     if ($rta["StatusCode"] == 702) {
         $this->logInfo("TP - SARoperacion - reintento SAR" . json_encode($optionsSAR_operacion), "message");
         $rta = $connector->sendAuthorizeRequest($optionsSAR_comercio, $optionsSAR_operacion);
     }
     setcookie('RequestKey', $rta["RequestKey"], time() + 86400 * 30, "/");
     $session = JFactory::getSession();
     $return_context = $session->getId();
     $dbValues['user_session'] = $return_context;
     $dbValues['order_number'] = $order['details']['BT']->order_number;
     $dbValues['payment_name'] = $this->renderPluginName($method, $order);
     $dbValues['virtuemart_paymentmethod_id'] = $cart->virtuemart_paymentmethod_id;
     $dbValues['cost_per_transaction'] = $method->cost_per_transaction;
     $dbValues['cost_percent_total'] = $method->cost_percent_total;
     $dbValues['payment_currency'] = $method->payment_currency;
     $dbValues['payment_order_total'] = $totalInPaymentCurrency['value'];
     $dbValues['tax_id'] = $method->tax_id;
     $dbValues['security_code'] = $method->security_code;
     $this->storePSPluginInternalData($dbValues);
     $cart->_confirmDone = TRUE;
     $cart->_dataValidated = TRUE;
     $cart->setCartIntoSession();
     if ($rta['StatusCode'] != -1) {
         echo "<script>alert('Su pago no puede ser procesado. Intente nuevamente más tarde')</script>";
         $this->logInfo("TP - Redirect to: " . $rta['URL_Request'], "message");
         echo "<script>window.location.href = '" . JURI::root() . "index.php/cart/'</script>";
     } else {
         $this->logInfo("TP - Redirect to: " . $rta['URL_Request'], "message");
         //echo "<script>window.location.href = '".$rta['URL_Request']."'</script>";
         header('Location: ' . $rta['URL_Request']);
     }
 }
Exemplo n.º 15
0
 function getOrderRecurringTerms($payment, $order, $start)
 {
     $recurring = json_decode($payment->recurring);
     $recurring_comment = "";
     for ($i = $start; $i < $payment->recurring_number; $i++) {
         $index_mont = "PBX_2MONT" . $i;
         $index_date = "PBX_DATE" . $i;
         $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'];
     }
     return $recurring_comment;
 }
Exemplo n.º 16
0
 function getCartItems($cart, &$klarnaOrderData)
 {
     //vmdebug('getProductItems', $cart->pricesUnformatted);
     //self::includeKlarnaFiles();
     $i = 0;
     if (!class_exists('CurrencyDisplay')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'currencydisplay.php';
     }
     foreach ($cart->products as $pkey => $product) {
         $items[$i]['reference'] = !empty($product->sku) ? $product->sku : $product->virtuemart_product_id;
         $items[$i]['name'] = substr(strip_tags($product->product_name), 0, 127);
         $items[$i]['quantity'] = (int) $product->quantity;
         $price = !empty($product->prices['basePriceWithTax']) ? $product->prices['basePriceWithTax'] : $product->prices['basePriceVariant'];
         $itemInPaymentCurrency = vmPSPlugin::getAmountInCurrency($price, $this->_currentMethod->payment_currency);
         $items[$i]['unit_price'] = round($itemInPaymentCurrency['value'] * 100, 0);
         //$items[$i]['discount_rate'] = $discountRate;
         // Bug indoc: discount is not supported
         //$items[$i]['discount'] = abs($cart->cartPrices[$pkey]['discountAmount']*100);
         $tax_rate = round($this->getVatTaxProduct($cart->cartPrices[$pkey]['VatTax']));
         $items[$i]['tax_rate'] = $tax_rate * 100;
         $i++;
         // ADD A DISCOUNT AS A NEGATIVE VALUE FOR THAT PRODUCT
         if ($cart->cartPrices[$pkey]['discountAmount'] != 0.0) {
             $items[$i]['reference'] = $items[$i - 1]['reference'];
             $items[$i]['name'] = $items[$i - 1]['name'] . ' (' . tsmText::_('VMPAYMENT_KLARNACHECKOUT_PRODUCTDISCOUNT') . ')';
             $items[$i]['quantity'] = (int) $product->quantity;
             $discount_tax_percent = 0.0;
             $discountInPaymentCurrency = vmPSPlugin::getAmountInCurrency(abs($cart->cartPrices[$pkey]['discountAmount']), $this->_currentMethod->payment_currency);
             $discountAmount = -abs(round($discountInPaymentCurrency['value'] * 100, 0));
             if ($cart->cartPrices[$pkey]['discountAmount'] > 0.0) {
                 $items[$i]['tax_rate'] = $items[$i - 1]['tax_rate'];
             } else {
                 $items[$i]['tax_rate'] = 0.0;
                 $tax_rate = 0.0;
             }
             $items[$i]['unit_price'] = round($discountAmount * (1 + $tax_rate * 0.01), 0);
             $i++;
         }
     }
     if ($cart->cartPrices['salesPriceCoupon']) {
         $items[$i]['reference'] = 'COUPON';
         $items[$i]['name'] = 'Coupon discount';
         $items[$i]['quantity'] = 1;
         $couponInPaymentCurrency = vmPSPlugin::getAmountInCurrency($cart->cartPrices['salesPriceCoupon'], $this->_currentMethod->payment_currency);
         $items[$i]['unit_price'] = round($couponInPaymentCurrency['value'] * 100, 0);
         $items[$i]['tax_rate'] = 0;
         $i++;
     }
     if ($cart->cartPrices['salesPriceShipment']) {
         $items[$i]['reference'] = 'SHIPPING';
         $items[$i]['name'] = 'Shipping Fee';
         $items[$i]['quantity'] = 1;
         $shipmentInPaymentCurrency = vmPSPlugin::getAmountInCurrency($cart->cartPrices['salesPriceShipment'], $this->_currentMethod->payment_currency);
         $items[$i]['unit_price'] = round($shipmentInPaymentCurrency['value'] * 100, 0);
         $items[$i]['tax_rate'] = $this->getTaxShipment($cart->cartPrices['shipment_calc_id']);
     }
     $currency = CurrencyDisplay::getInstance($cart->paymentCurrency);
     $klarnaOrderData['cart']['items'] = $items;
     return;
 }
Exemplo n.º 17
0
 /**
  * @static
  * @param        $price
  * @param string $toCurrency
  * @return float
  */
 static function convertPrice($price, $fromCurrency, $toCurrency = '', $cartPricesCurrency = '')
 {
     if (!(is_int($toCurrency) or is_numeric($toCurrency)) && !empty($toCurrency)) {
         $toCurrency = ShopFunctions::getCurrencyIDByName($toCurrency);
     }
     if ($fromCurrency == $toCurrency) {
         return $price;
     }
     // product prices or total in cart is always in vendor currency
     $priceInNewCurrency = vmPSPlugin::getAmountInCurrency($price, $toCurrency);
     // set back the currency display
     if (empty($cartPricesCurrency)) {
         $cartPricesCurrency = $fromCurrency;
     }
     $cd = CurrencyDisplay::getInstance($cartPricesCurrency);
     vmDebug('convertPrice', $price, $toCurrency, $fromCurrency, $cartPricesCurrency, $priceInNewCurrency);
     return $priceInNewCurrency['value'];
 }
Exemplo n.º 18
0
 /**
  * Subscription products:
  * 1. create a custom field type 'cart Variant', Cart Attribute= Yes
  * 2. Add the custom field to the product
  * 3. There must be a correspondence between custom in products / payment
  * -- first item of custom field => subscribe_1
  * -- second item of custom field => subscribe_2
  * -- third item of custom field => subscribe_3
  *
  * @param VirtueMartCart $cart
  * @return array or boolean
  */
 function getSubscribeProducts(VirtueMartCart $cart)
 {
     static $displayErrorMsg = true;
     $subscribe = array();
     if ($this->_method->subscribe_customfield == 0) {
         return false;
     }
     JPluginHelper::importPlugin('vmcustom');
     $app = JFactory::getApplication();
     $productSubscribe = 0;
     $products = $cart->products;
     $previousSubscribeOptionSelected = 0;
     $first = true;
     foreach ($products as $priceKey => $product) {
         // TODO check it is the correct Abonnement id
         $product_custom_fields = $this->getProdCustomFields($product->virtuemart_product_id);
         if (!empty($product_custom_fields)) {
             foreach ($product_custom_fields as $product_custom_field) {
                 if ($product_custom_field->virtuemart_custom_id == $this->_method->subscribe_customfield) {
                     $subscribeOptionSelected = $this->getSubscribeOptionSelected($product_custom_field, $priceKey);
                     if ($subscribeOptionSelected) {
                         if (!$first and $previousSubscribeOptionSelected != $subscribeOptionSelected) {
                             break;
                         }
                         $productSubscribe++;
                         $subscribe_due_date_amount = 'subscribe_due_date_amount_' . $subscribeOptionSelected;
                         $subscribe_frequency = 'subscribe_frequency_' . $subscribeOptionSelected;
                         $subscribe_test_amount = 'subscribe_test_amount_' . $subscribeOptionSelected;
                         $subscribe_test_period = 'subscribe_test_period_' . $subscribeOptionSelected;
                         $subscribe_id = 'subscribe_id_' . $subscribeOptionSelected;
                         $amountInCurrency = vmPSPlugin::getAmountInCurrency($this->_method->{$subscribe_due_date_amount}, $cart->pricesCurrency);
                         $subscribe['subscribe_due_date_amount'] = $amountInCurrency['display'];
                         $subscribe['subscribe_frequency'] = $this->_method->{$subscribe_frequency};
                         if ($this->_method->{$subscribe_test_amount}) {
                             $amountInCurrency = vmPSPlugin::getAmountInCurrency($this->_method->{$subscribe_test_amount}, $cart->pricesCurrency);
                             $subscribe['subscribe_test_amount'] = $amountInCurrency['display'];
                         }
                         $subscribe['subscribe_test_period'] = $this->_method->{$subscribe_test_period};
                         $subscribe['subscribe_id'] = $this->_method->{$subscribe_id};
                         $previousSubscribeOptionSelected = $subscribeOptionSelected;
                         $first = false;
                         $currencyDisplay = CurrencyDisplay::getInstance($cart->pricesCurrency);
                     }
                 }
             }
         }
     }
     $nbProducts = count($products);
     if ($productSubscribe and $nbProducts != $productSubscribe) {
         if ($displayErrorMsg) {
             $displayErrorMsg = false;
             vmError('VMPAYMENT_KLIKANDPAY_SUBSCRIBE_MIXED_PRODUCTS', 'VMPAYMENT_KLIKANDPAY_SUBSCRIBE_MIXED_PRODUCTS');
         }
         return false;
     } else {
         return $subscribe;
     }
 }
Exemplo n.º 19
0
 /**
  * KP returns AWAITINGCHEQUE OR AWAITING as response for payments other than CC
  * @param $klikandpay_data
  * @param $order
  * @return mixed
  */
 function updateOrderHistory($klikandpay_data, $order, $payments)
 {
     $amountInCurrency = vmPSPlugin::getAmountInCurrency($klikandpay_data['MONTANTXKP'], $klikandpay_data['DEVISEXKP']);
     $order_history['comments'] = vmText::sprintf('VMPAYMENT_KLIKANDPAY_PAYMENT_STATUS_CONFIRMED', $amountInCurrency['display'], $order['details']['BT']->order_number);
     $order_history['customer_notified'] = true;
     if ($klikandpay_data['RESPONSE'] == self::RESPONSE_AWAITINGCHEQUE or $klikandpay_data['RESPONSE'] == self::RESPONSE_AWAITING) {
         $order_history['order_status'] = $this->_method->status_waiting;
     } else {
         $order_history['order_status'] = $this->_method->status_success;
     }
     return $order_history;
 }
Exemplo n.º 20
0
 /**
  *
  *
  * @author Valérie Isaksen
  */
 function plgVmConfirmedOrder($cart, $order)
 {
     $paymentId = $order['details']['BT']->virtuemart_paymentmethod_id;
     if (!($method = $this->getVmPluginMethod($order['details']['BT']->virtuemart_paymentmethod_id))) {
         return NULL;
         // Another method was selected, do nothing
     }
     if (!$this->selectedThisElement($method->payment_element)) {
         return FALSE;
     }
     $lang = JFactory::getLanguage();
     $filename = 'com_virtuemart';
     $lang->load($filename, JPATH_ADMINISTRATOR);
     if (!class_exists('VirtueMartModelOrders')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
     }
     $this->getPaymentCurrency($method);
     $currency_code_3 = shopFunctions::getCurrencyByID($method->payment_currency, 'currency_code_3');
     $email_currency = $this->getEmailCurrency($method);
     $totalInPaymentCurrency = vmPSPlugin::getAmountInCurrency($order['details']['BT']->order_total, $method->payment_currency);
     $dbValues['payment_name'] = $this->renderPluginName($method) . '<br />' . $method->payment_info;
     $dbValues['order_number'] = $order['details']['BT']->order_number;
     $dbValues['virtuemart_paymentmethod_id'] = $order['details']['BT']->virtuemart_paymentmethod_id;
     $dbValues['cost_per_transaction'] = $method->cost_per_transaction;
     $dbValues['cost_percent_total'] = $method->cost_percent_total;
     $dbValues['payment_currency'] = $currency_code_3;
     $dbValues['email_currency'] = $email_currency;
     $dbValues['payment_order_total'] = $totalInPaymentCurrency['value'];
     $dbValues['tax_id'] = $method->tax_id;
     $this->storePSPluginInternalData($dbValues);
     $currency = CurrencyDisplay::getInstance('', $order['details']['BT']->virtuemart_vendor_id);
     $param = array("login_id" => $method->api_login_id, "password" => $method->api_password, "prod_id" => $method->api_product_id, "ttype" => "NBFundTransfer", "ordernum" => $dbValues['order_number'], "amount" => $order['details']['BT']->order_total, "curr" => "INR", "txnamt" => "0", "client_code" => "007", "customer_acc_no" => "1234567890", "paynetz_url" => $method->api_merchant_url);
     //$this->updateRecords( $dbValues['order_number'], $order['details']['BT']->order_total, $d );
     $this->requestMerchant($param, $paymentId);
     /*
     $app = JFactory::getApplication();
     $app->redirect($url);
     */
     $html = '<table class="vmorder-done">' . "\n";
     $html .= $this->getHtmlRow('paynetz_PAYMENT_INFO', $dbValues['payment_name'], 'class="vmorder-done-payinfo"');
     if (!empty($payment_info)) {
         $lang = JFactory::getLanguage();
         if ($lang->hasKey($method->payment_info)) {
             $payment_info = JText::_($method->payment_info);
         } else {
             $payment_info = $method->payment_info;
         }
         $html .= $this->getHtmlRow('paynetz_PAYMENTINFO', $payment_info, 'class="vmorder-done-payinfo"');
     }
     if (!class_exists('VirtueMartModelCurrency')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'currency.php';
     }
     $html .= $this->getHtmlRow('paynetz_ORDER_NUMBER', $order['details']['BT']->order_number, 'class="vmorder-done-nr"');
     $html .= $this->getHtmlRow('paynetz_AMOUNT', $currency->priceDisplay($order['details']['BT']->order_total), 'class="vmorder-done-amount"');
     if ($method->payment_currency != $order['details']['BT']->order_currency) {
         $html .= $this->getHtmlRow('COM_VIRTUEMART_CART_TOTAL_PAYMENT', $totalInPaymentCurrency['display'], 'class="vmorder-done-amount"');
     }
     //$html .= $this->getHtmlRow('paynetz_INFO', $method->payment_info);
     //$html .= $this->getHtmlRow('paynetz_AMOUNT', $totalInPaymentCurrency.' '.$currency_code_3);
     $html .= '</table>' . "\n";
     $modelOrder = VmModel::getModel('orders');
     $order['order_status'] = $this->getNewStatus($method);
     $order['customer_notified'] = 1;
     $order['comments'] = '';
     $modelOrder->updateStatusForOneOrder($order['details']['BT']->virtuemart_order_id, $order, TRUE);
     //We delete the old stuff
     $cart->emptyCart();
     JRequest::setVar('html', $html);
     return TRUE;
 }
Exemplo n.º 21
0
 /**
  * @param $paybox_data
  * @param $order
  * @return mixed
  */
 function getOrderHistory($paybox_data, $order, $payments)
 {
     $amountInCurrency = vmPSPlugin::getAmountInCurrency($paybox_data['M'] * 0.01, $order['details']['BT']->order_currency);
     $order_history['comments'] = tsmText::sprintf('VMPAYMENT_' . $this->plugin_name . '_PAYMENT_STATUS_CONFIRMED', $amountInCurrency['display'], $order['details']['BT']->order_number);
     $order_history['comments'] .= "<br />" . tsmText::_('VMPAYMENT_' . $this->plugin_name . '_RESPONSE_S') . ' ' . $paybox_data['S'];
     $order_history['customer_notified'] = true;
     $status_success = 'status_success_' . $this->_method->debit_type;
     $order_history['order_status'] = $this->_method->{$status_success};
     return $order_history;
 }
Exemplo n.º 22
0
 function plgVmConfirmedOrder($cart, $order, $payment_method = '')
 {
     if (!($method = $this->getVmPluginMethod($order['details']['BT']->virtuemart_paymentmethod_id))) {
         return NULL;
     }
     // Another method was selected, do nothing
     if (!$this->selectedThisElement($method->payment_element)) {
         return FALSE;
     }
     $session = JFactory::getSession();
     $return_context = $session->getId();
     $this->logInfo('plgVmConfirmedOrder order number: ' . $order['details']['BT']->order_number, 'message');
     if (!class_exists('VirtueMartModelOrders')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
     }
     if (!class_exists('VirtueMartModelCurrency')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'currency.php';
     }
     $usrBT = $order['details']['BT'];
     $address = isset($order['details']['ST']) ? $order['details']['ST'] : $order['details']['BT'];
     if (!class_exists('TableVendors')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'tables' . DS . 'vendors.php';
     }
     $vendorModel = VmModel::getModel('Vendor');
     $vendorModel->setId(1);
     $vendor = $vendorModel->getVendor();
     $vendorModel->addImages($vendor, 1);
     $this->getPaymentCurrency($method);
     $q = 'SELECT `currency_code_3` FROM `#__virtuemart_currencies` WHERE `virtuemart_currency_id`="' . $method->payment_currency . '" ';
     $db = JFactory::getDBO();
     $db->setQuery($q);
     $currency_code_3 = $db->loadResult();
     $totalInPaymentCurrency = vmPSPlugin::getAmountInCurrency($order['details']['BT']->order_total, $method->payment_currency);
     $cartCurrency = CurrencyDisplay::getInstance($cart->pricesCurrency);
     if ($totalInPaymentCurrency['value'] <= 0) {
         vmInfo(JText::_('VMPAYMENT_MONEYBOOKERS_PAYMENT_AMOUNT_INCORRECT'));
         return FALSE;
     }
     $merchant_email = $method->pay_to_email;
     if (empty($merchant_email)) {
         vmInfo(JText::_('VMPAYMENT_MONEYBOOKERS_MERCHANT_EMAIL_NOT_SET'));
         return FALSE;
     }
     $lang = JFactory::getLanguage();
     $tag = substr($lang->get('tag'), 0, 2);
     $post_variables = array('pay_to_email' => $merchant_email, 'pay_from_email' => $address->email, 'payment_methods' => $payment_method, 'recipient_description' => $vendorModel->getVendorName(), 'transaction_id' => $order['details']['BT']->order_number, 'return_url' => JROUTE::_(JURI::root() . 'index.php?option=com_virtuemart&view=pluginresponse&task=pluginresponsereceived&on=' . $order['details']['BT']->order_number . '&pm=' . $order['details']['BT']->virtuemart_paymentmethod_id . '&Itemid=' . JRequest::getInt('Itemid')), 'cancel_url' => JROUTE::_(JURI::root() . 'index.php?option=com_virtuemart&view=pluginresponse&task=pluginUserPaymentCancel&on=' . $order['details']['BT']->order_number . '&pm=' . $order['details']['BT']->virtuemart_paymentmethod_id . '&Itemid=' . JRequest::getInt('Itemid')), 'status_url' => JROUTE::_(JURI::root() . 'index.php?option=com_virtuemart&view=pluginresponse&task=pluginnotification&tmpl=component'), 'platform' => '21477272', 'hide_login' => $method->hide_login, 'prepare_only' => 1, 'logo_url' => $method->logourl, 'language' => strtoupper($tag), "firstname" => $address->first_name, "lastname" => $address->last_name, "address" => $address->address_1, "address2" => isset($address->address_2) ? $address->address_2 : '', "phone_number" => $address->phone_1, "postal_code" => $address->zip, "city" => $address->city, "state" => isset($address->virtuemart_state_id) ? ShopFunctions::getStateByID($address->virtuemart_state_id, 'state_2_code') : '', "country" => ShopFunctions::getCountryByID($address->virtuemart_country_id, 'country_3_code'), 'amount' => $totalInPaymentCurrency['value'], 'currency' => $currency_code_3, 'detail1_description' => JText::_('VMPAYMENT_MONEYBOOKERS_ORDER_NUMBER') . ': ', 'detail1_text' => $order['details']['BT']->order_number);
     // Prepare data that should be stored in the database
     $dbValues['user_session'] = $return_context;
     $dbValues['order_number'] = $order['details']['BT']->order_number;
     $dbValues['payment_name'] = $this->renderPluginName($method, $order);
     $dbValues['virtuemart_paymentmethod_id'] = $cart->virtuemart_paymentmethod_id;
     $dbValues['cost_per_transaction'] = $method->cost_per_transaction;
     $dbValues['cost_percent_total'] = $method->cost_percent_total;
     $dbValues['payment_currency'] = $method->payment_currency;
     $dbValues['payment_order_total'] = $totalInPaymentCurrency['value'];
     $dbValues['tax_id'] = $method->tax_id;
     $this->storePSPluginInternalData($dbValues);
     $content = http_build_query($post_variables);
     $url = $this->_getMoneybookersURL($method);
     $header = "POST /app/payment.pl HTTP/1.1\r\n";
     $header .= "Host: {$url}\r\n";
     $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
     $header .= "Content-Length: " . strlen($content) . "\r\n\r\n";
     $fps = fsockopen('ssl://' . $url, 443, $errno, $errstr, 10);
     // timeout applies only to connecting not for I/O
     $sid = '';
     if (!$fps || !stream_set_blocking($fps, 0)) {
         $this->sendEmailToVendorAndAdmins("Error with Moneybookers: ", JText::sprintf('VMPAYMENT_MONEYBOOKERS_ERROR_POSTING_IPN', $errstr, $errno));
         $this->logInfo('Process IPN ' . JText::sprintf('VMPAYMENT_MONEYBOOKERS_ERROR_POSTING_IPN', $errstr, $errno), 'message');
         vmInfo(JText::_('VMPAYMENT_MONEYBOOKERS_DISPLAY_GWERROR'));
         return NULL;
     } else {
         fwrite($fps, $header);
         fwrite($fps, $content);
         stream_set_timeout($fps, 10);
         $read = array($fps);
         $write = $except = NULL;
         $msg = $rbuff = '';
         if (stream_select($read, $write, $except, 10)) {
             $rbuff = fread($fps, 1024);
             $msg .= $rbuff;
         }
         $response = $this->_parse_response($msg);
         if (!count($response)) {
             $this->logInfo('Process IPN (empty or bad response) ' . $msg, 'message');
             vmInfo(JText::_('VMPAYMENT_MONEYBOOKERS_DISPLAY_GWERROR'));
             return NULL;
         }
         $sid = $response[0];
         $this->logInfo($response[0], 'message');
     }
     fclose($fps);
     $height = $method->hide_login ? 720 : 500;
     $html = '<html><head><title></title><script type="text/javascript">
             jQuery(document).ready(function () {
                 jQuery(\'#main h3\').css("display", "none");
             });
             </script></head><body>';
     $html .= '<iframe src="https://' . $this->_getMoneybookersURL($method) . '/app/payment.pl?sid=' . $sid . '" scrolling="yes" style="x-overflow: none;"
             frameborder="0" height="' . (string) $height . 'px" width="650px"></iframe>';
     $cart->_confirmDone = FALSE;
     $cart->_dataValidated = FALSE;
     $cart->setCartIntoSession();
     JRequest::setVar('html', $html);
 }
Exemplo n.º 23
0
 function getOrderHistory($klikandpay_data, $order, $payments)
 {
     if (count($payments) == 1) {
         $amountInCurrency = vmPSPlugin::getAmountInCurrency($order['details']['BT']->order_total, $order['details']['BT']->order_currency);
         $order_history['comments'] = vmText::sprintf('VMPAYMENT_KLIKANDPAY_PAYMENT_STATUS_CONFIRMED_RECURRING', $amountInCurrency['display'], $order['details']['BT']->order_number);
     }
     $amountInCurrency = vmPSPlugin::getAmountInCurrency($klikandpay_data['MONTANTXKP'], $order['details']['BT']->order_currency);
     $order_history['comments'] .= "<br />" . vmText::sprintf('VMPAYMENT_KLIKANDPAY_PAYMENT_STATUS_CONFIRMED_RECURRING_2', $amountInCurrency['display']);
     if (count($payments) == 1) {
         $recurring_comment = '';
         $payment = $payments[0];
         $recurring = json_decode($payment->recurring);
         $amountInCurrency = vmPSPlugin::getAmountInCurrency($recurring->MONTANT, $order['details']['BT']->order_currency);
         $recurring_comment .= "<br />" . vmText::_('VMPAYMENT_KLIKANDPAY_RECURRING_MONTANT') . ' ' . $amountInCurrency['display'];
         if (isset($recurring->MONTANT2)) {
             $amountInCurrency = vmPSPlugin::getAmountInCurrency($recurring->MONTANT2, $order['details']['BT']->order_currency);
             $recurring_comment .= "<br />" . vmText::_('VMPAYMENT_KLIKANDPAY_RECURRING_MONTANT2') . ' ' . $amountInCurrency['display'];
         }
         if (isset($recurring->EXTRA)) {
             $recurring_comment .= "<br />" . vmText::_('VMPAYMENT_KLIKANDPAY_RECURRING_EXTRA') . ' ' . substr($recurring->EXTRA, 0, 1);
         }
         if (isset($recurring->DATE2)) {
             $recurring_comment .= vmText::_('VMPAYMENT_KLIKANDPAY_RECURRING_DATE2') . ' ' . $recurring->DATE2;
         }
     }
     $nbRecurringDone = $this->getNbRecurringDone($payments);
     if ($nbRecurringDone < $this->_method->recurring_number) {
         $order_history['order_status'] = $this->_method->status_success_recurring;
     } else {
         $order_history['order_status'] = $this->_method->status_success_recurring_end;
     }
     $order_history['customer_notified'] = true;
     $order_history['comments'] .= $recurring_comment;
     return $order_history;
 }
Exemplo n.º 24
0
 function getCartItems($cart)
 {
     vmdebug('getProductItems', $cart->pricesUnformatted);
     //self::includeKlarnaFiles();
     $i = 0;
     foreach ($cart->products as $pkey => $product) {
         $items[$i]['reference'] = !empty($product->sku) ? $product->sku : $product->virtuemart_product_id;
         $items[$i]['name'] = $product->product_name;
         $items[$i]['quantity'] = (int) $product->quantity;
         $price = !empty($product->prices['basePriceWithTax']) ? $product->prices['basePriceWithTax'] : $product->prices['basePriceVariant'];
         $itemInPaymentCurrency = vmPSPlugin::getAmountInCurrency($price, $this->method->payment_currency);
         $items[$i]['unit_price'] = round($itemInPaymentCurrency['value'] * 100, 0);
         //$items[$i]['discount_rate'] = $discountRate;
         // Bug indoc: discount is not supported
         //$items[$i]['discount'] = abs($cart->pricesUnformatted[$pkey]['discountAmount']*100);
         $tax_rate = round($this->getVatTaxProduct($cart->pricesUnformatted[$pkey]['VatTax']));
         $items[$i]['tax_rate'] = $tax_rate * 100;
         //$this->debugLog($unitPriceCentsInPaymentCurrency, 'getCartItems', 'debug');
         //$this->debugLog($cart->pricesUnformatted[$pkey], 'getCartItems Products', 'debug');
         $this->debugLog($items[$i], 'getCartItems', 'debug');
         $i++;
         // ADD A DISCOUNT AS A NEGATIVE VALUE FOR THAT PRODUCT
         if ($cart->pricesUnformatted[$pkey]['discountAmount'] != 0.0) {
             $items[$i]['reference'] = $items[$i - 1]['reference'];
             $items[$i]['name'] = $items[$i - 1]['name'] . ' (' . vmText::_('VMPAYMENT_KLARNACHECKOUT_PRODUCTDISCOUNT') . ')';
             $items[$i]['quantity'] = (int) $product->quantity;
             $discount_tax_percent = 0.0;
             $discountInPaymentCurrency = vmPSPlugin::getAmountInCurrency(abs($cart->pricesUnformatted[$pkey]['discountAmount']), $this->method->payment_currency);
             $discountAmount = -abs(round($discountInPaymentCurrency['value'] * 100, 0));
             if ($cart->pricesUnformatted[$pkey]['discountAmount'] > 0.0) {
                 $items[$i]['tax_rate'] = $items[$i - 1]['tax_rate'];
             } else {
                 $items[$i]['tax_rate'] = 0.0;
                 $tax_rate = 0.0;
             }
             $items[$i]['unit_price'] = round($discountAmount * (1 + $tax_rate * 0.01), 0);
             $this->debugLog($items[$i], 'getCartItems', 'debug');
             $i++;
         }
     }
     if ($cart->pricesUnformatted['salesPriceCoupon']) {
         $items[$i]['reference'] = 'COUPON';
         $items[$i]['name'] = 'Coupon discount';
         $items[$i]['quantity'] = 1;
         $couponInPaymentCurrency = vmPSPlugin::getAmountInCurrency($cart->pricesUnformatted['salesPriceCoupon'], $this->method->payment_currency);
         $items[$i]['unit_price'] = round($couponInPaymentCurrency['value'] * 100, 0);
         $items[$i]['tax_rate'] = 0;
         $this->debugLog($cart->pricesUnformatted['salesPriceCoupon'], 'getCartItems Coupon', 'debug');
         $this->debugLog($items[$i], 'getCartItems', 'debug');
         $i++;
     }
     if ($cart->pricesUnformatted['salesPriceShipment']) {
         $items[$i]['reference'] = 'SHIPPING';
         $items[$i]['name'] = 'Shipping Fee';
         $items[$i]['quantity'] = 1;
         $shipmentInPaymentCurrency = vmPSPlugin::getAmountInCurrency($cart->pricesUnformatted['salesPriceShipment'], $this->method->payment_currency);
         $items[$i]['unit_price'] = round($shipmentInPaymentCurrency['value'] * 100, 0);
         $items[$i]['tax_rate'] = $this->getTaxShipment($cart->pricesUnformatted['shipment_calc_id']);
         $this->debugLog($cart->pricesUnformatted['salesPriceShipment'], 'getCartItems Shipment', 'debug');
         $this->debugLog($items[$i], 'getCartItems', 'debug');
     }
     $currency = CurrencyDisplay::getInstance($cart->paymentCurrency);
     return $items;
 }
Exemplo n.º 25
0
 /**
  * @param $cart
  * @param $order
  * @return bool|null
  */
 function plgVmConfirmedOrder($cart, $order)
 {
     if (!($method = $this->getVmPluginMethod($order['details']['BT']->virtuemart_paymentmethod_id))) {
         return NULL;
         // Another method was selected, do nothing
     }
     if (!$this->selectedThisElement($method->payment_element)) {
         return FALSE;
     }
     $session = JFactory::getSession();
     $return_context = $session->getId();
     $this->_debug = $method->debug;
     $this->logInfo('plgVmConfirmedOrder order number: ' . $order['details']['BT']->order_number, 'message');
     if (!class_exists('VirtueMartModelOrders')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
     }
     if (!class_exists('VirtueMartModelCurrency')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'currency.php';
     }
     $address = isset($order['details']['ST']) ? $order['details']['ST'] : $order['details']['BT'];
     if (!class_exists('TableVendors')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'tables' . DS . 'vendors.php';
     }
     $vendorModel = VmModel::getModel('Vendor');
     $vendorModel->setId(1);
     $vendor = $vendorModel->getVendor();
     $vendorModel->addImages($vendor, 1);
     $this->getPaymentCurrency($method);
     $email_currency = $this->getEmailCurrency($method);
     $currency_code_3 = shopFunctions::getCurrencyByID($method->payment_currency, 'currency_code_3');
     $totalInPaymentCurrency = vmPSPlugin::getAmountInCurrency($order['details']['BT']->order_total, $method->payment_currency);
     $cd = CurrencyDisplay::getInstance($cart->pricesCurrency);
     if ($totalInPaymentCurrency <= 0) {
         vmInfo(JText::_('VMPAYMENT_PAYPAL_PAYMENT_AMOUNT_INCORRECT'));
         return FALSE;
     }
     $merchant_email = $this->_getMerchantEmail($method);
     if (empty($merchant_email)) {
         vmInfo(JText::_('VMPAYMENT_PAYPAL_MERCHANT_EMAIL_NOT_SET'));
         return FALSE;
     }
     $quantity = 0;
     foreach ($cart->products as $key => $product) {
         $quantity = $quantity + $product->quantity;
     }
     $post_variables = array('cmd' => '_ext-enter', 'redirect_cmd' => '_xclick', 'upload' => '1', 'business' => $merchant_email, 'receiver_email' => $merchant_email, 'order_number' => $order['details']['BT']->order_number, "invoice" => $order['details']['BT']->order_number, 'custom' => $return_context, 'item_name' => JText::_('VMPAYMENT_PAYPAL_ORDER_NUMBER') . ': ' . $order['details']['BT']->order_number, "amount" => $totalInPaymentCurrency['value'], "currency_code" => $currency_code_3, "address_override" => isset($method->address_override) ? $method->address_override : 0, "first_name" => $address->first_name, "last_name" => $address->last_name, "address1" => $address->address_1, "address2" => isset($address->address_2) ? $address->address_2 : '', "zip" => $address->zip, "city" => $address->city, "state" => isset($address->virtuemart_state_id) ? ShopFunctions::getStateByID($address->virtuemart_state_id, 'state_2_code') : '', "country" => ShopFunctions::getCountryByID($address->virtuemart_country_id, 'country_2_code'), "email" => $order['details']['BT']->email, "night_phone_b" => $address->phone_1, "return" => substr(JURI::root(false, ''), 0, -1) . JROUTE::_('index.php?option=com_virtuemart&view=pluginresponse&task=pluginresponsereceived&on=' . $order['details']['BT']->order_number . '&pm=' . $order['details']['BT']->virtuemart_paymentmethod_id . '&Itemid=' . JRequest::getInt('Itemid'), false), "notify_url" => substr(JURI::root(false, ''), 0, -1) . JROUTE::_('index.php?option=com_virtuemart&view=pluginresponse&task=pluginnotification&tmpl=component', false), "cancel_return" => substr(JURI::root(false, ''), 0, -1) . JROUTE::_('index.php?option=com_virtuemart&view=pluginresponse&task=pluginUserPaymentCancel&on=' . $order['details']['BT']->order_number . '&pm=' . $order['details']['BT']->virtuemart_paymentmethod_id . '&Itemid=' . JRequest::getInt('Itemid'), false), "ipn_test" => $method->debug, "rm" => '2', "bn" => "VirtueMart_Cart_PPA", "image_url" => JURI::base() . $vendor->images[0]->file_url, "no_shipping" => isset($method->no_shipping) ? $method->no_shipping : 0, "no_note" => "1");
     // Prepare data that should be stored in the database
     $dbValues['order_number'] = $order['details']['BT']->order_number;
     $dbValues['payment_name'] = $this->renderPluginName($method, $order);
     $dbValues['virtuemart_paymentmethod_id'] = $cart->virtuemart_paymentmethod_id;
     $dbValues['paypal_custom'] = $return_context;
     $dbValues['cost_per_transaction'] = $method->cost_per_transaction;
     $dbValues['cost_percent_total'] = $method->cost_percent_total;
     $dbValues['payment_currency'] = $method->payment_currency;
     $dbValues['email_currency'] = $email_currency;
     $dbValues['payment_order_total'] = $totalInPaymentCurrency['value'];
     $dbValues['tax_id'] = $method->tax_id;
     $this->storePSPluginInternalData($dbValues);
     $url = $this->_getPaypalUrlHttps($method);
     // add spin image
     $html = '<html><head><title>Redirection</title></head><body><div style="margin: auto; text-align: center;">';
     $html .= '<form action="' . "https://" . $url . '" method="post" name="vm_paypal_form"  accept-charset="UTF-8">';
     $html .= '<input type="submit"  value="' . JText::_('VMPAYMENT_PAYPAL_REDIRECT_MESSAGE') . '" />';
     $html .= '<input type="hidden" name="charset" value="utf-8">';
     foreach ($post_variables as $name => $value) {
         $html .= '<input type="hidden" name="' . $name . '" value="' . htmlspecialchars($value) . '" />';
     }
     $html .= '</form></div>';
     $html .= ' <script type="text/javascript">';
     $html .= ' document.vm_paypal_form.submit();';
     $html .= ' </script></body></html>';
     // 	2 = don't delete the cart, don't send email and don't redirect
     $cart->_confirmDone = FALSE;
     $cart->_dataValidated = FALSE;
     $cart->setCartIntoSession();
     JRequest::setVar('html', $html);
     /*
     
      $qstring = '?';
      foreach ($post_variables AS $k => $v) {
      $qstring .= ( empty($qstring) ? '' : '&')
      . urlencode($k) . '=' . urlencode($v);
      }
      // we can display the logo, or do the redirect
      $mainframe = JFactory::getApplication();
      $mainframe->redirect("https://" . $url . $qstring);
     
     
      return false; // don't delete the cart, don't send email
     */
 }
Exemplo n.º 26
0
 /**
  * @param $response
  * @param $order
  * @return null|string
  */
 function getResponseHTML($order, $payments)
 {
     $transactionId = '';
     $success = false;
     $prochaine = '';
     $numxkp = '';
     $interface = $this->_loadKlikandpayInterface($this);
     if (count($payments) > 1) {
         $last_payment = end($payments);
         $numxkp = $last_payment->klikandpay_response_NUMXKP;
         $success = $interface->isResponseSuccess($last_payment->klikandpay_response_RESPONSE);
         $fullresponse = json_decode($last_payment->klikandpay_fullresponse);
         if (isset($fullresponse->PROCHAINE)) {
             $prochaine = $fullresponse->PROCHAINE;
         }
     }
     $payment_name = $this->renderPluginName($this->_currentMethod);
     VmConfig::loadJLang('com_virtuemart_orders', TRUE);
     if (!class_exists('VirtueMartCart')) {
         require VMPATH_SITE . DS . 'helpers' . DS . 'cart.php';
     }
     $cart = VirtueMartCart::getCart();
     $amountInCurrency = vmPSPlugin::getAmountInCurrency($order['details']['BT']->order_total, $order['details']['BT']->order_currency);
     $currencyDisplay = CurrencyDisplay::getInstance($cart->pricesCurrency);
     $html = $this->renderByLayout('response', array("success" => $success, "payment_name" => $payment_name, "numxkp" => $numxkp, "amountInCurrency" => $amountInCurrency['display'], "prochaine" => $prochaine, "order_number" => $order['details']['BT']->order_number, "order_pass" => $order['details']['BT']->order_pass));
     return $html;
 }
Exemplo n.º 27
0
 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;
 }
Exemplo n.º 28
0
 function getResponseHTML($order)
 {
     $payment_name = $this->renderPluginName($this->_currentMethod);
     VmConfig::loadJLang('com_virtuemart_orders', TRUE);
     if (!class_exists('VirtueMartCart')) {
         require VMPATH_SITE . DS . 'helpers' . DS . 'cart.php';
     }
     $cart = VirtueMartCart::getCart();
     $amountInCurrency = vmPSPlugin::getAmountInCurrency($order['details']['BT']->order_total, $order['details']['BT']->order_currency);
     $currencyDisplay = CurrencyDisplay::getInstance($cart->pricesCurrency);
     $html = $this->renderByLayout('response', array('order_number' => $order['details']['BT']->order_number, 'order_pass' => $order['details']['BT']->order_pass, 'payment_name' => 'Veritrans', 'displayTotalInPaymentCurrency' => $amountInCurrency['display']));
     return $html;
 }