Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.2.0

Bug #12402 Amount for transaction may not be negative
Submitted: 2007-11-08 16:58 UTC
From: ikke007 Assigned: walter
Status: Closed Package: Payment_Clieop (version 0.1.2)
PHP Version: 5.2.3 OS: n/a
Roadmaps: 1.0.0    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 15 + 2 = ?

 
 [2007-11-08 16:58 UTC] ikke007 (Mark van Straten)
Description: ------------ The ClieOp specification specifies that the amount for an transaction can not be negative. Currently no checks are applied so the negative amounts result in the output beeing invalid. Test script: --------------- $transaction = new TransactionPayment(CLIEOP_TRANSACTIE_BETALING); $transaction->setAccountNumberSource($account_from); $transaction->setAccountNumberDest($account_to); $transaction->setAmount(-12995); $transaction->setName($owner); $transaction->setCity($city); $transaction->setDescription('here is your money'); $clieopFile->addPayment($transaction); Expected result: ---------------- error (or exception) or typecast to positive amount Actual result: -------------- negative amount in clieop output

Comments

 [2008-03-29 00:07 UTC] walter (Walter Hop)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. Added a check for this. I added a few lines to the examples, so that it's clear how to check if this error has occurred. For instance, you can do: $result = $clieopFile->addPayment($debtor); if (PEAR::isError($result)) { exit ("Error in payment: ".$result->getMessage()); } Upcoming documentation will get a blurb about this too. It was (and still is) pretty easy to generate invalid clieops, and I will add a lot more checks.