setAmount requires a numeric amount value
Overview
Since https://github.com/civicrm/civicrm-core/pull/21583 our installation has a problem with making contribution payments through the contribution checksum link fails if the Thousands Separator and Decimal Delimiter are different than default.
Reproduction steps
- create a pending contribution
- set locale to the following:
(common in the Netherlands) - pay through a contribution link with checksum
(example: https://www.example.nl/civicrm/contribute/transact?reset=1&id=7&ccid=123&cid=456&cs=9982c0a392534059a7ae6b4f970f394c_1650623762_5648) - payment fails with: setAmount requires a numeric amount value (reproduced on the sandbox)
Current behaviour
With Thousands Separator set to . and Decimal Delimiter set to , (as we do in the Netherlands) contribution checksum link payments fail
Expected behaviour
The payments should succeed :-)
Environment information
- CiviCRM: 5.48
- CMS: Drupal 7.89
- PHP: 7.4.29 (fpm-fcgi)
- Database: 10.5.15-MariaDB-0+deb11u1 engine: InnoDB 10 row format: Dynamic
- Webserver: Apache/2.4.53 (Debian)
- OS: Linux
Comments
First I thought this had to do with omnipaymultiprocessor but this morning I tested with some more different payment methods
We found https://github.com/civicrm/civicrm-core/pull/21583 to be the change that caused our problem. Specifically in Civi/Payment/PropertyBag.php the line about 'total_amount'
protected static $propMap = [
'amount' => TRUE,
'total_amount' => 'amount',
When we remove the 'total_amount' line payments work fine, even with our decimal separator settings. I am not sure if that would be the solution or only helps to find a real solution.
NOTE: integral payments with event registrations work fine. It is the payment links that are affected.
@mattwire would you be able to look into this?