我正在使用 Keith Palmer 的漂亮 php 框架:docs/example_online_edition.php 与 Quickbooks 在线版帐户进行交互。
我能够检索发票信息并输入供应商记录(默认示例行为),但我无法输入发票。
我已经下载了 sdk v12 验证器,并验证了我的 xml,但没有发票出现在快速手册中。这是我的网页的输出,其中删除了登录凭据。在 curl 之前,我在 Gateway/OnlineEdition.php 中有打印语句。没有打印语句,我看不到请求 msg xml。
删除了连接信息的 XXXXX php 代码:XXXXX
<?php
/**
* Example of connecting to QuickBooks Online edition via qbXML
*
* IMPORTANT:
* IF YOU ARE BUILDING A SAAS APPLICATION (E.G. YOU ARE ALLOWING MANY OF YOUR
* CUSTOMERS TO CONNECT THEIR COMPANY FILES TO YOUR WEB APPLICATION) THEN THIS
* IS PROBABLY *NOT* THE FILE YOU SHOULD LOOKING AT. You should look at the
* Intuit Partner Platform (and thus the corresponding docs/example_ipp_*.php
* scripts) in this package.
*
*
*
* @author Keith Palmer <keith@ConsoliBYTE.com>
*
* @package QuickBooks
*/
error_reporting(E_ALL);
ini_set('display_errors', '1');
header('Content-Type: text/plain');
require_once dirname(__FILE__) . '/../QuickBooks.php';
// Register in DESKTOP mode to get these. Docs:
// http://www.consolibyte.com/docs/index.php/QuickBooks_Online_via_qbXML#Connecting_with_the_.27Desktop.27_model_of_communication
$application_id = 'goodid';
$application_login = 'goodLogin';
$connection_ticket = 'goodTicket';
// Create our new gateway instance
$Gateway = new QuickBooks_Gateway_OnlineEdition(
$application_id,
$application_login,
$connection_ticket);
// Get RefNumber 1014
$xml =
'<QBXMLMsgsRq onError="stopOnError">
<InvoiceQueryRq>
<RefNumber>1014</RefNumber>
</InvoiceQueryRq>
</QBXMLMsgsRq>';
// Send the request
$resp = $Gateway->qbxml($xml);
print($resp);
print("\n\n\n\n");
$xml = '<QBXMLMsgsRq onError="stopOnError">
<InvoiceAddRq requestID="1">
<InvoiceAdd>
<CustomerRef>
<ListID>2</ListID>
</CustomerRef>
<InvoiceLineAdd>
<ItemRef>
<FullName>Sales</FullName>
</ItemRef>
<Desc>Item1escriptionGoesHere</Desc>
<Amount>29.50</Amount>
</InvoiceLineAdd>
</InvoiceAdd>
</InvoiceAddRq>
</QBXMLMsgsRq>';
// Send the request
$resp = $Gateway->qbxml($xml);
print($resp);
print('\n\n\n\nLast print in file');
?>
XXXXX 结束 php 代码 XXXXX
XXXXX 输出开始(已删除登录) XXXXX
<?xml version="1.0" ?>
<?qbxml version="6.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<InvoiceQueryRq>
<RefNumber>1014</RefNumber>
</InvoiceQueryRq>
</QBXMLMsgsRq></QBXML>
XXXXX成功响应:
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<!DOCTYPE QBXML PUBLIC "-//INTUIT//DTD QBXML QBO 6.0//EN" "http://apps.quickbooks.com/dtds/qbxmlops60.dtd">
<QBXML>
<QBXMLMsgsRs>
<InvoiceQueryRs statusCode="0" statusMessage="Status OK" statusSeverity="Info">
<InvoiceRet>
<TxnID>19</TxnID>
<TimeCreated>2013-09-11T21:06:33</TimeCreated>
<TimeModified>2013-09-11T21:17:54</TimeModified>
<EditSequence>0</EditSequence>
<TxnNumber>19</TxnNumber>
<CustomerRef>
<ListID>3</ListID>
<FullName>Willy Wonka #442:Bertha Linebacker</FullName>
</CustomerRef>
<ARAccountRef>
<ListID>48</ListID>
<FullName>Accounts Receivable (A/R)</FullName>
</ARAccountRef>
<TxnDate>2013-09-11</TxnDate>
<RefNumber>1014</RefNumber>
<BillAddress>
<Addr1>111 Main</Addr1>
<City>Denver</City>
<State>CO</State>
<PostalCode>98310</PostalCode>
</BillAddress>
<ShipAddress>
<Addr1>111 Main</Addr1>
<City>Denver</City>
<State>CO</State>
<PostalCode>98310</PostalCode>
</ShipAddress>
<DueDate>2013-09-26</DueDate>
<Subtotal>70.00</Subtotal>
<SalesTaxPercentage>0</SalesTaxPercentage>
<AppliedAmount>0.00</AppliedAmount>
<BalanceRemaining>70.00</BalanceRemaining>
<IsPaid>false</IsPaid>
<IsToBePrinted>true</IsToBePrinted>
<InvoiceLineRet>
<TxnLineID>1</TxnLineID>
<ItemRef>
<ListID>1</ListID>
<FullName>Sales</FullName>
</ItemRef>
<Desc>tire storage (season)
RO# 57, Bertha</Desc>
<Amount>70.00</Amount>
<IsTaxable>false</IsTaxable>
</InvoiceLineRet>
</InvoiceRet>
</InvoiceQueryRs>
</QBXMLMsgsRs>
</QBXML>
XXXXXX 请求添加发票:注意客户 '2' 是有效客户
<?xml version="1.0" ?>
<?qbxml version="6.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<InvoiceAddRq requestID="1">
<InvoiceAdd>
<CustomerRef>
<ListID>2</ListID>
</CustomerRef>
<InvoiceLineAdd>
<ItemRef>
<FullName>Sales</FullName>
</ItemRef>
<Desc>Item1escriptionGoesHere</Desc>
<Amount>29.50</Amount>
</InvoiceLineAdd>
</InvoiceAdd>
</InvoiceAddRq>
</QBXMLMsgsRq></QBXML>
</QBXMLMsgsRq></QBXML>
[41] =>
[42] => 1
[64] =>
[81] => 0
)
\n\n\n\nLast print in file
XXXXXXXXX 输出结束
服务器显然没有响应 addInvoice 请求。
任何帮助解决这个谜团将不胜感激!
另外,假设我最终可以输入发票,我是否可以在 IPP API 中编写和字段?我收到的以下错误消息不是很令人鼓舞:
org.xml.sax.SAXParseException: 元素类型“InvoiceAdd”的内容必须匹配“(CustomerRef,ClassRef?,ARAccountRef?,TemplateRef?,TxnDate?,RefNumber?,BillAddress?,ShipAddress?,IsPending?,PONumber?,TermsRef ?,DueDate?,SalesRepRef?,FOB?,ShipDate?,ShipMethodRef?,ItemSalesTaxRef?,Memo?,CustomerMsgRef?,IsToBePrinted?,IsToBeEmailed?,IsTaxIncluded?,CustomerSalesTaxCodeRef?,Other?,LinkToTxnID*,(InvoiceLineAdd|InvoiceLineGroupAdd)* ,DiscountLineAdd?,SalesTaxLineAdd?,ShippingLineAdd?)"
非常感谢!