Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRM-18027: No credit card transaction details after 4.7 update #9147

Merged
merged 2 commits into from
Oct 3, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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