0

我正在尝试向 QuickBooks 添加客户和发票,但都没有出现。QuickBooks 使用以下 XML 响应:

http://pastebin.com/PLsFbA6N

我添加客户和发票的代码似乎可以正常工作,并且我没有看到任何错误:

public Customer BuildCustomerAddRq(JMAOrder _Order)
    {
        // Construct subordinate required records
        //BuildStandardTermsAddRq("Web Order");

        // build the main customer record
        Customer QBCustomerAdd = new Customer();
        var Customer = _Order.BillingAddress;
        var Billing = _Order.BillingAddress;

        PhysicalAddress phy = new PhysicalAddress();

        // if the setting is that all orders go under the same customer ID, then push 
        // the address lines down one and store the customer name on address line 1.
        if (_qboSettings.CustomerID == "SingleName")
        {
            QBCustomerAdd.DBAName = "Web Store";
            QBCustomerAdd.Email = new EmailAddress[] { new EmailAddress() { Address = "info@webstore.com", Tag = new string[] { "Business" } } };
            QBCustomerAdd.GivenName = "Web";
            QBCustomerAdd.Active = true;
            QBCustomerAdd.FamilyName = "Store";
            phy.Line1 = "Web Store";
            phy.Line2 = "";
            phy.Tag = new string[] { "Billing" };
        }

        else
        {
            //QBCustomerAdd.DBAName = GetCustId(_Order);
            QBCustomerAdd.Email = new EmailAddress[] { new EmailAddress() { Address = Customer.Email, Tag = new string[] { "Business" } } };
            QBCustomerAdd.GivenName = Customer.FirstName;
            QBCustomerAdd.Active = true;
            QBCustomerAdd.FamilyName = Customer.LastName;
            if (!String.IsNullOrEmpty(Customer.PhoneNumber))
            {
                QBCustomerAdd.Phone = new TelephoneNumber[] { new TelephoneNumber() { FreeFormNumber = Customer.PhoneNumber, Tag = new string[] { "Business" } } };
            }


            phy.Line1 = Billing.Address1;
            if (!String.IsNullOrEmpty(Billing.Address2))
            {
                phy.Line2 = Billing.Address2;
            }

            phy.City = Billing.City;
            if (Billing.RegionName != null)
            {
                phy.CountrySubDivisionCode = Billing.RegionName;
            }
            phy.PostalCode = Billing.PostalCode;
            phy.Country = Billing.CountryName;
            phy.Tag = new string[] { "Billing" };

        }

        // build add request and exit
        QBCustomerAdd.Address = new PhysicalAddress[] { phy };
        try
        {
            Customer cu = dataServices.Add(QBCustomerAdd);
            return cu;
        }
        catch (Exception ex)
        {
            ErrorMessageDataSource.Insert(new ErrorMessage(MessageSeverity.Error, "QBO", String.Format("Error adding customer : {0}", ex.ToString())));
            Customer ct = new Customer();
            return ct;

        }

当我运行 Intuit Sync Manager 时,我看不到新客户或发票。是否可以将新客户添加到 QuickBooks?

4

1 回答 1

2

客户似乎在错误状态下输入了 QuickBooks。我需要添加 QBCustomerAdd.Name 字段。

                CustomerQuery cq = new CustomerQuery();
            cq.ErroredObjectsOnly = true;
            var bList = cq.ExecuteQuery<Customer>(dataServices.ServiceContext);
于 2013-05-19T19:57:46.437 回答