Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

PayPal WPP Direct Payments & Express Checkout Support


dynamoeffects

Recommended Posts

dynamo where are you!!!! >_<

 

He probably took some time off over the holidays.

 

Order Total Discrepancy occurs when the total sent to the module does not equal the sum of the items on the order. This can be a result of round-off errors or possibly tax on shipping. Does it happen on all orders? To figure out what is going on, look at the contents of an order from the admin page and compare it to the cart contents of the transaction at PayPal. What is different?

 

--Glen

Link to comment
Share on other sites

Just implemented the module and thanks Dynamo for the fabulous contribution!!

 

I've corrected few bugs in version 0.92 such as:

 

1. Change of address in PayPal doesn't get propagated to the final checkout screen (only temporarily in shipping screen)

2. Billing address is blank

3. Phone number doesn't get propagated

 

I will send my changes to Dynamo for his consideration in the next version.

 

Many thanks again for the great contribution and support rendered!!

- The Jackal

Link to comment
Share on other sites

The Jackal,

 

All three of your bug fixes would be of interest to me. Hopefully Brian will be back soon.

 

Can you test to see if you see any error message/explanation upon being redirected to the payment page from the confirmation page when an error of any sort occurs? (such as an invaild card number or expiration missing etc...)

 

its a problem for many of us since RC1, the error/message is in the session data, but refuses to physically appear on the redirected-to page. If you have the same issue perhaps you can help Brian resolve it as well....

 

thanks for your inputs!

-Dave

Link to comment
Share on other sites

I have installed the latest 0.9.2 version of this in my store and I am thrilled with it. I'm especially grateful for the full details in the error dumps. I am concerned about something, though. These error dumps include the full credit card number along with expiration date and CVV code, as well as a ton of information about the customer. Is there any way to shut these items out of the detail of the error dump? I don't really need so much detail.

 

Thanks!

Brian (Schadeboy) Schade

CIO and Webmaster

Twilight Teez, LLC

 

"Camping is nature's way of promoting the hotel industry."

-Dave Barry

Link to comment
Share on other sites

The Jackal,

 

All three of your bug fixes would be of interest to me. Hopefully Brian will be back soon.

 

Can you test to see if you see any error message/explanation upon being redirected to the payment page from the confirmation page when an error of any sort occurs? (such as an invaild card number or expiration missing etc...)

 

its a problem for many of us since RC1, the error/message is in the session data, but refuses to physically appear on the redirected-to page. If you have the same issue perhaps you can help Brian resolve it as well....

 

thanks for your inputs!

The changes are quite simple and all contained in the paypal_wpp.php file. However, I thought it is more appropriate for Dynamo himself to update since he is still actively supporting this module.

 

Strange, the error messages are appearing correctly on mine.

- The Jackal

Link to comment
Share on other sites

@TheJackal: Thanks for the bug fixes. I only got half of the script though and I've replied to your PM.

 

@Schadeboy: That's a fix in 0.9.3 that I'm working slowly but steadily on. I've added a masking routine to mask out all sensitive information in error dumps.

 

@Roaddoctor: I encountered this issue during an installation two days ago. I added this line to checkout_process.php:

die(print_r($_SESSION));

under the include('includes/application_top.php'); line and it showed that an error 10501 was being received but for some reason not passed to checkout_payment.php. I've added it to my bug list and will get it worked out. Try adding that line for now and see what's displayed.

Please use the forums for support! I am happy to help you here, but I am unable to offer free technical support over instant messenger or e-mail.

Link to comment
Share on other sites


@Roaddoctor: I encountered this issue during an installation two days ago. I added this line to checkout_process.php:

die(print_r($_SESSION));

under the include('includes/application_top.php'); line and it showed that an error 10501 was being received but for some reason not passed to checkout_payment.php. I've added it to my bug list and will get it worked out. Try adding that line for now and see what's displayed.

 

Ok I submitted a transaction with correct card info but wrong address/zip knowing it should redirect to payment.php with a message. Here are the results. xxxx's placed on sensitive info.

 

