masspay transaction type not getting logged to dashboard.

Issue #24 closed
Drew Angell repo owner created an issue

Same as #23, but this one is with the masspay IPN types. I ran a MassPay API call, and the log file in the plugin caught it, but it didn't make it to the db/dashboard.

Comments (11)

  1. Drew Angell reporter

    In masspay have multiple transaction ID like masspay_txn_id_1, masspay_txn_id_2, masspay_txn_id_3...

    So in masspay type which Id will display in title from admin side

    Please let me know your thoughts

    What I did in my old template was loop through all of the payments on a masspay IPN and create individual mass payment records for each one. You can see that here: http://sandbox.angelleye.com/paypal/ipn/admin/mass-payments-results.php

    I realize that what we're doing here is a little different, and I don't want to delay the release of this plugin any more, so for now we could simply save the masspay IPN record without any txn_id at all, just like other IPNs that don't have txn_id's would get saved.

    What I would like to do, though, is add a new value to the $posts array that is available within the developer hooks for masspay IPNs. Just like I did in my old template, we can at least parse out the individual mass payment details and provide an array so they don't have to mess with that on their own. Here is the snippet used in my template for that.

    // Mass Payments   
    $i = 1;   
    $mass_payments = array();   
    while(isset($_POST['masspay_txn_id_' . $i]))   
    {   
     $masspay_txn_id = isset($_POST['masspay_txn_id_' . $i]) ? $_POST['masspay_txn_id_' . $i] : '';   
     $mc_currency = isset($_POST['mc_currency_' . $i]) ? $_POST['mc_currency_' . $i] : '';   
     $mc_fee = isset($_POST['mc_fee_' . $i]) ? $_POST['mc_fee_' . $i] : 0;   
     $mc_gross = isset($_POST['mc_gross_' . $i]) ? $_POST['mc_gross_' . $i] : 0;   
     $receiver_email = isset($_POST['receiver_email_' . $i]) ? $_POST['receiver_email_' . $i] : '';   
     $status = isset($_POST['status_' . $i]) ? $_POST['status_' . $i] : '';   
     $unique_id = isset($_POST['unique_id_' . $i]) ? $_POST['unique_id_' . $i] : '';   
    
     $current_payment_data_set = array(   
              'masspay_txn_id' => $masspay_txn_id,   
              'mc_currency' => $mc_currency,   
              'mc_fee' => $mc_fee,   
              'mc_gross' => $mc_gross,   
              'receiver_email' => $receiver_email,   
              'status' => $status,   
              'unique_id' => $unique_id  
             );   
    
     array_push($mass_payments, $current_payment_data_set);   
     $i++;   
    }
    

    So then we would just add that array as a new value called "mass_payments" to the $posts array to make that available with the rest of the IPN data, and then developers can simply loop through $posts['mass_payments'] without the hassle of parsing that out themselves.

    In the future we'll probably expand on this or build premium extensions that provide a lot more functionality with masspay IPNs.

  2. jignesh kaila

    Thanks for example.

    Actually empty txt_id will not able to save the transaction data because it is primary (required fields). So I have created loop and insert all the masspay txt_id insert individually in transaction listing from admin side.

    Hope this make sense, please review it and let me know your feedback for the same.

  3. Drew Angell reporter

    I just ran a test MassPay request with 3 payments on it. I wound up with 6 new transactions in my IPN dashboard because it put each of the payments in there twice. I can see 2 of each with the same transaction ID. Something must be going on with that loop causing it to enter each twice..??

  4. Drew Angell reporter

    Also, did you go ahead and make $posts['mass_payments'] available so that developers can loop through that easily within their extensions?

  5. Drew Angell reporter

    I just ran another masspay test, and now I'm thinking that maybe the issue is with PayPal. I ran the MassPay call a single time, and after a small delay I got 3 new IPN records in my dashboard. Then after another 2 min or so I got another 3 with the same transaction IDs.

    The delay was long enough that it seems like PayPal must have sent the additional IPN.

  6. Drew Angell reporter

    Yes, I can see in my PayPal IPN History that the same IPN was indeed sent twice, so nevermind about those getting created twice.

    Still want to confirm that we have $posts['mass_payments'] available now, though..??

  7. Drew Angell reporter

    Just putting notes here for reference purposes.

    We discussed over Skype that we would have the txn_type_masspay hook get triggered for each individual payment. We would also add the ipn_track_id to each one even though it will have the same value for each (since that parameter is an IPN specific parameter as opposed to a payment specific parameter).

  8. Drew Angell reporter

    Now my paypal_ipn_for_wordpress_txn_type_masspay hook isn't getting triggered at all. Before it was getting triggered just the one time regardless of how many payments were on the IPN. Now it's not triggering at all. Other hooks are still triggering just fine.

  9. Log in to comment