Closed dgerrells closed 6 years ago
Hi @dgerrells. Thanks for the report!
In the latest version of the SDK, I'm only seeing the conditional $amount < 0 || $amount == null
which only ensures that the amount is not negative and is not null. Is the null check the one you are referring to? Are you using an older version of it by any chance?
At any rate, I'll make a test script to check on this and ensure the behavior is correct.
You need to use the === operator to check for null because (0 == null) returns true: http://www.php.net/manual/en/types.comparisons.php
Apologies for not circling back here. We ended up pushing an update to correct this behavior (see https://github.com/hps/heartland-php/commit/22abebcea59c2ad35d54d6b59c8ce9f476d39778#diff-88a5fe91e9f6221ea73545f4867f7b71R9)
The check that is made for zero dollar transactions is using a '==' instead of '===' in HpsInputValidation.
Additionally, bypassing the check and sending to the gateway results in returning an invalid exception during the validation of a gateway response. I think this could also be due to a '==' not being a '==='
Reproducing this should be as simple as passing in '0' to a charge transaction.