【问题标题】:quickbooks sdk add paymentquickbooks sdk 添加付款
【发布时间】:2015-05-31 20:28:53
【问题描述】:

您好,我一直在尝试使用 quickbooks sdk 添加付款,到目前为止一切都很好,但是当我将请求发送到 quickbooks 时,我收到一条消息说交易是空的

这是我的示例代码: 该代码使用的是 quickbooks 中的示例公司之一,因此如果您在 c# 项目中通过此代码,它将立即运行

   private static void CreatePayment()
        {
            //var Customers = GetCustomers();
            bool sessionBegun = false;
            bool connectionOpen = false;
            QBSessionManager sessionManager = null;

            try
            {
                //Create the session Manager object
                sessionManager = new QBSessionManager();

                //Create the message set request object to hold our request
                IMsgSetRequest requestMsgSet = sessionManager.CreateMsgSetRequest("US", 8, 0);
                requestMsgSet.Attributes.OnError = ENRqOnError.roeContinue;

                //Connect to QuickBooks and begin a session
                sessionManager.OpenConnection(@"qid", "QuickBooks Integration Demo");
                connectionOpen = true;
                sessionManager.BeginSession(@"C:\Users\Public\Documents\Intuit\QuickBooks\Sample Company Files\QuickBooks Enterprise Solutions 15.0\sample_product-based business.qbw", ENOpenMode.omMultiUser);
                //sessionManager.BeginSession("", ENOpenMode.omDontCare);
                sessionBegun = true;

                IReceivePaymentAdd Payment = requestMsgSet.AppendReceivePaymentAddRq();
                Payment.CustomerRef.ListID.SetValue("260000-933272658");
                //Payment.TotalAmount.SetValue(100.00);
                //Payment.ORApplyPayment.IsAutoApply.SetValue(true);


                ////// Create the AppliedToTxn request for the payment.

                IAppliedToTxnAdd PaymentLine = Payment.ORApplyPayment.AppliedToTxnAddList.Append();
                //// Set the invoice TxnID and amount of the payment to apply
                PaymentLine.TxnID.SetValue("8B8-933372331");
                PaymentLine.PaymentAmount.SetValue(100.00);






                //Send the request and get the response from QuickBooks
                IMsgSetResponse responseMsgSet = sessionManager.DoRequests(requestMsgSet);
                IResponse response = responseMsgSet.ResponseList.GetAt(0);
                var StatusMessage = response.StatusMessage;
                Console.WriteLine(StatusMessage);



                //IReceivePaymentAdd Done = (IReceivePaymentAdd)response.Detail;

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                //MessageBox.Show(ex.Message, "Error");
            }
            finally
            {
                //End the session and close the connection to QuickBooks
                if (sessionBegun)
                {
                    sessionManager.EndSession();
                }
                if (connectionOpen)
                {
                    sessionManager.CloseConnection();
                }
            }
            Console.ReadLine();
        }

【问题讨论】:

  • 你得到的错误是什么?!
  • 没有错误,但是响应消息是“错误事务为空”

标签: c# quickbooks qbfc


【解决方案1】:

您必须发送总金额才能向 QuickBooks 添加付款。

您已将设置总金额的行注释掉:

//Payment.TotalAmount.SetValue(100.00);

取消注释就可以了。

【讨论】:

  • 已经做了,还是不行,如果你想下载源码看看,这里有下载链接intuitdeveloper.lc.intuit.com/questions/1168027
  • 在您发布的费用中,您仍然有总金额被注释掉。您需要取消注释该行。如果仍有问题,请再次检查错误消息并发布确切的错误消息
  • 我想我过去曾尝试过但没有用,现在它可以工作了,感谢您的帮助
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多