| Project: | Ubercart Popular Product |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | fixed |
Jump to:
In this case I'm talking about the function uc_paypal_ipn, where the payment_status is switched - to be exact the Completed-case. Let's look at the affected code part:
uc_payment_enter($order_id, 'paypal_wps', $payment_amount, $order->uid, NULL, $comment);
uc_cart_complete_sale($order);First of all uc_payment_enter is called. Since this function potentially triggers functions, that may change the current order object (e. g. by changing the order state), the $order variable passed to uc_cart_complete_sale won't contain that changes. A simple solutions is to load the order object again after applying uc_payment_enter:
uc_payment_enter($order_id, 'paypal_wps', $payment_amount, $order->uid, NULL, $comment);
uc_cart_complete_sale(uc_order_load($order_id));I also don't understand, why here first uc_payment_enter and then uc_cart_complete_sale are applied. I'm not that involved into the core of drupal/ubercart, but logically uc_cart_complete_sale should be applied before uc_payment_enter!?
