$params['L_SHIPPINGOPTIONISDEFAULT' . $cheapest_counter] = 'true'; $post_string = ''; foreach ($params as $key => $value) { $post_string .= $key . '=' . urlencode(utf8_encode(trim($value))) . '&'; } $post_string = substr($post_string, 0, -1); echo $post_string; } exit; break; case 'retrieve': // if there is nothing in the customers cart, redirect them to the shopping cart page if ($cart->count_contents() < 1) { tep_redirect(tep_href_link(FILENAME_SHOPPING_CART)); } $response_array = $paypal_express->getExpressCheckoutDetails($HTTP_GET_VARS['token']); if ($response_array['ACK'] == 'Success' || $response_array['ACK'] == 'SuccessWithWarning') { $force_login = false; // check if e-mail address exists in database and login or create customer account if (!tep_session_is_registered('customer_id')) { $force_login = true; $email_address = tep_db_prepare_input($response_array['EMAIL']); $check_query = tep_db_query("select * from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "' limit 1"); if (tep_db_num_rows($check_query)) { $check = tep_db_fetch_array($check_query); $customer_id = $check['customers_id']; $customers_firstname = $check['customers_firstname']; $customer_default_address_id = $check['customers_default_address_id']; } else { $customers_firstname = tep_db_prepare_input($response_array['FIRSTNAME']); $customers_lastname = tep_db_prepare_input($response_array['LASTNAME']);
$post_string = ''; foreach ($params as $key => $value) { $post_string .= $key . '=' . urlencode(utf8_encode(trim($value))) . '&'; } $post_string = substr($post_string, 0, -1); echo $post_string; } tep_session_destroy(); exit; break; case 'retrieve': // if there is nothing in the customers cart, redirect them to the shopping cart page if ($_SESSION['cart']->count_contents() < 1) { tep_redirect(tep_href_link(FILENAME_SHOPPING_CART, '', 'SSL')); } $response_array = $paypal_express->getExpressCheckoutDetails($_GET['token']); if ($response_array['ACK'] == 'Success' || $response_array['ACK'] == 'SuccessWithWarning') { if (!isset($_SESSION['ppe_secret']) || $response_array['PAYMENTREQUEST_0_CUSTOM'] != $ppe_secret) { tep_redirect(tep_href_link(FILENAME_SHOPPING_CART, '', 'SSL')); } if (!isset($_SESSION['payment'])) { tep_session_register('payment'); } $payment = $paypal_express->code; if (!isset($_SESSION['ppe_token'])) { tep_session_register('ppe_token'); } $ppe_token = $response_array['TOKEN']; if (!isset($_SESSION['ppe_payerid'])) { tep_session_register('ppe_payerid'); }