order_total = $this->fixOrderTotal($order); $email_received = $_POST['business']; if ($email_received=="") $email_received = $_POST['receiver_email']; $opending = 0; if ($order->order_total != $_POST['mc_gross'] || $order->currency_code_iso != $_POST['mc_currency']){ $opending = 1; } $payment_status = trim($post['payment_status']); $transaction = $post['txn_id']; $transactiondata = array('txn_id'=>$post['txn_id'],'payer_email'=>$post['payer_email'], 'mc_gross'=>$post['mc_gross'], 'mc_currency'=>$post['mc_currency'], 'payment_status'=>$post['payment_status']); if (strtolower($pmconfigs['email_received']) != strtolower($email_received)){ return array(0, 'Error email received. Order ID '.$order->order_id, $transaction, $transactiondata); } $req = 'cmd=_notify-validate'; if (function_exists('get_magic_quotes_gpc')) { $get_magic_quotes_exists = true; } foreach($_POST as $key => $value){ if($get_magic_quotes_exists == true && get_magic_quotes_gpc() == 1) { $value = urlencode(stripslashes($value)); } else { $value = urlencode($value); } $req .= "&$key=$value"; } $ch = curl_init('https://'.$host.'/cgi-bin/webscr'); curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_POSTFIELDS, $req); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($ch, CURLOPT_FORBID_REUSE, 1); curl_setopt($ch, CURLOPT_SSLVERSION, 6); curl_setopt($ch, CURLOPT_USERAGENT, 'PayPal-PHP-SDK'); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: Close')); if( !($res = curl_exec($ch)) ) { saveToLog("payment.log", "Paypal failed: ".curl_error($ch).'('.curl_errno($ch).')'); curl_close($ch); exit; }else{ curl_close($ch); } saveToLog("paymentdata.log", "RES: $res"); if (strcmp ($res, "VERIFIED") == 0) { if ($payment_status == 'Completed'){ if ($opending){ saveToLog("payment.log", "Status pending. Order ID ".$order->order_id.". Error mc_gross or mc_currency."); return array(2, "Status pending. Order ID ".$order->order_id, $transaction, $transactiondata); }else{ return array(1, '', $transaction, $transactiondata); } } 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'])), $transaction, $transactiondata); }else { return array(3, "Status $payment_status. Order ID ".$order->order_id, $transaction, $transactiondata); } } else if (strcmp ($res, "INVALID") == 0) { return array(0, 'Invalid response. Order ID '.$order->order_id, $transaction, $transactiondata); } } function showEndForm($pmconfigs, $order){ $jshopConfig = JSFactory::getConfig(); $pm_method = $this->getPmMethod(); $item_name = sprintf(_JSHOP_PAYMENT_NUMBER, $order->order_number); if ($pmconfigs['testmode']){ $host = "www.sandbox.paypal.com"; } else{ $host = "www.paypal.com"; } $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_method->payment_class."&no_lang=1"); }else{ $notify_url = JURI::root()."index.php?option=com_jshopping&controller=checkout&task=step7&act=notify&js_paymentclass=".$pm_method->payment_class."&no_lang=1"; } $return = $liveurlhost.SEFLink("index.php?option=com_jshopping&controller=checkout&task=step7&act=return&js_paymentclass=".$pm_method->payment_class); $cancel_return = $liveurlhost.SEFLink("index.php?option=com_jshopping&controller=checkout&task=step7&act=cancel&js_paymentclass=".$pm_method->payment_class); $_country = JSFactory::getTable('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; } } ?>