Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-6445

DPS Code does not correctly add Start/End dates to memberships

    Details

      Description

      I came across issue with the DPS payment express payment processor when using a contribution page that creates memberships - When the IPN callback is made, the payment is changed to completed but the attached membership is not updated with starting/ending dates.

      Reproduce: 1. Create a contribution page using DPS which creates memberships
      2. Put a payment through with that page.
      3. The membership still has pending status, even after the 'Approved' IPN call.

      I tracked the problem to this code in PaymentExpressIPN.php:

      // Private Data consists of : a=contactID, b=contributionID,c=contributionTypeID,d=invoiceID,e=membershipID,f=participantID,g=eventID
      $privateData['contactID'] = $privateData['a'];
      $privateData['contributionID'] = $privateData['b'];
      $privateData['contributionTypeID'] = $privateData['c'];
      $privateData['invoiceID'] = $privateData['d'];

      if ( $component == "event" )

      { $privateData['participantID'] = $privateData['f']; $privateData['eventID'] = $privateData['g']; }

      else if ( $component == "contribute" ) {

      if ( count($privateData) == 5)

      { $privateData["membershipID"] = $privateData['e']; }

      }

      Which checks that the count($privateData) = 5 to determine if this is a membership-attached contribution, but since the earlier code just added 4 items to the array the correct magic number is 9.

      Attached is a patch which fixes this by recording the count before beginning to add details to $privateData, and comparing against that.

        Attachments

          Activity

            People

            • Assignee:
              rajan Rajan P Mayekar
              Reporter:
              jords Jordan Thoms
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: