Stripe processor issue - RoundingNecessaryException on online contribution form to create a membership on behalf of an organization
Overview
When creating an online contribution form to create a membership on behalf of an organization and using a Membership Price Set with Taxes I am getting a RoundingNecessaryException. I've solved the issue with a workaround in civicrm/civicrm/vendor/brick/money/src/Money.php line 186 replacing manually the RoundingMode in the Money function from UNNECESSARY to CEILING.
Tax display is showing the exclusive price.
Link to the conversation on chat.civicrm.org: https://chat.civicrm.org/civicrm/pl/k6xf6skkhid3uqndhtwppfugmc
I'm using
- CiviCRM 5.72.1
- Wordpress Version 6.5.2
- AdminUI (Preview): Version 5.72.1
- AuthX: Version 5.72.1
- CiviCampaign: Version 5.72.1
- CiviContribute: Version 5.72.1
- CiviDiscount: Version 3.8.11
- CiviEvent: Version 5.72.1
- CiviMail: Version 5.72.1
- CiviMember: Version 5.72.1
- CiviPledge: Version 5.72.1
- CiviReport: Version 5.72.1
- CiviRules: Version 3.4
- CKEditor4: Version 5.72.1
- Contact Editor: Version 2.4
- Contribution cancel actions: Version 5.72.1
- Custom search framework: Version 5.72.1
- Email API: Version 2.14
- Event Cart: Version 5.72.1
- Financial ACLs: Version 5.72.1
- Firewall: Version 1.5.9
- FlexMailer: Version 5.72.1
- FormBuilder: Version 5.72.1
- Form Code Editor: Version 5.72.1
- Form Core: Version 5.72.1
- Member Only Event: Version 1.3.1
- Message Administration: Version 5.72.1
- Mosaico: Version 3.5.1709296836
- Payment Shared: Version 1.2.22
- PayPal Payflow Pro Integration: Version 5.72.1
- Profile Conditionals: Version 1.7.0
- reCAPTCHA: Version 5.72.1
- Report Plus: Version 2.7.3
- SearchKit: Version 5.72.1
- Sequential credit notes: Version 5.72.1
- Stripe Payment Processor: Version 6.10.2
- Sweet Alert: Version 1.6
- Theme: Greenwich: Version 5.72.1
- User Dashboard: Version 5.72.1
- Variable Recur Payments: Version 1.2
Here's the stack trace:
#0 /var/www/vhosts/bi.gen-europe.org/httpdocs/wp-content/plugins/civicrm/civicrm/vendor/brick/math/src/Internal/Calculator.php(516): Brick\Math\Exception\RoundingNecessaryException::roundingNecessary()
#1 /var/www/vhosts/bi.gen-europe.org/httpdocs/wp-content/plugins/civicrm/civicrm/vendor/brick/math/src/BigDecimal.php(276): Brick\Math\Internal\Calculator->divRound()
#2 /var/www/vhosts/bi.gen-europe.org/httpdocs/wp-content/plugins/civicrm/civicrm/vendor/brick/math/src/BigDecimal.php(722): Brick\Math\BigDecimal->dividedBy()
#3 /var/www/vhosts/bi.gen-europe.org/httpdocs/wp-content/plugins/civicrm/civicrm/vendor/brick/money/src/Context/DefaultContext.php(23): Brick\Math\BigDecimal->toScale()
#4 /var/www/vhosts/bi.gen-europe.org/httpdocs/wp-content/plugins/civicrm/civicrm/vendor/brick/money/src/Money.php(157): Brick\Money\Context\DefaultContext->applyTo()
#5 /var/www/vhosts/bi.gen-europe.org/httpdocs/wp-content/plugins/civicrm/civicrm/vendor/brick/money/src/Money.php(198): Brick\Money\Money::create()
#6 /var/www/vhosts/bi.gen-europe.org/httpdocs/wp-content/uploads/civicrm/ext/com.drastikbydesign.stripe/CRM/Core/Payment/Stripe.php(259): Brick\Money\Money::of()
#7 /var/www/vhosts/bi.gen-europe.org/httpdocs/wp-content/uploads/civicrm/ext/com.drastikbydesign.stripe/CRM/Core/Payment/Stripe.php(613): CRM_Core_Payment_Stripe->getAmountFormattedForStripeAPI()
#8 /var/www/vhosts/bi.gen-europe.org/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Contribute/Form/Contribution/Confirm.php(1563): CRM_Core_Payment_Stripe->doPayment()
#9 /var/www/vhosts/bi.gen-europe.org/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Contribute/Form/Contribution/Confirm.php(1357): CRM_Contribute_Form_Contribution_Confirm->postProcessMembership()
#10 /var/www/vhosts/bi.gen-europe.org/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Contribute/Form/Contribution/Confirm.php(2371): CRM_Contribute_Form_Contribution_Confirm->processMembership()
#11 /var/www/vhosts/bi.gen-europe.org/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Contribute/Form/Contribution/Confirm.php(2196): CRM_Contribute_Form_Contribution_Confirm->doMembershipProcessing()
#12 /var/www/vhosts/bi.gen-europe.org/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Contribute/Form/Contribution/Confirm.php(797): CRM_Contribute_Form_Contribution_Confirm->processFormSubmission()
#13 /var/www/vhosts/bi.gen-europe.org/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php(646): CRM_Contribute_Form_Contribution_Confirm->postProcess()
#14 /var/www/vhosts/bi.gen-europe.org/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/StateMachine.php(144): CRM_Core_Form->mainProcess()
#15 /var/www/vhosts/bi.gen-europe.org/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/QuickForm/Action/Next.php(43): CRM_Core_StateMachine->perform()
#16 /var/www/vhosts/bi.gen-europe.org/httpdocs/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Next->perform()
#17 /var/www/vhosts/bi.gen-europe.org/httpdocs/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle()
#18 /var/www/vhosts/bi.gen-europe.org/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(355): HTML_QuickForm_Page->handle()
#19 /var/www/vhosts/bi.gen-europe.org/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(325): CRM_Core_Controller->run()
#20 /var/www/vhosts/bi.gen-europe.org/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(69): CRM_Core_Invoke::runItem()
#21 /var/www/vhosts/bi.gen-europe.org/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(36): CRM_Core_Invoke::_invoke()
#22 /var/www/vhosts/bi.gen-europe.org/httpdocs/wp-content/plugins/civicrm/civicrm.php(1231): CRM_Core_Invoke::invoke()
#23 /var/www/vhosts/bi.gen-europe.org/httpdocs/wp-content/plugins/civicrm/includes/civicrm.basepage.php(425): CiviCRM_For_WordPress->invoke()
#24 /var/www/vhosts/bi.gen-europe.org/httpdocs/wp-includes/class-wp-hook.php(324): CiviCRM_For_WordPress_Basepage->basepage_handler()
#25 /var/www/vhosts/bi.gen-europe.org/httpdocs/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#26 /var/www/vhosts/bi.gen-europe.org/httpdocs/wp-includes/plugin.php(565): WP_Hook->do_action()
#27 /var/www/vhosts/bi.gen-europe.org/httpdocs/wp-includes/class-wp.php(830): do_action_ref_array()
#28 /var/www/vhosts/bi.gen-europe.org/httpdocs/wp-includes/functions.php(1336): WP->main()
#29 /var/www/vhosts/bi.gen-europe.org/httpdocs/wp-blog-header.php(16): wp()
#30 /var/www/vhosts/bi.gen-europe.org/httpdocs/index.php(17): require("/var/www/vhosts/bi.gen-europe.org/httpdocs/wp-blog-header.php")
#31 {main}