Exemple #1
0
        public async Task <ApiResponse <TokenResponse> > Login(LoginRequest loginRequest)
        {
            var headers = new Dictionary <string, string>();

            headers.Add("content-type", "application/x-www-form-urlencoded");

            var paramters = ClientHelper.AddParameter(loginRequest);

            var requestModel = new RemoteApiRequest {
                Route = "token", Parameters = paramters, Headers = headers, Method = Method.POST
            };

            return(await ClientHelper.SendRequest <TokenResponse>(requestModel));
        }
        public async Task <ApiResponse <SendInvoiceResponse> > Send(NESInvoiceSendRequest request)
        {
            string auth = GetHeaderTitle("authorization");

            if (string.IsNullOrEmpty(auth))
            {
                return(ResponseHelper.CreateApiResponse <SendInvoiceResponse>(null, "Authorization Header Must Have", 400, true));
            }

            var headers = new Dictionary <string, string>();

            headers.Add("content-type", "application/json");
            headers.Add("authorization", auth);

            var parameters = ClientHelper.AddParameter(request);

            var remoteRequestModel = new RemoteApiRequest {
                Method = RestSharp.Method.POST, Route = "invoicegeneral/sendNESInvoice", Headers = headers, Parameters = parameters
            };

            return(await ClientHelper.SendRequest <SendInvoiceResponse>(remoteRequestModel));
        }