Fetching all Bill Payment Check from Quickbooks da

2019-08-12 02:52发布

问题:

I want to fetch all the bill payment checks from quickbooks database. Iam using PHP Quickbooks dev kit 2.0. I created a request query like this, but web connector showing error.

  function _quickbooks_billpaymentcheck_query_request($requestID, $user,       $action, $ID, $extra, &$err, $last_action_time, $last_actionident_time, $version, $locale)
  {

 $xml = '<?xml version="1.0" encoding="utf-8"?>
     <?qbxml version="2.0"?>
     <QBXML>
        <QBXMLMsgsRq onError="stopOnError">
    <BillPaymentCheckQueryRq  requestID="' . $requestID . '">

               <FromModifiedDate>1990-01-01T00:00:00</FromModifiedDate>
                <OwnerID>0</OwnerID>
            </BillPaymentCheckQueryRq>  
        </QBXMLMsgsRq>
      </QBXML>';

  return $xml;
  }   

And request code is like :-

       function _quickbooks_billpaymentcheck_query_response($requestID, $user,  $action, $ID, $extra, &$err, $last_action_time, $last_actionident_time, $xml, $idents)
     {  
          $errnum = 0;
          $errmsg = '';
          $Parser = new QuickBooks_XML_Parser($xml);
        if ($Doc = $Parser->parse($errnum, $errmsg))
         {
           $Root = $Doc->getRoot();
          $List = $Root->getChildAt('QBXML/QBXMLMsgsRs/BillPaymentCheckRs');
             foreach($List->children() as $BillPaymentCheck)
               {
        $TxnID=$BillPaymentCheck->getChildDataAt('BillPaymentCheckRet  TxnID');



    }
       }

return true;

}

Is their anything wrong with this code?? please help??

回答1:

K... I got it , In the response code

$List = $Root->getChildAt('QBXML/QBXMLMsgsRs/BillPaymentCheckRs');

changed to

$List = $Root->getChildAt('QBXML/QBXMLMsgsRs/BillPaymentCheckQueryRs');

It worked fine...