Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Major
-
Resolution: Fixed/Completed
-
Affects Version/s: 3.1.5
-
Fix Version/s: 3.2
-
Component/s: CiviContribute, CiviMember, Core CiviCRM
-
Labels:None
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.