Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

PayPal Standard - writes to db at checkout_payment


smartwork

Recommended Posts

My understanding is that PayPal Standard should write the order to the db at checkout_confirmation before sending the customer to PP for payment submission. Mine is writing the order to the db upon leaving checkout_payment, so it's happening before the customer even sees the order review (with shipping/taxes).

 

Ideas on why that's happening?

 

Thank you.

Link to comment
Share on other sites

Hi Shaun..

 

The certified module stores the database when leaving the checkout payment page landing on the checkout confirmation page. It saves the order with a Prepared order status level. This is required incase the customer does not return back to the store a after finalizing the payment at PayPal. In these cases the order is automatically taken care of by the IPN.

 

Kind regards,

:heart:, osCommerce

Link to comment
Share on other sites

  • 2 months later...

I am afraid your description does not make sense.

 

Can you try again with more explanation of what is wrong?

 

Cheers

 

G

Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Link to comment
Share on other sites

you do not see this written in the order confirmation e-mail

 

Sub-Total:  $ ......

Shipping: $ ........

Total:  $ .........

 

module payment paypal standard

 

I hope to be understood 
 
I greet and thank
Link to comment
Share on other sites

Can you cut and paste the order email you do get so we can see it for ourselves.

 

Thanks

 

G

Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Link to comment
Share on other sites

 

this is the code that sends me email

 

 

in red is the command that does not work

 

I do not understand where is error

 

 

// lets start with the email confirmation

      $email_order = STORE_NAME . "\n" .

                     EMAIL_SEPARATOR . "\n" .

                     EMAIL_TEXT_CUSTOMERS_ID . ' ' . $customer_id . ' ' . $gender . "\n" .

                     EMAIL_TEXT_CUSTOMERS_TP . ' ' . $email_extra_text . "\n" .

                     EMAIL_SEPARATOR . "\n" .

                     EMAIL_TEXT_ORDER_NUMBER . ' ' . $order_id . "\n" .

                     EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $order_id, 'SSL', false) . "\n" .

                     EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";

      if ($order->info['comments']) {

        $email_order .= tep_db_output($order->info['comments']) . "\n\n";

      }

      $email_order .= EMAIL_TEXT_PRODUCTS . "\n" .

                      EMAIL_SEPARATOR . "\n" .

                      $products_ordered .

                      EMAIL_SEPARATOR . "\n";

 

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

        $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";

      }

 

      if ($order->content_type != 'virtual') {

        $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" .

                        EMAIL_SEPARATOR . "\n" .

                        tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n";

      }

 

      $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" .

                      EMAIL_SEPARATOR . "\n" .

                      EMAIL_TEXT_PARTITA_IVA . ' ' . $order->billing['piva'] . "\n" .

                      EMAIL_TEXT_COD_FISC . ' ' . $order->billing['cf'] . "\n" .

                      EMAIL_SEPARATOR . "\n" .

                      tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n";

 

      if (is_object($$payment)) {

        $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" .

                        EMAIL_SEPARATOR . "\n";

        $payment_class = $$payment;

        $email_order .= $payment_class->title . "\n\n";

        if ($payment_class->email_footer) {

          $email_order .= $payment_class->email_footer . "\n\n";

        }

      }

 

      tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT. ' ' . $order_id, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

 

// send emails to other people

      if (SEND_EXTRA_ORDER_EMAILS_TO != '') {

        tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT. ' ' . $order_id, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

      }

 

Thank you!

Link to comment
Share on other sites

I was actually after the contents of the email it actually sends, so if you could send that too, I'll be back in an hour or so.

 

Cheers

 

G

Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Link to comment
Share on other sites

// lets start with the email confirmation

      $email_order = STORE_NAME . "\n" .

                     EMAIL_SEPARATOR . "\n" .

                     EMAIL_TEXT_CUSTOMERS_ID . ' ' . $customer_id . ' ' . $gender . "\n" .

                     EMAIL_TEXT_CUSTOMERS_TP . ' ' . $email_extra_text . "\n" .

                     EMAIL_SEPARATOR . "\n" .

                     EMAIL_TEXT_ORDER_NUMBER . ' ' . $order_id . "\n" .

                     EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $order_id, 'SSL', false) . "\n" .

                     EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";

      if ($order->info['comments']) {

        $email_order .= tep_db_output($order->info['comments']) . "\n\n";

      }

      $email_order .= EMAIL_TEXT_PRODUCTS . "\n" .

                      EMAIL_SEPARATOR . "\n" .

                      $products_ordered .

                      EMAIL_SEPARATOR . "\n";

 

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

        $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";

      }

 

      if ($order->content_type != 'virtual') {

        $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" .

                        EMAIL_SEPARATOR . "\n" .

                        tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n";

      }

 

      $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" .

                      EMAIL_SEPARATOR . "\n" .

                      EMAIL_TEXT_PARTITA_IVA . ' ' . $order->billing['piva'] . "\n" .

                      EMAIL_TEXT_COD_FISC . ' ' . $order->billing['cf'] . "\n" .

                      EMAIL_SEPARATOR . "\n" .

                      tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n";

 

      if (is_object($$payment)) {

        $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" .

                        EMAIL_SEPARATOR . "\n";

        $payment_class = $$payment;

        $email_order .= $payment_class->title . "\n\n";

        if ($payment_class->email_footer) {

          $email_order .= $payment_class->email_footer . "\n\n";

        }

      }

 

      tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT. ' ' . $order_id, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

 

// send emails to other people

      if (SEND_EXTRA_ORDER_EMAILS_TO != '') {

        tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT. ' ' . $order_id, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

      }

 

// load the after_process function from the payment modules

      $this->after_process();

 

      $cart->reset(true);

 

