$this->callAPISuccess('Payment', 'sendconfirmation', ['id' => $payment['id']]);
$mut->assertSubjects(['Payment Receipt - Annual CiviCRM meet']);
$mut->checkMailLog([
+ 'From: "FIXME" <info@EXAMPLE.ORG>',
'Dear Anthony,',
'Total Fees: $ 300.00',
'This Payment Amount: $ 50.00',
*/
public function testPaymentEmailReceiptFullyPaid() {
$mut = new CiviMailUtils($this);
+ CRM_Core_Config::singleton()->userPermissionClass->permissions = ['access CiviContribute', 'edit contributions', 'access CiviCRM'];
list($lineItems, $contribution) = $this->createParticipantWithContribution();
$params = [
];
$payment = $this->callAPISuccess('payment', 'create', $params);
- $this->callAPISuccess('Payment', 'sendconfirmation', ['id' => $payment['id']]);
+ // Here we set the email to an invalid email & use check_permissions, domain email should be used.
+ $email = $this->callAPISuccess('Email', 'create', ['contact_id' => 1, 'email' => 'bob@example.com']);
+ $this->callAPISuccess('Payment', 'sendconfirmation', ['id' => $payment['id'], 'from' => $email['id'], 'check_permissions' => 1]);
$mut->assertSubjects(['Payment Receipt - Annual CiviCRM meet', 'Registration Confirmation - Annual CiviCRM meet']);
$mut->checkMailLog([
+ 'From: "FIXME" <info@EXAMPLE.ORG>',
'Dear Anthony,',
'A payment has been received.',
'Total Fees: $ 300.00',
'This Payment Amount: $ 150.00',
'Balance Owed: $ 0.00',
- 'Thank you for completing payment.',
+ 'Thank you for completing this payment.',
]);
$mut->stop();
$mut->clearMessages();
/**
* Test create payment api for pay later contribution with partial payment.
*
- * @throws \Exception
+ * https://lab.civicrm.org/dev/financial/issues/69
+ */
+ public function testCreatePaymentIncompletePaymentPartialPayment() {
+ $contributionParams = [
+ 'total_amount' => 100,
+ 'currency' => 'USD',
+ 'contact_id' => $this->_individualId,
+ 'financial_type_id' => 1,
+ 'contribution_status_id' => 2,
+ ];
+ $contribution = $this->callAPISuccess('Contribution', 'create', $contributionParams);
+ $this->callAPISuccess('Payment', 'create', [
+ 'contribution_id' => $contribution['id'],
+ 'total_amount' => 50,
+ 'payment_instrument_id' => 'Cash',
+ ]);
+ $payments = $this->callAPISuccess('Payment', 'get', ['contribution_id' => $contribution['id']])['values'];
+ $this->assertCount(1, $payments);
+ }
+
+ /**
+ * Test create payment api for pay later contribution with partial payment.
*/
public function testCreatePaymentPayLaterPartialPayment() {
$this->createLoggedInUser();