Example #1
0
        /// <summary>
        /// Obtain a listing of all valid payment types in Quickbooks.
        /// </summary>
        /// <returns>a list of all quickbooks payment types</returns>
        public List <QuickbooksPaytype> getPaymentTypes()
        {
            List <QuickbooksPaytype> paymentTypes = new List <QuickbooksPaytype>();
            IMsgSetRequest           msgRequest   = qbMgr.CreateMsgSetRequest("US", 4, 0);

            msgRequest.Attributes.OnError = ENRqOnError.roeStop;
            msgRequest.AppendPaymentMethodQueryRq();
            IMsgSetResponse       response        = qbMgr.DoRequests(msgRequest);
            IPaymentMethodRetList payment_methods = (IPaymentMethodRetList)response.ResponseList.GetAt(0).Detail;

            for (int i = 0; i < payment_methods.Count; i++)
            {
                paymentTypes.Add(new QuickbooksPaytype()
                {
                    Name = payment_methods.GetAt(i).Name.GetValue()
                });
            }

            return(paymentTypes);
        }