// unregister session variables used during checkout

      tep_session_unregister('sendto');

      tep_session_unregister('billto');

      tep_session_unregister('shipping');

      tep_session_unregister('payment');

      tep_session_unregister('comments');

 

      tep_session_unregister('cart_PayPal_Standard_ID');

 

      tep_redirect(tep_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL'));

    }

 

    function after_process() {

      return false;

    }

 

    function get_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_STANDARD_STATUS'");

        $this->_check = tep_db_num_rows($check_query);

      }

      return $this->_check;

    }

 

    function install($parameter = null) {

      $params = $this->getParams();

 

      if (isset($parameter)) {

        if (isset($params[$parameter])) {

          $params = array($parameter => $params[$parameter]);

        } else {

          $params = array();

        }

      }

 

      foreach ($params as $key => $data) {

        $sql_data_array = array('configuration_title' => $data['title'],

                                'configuration_key' => $key,

                                'configuration_value' => (isset($data['value']) ? $data['value'] : ''),

                                'configuration_description' => $data['desc'],

                                'configuration_group_id' => '6',

                                'sort_order' => '0',

                                'date_added' => 'now()');

 

        if (isset($data['set_func'])) {

          $sql_data_array['set_function'] = $data['set_func'];

        }

 

        if (isset($data['use_func'])) {

          $sql_data_array['use_function'] = $data['use_func'];

        }

 

        tep_db_perform(TABLE_CONFIGURATION, $sql_data_array);

      }

    }

 

    function remove() {

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

    }

 

    function keys() {

      $keys = array_keys($this->getParams());

 

      if ($this->check()) {

        foreach ($keys as $key) {

          if (!defined($key)) {

            $this->install($key);

          }

        }

      }

 

      return $keys;

    }

 

    function getParams() {

      if (!defined('MODULE_PAYMENT_PAYPAL_STANDARD_PREPARE_ORDER_STATUS_ID')) {

        $check_query = tep_db_query("select orders_status_id from " . TABLE_ORDERS_STATUS . " where orders_status_name = 'Preparing [PayPal Standard]' limit 1");

 

        if (tep_db_num_rows($check_query) < 1) {

          $status_query = tep_db_query("select max(orders_status_id) as status_id from " . TABLE_ORDERS_STATUS);

          $status = tep_db_fetch_array($status_query);

 

          $status_id = $status['status_id']+1;

 

          $languages = tep_get_languages();

 

          foreach ($languages as $lang) {

            tep_db_query("insert into " . TABLE_ORDERS_STATUS . " (orders_status_id, language_id, orders_status_name) values ('" . $status_id . "', '" . $lang['id'] . "', 'Preparing [PayPal Standard]')");

          }

 

          $flags_query = tep_db_query("describe " . TABLE_ORDERS_STATUS . " public_flag");

          if (tep_db_num_rows($flags_query) == 1) {

            tep_db_query("update " . TABLE_ORDERS_STATUS . " set public_flag = 0 and downloads_flag = 0 where orders_status_id = '" . $status_id . "'");

          }

        } else {

          $check = tep_db_fetch_array($check_query);

 

          $status_id = $check['orders_status_id'];

        }

      } else {

        $status_id = MODULE_PAYMENT_PAYPAL_STANDARD_PREPARE_ORDER_STATUS_ID;

      }

 

      if (!defined('MODULE_PAYMENT_PAYPAL_STANDARD_TRANSACTIONS_ORDER_STATUS_ID')) {

        $check_query = tep_db_query("select orders_status_id from " . TABLE_ORDERS_STATUS . " where orders_status_name = 'PayPal [Transactions]' limit 1");

 

        if (tep_db_num_rows($check_query) < 1) {

          $status_query = tep_db_query("select max(orders_status_id) as status_id from " . TABLE_ORDERS_STATUS);

          $status = tep_db_fetch_array($status_query);

 

          $tx_status_id = $status['status_id']+1;

 

          $languages = tep_get_languages();

 

          foreach ($languages as $lang) {

            tep_db_query("insert into " . TABLE_ORDERS_STATUS . " (orders_status_id, language_id, orders_status_name) values ('" . $tx_status_id . "', '" . $lang['id'] . "', 'PayPal [Transactions]')");

          }

 

          $flags_query = tep_db_query("describe " . TABLE_ORDERS_STATUS . " public_flag");

          if (tep_db_num_rows($flags_query) == 1) {

            tep_db_query("update " . TABLE_ORDERS_STATUS . " set public_flag = 0 and downloads_flag = 0 where orders_status_id = '" . $tx_status_id . "'");

          }

        } else {

          $check = tep_db_fetch_array($check_query);

 

          $tx_status_id = $check['orders_status_id'];

        }

      } else {

        $tx_status_id = MODULE_PAYMENT_PAYPAL_STANDARD_TRANSACTIONS_ORDER_STATUS_ID;

      }

 

      $params = array('MODULE_PAYMENT_PAYPAL_STANDARD_STATUS' => array('title' => 'Enable PayPal Payments Standard',

                                                                       'desc' => 'Do you want to accept PayPal Payments Standard payments?',

                                                                       'value' => 'True',

                                                                       'set_func' => 'tep_cfg_select_option(array(\'True\', \'False\'), '),

                      'MODULE_PAYMENT_PAYPAL_STANDARD_ID' => array('title' => 'Seller E-Mail Address',

                                                                   'desc' => 'The PayPal seller e-mail address to accept payments for'),

                      'MODULE_PAYMENT_PAYPAL_STANDARD_PRIMARY_ID' => array('title' => 'Primary E-Mail Address',

                                                                           'desc' => 'The primary PayPal seller e-mail address to validate IPN with (leave empty if it is the same as the Seller E-Mail Address)'),

                      'MODULE_PAYMENT_PAYPAL_STANDARD_PAGE_STYLE' => array('title' => 'Page Style',

                                                                           'desc' => 'The page style to use for the transaction procedure (defined at your PayPal Profile page)'),

                      'MODULE_PAYMENT_PAYPAL_STANDARD_TRANSACTION_METHOD' => array('title' => 'Transaction Method',

                                                                                   'desc' => 'The processing method to use for each transaction.',

                                                                                   'value' => 'Sale',

                                                                                   'set_func' => 'tep_cfg_select_option(array(\'Authorization\', \'Sale\'), '),

                      'MODULE_PAYMENT_PAYPAL_STANDARD_PREPARE_ORDER_STATUS_ID' => array('title' => 'Set Preparing Order Status',

                                                                                        'desc' => 'Set the status of prepared orders made with this payment module to this value',

                                                                                        'value' => $status_id,

                                                                                        'set_func' => 'tep_cfg_pull_down_order_statuses(',

                                                                                        'use_func' => 'tep_get_order_status_name'),

                      'MODULE_PAYMENT_PAYPAL_STANDARD_ORDER_STATUS_ID' => array('title' => 'Set PayPal Acknowledged Order Status',

                                                                                'desc' => 'Set the status of orders made with this payment module to this value',

                                                                                'value' => '0',

                                                                                'set_func' => 'tep_cfg_pull_down_order_statuses(',

                                                                                'use_func' => 'tep_get_order_status_name'),

                      'MODULE_PAYMENT_PAYPAL_STANDARD_TRANSACTIONS_ORDER_STATUS_ID' => array('title' => 'PayPal Transactions Order Status Level',

                                                                                             'desc' => 'Include PayPal transaction information in this order status level.',

                                                                                             'value' => $tx_status_id,

                                                                                             'use_func' => 'tep_get_order_status_name',

                                                                                             'set_func' => 'tep_cfg_pull_down_order_statuses('),

                      'MODULE_PAYMENT_PAYPAL_STANDARD_ZONE' => array('title' => 'Payment Zone',

                                                                     'desc' => 'If a zone is selected, only enable this payment method for that zone.',

                                                                     'value' => '0',

                                                                     'use_func' => 'tep_get_zone_class_title',

                                                                     'set_func' => 'tep_cfg_pull_down_zone_classes('),

                      'MODULE_PAYMENT_PAYPAL_STANDARD_GATEWAY_SERVER' => array('title' => 'Gateway Server',

                                                                               'desc' => 'Use the testing (sandbox) or live gateway server for transactions?',

                                                                               'value' => 'Live',

                                                                               'set_func' => 'tep_cfg_select_option(array(\'Live\', \'Sandbox\'), '),

                      'MODULE_PAYMENT_PAYPAL_STANDARD_VERIFY_SSL' => array('title' => 'Verify SSL Certificate',

                                                                           'desc' => 'Verify gateway server SSL certificate on connection?',

                                                                           'value' => 'True',

                                                                           'set_func' => 'tep_cfg_select_option(array(\'True\', \'False\'), '),

                      'MODULE_PAYMENT_PAYPAL_STANDARD_PROXY' => array('title' => 'Proxy Server',

                                                                      'desc' => 'Send API requests through this proxy server. (host:port, eg: 123.45.67.89:8080 or proxy.example.com:8080)'),

                      'MODULE_PAYMENT_PAYPAL_STANDARD_DEBUG_EMAIL' => array('title' => 'Debug E-Mail Address',

                                                                            'desc' => 'All parameters of an Invalid IPN notification will be sent to this email address if one is entered.'),

                      'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_STATUS' => array('title' => 'Enable Encrypted Website Payments',

                                                                           'desc' => 'Do you want to enable Encrypted Website Payments?',

                                                                           'value' => 'False',

                                                                           'set_func' => 'tep_cfg_select_option(array(\'True\', \'False\'), '),

                      'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PRIVATE_KEY' => array('title' => 'Your Private Key',

                                                                                'desc' => 'The location of your Private Key to use for signing the data. (*.pem)'),

                      'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PUBLIC_KEY' => array('title' => 'Your Public Certificate',

                                                                               'desc' => 'The location of your Public Certificate to use for signing the data. (*.pem)'),

                      'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PAYPAL_KEY' => array('title' => 'PayPals Public Certificate',

                                                                               'desc' => 'The location of the PayPal Public Certificate for encrypting the data.'),

                      'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_CERT_ID' => array('title' => 'Your PayPal Public Certificate ID',

                                                                            'desc' => 'The Certificate ID to use from your PayPal Encrypted Payment Settings Profile.'),

                      'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY' => array('title' => 'Working Directory',

                                                                                      'desc' => 'The working directory to use for temporary files. (trailing slash needed)'),

                      'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_OPENSSL' => array('title' => 'OpenSSL Location',

                                                                            'desc' => 'The location of the openssl binary file.',

                                                                            'value' => '/usr/bin/openssl'),

                      'MODULE_PAYMENT_PAYPAL_STANDARD_SORT_ORDER' => array('title' => 'Sort order of display.',

                                                                           'desc' => 'Sort order of display. Lowest is displayed first.',

                                                                           'value' => '0'));

 

      return $params;

    }

 

    function sendTransactionToGateway($url, $parameters) {

      $server = parse_url($url);

 

      if ( !isset($server['port']) ) {

        $server['port'] = ($server['scheme'] == 'https') ? 443 : 80;

      }

 

      if ( !isset($server['path']) ) {

        $server['path'] = '/';

      }

 

      $curl = curl_init($server['scheme'] . '://' . $server['host'] . $server['path'] . (isset($server['query']) ? '?' . $server['query'] : ''));

      curl_setopt($curl, CURLOPT_PORT, $server['port']);

      curl_setopt($curl, CURLOPT_HEADER, false);

      curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

      curl_setopt($curl, CURLOPT_FORBID_REUSE, true);

      curl_setopt($curl, CURLOPT_FRESH_CONNECT, true);

      curl_setopt($curl, CURLOPT_POST, true);

      curl_setopt($curl, CURLOPT_POSTFIELDS, $parameters);

 

      if ( MODULE_PAYMENT_PAYPAL_STANDARD_VERIFY_SSL == 'True' ) {

        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true);

        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2);

 

        if ( file_exists(DIR_FS_CATALOG . 'ext/modules/payment/paypal/paypal.com.crt') ) {

          curl_setopt($curl, CURLOPT_CAINFO, DIR_FS_CATALOG . 'ext/modules/payment/paypal/paypal.com.crt');

        } elseif ( file_exists(DIR_FS_CATALOG . 'includes/cacert.pem') ) {

          curl_setopt($curl, CURLOPT_CAINFO, DIR_FS_CATALOG . 'includes/cacert.pem');

        }

      } else {

        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);

      }

 

      if ( tep_not_null(MODULE_PAYMENT_PAYPAL_STANDARD_PROXY) ) {

        curl_setopt($curl, CURLOPT_HTTPPROXYTUNNEL, true);

        curl_setopt($curl, CURLOPT_PROXY, MODULE_PAYMENT_PAYPAL_STANDARD_PROXY);

      }

 

      $result = curl_exec($curl);

 

      curl_close($curl);

 

      return $result;

    }

 

