Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution]Paypal IPN - Devosc


devosc

Recommended Posts

Hiya,

I can't be of much use at the moment since I currently haven't had much to do with CCGV, but from the above and before, I don't think CCGV will work with an 'Itemized' cart since PayPal calculates the totals based upon the individual product prices and their associated taxes. That's why the comment was provided above and the amount field commented out.

How about when trying the 'Aggregate' method?

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

Link to comment
Share on other sites

  • Replies 2.1k
  • Created
  • Last Reply

Top Posters In This Topic

Good lawd Greg, you are a smart one! That fixed almost all of the problems. The tax gets passed, the gv gets passed and the shipping is the right charge! Now the only issue that's left is the subtotal not actually subtotaling...any ideas on that?

Link to comment
Share on other sites

Can someone look at this and tell me what needs to be modified so that the itemized option will subtract the CC and GV and do the tax based on that total?

 

<?php
/*
 $Id: paypal.php,v 2.3 2004/04/28 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
*/

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

// class constructor
   function paypal() {
     global $order;

     $this->code = '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_action_url = tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL');
     //$this->form_action_url = 'https://www.paypal.com/cgi-bin/webscr';
   }

// 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() {
     return array('id' => $this->code,
                  'module' => $this->title);
   }

   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;
   }

   function process_button() {
     return false;
   }

   function before_process() {
     global $paypal_order_id, $cart;
     //function paypal_check_order_status is located in modules/payment/paypal/functions.php
     //which was included in includes/application_top.php
     if (paypal_check_order_status()) {
       tep_redirect(tep_href_link(FILENAME_SHOPPING_CART, '', 'SSL'));
     } else {
       include DIR_WS_MODULES . 'payment/paypal/checkout_process.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', '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 ('Business ID', 'MODULE_PAYMENT_PAYPAL_BUSINESS_ID','".STORE_OWNER_EMAIL_ADDRESS."', 'Email address or account ID of the payment recipient', '6', '3', 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', '4', '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, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_PAYPAL_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '5', 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', '6', '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', '6', '7', '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', '6', '8', '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 ('Background Color', 'MODULE_PAYMENT_PAYPAL_CS', 'White', 'Select the background color of PayPal\'s payment pages.', '6', '9', '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 ('Store logo', 'MODULE_PAYMENT_PAYPAL_STORE_LOGO', 'oscommerce.gif', 'The image file name for PayPal to display (leave empty if your store does not have SSL)', '6', '10', 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', '', 'The name of the page style you have configured in your PayPal Account', '6', '11', 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', '12', '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 ('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', '13', 'tep_cfg_select_option(array(\'0\',\'1\',\'2\'), ', 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', '14', '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', '15', '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 ('Email Notifications', 'MODULE_PAYMENT_PAYPAL_IPN_DEBUG', '2', 'The email notification level<br>(1 is recommended)', '6', '16', 'tep_cfg_select_option(array(\'0\',\'1\',\'2\'), ', 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_DEBUG_TEST', 'Off', 'Set test mode (<a href=\"" . tep_href_link(FILENAME_PAYPAL, tep_get_all_get_params(array('set','module','action')).'action=test') . "\" target=\"ipn\"><u>Launch Test Page</u></a>)', '6', '17', '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', '18', '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 ('Notification Address', 'MODULE_PAYMENT_PAYPAL_IPN_DEBUG_EMAIL','".STORE_OWNER_EMAIL_ADDRESS."', 'The e-mail address to send (level 1) notifications to', '6', '19', 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', '20', 'tep_cfg_select_option(array(\'True\', \'False\'), ', 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_INVOICE_REQUIRED', 'MODULE_PAYMENT_PAYPAL_SORT_ORDER', 'MODULE_PAYMENT_PAYPAL_CS', '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_DEBUG','MODULE_PAYMENT_PAYPAL_IPN_DEBUG_TEST', 'MODULE_PAYMENT_PAYPAL_IPN_CART_TEST', 'MODULE_PAYMENT_PAYPAL_IPN_DEBUG_EMAIL','MODULE_PAYMENT_PAYPAL_RM');
   }

   function _getPayPalFields() {
     global $paypal_order_id, $order, $currencies;
     $my_currency = $this->currency();
     $paypal_fields = tep_draw_hidden_field('cmd', '_ext-enter') . //allows the customer addr details to be passed
     tep_draw_hidden_field('business', MODULE_PAYMENT_PAYPAL_BUSINESS_ID);
     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'));
     $paypal_fields .= tep_draw_hidden_field('return', tep_href_link(FILENAME_CHECKOUT_SUCCESS, 'action=success', 'SSL'));
     $paypal_fields .= tep_draw_hidden_field('cancel_return', tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')) .
     tep_draw_hidden_field('notify_url', tep_href_link('ipn.php', '', 'SSL',false));
     $paypal_fields .= tep_draw_hidden_field('bn', 'osc-ipn-v1');
     if(MODULE_PAYMENT_PAYPAL_SHIPPING_ALLOWED == 'No' ) $paypal_fields .= tep_draw_hidden_field('no_shipping', '1' );

     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'] * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency)));
       //Let PayPal Calculate the amount since we're essentiall uploading a shopping cart
       //tep_draw_hidden_field('amount', number_format(($order->info['total'] - $order->info['shipping_cost']) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency)));

     } else {

       $paypal_fields .= tep_draw_hidden_field('item_name', STORE_NAME) .
       tep_draw_hidden_field('redirect_cmd', '_xclick') .
       tep_draw_hidden_field('amount', number_format(($order->info['total'] - $order->info['shipping_cost']) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency))) .
       tep_draw_hidden_field('shipping', number_format($order->info['shipping_cost'] * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency)));
     }

     //See Manual: 0= No IPN, 1 = GET, 2 = POST
     $paypal_fields .= tep_draw_hidden_field('rm', MODULE_PAYMENT_PAYPAL_RM) .
     tep_draw_hidden_field('custom', $paypal_order_id) .
     tep_draw_hidden_field('currency_code', $my_currency);
     if(MODULE_PAYMENT_PAYPAL_INVOICE_REQUIRED == 'True') $paypal_fields .= tep_draw_hidden_field('invoice', $paypal_order_id );

     $paypal_fields .= $this->_drawCustomerDetails($order) .

     //Customer comment field
     $this->_drawNoteOption(MODULE_PAYMENT_PAYPAL_NO_NOTE , MODULE_PAYMENT_PAYPAL_CUSTOMER_COMMENTS) .

     //PayPal Background Color
     tep_draw_hidden_field('cs',(MODULE_PAYMENT_PAYPAL_CS == 'White') ? '0' : '1');
     if(tep_not_null(MODULE_PAYMENT_PAYPAL_PAGE_STYLE)) $paypal_fields .= tep_draw_hidden_field('page_style',MODULE_PAYMENT_PAYPAL_PAGE_STYLE);

     if(MODULE_PAYMENT_PAYPAL_METHOD == 'Itemized') {
       //Itemized Order Details
       for ($i=0; $i<sizeof($order->products); $i++) {
         $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']* $currencies->get_value($my_currency),2));

         $tax = ($order->products[$i]['final_price'] * ($order->products[$i]['tax'] / 100)) * $currencies->get_value($my_currency);
         $paypal_fields .= tep_draw_hidden_field('tax_'.$index, number_format($tax, 2));

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

   function _drawCustomerDetails(&$order) {
     //Customer Details - for those who haven't signed up to PayPal
     $paypal_fields = tep_draw_hidden_field('email', $order->customer['email_address']) .
     tep_draw_hidden_field('first_name', $order->customer['firstname']) .
     tep_draw_hidden_field('last_name', $order->customer['lastname']) .
     tep_draw_hidden_field('address1', $order->customer['street_address']) .
     tep_draw_hidden_field('address2', $order->customer['suburb']) .
     tep_draw_hidden_field('city', $order->customer['city']) .
     tep_draw_hidden_field('state', tep_get_zone_code($order->customer['country']['id'],$order->customer['zone_id'],$order->customer['zone_id'])) .
     tep_draw_hidden_field('zip', $order->customer['postcode']);
     //User Country Preference
     //Note: Anguilla[AI], Dominican Republic[DO], The Netherlands[NL] have different codes to the iso codes in the osC db
     $paypal_fields .= tep_draw_hidden_field('lc', $order->customer['country']['iso_code_2']);
     //Telephone is problematic.
     $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));
     return $paypal_fields;
   }

   function _drawPayPalOptionSet($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 _drawNoteOption($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;
   }
 }//end class

 class paypal_ipn {
   var $info, $txn, $customer;

   function paypal_ipn($paypal_ipn_id) {
     $this->info = array();
     $this->txn = array();
     $this->customer = array();
     $this->query($paypal_ipn_id);
   }

   function query($paypal_ipn_id) {
     $ipn_query = tep_db_query("select * from " . TABLE_PAYPAL . " where paypal_ipn_id = '" . (int)$paypal_ipn_id . "'");
     $ipn = tep_db_fetch_array($ipn_query);
     $this->info = array(
       'txn_type'            => $ipn['txn_type'],
       'reason_code'         => $ipn['reason_code'],
       'payment_type'        => $ipn['payment_type'],
       'payment_status'      => $ipn['payment_status'],
       'pending_reason'      => $ipn['pending_reason'],
       'invoice'             => $ipn['invoice'],
       'mc_currency'         => $ipn['mc_currency'],
       'payment_date'        => $ipn['payment_date'],
       'business'            => $ipn['business'],
       'receiver_email'      => $ipn['receiver_email'],
       'receiver_id'         => $ipn['receiver_id'],
       'paypal_address_id'   => $ipn['papal_address_id'],
       'txn_id'              => $ipn['txn_id'],
       'parent_txn_id'       => $ipn['parent_txn_id'],
       'notify_version'      => $ipn['notify_version'],
       'verify_sign'         => $ipn['verify_sign'],
       'last_modified'       => $ipn['last_modified'],
       'date_added'          => $ipn['date_added']);

     $this->txn = array(
       'num_cart_items'      => $ipn['num_cart_items'],
       'mc_gross'            => $ipn['mc_gross'],
       'mc_fee'              => $ipn['mc_fee'],
       'payment_gross'       => $ipn['payment_gross'],
       'payment_fee'         => $ipn['payment_fee'],
       'settle_amount'       => $ipn['settle_amount'],
       'settle_currency'     => $ipn['settle_currency'],
       'exchange_rate'       => $ipn['exchange_rate']);

     $this->customer = array(
       'first_name'          => $ipn['first_name'],
       'last_name'           => $ipn['last_name'],
       'payer_business_name' => $ipn['payer_business_name'],
       'address_name'        => $ipn['address_name'],
       'address_street'      => $ipn['address_street'],
       'address_city'        => $ipn['address_city'],
       'address_state'       => $ipn['address_state'],
       'address_zip'         => $ipn['address_zip'],
       'address_country'     => $ipn['address_country'],
       'address_status'      => $ipn['address_status'],
       'address_owner'       => $ipn['address_owner'],
       'payer_email'         => $ipn['payer_email'],
       'ebay_address_id'     => $ipn['ebay_address_id'],
       'payer_id'            => $ipn['payer_id'],
       'payer_status'        => $ipn['payer_status'],
       'memo'                => $ipn['memo']);
   }
 }//end class
?>

osC Contributions I have published.

 

Note: Some I only provided minor changes, updates or additions!

Link to comment
Share on other sites

:rolleyes: Could someone give ma a little help?

 

How do you delete the IPN's in the IPN list? Did I enter code incorrectly?

 

I might have, because when I click on an IPN, it shows the details - but I get strange looking code and graphics on the top of the page.

 

what file should I check?

 

Thanks!

 

Phil

 

please check www.dvbwest.com and give me some input for what you think might be a nice addition...

 

Thank you

Link to comment
Share on other sites

Chris & others with subtotal problems - So from what I read so far, setting it to aggregate and not itemized fixed the subtotal issues with CCGV?

 

Chris - I wish I could take a look at the file right now, but won't be able to get to it for a couple of days, headin cross country in about 2 hours for a couple of weeks. When I get there though, I'll try to take a look when I get time...

9 times out of 10 its a PEBCAK Error (Problem exists between chair and keyboard)

 

Replace that and you're fine...

Link to comment
Share on other sites

Wow, I just came across this contribution and thus, this support thread, and there is a lot to read! After a half hour of reading and causing a headache, I haven't found my problem or an answer to my problem. So, please bear with me if this has been gone over before:

 

 

The install seems to have gone smoothly. I have run a couple tests while in Test mode and they all ran perfectly - the IPN was accepted in OsC, the order status changed, email was sent, etc.

 

However, the problem I have is when a live order is placed (not in test mode). The order goes through just fine, but the IPN is not picked up by OsC. Also, there are no email messages sent out - not to the customer and not to the store owner. If I manually change the order status, email is sent out to the customer, but there is no initial email.

 

Why do the tests run okay, but live orders fail?

 

Any help would be appreciated.

 

Just let me know what you need to know about my site/install/etc.

 

The site URL is www.acehighsupply.com

Link to comment
Share on other sites

Oops . . . please ignore my request

 

I have six or seven email address for PayPal. What I thought was the primary address actually wasn't. Once changed, everything works. Sorry.

Link to comment
Share on other sites

Hello, Greg, and everyone! I recently just run into os admin problem.....here is....I ordered an item myself, after I add it on the shopping cart, and checkout to paypal....and yes successfully paid at paypal (I checked my personal paypal paid to my business paypal account....)....however, after all these, i can't go to the last page which is the checkout success page (it sould be redirected back to the last page of my site right?), instead of going to my site login page.....and also I can't see any customer orders at my os admin...please someone if could help me. :unsure:

 

 

Really a big thanks! :)

OS-commerce is great, but with other magical contributions, that is just so "COOL"!

Link to comment
Share on other sites

Hi guys, havent looked in since v2 and need some help before updating.

 

Greg, or any1 else who can help,

 

I have read the FAQ in v2.2 but want to clarify before screwing with my setup.

 

As i understand it:

 

1 - Run the new sql file (i dont have any orders, as the store i am working on is not live)

2 - delete some newly moved files (not sure which) and place new ones in includes/modules/payment/paypal

3 - Make the edits in the admin section.

 

Am I right that only the admin files need to be re-edited and no other files need to be replaced??

 

Thanks for the help in advance!!

 

PoZel

Link to comment
Share on other sites

I'm hoping someone can point me in the right direction. Whenever I make a purchase using Paypal with the CCGV mod installed (5.10b), the Paypal mod inserts two rows into the order_totals table.

 

Sub-Total: $25.00

Sub-Total: $25.00

PA State Sales Tax: $1.50

PA State Sales Tax: $1.50

Flat Rate (Best Way): $3.00

Flat Rate (Best Way): $3.00

Total: $29.50

Total: $29.50

 

The above result is the order detail from the admin. The interesting thing is that Paypal shows the correct amount.

 

Currency: U.S. Dollars

Amount: $26.50 USD

Shipping & Handling: $3.00 USD

 

However, when I use a discount coupon things start to get really crazy.

 

Sub-Total: $25.00

Sub-Total: $25.00

Discount Coupons:summer: -$5.00

Discount Coupons:summer: -$5.00

PA State Sales Tax: $1.50

PA State Sales Tax: $1.50

Flat Rate (Best Way): $3.00

Flat Rate (Best Way): $3.00

Total: $19.50

Total: $24.50

 

And this is what Paypal shows at the payment details screen.

 

Currency: U.S. Dollars

Amount: $16.50 USD

Shipping & Handling: $3.00 USD

 

I've been scratching my head for days, but I can't make heads nor tails of what might be the problem. To me it almost seems as though its running the order_total twice. I have applied the above mentioned code, but it doesn't seem to have fixed my problem. Any ideas?

 

clarocque - I don't know if you have fixed the line 29 problem yet, but make sure you have your globals setup. It wasn't setup in the latest download. paypal/checkout_process.php globals should look like this...

 

global $payment_modules, $shipping_modules, $order, $currencies, $cart, $customer_id, $sendto, $billto, $shipping, $payment, $language, $currency, $languages_id, $order_total_modules;

Edited by BearHappy
Link to comment
Share on other sites

Thanks... but to be honest I am kinda stuck - I have retunred all to where it was (which was causing the line 29 issue)...

 

I am hoping someone will modify 2.3 or tell me what to do to make it pass the cc/GV to paypal.....

osC Contributions I have published.

 

Note: Some I only provided minor changes, updates or additions!

Link to comment
Share on other sites

which version of this contrib is it best to install just looked at the contribution section and there are 16 or so releases of this

 

?

"because it'll hurt more"- the greatest film of all time?

Link to comment
Share on other sites

Hi guys, havent looked in since v2 and need some help before updating.

 

Greg, or any1 else who can help,

 

I have read the FAQ in v2.2 but want to clarify before screwing with my setup.

 

As i understand it:

 

1 - Run the new sql file (i dont have any orders, as the store i am working on is not live)

2 - delete some newly moved files (not sure which) and place new ones in includes/modules/payment/paypal

3 - Make the edits in the admin section.

 

Am I right that only the admin files need to be re-edited and no other files need to be replaced??

 

Thanks for the help in advance!!

 

PoZel

sorry, I meant version 2.3 NOT 2.2, but the same questions apply.

Link to comment
Share on other sites

mike, :)

would you prefer win98 or win2000, only teasing, the latest version should suffice.

 

pozel,

i think the easiest think would be to reverse the install instructions for v2, then install v2.2.

here the main reason is to remove the previous conrib files rather than the files you edited.

You don't neccessarily need to delete the paypal_ipn tables, but make sure upon installing the ne db tables in v2.3 that you reset the table paypal's autoincrement vlaue to be higher than your laster paypal_ipn_id value in the orders table.

Confirm the edits required in both sides, mainly it is just admin section that you will need to pay particular attention to since there are some subtle changes like database table names.

 

clarocque,

Perform the revisions provided in these two posts: a and b.

 

BearHappy,

I'll try and look more into this, but quickly looking this seems to be the culprit:

for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {

Apols if missed anybody out.

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

Link to comment
Share on other sites

the reason i ask is cos the latest update/ version has no install instructions that i can find?

 

it just has revisions.txt and licence crap

:s

"because it'll hurt more"- the greatest film of all time?

Link to comment
Share on other sites

Mike, in the nicest possible way, you're gonna need to use some intuition and or be inquistive, PayPal_Shopping_Cart_IPN.html, fwiw, you'll also need to backup catalog/application_top.php

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

Link to comment
Share on other sites

ok, re-done everything from v2 to v2.3 and now get this when going to admin section:

 

Warning: main(/home/pozel/public_html/dogsportif/dogsportif/includes/modules/payment/paypal/database_tables.php): failed to open stream: No such file or directory in /home/pozel/public_html/dogsportif/admin/includes/database_tables.php on line 59

 

Fatal error: main(): Failed opening required '/home/pozel/public_html/dogsportif/dogsportif/includes/modules/payment/paypal/database_tables.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/pozel/public_html/dogsportif/admin/includes/database_tables.php on line 59

 

any idea why???

 

here is what i have from the paypal ipn addition in the database_tables.php in admin:

 

//begin PayPal_Shopping_Cart_IPN

require_once(DIR_FS_CATALOG_MODULES . 'payment/paypal/database_tables.php');

//end PayPal_Shopping_Cart_IPN

 

 

 

thanks for any help

Link to comment
Share on other sites

/home/pozel/public_html/dogsportif/admin/includes/database_tables.php
/home/pozel/public_html/dogsportif/dogsportif/includes/modules/payment/paypal/database_tables.php

Check your admin/includes/configure.php for the DIR_FS_CATALOG and DIR_FS_CATALOG_MODULES settings.

I think it should be:

/home/pozel/public_html/dogsportif/includes/modules/payment/paypal/database_tables.php

Alternatively just copy and paste the contents of paypal/database_tables.php into your admin/database_tables.php

 

BearHappy, can you confirm that you have the same revisions/edits as suggested to clarocque earlier.

Edited by gregbaboolal

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

Link to comment
Share on other sites

can't see anything wrong in the configure file, maybe u can see something

 

define('HTTP_SERVER', 'http://pozel.co.uk');
 define('HTTP_CATALOG_SERVER', '');
 define('HTTPS_CATALOG_SERVER', '');
 define('ENABLE_SSL_CATALOG', 'false'); // secure webserver for catalog module
 define('DIR_FS_DOCUMENT_ROOT', $DOCUMENT_ROOT); // where your pages are located on the server. if $DOCUMENT_ROOT doesnt suit you, replace with your local path. (eg, /usr/local/apache/htdocs)
define('DIR_WS_ADMIN', '/dogsportif/admin/');
 define('DIR_FS_ADMIN', DIR_FS_DOCUMENT_ROOT . DIR_WS_ADMIN);
define('DIR_WS_CATALOG', '/dogsportif/');
 define('DIR_FS_CATALOG', DIR_FS_DOCUMENT_ROOT . DIR_WS_CATALOG);
 define('DIR_WS_IMAGES', 'images/');
 define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/');
 define('DIR_WS_CATALOG_IMAGES', DIR_WS_CATALOG . 'images/');
 define('DIR_WS_INCLUDES', 'includes/');
 define('DIR_WS_BOXES', DIR_WS_INCLUDES . 'boxes/');
 define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/');
 define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');
 define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/');
 define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/');
 define('DIR_WS_CATALOG_LANGUAGES', DIR_WS_CATALOG . 'includes/languages/');
 define('DIR_FS_CATALOG_LANGUAGES', DIR_FS_CATALOG . 'includes/languages/');
 define('DIR_FS_CATALOG_IMAGES', DIR_FS_CATALOG . 'images/');
 define('DIR_FS_CATALOG_MODULES', DIR_FS_CATALOG . 'includes/modules/');
 define('DIR_FS_BACKUP', DIR_FS_ADMIN . 'backups/');

 

Thanks for the quick help greg!!

Link to comment
Share on other sites

think i may have sussed it!

 

I use the URL: http://dogsportif.pozel.co.uk which points to pozel.co.uk/dogsportif

 

So, when i am connecting to the server, my browser is simply adding another /dogsportif as it thinks that it is at the base level.

 

When i tried to connect with http://pozel.co.uk/dogsportif/admin it worked

 

So i guess i need to change the http server to: "http://dogsportif.pozel.co.uk" and remove the dogsportif from the other addresses

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...