Skip to content

Commit

Permalink
Merge pull request #9147 from monishdeb/CRM-18027
Browse files Browse the repository at this point in the history
CRM-18027: No credit card transaction details after 4.7 update
  • Loading branch information
colemanw authored Oct 3, 2016
2 parents fb689c3 + 128d44a commit d6afbe0
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
6 changes: 5 additions & 1 deletion CRM/Contribute/BAO/Contribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -2801,6 +2801,11 @@ public function _assignMessageVariablesToTemplate(&$values, $input, &$template,
$template->assign('first_name', $this->_relatedObjects['contact']->first_name);
$template->assign('last_name', $this->_relatedObjects['contact']->last_name);
$template->assign('displayName', $this->_relatedObjects['contact']->display_name);

// For some unit tests contribution cannot contain paymentProcessor information
$billingMode = empty($this->_relatedObjects['paymentProcessor']) ? CRM_Core_Payment::BILLING_MODE_NOTIFY : $this->_relatedObjects['paymentProcessor']['billing_mode'];
$template->assign('contributeMode', CRM_Utils_Array::value($billingMode, CRM_Core_SelectValues::contributeMode()));

if (!empty($values['lineItem']) && !empty($this->_relatedObjects['membership'])) {
$values['useForMember'] = TRUE;
}
Expand Down Expand Up @@ -2884,7 +2889,6 @@ public function _assignMessageVariablesToTemplate(&$values, $input, &$template,
CRM_Utils_Date::processDate($this->receive_date)
);
$values['receipt_date'] = (empty($this->receipt_date) ? NULL : $this->receipt_date);
$template->assign('contributeMode', 'notify');
$template->assign('action', $this->is_test ? 1024 : 1);
$template->assign('receipt_text',
CRM_Utils_Array::value('receipt_text',
Expand Down
11 changes: 11 additions & 0 deletions CRM/Core/SelectValues.php
Original file line number Diff line number Diff line change
Expand Up @@ -1012,6 +1012,17 @@ public static function billingMode() {
);
}

/**
* @return array
*/
public static function contributeMode() {
return array(
CRM_Core_Payment::BILLING_MODE_FORM => 'direct',
CRM_Core_Payment::BILLING_MODE_BUTTON => 'directIPN',
CRM_Core_Payment::BILLING_MODE_NOTIFY => 'notify',
);
}

/**
* Frequency unit for schedule reminders.
*
Expand Down
27 changes: 27 additions & 0 deletions tests/phpunit/api/v3/ContributionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2593,9 +2593,36 @@ public function testSendMail() {
'Event',
)
);

$this->checkCreditCardDetails($mut, $contribution['id']);
$mut->stop();
}

/**
* Check credit card details in sent mail via API
*
* @param $mut obj CiviMailUtils instance
* @param int $contributionID Contribution ID
*
*/
public function checkCreditCardDetails($mut, $contributionID) {
$contribution = $this->callAPISuccess('contribution', 'create', $this->_params);
$this->callAPISuccess('contribution', 'sendconfirmation', array(
'id' => $contributionID,
'receipt_from_email' => 'api@civicrm.org',
'payment_processor_id' => $this->paymentProcessorID,
)
);
$mut->checkMailLog(array(
'Credit Card Information', // credit card header
'Billing Name and Address', // billing header
'anthony_anderson@civicrm.org', // billing name
), array(
'Event',
)
);
}

/**
* Test sending a mail via the API.
*/
Expand Down

0 comments on commit d6afbe0

Please sign in to comment.