我已经使用quickbooks桌面php库大约一年了。我在当前系统中的基本工作流程是:
。通过进行api调用来排队请求。 。将qwc文件导入连接器中并运行。它将从服务器拉入排队的请求,进行处理,然后将响应返回给服务器。
这是我的代码库的样子: https://github.com/consolibyte/quickbooks-php/blob/master/docs/web_connector/example_web_connector.php
通过遵循上述代码库,我可以查询发票,客户,帐户,项目...等。但是我要求获取未存款付款清单的请求无效。我从这里获得了请求xml:
https://developer-static.intuit.com/qbSDK-current/Common/newOSR/index.html
只需从下拉列表中选择“ ReceivePaymentToDepositQueryRq”,您就会看到xml。我还打印了在日志中形成的最终请求xml。看起来像这样:
<?xml version =“ 1.0” encoding =“ utf-8”?>
<?qbxml version =“ 13.0”?>
<QBXMLMsgsRq onError="stopOnError">
<ReceivePaymentToDepositQueryRq metaData="MetaDataAndResponseData">
<IncludeRetElement>TxnLineID</IncludeRetElement>
<IncludeRetElement>TxnType</IncludeRetElement>
<IncludeRetElement>CustomerRef</IncludeRetElement>
<IncludeRetElement>TxnDate</IncludeRetElement>
<IncludeRetElement>RefNumber</IncludeRetElement>
<IncludeRetElement>Amount</IncludeRetElement>
<IncludeRetElement>CurrencyRef</IncludeRetElement>
<IncludeRetElement>ExchangeRate</IncludeRetElement>
<IncludeRetElement>AmountInHomeCurrency</IncludeRetElement>
</ReceivePaymentToDepositQueryRq>
</QBXMLMsgsRq>
到目前为止,一切看起来都很不错。但是问题是我没有得到结果。它甚至没有提供任何更麻烦的错误细节。你们当中的任何一个都可以帮助我,那将是很棒的。预先感谢。
注意:在上面的xml中,我尝试了带和不带
按照@Keith在评论中的要求,我在此处添加了我的代码:
function _quickbooks_ReceivePaymentToDeposit_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="13.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<ReceivePaymentToDepositQueryRq metaData="MetaDataAndResponseData">
<IncludeRetElement>TxnLineID</IncludeRetElement>
<IncludeRetElement>TxnType</IncludeRetElement>
<IncludeRetElement>CustomerRef</IncludeRetElement>
<IncludeRetElement>TxnDate</IncludeRetElement>
<IncludeRetElement>RefNumber</IncludeRetElement>
<IncludeRetElement>Amount</IncludeRetElement>
<IncludeRetElement>CurrencyRef</IncludeRetElement>
<IncludeRetElement>ExchangeRate</IncludeRetElement>
<IncludeRetElement>AmountInHomeCurrency</IncludeRetElement>
</ReceivePaymentToDepositQueryRq>
</QBXMLMsgsRq>
</QBXML>';
return $xml;
}
函数_quickbooks_ReceivePaymentToDeposit_response($ requestID,$ user,$ action,$ ID,$ extra,&$ err,$ last_action_time,$ last_actionident_time,$ xml,$ idents) {
$Createdon = date('Ymd');
$file = "logs/$Createdon.txt";
if (!file_exists($file)) {
$myFile = fopen($file, "w") or die("Unable to open file!");
fclose($myFile);
}
$current = file_get_contents($file);
$current .= "\n\n" . date("h:i:sa") . "\n" . $xml . "\n";
file_put_contents($file, $current);
}