58 lines
1.3 KiB
C#
58 lines
1.3 KiB
C#
using BeWo.Data.Entities;
|
|
using BeWo.Service.Core;
|
|
using BS.Shared.Core;
|
|
using BS.Shared.Core.Facade;
|
|
using BS.Shared.DataContracts;
|
|
using DevExpress.XtraRichEdit.Model;
|
|
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Configuration;
|
|
using System.Linq;
|
|
using System.Security.Policy;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace BeWo.Service.ServiceProxy
|
|
{
|
|
public class XRechnungApiClient
|
|
{
|
|
private readonly JsonHttpClientFacade _JsonHttpClientFacade;
|
|
|
|
public XRechnungApiClient() : this(MergedConfig.GetSetting(WebConfigSetting.XRechnungApiUrl)) { }
|
|
public XRechnungApiClient(string base_url)
|
|
{
|
|
_JsonHttpClientFacade = new JsonHttpClientFacade(base_url);
|
|
}
|
|
|
|
public ApiResponse<byte[]> Create(object xrechnung)
|
|
{
|
|
_JsonHttpClientFacade.JsonObject = new
|
|
{
|
|
json = xrechnung
|
|
};
|
|
|
|
var bytes = _JsonHttpClientFacade.SendAsync("create").GetAwaiter().GetResult();
|
|
|
|
var response = ApiResponse<byte[]>.Parse(bytes);
|
|
|
|
return response;
|
|
}
|
|
|
|
public ApiResponse<byte[]> Create(object xrechnung, string url)
|
|
{
|
|
_JsonHttpClientFacade.JsonObject = new
|
|
{
|
|
json = xrechnung,
|
|
pdf = url
|
|
};
|
|
|
|
var bytes = _JsonHttpClientFacade.SendAsync("create").GetAwaiter().GetResult();
|
|
|
|
var response = ApiResponse<byte[]>.Parse(bytes);
|
|
|
|
return response;
|
|
}
|
|
}
|
|
}
|