Esempio n. 1
0
        //---------------------------------------------------------------------------------------------
        /// <summary>
        /// Handle an error response from HMRC
        /// </summary>
        /// <param name="aResponse"></param>
        private int ProcessErrorResponse(VAT100_BusinessErrorResponse aResponse)
        {
            // The response was not good news
            string errorNarrative = string.Empty;

            int Result = 0;

            VAT100BusinessResponseDetails details = aResponse.GovTalkDetails;

            if (details.GovTalkErrors.Count > 0)
            {
                for (int index = 0; index < details.GovTalkErrors.Count; index++)
                {
                    GovTalkError error = details.GovTalkErrors[index];
                    errorNarrative += error.Error.Text + "\n\r\n\r";
                }
            }

            // GovTalkErrors done.  Now look for messages in the <Body>
            if (aResponse.Body.ErrorResponse != null)
            {
                if (aResponse.Body.ErrorResponse.ErrorList.Length > 0)
                {
                    foreach (VAT100_ErrorResponseError error in aResponse.Body.ErrorResponse.ErrorList)
                    {
                        errorNarrative += error.Text + "\n\r\n\r";
                        errorNarrative += error.Location + "\n\r";
                    }
                }
            }

            // Update its status
            FPendingDocument.theDocument.status = Convert.ToInt16(SubmissionStatus.ssError);

            // Add the narrative
            FPendingDocument.theDocument.hmrcNarrative = errorNarrative;

            // Save the record
            Result = VAT100Database.Instance.UpdateVAT100Entry(FPendingDocument.theDocument, FPendingDocument.companyCode);

            return(Result);
        }
Esempio n. 2
0
        private int ProcessErrorResponse(VAT100_BusinessErrorResponse aResponse)
        {
            // The response was not good news
            string errorNarrative = string.Empty;

            int Result = 0;

            VAT100BusinessResponseDetails details = aResponse.GovTalkDetails;

            if (details.GovTalkErrors.Count > 0)
            {
                for (int index = 0; index < details.GovTalkErrors.Count; index++)
                {
                    GovTalkError error = details.GovTalkErrors[index];
                    errorNarrative += error.Error.Text + "\n\r\n\r";
                }
            }

            // GovTalkErrors done.  Now look for messages in the <Body>
            if (aResponse.Body.ErrorResponse != null)
            {
                if (aResponse.Body.ErrorResponse.ErrorList.Length > 0)
                {
                    foreach (VAT100_ErrorResponseError error in aResponse.Body.ErrorResponse.ErrorList)
                    {
                        errorNarrative += error.Text + "\n\r\n\r";
                        errorNarrative += error.Location + "\n\r";
                    }
                }
            }

            // Add the narrative
            textNarrative.AppendText(errorNarrative + "\r\n\r\n");

            return(Result);
        }