Skip to content

Commit

Permalink
Merge pull request civicrm#11465 from jitendrapurohit/CRM-21612
Browse files Browse the repository at this point in the history
CRM-21612: Membership Payment not recorded for recurring contribution…
  • Loading branch information
eileenmcnaughton authored and sluc23 committed Jan 10, 2018
2 parents be2d510 + e3b6aae commit 7ca8341
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CRM/Core/Payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -1158,7 +1158,7 @@ protected function doDirectPayment(&$params) {
*/
public function doPayment(&$params, $component = 'contribute') {
$this->_component = $component;
$statuses = CRM_Contribute_BAO_Contribution::buildOptions('contribution_status_id');
$statuses = CRM_Contribute_BAO_Contribution::buildOptions('contribution_status_id', 'validate');

// If we have a $0 amount, skip call to processor and set payment_status to Completed.
// Conceivably a processor might override this - perhaps for setting up a token - but we don't
Expand Down
17 changes: 17 additions & 0 deletions tests/phpunit/CRM/Member/Form/MembershipTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,17 @@ public function testSubmitPartialPayment($thousandSeparator) {
* Test the submit function of the membership form.
*/
public function testSubmitRecur() {
$pendingVal = $this->callAPISuccessGetValue('OptionValue', array(
'return' => "id",
'option_group_id' => "contribution_status",
'label' => "Pending",
));
//Update label for Pending contribution status.
$this->callAPISuccess('OptionValue', 'create', array(
'id' => $pendingVal,
'label' => "PendingEdited",
));

$form = $this->getForm();

$this->callAPISuccess('MembershipType', 'create', array(
Expand All @@ -711,6 +722,12 @@ public function testSubmitRecur() {
'is_test' => TRUE,
));

//Check if Membership Payment is recorded.
$this->callAPISuccessGetCount('MembershipPayment', array(
'membership_id' => $membership['id'],
'contribution_id' => $contribution['id'],
), 1);

// CRM-16992.
$this->callAPISuccessGetCount('LineItem', array(
'entity_id' => $membership['id'],
Expand Down

0 comments on commit 7ca8341

Please sign in to comment.