I am trying to do a simple condition where if the total of my previous transaction + the amount I want to charge on the credit is smaller or equal to the total amount invoice than I can charge the amount on the credit card
$amount_to_charge = (float)$_REQUEST['cc_amount'];
Log::error("PAID TYPE : ".gettype(($book->totalPaid() + $amount_to_charge)));
Log::error("Total Type : ".gettype($book->bookedGrandTotal()));
Log::error(($book->totalPaid() + $amount_to_charge)." <= ".$book->bookedGrandTotal());
if(($book->totalPaid() + $amount_to_charge) <= $book->bookedGrandTotal())
{
Log::error("AMT OK");
}
else
{
Log::error("AMT NOT OK");
$error['ERROR'] = "The maximal amount you can charge is : $".($book->bookedGrandTotal()-$book->totalPaid());
}
Log response :
[2018-08-02 10:01:24] dev.ERROR: PAID TYPE : double
[2018-08-02 10:01:24] dev.ERROR: Total Type : double
[2018-08-02 10:01:24] dev.ERROR: 142.56 <= 142.56
[2018-08-02 10:01:24] dev.ERROR: AMT NOT OK
142.56 is supposed to be equal to 142.56 so I should enter in my if statement?