finish_waiting_payment never called

Discussion in 'Customization & add-ons' started by simplifier1, May 27, 2012.

  1. simplifier1

    simplifier1 New Member

    Joined:
    Dec 15, 2010
    Messages:
    20
    I have extra processing to add at the end of new purchases. I set up the extra processing function in the fwp plugin.

    When payments are added to a customer via the admin function "Add new Payment/Subscription" everything works perfectly. For debugging purposes the code calls a tracing function that sends emails with trace information. The trace emails arrive exactly as I expected, and the db modifications all work exactly as desired.

    HOWEVER:
    When I make test purchases using the PayPal sandbox (and paypal_r plugin), my fwp hook is never called! I know this because a) the programmed modifications do not appear and b) No tracing emails are received. One of these calls is the first statement in the function hooked into fwp.

    The purchase goes through, the payment records get added with the correct receipt numbers, etc., etc.. No fwp plugin call.

    What am I doing wrong? Or, what do I have to do to make this plugin work with an actual customer payment?
  2. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    Can you show exact code that you use?
  3. simplifier1

    simplifier1 New Member

    Joined:
    Dec 15, 2010
    Messages:
    20
    Mystery solved.

    The fwp hook was not working (or even tracing) because the function I wrote was expecting two arguments: $payment_id and $member_id.

    When run using the admin code, both arguments were always supplied. However, when called from the PayPal postback code, the function receives only the payment id argument. The following statement at the beginning of the code was killing both the processing and the trace:
    PHP:
    if (!($member_id 0)) return; // This code does not apply to any non-member payments

    Now that I changed the function so it first pulls the member id out of the payment array, everything now works as expected. With PayPal, at least.

    My only remaining testing issue is that Google checkout sandbox keeps all purchases in perpetual "Customer review in process" state. The only postback occurring is a pending purchase notice. Does anyone have any idea how to force a GCO sandbox purchase out of the "review" state? Seems to me that "customer review" should be instantaneous for a sandbox customer. ??? Bizarre.

Share This Page