Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

iecwillow

Pioneers
  • Posts

    134
  • Joined

  • Last visited

Profile Information

  • Real Name
    willow

iecwillow's Achievements

  1. Thanks for the great contribution, everthing works. However, seems like the second page still not showing static HTML file URLs? Here is what I'm having for second page: http://test.com/ categorey-c-1.html?page=2&sort=products_sort_order
  2. any one get this contribution works via Paypal? On checkout comfirmation page, I can see the discount code does works, however, when transfer to Paypal page, the total back to normal without discount applied...
  3. Hey all, I'm helping out a friend with his osCommerce-based store, and tried to add CTOPAY payment module, everything works fine, however CTOPAY claim that they could not get the web address where the payment coming from, the result on request.getHeader("referer") shows "null". Here is the code I currently use: <?php class ctopay { var $code, $title, $description, $enabled; /** * order status setting for pending orders * * @var int */ var $order_pending_status = 1; /** * order status setting for completed orders * * @var int */ var $order_status = DEFAULT_ORDERS_STATUS_ID; // class constructor function ctopay() { global $order; $this->code = 'ctopay'; if ($_GET['main_page'] != '') { $this->title = MODULE_PAYMENT_CTOPAY_TEXT_CATALOG_TITLE; // Payment Module title in Catalog } else { $this->title = MODULE_PAYMENT_CTOPAY_TEXT_ADMIN_TITLE; // Payment Module title in Admin } $this->description = MODULE_PAYMENT_CTOPAY_TEXT_DESCRIPTION; $this->sort_order = MODULE_PAYMENT_CTOPAY_SORT_ORDER; $this->enabled = ((MODULE_PAYMENT_CTOPAY_STATUS == 'True') ? true : false); if ((int)MODULE_PAYMENT_CTOPAY_ORDER_STATUS_ID > 0) { $this->order_status = MODULE_PAYMENT_CTOPAY_ORDER_STATUS_ID; } if (is_object($order)) $this->update_status(); $this->form_action_url = MODULE_PAYMENT_CTOPAY_HANDLER; } // class methods function update_status() { global $order, $db; if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_CTOPAY_ZONE > 0) ) { $check_flag = false; $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_CTOPAY_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id"); while ($check = tep_db_fetch_array($check_query)) { if ($check_query->fields['zone_id'] < 1) { $check_flag = true; break; } elseif ($check['zone_id'] == $order->delivery['zone_id']) { $check_flag = true; break; } $check_query->MoveNext(); } if ($check_flag == false) { $this->enabled = false; } } } function javascript_validation() { return false; } function selection() { return array('id' => $this->code, 'module' => MODULE_PAYMENT_CTOPAY_TEXT_CATALOG_LOGO, 'icon' => MODULE_PAYMENT_CTOPAY_TEXT_CATALOG_LOGO ); } function pre_confirmation_check() { return false; } function confirmation() { return array('title' => MODULE_PAYMENT_CTOPAY_TEXT_DESCRIPTION); } function process_button() { global $db, $order, $currencies; $MD5key = MODULE_PAYMENT_CTOPAY_MD5KEY; // $MerNo = MODULE_PAYMENT_CTOPAY_SELLER; // $BillNo =date("Ymdhis"); // $Currency = MODULE_PAYMENT_CTOPAY_MONEYTYPE; // if (MODULE_PAYMENT_CTOPAY_MONEYTYPE == 1) { $my_currency = 'CNY'; } else { $my_currency = 'USD'; } $Amount = number_format(($order->info['total']) * $currencies->get_value($my_currency), 2, '.', ''); // $DispAmount = $Amount; // //$ReturnURL = tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL'); // $ReturnURL = tep_href_link(FILENAME_PAYRESULT, '', 'SSL'); // for ($i=0; $i<sizeof($order->products); $i++) { $OrderDesc = $order->products[$i]["qty"] . ' x ' . $order->products[$i]["name"]; } $Remark = $OrderDesc; // $Language = MODULE_PAYMENT_CTOPAY_LANGUAGE; // $md5src = $MerNo.$BillNo.$Currency.$Amount.$Language.$ReturnURL.$MD5key; // $MD5info = strtoupper(md5($md5src)); // $process_button_string = tep_draw_hidden_field('MerNo', $MerNo) . tep_draw_hidden_field('Currency', $Currency) . tep_draw_hidden_field('BillNo', $BillNo) . tep_draw_hidden_field('Amount', $Amount) . tep_draw_hidden_field('DispAmount', $DispAmount) . tep_draw_hidden_field('ReturnURL', $ReturnURL) . tep_draw_hidden_field('Language', $Language) . tep_draw_hidden_field('MD5info', $MD5info) . tep_draw_hidden_field('OrderDesc', $OrderDesc) . tep_draw_hidden_field('Remark', $Remark) ; return $process_button_string; } function before_process() { global $_POST, $order, $currencies, $messageStack; // $BillNo = $_POST["BillNo"]; // $Currency = $_POST["Currency"]; // $BankID = $_POST["BankID"]; // $Amount = $_POST["Amount"]; // $Succeed = $_POST["Succeed"]; // $TradeNo = $_POST["TradeNo"]; // $Result = $_POST["Result"]; // $MD5info = $_POST["MD5info"]; // $Remark = $_POST["Remark"]; // $Drawee = $_POST["Drawee"]; // $MD5key = MODULE_PAYMENT_CTOPAY_MD5KEY; // $md5src = $BillNo.$Currency.$Amount.$Succeed.$MD5key; // $md5sign = strtoupper(md5($md5src)); // $this->tradeno = $TradeNo; $this->result = $Result; if($MD5info==$md5sign){ return true; // }else{ $messageStack->add_session('checkout_payment', 'FAILED', 'error'); tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL', true, false)); } } function after_process() { global $insert_id,$db; tep_db_query("insert into " . TABLE_ORDERS_STATUS_HISTORY . " (comments, orders_id, orders_status_id, date_added) values ('Serial Number: " . $this->tradeno . " - Payment results: " . $this->result . " ' , '". (int)$insert_id . "','" . $this->order_status . "', now() )"); return true; } function after_order_create($zf_order_id) { global $db, $order; unset($_SESSION['payment']); } function output_error() { return false; } function check() { if (!isset($this->_check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_CTOPAY_STATUS'"); $this->_check = tep_db_num_rows($check_query); } return $this->_check; } function install() { global $db, $language, $module_type; if (!defined('MODULE_PAYMENT_CTOPAY_TEXT_CONFIG_1_1')) include(DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/modules/' . $module_type . '/' . $this->code . '.php'); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('" . MODULE_PAYMENT_CTOPAY_TEXT_CONFIG_1_1 . "', 'MODULE_PAYMENT_CTOPAY_STATUS', 'True', '" . MODULE_PAYMENT_CTOPAY_TEXT_CONFIG_1_2 . "', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . MODULE_PAYMENT_CTOPAY_TEXT_CONFIG_2_1 . "', 'MODULE_PAYMENT_CTOPAY_SELLER', '1000', '" . MODULE_PAYMENT_CTOPAY_TEXT_CONFIG_2_2 . "', '6', '2', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . MODULE_PAYMENT_CTOPAY_TEXT_CONFIG_3_1 . "', 'MODULE_PAYMENT_CTOPAY_MD5KEY', '12345678', '" . MODULE_PAYMENT_CTOPAY_TEXT_CONFIG_3_2 . "', '6', '4', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('" . MODULE_PAYMENT_CTOPAY_TEXT_CONFIG_4_1 . "', 'MODULE_PAYMENT_CTOPAY_MONEYTYPE', 'CNY', '" . MODULE_PAYMENT_CTOPAY_TEXT_CONFIG_4_2 . "', '6', '6', 'tep_cfg_select_option(array(\'1\', \'6\', \'7\', \'10\', \'15\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('" . MODULE_PAYMENT_CTOPAY_TEXT_CONFIG_5_1 . "', 'MODULE_PAYMENT_CTOPAY_LANGUAGE', 'CNY', '" . MODULE_PAYMENT_CTOPAY_TEXT_CONFIG_5_2 . "', '6', '8', 'tep_cfg_select_option(array(\'1\', \'2\', \'3\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('" . MODULE_PAYMENT_CTOPAY_TEXT_CONFIG_6_1 . "', 'MODULE_PAYMENT_CTOPAY_ZONE', '0', '" . MODULE_PAYMENT_CTOPAY_TEXT_CONFIG_6_2 . "', '6', '10', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('" . MODULE_PAYMENT_CTOPAY_TEXT_CONFIG_7_1 . "', 'MODULE_PAYMENT_CTOPAY_ORDER_STATUS_ID', '2', '" . MODULE_PAYMENT_CTOPAY_TEXT_CONFIG_7_2 . "', '6', '12', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . MODULE_PAYMENT_CTOPAY_TEXT_CONFIG_8_1 . "', 'MODULE_PAYMENT_CTOPAY_SORT_ORDER', '0', '" . MODULE_PAYMENT_CTOPAY_TEXT_CONFIG_8_2 . "', '6', '12', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('" . MODULE_PAYMENT_CTOPAY_TEXT_CONFIG_9_1 . "', 'MODULE_PAYMENT_CTOPAY_HANDLER', 'http://payment.ctopay.com/payment/Interface', '" . MODULE_PAYMENT_CTOPAY_TEXT_CONFIG_9_2 . "', '6', '14', '', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key LIKE 'MODULE_PAYMENT_CTOPAY%'"); } function keys() { return array( 'MODULE_PAYMENT_CTOPAY_STATUS', 'MODULE_PAYMENT_CTOPAY_SELLER', 'MODULE_PAYMENT_CTOPAY_MD5KEY', 'MODULE_PAYMENT_CTOPAY_ZONE', 'MODULE_PAYMENT_CTOPAY_MONEYTYPE', 'MODULE_PAYMENT_CTOPAY_LANGUAGE', 'MODULE_PAYMENT_CTOPAY_ORDER_STATUS_ID', 'MODULE_PAYMENT_CTOPAY_SORT_ORDER', 'MODULE_PAYMENT_CTOPAY_HANDLER' ); } } ?> Just for reference, here is the CTOPAY website: http://www.ctopay.com/ctopay/en/service.jsp Any help would be much appreciated. Thanks!
  4. I also could not get product information on the link. I actually have exacly same files upload to 2 different sites, one is working very well, another one just no go. The working one can got pID correctly, the address shows: admin/categories.php?action=new_product_preview&read=only&pID=142&oID=&origin=orders.php?oID=&retOID=&retAction=edit The non-working one cannot get pID, the address shows: admin/categories.php?action=new_product_preview&read=only&pID=&oID=&origin=orders.php?oID=&retOID=&retAction=edit The only difference is working one is Linux 2.6.26.5 via PHP 5.2.3 and MySQL 5.0.41, and the non-working one is Linux 2.6.23.17 via PHP 5.2.6 and MySQL 5.0.45. Anyone please help?
  5. I have exactly same problem after I moved to godaddy's hosting and I chatted with couple of their support, no one know what's going on, they said is script coding issue and they could not provide any help... Did you contact the person who provide you the script code to check where we should add it?
  6. Do you mean the IPN.class which is stored in catalog/includes/modules/payment/paypal/classes/ folder? I actually did not change anything here, and as I remember, this modules really do not need to manually provided the 'notify_url' or 'return url'. Could you please take a look at the code of my IPN.class file and let me know if anything I need to change? Thank you. Below is the code of IPN.class: <?php /* $Id: IPN.class.php,v 1.1.1.1 2004/09/22 13:45:13 devosc Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com DevosC, Developing open source Code http://www.devosc.com Copyright (c) 2003 osCommerce Copyright (c) 2004 DevosC.com Released under the GNU General Public License */ //admin workaround! $modules_directory = defined('DIR_FS_CATALOG_MODULES') ? DIR_FS_CATALOG_MODULES : DIR_WS_MODULES; require_once($modules_directory . 'payment/paypal/classes/Client/Connector.class.php'); class PayPal_IPN extends PayPal_Client_Connector { function PayPal_IPN($post_vars) { global $debug; if (!in_array($post_vars['payment_type'],array('instant','echeck'))) { if ($debug->enabled) $debug->add(UNKNOWN_TXN_TYPE,sprintf(UNKNOWN_TXN_TYPE_MSG,$post_vars['payment_type'])); } else if(strlen($post_vars['txn_id']) == 17) { $this->init($post_vars); //Looks like a PayPal transaction } else { if ($debug->enabled) $debug->add(UNKNOWN_POST,sprintf(UNKNOWN_POST_MSG,$_SERVER['REMOTE_ADDR'])); } $this->setTestMode('Off'); register_shutdown_function(array($this,'_PayPal_IPN')); } function _PayPal_IPN() { global $debug; if ($debug->enabled) $debug->sendEmail(); } function init($post_vars) { global $debug; $debug_string = ''; $this->key = array(); $this->response_string = 'cmd=_notify-validate'; reset($post_vars); foreach ($post_vars as $var => $val) { $var = urldecode($var); $val = stripslashes(urldecode($val)); if ($debug->enabled) $debug_string .= $var . '=' . $val .'&'; if (!strcasecmp($var,'cmd') || !eregi("^[_0-9a-z-]{1,32}$",$var)) { unset($var); unset($val); } elseif (!empty($var)) { if($var === 'custom') { $this->setTxnSignature($val); } else { $this->key[$var] = $val; } $this->response_string .= '&' . urlencode($var) . '=' . urlencode($val); } } if ($debug->enabled) $debug->init($debug_string); unset($post_vars, $debug_string); } function insert($paypal_id = '') { global $debug; $key_vars = array( 'txn_type', 'reason_code', 'payment_type', 'payment_status', 'pending_reason', 'invoice', 'mc_currency', 'first_name', 'last_name', 'payer_business_name', 'address_name', 'address_street', 'address_city', 'address_state', 'address_zip', 'address_country', 'address_status', 'payer_email', 'payer_id', 'payer_status', 'business', 'receiver_email', 'receiver_id', 'txn_id', 'parent_txn_id', 'mc_gross', 'mc_fee', 'payment_gross', 'payment_fee', 'settle_amount', 'settle_currency', 'exchange_rate', 'for_auction', 'auction_buyer_id', 'auction_multi_item', 'quantity', 'tax', 'notify_version', 'verify_sign', 'memo' ); $sql_data_array = $this->setSQLDataElements($key_vars); $sql_data_array['num_cart_items'] = $this->txnType('cart') ? $this->key['num_cart_items'] : '1'; $sql_data_array['payment_date'] = $this->datetime_to_sql_format($this->key['payment_date']); $sql_data_array['payment_time_zone'] = $this->paymentTimeZone($this->key['payment_date']); $sql_data_array['auction_closing_date'] = $this->datetime_to_sql_format($this->key['auction_closing_date']); $sql_data_array['date_added'] = 'now()'; tep_db_perform(TABLE_PAYPAL, $sql_data_array); $this->ipnID = tep_db_insert_id(); $this->updatePaymentStatusHistory( !empty($paypal_id) ? $paypal_id : $this->ipnID ); if($this->isAuction()) $this->processAuction($this->ipnID); if($debug->enabled) $debug->add(IPN_TXN_INSERT,sprintf(IPN_TXN_INSERT_MSG,$this->ipnID)); return $this->ipnID; } function updatePaymentStatusHistory($paypal_id) { $sql_data_array = $this->setSQLDataElements(array('payment_status', 'pending_reason', 'reason')); $sql_data_array['paypal_id'] = $paypal_id; $sql_data_array['date_added'] = 'now()'; tep_db_perform(TABLE_PAYPAL_PAYMENT_STATUS_HISTORY, $sql_data_array); } function updateStatus($paypal_id) { $key_vars = array( 'first_name', 'last_name', 'payer_business_name', 'address_name', 'address_street', 'address_city', 'address_state','address_zip', 'address_country', 'address_status', 'mc_gross', 'mc_currency', 'mc_fee', 'settle_amount', 'settle_currency', 'exchange_rate', 'payment_status' ); $sql_data_array = $this->setSQLDataElements($key_vars); $sql_data_array['last_modified'] = 'now()'; tep_db_perform(TABLE_PAYPAL, $sql_data_array, 'update', "paypal_id = '" . (int)$paypal_id . "'"); $this->updatePaymentStatusHistory($paypal_id); } function updateOrderStatus($paypal_id,$status) { //Orders $sql_data_array = array( 'orders_status' => tep_db_input($status), 'last_modified' => 'now()' ); tep_db_perform(TABLE_ORDERS, $sql_data_array, 'update', "payment_id = '" . (int)$paypal_id . "'"); //Orders Status History $sql_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where payment_id = '" . (int)$paypal_id . "'"); $sql_result = tep_db_fetch_array($sql_query); $sql_data_array = array( 'orders_id' => $sql_result['orders_id'], 'orders_status_id' => tep_db_input($status), 'date_added' => 'now()' ); tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array, 'insert'); } function queryTxnID($txn_id) { $sql_query = tep_db_query("select paypal_id from " . TABLE_PAYPAL . " where txn_id = '" . tep_db_input($txn_id) . "' limit 0,1"); return tep_db_fetch_array($sql_query); } function queryPendingStatus($txn_id) { $sql_query = tep_db_query("select paypal_id, payment_status, pending_reason from " . TABLE_PAYPAL . " where txn_id = '" . tep_db_input($txn_id) . "' limit 0,1"); return tep_db_fetch_array($sql_query); } function authenticate($domain, $success = 'VERIFIED') { $paypal_response = $this->getResponse($domain); $paypal_verification = $this->getVerificationResponse($paypal_response); return strstr($paypal_verification,$success); } function uniqueTxnID() { global $debug; if (isset($this->uniqueTxnID)) { return $this->uniqueTxnID; } else { $txn_id_query = tep_db_query("select txn_id from " . TABLE_PAYPAL . " where txn_id = '" . tep_db_input($this->txnID()) . "' limit 0,1"); if (!tep_db_num_rows($txn_id_query)) { //txn_id doesn't exist $this->uniqueTxnID = true; return $this->uniqueTxnID; } else { if($debug->enabled) $debug->add(TXN_DUPLICATE,sprintf(TXN_DUPLICATE_MSG,$this->txnID())); $this->uniqueTxnID = false; return $this->uniqueTxnID; } } } function validPayment($amount,$currency) { if (MODULE_PAYMENT_PAYPAL_IPN_CART_TEST == 'Off') return true; return parent::validPayment($amount,$currency); } //returns TABLE_PAYPAL.paypal_id function ID() { return $this->ipnID; } function txnID() { return $this->key['txn_id']; } //returns the transaction type (paypal.txn_type) function txnType($txnTypeName = '') { if(!empty($txnTypeName)) { return ($this->key['txn_type'] === $txnTypeName); } return $this->key['txn_type']; } function paymentStatus($statusName = '') { if(!empty($statusName)) { return ($this->key['payment_status'] == $statusName); } return $this->key['payment_status']; } function isCartPayment() { return in_array($this->key['txn_type'],array('web_accept','cart')); } function isReversal() { return in_array($this->key['payment_status'],array('Refunded','Reversed','Canceled_Reversal')); } function reversalType() { return $this->key['payment_status']; } function datetime_to_sql_format($paypalDateTime) { $months = array('Jan' => '01', 'Feb' => '02', 'Mar' => '03', 'Apr' => '04', 'May' => '05', 'Jun' => '06', 'Jul' => '07', 'Aug' => '08', 'Sep' => '09', 'Oct' => '10', 'Nov' => '11', 'Dec' => '12'); $array = explode(" ",$paypalDateTime); $time = explode(":",$array[0]); $hour = $time[0];$minute = $time[1];$second = $time[2]; $month = $months[$array[1]]; $day = substr_replace($array[2],'',-1,1); $year = $array[3]; return ($year . "-" . $month . "-" . $day . " " . $hour . ":" . $minute . ":" . $second); } function paymentTimeZone($paypalDateTime) { $array = explode(" ",$paypalDateTime); return $array[4]; } function setSQLDataElements($varnames) { $sql_data_array = array(); $nVars = count($varnames); for($i=0; $i<$nVars; $i++) { if(isset($this->key[$varnames[$i]]) && !empty($this->key[$varnames[$i]]) && trim($this->key[$varnames[$i]]) != '') $sql_data_array[$varnames[$i]] = $this->key[$varnames[$i]]; } return $sql_data_array; } function isAuction() { return (isset($this->key['for_auction']) && $this->key['for_auction'] === 'true'); } function processAuction($paypal_id) { if(defined('TABLE_PAYPAL_AUCTION')) { if($this->isAuction() && strlen($this->key['item_number']) > 0) { $items = explode(',', $this->key['item_number']); foreach($items as $key => $item_id) { // Save the auction IDs for correlation later $txn_check = tep_db_query("select auction_buyer_id from " . TABLE_PAYPAL_AUCTION . " where paypal_id = '" . (int)$paypal_id . "' and item_number = '" . tep_db_input($item_id) . "'"); if (!tep_db_num_rows($txn_check)) { $sql_data_array = $this->setSQLDataElements(array('auction_buyer_id','auction_multi_item')); $sql_data_array['paypal_id'] = (int)$paypal_id; $sql_data_array['item_number'] = $item_id; tep_db_perform(TABLE_PAYPAL_AUCTION, $sql_data_array); } } } } } function setTxnSignature($txnSignature = '') { if(!isset($this->txnSignature)) $this->txnSignature = $txnSignature; } function txnSignature() { return $this->txnSignature; } /* //Test that the store owner's 'custom' transaction signature doesn't exist //Really this is only for preventing mistakes via the IPN Test Panel function uniqueTxnSignature() { global $debug; if(!$this->isTestMode()) return true; if (isset($this->uniqueTxnSignature)) { return $this->uniqueTxnSignature; } else { $txn_sign_query = tep_db_query("select txn_sign from " . TABLE_PAYPAL . " where txn_sign = '" . tep_db_input($this->txnSignature()) . "' limit 0,1"); if (!tep_db_num_rows($txn_sign_query)) { //txn_sign doesn't exist $this->uniqueTxnSignature = true; return $this->uniqueTxnSignature; } else { if($debug->enabled) $debug->add(TXN_DUPLICATE_SIGNATURE,sprintf(TXN_DUPLICATE_SIGNATURE_MSG,$this->txnSignature())); $this->uniqueTxnSignature = false; return $this->uniqueTxnSignature; } } }*/ }//end class ?>
  7. I received another email from Paypal saying: After checking with technician about IPN issue, I was notified that they found you set incorrect value for the variable 'notify_url', the value you are using at this moment is 'ipn.php' ,which obviously is not a complete and valid URL. Besides, the URL for both variable 'return' and 'cancel_return' are invalid. So some variables are missing at your site, as a result, you send a relative address instead of the absolute address in this case. You need to fix it at your side. Please try to contact third party provider to work out the issue.
  8. I actually always leave it blank, and never got the problem before. And I just confirmed with my friend's working site, he also leave the Instand Payment Notification URL blank but the status post back to the shopping cart without any problem.
  9. Not quite understand how to place some file write code or open these lines, however, I received another email from Paypal saying: After checking with technician about IPN issue, I was notified that they found you set incorrect value for the variable 'notify_url', the value you are using at this moment is 'ipn.php' ,which obviously is not a complete and valid URL. Besides, the URL for both variable 'return' and 'cancel_return' are invalid. So some variables are missing at your site, as a result, you send a relative address instead of the absolute address in this case. You need to fix it at your side. Please try to contact third party provider to work out the issue.
  10. Just received the following notice from Paypal: Please check your server that handles PayPal Instant Payment Notifications (IPN). IPNs sent to the following URL(s) are failing: ipn.php If you do not recognize this URL, you may be using a service provider that is using IPN on your behalf. Please contact your service provider with the above information. If this problem continues, IPNs may be disabled for your account. Thank you for your prompt attention to this issue. Can you please take a look at my ipn.php? Here is the code: <?php /* $Id: ipn.php,v 1.1.1.1 2004/09/22 13:45:11 devosc Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com DevosC, Developing open source Code http://www.devosc.com Copyright (c) 2003 osCommerce Copyright (c) 2004 DevosC.com Released under the GNU General Public License */ /* function debugWriteFile($str,$mode="a") { $fp = @fopen("ipn.txt",$mode); @flock($fp, LOCK_EX); @fwrite($fp,$str); @flock($fp, LOCK_UN); @fclose($fp); } $postString = ''; foreach($_POST as $key => $val) $postString .= $key.' = '.$val."\n"; if($postString != '') { debugWriteFile($postString,"w+"); } */ require_once('includes/modules/payment/paypal/application_top.inc.php'); require_once(DIR_WS_MODULES . 'payment/paypal/classes/IPN/IPN.class.php'); require_once(DIR_WS_MODULES . 'payment/paypal/classes/Debug/Debug.class.php'); require_once(DIR_WS_MODULES . 'payment/paypal/functions/general.func.php'); paypal_include_lng(DIR_WS_MODULES . 'payment/paypal/languages/', 'english', 'ipn.lng.php'); $debug = new PayPal_Debug(MODULE_PAYMENT_PAYPAL_IPN_DEBUG_EMAIL, MODULE_PAYMENT_PAYPAL_IPN_DEBUG); $ipn = new PayPal_IPN($_POST); $ipn->setTestMode(MODULE_PAYMENT_PAYPAL_IPN_TEST_MODE); unset($_POST); //post back to PayPal to validate if(!$ipn->authenticate(MODULE_PAYMENT_PAYPAL_DOMAIN) && $ipn->testMode('Off')) $ipn->dienice('500'); //Check both the receiver_email and business ID fields match if (!$ipn->validateReceiverEmail(MODULE_PAYMENT_PAYPAL_ID,MODULE_PAYMENT_PAYPAL_BUSINESS_ID)) $ipn->dienice('500'); if($ipn->uniqueTxnID() && $ipn->isReversal() && strlen($ipn->key['parent_txn_id']) == 17) { //parent_txn_id is the txn_id of the original transaction $txn = $ipn->queryTxnID($ipn->key['parent_txn_id']); if(!empty($txn)) { $ipn->insert($txn['paypal_id']); // update the order's status switch ($ipn->reversalType()) { case 'Canceled_Reversal': $order_status = MODULE_PAYMENT_PAYPAL_ORDER_STATUS_ID; break; case 'Reversed': $order_status = MODULE_PAYMENT_PAYPAL_ORDER_CANCELED_STATUS_ID; break; case 'Refunded': $order_status = MODULE_PAYMENT_PAYPAL_ORDER_REFUNDED_STATUS_ID; break; } $ipn->updateOrderStatus($txn['paypal_id'],$order_status); } } elseif ($ipn->isCartPayment() && !empty($PayPal_osC_Order->orderID)) { //actually not essential since 'orders_status_name' is not required $languages_id = $PayPal_osC_Order->languageID; include(DIR_WS_CLASSES . 'order.php'); $order = new order($PayPal_osC_Order->orderID); //Check that txn_id has not been previously processed if ($ipn->uniqueTxnID()) { //Payment is either Completed, Pending or Failed $ipn->insert(); $PayPal_osC_Order->setOrderPaymentID($ipn->ID()); $PayPal_osC_Order->removeCustomersBasket($order->customer['id']); switch ($ipn->paymentStatus()) { case 'Completed': if ($ipn->validPayment($PayPal_osC_Order->payment_amount,$PayPal_osC_Order->payment_currency)) { include(DIR_WS_MODULES . 'payment/paypal/catalog/checkout_update.inc.php'); } else { $ipn->updateOrderStatus($ipn->ID(),MODULE_PAYMENT_PAYPAL_ORDER_ONHOLD_STATUS_ID); } break; case 'Failed': $ipn->updateOrderStatus($ipn->ID(),MODULE_PAYMENT_PAYPAL_ORDER_CANCELED_STATUS_ID); break; case 'Pending': //Assumed to do nothing since the order is initially in a Pending ORDER Status break; }//end switch } else { // not a unique transaction => Pending Payment //Assumes there is only one previous IPN transaction $pendingTxn = $ipn->queryPendingStatus($ipn->txnID()); if ($pendingTxn['payment_status'] === 'Pending') { $ipn->updateStatus($pendingTxn['paypal_id']); switch ($ipn->paymentStatus()) { case 'Completed': if ($ipn->validPayment($PayPal_osC_Order->payment_amount,$PayPal_osC_Order->payment_currency)) { include(DIR_WS_MODULES . 'payment/paypal/catalog/checkout_update.inc.php'); } else { $ipn->updateOrderStatus($pendingTxn['paypal_id'],MODULE_PAYMENT_PAYPAL_ORDER_ONHOLD_STATUS_ID); } break; case 'Denied': $ipn->updateOrderStatus($pendingTxn['paypal_id'],MODULE_PAYMENT_PAYPAL_ORDER_CANCELED_STATUS_ID); break; }//end switch }//end if Pending Payment } } elseif ($ipn->isAuction()) { if ($ipn->uniqueTxnID()) $ipn->insert(); if ($debug->enabled) $debug->add(PAYPAL_AUCTION,sprintf(PAYPAL_AUCTION_MSG)); } elseif ($ipn->txnType('send_money')) { if ($ipn->uniqueTxnID()) $ipn->insert(); if ($debug->enabled) $debug->add(PAYMENT_SEND_MONEY_DESCRIPTION,sprintf(PAYMENT_SEND_MONEY_DESCRIPTION_MSG,number_format($ipn->key['mc_gross'],2),$ipn->key['mc_currency'])); } elseif ($debug->enabled && $ipn->testMode('On')) { $debug->raiseError(TEST_INCOMPLETE,sprintf(TEST_INCOMPLETE_MSG),true); } if ($ipn->testMode('On') && $ipn->validDigest()) { include(DIR_WS_MODULES . 'payment/paypal/classes/Page/Page.class.php'); $page = new PayPal_Page(); $page->setBaseDirectory(DIR_WS_MODULES . 'payment/paypal/'); $page->setBaseURL(DIR_WS_MODULES . 'payment/paypal/'); $page->includeLanguageFile('admin/languages','english','paypal.lng.php'); $page->setTitle(HEADING_ITP_RESULTS_TITLE); $page->setContentFile(DIR_WS_MODULES . 'payment/paypal/admin/TestPanel/Results.inc.php'); $page->addCSS($page->baseURL . 'templates/css/general.css'); $page->addCSS($page->baseURL . 'templates/css/stylesheet.css'); $page->setTemplate('default'); include($page->template()); } require(DIR_WS_MODULES . 'payment/paypal/application_bottom.inc.php'); ?> Thanks....
  11. Just received the following notice from Paypal: Please check your server that handles PayPal Instant Payment Notifications (IPN). IPNs sent to the following URL(s) are failing: ipn.php If you do not recognize this URL, you may be using a service provider that is using IPN on your behalf. Please contact your service provider with the above information. If this problem continues, IPNs may be disabled for your account. Thank you for your prompt attention to this issue. Can you please take a look at my ipn.php? Here is the code: <?php /* $Id: ipn.php,v 1.1.1.1 2004/09/22 13:45:11 devosc Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com DevosC, Developing open source Code http://www.devosc.com Copyright (c) 2003 osCommerce Copyright (c) 2004 DevosC.com Released under the GNU General Public License */ /* function debugWriteFile($str,$mode="a") { $fp = @fopen("ipn.txt",$mode); @flock($fp, LOCK_EX); @fwrite($fp,$str); @flock($fp, LOCK_UN); @fclose($fp); } $postString = ''; foreach($_POST as $key => $val) $postString .= $key.' = '.$val."\n"; if($postString != '') { debugWriteFile($postString,"w+"); } */ require_once('includes/modules/payment/paypal/application_top.inc.php'); require_once(DIR_WS_MODULES . 'payment/paypal/classes/IPN/IPN.class.php'); require_once(DIR_WS_MODULES . 'payment/paypal/classes/Debug/Debug.class.php'); require_once(DIR_WS_MODULES . 'payment/paypal/functions/general.func.php'); paypal_include_lng(DIR_WS_MODULES . 'payment/paypal/languages/', 'english', 'ipn.lng.php'); $debug = new PayPal_Debug(MODULE_PAYMENT_PAYPAL_IPN_DEBUG_EMAIL, MODULE_PAYMENT_PAYPAL_IPN_DEBUG); $ipn = new PayPal_IPN($_POST); $ipn->setTestMode(MODULE_PAYMENT_PAYPAL_IPN_TEST_MODE); unset($_POST); //post back to PayPal to validate if(!$ipn->authenticate(MODULE_PAYMENT_PAYPAL_DOMAIN) && $ipn->testMode('Off')) $ipn->dienice('500'); //Check both the receiver_email and business ID fields match if (!$ipn->validateReceiverEmail(MODULE_PAYMENT_PAYPAL_ID,MODULE_PAYMENT_PAYPAL_BUSINESS_ID)) $ipn->dienice('500'); if($ipn->uniqueTxnID() && $ipn->isReversal() && strlen($ipn->key['parent_txn_id']) == 17) { //parent_txn_id is the txn_id of the original transaction $txn = $ipn->queryTxnID($ipn->key['parent_txn_id']); if(!empty($txn)) { $ipn->insert($txn['paypal_id']); // update the order's status switch ($ipn->reversalType()) { case 'Canceled_Reversal': $order_status = MODULE_PAYMENT_PAYPAL_ORDER_STATUS_ID; break; case 'Reversed': $order_status = MODULE_PAYMENT_PAYPAL_ORDER_CANCELED_STATUS_ID; break; case 'Refunded': $order_status = MODULE_PAYMENT_PAYPAL_ORDER_REFUNDED_STATUS_ID; break; } $ipn->updateOrderStatus($txn['paypal_id'],$order_status); } } elseif ($ipn->isCartPayment() && !empty($PayPal_osC_Order->orderID)) { //actually not essential since 'orders_status_name' is not required $languages_id = $PayPal_osC_Order->languageID; include(DIR_WS_CLASSES . 'order.php'); $order = new order($PayPal_osC_Order->orderID); //Check that txn_id has not been previously processed if ($ipn->uniqueTxnID()) { //Payment is either Completed, Pending or Failed $ipn->insert(); $PayPal_osC_Order->setOrderPaymentID($ipn->ID()); $PayPal_osC_Order->removeCustomersBasket($order->customer['id']); switch ($ipn->paymentStatus()) { case 'Completed': if ($ipn->validPayment($PayPal_osC_Order->payment_amount,$PayPal_osC_Order->payment_currency)) { include(DIR_WS_MODULES . 'payment/paypal/catalog/checkout_update.inc.php'); } else { $ipn->updateOrderStatus($ipn->ID(),MODULE_PAYMENT_PAYPAL_ORDER_ONHOLD_STATUS_ID); } break; case 'Failed': $ipn->updateOrderStatus($ipn->ID(),MODULE_PAYMENT_PAYPAL_ORDER_CANCELED_STATUS_ID); break; case 'Pending': //Assumed to do nothing since the order is initially in a Pending ORDER Status break; }//end switch } else { // not a unique transaction => Pending Payment //Assumes there is only one previous IPN transaction $pendingTxn = $ipn->queryPendingStatus($ipn->txnID()); if ($pendingTxn['payment_status'] === 'Pending') { $ipn->updateStatus($pendingTxn['paypal_id']); switch ($ipn->paymentStatus()) { case 'Completed': if ($ipn->validPayment($PayPal_osC_Order->payment_amount,$PayPal_osC_Order->payment_currency)) { include(DIR_WS_MODULES . 'payment/paypal/catalog/checkout_update.inc.php'); } else { $ipn->updateOrderStatus($pendingTxn['paypal_id'],MODULE_PAYMENT_PAYPAL_ORDER_ONHOLD_STATUS_ID); } break; case 'Denied': $ipn->updateOrderStatus($pendingTxn['paypal_id'],MODULE_PAYMENT_PAYPAL_ORDER_CANCELED_STATUS_ID); break; }//end switch }//end if Pending Payment } } elseif ($ipn->isAuction()) { if ($ipn->uniqueTxnID()) $ipn->insert(); if ($debug->enabled) $debug->add(PAYPAL_AUCTION,sprintf(PAYPAL_AUCTION_MSG)); } elseif ($ipn->txnType('send_money')) { if ($ipn->uniqueTxnID()) $ipn->insert(); if ($debug->enabled) $debug->add(PAYMENT_SEND_MONEY_DESCRIPTION,sprintf(PAYMENT_SEND_MONEY_DESCRIPTION_MSG,number_format($ipn->key['mc_gross'],2),$ipn->key['mc_currency'])); } elseif ($debug->enabled && $ipn->testMode('On')) { $debug->raiseError(TEST_INCOMPLETE,sprintf(TEST_INCOMPLETE_MSG),true); } if ($ipn->testMode('On') && $ipn->validDigest()) { include(DIR_WS_MODULES . 'payment/paypal/classes/Page/Page.class.php'); $page = new PayPal_Page(); $page->setBaseDirectory(DIR_WS_MODULES . 'payment/paypal/'); $page->setBaseURL(DIR_WS_MODULES . 'payment/paypal/'); $page->includeLanguageFile('admin/languages','english','paypal.lng.php'); $page->setTitle(HEADING_ITP_RESULTS_TITLE); $page->setContentFile(DIR_WS_MODULES . 'payment/paypal/admin/TestPanel/Results.inc.php'); $page->addCSS($page->baseURL . 'templates/css/general.css'); $page->addCSS($page->baseURL . 'templates/css/stylesheet.css'); $page->setTemplate('default'); include($page->template()); } require(DIR_WS_MODULES . 'payment/paypal/application_bottom.inc.php'); ?> Thanks....
  12. Just received the following notice from Paypal: Please check your server that handles PayPal Instant Payment Notifications (IPN). IPNs sent to the following URL(s) are failing: ipn.php If you do not recognize this URL, you may be using a service provider that is using IPN on your behalf. Please contact your service provider with the above information. If this problem continues, IPNs may be disabled for your account. Thank you for your prompt attention to this issue. Anyone please help? Thanks for any advice.
  13. Just noticedthat I am actually using Paypal_Shopping_Cart_IPN V3.1.5, I can only received Notification of Payment Received Email from Paypal without Invoice ID. My friend's site on other hosting company using same modules on PHP Version: 4.4.8 without any issue. He can receive another PayPal_Shopping_Cart_IPN Debug Notification Email when the Paypal payment completed. Do you know what changes I should to make to fix this problem? Thanks for your attention.
×
×
  • Create New...