'isRefund' => $entities['payment']['total_amount'] < 0,
'isAmountzero' => $entities['payment']['total_amount'] === 0,
'refundAmount' => ($entities['payment']['total_amount'] < 0 ? $entities['payment']['total_amount'] : NULL),
+ 'paymentsComplete' => ($entities['payment']['balance'] == 0),
];
return self::filterUntestedTemplateVariables($templateVariables);
'isAmountzero',
'refundAmount',
'totalPaid',
+ 'paymentsComplete',
];
// Need to do these before switching the form over...
$todoParams = [
- 'paymentsComplete',
'contributeMode',
'billingName',
'address',
$mut->clearMessages();
}
+ /**
+ * Test email receipt for partial payment.
+ */
+ public function testPaymentEmailReceiptFullyPaid() {
+ $mut = new CiviMailUtils($this);
+ list($lineItems, $contribution) = $this->createParticipantWithContribution();
+
+ $params = [
+ 'contribution_id' => $contribution['id'],
+ 'total_amount' => 150,
+ ];
+ $payment = $this->callAPISuccess('payment', 'create', $params);
+
+ $this->callAPISuccess('Payment', 'sendconfirmation', ['id' => $payment['id']]);
+ $mut->assertSubjects(['Payment Receipt - Annual CiviCRM meet']);
+ $mut->checkMailLog(array(
+ 'Dear Mr. Anthony Anderson II',
+ 'A payment has been received.',
+ 'Total Fees: $ 300.00',
+ 'This Payment Amount: $ 150.00',
+ 'Balance Owed: $ 0.00',
+ 'Thank you for completing payment.',
+ ));
+ $mut->stop();
+ $mut->clearMessages();
+ }
+
/**
* Test email receipt for partial payment.
*
$mut->assertSubjects(['Refund Notification - Annual CiviCRM meet']);
$mut->checkMailLog(array(
'Dear Mr. Anthony Anderson II',
+ 'A refund has been issued based on changes in your registration selections.',
'Total Fees: $ 300' . $decimalSeparator . '00',
'Refund Amount: $ -30' . $decimalSeparator . '00',
'Event Information and Location',