// format prices without currency formatting

    function format_raw($number, $currency_code = '', $currency_value = '') {

      global $currencies, $currency;

 

      if (empty($currency_code) || !$this->is_set($currency_code)) {

        $currency_code = $currency;

      }

 

      if (empty($currency_value) || !is_numeric($currency_value)) {

        $currency_value = $currencies->currencies[$currency_code]['value'];

      }

 

      return number_format(tep_round($number * $currency_value, $currencies->currencies[$currency_code]['decimal_places']), $currencies->currencies[$currency_code]['decimal_places'], '.', '');

    }

 

    function sendDebugEmail($response = '', $ipn = false) {

      global $HTTP_POST_VARS, $HTTP_GET_VARS;

 

      if (tep_not_null(MODULE_PAYMENT_PAYPAL_STANDARD_DEBUG_EMAIL)) {

        $email_body = '';

 

        if (!empty($response)) {

          $email_body .= 'RESPONSE:' . "\n\n" . print_r($response, true) . "\n\n";

        }

 

        if (!empty($HTTP_POST_VARS)) {

          $email_body .= '$HTTP_POST_VARS:' . "\n\n" . print_r($HTTP_POST_VARS, true) . "\n\n";

        }

 

        if (!empty($HTTP_GET_VARS)) {

          $email_body .= '$HTTP_GET_VARS:' . "\n\n" . print_r($HTTP_GET_VARS, true) . "\n\n";

        }

 

        if (!empty($email_body)) {

          tep_mail('', MODULE_PAYMENT_PAYPAL_STANDARD_DEBUG_EMAIL, 'PayPal Standard Debug E-Mail' . ($ipn == true ? ' (IPN)' : ''), trim($email_body), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

        }

      }

    }

 

    function getTestLinkInfo() {

      $dialog_title = MODULE_PAYMENT_PAYPAL_STANDARD_DIALOG_CONNECTION_TITLE;

      $dialog_button_close = MODULE_PAYMENT_PAYPAL_STANDARD_DIALOG_CONNECTION_BUTTON_CLOSE;

      $dialog_success = MODULE_PAYMENT_PAYPAL_STANDARD_DIALOG_CONNECTION_SUCCESS;

      $dialog_failed = MODULE_PAYMENT_PAYPAL_STANDARD_DIALOG_CONNECTION_FAILED;

      $dialog_error = MODULE_PAYMENT_PAYPAL_STANDARD_DIALOG_CONNECTION_ERROR;

      $dialog_connection_time = MODULE_PAYMENT_PAYPAL_STANDARD_DIALOG_CONNECTION_TIME;

 

      $test_url = tep_href_link(FILENAME_MODULES, 'set=payment&module=' . $this->code . '&action=install&subaction=conntest');

 

      $js = <<<EOD

<script>

if ( typeof jQuery == 'undefined' ) {

  document.write('<scr' + 'ipt src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></scr' + 'ipt>');

  document.write('<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/redmond/jquery-ui.css" />');

  document.write('<scr' + 'ipt src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></scr' + 'ipt>');

}

</script>

 

<script>

$(function() {

  $('#tcdprogressbar').progressbar({

    value: false

  });

});

 

function openTestConnectionDialog() {

  var d = $('<div>').html($('#testConnectionDialog').html()).dialog({

    modal: true,

    title: '{$dialog_title}',

    buttons: {

      '{$dialog_button_close}': function () {

        $(this).dialog('destroy');

      }

    }

  });

 

  var timeStart = new Date().getTime();

 

  $.ajax({

    url: '{$test_url}'

  }).done(function(data) {

    if ( data == '1' ) {

      d.find('#testConnectionDialogProgress').html('<p style="font-weight: bold; color: green;">{$dialog_success}</p>');

    } else {

      d.find('#testConnectionDialogProgress').html('<p style="font-weight: bold; color: red;">{$dialog_failed}</p>');

    }

  }).fail(function() {

    d.find('#testConnectionDialogProgress').html('<p style="font-weight: bold; color: red;">{$dialog_error}</p>');

  }).always(function() {

    var timeEnd = new Date().getTime();

    var timeTook = new Date(0, 0, 0, 0, 0, 0, timeEnd-timeStart);

 

    d.find('#testConnectionDialogProgress').append('<p>{$dialog_connection_time} ' + timeTook.getSeconds() + '.' + timeTook.getMilliseconds() + 's</p>');

  });

}

</script>

EOD;

 

      $info = '<p><img src="images/icons/locked.gif" border="0"> <a href="javascript:openTestConnectionDialog();" style="text-decoration: underline; font-weight: bold;">' . MODULE_PAYMENT_PAYPAL_STANDARD_DIALOG_CONNECTION_LINK_TITLE . '</a></p>' .

              '<div id="testConnectionDialog" style="display: none;"><p>';

 

      if ( MODULE_PAYMENT_PAYPAL_STANDARD_GATEWAY_SERVER == 'Live' ) {

        $info .= 'Live Server:<br />https://www.paypal.com/cgi-bin/webscr';

      } else {

        $info .= 'Sandbox Server:<br />https://www.sandbox.paypal.com/cgi-bin/webscr';

      }

 

      $info .= '</p><div id="testConnectionDialogProgress"><p>' . MODULE_PAYMENT_PAYPAL_STANDARD_DIALOG_CONNECTION_GENERAL_TEXT . '</p><div id="tcdprogressbar"></div></div></div>' .

               $js;

 

      return $info;

    }

 

    function getTestConnectionResult() {

      $parameters = 'cmd=_notify-validate&business=' . urlencode(MODULE_PAYMENT_PAYPAL_STANDARD_ID);

 

      $result = $this->sendTransactionToGateway($this->form_action_url, $parameters);

 

      if ( $result == 'INVALID' ) {

        return 1;

      }

 

      return -1;

    }

 

    function verifyTransaction($is_ipn = false) {

      global $HTTP_POST_VARS, $currencies;

 

      if ( isset($HTTP_POST_VARS['invoice']) && is_numeric($HTTP_POST_VARS['invoice']) && ($HTTP_POST_VARS['invoice'] > 0) && isset($HTTP_POST_VARS['custom']) && is_numeric($HTTP_POST_VARS['custom']) && ($HTTP_POST_VARS['custom'] > 0) ) {

        $order_query = tep_db_query("select orders_id, orders_status, currency, currency_value from " . TABLE_ORDERS . " where orders_id = '" . (int)$HTTP_POST_VARS['invoice'] . "' and customers_id = '" . (int)$HTTP_POST_VARS['custom'] . "'");

 

        if ( tep_db_num_rows($order_query) === 1 ) {

          $order = tep_db_fetch_array($order_query);

 

          $new_order_status = DEFAULT_ORDERS_STATUS_ID;

 

          if ( $order['orders_status'] != MODULE_PAYMENT_PAYPAL_STANDARD_PREPARE_ORDER_STATUS_ID) {

            $new_order_status = $order['orders_status'];

          }

 

          $total_query = tep_db_query("select value from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$order['orders_id'] . "' and class = 'ot_total' limit 1");

          $total = tep_db_fetch_array($total_query);

 

          $comment_status = 'Transaction ID: ' . $HTTP_POST_VARS['txn_id'] . '; ' .

                            $HTTP_POST_VARS['payment_status'] . ' (' . ucfirst($HTTP_POST_VARS['payer_status']) . '; ' . $currencies->format($HTTP_POST_VARS['mc_gross'], false, $HTTP_POST_VARS['mc_currency']) . ')';

 

          if ( $HTTP_POST_VARS['payment_status'] == 'Pending' ) {

            $comment_status .= '; ' . $HTTP_POST_VARS['pending_reason'];

          } elseif ( ($HTTP_POST_VARS['payment_status'] == 'Reversed') || ($HTTP_POST_VARS['payment_status'] == 'Refunded') ) {

            $comment_status .= '; ' . $HTTP_POST_VARS['reason_code'];

          }

 

          if ( $HTTP_POST_VARS['mc_gross'] != number_format($total['value'] * $order['currency_value'], $currencies->get_decimal_places($order['currency'])) ) {

            $comment_status .= '; PayPal transaction value (' . $HTTP_POST_VARS['mc_gross'] . ') does not match order value (' . number_format($total['value'] * $order['currency_value'], $currencies->get_decimal_places($order['currency'])) . ')';

          } elseif ($HTTP_POST_VARS['payment_status'] == 'Completed') {

            $new_order_status = (MODULE_PAYMENT_PAYPAL_STANDARD_ORDER_STATUS_ID > 0 ? MODULE_PAYMENT_PAYPAL_STANDARD_ORDER_STATUS_ID : $new_order_status);

          }

 

          tep_db_query("update " . TABLE_ORDERS . " set orders_status = '" . (int)$new_order_status . "', last_modified = now() where orders_id = '" . (int)$order['orders_id'] . "'");

 

          if ( $is_ipn === true ) {

            $source = 'PayPal IPN Verified';

          } else {

            $source = 'PayPal Verified';

          }

 

          $sql_data_array = array('orders_id' => (int)$order['orders_id'],

                                  'orders_status_id' => MODULE_PAYMENT_PAYPAL_STANDARD_TRANSACTIONS_ORDER_STATUS_ID,

                                  'date_added' => 'now()',

                                  'customer_notified' => '0',

                                  'comments' => $source . ' [' . tep_output_string_protected($comment_status) . ']');

 

          tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);

        }

      }

    }

  }

?>

 


I hope we can find error in this code 

 

thanks

Link to comment
Share on other sites

I was actually after the contents of the email it actually sends, so if you could send that too, I'll be back in an hour or so.

 

Cheers

 

G

Thank you for sending the code that generates the email, now can you send the "email" the code is generating as requested above.

 

This will show what is being sent and we can see what is not being sent.

 

Cheers

 

G

Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Link to comment
Share on other sites

Sorry, I do not seem to be explaining what I want to see.

 

Please post a sample of the entire order email that "is" being sent. Not repeatedly posting the bit that "is not" being sent.

 

Thanks

 

G

Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Link to comment
Share on other sites

  • 8 months later...
PayPal express does not keep language of a web-store.

I am using osCommerce Online Merchant in 2.3.4 and I have Paypal business

account, I installed module of PayPal express /app-paypal-4_039/. My web store runs in two languages, Slovene (default) and English. If buyer chooses English language while shopping, paypal directs him back on checkout_confirmation in Slovene language and it doesn't matter which language I have in default in any browser.

How to fix this?

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