PHP Classes

Errors in class file

Recommend this page to a friend!

      Paypal Invoice API  >  All threads  >  Errors in class file  >  (Un) Subscribe thread alerts  
Subject:Errors in class file
Summary:I identified a couple of errors in the class file
Messages:5
Author:Tom Fitzgerald
Date:2012-11-13 23:27:33
Update:2013-08-06 05:13:06
 

  1. Errors in class file   Reply   Report abuse  
Picture of Tom Fitzgerald Tom Fitzgerald - 2012-11-13 23:27:33
function adjustStringLength($str, $limit = 30)
{
$encode_string = urlencode($str);

$len = strlen($encode_string);

if( $len > $limit )
{
$diff = $len - $limit;
$newlimit = $limit + $diff;


return substr($str, 0, $limit+$diff-1);//FIXED was $limit-$diff-1
}
else
return substr($str, 0, $limit-1);
}
................
function prepareCreateInvoice($aryData, $aryItems)
{
{.............}
$nLoop = count($aryItems);
for($cnt=0;$cnt<$nLoop;$cnt++)
{

if(trim(@$aryItems[$cnt]['name'])!= "")
$aryCreateInvoice["invoice.itemList.item($cnt).name"] = $this->adjustStringLength($aryItems[$cnt]['name']);//FIXED was item_name
if(trim(@$aryItems[$cnt]['description'])!= "")
$aryCreateInvoice["invoice.itemList.item($cnt).description"]= $this->adjustStringLength($aryItems[$cnt]['description']);//FIXED was item_description
if(trim(@$aryItems[$cnt]['quantity'])!= "")
$aryCreateInvoice["invoice.itemList.item($cnt).quantity"] = $this->adjustStringLength($aryItems[$cnt]['quantity']);//FIXED was item_quantity
if(trim(@$aryItems[$cnt]['unitprice'])!= "")
$aryCreateInvoice["invoice.itemList.item($cnt).unitPrice"] = $this->adjustStringLength($aryItems[$cnt]['unitprice']);//FIXED was item_unitprice
...............

  2. Re: Errors in class file   Reply   Report abuse  
Picture of Fred Chen Fred Chen - 2012-12-05 05:48:27 - In reply to message 1 from Tom Fitzgerald
The correction works for me too. Many thanks.

  3. Re: Errors in class file   Reply   Report abuse  
Picture of devi devi - 2013-08-05 06:08:08 - In reply to message 1 from Tom Fitzgerald
i am getting this error please help me
Failure
Invalid request parameter: quantity must be in the range 0.001 through 9999.999 &#8594; quantity = 0.0
The invoice date is earlier than today�s date &#8594;
Invalid request parameter: logoUrl must match the pattern https:/// &#8594; logoUrl = Company Logo URL

  4. Re: Errors in class file   Reply   Report abuse  
Picture of devi devi - 2013-08-06 05:13:06 - In reply to message 2 from Fred Chen
any documentation is available ? please provide

  5. Re: Errors in class file   Reply   Report abuse  
Picture of Jim Storey Jim Storey - 2014-12-04 03:31:54 - In reply to message 1 from Tom Fitzgerald
Thanks this also helped me.