From: Eileen McNaughton Date: Sat, 2 Dec 2023 06:31:00 +0000 (+1300) Subject: Add support for financial trxn tokens X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=8b8fad1b1e5bb77641f09127507febd41d54668a;p=civicrm-core.git Add support for financial trxn tokens --- diff --git a/CRM/Financial/FinancialTrxnTokens.php b/CRM/Financial/FinancialTrxnTokens.php new file mode 100644 index 0000000000..236be716f1 --- /dev/null +++ b/CRM/Financial/FinancialTrxnTokens.php @@ -0,0 +1,29 @@ +addTag('kernel.event_subscriber')->setPublic(TRUE); } + $container->setDefinition("crm_financial_trxn_tokens", new Definition( + 'CRM_Financial_FinancialTrxnTokens', + [] + ))->addTag('kernel.event_subscriber')->setPublic(TRUE); + $container->setDefinition('civi_token_impliedcontext', new Definition( 'Civi\Token\ImpliedContextSubscriber', [] diff --git a/tests/phpunit/CRM/Utils/TokenConsistencyTest.php b/tests/phpunit/CRM/Utils/TokenConsistencyTest.php index 06dca14555..e9d2b0bcaf 100644 --- a/tests/phpunit/CRM/Utils/TokenConsistencyTest.php +++ b/tests/phpunit/CRM/Utils/TokenConsistencyTest.php @@ -9,6 +9,7 @@ +--------------------------------------------------------------------+ */ +use Civi\Api4\FinancialTrxn; use Civi\Token\TokenProcessor; use Civi\Api4\LocBlock; use Civi\Api4\Email; @@ -304,6 +305,9 @@ Czech Republic
', $html); The End Czech Republic ', $text); + $financialTrxn = FinancialTrxn::get()->addWhere('is_payment', '=', TRUE)->execute()->first(); + $text = $this->renderText(['financial_trxnId' => $financialTrxn['id']], '{financial_trxn.total_amount}', [], FALSE); + $this->assertEquals('$100.00', $text); } /**