Exemplo n.º 1
0
        private BoardingResponse BuildResponse(GatewayResponse response, string message = null)
        {
            if (response.StatusCode == HttpStatusCode.OK)
            {
                string applicationId = "0";
                if (response.RequestUrl.Contains("ThankYou"))
                {
                    applicationId = response.RequestUrl.Substring(response.RequestUrl.IndexOf("=") + 1);
                }

                return(new BoardingResponse {
                    ApplicationId = int.Parse(applicationId),
                    Message = ParseResponse(response.RawResponse)
                });
            }
            else
            {
                throw new GatewayException(message ?? "Unknown application submission error.");
            }
        }
        private BoardingResponse BuildResponse(GatewayResponse response, string message = null)
        {
            if (response.StatusCode == HttpStatusCode.OK)
            {
                var boardingResponse = new BoardingResponse();

                if (response.RequestUrl.Contains("ThankYou"))
                {
                    boardingResponse.ApplicationId = int.Parse(response.RequestUrl.Substring(response.RequestUrl.IndexOf("=") + 1));
                    boardingResponse.Message       = ParseResponse(response.RawResponse);
                }
                else if (response.RequestUrl.Contains("sign.myhpy.com"))
                {
                    boardingResponse.SignatureUrl = response.RequestUrl;
                    boardingResponse.Message      = "Thank you for your submission.";
                }

                return(boardingResponse);
            }
            else
            {
                throw new GatewayException(message ?? "Unknown application submission error.");
            }
        }