2013-02-21 65 views
1

我們從Magento導入訂單和付款數據到Quickbooks桌面版。以下是兩個查詢 - 這些查詢成功,但沒有數據導入。對我們有什麼想法?導入訂單,付款從Magento到Quickbooks桌面

首先,我們創建一個查詢,形成訂單堆

$qb_order = new QuickBooks_IPP_Object_Invoice(); 

     $qb_meta = new QuickBooks_IPP_Object_MetaData(); 
     $qb_meta->setCreateTime($order->getCreatedAt()); 
     $qb_meta->setLastUpdatedTime($order->getUpdatedAt()); 
     $qb_order->setMetaData($qb_meta); 

     $qb_header = new QuickBooks_IPP_Object_Header(); 
     $qb_header->setDocNumber($order->getIncrementId()); 
     if (!$qb_customer_id = $this->_getQbCustomerId($order->getCustomerId())) return false; 
     $qb_header->setCustomerId($qb_customer_id); 
     $qb_header->setShipDate($order->getDeliveryDate()); 
     $qb_header->setSubTotalAmt($order->getBaseSubtotal()); 
     $qb_header->setTaxAmt($order->getBaseTaxAmount()); 
     $qb_header->setTotalAmt($order->getBaseGrandTotal()); 
     $qb_header->setARAccountId("Accounts Receivable"); 

     if ($address = $order->getBillingAddress()) { 
      $qb_header->setBillAddr($this->_convertAddress($address, "Billing")); 
     } 

     if ($address = $order->getShippingAddress()) { 
      $qb_header->setShipAddr($this->_convertAddress($address, "Shipping")); 
     } 

     $qb_header->setDiscountAmt($order->getBaseDiscountAmount()); 
     $qb_order->setHeader($qb_header); 

     foreach($order->getItemsCollection() as $item) { 
      $qb_order->addLine($this->_convertOrderItem($item)); 
    } 

這裏是XML,這是查詢之後形成:

<?xml version="1.0" encoding="UTF-8"?> 
<Add xmlns="http://www.intuit.com/sb/cdm/v2" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    RequestId="4562cdf8407178e362082c0441dffa74" 
    xsi:schemaLocation="http://www.intuit.com/sb/cdm/v2 ./RestDataFilter.xsd "> 
    <OfferingId>ipp</OfferingId> 
    <ExternalRealmId>631645715</ExternalRealmId> 
    <Object xsi:type="Invoice"> 
     <Header> 
      <DocNumber>100001570</DocNumber> 
      <CustomerId>103699</CustomerId> 
      <ShipDate>2013-02-21</ShipDate> 
      <SubTotalAmt>33.0000</SubTotalAmt> 
      <TaxAmt>2.6400</TaxAmt> 
      <TotalAmt>35.64</TotalAmt> 
      <ARAccountId>Accounts Receivable</ARAccountId> 
      <BillAddr> 
       <Line1>⁣</Line1> 
       <Line2></Line2> 
       <Line3></Line3> 
       <Line4></Line4> 
       <City>⁣</City> 
       <Country>⁣</Country> 
       <CountrySubDivisionCode>⁣</CountrySubDivisionCode> 
       <PostalCode>⁣</PostalCode> 
       <Tag>Billing</Tag> 
      </BillAddr> 
      <ShipAddr> 
       <Line1>⁣</Line1> 
       <Line2></Line2> 
       <Line3></Line3> 
       <Line4></Line4> 
       <City>⁣</City> 
       <Country>⁣</Country> 
       <CountrySubDivisionCode>⁣</CountrySubDivisionCode> 
       <PostalCode>⁣</PostalCode> 
       <Tag>Shipping</Tag> 
      </ShipAddr> 
      <DiscountAmt>0.0000</DiscountAmt> 
     </Header> 
     <Line> 
      <Desc>Special Product For POS 
sdf</Desc> 
      <Amount>33.0000</Amount> 
      <ItemType>Product</ItemType> 
      <UnitPrice>33.0000</UnitPrice> 
      <Qty>1</Qty> 
     </Line> 
    </Object> 
</Add> 

這裏是服務器響應:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
<RestResponse xmlns="http://www.intuit.com/sb/cdm/v2"> 
    <Success RequestId="4562cdf8407178e362082c0441dffa74"> 
    <ObjectRef> 
     <Id idDomain="NG">494527</Id> 
     <SyncToken>1</SyncToken> 
     <LastUpdatedTime>2013-02-21T05:44:12Z</LastUpdatedTime> 
    </ObjectRef> 
    <RequestName>InvoiceAdd</RequestName> 
    <ProcessedTime>2013-02-21T05:44:12Z</ProcessedTime> 
    </Success> 
</RestResponse> 

=============================================== ==================

這是用於根據訂單創建付款的第二組代碼。同樣同樣的問題,成功的XML但沒有數據的輸入:

