Exemplo n.º 1
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.º 2
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.º 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);
     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.º 4
0
 /**
  * Display stored payment data for an order
  * @param  int $virtuemart_order_id
  * @param  int $payment_method_id
  * @see components/com_virtuemart/helpers/vmPSPlugin::plgVmOnShowOrderBEPayment()
  */
 function plgVmOnShowOrderBEPayment($virtuemart_order_id, $payment_method_id)
 {
     if (!$this->selectedThisByMethodId($payment_method_id)) {
         return NULL;
         // Another method was selected, do nothing
     }
     if (!($payments = $this->getDatasByOrderId($virtuemart_order_id))) {
         // JError::raiseWarning(500, $db->getErrorMsg());
         return '';
     }
     $html = '<table class="adminlist table">' . "\n";
     $html .= $this->getHtmlHeaderBE();
     $code = "sofort_response_";
     $first = TRUE;
     foreach ($payments as $payment) {
         $html .= '<tr class="row1"><th>' . vmText::_('COM_VIRTUEMART_DATE') . '</th><th align="left">' . $payment->created_on . '</th></tr>';
         // Now only the first entry has this data when creating the order
         if ($first) {
             $html .= $this->getHtmlRowBE('SOFORT_PAYMENT_NAME', $payment->payment_name);
             // keep that test to have it backwards compatible. Old version was deleting that column  when receiving an IPN notification
             if ($payment->payment_order_total and $payment->payment_order_total != 0.0) {
                 $html .= $this->getHtmlRowBE('SOFORT_PAYMENT_ORDER_TOTAL', $payment->payment_order_total . " " . shopFunctions::getCurrencyByID($payment->payment_currency, 'currency_code_3'));
             }
             if ($payment->email_currency and $payment->email_currency != 0) {
                 $html .= $this->getHtmlRowBE('SOFORT_PAYMENT_EMAIL_CURRENCY', shopFunctions::getCurrencyByID($payment->email_currency, 'currency_code_3'));
             }
             if ($payment->email_currency and $payment->email_currency != 0) {
                 $html .= $this->getHtmlRowBE('SOFORT_RESPONSE_TRANSACTION', $payment->sofort_response_transaction);
             }
             $first = FALSE;
         } else {
             foreach ($payment as $key => $value) {
                 // only displays if there is a value or the value is different from 0.00 and the value
                 if ($value) {
                     if (substr($key, 0, strlen($code)) == $code) {
                         $html .= $this->getHtmlRowBE($key, $value);
                     }
                 }
             }
         }
     }
     $html .= '</table>' . "\n";
     return $html;
 }
Exemplo n.º 5
0
    /**
     * @param $virtuemart_order_id
     * @return string
     */
    function showOrderBEPayment($virtuemart_order_id)
    {
        $db = JFactory::getDBO();
        $q = 'SELECT * FROM `' . $this->plugin->getTablename() . '` WHERE ';
        $q .= ' `virtuemart_order_id` = ' . $virtuemart_order_id;
        $db->setQuery($q);
        $payments = $db->loadObjectList();
        $html = '<table class="adminlist table">' . "\n";
        $html .= $this->plugin->getHtmlHeaderBE();
        $first = TRUE;
        $lang = JFactory::getLanguage();
        foreach ($payments as $payment) {
            $html .= '<tr class="row1"><td>' . tsmText::_('VMPAYMENT_' . $this->plugin_name . '_DATE') . '</td><td align="left">' . $payment->created_on . '</td></tr>';
            // Now only the first entry has this data when creating the order
            if ($first) {
                $html .= $this->plugin->getHtmlRowBE($this->plugin_name . '_PAYMENT_NAME', $payment->payment_name);
                // keep that test to have it backwards compatible. Old version was deleting that column  when receiving an IPN notification
                if ($payment->payment_order_total and $payment->payment_order_total != 0.0) {
                    $html .= $this->plugin->getHtmlRowBE($this->plugin_name . '_PAYMENT_ORDER_TOTAL', $payment->payment_order_total * 0.01 . " " . shopFunctions::getCurrencyByID($payment->payment_currency, 'currency_code_3'));
                }
                if ($payment->email_currency and $payment->email_currency != 0) {
                    //$html .= $this->getHtmlRowBE($this->_name.'_PAYMENT_EMAIL_CURRENCY', shopFunctions::getCurrencyByID($payment->email_currency, 'currency_code_3'));
                }
                if ($payment->recurring) {
                    $recurring_html = '<table class="adminlist table">' . "\n";
                    $recurring = json_decode($payment->recurring);
                    $recurring_html .= $this->plugin->getHtmlRowBE($this->plugin_name . '_CONF_RECURRING_PERIODICTY', $payment->recurring_periodicity);
                    $recurring_html .= $this->plugin->getHtmlRowBE($this->plugin_name . '_CONF_RECURRING_NUMBER', $payment->recurring_number);
                    //$recurring_html .= $this->getHtmlRowBE(VmText::_('VMPAYMENT_'.$this->_name.'_CONF_RECURRING_PERIODICTY').' '. $payment->recurring_periodicity, VmText::_('VMPAYMENT_'.$this->_name.'_CONF_RECURRING_NUMBER').' '. $payment->recurring_number);
                    for ($i = 1; $i < $payment->recurring_number; $i++) {
                        $index_mont = "PBX_2MONT" . $i;
                        $index_date = "PBX_DATE" . $i;
                        $text_mont = tsmText::_('VMPAYMENT_' . $this->plugin_name . '_PAYMENT_RECURRING_2MONT') . " " . $i;
                        $text_date = tsmText::_('VMPAYMENT_' . $this->plugin_name . '_PAYMENT_RECURRING_DATE') . " " . $i;
                        //$recurring_html .= $this->getHtmlRowBE($text_date, $recurring->$index_date);
                        //$recurring_html .= $this->getHtmlRowBE($text_mont, ($recurring->$index_mont * 0.01) . " " . shopFunctions::getCurrencyByID($payment->payment_currency, 'currency_code_3'));
                        $recurring_html .= $this->plugin->getHtmlRowBE($recurring->{$index_date}, $recurring->{$index_mont} * 0.01 . " " . shopFunctions::getCurrencyByID($payment->payment_currency, 'currency_code_3'));
                    }
                    $recurring_html .= '</table>' . "\n";
                    $html .= $this->plugin->getHtmlRowBE($this->plugin_name . '_RECURRING', $recurring_html);
                }
                $first = FALSE;
            } else {
                if (!empty($payment->paybox_fullresponse)) {
                    $paybox_data = json_decode($payment->paybox_fullresponse);
                    $showOrderBEFields = $this->getOrderBEFields();
                    $prefix = $this->plugin_name . '_RESPONSE_';
                    foreach ($showOrderBEFields as $showOrderBEField) {
                        if (isset($paybox_data->{$showOrderBEField}) and !empty($paybox_data->{$showOrderBEField})) {
                            $key = $prefix . $showOrderBEField;
                            if (method_exists($this, 'getValueBE_' . $showOrderBEField)) {
                                $function = 'getValueBE_' . $showOrderBEField;
                                $paybox_data->{$showOrderBEField} = $this->{$function}($paybox_data->{$showOrderBEField});
                            }
                            $html .= $this->plugin->getHtmlRowBE($key, $paybox_data->{$showOrderBEField});
                        }
                    }
                    $html .= '<tr><td></td><td>
<a href="#" class="PayboxLogOpener" rel="' . $payment->id . '" >
	<div style="background-color: white; z-index: 100; right:0; display: none; border:solid 2px; padding:10px;" class="vm-absolute" id="PayboxLog_' . $payment->id . '">';
                    foreach ($paybox_data as $key => $value) {
                        $langKey = 'VMPAYMENT_' . $prefix . $key;
                        if ($lang->hasKey($langKey)) {
                            $label = tsmText::_($langKey);
                        } else {
                            $label = $key;
                        }
                        $html .= ' <b>' . $label . '</b>:&nbsp;' . wordwrap($value, 50, "\n", true) . '<br />';
                    }
                    $html .= ' </div>
	<span class="icon-nofloat vmicon vmicon-16-xml"></span>&nbsp;';
                    $html .= tsmText::_('VMPAYMENT_' . $this->plugin_name . '_VIEW_TRANSACTION_LOG');
                    $html .= '  </a>';
                    $html .= ' </td></tr>';
                }
            }
        }
        $html .= '</table>' . "\n";
        $doc = JFactory::getDocument();
        $js = "\njQuery().ready(function(\$) {\n\t\$('.PayboxLogOpener').click(function() {\n\t\tvar logId = \$(this).attr('rel');\n\t\t\$('#PayboxLog_'+logId).toggle();\n\t\treturn false;\n\t});\n});";
        $doc->addScriptDeclaration($js);
        return $html;
    }
