You are here

function uc_paypal_ec_review_redirect in Ubercart 6.2

Same name and namespace in other branches
  1. 5 payment/uc_paypal/uc_paypal.module \uc_paypal_ec_review_redirect()
  2. 7.3 payment/uc_paypal/uc_paypal.pages.inc \uc_paypal_ec_review_redirect()
1 string reference to 'uc_paypal_ec_review_redirect'
uc_paypal_menu in payment/uc_paypal/uc_paypal.module
Implements hook_menu().

File

payment/uc_paypal/uc_paypal.pages.inc, line 168
Paypal administration menu items.

Code

function uc_paypal_ec_review_redirect() {
  if (!isset($_SESSION['TOKEN']) || ($order = uc_order_load($_SESSION['cart_order'])) == FALSE) {
    unset($_SESSION['cart_order']);
    unset($_SESSION['have_details']);
    unset($_SESSION['TOKEN'], $_SESSION['PAYERID']);
    drupal_set_message(t('An error has occurred in your PayPal payment. Please review your cart and try again.'));
    drupal_goto('cart');
  }
  $nvp_request = array(
    'METHOD' => 'GetExpressCheckoutDetails',
    'TOKEN' => $_SESSION['TOKEN'],
  );
  $nvp_response = uc_paypal_api_request($nvp_request, variable_get('uc_paypal_wpp_server', 'https://api-3t.sandbox.paypal.com/nvp'));
  $_SESSION['PAYERID'] = $nvp_response['PAYERID'];
  drupal_goto('cart/checkout/review');
}