Esempio n. 1
0
        public virtual StampResponseV1 TimbrarJsonV1(string json)
        {
            StampResponseHandlerV1 handler = new StampResponseHandlerV1();

            try
            {
                var request = RequestStampJson(json, StampTypes.v1.ToString(), _operation);
                return(handler.GetResponse(request));
            }
            catch (Exception ex)
            {
                return(handler.HandleException(ex));
            }
        }
Esempio n. 2
0
        public virtual StampResponseV1 TimbrarJsonV1(string json)
        {
            StampResponseHandlerV1 handler = new StampResponseHandlerV1();

            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.v1.ToString(),
                                                             ""), headers, content, proxy));
            }
            catch (Exception ex)
            {
                return(handler.HandleException(ex));
            }
        }
Esempio n. 3
0
        public virtual async Task <StampResponseV1> TimbrarJsonV1Async(string json, string email = null, string customId = null, string[] extras = null)
        {
            StampResponseHandlerV1 handler = new StampResponseHandlerV1();

            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.v1.ToString(),
                                                                        ""), headers, content, proxy));
            }
            catch (Exception ex)
            {
                return(handler.HandleException(ex));
            }
        }