Exemplo n.º 6
0
 protected function _check_email_amount_currency($payments, $paypal_data)
 {
     /*
      * TODO Not checking yet because config do not have primary email address
      * Primary email address of the payment recipient (that is, the merchant).
      * If the payment is sent to a non-primary email address on your PayPal account,
      * the receiver_email is still your primary email.
      */
     if ($this->_method->paypalproduct == "std") {
         if (strcasecmp($paypal_data['business'], $this->merchant_email) != 0) {
             $errorInfo = array("paypal_data" => $paypal_data, 'merchant_email' => $this->merchant_email);
             $this->debugLog($errorInfo, 'IPN notification: wrong merchant_email', 'error', false);
             return false;
         }
     }
     $result = false;
     $payment_currency_code_3 = shopFunctions::getCurrencyByID($payments[0]->payment_currency, 'currency_code_3');
     if ($this->_method->paypalproduct == "std" and $paypal_data['txn_type'] == 'cart') {
         if (abs($payments[0]->payment_order_total - $paypal_data['mc_gross'] < abs($paypal_data['mc_gross'] * 0.001)) and $payment_currency_code_3 == $paypal_data['mc_currency']) {
             $result = TRUE;
         }
     } else {
         if ($payments[0]->payment_order_total == $paypal_data['mc_gross'] and $this->currency_code_3 == $paypal_data['mc_currency']) {
             $result = TRUE;
         }
     }
     if (!$result) {
         $errorInfo = array("paypal_data" => $paypal_data, 'payment_order_total' => $payments[0]->payment_order_total, 'currency_code_3' => $payment_currency_code_3, 'testing Total-mc-gross' => $payments[0]->payment_order_total - $paypal_data['mc_gross'], 'testing Compare' => $paypal_data['mc_gross'] * 0.001, 'testing Result' => (int) abs($payments[0]->payment_order_total - $paypal_data['mc_gross'] < abs($paypal_data['mc_gross'] * 0.001)));
         $this->debugLog($errorInfo, 'IPN notification with invalid amount or currency or email', 'error', false);
     }
     return $result;
 }
