PayPal issue

I discovered an little issue on purchases after returning from PayPal: Although the purchases/payments had been completed, no discount codes were generated (can_reward() always returned false). If I see this right, this is because edd_complete_purchase is fired via the PayPal IPN and therefore the customer's purchase session isn't available anymore.

I modified the can_reward function to use an optional $payment_id parameter to determine the purchase amount in these cases. This did the trick for me.