Exemple #1
0
        public virtual StampResponseV4 TimbrarJsonV4(string json)
        {
            StampResponseHandlerV4 handler = new StampResponseHandlerV4();

            try
            {
                var request = RequestStampJson(json, StampTypes.v4.ToString(), _operation);
                return(handler.GetResponse(request));
            }
            catch (Exception ex)
            {
                return(handler.HandleException(ex));
            }
        }
Exemple #2
0
        public virtual StampResponseV4 TimbrarJsonV4(string json)
        {
            StampResponseHandlerV4 handler = new StampResponseHandlerV4();

            try
            {
                var           headers = GetHeaders();
                StringContent content = new StringContent(json, Encoding.UTF8, "application/jsontoxml");
                var           proxy   = Helpers.RequestHelper.ProxySettings(this.Proxy, this.ProxyPort);
                return(handler.GetPostResponse(this.Url,
                                               string.Format("v3/cfdi33/{0}/{1}/{2}",
                                                             _operation,
                                                             StampTypes.v4.ToString(),
                                                             ""), headers, content, proxy));
            }
            catch (Exception ex)
            {
                return(handler.HandleException(ex));
            }
        }
        public virtual async Task <StampResponseV4> TimbrarJsonV4Async(string json, string email = null, string customId = null, string[] extras = null)
        {
            StampResponseHandlerV4 handler = new StampResponseHandlerV4();

            try
            {
                var headers = await GetHeadersAsync(email, customId, extras);

                StringContent content = new StringContent(json, Encoding.UTF8, "application/jsontoxml");
                var           proxy   = Helpers.RequestHelper.ProxySettings(this.Proxy, this.ProxyPort);
                return(await handler.GetPostResponseAsync(this.Url,
                                                          string.Format("v4/cfdi33/{0}/{1}/{2}",
                                                                        _operation,
                                                                        StampTypes.v4.ToString(),
                                                                        ""), headers, content, proxy));
            }
            catch (Exception ex)
            {
                return(handler.HandleException(ex));
            }
        }