Exemplo n.º 7
0
 /**
  * Display stored payment data for an order
  *
  * @see components/com_virtuemart/helpers/vmPSPlugin::plgVmOnShowOrderBEPayment()
  */
 function plgVmOnShowOrderBEPayment($virtuemart_order_id, $payment_method_id)
 {
     if (!$this->selectedThisByMethodId($payment_method_id)) {
         return NULL;
         // Another method was selected, do nothing
     }
     $db = JFactory::getDBO();
     $q = 'SELECT * FROM `' . $this->_tablename . '` WHERE ';
     $q .= ' `virtuemart_order_id` = ' . $virtuemart_order_id;
     $db->setQuery($q);
     $payments = $db->loadObjectList();
     $html = '<table class="adminlist" >' . "\n";
     $html .= $this->getHtmlHeaderBE();
     $first = TRUE;
     $lang = JFactory::getLanguage();
     foreach ($payments as $payment) {
         $html .= '<tr class="row1"><td>' . vmText::_('VMPAYMENT_KLIKANDPAY_DATE') . '</td><td align="left">' . $payment->created_on . '</td></tr>';
         // Now only the first entry has this data when creating the order
         if ($first) {
             $html .= $this->getHtmlRowBE('KLIKANDPAY_PAYMENT_NAME', $payment->payment_name);
             // keep that test to have it backwards compatible. Old version was deleting that column  when receiving an IPN notification
             if ($payment->payment_order_total and $payment->payment_order_total != 0.0) {
                 $html .= $this->getHtmlRowBE('KLIKANDPAY_PAYMENT_ORDER_TOTAL', $payment->payment_order_total . " " . shopFunctions::getCurrencyByID($payment->payment_currency, 'currency_code_3'));
             }
             if ($payment->email_currency and $payment->email_currency != 0) {
                 //$html .= $this->getHtmlRowBE('KLIKANDPAY_PAYMENT_EMAIL_CURRENCY', shopFunctions::getCurrencyByID($payment->email_currency, 'currency_code_3'));
             }
             if ($payment->recurring) {
                 $recurring_html = '<table class="adminlist table">' . "\n";
                 $recurring = json_decode($payment->recurring);
                 $recurring_html .= $this->getHtmlRowBE('VMPAYMENT_KLIKANDPAY_RECURRING_MONTANT', $recurring->MONTANT);
                 if (isset($recurring->MONTANT2)) {
                     $recurring_html .= $this->getHtmlRowBE('VMPAYMENT_KLIKANDPAY_RECURRING_MONTANT2', $recurring->MONTANT2);
                 }
                 if (isset($recurring->EXTRA)) {
                     $recurring_html .= $this->getHtmlRowBE('VMPAYMENT_KLIKANDPAY_RECURRING_EXTRA', $recurring->EXTRA);
                 }
                 if (isset($recurring->DATE2)) {
                     $recurring_html .= $this->getHtmlRowBE('VMPAYMENT_KLIKANDPAY_RECURRING_DATE2', $recurring->DATE2);
                 }
                 $recurring_html .= '</table>' . "\n";
                 $html .= $this->getHtmlRowBE('KLIKANDPAY_RECURRING', $recurring_html);
             }
             $first = FALSE;
         } else {
             $showOrderBEFields = $this->getOrderBEFields();
             $keyPrefix = 'KLIKANDPAY_RESPONSE_';
             $dbPrefix = 'klikandpay_response_';
             foreach ($showOrderBEFields as $showOrderBEField) {
                 $orderField = $dbPrefix . $showOrderBEField;
                 if (isset($payment->{$orderField}) and !empty($payment->{$orderField})) {
                     $key = $keyPrefix . $showOrderBEField;
                     if (method_exists($this, 'getValueBE_' . $orderField)) {
                         $function = 'getValueBE_' . $orderField;
                         $payment->{$orderField} = $this->{$function}($payment->{$orderField});
                     }
                     $html .= $this->getHtmlRowBE($key, $payment->{$orderField});
                 }
             }
             $html .= '<tr><td></td><td>
 <a href="#" class="KlikandpayLogOpener" rel="' . $payment->id . '" >
     <div style="background-color: white; z-index: 100; right:0; display: none; border:solid 2px; padding:10px;" class="vm-absolute" id="KlikandpayLog_' . $payment->id . '">';
             $klikandpay_data = json_decode($payment->klikandpay_fullresponse);
             foreach ($klikandpay_data as $key => $value) {
                 $langKey = 'VMPAYMENT_' . $keyPrefix . $key;
                 if ($lang->hasKey($langKey)) {
                     $label = vmText::_($langKey);
                 } else {
                     $label = $key;
                 }
                 $html .= ' <b>' . $label . '</b>:&nbsp;' . wordwrap($value, 50, "\n", true) . '<br />';
             }
             $html .= ' </div>
     <span class="icon-nofloat vmicon vmicon-16-xml"></span>&nbsp;';
             $html .= vmText::_('VMPAYMENT_KLIKANDPAY_VIEW_TRANSACTION_LOG');
             $html .= '  </a>';
             $html .= ' </td></tr>';
         }
     }
     $html .= '</table>' . "\n";
     $doc = JFactory::getDocument();
     $js = "\n\tjQuery().ready(function(\$) {\n\t\t\$('.KlikandpayLogOpener').click(function() {\n\t\t\tvar logId = \$(this).attr('rel');\n\t\t\t\$('#KlikandpayLog_'+logId).toggle();\n\t\t\treturn false;\n\t\t});\n\t});";
     $doc->addScriptDeclaration($js);
     return $html;
 }
Exemplo n.º 8
0
 public function setPaymentCurrency()
 {
     vmPSPlugin::getPaymentCurrency($this->_method);
     $this->currency_code_3 = shopFunctions::getCurrencyByID($this->_method->payment_currency, 'currency_code_3');
 }
Exemplo n.º 9
0
	function getPaypalPaymentCurrency ($getCurrency = FALSE) {

		vmPSPlugin::getPaymentCurrency($this->_method);
		$this->currency_code_3 = shopFunctions::getCurrencyByID($this->_method->payment_currency, 'currency_code_3');

	}
Exemplo n.º 10
0
 /**
  * @param $virtuemart_order_id
  * @param $payment_method_id
  * @return null|string
  */
 function plgVmOnShowOrderBEPayment($virtuemart_order_id, $payment_method_id)
 {
     if (!$this->selectedThisByMethodId($payment_method_id)) {
         return NULL;
         // Another method was selected, do nothing
     }
     if (!($this->_currentMethod = $this->getVmPluginMethod($payment_method_id))) {
         return NULL;
         // Another method was selected, do nothing
     }
     if (!($payments = $this->getDatasByOrderId($virtuemart_order_id))) {
         // JError::raiseWarning(500, $db->getErrorMsg());
         return '';
     }
     $this->initKlarnaParams();
     $html = '<table class="adminlist table"  >' . "\n";
     $html .= $this->getHtmlHeaderBE();
     $first = TRUE;
     $code = "klarna";
     $prefix = "KLARNACHECKOUT_";
     foreach ($payments as $key => $payment) {
         $html .= '<tr class="row1"><td><strong>' . JText::_('VMPAYMENT_KLARNACHECKOUT_DATE') . '</strong></td><td align="left"><strong>' . $payment->created_on . '</strong></td></tr>';
         // Now only the first entry has this data when creating the order
         if ($first) {
             $html .= $this->getHtmlRowBE('KLARNACHECKOUT_PAYMENT_NAME', $payment->payment_name);
             // keep that test to have it backwards compatible. Old version was deleting that column  when receiving an IPN notification
             if ($payment->payment_order_total and $payment->payment_order_total != 0.0) {
                 $html .= $this->getHtmlRowBE('KLARNACHECKOUT_PAYMENT_ORDER_TOTAL', $payment->payment_order_total . " " . shopFunctions::getCurrencyByID($payment->payment_currency, 'currency_code_3'));
             }
             if (!empty($payment->email_currency) and $payment->email_currency != 0) {
                 $html .= $this->getHtmlRowBE('KLARNACHECKOUT_PAYMENT_EMAIL_CURRENCY', shopFunctions::getCurrencyByID($payment->email_currency, 'currency_code_3'));
             }
             $first = FALSE;
         }
         // TODO go though the SQL table to have the fields in the correct order
         foreach ($payment as $key => $value) {
             // only displays if there is a value or the value is different from 0.00 and the value
             if ($value) {
                 if (substr($key, 0, strlen($code)) == $code) {
                     $html .= $this->getHtmlRowBE($prefix . $key, $value);
                 }
             }
         }
         if ($payment->action == 'activate') {
             $vm_invoice_name = '';
             $data = json_decode($payment->data);
             $invoice_number = $data[1];
             $klarnaCheckoutInterface = $this->_loadKlarnaCheckoutInterface();
             $invoiceURL = $klarnaCheckoutInterface->getInvoice($invoice_number, $vm_invoice_name);
             $html .= $this->getHtmlRowBE(vmText::_('VMPAYMENT_KLARNACHECKOUT_INVOICE_NUMBER'), $invoice_number);
             //$invoicePdfLink = $klarnaCheckoutInterface->getInvoicePdfLink($payment->virtuemart_order_id);
             $value = '<a target="_blank" href="' . $invoiceURL . '">' . vmText::_('VMPAYMENT_KLARNACHECKOUT_VIEW_INVOICE') . '</a>';
             $html .= $this->getHtmlRowBE("", $value);
         }
         if ($this->_currentMethod->debug) {
             $html .= $this->getTransactionLogContent($payment);
         }
     }
     $html .= '</table>' . "\n";
     if ($this->_currentMethod->debug) {
         $doc = JFactory::getDocument();
         $js = "\njQuery().ready(function(\$) {\n\t\$('.kcoLogOpener').click(function() {\n\t\tvar logId = \$(this).attr('rel');\n\t\t\$('#kcoLog_'+logId).toggle();\n\t\treturn false;\n\t});\n\t\$('.kcoDetailsOpener').click(function() {\n\t\tvar detailsId = \$(this).attr('rel');\n\t\t\$('#kcoDetails_'+detailsId).toggle();\n\t\treturn false;\n\t});\n});";
         $doc->addScriptDeclaration($js);
     }
     return $html;
 }
