Keith Palmer の素敵な php フレームワーク: docs/example_online_edition.php を使用して、Quickbooks Online Edition アカウントとやり取りしています。
請求書情報を取得し、仕入先レコードを入力することはできますが (デフォルトの動作例)、請求書を入力することはできません。
SDK v12 バリデーターをダウンロードし、xml を検証しましたが、クイックブックに請求書が表示されません。これは、サインオン資格情報が削除された私の Web ページの出力です。curl の直前に、Gateway/OnlineEdition.php に print ステートメントがあります。print ステートメントがないと、リクエスト 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>
XXXXX 請求書の追加リクエスト: 顧客 '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?)"
どうもありがとうございました!