错误:在快速预订v3中创建采购订单PHP api
问题描述:
我使用Quickbooks V3按照此包创建采购订单。 https://github.com/consolibyte/quickbooks-php错误:在快速预订v3中创建采购订单PHP api
这是我是从上面的代码中得到响应.. 2020:[必需PARAM缺失,需要为API提供所需值,要求的参数线路.DetailType中缺少请求]
以下是我的PHP代码
$PurchaseOrderService = new QuickBooks_IPP_Service_PurchaseOrder();
$PO = new QuickBooks_IPP_Object_PurchaseOrder();
$PO->setVendorRef(78);
$PO->setDocNumber('1234');
$PO->setTxnDate('2016-07-27');
$Line = new QuickBooks_IPP_Object_Line();
$Line->setDetailType('SalesItemLineDetail');
$Line->setAmount(20.0000 * 1.0000 * 0.516129);
$Line->setDescription('Test description goes here.');
$SalesItemLineDetail = new QuickBooks_IPP_Object_SalesItemLineDetail();
$SalesItemLineDetail->setItemRef(22);
$SalesItemLineDetail->setUnitPrice(20 * 0.516129);
$SalesItemLineDetail->setQty(1.00000);
$Line->addSalesItemLineDetail($SalesItemLineDetail);
$PO->addLine($Line);
if ($resp = $PurchaseOrderService->add($this->context, $this->realm, $PO)) {
return $this->getId($resp);
} else {
print($PurchaseOrderService->lastError());
}
答
你有没有造出来的任何努力来阅读文档?
请阅读文档。该文件非常清楚,有两种类型的有效Line.DetailType
的条目:
- 基于项目的费用行
- 账户为基础的费用行
您既没有使用这些的。修复代码,以便发送正确的数据,并且不会出现此错误。
这是请求的XML数据http://pastebin.com/cZd9j1QL 这是XML响应http://pastebin.com/VBg24Yiy – Sridhar
请发布您的代码。阅读文档。在问题中发布您的XML请求不要超链接,并在问题中张贴XML响应,而不是超链接。 –