Ejemplo n.º 1
0
 public RequestObject(HttpMethod method, string url, Credentials credentials, object data)
 {
     _method = method;
     _url = url;
     _data = data;
     _credentials = credentials;
 }
        public string ProcessTransaction(HttpMethod method, string url, object data)
        {
            try
            {
                var authScheme = "Passcode";

                Credentials authInfo = null;
                // this request might not be using authorization
                if (_passcode != null)
                    authInfo = new Credentials(_merchantId, _passcode, authScheme);

                var requestInfo = new RequestObject(method, url, authInfo, data);

                var command = new ExecuteWebRequest(requestInfo);
                var result = _executer.ExecuteCommand(command);

                return result.Response;
            }
            catch (WebException ex) //catch web command exception
            {
                if (ex.Status != WebExceptionStatus.ProtocolError)
                {
                    throw;
                }

                throw BeanstreamApiException(ex);
            }
        }