From: Eileen McNaughton Date: Fri, 24 Nov 2023 04:32:52 +0000 (+1300) Subject: Specify tax when lines not being passed to contributon create X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=bcc0dc793487019c2c8ae2afd19a80ff556d922b;p=civicrm-core.git Specify tax when lines not being passed to contributon create --- diff --git a/tests/phpunit/CRM/Contribute/Form/Contribution/ConfirmTest.php b/tests/phpunit/CRM/Contribute/Form/Contribution/ConfirmTest.php index a5b96ead08..8c4d109108 100644 --- a/tests/phpunit/CRM/Contribute/Form/Contribution/ConfirmTest.php +++ b/tests/phpunit/CRM/Contribute/Form/Contribution/ConfirmTest.php @@ -242,6 +242,27 @@ class CRM_Contribute_Form_Contribution_ConfirmTest extends CiviUnitTestCase { $this->assertEquals(127.5, $contribution['total_amount']); } + /** + * Test the tax calculation when using a quick config price set with a membership selection & a contribution (radio) selection. + * + * Expected amount is $100 non-tax deductible + $100 with an additional $10 tax. + */ + public function testSeparatePaymentWithTaxOtherAmount(): void { + $this->enableTaxAndInvoicing(); + $this->addTaxAccountToFinancialType(CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'financial_type_id', 'Donation')); + $this->contributionPageQuickConfigCreate([], [], FALSE, TRUE, TRUE, TRUE); + $this->submitOnlineContributionForm([ + 'payment_processor_id' => $this->ids['PaymentProcessor']['dummy'], + 'price_' . $this->ids['PriceField']['other_amount'] => 100, + 'price_' . $this->ids['PriceField']['membership_amount'] => $this->ids['PriceFieldValue']['membership_general'], + 'id' => $this->getContributionPageID(), + ] + $this->getBillingSubmitValues(), $this->getContributionPageID()); + + $contribution = $this->callAPISuccessGetSingle('Contribution', ['contribution_page_id' => $this->getContributionPageID(), 'version' => 4]); + $this->assertEquals(10, $contribution['tax_amount']); + $this->assertEquals(210, $contribution['total_amount']); + } + /** * Test the confirm form with a separate membership payment configured. */