Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution]Paypal IPN - Devosc


devosc

Recommended Posts

Devosc,

 

I made modifications so that it function with CCGV AND send_order_html_email,

I am not developer, but on my MS2 with BTS 1.4 that work.

 

Can be that it is necessary optimized the code thank you for your advises

 

catalog/includes/modules/payment/paypal.php

 

<?php
/*
 $Id: paypal.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
*/

 define('FILENAME_PAYPAL_INFO','popup_paypal.php');
 define('FILENAME_IPN','ipn.php');

 class paypal {
   var $code, $title, $description, $enabled;

// class constructor
   function paypal() {
     global $order;
     $this->code = 'paypal';
     $this->codeTitle = 'PayPal';
     $this->title = MODULE_PAYMENT_PAYPAL_TEXT_TITLE;
     $this->description = MODULE_PAYMENT_PAYPAL_TEXT_DESCRIPTION;
     $this->sort_order = MODULE_PAYMENT_PAYPAL_SORT_ORDER;
     $this->enabled = ((MODULE_PAYMENT_PAYPAL_STATUS == 'True') ? true : false);
     if ((int)MODULE_PAYMENT_PAYPAL_ORDER_STATUS_ID > 0) {
       $this->order_status = MODULE_PAYMENT_PAYPAL_ORDER_STATUS_ID;
     }
     if (is_object($order)) $this->update_status();
     $this->form_paypal_url = 'https://' . MODULE_PAYMENT_PAYPAL_DOMAIN . '/cgi-bin/webscr';
     $this->cc_explain_url = tep_href_link(FILENAME_PAYPAL_INFO, '', 'SSL');
  }

// catalog payment module class methods
   function update_status() {
     global $order;
     if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_PAYPAL_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_PAYPAL_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id");
       while ($check = tep_db_fetch_array($check_query)) {
         if ($check['zone_id'] < 1) {
           $check_flag = true;
           break;
         } elseif ($check['zone_id'] == $order->billing['zone_id']) {
           $check_flag = true;
           break;
         }
       }
       if ($check_flag == false) {
         $this->enabled = false;
       }
     }
   }

   function javascript_validation() {
     return false;
   }

   function selection() {
     $img_visa = DIR_WS_MODULES .'payment/paypal/images/visa.gif';
     $img_mc = DIR_WS_MODULES .'payment/paypal/images/mastercard.gif';
     $img_discover = DIR_WS_MODULES .'payment/paypal/images/discover.gif';
     $img_amex = DIR_WS_MODULES .'payment/paypal/images/amex.gif';
     $img_paypal = DIR_WS_MODULES .'payment/paypal/images/paypal_intl.gif';
     $jscript_url = '<a style="cursor: pointer; cursor: hand;"' . " onclick=\"javascript:popup=window.open(\'" . $this->cc_explain_url . "\',\'popup\',\'scrollbars,resizable,width=625,height=600,left=50,top=50\'); popup.focus(); return false;\">";
     $cc_explain = '<div style="A.hover{cursor:hand}">' . MODULE_PAYMENT_PAYPAL_CC_DESCRIPTION .' ' .
                   "<script>document.writeln('" . $jscript_url .
                   MODULE_PAYMENT_PAYPAL_CC_URL_TEXT . "</a>');</script>" .
                   '<noscript><a href="' . $this->cc_explain_url . '" target="_blank">' .
                   MODULE_PAYMENT_PAYPAL_CC_URL_TEXT . '</noscript>' ."\n".'</div>';
     $paypal_cc_txt = sprintf(MODULE_PAYMENT_PAYPAL_CC_TEXT,
                             tep_image($img_visa,' Visa ','','','align="absmiddle"'),
                             tep_image($img_mc,' MasterCard ','','','align="absmiddle"'),
                             tep_image($img_discover,' Discover ','','','align="absmiddle"'),
                             tep_image($img_amex,' American Express ','','','align="absmiddle"'),
                             tep_image($img_paypal,' PayPal ','','','align="absmiddle"')
                            );
     $fields[] = array('title' => '', //MODULE_PAYMENT_PAYPAL_TEXT_TITLE,
                       'field' => '<div><b>' . $paypal_cc_txt . '</b></div>' . $cc_explain );
     return array('id' => $this->code,
                  'module' => $this->title,
                  'fields' => $fields);
   }

   function pre_confirmation_check() {
     return false;
   }

   function confirmation() {
     return false;
   }

   function currency() {
     global $currency;
     if(!isset($this->currency)) {
       if (MODULE_PAYMENT_PAYPAL_CURRENCY == 'Selected Currency') {
         $this->currency = $currency;
       } else {
         $this->currency = substr(MODULE_PAYMENT_PAYPAL_CURRENCY, 5);
       }
       if (!in_array($this->currency, array('CAD', 'EUR', 'GBP', 'JPY', 'USD'))) {
         $this->currency = 'USD';
       }
     }
     return $this->currency;
   }

   //Returns the gross total amount to compare with paypal.mc_gross
   function grossPaymentAmount($my_currency) {
     global $order, $currencies;
     return number_format(($order->info['total']) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));
   }

   function amount($my_currency) {
     global $order, $currencies;
     return number_format(($order->info['total'] - $order->info['shipping_cost']) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));
   }

   function process_button() {
     return false;
   }

   function before_process() {
     if(!class_exists('PayPal_osC')) include_once(DIR_WS_MODULES . 'payment/paypal/classes/osC/osC.class.php');
     if (PayPal_osC::check_order_status()) {
       tep_redirect(tep_href_link(FILENAME_SHOPPING_CART, '', 'SSL'));
     } else {
       include(DIR_WS_MODULES . 'payment/paypal/catalog/checkout_process.inc.php');
     }
     exit;
   }

   function after_process() {
     return false;
   }

   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_PAYPAL_STATUS'");
       $this->_check = tep_db_num_rows($check_query);
     }
     return $this->_check;
   }

   function install() {
     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 ('Enable PayPal Module', 'MODULE_PAYMENT_PAYPAL_STATUS', 'True', 'Do you want to accept PayPal payments?', '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 ('E-Mail Address', 'MODULE_PAYMENT_PAYPAL_ID','".STORE_OWNER_EMAIL_ADDRESS."', 'The e-mail address to use for the PayPal service', '6', '0', now())");
     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Business ID', 'MODULE_PAYMENT_PAYPAL_BUSINESS_ID','".STORE_OWNER_EMAIL_ADDRESS."', 'Email address or account ID of the payment recipient', '6', '', 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 ('Transaction Currency', 'MODULE_PAYMENT_PAYPAL_CURRENCY', 'Selected Currency', 'The currency to use for credit card transactions', '6', '0', 'tep_cfg_select_option(array(\'Selected Currency\',\'Only USD\',\'Only CAD\',\'Only EUR\',\'Only GBP\',\'Only JPY\'), ', 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 ('Payment Zone', 'MODULE_PAYMENT_PAYPAL_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '0', '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 ('Set Pending Notification Status', 'MODULE_PAYMENT_PAYPAL_PROCESSING_STATUS_ID', '" . DEFAULT_ORDERS_STATUS_ID .  "', 'Set the Pending Notification status of orders made with this payment module to this value (\'Pending\' recommended)', '6', '0', '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, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_PAYPAL_ORDER_STATUS_ID', '" . DEFAULT_ORDERS_STATUS_ID . "', 'Set the status of orders made with this payment module to this value<br>(\'Processing\' recommended)', '6', '0', '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, set_function, use_function, date_added) values ('Set On Hold Order Status', 'MODULE_PAYMENT_PAYPAL_ORDER_ONHOLD_STATUS_ID', '" . DEFAULT_ORDERS_STATUS_ID . "', 'Set the status of <b>On Hold</b> orders made with this payment module to this value', '6', '0', '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, set_function, use_function, date_added) values ('Set Canceled Order Status', 'MODULE_PAYMENT_PAYPAL_ORDER_CANCELED_STATUS_ID', '" . DEFAULT_ORDERS_STATUS_ID . "', 'Set the status of <b>Canceled</b> orders made with this payment module to this value', '6', '0', '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, set_function, date_added) values ('Synchronize Invoice', 'MODULE_PAYMENT_PAYPAL_INVOICE_REQUIRED', 'False', 'Do you want to specify the order number as the PayPal invoice number?', '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 ('Sort order of display.', 'MODULE_PAYMENT_PAYPAL_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', 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 ('Background Color', 'MODULE_PAYMENT_PAYPAL_CS', 'White', 'Select the background color of PayPal\'s payment pages.', '6', '0', 'tep_cfg_select_option(array(\'White\',\'Black\'), ', now())");
     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Processing logo', 'MODULE_PAYMENT_PAYPAL_PROCESSING_LOGO', 'oscommerce.gif', 'The image file name to display the store\'s checkout process', '6', '0', now())");
     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Store logo', 'MODULE_PAYMENT_PAYPAL_STORE_LOGO', '', 'The image file name for PayPal to display (leave empty if your store does not have SSL)', '6', '0', now())");
     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('PayPal Page Style Name', 'MODULE_PAYMENT_PAYPAL_PAGE_STYLE', 'default', 'The name of the page style you have configured in your PayPal Account', '6', '0', 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 ('Include a note with payment', 'MODULE_PAYMENT_PAYPAL_NO_NOTE', 'No', 'Choose whether your customer should be prompted to include a note or not?', '6', '0', 'tep_cfg_select_option(array(\'Yes\',\'No\'), ', 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 ('Shopping Cart Method', 'MODULE_PAYMENT_PAYPAL_METHOD', 'Aggregate', 'What type of shopping cart do you want to use?', '6', '0', 'tep_cfg_select_option(array(\'Aggregate\',\'Itemized\'), ', 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 ('Enable PayPal Shipping Address', 'MODULE_PAYMENT_PAYPAL_SHIPPING_ALLOWED', 'No', 'Allow the customer to choose their own PayPal shipping address?', '6', '0', 'tep_cfg_select_option(array(\'Yes\',\'No\'), ', 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 ('Debug Email Notifications', 'MODULE_PAYMENT_PAYPAL_IPN_DEBUG', 'Yes', 'Enable debug email notifications', '6', '0', 'tep_cfg_select_option(array(\'Yes\',\'No\'), ', now())");
     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Digest Key', 'MODULE_PAYMENT_PAYPAL_IPN_DIGEST_KEY', 'PayPal_Shopping_Cart_IPN', 'Key to use for the digest functionality', '6', '0', 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 ('Test Mode', 'MODULE_PAYMENT_PAYPAL_IPN_TEST_MODE', 'Off', 'Set test mode <a style=\"color: #0033cc;\" href=\"" . tep_href_link(FILENAME_PAYPAL, 'action=itp') . "\" target=\"ipn\">[IPN Test Panel]</a>', '6', '0', 'tep_cfg_select_option(array(\'Off\',\'On\'), ', 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 ('Cart Test', 'MODULE_PAYMENT_PAYPAL_IPN_CART_TEST', 'On', 'Set cart test mode to verify the transaction amounts', '6', '0', 'tep_cfg_select_option(array(\'Off\',\'On\'), ', now())");
     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Debug Email Notification Address', 'MODULE_PAYMENT_PAYPAL_IPN_DEBUG_EMAIL','".STORE_OWNER_EMAIL_ADDRESS."', 'The e-mail address to send <b>debug</b> notifications to', '6', '0', 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 ('PayPal Domain', 'MODULE_PAYMENT_PAYPAL_DOMAIN', 'www.paypal.com', 'Select which PayPal domain to use<br>(for live production select www.paypal.com)', '6', '0', 'tep_cfg_select_option(array(\'www.paypal.com\',\'www.sandbox.paypal.com\'), ', 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 ('Return URL behavior', 'MODULE_PAYMENT_PAYPAL_RM', '1', 'How should the customer be sent back from PayPal to the specified URL?<br>0=No IPN, 1=GET, 2=POST', '6', '0', 'tep_cfg_select_option(array(\'0\',\'1\',\'2\'), ', now())");
   }

   function remove() {
     tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
   }

   function keys() {
     return array(
         'MODULE_PAYMENT_PAYPAL_STATUS',
         'MODULE_PAYMENT_PAYPAL_ID',
         'MODULE_PAYMENT_PAYPAL_BUSINESS_ID',
         'MODULE_PAYMENT_PAYPAL_CURRENCY',
         'MODULE_PAYMENT_PAYPAL_ZONE',
         'MODULE_PAYMENT_PAYPAL_PROCESSING_STATUS_ID',
         'MODULE_PAYMENT_PAYPAL_ORDER_STATUS_ID',
         'MODULE_PAYMENT_PAYPAL_ORDER_ONHOLD_STATUS_ID',
         'MODULE_PAYMENT_PAYPAL_ORDER_CANCELED_STATUS_ID',
         'MODULE_PAYMENT_PAYPAL_INVOICE_REQUIRED',
         'MODULE_PAYMENT_PAYPAL_SORT_ORDER',
         'MODULE_PAYMENT_PAYPAL_CS',
         'MODULE_PAYMENT_PAYPAL_PROCESSING_LOGO',
         'MODULE_PAYMENT_PAYPAL_STORE_LOGO',
         'MODULE_PAYMENT_PAYPAL_PAGE_STYLE',
         'MODULE_PAYMENT_PAYPAL_NO_NOTE',
         'MODULE_PAYMENT_PAYPAL_METHOD',
         'MODULE_PAYMENT_PAYPAL_SHIPPING_ALLOWED',
         'MODULE_PAYMENT_PAYPAL_IPN_DIGEST_KEY',
         'MODULE_PAYMENT_PAYPAL_IPN_TEST_MODE',
         'MODULE_PAYMENT_PAYPAL_IPN_CART_TEST',
         'MODULE_PAYMENT_PAYPAL_IPN_DEBUG',
         'MODULE_PAYMENT_PAYPAL_IPN_DEBUG_EMAIL',
         'MODULE_PAYMENT_PAYPAL_DOMAIN',
         'MODULE_PAYMENT_PAYPAL_RM');
   }

   function setTransactionID() {
     global $order, $currencies;
     $my_currency = $this->currency();
     $trans_id = STORE_NAME . date('Ymdhis');
     $this->digest = md5($trans_id . number_format($order->info['total'] * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency), '.', '') . MODULE_PAYMENT_PAYPAL_IPN_DIGEST_KEY);
     return $this->digest;
   }

   function formFields($txn_sign = '', $payment_amount = '', $payment_currency = '', $payment_currency_value = '', $orders_id = '', $return_url = '', $cancel_url = '' ) {
     global $order, $currencies;

     $my_currency = (!empty($payment_currency)) ? $payment_currency : $this->currency();
     $my_currency_value = (!empty($payment_currency_value)) ? $payment_currency_value : $currencies->get_value($my_currency);

     //Merchant Info
     $paypal_fields = tep_draw_hidden_field('business', MODULE_PAYMENT_PAYPAL_BUSINESS_ID);

     //Currency
     $paypal_fields .= tep_draw_hidden_field('currency_code', $my_currency);

     //Shopping Cart Info
     if(MODULE_PAYMENT_PAYPAL_METHOD == 'Itemized') {

       $paypal_fields .= tep_draw_hidden_field('upload', sizeof($order->products)) .
       tep_draw_hidden_field('redirect_cmd', '_cart') .
       tep_draw_hidden_field('handling_cart', number_format($order->info['shipping_cost'] * $my_currency_value, $currencies->get_decimal_places($my_currency)));

       //Itemized Order Details
       for ($i=0,$index=1; $i<sizeof($order->products); $i++, $index++) {
         //$index = $i+1;
         $paypal_fields .= tep_draw_hidden_field('item_name_'.$index, $order->products[$i]['name']).
         tep_draw_hidden_field('item_number_'.$index, $order->products[$i]['model']).
         tep_draw_hidden_field('quantity_'.$index, $order->products[$i]['qty']).
         tep_draw_hidden_field('amount_'.$index, number_format($order->products[$i]['final_price']* $my_currency_value,2));
         $tax = ($order->products[$i]['final_price'] * ($order->products[$i]['tax'] / 100)) * $my_currency_value;
         $paypal_fields .= tep_draw_hidden_field('tax_'.$index, number_format($tax, 2));

         //Customer Specified Product Options: PayPal Max = 2
         if ($order->products[$i]['attributes']) {
           //$n = sizeof($order->products[$i]['attributes']);
           for ($j=0; $j<2; $j++) {
             if($order->products[$i]['attributes'][$j]['option']){
               $paypal_fields .= $this->optionSetFields($j,$index,$order->products[$i]['attributes'][$j]['option'],$order->products[$i]['attributes'][$j]['value']);
             } else {
               $paypal_fields .= $this->optionSetFields($j,$index);
             }
           }
         } else {
           for ($j=0; $j<2; $j++) {
             $paypal_fields .= $this->optionSetFields($j,$index);
           }
         }
       }

     } else { //Aggregate Cart (Method 1)

       $paypal_fields .= tep_draw_hidden_field('item_name', STORE_NAME) .
       tep_draw_hidden_field('redirect_cmd', '_xclick') .
       tep_draw_hidden_field('amount', !empty($payment_amount) ? $payment_amount : $this->amount($my_currency)) .
       tep_draw_hidden_field('shipping', number_format($order->info['shipping_cost'] * $my_currency_value, $currencies->get_decimal_places($my_currency)));
       $item_number = '';
       for ($i=0; $i<sizeof($order->products); $i++) $item_number .= ' '.$order->products[$i]['name'].' ,';
       $item_number = substr_replace($item_number,'',-2);
       $paypal_fields .= tep_draw_hidden_field('item_number', $item_number);

     }

     //Synchronize invoice
     if(MODULE_PAYMENT_PAYPAL_INVOICE_REQUIRED == 'True') $paypal_fields .= tep_draw_hidden_field('invoice', !empty($orders_id) ? $orders_id : $this->orders_id);
     //Allow customer to choose their own shipping address
     if(MODULE_PAYMENT_PAYPAL_SHIPPING_ALLOWED == 'No' ) $paypal_fields .= tep_draw_hidden_field('no_shipping', '1' );

     //Customer registration fields
     $paypal_fields .= $this->customerDetailsFields($order);
     //Customer comment field
     $paypal_fields .= $this->noteOptionFields(MODULE_PAYMENT_PAYPAL_NO_NOTE , MODULE_PAYMENT_PAYPAL_CUSTOMER_COMMENTS);

     //Store Logo
     if(tep_not_null(MODULE_PAYMENT_PAYPAL_STORE_LOGO)) $paypal_fields .= tep_draw_hidden_field('image_url', tep_href_link(DIR_WS_IMAGES.MODULE_PAYMENT_PAYPAL_STORE_LOGO, '', 'SSL',false));
     //PayPal background color
     $paypal_fields .= tep_draw_hidden_field('cs',(MODULE_PAYMENT_PAYPAL_CS == 'White') ? '0' : '1');
     //PayPal page style
     if(tep_not_null(MODULE_PAYMENT_PAYPAL_PAGE_STYLE)) $paypal_fields .= tep_draw_hidden_field('page_style',MODULE_PAYMENT_PAYPAL_PAGE_STYLE);

     //PayPal Store Config
     $paypal_fields .= tep_draw_hidden_field('custom', !empty($txn_sign) ? $txn_sign : $this->digest) .
     tep_draw_hidden_field('return', !empty($return_url) ? $return_url : tep_href_link(FILENAME_CHECKOUT_SUCCESS, 'action=success&order_id=' . (int)$this->orders_id , 'SSL')) . 
     tep_draw_hidden_field('cancel_return', !empty($cancel_url) ? $cancel_url : tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')) .
     tep_draw_hidden_field('notify_url', tep_href_link(FILENAME_IPN, '', 'SSL',false)) .
     tep_draw_hidden_field('rm', MODULE_PAYMENT_PAYPAL_RM) .
     tep_draw_hidden_field('bn', 'osc-ipn-v1');

     return $paypal_fields;
   }

   function customerDetailsFields(&$order) {
     //Customer Details - for those who haven't signed up to PayPal
     $paypal_fields = tep_draw_hidden_field('cmd', '_ext-enter') . //allows the customer addr details to be passed
     tep_draw_hidden_field('email', $order->customer['email_address']) .
     tep_draw_hidden_field('first_name', $order->billing['firstname']) .
     tep_draw_hidden_field('last_name', $order->billing['lastname']) .
     tep_draw_hidden_field('address1', $order->billing['street_address']) .
     tep_draw_hidden_field('address2', $order->billing['suburb']) .
     tep_draw_hidden_field('city', $order->billing['city']) .
     tep_draw_hidden_field('state', tep_get_zone_code($order->billing['country']['id'],$order->billing['zone_id'],$order->billing['zone_id'])) .
     tep_draw_hidden_field('zip', $order->billing['postcode']) .
     //Note: Anguilla[AI], Dominican Republic[DO], The Netherlands[NL] have different codes to the iso codes in the osC db
     tep_draw_hidden_field('country', $order->billing['country']['iso_code_2']);

     //Telephone is problematic.
     /*//OMITTED SINCE NOT SPECIFICALLY BILLING ADDRESS RELATED
       $telephone = preg_replace('/\D/', '', $order->customer['telephone']);
       $paypal_fields .= tep_draw_hidden_field('night_phone_a',substr($telephone,0,3));
       $paypal_fields .= tep_draw_hidden_field('night_phone_b',substr($telephone,3,3));
       $paypal_fields .= tep_draw_hidden_field('night_phone_c',substr($telephone,6,4));
       $paypal_fields .= tep_draw_hidden_field('day_phone_a',substr($telephone,0,3));
       $paypal_fields .= tep_draw_hidden_field('day_phone_b',substr($telephone,3,3));
       $paypal_fields .= tep_draw_hidden_field('day_phone_c',substr($telephone,6,4));
     */

     //Flow Language
     $paypal_fields .= tep_draw_hidden_field('lc', $order->billing['country']['iso_code_2']);

     return $paypal_fields;
   }

   function optionSetFields($sub_index,$index,$option=' ',$value=' ') {
     return tep_draw_hidden_field('on'.$sub_index.'_'.$index,$option).
       tep_draw_hidden_field('os'.$sub_index.'_'.$index,$value);
   }

   function noteOptionFields($option='No',$msg='Add Comments About Your Order') {
     $option = ($option == 'Yes') ? '0': '1';
     $no_note = tep_draw_hidden_field('no_note',$option);
     if (!$option) return $no_note .= tep_draw_hidden_field('cn',$msg);
     else return $no_note;
   }

   function sendMoneyFields(&$order, $orders_id) {
     include_once(DIR_WS_MODULES . 'payment/paypal/database_tables.inc.php');
     $orders_session_query = tep_db_query("select firstname, lastname, payment_amount, payment_currency, payment_currency_val, txn_signature from " . TABLE_ORDERS_SESSION_INFO . " where orders_id ='" . (int)$orders_id . "'");
     $orders_session_info = tep_db_fetch_array($orders_session_query);
     $order->billing['firstname'] = $orders_session_info['firstname'];
     $order->billing['lastname'] = $orders_session_info['lastname'];
     $return_href_link = tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id='.$orders_id, 'SSL');
     $cancel_href_link = $return_href_link;
     return $this->formFields($orders_session_info['txn_signature'], $orders_session_info['payment_amount'] - $order->info['shipping_cost'], $orders_session_info['payment_currency'], $orders_session_info['payment_currency_val'], $orders_id, $return_href_link, $cancel_href_link);
   }
 }//end class
?>

 

catalog/includes/modules/payment/paypal/classes/osC /Order.class.php

 

<?php

/*

  $Id: Order.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 © 2003 osCommerce

  Copyright © 2004 DevosC.com

 

  Released under the GNU General Public License

*/

 

class PayPal_osC_Order {

 

  function PayPal_osC_Order() {

  }

 

  function setCommonVars($osC) {

    $this->setContentType($osC['content_type']);

    $this->setPaymentTitle($osC['payment_title']);

    $this->setLanguage($osC['language']);

    $this->setLanguageID($osC['language_id']);

    $this->setBillTo($osC['billto']);

    $this->setSendTo($osC['sendto']);

    $this->currency = $osC['currency'];

    $this->currency_value = $osC['currency_value'];

    $this->affiliate_id = $osC['affiliate_id'];

    $this->affiliate_clickthroughs_id = $osC['affiliate_clickthroughs_id'];

    $this->affiliate_date = $osC['affiliate_date'];

    $this->affiliate_browser = $osC['affiliate_browser'];

    $this->affiliate_ipaddress = $osC['affiliate_ipaddress'];

  }

 

  function loadTransactionSessionInfo($txn_sign) {

    $txn_signature = tep_db_prepare_input($txn_sign);

    $orders_session_query = tep_db_query("select orders_id, content_type, payment_title, language, language_id, billto, sendto, currency, currency_value, payment_amount, payment_currency, affiliate_id, affiliate_clickthroughs_id, affiliate_date, affiliate_browser, affiliate_ipaddress from " . TABLE_ORDERS_SESSION_INFO . " where txn_signature ='" . tep_db_input($txn_signature) . "' limit 1");

    if(tep_db_num_rows($orders_session_query)) {

      $orders_session = tep_db_fetch_array($orders_session_query);

      $this->setCommonVars($orders_session);

      $this->setOrderID($orders_session['orders_id']);

      $this->payment_amount = $orders_session['payment_amount'];

      $this->payment_currency = $orders_session['payment_currency'];

    }

  }

 

  function loadOrdersSessionInfo() {

    $orders_session_query = tep_db_query("select content_type, payment_title, language, language_id, billto, sendto, currency, currency_value, affiliate_id, affiliate_clickthroughs_id, affiliate_date, affiliate_browser, affiliate_ipaddress from " . TABLE_ORDERS_SESSION_INFO . " where orders_id ='" . (int)$this->orderID . "' limit 1");

    if(tep_db_num_rows($orders_session_query)) {

      $orders_session = tep_db_fetch_array($orders_session_query);

      $this->setCommonVars($orders_session);

    }

  }

 

  function removeOrdersSession() {

    tep_db_query("delete from " . TABLE_ORDERS_SESSION_INFO . " where orders_id = '" . (int)$this->orderID . "'");

  }

 

  function updateOrderStatus($order_status = MODULE_PAYMENT_PAYPAL_ORDER_STATUS_ID) {

    // update the order's status

    tep_db_query("update " . TABLE_ORDERS . " set orders_status = '" . tep_db_input($order_status) . "', last_modified = now() where orders_id = '" . (int)$this->orderID . "'");

  }

 

  function updateProducts(&$order) {

    // initialized for the email confirmation

    $this->products_ordered = '';

    $subtotal = 0;

    $total_tax = 0;

    for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {

    // Stock Update - Joao Correia

      if (STOCK_LIMITED == 'true') {

        if (DOWNLOAD_ENABLED == 'true') {

          $stock_query_raw = "SELECT products_quantity, pad.products_attributes_filename

                              FROM " . TABLE_PRODUCTS . " p

                              LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES . " pa

                              ON p.products_id=pa.products_id

                              LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad

                              ON pa.products_attributes_id=pad.products_attributes_id

                              WHERE p.products_id = '" . tep_get_prid($order->products[$i]['id']) . "'";

          // Will work with only one option for downloadable products

          // otherwise, we have to build the query dynamically with a loop

          $products_attributes = $order->products[$i]['attributes'];

          if (is_array($products_attributes)) {

            $stock_query_raw .= " AND pa.options_id = '" . $products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . $products_attributes[0]['value_id'] . "'";

          }

          $stock_query = tep_db_query($stock_query_raw);

        } else {

          $stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");

        }

        if (tep_db_num_rows($stock_query) > 0) {

          $stock_values = tep_db_fetch_array($stock_query);

          // do not decrement quantities if products_attributes_filename exists

          if ((DOWNLOAD_ENABLED != 'true') || (!$stock_values['products_attributes_filename'])) {

            $stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty'];

      // Version: 02-20-04 (BOF) 02/20/2004 - Low Stock Level Email Author: Emmett (yesUdo.com) and Jai (kynet.co.uk)

 

$warning_stock = STOCK_REORDER_LEVEL;

$current_stock = $stock_left;

 

// Jai @ kynet.co.uk made the following change on 20-02-04

// Dynamic store url - Replaced [' http://www.YOURDOMAIN.com/] with [. HTTP_SERVER . DIR_WS_CATALOG . ']

 

$low_stock_email = '<b>Low stock warning:</b> ' . $order->products[$i]['name'] . "\n" . '<b>Model No.:</b> ' . $order->products[$i]['model'] . "\n" . '<b>Quantity:</b> ' . $stock_left  . "\n" . '<b>Product URL:</b>' . HTTP_SERVER . DIR_WS_CATALOG . 'product_info.php?products_id='. $order->products[$i]['id'] . "\n\n" . '<b>Current Low order limit is ' . $warning_stock . ' units</b>';

$low_stock_subject = 'Low Stock Warning: ' .  $order->products[$i]['name'];

 

if ($current_stock < $warning_stock) {

  tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $low_stock_subject, $low_stock_email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

}

// (EOF) 02/20/2004 - Low Stock Level Email Author: Emmett (yesUdo.com) and Jai (kynet.co.uk)

          } else {

            $stock_left = $stock_values['products_quantity'];

          }

          tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . $stock_left . "' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");

          if ( ($stock_left < 1) && (STOCK_ALLOW_CHECKOUT == 'false') ) {

            tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");

          }

        }

      }

 

      // Update products_ordered (for bestsellers list)

      tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");

 

      //------insert customer choosen option to order--------

      $attributes_exist = '0';

      $products_ordered_attributes = '';

      if (isset($order->products[$i]['attributes'])) {

        $attributes_exist = '1';

        for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {

          if (DOWNLOAD_ENABLED == 'true') {

            $attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename

                                from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa

                                left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad

                                  on pa.products_attributes_id=pad.products_attributes_id

                                where pa.products_id = '" . $order->products[$i]['id'] . "'

                                  and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "'

                                  and pa.options_id = popt.products_options_id

                                  and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "'

                                  and pa.options_values_id = poval.products_options_values_id

                                  and popt.language_id = '" . $this->languageID . "'

                                  and poval.language_id = '" . $this->languageID . "'";

            $attributes = tep_db_query($attributes_query);

          } else {

            $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $this->languageID . "' and poval.language_id = '" . $this->languageID . "'");

          }

          $attributes_values = tep_db_fetch_array($attributes);

          if ((DOWNLOAD_ENABLED == 'true') && isset($attributes_values['products_attributes_filename']) && tep_not_null($attributes_values['products_attributes_filename']) ) {

            $sql_data_array = array('orders_id' => $this->orderID,

                                    'orders_products_id' => $order->products[$i]['orders_products_id'],

                                    'orders_products_filename' => $attributes_values['products_attributes_filename'],

                                    'download_maxdays' => $attributes_values['products_attributes_maxdays'],

                                    'download_count' => $attributes_values['products_attributes_maxcount']);

            tep_db_perform(TABLE_ORDERS_PRODUCTS_DOWNLOAD, $sql_data_array);

          }

          $products_ordered_attributes .= "\n\t" . $attributes_values['products_options_name'] . ' ' . $attributes_values['products_options_values_name'];

        }

      }

      //------insert customer choosen option eof ----

      $total_weight += ($order->products[$i]['qty'] * $order->products[$i]['weight']);

      $total_tax += tep_calculate_tax($total_products_price, $products_tax) * $order->products[$i]['qty'];

      $total_cost += $total_products_price;

 

      //$currency_price = $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']);

      $products_ordered_price = $this->displayPrice($order->products[$i]['final_price'],$order->products[$i]['tax'],$order->products[$i]['qty']);

// ################# START MODIFICATIONS HTML EMAIL #################

      $products_ordered_price2 = $this->displayPrice($order->products[$i]['final_price'] * $order->products[$i]['qty']);

// ################# END MODIFICATIONS SEND HTML EMAIL #################

 

      $this->products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $products_ordered_price . $products_ordered_attributes . "\n";

// ################# START MODIFICATIONS HTML EMAIL #################

      $this->products_ordered2 .= $order->products[$i]['qty'] . "\n";

      $this->products_ordered3 .= $order->products[$i]['name'] . "\n";

      $this->products_ordered4 .= $order->products[$i]['model'] . "\n";

      $this->products_ordered5 .= $products_ordered_price2 . "\n";

// ################# END MODIFICATIONS SEND HTML EMAIL #################

    }

  }

 

  function displayPrice($amount, $tax, $qty = 1) {

    global $currencies;

 

    if ( (DISPLAY_PRICE_WITH_TAX == 'true') && ($tax > 0) ) {

      return $currencies->format(tep_add_tax($amount, $tax) * $qty, true, $this->currency, $this->currency_value);

    }

 

 

IEUFLR2000

Link to comment
Share on other sites

  • Replies 2.1k
  • Created
  • Last Reply

Top Posters In This Topic

Rik, well I haven't played much with PayPal recently, but the contribution developed by the team and this contribution, is like chalk and cheese, for example they create an order even if the customer hasn't confirmed that they wanted to actually make the order !!! this also makes downloads immediately available via the customers account history page, and why should customer order notifications only be sent *only if* the customer actually returns to the site !!!!

I actually suspect your problems may of been specific to your site because you said when you clicked the continue button you would not be returned to site, unfortunately you didn't mention where it returned you too... Admittedly PayPal sometimes have their differences, for example they say their sandbox is a copy of their real site, yet I've been previously informed (by PayPal) that some API parameters are avialable on one but not the other....

 

ieuflr2000, the ccgv contrib may of had recent changes / updates that I'm not aware of, and I was never that familiar with the inner workings of it... however in 3.0 in paypal/catalog/checkout_process.php there is a line near the bottom saying somthing like '$order_total_modules->apply_credit()'.... I not sure what '->update_credit()' is supposed to do...

In regard to you other changes... as long as it works that should suffice - I didn't go through it thoroughly but couldn't see anything drastically wrong etc..

"Any fool can know. The point is to understand." -- Albert Einstein

Link to comment
Share on other sites

There were many people complaining of the same problems I was having. Many of them were not using osCommerce, much less the same module I was using.

 

With no chnages on my end, it is now working.

 

All of this began when PayPal says they had made database changes on their end.

 

The evidence seems to point to PayPal being the source of the problem.

 

I mentioned my problem here for exactly the reason of attempting to dteremine if users of other IPN modules experienced the same problems. I also felt an obligation to return and mention when it began to work.

 

I have no idea if one IPN module is superior to another. I just happened to install the other one. It does seem to overcome problems one would have using th original PayPal module, primarily the recording of a possible sale as the customer is transfered to PayPal. At least if the IPN does not come, you have a record you can follow up on.

 

I would be interested if someone could provide a comparison of the two popular IPN modules here. The differences are not clear to me.

Edited by RikR

Rik Rasmussen

Link to comment
Share on other sites

Hello all.

 

I noticed that in my store, when a customer makes an eCheck payment through PayPal with the PayPal IPN contribution installed, that my stock levels are not reduced. The stock levels will only be reduced once the eCheck clears.

 

Problem is, that between the time that someone checks out and pays with an eCheck, other people can still go in and order that item even if we only had like 1 left in stock. This can be a huge problem if we can not get more stock of that particular item.

 

Anyone know if it is possible to subtract the stock right away from the OSC site when the customer pays with an eCheck and not subtract again once that eCheck clears?

 

Any help is greatly appreciated. Thanks!

Link to comment
Share on other sites

Hi,

 

I get a couple of parse errors when I install this hack, the first is when I try to go into the admin section of the shop

 

Parse error: parse error, unexpected $ in /homepages/26/d90465391/htdocs/sovam/catalog/admin/includes/boxes/customers.php on line 36

 

And the second is when I go to checkout after test purchasing something.

 

Parse error: parse error, unexpected T_DOUBLE_ARROW in /homepages/26/d90465391/htdocs/sovam/catalog/includes/classes/order.php on line 130

 

Hope someone can come with a suggestion to fix this problem,

 

Thanks,

 

Craig

Link to comment
Share on other sites

Hi,

 

I'm trying (rather desperately) to get the IPN module to work with eBay IPN's.  A simple statement could work:

 

if ($_POST['for_auction'] == 'true') {
?// ?code to insert into a separate ebay IPN table, or better yet,
?// ?run a separate IPN script just for eBay orders altogether...
}

 

but I have no idea where to insert the conditional (or if that would even be the correct conditional to use).  Anybody else know of any solutions to this problem?  I'm sure there are others selling with OSC and eBay who would appreciate the advice too.

 

Thanks in advance for any help!

 

Hi

did you ever find out what the url for IPN was? This forum is like looking though the library of congress for information, it's all there but hard to sift thru. I've read checkout_success.php , ipn_notify.php and ipn_process.php - do you know which is correct? thanks much!

Link to comment
Share on other sites

Hi,

My site is running osCommerce+paypal ipn for the past year or so and now for no reason we are experiencing this problem where the payment is completed but the status return back to my site always PENDING ? I tried to shift through this thread but too much to shift.... :(

Link to comment
Share on other sites

Gregory,

I've upgraded the IPN from 2.4 to 3.0. This is an outstanding addition to osCommerce.

 

When testing IPN from osC store should it minus from inventory stock and the order change from "Pending" to "Processing"? If so, it didn't do it for me.

 

However, I got my brother to purchase a couple products from me in real mode and there were no problems. Everything worked like it is supposed to, even minusing inventory stock. Then I was really surprised that after I canceled my brother's order I received a PayPal IPN with the PayPal refund/canceled order details. I'm thrilled.

 

One more question. Do I remove the paypal_payment_status table? I could not find any information in the sql script or change logs. There is no installation for it in the sql script so I thought I would check.

 

Alan :)

Production:
osCommerce V. 2.3.4BS
VPS Box

Link to comment
Share on other sites

Hello all.

 

I noticed that in my store, when a customer makes an eCheck payment through PayPal with the PayPal IPN contribution installed, that my stock levels are not reduced. The stock levels will only be reduced once the eCheck clears.

 

Problem is, that between the time that someone checks out and pays with an eCheck, other people can still go in and order that item even if we only had like 1 left in stock. This can be a huge problem if we can not get more stock of that particular item.

 

Anyone know if it is possible to subtract the stock right away from the OSC site when the customer pays with an eCheck and not subtract again once that eCheck clears?

 

Any help is greatly appreciated. Thanks!

 

Hypnotizer,

 

Did you figure it out?

 

What would happen if you edit item by keeping it active "Green" and using the Date Available calendar, make it available sometime after the E-check is scheduled to clear? Anybody know?

 

Alan :)

Production:
osCommerce V. 2.3.4BS
VPS Box

Link to comment
Share on other sites

There were many people complaining of the same problems I was having. Many of them were not using osCommerce, much less the same module I was using.

 

With no chnages on my end, it is now working.

 

All of this began when PayPal says they had made database changes on their end.

 

The evidence seems to point to PayPal being the source of the problem.

 

I mentioned my problem here for exactly the reason of attempting to dteremine if users of other IPN modules experienced the same problems. I also felt an obligation to return and mention when it began to work.

 

I have no idea if one IPN module is superior to another. I just happened to install the other one. It does seem to overcome problems one would have using th original PayPal module, primarily the recording of a possible sale as the customer is transfered to PayPal. At least if the IPN does not come, you have a record you can follow up on.

 

I would be interested if someone could provide a comparison of the two popular IPN modules here. The differences are not clear to me.

 

Rik,

 

Are you able to run transactions as of today? I have devosc's PayPal module installed and it's acting very strangely: I am able to successfully purchase a product via PayPal, but no transaction details are being passed to admin/orders.php. Plus, I do not receive an email notification of the order. I haven't changed anything and this module (or PayPal's sandbox) hasn't been working correctly for almost 3 weeks now. I have PWA installed and - even worse - there are terrible consequences when I attempt to checkout w/o an account and am presented with a "cart empty" or error message at the PayPal screen (this happens intermittently). When I click on the link to return me to my site, I am directed to the payment page again, but the order has been logged as though it went through AND an account has been created for me!!!

 

Is anybody experiencing anything close to this??

cxdi_logo_100x45.gif
Link to comment
Share on other sites

WOW!!! This is even weirder - I am receiving about 20 debug emails per attempted PayPal order. All of them say that the transaction was verified, accepted and processed successfully, yet my problems listed above still persist.

 

My client is going to love it when I tell him he can't offer PayPal as a payment when his site goes live in 2 days. Unbelievable. Is anybody out there using the devosc contrib. NOT experiencing errors and receiving transaction successfully???

cxdi_logo_100x45.gif
Link to comment
Share on other sites

WOW!!!  This is even weirder - I am receiving about 20 debug emails per attempted PayPal order. All of them say that the transaction was verified, accepted and processed successfully, yet my problems listed above still persist.

 

My client is going to love it when I tell him he can't offer PayPal as a payment when his site goes live in 2 days. Unbelievable. Is anybody out there using the devosc contrib. NOT experiencing errors and receiving transaction successfully???

 

Yes... and PayPal seems to finally have gotten the IPN situation fixed on their end. (At least for me)

Link to comment
Share on other sites

I just did a test buy to the Paypal sandbox from my osC store and everything worked perfectly, except the Instant Payment Notification (IPN) had not been received several minutes later. (I am using the other contribution)

 

I have read complaints at PayPal's Forums on the slow IPNs in recent days.

Edited by RikR

Rik Rasmussen

Link to comment
Share on other sites

I just did a test buy to the Paypal sandbox from my osC store and everything worked perfectly, except the Instant Payment Notification (IPN) had not been received several minutes later. (I am using the other contribution)

 

I have read complaints at PayPal's Forums on the slow IPNs in recent days.

 

Rik,

 

Did you receive the usual email confirmation for the order? Also, if you have the 'email debugging' option enabled, did you receive an endless amount of IPN debug messages as I did? Which module do you have installed now - the devosc one, or the official osC one? Thanks.

cxdi_logo_100x45.gif
Link to comment
Share on other sites

I received the PayPal emails, the "customer" also received the PayPal emails. We both received osC emails also.

 

I just checked again and the IPNs arrived for two test orders I placed.

 

I received no debug emails.

 

I am using the official osC PayPal IPN module.

Rik Rasmussen

Link to comment
Share on other sites

Thanks Rik. After hearing that things are working for you using the osC-contributed PayPal module, I think I'm going to switch over to that and see what happens. Hopefully devosc will try to address any issues that may exist with their module b/c it's a great contrib. It probably has nothing to do on their part; I wouldn't be surprised if it's a PayPal sandbox issue. Thanks again!

cxdi_logo_100x45.gif
Link to comment
Share on other sites

Have a look in catalog/includes/modules/payment/paypal/classes/osC/Order.class.php

 

If you're just adding static text then it should be straight forward. However if what you want to do depends on particular session vars, you would need to update the order_session_info table to hold this info, change the paypal/catalog/checkout_process to now store these session vars, and then in the above Order.class.php update and retrieve this vars via the loadTransactionSessionInfo function.

 

This is because the email is sent at a later moment in time with no customer browser interaction, so any session info must be made available for this non-GUI process. If you follow whats there already it should be easy enough to extend to suit additional needs etc...

"Any fool can know. The point is to understand." -- Albert Einstein

Link to comment
Share on other sites

Have a look in catalog/includes/modules/payment/paypal/classes/osC/Order.class.php

 

If you're just adding static text then it should be straight forward. However if what you want to do depends on particular session vars, you would need to update the order_session_info table to hold this info, change the paypal/catalog/checkout_process to now store these session vars, and then in the above Order.class.php update and retrieve this vars via the loadTransactionSessionInfo function.

 

This is because the email is sent at a later moment in time with no customer browser interaction, so any session info must be made available for this non-GUI process. If you follow whats there already it should be easy enough to extend to suit additional needs etc...

 

Hi

 

Static text is what I need. Thanks.

Link to comment
Share on other sites

Hi everybody, i just installed the latest module (i think it is anyway - osCommerce-PayPal_IPN-v1.1)

 

and everything works fine, EXCEPT i get no IPN emails. I get the return, etc. Customer gets email as well.

 

I have followed all the instructions to a tee, i understand i don't have to turn on IPN from paypal itself right? I also have secure transactions turned of in the module.

 

I also read that nobody was getting IPNs until recently, but now they have "come back" correct?

 

Thanks for any input guys!!!!!!

Link to comment
Share on other sites

jeez... i just found out i installed version one!!! when u search paypal IPN it says OsCommerce, you just don't know which one to install!!!!!! Wow this open source stuff.... :'(

Link to comment
Share on other sites

Hi Scott,

Unless your able to handle migrating your existing paypal database tables I would suggest a fresh installation.

I just uploaded PayPal_Shopping_Cart_IPN_v3.0.tar.gz which is below the 300KB file size limit.

 

Hi, need some help, I just downloaded and installed PayPal_Shopping_Cart_IPN_v3.0.tar.gz. I am getting this error "Fatal error: Cannot redeclare class paypal in /home/domainuser/public_html/includes/modules/payment/paypal.php on line 20 " when I go to the osCommerce->Admin->Modules->Payment to remove and reinstall the PayPal payment module. This is the last step in your guide. I have followed all the instructions that are in there. Iam new to PHP, maybe you can point where else to look, i have reviewed the steps that i did and I have checked my codes. Any assistance is greatly appreciated. Thank you very much

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...