$order = Mage::getModel("sales/order")->load($invoice->getOrderId()); 
     if (!$qb_order_id = $this->getHelper()->getObjectQbId($order)) return false; 
     $qb_payment = new QuickBooks_IPP_Object_Payment(); 

     $qb_meta = new QuickBooks_IPP_Object_MetaData(); 
     $qb_meta->setCreateTime($invoice->getCreatedAt()); 
     $qb_meta->setLastUpdatedTime($invoice->getUpdatedAt()); 
     $qb_payment->setMetaData($qb_meta); 

     $qb_header = new QuickBooks_IPP_Object_Header(); 
     $qb_header->setDocNumber($invoice->getIncrementId()); 
     $qb_header->setTxnDate($invoice->getCreatedAt()); 
     if (!$qb_customer_id = $this->_getQbCustomerId($order->getCustomerId())) return false; 
     $qb_header->setCustomerId($qb_customer_id); 
     $qb_header->setTotalAmt($invoice->getBaseGrandTotal()); 
     $qb_header->setProcessPayment('false'); 

     $qb_payment->setHeader($qb_header); 

     $qb_line = new QuickBooks_IPP_Object_Line(); 
     $qb_line->setAmount($invoice->getBaseGrandTotal()); 
     $qb_line->setTxnId($qb_order_id); 
     $qb_payment->addLine($qb_line); 

這裏是XML,它的代碼後形成:

<?xml version="1.0" encoding="UTF-8"?> 
<Add xmlns="http://www.intuit.com/sb/cdm/v2" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    RequestId="dc07317b838eb3d0c89e310b4984468a" 
    xsi:schemaLocation="http://www.intuit.com/sb/cdm/v2 ./RestDataFilter.xsd "> 
    <OfferingId>ipp</OfferingId> 
    <ExternalRealmId>631645715</ExternalRealmId> 
    <Object xsi:type="Payment"> 
     <Header> 
      <DocNumber>100000265</DocNumber> 
      <TxnDate>2013-02-21</TxnDate> 
      <CustomerId>103699</CustomerId> 
      <TotalAmt>35.64</TotalAmt> 
      <ProcessPayment>false</ProcessPayment> 
     </Header> 
     <Line> 
      <Amount>35.6400</Amount> 
      <TxnId>494527</TxnId> 
     </Line> 
    </Object> 
</Add> 

下面是來自服務器的應答:

<?xml version="1.0" ?> 
<RestResponse xmlns="http://www.intuit.com/sb/cdm/v2"> 
    <Success RequestId="dc07317b838eb3d0c89e310b4984468a"> 
    <ObjectRef> 
     <Id idDomain="NG">494529</Id> 
     <SyncToken>1</SyncToken> 
     <LastUpdatedTime>2013-02-21T05:48:07Z</LastUpdatedTime> 
    </ObjectRef> 
    <RequestName>PaymentAdd</RequestName> 
    <ProcessedTime>2013-02-21T05:48:07Z</ProcessedTime> 
    </Success> 
</RestResponse> 

回答

1

首先,要明確一點,確保您正在爲正確的平臺構建 - 根據Intuit FAQs(截至2013年2月),如果這是針對貴公司的內部集成,則不應使用Intuit Anywh ERE/IPP。 FAQ:

問:我想將自定義(非SaaS,單租戶)解決方案與Intuit Anywhere集成。我可以這樣做嗎?

答:不是今天,但我們正在考慮它。

作爲一個備註,對於QuickBooks for Windows的內部集成,Web連接器比Intuit Anywhere更加可靠,更易於排除故障。

所有這些......您的問題可能與訂單項以及您所指的項目有關。在QuickBooks中,每個訂單項都附加到QuicKBooks中的特定項目記錄(它是GUI中的「項目名稱/ SKU」下拉菜單)。

你行項目,但是:

<Line> 
    <Desc>Special Product For POS sdf</Desc> 
    <Amount>33.0000</Amount> 
    <ItemType>Product</ItemType> 
    <UnitPrice>33.0000</UnitPrice> 
    <Qty>1</Qty> 
    </Line> 

只是指一個項目的 「類型」(例如, 「庫存」, 「產品」, 「服務」 等)。

你應該有一個標籤在每一行項目之一:

<ItemName>Your QuickBooks Item Name</ItemName> 

或者:

<ItemId>123</ItemId> 

如果你看一下documentation或一些QuickBooks IDS/Intuit Anywhere examples的浮動各地的網絡,你會看到他們都在每個訂單項中使用ItemName或ItemId。

您可能還想研究how to fetch the write back errors,因爲它可以提供更多信息(值得注意的是,PHP DevKit目前沒有用於獲取這些錯誤的本機方法,但這是我們正在研究的內容 - 聯繫我如果你需要進一步的幫助)。

+0

便箋和無恥自我插件 - 有商業Magento + QuickBooks集成已經在那裏,你可能也想看看:http://consolibyte.com/quickbooks-integration/magento-quickbooks/ – 2013-02-21 12:32:23

相關問題