コード例 #1
0
        /// <summary>
        /// Returns the string that has to be sent to the Web Connector.
        /// Return null if your step has nothing to do this time. The next step will be executed immediately.
        /// </summary>
        /// <param name="authenticatedTicket">The authenticated ticket.</param>
        /// <returns>QbXml or null to execute the next step.</returns>
        public virtual async Task <string?> SendXMLAsync(IAuthenticatedTicket authenticatedTicket)
        {
            var requestObject = await ExecuteRequestAsync(authenticatedTicket);

            var requestObjectArray = requestObject?.ToArray();

            if (requestObjectArray?.Any() == true)
            {
                var qbXmlRequest = new QbXmlRequest();

                var list = new List <object>(requestObjectArray.Count());
                foreach (var request in requestObjectArray)
                {
                    list.Add(request);
                }

                qbXmlRequest.Add(new QBXMLMsgsRq
                {
                    onError = await GetOnErrorAttributeAsync(authenticatedTicket),
                    Items   = list.ToArray()
                });

                return(qbXmlRequest.GetRequest());
            }

            return(null);
        }