}
else {
if (empty($input['IAmAHorribleNastyBeyondExcusableHackInTheCRMEventFORMTaskClassThatNeedsToBERemoved'])) {
- if ($event->is_email_confirm) {
- // @todo this should be set by the function that sends the mail after sending.
- $contributionParams['receipt_date'] = $changeDate;
- }
$participantParams['id'] = $participant->id;
$participantParams['status_id'] = 'Registered';
civicrm_api3('Participant', 'create', $participantParams);
*
* @param string $thousandSeparator
*
- * @dataProvider getThousandSeparators
+ * @throws \CRM_Core_Exception
+ * @throws \CiviCRM_API3_Exception
*
- * @throws \Exception
+ * @dataProvider getThousandSeparators
*/
public function testPaidSubmit($thousandSeparator) {
$this->setCurrencySeparators($thousandSeparator);
$this->assertEquals(8000.67, $contribution['total_amount']);
$this->assertEquals(1.67, $contribution['fee_amount']);
$this->assertEquals(7999, $contribution['net_amount']);
+ $this->assertNotEmpty($contribution['receipt_date']);
$this->assertNotContains(' (multiple participants)', $contribution['amount_level']);
$lastFinancialTrxnId = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnId($contribution['id'], 'DESC');
$financialTrxn = $this->callAPISuccessGetSingle(
$this->validateAllPayments();
}
+ /**
+ * Test contribution receipts triggered by Payment.create with is_send_contribution_notification = TRUE.
+ *
+ * @throws \CRM_Core_Exception
+ */
+ public function testPaymentSendContributionReceipt() {
+ $mut = new CiviMailUtils($this);
+ $contribution = $this->createPartiallyPaidParticipantOrder();
+ $event = $this->callAPISuccess('Event', 'get', []);
+ $this->addLocationToEvent($event['id']);
+ $params = [
+ 'contribution_id' => $contribution['id'],
+ 'total_amount' => 150,
+ 'check_number' => '345',
+ 'trxn_date' => '2018-08-13 17:57:56',
+ 'is_send_contribution_notification' => TRUE,
+ ];
+ $this->callAPISuccess('Payment', 'create', $params);
+ $contribution = $this->callAPISuccessGetSingle('Contribution', ['id' => $contribution['id']]);
+ $this->assertNotEmpty($contribution['receipt_date']);
+ $mut->checkMailLog([
+ 'Price Field - Price Field 1 1 $ 100.00 $ 100.00',
+ 'event place',
+ 'streety street',
+ ]);
+ }
+
/**
* Test email receipt for partial payment.
*
'event place',
'streety street',
]);
- $mut->stop();
- $mut->clearMessages();
$this->validateAllPayments();
}
'Balance Owed: $ 0.00',
'Thank you for completing this payment.',
]);
- $mut->stop();
- $mut->clearMessages();
$this->validateAllPayments();
}
'Transaction Date: November 13th, 2018 12:01 PM',
'Total Paid: $ 170' . $decimalSeparator . '00',
]);
- $mut->stop();
- $mut->clearMessages();
$this->validateAllPayments();
}