Exemplo n.º 11
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.º 12
0
 private function showOrderBEPayment($virtuemart_order_id, $payments)
 {
     $db = JFactory::getDBO();
     $query = 'SHOW COLUMNS FROM `' . $this->_tablename . '` ';
     $db->setQuery($query);
     $columns = $db->loadColumn(0);
     $html = '';
     $first = TRUE;
     $lang = JFactory::getLanguage();
     foreach ($payments as $payment) {
         if ($payment->amazon_class_request_type) {
             $this->loadAmazonClass($payment->amazon_class_request_type);
         }
         if ($payment->amazon_class_response_type) {
             $this->loadAmazonClass($payment->amazon_class_response_type);
         }
         if ($payment->amazon_class_notification_type) {
             $this->loadAmazonClass($payment->amazon_class_notification_type);
         }
         $html .= '<tr class="row1"><td><strong>' . vmText::_('VMPAYMENT_AMAZON_DATE') . '</strong></td><td align="left"><strong>' . $payment->created_on . '</strong></td></tr>';
         // Now only the first entry has this data when creating the order
         if ($first) {
             $html .= $this->getHtmlRowBE('AMAZON_PAYMENT_NAME', $payment->payment_name);
             // keep that test to have it backwards compatible. Old version was deleting that column  when receiving an IPN notification
             if ($payment->payment_order_total and $payment->payment_order_total != 0.0) {
                 $html .= $this->getHtmlRowBE('COM_VIRTUEMART_TOTAL', $payment->payment_order_total * 0.01 . " " . shopFunctions::getCurrencyByID($payment->payment_currency, 'currency_code_3'));
             }
             if ($payment->email_currency and $payment->email_currency != 0) {
                 //$html .= $this->getHtmlRowBE($this->_name.'_PAYMENT_EMAIL_CURRENCY', shopFunctions::getCurrencyByID($payment->email_currency, 'currency_code_3'));
             }
             $first = FALSE;
         } else {
             $amazon_classes = array();
             /*
             if (!empty($payment->amazon_request)) {
             	$amazon_data = unserialize($payment->amazon_request);
             	$amazon_classes[get_class($amazon_data)] = $payment->amazon_request;
             }
             */
             $this->loadAmazonServicesClasses();
             $this->loadAmazonNotificationClasses();
             if (!empty($payment->amazon_request)) {
                 $amazon_classes[$payment->amazon_class_request_type] = $payment->amazon_request;
                 $vmClass = $this->getVmClass($payment->amazon_class_request_type);
                 $html .= $this->getHtmlRowBE(vmText::_('VMPAYMENT_AMAZON_REQUEST_TYPE'), vmText::_('VMPAYMENT_AMAZON_REQUEST_TYPE_' . $vmClass));
                 $transactionLogContent = $this->getTransactionLogContent($payment->amazon_class_request_type, $payment->amazon_request, $payment);
                 if (empty($transactionLogContent)) {
                     vmError("getTransactionLogContent" . $payment->amazon_class_request_type . ' ');
                     vmError("getTransactionLogContent" . $payment->amazon_request . ' ');
                 }
                 $html .= $transactionLogContent;
             }
             if (!empty($payment->amazon_response)) {
                 $vmClass = $this->getVmClass($payment->amazon_class_response_type);
                 $amazon_classes[$payment->amazon_class_response_type] = $payment->amazon_response;
                 $html .= $this->getHtmlRowBE(vmText::_('VMPAYMENT_AMAZON_RESPONSE_TYPE'), vmText::_('VMPAYMENT_AMAZON_RESPONSE_TYPE_' . $vmClass));
                 $html .= $this->getResponseData($payment);
                 $html .= $this->getTransactionLogContent($payment->amazon_class_response_type, $payment->amazon_response, $payment);
             } elseif (!empty($payment->amazon_notification)) {
                 $amazon_classes[$payment->amazon_class_notification_type] = $payment->amazon_notification;
                 $vmClass = $this->getVmClass($payment->amazon_class_notification_type);
                 $html .= $this->getHtmlRowBE(vmText::_('VMPAYMENT_AMAZON_NOTIFICATION_TYPE'), vmText::_('VMPAYMENT_AMAZON_NOTIFICATION_TYPE_' . $vmClass));
                 $html .= $this->getResponseData($payment);
                 $html .= $this->getTransactionLogContent($payment->amazon_class_notification_type, $payment->amazon_notification, $payment);
             }
         }
     }
     $doc = JFactory::getDocument();
     $js = "\njQuery().ready(function(\$) {\n\t\$('.amazonLogOpener').click(function() {\n\t\tvar logId = \$(this).attr('rel');\n\t\t\$('#amazonLog_'+logId).toggle();\n\t\treturn false;\n\t});\n\t\$('.amazonDetailsOpener').click(function() {\n\t\tvar detailsId = \$(this).attr('rel');\n\t\t\$('#amazonDetails_'+detailsId).toggle();\n\t\treturn false;\n\t});\n});";
     $doc->addScriptDeclaration($js);
     return $html;
 }
