function uc_paypal_complete in Ubercart 5
Same name and namespace in other branches
- 6.2 payment/uc_paypal/uc_paypal.pages.inc \uc_paypal_complete()
- 7.3 payment/uc_paypal/uc_paypal.pages.inc \uc_paypal_complete()
1 string reference to 'uc_paypal_complete'
- uc_paypal_menu in payment/
uc_paypal/ uc_paypal.module - Implementation of hook_menu().
File
- payment/
uc_paypal/ uc_paypal.module, line 734 - Integrates various PayPal payment services and Instant Payment Notifications (IPN) with Ubercart!
Code
function uc_paypal_complete($order_id = 0) {
// If the order ID specified in the return URL is not the same as the one in
// the user's session, we need to assume this is either a spoof or that the
// user tried to adjust the order on this side while at PayPal. If it was a
// legitimate checkout, the IPN will still come in from PayPal so the order
// gets processed correctly. We'll leave an ambiguous message just in case.
if (intval($_SESSION['cart_order']) != $order_id) {
drupal_set_message(t('Thank you for your order! We will be notified by PayPal that we have received your payment.'));
drupal_goto('cart');
}
if (!($order = uc_order_load($order_id)) || $order->payment_method != 'paypal_wps') {
drupal_goto('cart');
}
// This lets us know it's a legitimate access of the complete page.
$_SESSION['do_complete'] = TRUE;
drupal_goto('cart/checkout/complete');
}