Exemplo n.º 1
0
        internal override async Task <CancelationResponse> Cancelar(string pfx, string rfc, string password, string uuid)
        {
            CancelationResponseHandler handler = new CancelationResponseHandler();

            try
            {
                new Validation(Url, User, Password, Token).ValidateHeaderParameters();
                var headers = await GetHeadersAsync();

                var content = this.RequestCancelar(pfx, rfc, password, uuid);
                var proxy   = Helpers.RequestHelper.ProxySettings(this.Proxy, this.ProxyPort);
                return(await handler.GetPostResponseAsync(this.Url,
                                                          "cfdi33/cancel/pfx", headers, content, proxy));
            }
            catch (Exception e)
            {
                return(handler.HandleException(e));
            }
        }
Exemplo n.º 2
0
        internal override async Task <CancelationResponse> Cancelar(string rfc, string uuid)
        {
            CancelationResponseHandler handler = new CancelationResponseHandler();

            try
            {
                new Validation(Url, User, Password, Token).ValidateHeaderParameters();
                HttpWebRequest request = await this.RequestCancelarAsync(rfc, uuid);

                request.ContentType   = "application/json";
                request.ContentLength = 0;
                request.Method        = WebRequestMethods.Http.Post;
                var proxy   = Helpers.RequestHelper.ProxySettings(this.Proxy, this.ProxyPort);
                var headers = await GetHeadersAsync();

                return(await handler.GetPostResponseAsync(this.Url, headers, $"cfdi33/cancel/{rfc}/{uuid}", proxy));
            }
            catch (Exception e)
            {
                return(handler.HandleException(e));
            }
        }