Exemplo n.º 13
0
 /**
  * plgVmDisplayListFEPayment
  * This event is fired to display the pluginmethods in the cart (edit shipment/payment) for example
  *
  * @param object  $cart Cart object
  * @param integer $selected ID of the method selected
  * @return boolean True on succes, false on failures, null when this plugin was not selected.
  * On errors, JError::raiseWarning (or JError::raiseError) must be used to set a message.
  *
  * @author Valerie Isaksen
  * @author Max Milbers
  */
 public function plgVmDisplayListFEPayment(VirtueMartCart $cart, $selected = 0, &$htmlIn)
 {
     if (PagSeguroCurrencies::checkCurrencyAvailabilityByIsoCode(shopFunctions::getCurrencyByID($cart->pricesCurrency, 'currency_code_3'))) {
         return $this->displayListFE($cart, $selected, $htmlIn);
     }
     return false;
 }
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->_debug = $method->HEIDELPAY_DEBUG;
     if (!class_exists('VirtueMartModelOrders')) {
         require VMPATH_ADMIN . DS . 'models' . DS . 'orders.php';
     }
     if (!class_exists('VirtueMartModelCurrency')) {
         require VMPATH_ADMIN . DS . 'models' . DS . 'currency.php';
     }
     $address = isset($order['details']['BT']) ? $order['details']['BT'] : $order['details']['ST'];
     if (!class_exists('TableVendors')) {
         require VMPATH_ADMIN . DS . 'table' . 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');
     $paymentCurrency = CurrencyDisplay::getInstance($method->payment_currency);
     $totalInPaymentCurrency = round($paymentCurrency->convertCurrencyTo($method->payment_currency, $order['details']['BT']->order_total, FALSE), 2);
     $cd = CurrencyDisplay::getInstance($cart->pricesCurrency);
     // prepare the post var values:
     $languageTag = $this->getLang();
     $params = array();
     /*
      * 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";
     $params['PRESENTATION.AMOUNT'] = $totalInPaymentCurrency;
     $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";
     }
     /*
      * case for GiroPay
      */
     if ($method->HEIDELPAY_PAYMENT_TYPE == "OTGIR") {
         $params['FRONTEND.SEPA'] = 'YES';
         $params['FRONTEND.SEPASWITCH'] = 'NO';
     }
     /*
      * Special case for BarPay without hco iframe
      */
     if ($method->HEIDELPAY_PAYMENT_TYPE == "PPBARPAY") {
         $params['PAYMENT.CODE'] = "PP.PA";
         $params['ACCOUNT.BRAND'] = "BARPAY";
     }
     /*
      * Special case for BillSAFE
      */
     if ($method->HEIDELPAY_PAYMENT_TYPE == "IVBILLSAFE") {
         $toCheck = array('last_name', 'first_name', 'middle_name', 'phone_1', 'phone_2', 'fax', 'address_1', 'address_2', 'city', 'virtuemart_state_id', 'virtuemart_country_id', 'zip');
         $bsError = false;
         foreach ($toCheck as $val) {
             if (isset($order['details']['ST']->{$val})) {
                 if ($order['details']['ST']->{$val} != $order['details']['BT']->{$val}) {
                     $bsError = true;
                     $errorVal = $val;
                     break;
                 }
             }
         }
         if ($bsError) {
             $msg = vmText::_('VMPAYMENT_HEIDELPAY_TECHNICAL_ERROR') . "<br />" . vmText::_('VMPAYMENT_HEIDELPAY_BILLSAFE_ERROR') . "<br />";
             $app = JFactory::getApplication();
             $app->redirect('index.php?option=com_virtuemart&view=cart', $msg);
         }
         $params['PAYMENT.CODE'] = "IV.PA";
         $params['ACCOUNT.BRAND'] = "BILLSAFE";
         $params = array_merge($params, $this->getBasketDetails());
     }
     /*
      *  User account information
      */
     $params['ACCOUNT.HOLDER'] = $address->first_name . " " . $address->last_name;
     $params['NAME.GIVEN'] = $address->first_name;
     $params['NAME.FAMILY'] = $address->last_name;
     if (!empty($address->company)) {
         $params['NAME.COMPANY'] = $address->company;
     }
     $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'] = 'VirtueMart ' . VmConfig::getInstalledVersion();
     $params['SHOPMODULE.VERSION'] = $this->version;
     $params['CRITERION.PAYMENT_NAME'] = vmText::_('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";
     }
     /*
      * 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;
     if (substr($method->HEIDELPAY_PAYMENT_TYPE, 0, 2) == 'DD') {
         $sepaform = array();
         $sepaform = $this->switchDirectDebitFrom($method->HEIDELPAY_SEPA_FORM);
         $params = array_merge($sepaform, $params);
     }
     /*
      * 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 = vmText::_('VMPAYMENT_HEIDELPAY_TECHNICAL_ERROR') . " <br /> - " . addslashes($response['PROCESSING_RETURN']) . "<br />" . vmText::_('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.º 15
0
 /**
  * Display stored payment data for an order
  * @param  int $virtuemart_order_id
  * @param  int $payment_method_id
  * @see components/com_virtuemart/helpers/vmPSPlugin::plgVmOnShowOrderBEPayment()
  */
 function plgVmOnShowOrderBEPayment($virtuemart_order_id, $payment_method_id)
 {
     if (!$this->selectedThisByMethodId($payment_method_id)) {
         return NULL;
         // Another method was selected, do nothing
     }
     if (!($payments = $this->getDatasByOrderId($virtuemart_order_id))) {
         // JError::raiseWarning(500, $db->getErrorMsg());
         return '';
     }
     $html = '<table class="adminlist" width="50%">' . "\n";
     $html .= $this->getHtmlHeaderBE();
     $code = "sofort_ideal_response_";
     $first = TRUE;
     foreach ($payments as $payment) {
         $html .= '<tr class="row1"><td>' . JText::_('COM_VIRTUEMART_DATE') . '</td><td align="left">' . $payment->created_on . '</td></tr>';
         // Now only the first entry has this data when creating the order
         if ($first) {
             $html .= $this->getHtmlRowBE('COM_VIRTUEMART_PAYMENT_NAME', $payment->payment_name);
             if ($payment->payment_order_total and $payment->payment_order_total != 0.0) {
                 $html .= $this->getHtmlRowBE('SOFORT_PAYMENT_ORDER_TOTAL', $payment->payment_order_total . " " . shopFunctions::getCurrencyByID($payment->payment_currency, 'currency_code_3'));
             }
             $html .= $this->getHtmlRowBE('SOFORT_PAYMENT_EMAIL_CURRENCY', shopFunctions::getCurrencyByID($payment->payment_currency, 'currency_code_3'));
             $first = FALSE;
         } else {
             foreach ($payment as $key => $value) {
                 // only displays if there is a value or the value is different from 0.00 and the value
                 if ($value) {
                     if (substr($key, 0, strlen($code)) == $code) {
                         $html .= $this->getHtmlRowBE($key, $value);
                     }
                 }
             }
         }
     }
     $html .= '</table>' . "\n";
     return $html;
 }
Exemplo n.º 16
0
	/**
	 * Display stored payment data for an order
	 *
	 * @see components/com_virtuemart/helpers/vmPSPlugin::plgVmOnShowOrderBEPayment()
	 */
	function plgVmOnShowOrderBEPayment($virtuemart_order_id, $payment_method_id) {

		if (!$this->selectedThisByMethodId($payment_method_id)) {
			return NULL; // Another method was selected, do nothing
		}
		if (!($this->_currentMethod = $this->getVmPluginMethod($payment_method_id))) {
			return FALSE;
		}
		if (!($payments = $this->_getPaypalInternalData($virtuemart_order_id))) {
			// JError::raiseWarning(500, $db->getErrorMsg());
			return '';
		}

		//$html = $this->renderByLayout('orderbepayment', array($payments, $this->_psType));
		$html = '<table class="adminlist" width="50%">' . "\n";
		$html .= $this->getHtmlHeaderBE();
		$code = "paypal_response_";
		$first = TRUE;
		foreach ($payments as $payment) {
			$html .= '<tr class="row1"><td>' . JText::_('VMPAYMENT_PAYPAL_DATE') . '</td><td align="left">' . $payment->created_on . '</td></tr>';
			// Now only the first entry has this data when creating the order
			if ($first) {
				$html .= $this->getHtmlRowBE('COM_VIRTUEMART_PAYMENT_NAME', $payment->payment_name);
				// keep that test to have it backwards compatible. Old version was deleting that column  when receiving an IPN notification
				if ($payment->payment_order_total and  $payment->payment_order_total != 0.00) {
					$html .= $this->getHtmlRowBE('COM_VIRTUEMART_TOTAL', $payment->payment_order_total . " " . shopFunctions::getCurrencyByID($payment->payment_currency, 'currency_code_3'));
				}

				$first = FALSE;
			} else {
				$paypalInterface = $this->_loadPayPalInterface();

				if (isset($payment->paypal_fullresponse) and !empty($payment->paypal_fullresponse)) {
					$paypal_data = json_decode($payment->paypal_fullresponse);
					$paypalInterface = $this->_loadPayPalInterface();
					$html .= $paypalInterface->onShowOrderBEPayment($paypal_data);

					$html .= '<tr><td></td><td>
    <a href="#" class="PayPalLogOpener" rel="' . $payment->id . '" >
        <div style="background-color: white; z-index: 100; right:0; display: none; border:solid 2px; padding:10px;" class="vm-absolute" id="PayPalLog_' . $payment->id . '">';

					foreach ($paypal_data as $key => $value) {
						$html .= ' <b>' . $key . '</b>:&nbsp;' . $value . '<br />';
					}

					$html .= ' </div>
        <span class="icon-nofloat vmicon vmicon-16-xml"></span>&nbsp;';
					$html .= JText::_('VMPAYMENT_PAYPAL_VIEW_TRANSACTION_LOG');
					$html .= '  </a>';
					$html .= ' </td></tr>';
				} else {
					$html .= $paypalInterface->onShowOrderBEPaymentByFields($payment);
				}
			}



		}
		$html .= '</table>' . "\n";

		$doc = JFactory::getDocument();
		$js = "
	jQuery().ready(function($) {
		$('.PayPalLogOpener').click(function() {
			var logId = $(this).attr('rel');
			$('#PayPalLog_'+logId).toggle();
			return false;
		});
	});";
		$doc->addScriptDeclaration($js);
		return $html;

	}
Exemplo n.º 17
0
	private function showOrderBEPayment ($virtuemart_order_id, $payments) {


		$db = JFactory::getDBO();
		$query = 'SHOW COLUMNS FROM `' . $this->_tablename . '` ';
		$db->setQuery($query);
		$columns = $db->loadColumn(0);

		$html = '';
		$first = TRUE;
		$lang = JFactory::getLanguage();
		foreach ($payments as $payment) {
			if ($payment->amazon_class_response_type) {
				$this->loadAmazonClass($payment->amazon_class_response_type);
			}
			if ($payment->amazon_class_notification_type) {
				$this->loadAmazonClass($payment->amazon_class_notification_type);
			}

			$html .= '<tr class="row1"><td>' . vmText::_('VMPAYMENT_AMAZON_DATE') . '</td><td align="left">' . $payment->created_on . '</td></tr>';
			// Now only the first entry has this data when creating the order
			if ($first) {
				$html .= $this->getHtmlRowBE('AMAZON_PAYMENT_NAME', $payment->payment_name);
				// keep that test to have it backwards compatible. Old version was deleting that column  when receiving an IPN notification
				if ($payment->payment_order_total and $payment->payment_order_total != 0.00) {
					$html .= $this->getHtmlRowBE('COM_VIRTUEMART_TOTAL', ($payment->payment_order_total * 0.01) . " " . shopFunctions::getCurrencyByID($payment->payment_currency, 'currency_code_3'));
				}
				if ($payment->email_currency and $payment->email_currency != 0) {
					//$html .= $this->getHtmlRowBE($this->_name.'_PAYMENT_EMAIL_CURRENCY', shopFunctions::getCurrencyByID($payment->email_currency, 'currency_code_3'));
				}

				$first = FALSE;
			} else {


				$amazon_classes = array();
				/*
				if (!empty($payment->amazon_request)) {
					$amazon_data = unserialize($payment->amazon_request);
					$amazon_classes[get_class($amazon_data)] = $payment->amazon_request;
				}
				*/
				$this->loadAmazonServicesClasses();
				$this->loadAmazonNotificationClasses();

				if (!empty($payment->amazon_response)) {

					$amazon_classes[$payment->amazon_class_response_type] = $payment->amazon_response;
					$response_class = $payment->amazon_class_response_type;
					$pos = strrpos($response_class, '_');
					$vmClass = substr($response_class, $pos + 1);
					$html .= $this->getHtmlRowBE(vmText::_('VMPAYMENT_AMAZON_RESPONSE_TYPE'), vmText::_('VMPAYMENT_AMAZON_RESPONSE_TYPE_' . $vmClass));
				}
				if (!empty($payment->amazon_notification)) {
					$amazon_classes[ $payment->amazon_class_notification_type] = $payment->amazon_notification;
					$notification_class = $payment->amazon_class_notification_type;
					$pos = strrpos($notification_class, '_');
					$vmClass = substr($notification_class, $pos + 1);
					$html .= $this->getHtmlRowBE(vmText::_('VMPAYMENT_AMAZON_NOTIFICATION_TYPE'), vmText::_('VMPAYMENT_AMAZON_NOTIFICATION_TYPE_' . $vmClass));

				}
				$code = 'amazon_response_';
				foreach ($payment as $key => $value) {
					// only displays if there is a value or the value is different from 0.00 and the value
					if ($value) {
						if (substr($key, 0, strlen($code)) == $code) {
							$html .= $this->getHtmlRowBE($key, $value);
						}
					}
				}


				foreach ($amazon_classes as $amazon_class => $amazon_data_serialized) {
					$this->loadAmazonClass($amazon_class);
					$vmClassName = 'amazonHelper' . $vmClass;
					$amazon_data = unserialize($amazon_data_serialized);
					$this->loadHelperClass($vmClassName);
					$html .= '<tr><td>';
					if (class_exists($vmClassName)) {
						$obj = new $vmClassName($amazon_data, $this->_currentMethod);
						$contents = $obj->getContents();

						if (!empty($contents)) {
							$html .= '<a href="#" class="amazonDetailsOpener"   rel="' . $payment->id . '">';
							//$html .= '<div style="background-color: white; z-index: 100; right:0; display: none; border:solid 2px; padding:10px;" class="vm-absolute" id="amazonDetails_' . $payment->id . '">';
							//$html .= ' </div>';
							$html .= ' <span class="icon-nofloat vmicon vmicon-16-xml"></span>&nbsp;';
							$html .= vmText::_('VMPAYMENT_AMAZON_VIEW_TRANSACTION_DETAILS');
							$html .= '  </a>';
							$html .= '<div  style="display:none;" id="amazonDetails_' . $payment->id . '">';
							$html .= $contents;
							$html .= ' </div>';

						}

					}
					$html .= ' </td>';
					$html .= ' <td>';

					if ($this->_currentMethod->debug) {
						//$html .= '<tr><td></td><td>' . $amazon_class . '
						$html .= '<td>' . '
<a href="#" class="amazonLogOpener" rel="' . $payment->id . '" >
	<div style="background-color: white; z-index: 100; right:0; display: none; border:solid 2px; padding:10px;" class="vm-absolute" id="amazonLog_' . $payment->id . '">';
						$html .= "<pre>" . var_export($amazon_data, true) . "</pre>";
						//$html .= $obj->getContents();

						$html .= ' </div>
	<span class="icon-nofloat vmicon vmicon-16-xml"></span>&nbsp;';
						$html .= vmText::_('VMPAYMENT_AMAZON_VIEW_TRANSACTION_LOG');
						$html .= '  </a>';

					}
					$html .= ' </td></tr>';
//}

				}

			}
		}


		$doc = JFactory::getDocument();
		$js = "
jQuery().ready(function($) {
	$('.amazonLogOpener').click(function() {
		var logId = $(this).attr('rel');
		$('#amazonLog_'+logId).toggle();
		return false;
	});
	$('.amazonDetailsOpener').click(function() {
		var detailsId = $(this).attr('rel');
		$('#amazonDetails_'+detailsId).toggle();
		return false;
	});
});";
		$doc->addScriptDeclaration($js);

		return $html;
	}
Exemplo n.º 18
0
 function _check_email_amount_currency($payments, $email, $paypal_data)
 {
     /*
      * TODO Not checking yet because config do not have primary email address
      * Primary email address of the payment recipient (that is, the merchant).
      * If the payment is sent to a non-primary email address on your PayPal account,
      * the receiver_email is still your primary email.
      */
     /*
     if ($payments[0]->payment_order_total==$email) {
     	return true;
     }
     */
     $currency_code_3 = shopFunctions::getCurrencyByID($payments[0]->payment_currency, 'currency_code_3');
     if ($payments[0]->payment_order_total == $paypal_data['mc_gross'] and $currency_code_3 == $paypal_data['mc_currency']) {
         return TRUE;
     }
     $mailsubject = "PayPal Transaction";
     $mailbody = "Hello,\n\t\tAn IPN notification was received with an invalid amount or currency\n\t\t----------------------------------\n\t\tIPN Notification content:\n\t\t";
     foreach ($paypal_data as $key => $value) {
         $mailbody .= $key . " = " . $value . "\n\n";
     }
     $this->sendEmailToVendorAndAdmins($mailsubject, $mailbody);
     return FALSE;
 }
Exemplo n.º 19
0
 /**
  * cf https://docs.klarna.com/en/rest-api#supported_locales
  * @param $method
  */
 function initKlarnaParams($method)
 {
     $return = true;
     $db = JFactory::getDBO();
     $q = 'SELECT ' . $db->getEscaped('country_2_code') . '  , ' . $db->getEscaped('country_3_code') . ' FROM `#__virtuemart_countries` WHERE virtuemart_country_id = ' . (int) $method->purchase_country;
     $db->setQuery($q);
     $country = $db->loadObject();
     if (!$country) {
         vmError('Klarna Checkout: No country has been found with country id=' . $method->purchase_country, vmText::sprintf('VMPAYMENT_KLARNACHECKOUT_ERROR_OCCURRED', $method->payment_name));
         $this->debugLog('No country has been found with country id=' . $method->purchase_country, 'initKlarnaParams', 'error');
         $return = false;
     }
     $this->country_code_2 = $country->country_2_code;
     $this->country_code_3 = $country->country_3_code;
     $this->getPaymentCurrency($method);
     $this->currency_code_3 = shopFunctions::getCurrencyByID($method->payment_currency, 'currency_code_3');
     if (!$this->currency_code_3) {
         vmError('Klarna Checkout: No currency has been found with currency id=' . $method->payment_currency, vmText::sprintf('VMPAYMENT_KLARNACHECKOUT_ERROR_OCCURRED', $method->payment_name));
         $this->debugLog('No currency has been found with currency id=' . $method->payment_currency, 'initKlarnaParams', 'error');
         $return = false;
     }
     $this->currency_id = $method->payment_currency;
     if (empty($method->sharedsecret) or empty($method->merchantid)) {
         vmError('Klarna Checkout: Missing mandatory values merchant id=' . $method->merchantid . ' shared secret=' . $method->sharedsecret, vmText::sprintf('VMPAYMENT_KLARNACHECKOUT_ERROR_OCCURRED', $method->payment_name));
         $this->debugLog('Missing mandatory values merchant id=' . $method->merchantid . ' shared secret=' . $method->sharedsecret, 'initKlarnaParams', 'error');
         $return = false;
     }
     $this->locale = $method->locale;
     $this->sharedsecret = $method->sharedsecret;
     $this->merchantid = $method->merchantid;
     if ($method->server == 'beta') {
         $this->mode = Klarna::BETA;
     } else {
         $this->mode = Klarna::LIVE;
     }
     $this->ssl = KlarnaHandler::getKlarnaSSL($this->mode);
     return $return;
 }
Exemplo n.º 20
0
 private function showActionOrderBEPayment($virtuemart_order_id, $virtuemart_paymentmethod_id, $payments)
 {
     $orderModel = VmModel::getModel('orders');
     $order = $orderModel->getOrder($virtuemart_order_id);
     $options = array();
     if ($this->isDelayedSettlement()) {
         $options[] = JHTML::_('select.option', 'settlePayment', vmText::_('VMPAYMENT_REALEX_HPP_API_ORDER_BE_CAPTURE'), 'value', 'text');
     }
     $options[] = JHTML::_('select.option', 'rebatePayment', vmText::_('VMPAYMENT_REALEX_HPP_API_ORDER_BE_REBATE'), 'value', 'text');
     $actionList = JHTML::_('select.genericlist', $options, 'action', '', 'value', 'text', 'capturePayment', 'action', true);
     $html = '<table class="adminlist table"  >' . "\n";
     $html .= $this->getHtmlHeaderBE();
     $html .= '<form action="index.php" method="post" name="updateOrderBEPayment" id="updateOrderBEPayment">';
     $html .= '<tr ><td >';
     $html .= $actionList;
     $html .= ' </td><td>';
     $html .= '<input type="text" id="amount" name="amount" size="20" value="" class="required" maxlength="25"  placeholder="' . vmText::sprintf('VMPAYMENT_REALEX_HPP_API_ORDER_BE_AMOUNT', shopFunctions::getCurrencyByID($payments[0]->payment_currency, 'currency_code_3')) . '"/>';
     $html .= '<input type="hidden" name="type" value="vmpayment"/>';
     $html .= '<input type="hidden" name="name" value="realex_hpp_api"/>';
     $html .= '<input type="hidden" name="view" value="plugin"/>';
     $html .= '<input type="hidden" name="option" value="com_virtuemart"/>';
     $html .= '<input type="hidden" name="virtuemart_order_id" value="' . $virtuemart_order_id . '"/>';
     $html .= '<input type="hidden" name="virtuemart_paymentmethod_id" value="' . $virtuemart_paymentmethod_id . '"/>';
     $html .= '<a class="updateOrderBEPayment btn btn-small" href="#"   >' . vmText::_('COM_VIRTUEMART_SAVE') . '</a>';
     $html .= '</form>';
     $html .= ' </td></tr>';
     vmJsApi::addJScript('vmRealex.updateOrderBEPayment', "\n\t\tjQuery(document).ready( function(\$) {\n\t\t\tjQuery('.updateOrderBEPayment').click(function() {\n\t\t\t\tdocument.updateOrderBEPayment.submit();\n\t\t\t\treturn false;\n\n\t});\n});\n");
     //$html .= '</table>'  ;
     return $html;
 }
Exemplo n.º 21
0
 /**
  * @param $cart
  * @param $order
  *
  * @return
  */
 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;
     }
     //         $params = new JParameter($payment->payment_params);
     // $lang     = JFactory::getLanguage();
     // $filename = 'com_virtuemart';
     // $lang->load($filename, JPATH_ADMINISTRATOR);
     $vendorId = 0;
     $html = "";
     VmConfig::loadJLang('com_virtuemart', true);
     VmConfig::loadJLang('com_virtuemart_orders', TRUE);
     $this->getPaymentCurrency($method);
     if (!class_exists('VirtueMartModelOrders')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
     }
     $this->getPaymentCurrency($method, true);
     $currency_code_3 = shopFunctions::getCurrencyByID($method->payment_currency, 'currency_code_3');
     $email_currency = $this->getEmailCurrency($method);
     // END printing out HTML Form code (Payment Extra Info)
     $q = 'SELECT `currency_code_3` FROM `#__virtuemart_currencies` WHERE `virtuemart_currency_id`="' . $method->payment_currency . '" ';
     $db = JFactory::getDBO();
     $db->setQuery($q);
     $paymentCurrency = CurrencyDisplay::getInstance($method->payment_currency);
     $totalInPaymentCurrency = round($paymentCurrency->convertCurrencyTo($method->payment_currency, $order['details']['BT']->order_total, false), 2);
     $cd = CurrencyDisplay::getInstance($cart->pricesCurrency);
     $usrBT = $order['details']['BT'];
     $usrST = isset($order['details']['ST']) ? $order['details']['ST'] : $order['details']['BT'];
     $options['transactionSpeed'] = $method->speed;
     $options['currency'] = $currency_code_3;
     $options['notificationURL'] = JROUTE::_(JURI::root() . 'index.php?option=com_virtuemart&view=pluginresponse&task=pluginnotification&tmpl=component');
     $options['redirectURL'] = 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'));
     $options['posData'] = '{"id_order": "' . $order['details']['BT']->order_number . '"';
     $options['posData'] .= ', "hash": "' . crypt($order['details']['BT']->order_number, $method->merchant_apikey) . '"';
     $options['posData'] .= '}';
     $options['orderID'] = $order['details']['BT']->order_number;
     $options['price'] = $order['details']['BT']->order_total;
     $postOptions = array('orderID', 'itemDesc', 'itemCode', 'notificationEmail', 'notificationURL', 'redirectURL', 'posData', 'price', 'currency', 'physical', 'fullNotifications', 'transactionSpeed', 'buyerName', 'buyerAddress1', 'buyerAddress2', 'buyerCity', 'buyerState', 'buyerZip', 'buyerEmail', 'buyerPhone');
     foreach ($postOptions as $o) {
         if (array_key_exists($o, $options)) {
             $post[$o] = $options[$o];
         }
     }
     $post = json_encode($post);
     // Call BitPay
     if ($method->network == "test") {
         $network_uri = 'test.bitpay.com';
     } else {
         $network_uri = 'bitpay.com';
     }
     $curl = curl_init('https://' . $network_uri . '/api/invoice/');
     $length = 0;
     if ($post) {
         curl_setopt($curl, CURLOPT_POST, 1);
         curl_setopt($curl, CURLOPT_POSTFIELDS, $post);
         $length = strlen($post);
     }
     $uname = base64_encode($method->merchant_apikey);
     $header = array('Content-Type: application/json', "Content-Length: {$length}", "Authorization: Basic {$uname}", 'X-BitPay-Plugin-Info: virtuemart033114');
     curl_setopt($curl, CURLOPT_PORT, 443);
     curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
     curl_setopt($curl, CURLOPT_TIMEOUT, 10);
     curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
     curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 1);
     // verify certificate
     curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2);
     // check existence of CN and verify that it matches hostname
     curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($curl, CURLOPT_FORBID_REUSE, 1);
     curl_setopt($curl, CURLOPT_FRESH_CONNECT, 1);
     $responseString = curl_exec($curl);
     if ($responseString == false) {
         $response = curl_error($curl);
     } else {
         $response = json_decode($responseString, true);
     }
     curl_close($curl);
     $this->logInfo('invoice ' . implode(' / ', $response), 'message');
     if (isset($response['url'])) {
         $cart->emptyCart();
         header('Location: ' . $response['url']);
         exit;
     } else {
         $html = vmText::_('BitPay could not process your payment for the following reasons:') . " <br /> -------------------- " . "<br />" . vmText::_($response['error']['message']) . "<br /> " . vmText::_('Please contact the store owner');
         bplog("VM BitPayError: " . $response['error']['message'] . " with order id: " . $order['details']['BT']->order_number);
         bplog('curl error - no invoice url');
         $returnValue = 0;
         return $this->processConfirmedOrderPaymentResponse($returnValue, $cart, $order, $html, '', '');
     }
 }