order_total = $this->fixOrderTotal($order); $email_received = $_POST['business']; if ($email_received=="") $email_received = $_POST['receiver_email']; if ($order->order_total != $_POST['mc_gross']){ return array(0, 'Error mc_gross. Order ID '.$order->order_id); } if (strtolower($pmconfigs['email_received']) != strtolower($email_received)){ return array(0, 'Error email received. Order ID '.$order->order_id); } if ($order->currency_code_iso != $_POST['mc_currency']){ return array(0, 'Error currency. Order ID '.$order->order_id); } $req = 'cmd=_notify-validate'; foreach($_POST as $key=>$value){ $value = urlencode(stripslashes($value)); $req .= "&$key=$value"; } $payment_status = trim(stripslashes($_POST['payment_status'])); $header = ''; $header .= "POST /cgi-bin/webscr HTTP/1.1\r\n"; $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; $header .= "Host: ".$hostname."\r\n"; $header .= "Connection: close\r\n"; $header .= "Content-Length: ".strlen($req)."\r\n\r\n"; $debug = ""; $port = 80; if ($pmconfigs['use_ssl']) $port = 443; $fp = fsockopen ($host, $port, $errno, $errstr, 30); if (!$fp) { return array(0, 'Http error. Order number '.$order->order_id); } else { @fputs ($fp, $header . $req); while (!@feof($fp)) { $res = @fgets($fp, 1024); $res = trim($res); $debug .= $res."\n"; if (strcmp ($res, "VERIFIED") == 0) { if ($payment_status == 'Completed'){ return array(1, ''); } elseif ($payment_status == 'Pending') { saveToLog("payment.log", "Status pending. Order ID ".$order->order_id.". Reason: ".$_POST['pending_reason']); return array(2, trim(stripslashes($_POST['pending_reason'])) ); } elseif ($payment_status == 'Failed') { return array(3, 'Status Failed. Order ID '.$order->order_id ); } elseif ($payment_status == 'Refunded') { return array(3, "Status Refunded. Order ID ".$order->order_id ); }else { return array(0, "Order number ".$order->order_id."\nPaypal error\nPayment status - $payment_status."); } } else if (strcmp ($res, "INVALID") == 0) { return array(0, 'Invalid response. Order ID '.$order->order_id); } } fclose ($fp); if ($jshopConfig->savelog && $jshopConfig->savelogpaymentdata){ saveToLog("paymentdata.log", $debug); } return array(0, "Error response. Order ID ".$order->order_id); } } function showEndForm($pmconfigs, $order){ $jshopConfig = JSFactory::getConfig(); $item_name = sprintf(_JSHOP_PAYMENT_NUMBER, $order->order_number); if ($pmconfigs['testmode']){ $host = "www.sandbox.paypal.com"; } else{ $host = "www.paypal.com"; } //MODIFICA CATEGORIA //include_once(JPATH_SITE.'./src/modifyStatusCategory.php'); //modifyStatus(6,$order->order_id); $email = $pmconfigs['email_received']; $address_override = (int)$pmconfigs['address_override']; $uri = JURI::getInstance(); $liveurlhost = $uri->toString(array("scheme",'host', 'port')); if ($pmconfigs['notifyurlsef']){ $notify_url = $liveurlhost.SEFLink("index.php?option=com_jshopping&controller=checkout&task=step7&act=notify&js_paymentclass=pm_paypal&no_lang=1"); }else{ $notify_url = JURI::root()."index.php?option=com_jshopping&controller=checkout&task=step7&act=notify&js_paymentclass=pm_paypal&no_lang=1"; } $return = $liveurlhost.SEFLink("index.php?option=com_jshopping&controller=checkout&task=step7&act=return&js_paymentclass=pm_paypal"); $cancel_return = $liveurlhost.SEFLink("index.php?option=com_jshopping&controller=checkout&task=step7&act=cancel&js_paymentclass=pm_paypal"); $_country = JTable::getInstance('country', 'jshop'); $_country->load($order->d_country); $country = $_country->country_code_2; $order->order_total = $this->fixOrderTotal($order); ?>

order_total; if ($order->currency_code_iso=='HUF'){ $total = round($total); }else{ $total = number_format($total, 2, '.', ''); } return $total; } } ?>