Array ( [cart] => shoppingcart Object ( [contents] => Array ( [30] => Array ( [qty] => 1 ) ) [total] => 11.5 [weight] => 2 [cartID] => [content_type] => physical ) [language] => english [languages_id] => 1 [currency] => USD [navigation] => navigationhistory Object ( [path] => Array ( [0] => Array ( 

 => index.php [mode] => NONSSL [get] => Array ( ) [post] => Array ( ) ) [1] => Array ( 

 => index.php [mode] => NONSSL [get] => Array ( [cPath] => 23 ) [post] => Array ( ) ) [2] => Array ( 

 => shopping_cart.php [mode] => NONSSL [get] => Array ( ) [post] => Array ( ) ) [3] => Array ( 

 => checkout_shipping.php [mode] => SSL [get] => Array ( ) [post] => Array ( [action] => process [shipping] => pickup_pickup [comments] => [x] => 64 [y] => 7 ) ) [4] => Array ( 

 => checkout_payment.php [mode] => SSL [get] => Array ( ) [post] => Array ( ) ) [5] => Array ( 

 => checkout_confirmation.php [mode] => SSL [get] => Array ( ) [post] => Array ( [payment] => paypal_wpp [paypalwpp_cc_firstname] => David [paypalwpp_cc_lastname] => xxxxxxxx [paypalwpp_cc_type] => MasterCard [paypalwpp_cc_number] => 5490xxxxxxxxxxxx [paypalwpp_cc_expires_month] => 10 [paypalwpp_cc_expires_year] => xx [paypalwpp_cc_checkcode] => xxx [po_number] => [comments] => [x] => 51 [y] => 11 ) ) [6] => Array ( 

 => checkout_process.php [mode] => SSL [get] => Array ( ) [post] => Array ( [wpp_cc_type] => MasterCard [wpp_cc_expdate_month] => 10 [wpp_cc_expdate_year] => xx [wpp_cc_number] => 5490xxxxxxxxxxxx [wpp_cc_checkcode] => xxx [wpp_payer_firstname] => David [wpp_payer_lastname] => xxxxxxxxx [wpp_redirect_url] => https://www.xxxxxxx.com/checkout_process.php [x] => 74 [y] => 11 ) ) ) [snapshot] => Array ( ) ) [customer_id] => 2 [customer_default_address_id] => 179 [customer_first_name] => David [sppc_customer_group_id] => 0 [sppc_customer_group_show_tax] => 1 [sppc_customer_group_tax_exempt] => 0 [customer_country_id] => 223 [customer_zone_id] => 57 [sendto] => 179 [cartID] => [comments] => [shipping] => Array ( [id] => pickup_pickup [title] => Local Pickup (Customer Pickup (Our Address) Missouri City, Texas ) [cost] => 0.00 ) [billto] => 2 [payment] => paypal_wpp ) 1

 

Have you checked out this message stack bug thread?

message stack bug rc1

 

Hope that helps

-Dave

Link to comment
Share on other sites

@TheJackal: Thanks for the bug fixes. I only got half of the script though and I've replied to your PM.

Maybe the message is too big. I think most people do not like long code on the forum..so I will paste only ec_step2 function of paypal_wpp.php:

 

The changes have "Bug 0.92" comments. Do a diff to see all the changes.

 

	function ec_step2() {
  global $_GET, $_SESSION, $customer_id, $customer_first_name, $language;
  global $customer_default_address_id, $sendto;
  global $customer_default_address_id, $billto; // Bug 0.92 Empty billing address for change


  //Visitor just came back from PayPal and so we collect all the info returned, create an account if necessary, 
  //then log them in, and then send them to checkout_shipping.php.  What a long, strange trip it's been.

  if ($_SESSION['paypal_ec_token'] == '') {
	if (isset($_GET['token'])) {
	  $_SESSION['paypal_ec_token'] = $_GET['token'];
	} else {
	  $this->away_with_you(MODULE_PAYMENT_PAYPAL_DP_INVALID_RESPONSE, true);
	}
  }

  //Make sure the token is in the correct format
  if (!ereg("([C-E]{2})-([A-Z0-9]{17})", $_SESSION['paypal_ec_token'])) {
	$this->away_with_you(MODULE_PAYMENT_PAYPAL_DP_INVALID_RESPONSE, true);
  }

  $token_info = array('PAYPAL_TOKEN' => $_SESSION['paypal_ec_token']);

  $response = $this->wpp_execute_transaction('getExpressCheckoutDetails', $token_info);

  if(!is_array($response)  || ($response['GetExpressCheckoutDetailsResponse'][0]['Ack'] != 'Success' && $response['GetExpressCheckoutDetailsResponse'][0]['Ack'] != 'SuccessWithWarning')) {
	if ($this->enableDebugging == '1') {
	  tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, 'PayPal Error Dump', "In function: ec_step2()\r\n\r\n" . var_dump($response), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
	}
	$this->away_with_you(MODULE_PAYMENT_PAYPAL_DP_GEN_ERROR . $this->return_transaction_errors($response['GetExpressCheckoutDetailsResponse'][0]['Errors']), true);
  } else {
	$payer_info = $response['GetExpressCheckoutDetailsResponse'][0]['GetExpressCheckoutDetailsResponseDetails'][0]['PayerInfo'][0];
	$payer_contactphone = $response['GetExpressCheckoutDetailsResponse'][0]['GetExpressCheckoutDetailsResponseDetails'][0]['ContactPhone']; //Bug 0.92

	if(MODULE_PAYMENT_PAYPAL_DP_REQ_VERIFIED == 'Yes' && strtolower($payer_info['PayerStatus']) != 'verified') {
	  $this->away_with_you(MODULE_PAYMENT_PAYPAL_DP_TEXT_UNVERIFIED, true);
	}

	tep_session_register('paypal_ec_payer_id');
	$_SESSION['paypal_ec_payer_id'] = $payer_info['PayerID'];

	tep_session_register('paypal_ec_payer_info');
	//To ensure there is always value in telephone field, default to your store's number
	$paypal_phone = '1234567890';//Bug 0.92
	if ($payer_contactphone != '') $paypal_phone = $payer_contactphone;
	$_SESSION['paypal_ec_payer_info'] = array(
		'payer_id' => $payer_info['PayerID'], 
		'payer_email' => $payer_info['Payer'], 
		'payer_firstname' => $payer_info['PayerName'][0]['FirstName'],
		'payer_lastname' => $payer_info['PayerName'][0]['LastName'],
		'payer_business' => $payer_info['PayerBusiness'],
		'payer_status' => $payer_info['PayerStatus'],
		'ship_owner' => $payer_info['Address'][0]['AddressOwner'],
		'ship_name' => $payer_info['Address'][0]['Name'],
		'ship_street_1' => $payer_info['Address'][0]['Street1'],
		'ship_street_2' => $payer_info['Address'][0]['Street2'],
		'ship_city' => $payer_info['Address'][0]['CityName'],
		'ship_state' => $payer_info['Address'][0]['StateOrProvince'],
		'ship_postal_code' => $payer_info['Address'][0]['PostalCode'],
		'ship_country' => $payer_info['Address'][0]['Country'],
		'ship_country_name' => $payer_info['Address'][0]['CountryName'],
		'ship_phone' => $paypal_phone,
		'ship_address_status' => $payer_info['Address'][0]['AddressStatus']);

	//Get the customer's country ID.
	$country_query = tep_db_query("SELECT countries_id, address_format_id FROM ".TABLE_COUNTRIES." WHERE countries_name = '".$_SESSION['paypal_ec_payer_info']['ship_country_name']."' LIMIT 1");
	if (tep_db_num_rows($country_query) > 0) {
	  $country = tep_db_fetch_array($country_query);
	  $country_id = $country['countries_id'];
	  $address_format_id = $country['address_format_id'];
	} else {
	  $country_id = '';
	  $address_format_id = '2'; //2 is the American format
	}

	$states_query = tep_db_query("SELECT zone_id FROM ".TABLE_ZONES." WHERE zone_code = '".$_SESSION['paypal_ec_payer_info']['ship_state']."' AND zone_country_id = '".$country_id."' LIMIT 1");
	if (tep_db_num_rows($states_query) > 0) {
	  $states = tep_db_fetch_array($states_query);
	  $state_id = $states['zone_id'];
	} else {
	  $state_id = '';
	}

	$order->customer['name'] = $_SESSION['paypal_ec_payer_info']['payer_firstname'] . ' ' . $_SESSION['paypal_ec_payer_info']['payer_lastname'];
	$order->customer['company'] = $_SESSION['paypal_ec_payer_info']['payer_business'];
	$order->customer['street_address'] = $_SESSION['paypal_ec_payer_info']['ship_street_1'];
	$order->customer['suburb'] = $_SESSION['paypal_ec_payer_info']['ship_street_2'];
	$order->customer['city'] = $_SESSION['paypal_ec_payer_info']['ship_city'];
	$order->customer['postcode'] = $_SESSION['paypal_ec_payer_info']['ship_postal_code'];
	$order->customer['state'] = $_SESSION['paypal_ec_payer_info']['ship_state'];
	$order->customer['country'] = $_SESSION['paypal_ec_payer_info']['ship_country_name'];
	$order->customer['format_id'] = $address_format_id;
	$order->customer['email_address'] = $_SESSION['paypal_ec_payer_info']['payer_email'];
	$order->customer['telephone'] = $_SESSION['paypal_ec_payer_info']['ship_phone'];

	//For some reason, $order->billing gets erased between here and checkout_confirmation.php
	$order->billing['name'] = $_SESSION['paypal_ec_payer_info']['payer_firstname'] . ' ' . $_SESSION['paypal_ec_payer_info']['payer_lastname'];
	$order->billing['company'] = $_SESSION['paypal_ec_payer_info']['payer_business'];
	$order->billing['street_address'] = $_SESSION['paypal_ec_payer_info']['ship_street_1'];
	$order->billing['suburb'] = $_SESSION['paypal_ec_payer_info']['ship_street_2'];
	$order->billing['city'] = $_SESSION['paypal_ec_payer_info']['ship_city'];
	$order->billing['postcode'] = $_SESSION['paypal_ec_payer_info']['ship_postal_code'];
	$order->billing['state'] = $_SESSION['paypal_ec_payer_info']['ship_state'];
	$order->billing['country'] = $_SESSION['paypal_ec_payer_info']['ship_country_name'];
	$order->billing['format_id'] = $address_format_id;

	/*Disabled for now
	//If they selected an address on PayPal's site with a different zipcode than was previously selected
	//send them back to the shipping page
	if ($order->delivery['postcode'] == $_SESSION['paypal_ec_payer_info']['ship_postal_code']) {
	  $goto_shipping = false;
	} else {
	  $goto_shipping = true;
	}
	*/

	$order->delivery['name'] = $_SESSION['paypal_ec_payer_info']['payer_firstname'] . ' ' . $_SESSION['paypal_ec_payer_info']['payer_lastname'];
	$order->delivery['company'] = $_SESSION['paypal_ec_payer_info']['payer_business'];
	$order->delivery['street_address'] = $_SESSION['paypal_ec_payer_info']['ship_street_1'];
	$order->delivery['suburb'] = $_SESSION['paypal_ec_payer_info']['ship_street_2'];
	$order->delivery['city'] = $_SESSION['paypal_ec_payer_info']['ship_city'];
	$order->delivery['postcode'] = $_SESSION['paypal_ec_payer_info']['ship_postal_code'];
	$order->delivery['state'] = $_SESSION['paypal_ec_payer_info']['ship_state'];
	$order->delivery['country'] = $_SESSION['paypal_ec_payer_info']['ship_country_name'];
	$order->delivery['format_id'] = $address_format_id;

	if (!tep_session_is_registered('paypal_ec_temp')) tep_session_register('paypal_ec_temp');

	if (tep_session_is_registered('customer_first_name') && tep_session_is_registered('customer_id')) {
	  //They're logged in, so forward them straight to checkout_shipping.php
	  $order->customer['id'] = $customer_id;
	  //there's a bug here
	  //if logged in, and paypal address is different from addr book default, change the addr book entry
	  /* Bug in 0.92 
		 It is wrong to assume that the default address in Oscommerce is correct 
		 when customer is logged in
		 coz PayPal customer could have chosen another delivery address from PayPal
	  */
	  //if logged in, and paypal address is different from addr book default, change the addr book entry
	  //get customer id
	  $check_customer_query = tep_db_query("select customers_id, customers_firstname, customers_lastname, customers_paypal_payerid, customers_paypal_ec, customers_default_address_id from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . "'");
	  $check_customer = tep_db_fetch_array($check_customer_query);
	  if (tep_db_num_rows($check_customer_query) > 0) {
		$default_address_customer_id = $check_customer['customers_default_address_id'];
		//get address
		$check_address_query = tep_db_query("select * from " . TABLE_ADDRESS_BOOK . " where address_book_id = '" . (int)$default_address_customer_id . "'");
		$check_address = tep_db_fetch_array($check_address_query);
		if (tep_db_num_rows($check_address_query) > 0) {
		  if (strcasecmp($check_address['entry_street_address'], $_SESSION['paypal_ec_payer_info']['ship_street_1']) != 0) {
			 //Update database address book with Paypal address if different
			 $sql_data_array = array('customers_id' => (int)$check_customer['customers_id'],
									'entry_firstname' => $_SESSION['paypal_ec_payer_info']['payer_firstname'],
									'entry_lastname' => $_SESSION['paypal_ec_payer_info']['payer_lastname'],
									'entry_street_address' => $_SESSION['paypal_ec_payer_info']['ship_street_1'],
									'entry_suburb' => $_SESSION['paypal_ec_payer_info']['ship_street_2'],
									'entry_city' => $_SESSION['paypal_ec_payer_info']['ship_city'],
									'entry_zone_id' => $state_id,
									'entry_postcode' => $_SESSION['paypal_ec_payer_info']['ship_postal_code'],
									'entry_country_id' => $country_id);
			 tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array, 'update', "address_book_id = '" . (int)$default_address_customer_id . "'");
			 tep_db_query("update " . TABLE_CUSTOMERS . " set customers_default_address_id = '" . (int)$default_address_customer_id . "' where customers_id = '" . (int)$check_customer['customers_id'] . "'");
			 $address_id = $default_address_customer_id;
			 $customer_default_address_id = $default_address_customer_id;
			 if (tep_session_is_registered('shipping')) tep_session_unregister('shipping');  //required?
		  }
		}
	  }
	  //end
	  if (!tep_session_is_registered('sendto')) tep_session_register('sendto'); 
	  $_SESSION['sendto'] = $customer_default_address_id;
	  $_SESSION['paypal_ec_temp'] = false;

	  // Bug 0.92  Empty Billing Address
	  $billto = $_SESSION['billto'] = $customer_default_address_id;
	  if (!tep_session_is_registered('billto')) tep_session_register('billto');
	  // End

	  $this->away_with_you(); 

	  /*disabled for now
	  //0.6.2b modification.  If they already have a shipping amount calculated for this zip code, send them on instead of backwards
	  if ($goto_shipping) {
		$this->away_with_you();
	  } else {
		$this->away_with_you('', false, FILENAME_CHECKOUT_CONFIRMATION);
	  }
	  */
	} else {
	  //They're not logged in.  Create an account if necessary, and then log them in.
	  //First, see if they're an existing customer

	  //If Paypal didn't send an email address, something went wrong
	  if (trim($_SESSION['paypal_ec_payer_info']['payer_email']) == '') $this->away_with_you(MODULE_PAYMENT_PAYPAL_DP_INVALID_RESPONSE, true);
	  $check_customer_query = tep_db_query("select customers_id, customers_firstname, customers_lastname, customers_paypal_payerid, customers_paypal_ec from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($_SESSION['paypal_ec_payer_info']['payer_email']) . "'");
	  $check_customer = tep_db_fetch_array($check_customer_query);
	  if (tep_db_num_rows($check_customer_query) > 0) {
		$check_customer = tep_db_fetch_array($check_customer_query);
		$acct_exists = true;
		if ($check_customer['customers_paypal_ec'] == '1') {
		  //Delete the existing temporary account
		  $this->ec_delete_user($check_customer['customers_id']);
		  $acct_exists = false;
		}
	  }

	  //Create an account
	  if (!$acct_exists) {
		//Generate a random-looking 8-char password
		$salt = "46z3haZzegmn676PA3rUw2vrkhcLEn2p1c6gf7vp2ny4u3qqfqBh5j6kDhuLmyv9xf";
		srand((double)microtime()*1000000); 
		$password = '';
		for ($x = 0; $x < 7; $x++) {
		  $num = rand() % 33;
		  $tmp = substr($salt, $num, 1);
		  $password = $password . $tmp;
		}

		$sql_data_array = array('customers_firstname' => $_SESSION['paypal_ec_payer_info']['payer_firstname'],
								'customers_lastname' => $_SESSION['paypal_ec_payer_info']['payer_lastname'],
								'customers_email_address' => $_SESSION['paypal_ec_payer_info']['payer_email'],
								'customers_telephone' => $_SESSION['paypal_ec_payer_info']['ship_phone'],
								'customers_fax' => '',
								'customers_newsletter' => '0',
								'customers_password' => tep_encrypt_password($password),
								'customers_paypal_payerid' => $_SESSION['paypal_ec_payer_id']);

		tep_db_perform(TABLE_CUSTOMERS, $sql_data_array);

		$customer_id = tep_db_insert_id();

		$sql_data_array = array('customers_id' => $customer_id,
								'entry_firstname' => $_SESSION['paypal_ec_payer_info']['payer_firstname'],
								'entry_lastname' => $_SESSION['paypal_ec_payer_info']['payer_lastname'],
								'entry_street_address' => $_SESSION['paypal_ec_payer_info']['ship_street_1'],
								'entry_suburb' => $_SESSION['paypal_ec_payer_info']['ship_street_2'],
								'entry_city' => $_SESSION['paypal_ec_payer_info']['ship_city'],
								'entry_zone_id' => $state_id,
								'entry_postcode' => $_SESSION['paypal_ec_payer_info']['ship_postal_code'],
								'entry_country_id' => $country_id);

		tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);

		$address_id = tep_db_insert_id();

		tep_db_query("update " . TABLE_CUSTOMERS . " set customers_default_address_id = '" . (int)$address_id . "' where customers_id = '" . (int)$customer_id . "'");

		tep_db_query("insert into " . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values ('" . (int)$customer_id . "', '0', now())");



		if (MODULE_PAYMENT_PAYPAL_DP_NEW_ACCT_NOTIFY == 'Yes') {
		  require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CREATE_ACCOUNT);

		  $email_text = sprintf(EMAIL_GREET_NONE, $_SESSION['paypal_ec_payer_info']['payer_firstname']) . EMAIL_WELCOME . EMAIL_TEXT;
		  $email_text .= EMAIL_EC_ACCOUNT_INFORMATION . "Username: " . $_SESSION['paypal_ec_payer_info']['payer_email'] . "\nPassword: " . $password . "\n\n";
		  $email_text .= EMAIL_CONTACT;

		  tep_mail($_SESSION['paypal_ec_payer_info']['payer_firstname'] . " " . $_SESSION['paypal_ec_payer_info']['payer_lastname'], $_SESSION['paypal_ec_payer_info']['payer_email'], EMAIL_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

		  $_SESSION['paypal_ec_temp'] = false;
		} else {
		  //Make it a temporary account that'll be deleted once they've checked out
		  tep_db_query("UPDATE " . TABLE_CUSTOMERS . " SET customers_paypal_ec = '1' WHERE customers_id = '" . (int)$customer_id . "'");

		  $_SESSION['paypal_ec_temp'] = True;
		}
	  } else {
		$_SESSION['paypal_ec_temp'] = false;
	  }

	  /* Bug in 0.92 
		 It is wrong to assume that the default address in Oscommerce is correct 
		 when customer is not logged in and account exists in OSCommerce
		 coz PayPal customer could have chosen another delivery address from PayPal
	  */
	  //get customer id
	  $check_customer_query = tep_db_query("select customers_id, customers_firstname, customers_lastname, customers_paypal_payerid, customers_paypal_ec, customers_default_address_id from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($_SESSION['paypal_ec_payer_info']['payer_email']) . "'");
	  $check_customer = tep_db_fetch_array($check_customer_query);
	  if (tep_db_num_rows($check_customer_query) > 0) {
		$default_address_customer_id = $check_customer['customers_default_address_id'];
		//get address
		$check_address_query = tep_db_query("select * from " . TABLE_ADDRESS_BOOK . " where address_book_id = '" . (int)$default_address_customer_id . "'");
		$check_address = tep_db_fetch_array($check_address_query);
		if (tep_db_num_rows($check_address_query) > 0) {
		  if (strcasecmp($check_address['entry_street_address'], $_SESSION['paypal_ec_payer_info']['ship_street_1']) != 0) {
			 //Update database address book with Paypal address if different
			 $sql_data_array = array('customers_id' => (int)$check_customer['customers_id'],
									'entry_firstname' => $_SESSION['paypal_ec_payer_info']['payer_firstname'],
									'entry_lastname' => $_SESSION['paypal_ec_payer_info']['payer_lastname'],
									'entry_street_address' => $_SESSION['paypal_ec_payer_info']['ship_street_1'],
									'entry_suburb' => $_SESSION['paypal_ec_payer_info']['ship_street_2'],
									'entry_city' => $_SESSION['paypal_ec_payer_info']['ship_city'],
									'entry_zone_id' => $state_id,
									'entry_postcode' => $_SESSION['paypal_ec_payer_info']['ship_postal_code'],
									'entry_country_id' => $country_id);
			 tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array, 'update', "address_book_id = '" . (int)$default_address_customer_id . "'");
			 tep_db_query("update " . TABLE_CUSTOMERS . " set customers_default_address_id = '" . (int)$default_address_customer_id . "' where customers_id = '" . (int)$check_customer['customers_id'] . "'");
			 //$address_id = $default_address_customer_id;
			 if (tep_session_is_registered('shipping')) tep_session_unregister('shipping');  //required?
		  }
		  $address_id = $default_address_customer_id;
		}
	  }		
	  //End Bug 0.92
	  $sendto = $address_id;
	  if (!tep_session_is_registered('sendto')) tep_session_register('sendto');

	  // Bug 0.92  Empty Billing Address
	  tep_session_unregister('billto');
	  $billto = $address_id;
	  if (!tep_session_is_registered('billto')) tep_session_register('billto');
	  // End
	  $this->user_login($_SESSION['paypal_ec_payer_info']['payer_email']);
	}
  }
}

- The Jackal

Link to comment
Share on other sites

Thanks for that, TheJackal. That's pretty dangerous to replace the billing address without asking the customer first, though. What I'll probably do is create a new entry in the DB if no exact match was found. We run into the problem of the user exceeding 5 entries, but that should be extremely rare.

 

Also, do you get a phone number 100% of the time with that change in code? Tests in the sandbox show that it's beneath PayerInfo, not at the same level.

Please use the forums for support! I am happy to help you here, but I am unable to offer free technical support over instant messenger or e-mail.

Link to comment
Share on other sites

Thanks for that, TheJackal. That's pretty dangerous to replace the billing address without asking the customer first, though. What I'll probably do is create a new entry in the DB if no exact match was found. We run into the problem of the user exceeding 5 entries, but that should be extremely rare.

 

Also, do you get a phone number 100% of the time with that change in code? Tests in the sandbox show that it's beneath PayerInfo, not at the same level.

I tried your way initially . But I ran into the problem of trying to match the address correctly. Eg 7th St vs 7th Street etc. So I decided to overwrite the default address instead to simplify things. But yes, your method should be more comprehensive.

 

Yes, I confirm that I am getting the contact number 100% of the time so far in Production and Sandbox.

Edited by TheJackal

- The Jackal

Link to comment
Share on other sites

Due to the large number of orders we are doing now, it is becoming VERY tedious to login to PayPal and do refunds. Does anyone know if there is a way to do this from our admin panel? It wouldn't be AS BAD, but PayPal logs you out after about 5 minutes. . .so it's constantly logging us out. Any help would be greatly appreciated. I've spent about 30 minutes looking for any threads related to the same issue.

 

Also, one more thing. . .eChecks. . .also driving us crazy. At one point, when the check would clear, it seemed the status on the order was automatically getting updated from "Pending Payment" to "Ready for Shipment", however, now we have to do this manually. Did we break it or was I dreaming that this was happening? Is there a way to automate this? Any help would be greatly appreciated.

Link to comment
Share on other sites

So I am having an issue with orders processing through, an dgetting the 10501 error. I know this is supposed ot be a PayPal issue, but I think I am missing the login info somewhere. Take a look at the info sent back from paypal:

In function: before_process() - Direct Payment Did first contact attempt return error? Yes
---------------------------------------------------------------------
-------------------------------DP_DUMP-------------------------------
------------This is the information that was sent to PayPal----------
---------------------------------------------------------------------
[?xml version="1.0" encoding="utf-8"?] [soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"]
 [soap:Header]
[RequesterCredentials xmlns="urn:ebay:api:PayPalAPI"]
  [Credentials xmlns="urn:ebay:apis:eBLBaseComponents"]
	[Username]Gremlyn1_****.***.com[/Username]
	[Password]V7GA*********9B8[/Password]
	[Subject][/Subject]
  [/Credentials]
[/RequesterCredentials]
 [/soap:Header]
 [soap:Body]
[DoDirectPaymentReq xmlns="urn:ebay:api:PayPalAPI"]
  [DoDirectPaymentRequest]
	[Version xmlns="urn:ebay:apis:eBLBaseComponents"]2.0[/Version]
	[DoDirectPaymentRequestDetails xmlns="urn:ebay:apis:eBLBaseComponents"]
	  [PaymentAction]Authorization[/PaymentAction]
	  [PaymentDetails]
		[OrderTotal currencyID="USD"]4.00[/OrderTotal]
		[OrderDescription]Order placed on January 14, 2008, 9:30 pm by Colin(ID: 2)[/OrderDescription]
		[ItemTotal currencyID="USD"]1[/ItemTotal]
		[ShippingTotal currencyID="USD"]3[/ShippingTotal]
		[HandlingTotal currencyID="USD"][/HandlingTotal]
		[TaxTotal currencyID="USD"]0[/TaxTotal]
		[Custom]Phone: ********* -- Email: gremlyn1[/Custom]
		[InvoiceID][/InvoiceID]
		[NotifyURL][/NotifyURL]
		[ButtonSource][/ButtonSource]
		[ShipToAddress]
		  [Name]Colin[/Name]
		  [Street1]*********[/Street1]
		  [Street2][/Street2]
		  [CityName]***********[/CityName] 
		  [StateOrProvince]CA[/StateOrProvince]
		  [PostalCode]******[/PostalCode]
		  [Country]US[/Country]
		[/ShipToAddress]
		[PaymentDetailsItem][Name]test[/Name][Amount currencyID="USD"]1.00[/Amount][Number]30 ()[/Number][Quantity]1[/Quantity][/PaymentDetailsItem]
	  [/PaymentDetails]
	  [CreditCard]
		[CardOwner]
		  [Payer]gremlyn1[/Payer]
		  [PayerName]
		  [FirstName]Colin[/FirstName]
		  [LastName]******[/LastName]
		  [/PayerName]
		  [Address]
			[Street1]***********[/Street1]
			[Street2][/Street2]
			[CityName]*******[/CityName] 
			[StateOrProvince]CA[/StateOrProvince]
			[PostalCode]*****[/PostalCode]
			[Country]US[/Country]
		  [/Address]
		[/CardOwner]
		[CreditCardType]MasterCard[/CreditCardType]
		[CreditCardNumber]****************[/CreditCardNumber]
		[StartMonth][/StartMonth]
		[StartYear][/StartYear]
		[IssueNumber][/IssueNumber]
		[ExpMonth]0*[/ExpMonth]
		[ExpYear]20**[/ExpYear]
		[CVV2]***[/CVV2]
	  [/CreditCard]
	  [IPAddress]68.107.72.61[/IPAddress]
	  [MerchantSessionId]e20c83e24c5fc4314ecfa0c1aa6fc5ef[/MerchantSessionId]
	[/DoDirectPaymentRequestDetails]
  [/DoDirectPaymentRequest]
[/DoDirectPaymentReq]
 [/soap:Body]
[/soap:Envelope]---------------------------------------------------------------------
-------------------------------FINAL_REQ-----------------------------
-------------------This is the response from PayPal------------------
---------------------------------------------------------------------
Array
(
[Security] => 
[RequesterCredentials] => Array
	(
		[0] => Array
			(
				[Credentials] => Array
					(
						[0] => Array
							(
								[Username] => 
								[Password] => 
								[Subject] => 
							)

					)

			)

	)

[DoDirectPaymentResponse] => Array
	(
		[0] => Array
			(
				[Timestamp] => 2008-01-15T02:30:03Z
				[Ack] => Failure
				[CorrelationID] => 6c379421b5049
				[Errors] => Array
					(
						[0] => Array
							(
								[ShortMessage] => Invalid Configuration
								[LongMessage] => This transaction cannot be processed due to an invalid merchant configuration.
								[ErrorCode] => 10501
								[SeverityCode] => Error
							)

					)

				[Version] => 2.000000
				[Build] => 1.0006
				[Amount] => 4.00
			)

	)

)


---------------------------------------------------------------------
---------------------------------TS_REQ------------------------------
--------Results of the transaction search if it was executed---------
---------------------------------------------------------------------

 

Should there be a user/pass being submitted in that last section?

Link to comment
Share on other sites

Due to the large number of orders we are doing now, it is becoming VERY tedious to login to PayPal and do refunds. Does anyone know if there is a way to do this from our admin panel? It wouldn't be AS BAD, but PayPal logs you out after about 5 minutes. . .so it's constantly logging us out. Any help would be greatly appreciated. I've spent about 30 minutes looking for any threads related to the same issue.

 

Also, one more thing. . .eChecks. . .also driving us crazy. At one point, when the check would clear, it seemed the status on the order was automatically getting updated from "Pending Payment" to "Ready for Shipment", however, now we have to do this manually. Did we break it or was I dreaming that this was happening? Is there a way to automate this? Any help would be greatly appreciated.

 

Hello Kelly,

I really don't have any words of wisdom to help you, but I will throw my two cents of support here and say that we have also noticed that PayPal has become very tedious to work with. Personally, I would die to have a php script that would do what their multi-order shipping can do, only much better. But the point here is, we have noticed that PayPal has become very slow in handling a lot of things, and the frustration level with dealing with some of their applications has hit a new height for us. The problem is, PayPal offers the best type of service for our company; the ability to handle all major credit cards with only one fee, capture addresses from our customers for shipping, and offering a batch shipping label creation/payment option. I just wish PayPal would get on the ball and update these things on a more regular basis.

Brian (Schadeboy) Schade

CIO and Webmaster

Twilight Teez, LLC

 

"Camping is nature's way of promoting the hotel industry."

-Dave Barry

Link to comment
Share on other sites

@Gremlyn1: It means that you haven't completed the WPP signup process. Contact PayPal support and they'll show you what you're still missing.

Please use the forums for support! I am happy to help you here, but I am unable to offer free technical support over instant messenger or e-mail.

Link to comment
Share on other sites

Hello Kelly,

I really don't have any words of wisdom to help you, but I will throw my two cents of support here and say that we have also noticed that PayPal has become very tedious to work with. Personally, I would die to have a php script that would do what their multi-order shipping can do, only much better. But the point here is, we have noticed that PayPal has become very slow in handling a lot of things, and the frustration level with dealing with some of their applications has hit a new height for us. The problem is, PayPal offers the best type of service for our company; the ability to handle all major credit cards with only one fee, capture addresses from our customers for shipping, and offering a batch shipping label creation/payment option. I just wish PayPal would get on the ball and update these things on a more regular basis.

 

Same here! Around November it seems PayPal started crawling. I thought it was due to the holidays, however, even now, it just continues to be so slow. Logging in is dreadful. I typically login and then go do something else and then I have to remember to do the refund before I get logged out again. Drives us nuts.

 

I thought it might possibly be due to our account size? We do a very large number of transactions through PayPal, but I noticed the same delays with our personal PayPal account too. Thanks for the post!

 

Kelly

Link to comment
Share on other sites

@Gremlyn1: It means that you haven't completed the WPP signup process. Contact PayPal support and they'll show you what you're still missing.

 

Even if on the PayPal To Do List everything is completed, up to actually being able to use VT? I'll have to call them, though I spoke with a customer service guy yesterday and he said everything looked done.

Link to comment
Share on other sites

Yes. It's more than likely the billing agreement, which is kept well hidden. Contact PayPal support, tell them that you're receiving a 10501 "This transaction cannot be processed due to an invalid merchant configuration" error and have them check your account again.

Please use the forums for support! I am happy to help you here, but I am unable to offer free technical support over instant messenger or e-mail.

Link to comment
Share on other sites

dynamoeffects,

 

I have the points and rewards system setup. When customers pay via WPP, the point total isn't being deducted from their payment, however it does deduct from the order total on the invoice in admin. It works fine with check/money order. The points/rewards package does come with code on how to modify the paypal IPN code to get it to work with points/rewards, but it does not include instructions on how to get it to work with WPP.

 

Is their any way you could possibly take a look at points rewards package file called PayPal IPN 3.1.5 Modifications.txt and see if you can use that to quickly build a WPP Modifications.txt so people can use your mod and points rewords together. Thank you.

Link to comment
Share on other sites

dynamoeffects,

 

Here is the IPN modifications to get working with points/rewards:

Thank you for taking a look at this.

 

To be used with Points/Rewards Module v2.00 and the contribution Paypal Shopping Cart IPN as developped by Gregory Baboolal and then devosc
-------------------------------

In short the paypal_ipn.php file integrates some of the code that would otherwise be found in other files e.g. checkout_process.php.
In this case the code that can be found in checkout_process is replicated in the paypal_ipn file under the function: before_process()

So in order to maintain compatibility with the Points/Rewards Module v2.00 contribution you will need to remake those changes here.

The additions are as follows and can be found in the attached paypal_ipn.php file:

*** Ensure that you have already installed the PayPal IPN module: Paypal Shopping Cart IPN v3.1.5 For MS2,
  http://www.oscommerce.com/community/contributions,1753/category,all/search,ipn

------------------------------------------------------------------------------------------
Open: catalog/includes/modules/payment/paypal/catalog/checkout_process.inc.php

Find this.... (start at aprox. line no.17)

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

.. and REPLACE it with this...(we just add this 2 elements to the line $customer_shopping_points, $customer_shopping_points,)

#### Points/Rewards Module v2.00 balance customer points BOF ####
//global $payment_modules, $shipping_modules, $order, $currencies, $cart, $PayPal_osC, $customer_id,
//		 $sendto, $billto, $shipping, $payment, $language, $currency, $languages_id, $order_total_modules, $order_totals;
global $payment_modules, $shipping_modules, $order, $currencies, $cart, $PayPal_osC, $customer_id,
	 $sendto, $billto, $shipping, $payment, $language, $currency, $languages_id, $order_total_modules, $order_totals, $customer_shopping_points, $customer_shopping_points_spending, $order_total_modules;
#### Points/Rewards Module v2.00 balance customer points EOF ####*/

Find this.... (start at aprox. line no.103)

		tep_db_perform(TABLE_ORDERS_TOTAL, $sql_data_array);
	  }

.. and add this after...

#### Points/Rewards Module V2.00 balance customer points BOF ####
	  if ((USE_POINTS_SYSTEM == 'true') && (USE_REDEEM_SYSTEM == 'true')) {
// customer pending points added 
		if (($order->info['total'] > 0) && (get_award_discounted($order) == true)) {
		  $points_toadd = get_points_toadd($order);
		  $points_comment = 'TEXT_DEFAULT_COMMENT';
		  $points_type = 'SP';
		  if ((get_redemption_awards($customer_shopping_points_spending) == true) && ($points_toadd >0)) {
			tep_add_pending_points($customer_id, $this->orders_id, $points_toadd, $points_comment, $points_type);
		  }
		}
// customer referral points added 
		if ((tep_session_is_registered('customer_referral')) && (tep_not_null(USE_REFERRAL_SYSTEM))) {
		 $points_toadd = USE_REFERRAL_SYSTEM;
		 $points_comment = 'TEXT_DEFAULT_REFERRAL';
		 $points_type = 'RF';
		 tep_add_pending_points($customer_referral, $this->orders_id, $points_toadd, $points_comment, $points_type);
		}
// customer shoppping points account balanced 
		if ($customer_shopping_points_spending) {
		  tep_redeemed_points($customer_id, $this->orders_id, $customer_shopping_points_spending);
		}
	  }
#### Points/Rewards Module V2.00 balance customer points EOF ####*/

------------------------------------------------------------------------------------------
Open: catalog/includes/modules/payment/paypal/classes/osC/osC.class.php

2.   Find this.... (start at aprox. line no.50)

tep_session_unregister('sendto');
tep_session_unregister('billto');
tep_session_unregister('shipping');
tep_session_unregister('payment');
tep_session_unregister('comments');
tep_session_unregister('PayPal_osC');

... and add after.....

tep_session_unregister('customer_shopping_points');// Points/Rewards Module v2.00
tep_session_unregister('customer_shopping_points_spending');// Points/Rewards Module v2.00

Link to comment
Share on other sites

No sorry, I don't see anything there that would explain why it's not working. This module takes the order total fed to it by osCommerce. Have you applied the bugfix to your checkout_process.php file by moving the $payment->before_process() line a few lines down?

Please use the forums for support! I am happy to help you here, but I am unable to offer free technical support over instant messenger or e-mail.

Link to comment
Share on other sites

dynamoeffects,

 

I just put in the bug fix for the checkout_process.php file and now credit cards are getting declined. When I remove the bug fix the cards work fine. I tried it on a few of my own cards.

 

Here is what that code section looks like:

// load selected payment module
 require(DIR_WS_CLASSES . 'payment.php');
 $payment_modules = new payment($payment);

// load the selected shipping module
 require(DIR_WS_CLASSES . 'shipping.php');
 $shipping_modules = new shipping($shipping);

 require(DIR_WS_CLASSES . 'order.php');
 $order = new order;

// load the before_process function from the payment modules
 //$payment_modules->before_process();

 require(DIR_WS_CLASSES . 'order_total.php');
 $order_total_modules = new order_total;

 $order_totals = $order_total_modules->process();

 // load the before_process function from the payment modules
 $payment_modules->before_process();
//---PayPal WPP Modification END ---//

 $sql_data_array = array('customers_id' => $customer_id,

Link to comment
Share on other sites

Dynamoeffects - I have two questions for you. One is troubleshooting related, the other is a question for a future feature:

 

1 - I just installed the CCGV(trad) contribution by Vger, and everything's working well except for two things. One is directly related to that contribution so I won't go into the problem here. The other is related to when I'm paying through PayPal direct pay. I enter my credit card information on my site when doing a test purchase of just a gift voucher. Because only a gift voucher is my shopping cart, I do not get the screen that asks for a shipping option. However, this apparently doesn't bode well for PayPal, because I am getting the following errors when I try to confirm the order in the end:

 

Your credit card was declined. Please try another card or contact your bank for more info.

Error #1: Invalid Data (10726)
There's an error with this transaction. Please enter a complete shipping address.

Error #2: Invalid Data (10727)
There's an error with this transaction. Please enter an address1 in the shipping address.

Error #3: Invalid Data (10728)
There's an error with this transaction. Please enter a city in the shipping address.

Error #4: Invalid Data (10731)
There's an error with this transaction. Please enter a country in the shipping address.

 

I know you are/were a big supported of the CCGV(trad) contribution and was hoping you might be able to shed a little light on the subject? I have already asked this over on Vger's web site and am awaiting a response. But I thought I'd post here, too, in hopes of getting a couple more heads involved.

 

2 - I am wondering if you have considered placing code in your contribution that will automatically select the Credit Card radio button when people start entering information? I've had several people in the past enter the credit card info, but somehow the Check/Money Order option is checked. Because that is checked, all of the CC info is discarded. I'd like to see it happen where the appropriate radio button is automatically ticked when someone enters their CC information. That would solve a lot of headaches for us.

 

Thanks!

Edited by Schadeboy

Brian (Schadeboy) Schade

CIO and Webmaster

Twilight Teez, LLC

 

"Camping is nature's way of promoting the hotel industry."

-Dave Barry

Link to comment
Share on other sites

OK, I got my issued sorted. Apparently something in the automated process didn't occur, so tech support at PayPal manually went in and fixed it. All works like a charm!

Edited by Gremlyn1
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...