diff --git a/CRM/Core/Payment/BaseIPN.php b/CRM/Core/Payment/BaseIPN.php index eeff13606e4ab324529bfe94b67259c20b0c015f..3976560052fb1a937debca4a8caadf044746a742 100644 --- a/CRM/Core/Payment/BaseIPN.php +++ b/CRM/Core/Payment/BaseIPN.php @@ -502,6 +502,7 @@ LIMIT 1;"; $contribution->trxn_id = $input['trxn_id']; $contribution->receive_date = CRM_Utils_Date::isoToMysql($contribution->receive_date); $contribution->thankyou_date = CRM_Utils_Date::isoToMysql($contribution->thankyou_date); + $contribution->receipt_date = CRM_Utils_Date::isoToMysql($contribution->receipt_date); $contribution->cancel_date = 'null'; if (CRM_Utils_Array::value('check_number', $input)) { diff --git a/tests/phpunit/api/v3/ContributionTest.php b/tests/phpunit/api/v3/ContributionTest.php index c05465c93185a85f1faa8af2d6571371c0c9a119..df1ccfac77b3406f27214950b0935f62075af19f 100644 --- a/tests/phpunit/api/v3/ContributionTest.php +++ b/tests/phpunit/api/v3/ContributionTest.php @@ -1230,6 +1230,31 @@ class api_v3_ContributionTest extends CiviUnitTestCase { $mut->stop(); } + /** + * CRM-14151 + * Test completing a transaction via the API + * + * For wierd caching-y reasons this test performs differently in isolation than with other + * tests. + */ + function testCompleteTransactionWithReceiptDateSet() { + $mut = new CiviMailUtils( $this, true ); + $this->createLoggedInUser(); + $params = array_merge($this->_params, array('contribution_status_id' => 1,'receipt_date' => 'now')); + $contribution = $this->callAPISuccess('contribution','create', $params); + $apiResult = $this->callAPISuccess('contribution', 'completetransaction', array( + 'id' => $contribution['id'], + ) + ); + $contribution = $this->callAPISuccess('contribution', 'get', array('id' => $contribution['id'], 'sequential' => 1,)); + $this->assertEquals('Completed', $contribution['values'][0]['contribution_status']); + $mut->checkMailLog(array( + 'Receipt - Contribution', + 'Please print this confirmation for your records.', + )); + $mut->stop(); + } + /** * Test completing a transaction with an event via the API *