Umgeschrieben auf Sevdesk
This commit is contained in:
@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.6.33815.320
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp3", "ConsoleApp3\ConsoleApp3.csproj", "{4CB462A0-22BB-4E70-9C0B-203560329AFE}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CardMarketBot", "ConsoleApp3\CardMarketBot.csproj", "{4CB462A0-22BB-4E70-9C0B-203560329AFE}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@@ -8,7 +8,14 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="RestSharp" Version="110.2.0" />
|
||||
<PackageReference Include="Selenium.WebDriver" Version="4.10.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="usedList.csv">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -3,16 +3,8 @@
|
||||
using OpenQA.Selenium.Chrome;
|
||||
using OpenQA.Selenium;
|
||||
using System.Net;
|
||||
|
||||
/*
|
||||
*
|
||||
* referalPage: /de/OnePiece
|
||||
username: Skywalkerex
|
||||
userPassword: Magnatpower310!!
|
||||
/de/OnePiece/PostGetAction/User_Login
|
||||
|
||||
curbpJUJmtup1t.Tq0awbHIhIRwhzMW7vrsWxLAJu.pI9X4r
|
||||
*/
|
||||
using System.Diagnostics;
|
||||
using ConsoleApp3.Contracts;
|
||||
|
||||
namespace CardmarketBot
|
||||
{
|
||||
@@ -20,6 +12,7 @@ namespace CardmarketBot
|
||||
{
|
||||
private readonly string username;
|
||||
private readonly string password;
|
||||
private readonly IUsedRepository _usedRepository;
|
||||
|
||||
Dictionary<string, Helper.Porto> portoberechnung = new Dictionary<string, Helper.Porto>()
|
||||
{
|
||||
@@ -31,10 +24,11 @@ namespace CardmarketBot
|
||||
{"3,20 €", Helper.Porto.PRIO270 },
|
||||
};
|
||||
|
||||
public CardMarketParser(string username, string password)
|
||||
public CardMarketParser(string username, string password, IUsedRepository repository)
|
||||
{
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
_usedRepository = repository;
|
||||
}
|
||||
|
||||
public List<Kunde> ParseCardMarket()
|
||||
@@ -65,27 +59,39 @@ namespace CardmarketBot
|
||||
cookieContainer.Add(new System.Net.Cookie(name, value, c.Path, c.Domain));
|
||||
}
|
||||
|
||||
//cd.Navigate().GoToUrl(@"https://www.cardmarket.com/de/OnePiece/Orders/Sales/Paid");
|
||||
cd.Navigate().GoToUrl(@"https://www.cardmarket.com/de/OnePiece/Orders/Sales/Sent");
|
||||
|
||||
IWebElement element = cd.FindElement(By.XPath("/html/body/main/section/div[3]/div[3]/div[2]"));
|
||||
string content = element.Text;
|
||||
|
||||
string[] datas = content.Split("\r\n");
|
||||
cd.Navigate().GoToUrl(@"https://www.cardmarket.com/de/OnePiece/Orders/Sales/Paid");
|
||||
//cd.Navigate().GoToUrl(@"https://www.cardmarket.com/de/OnePiece/Orders/Sales/Sent");
|
||||
|
||||
List<string> ids = new List<string>();
|
||||
for (int i = 0; i < datas.Length; i += 7)
|
||||
{
|
||||
ids.Add(datas[i]);
|
||||
}
|
||||
|
||||
List<Kunde> kunden = new List<Kunde>();
|
||||
IWebElement element;
|
||||
try
|
||||
{
|
||||
element = cd.FindElement(By.XPath("/html/body/main/section/div[3]/div[3]/div[2]"));
|
||||
string content = element.Text;
|
||||
|
||||
int maxCounter = 2;
|
||||
int counter = 0;
|
||||
List<string> bereitsbearbeitet = _usedRepository.Query;
|
||||
string[] datas = content.Split("\r\n");
|
||||
|
||||
|
||||
for (int i = 0; i < datas.Length; i += 7)
|
||||
{
|
||||
if (bereitsbearbeitet.Find(x => x.Equals(datas[i])) != null) continue;
|
||||
ids.Add(datas[i]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
catch(OpenQA.Selenium.NotFoundException ex)
|
||||
{
|
||||
Console.WriteLine("Keine Verkäufe aktuell");
|
||||
return kunden;
|
||||
}
|
||||
|
||||
foreach (string id in ids)
|
||||
{
|
||||
if (counter > maxCounter) break;
|
||||
|
||||
Console.WriteLine(id);
|
||||
cd.Navigate().GoToUrl(string.Format(@"https://www.cardmarket.com/de/OnePiece/Orders/{0}", id));
|
||||
element = cd.FindElement(By.XPath("/html/body/main/section/div/div[1]/div/div[3]/div[2]/div[2]/div/div"));
|
||||
@@ -94,12 +100,22 @@ namespace CardmarketBot
|
||||
|
||||
// Bezahldatum
|
||||
element = cd.FindElement(By.XPath("/html/body/main/section/div/div[1]/div/div[2]/div/div[2]/div[2]"));
|
||||
kunde.Bezahldatum = element.Text;
|
||||
//Debugger.Break();
|
||||
kunde.Bezahldatum = Helper.ConvertBezahlDatum(element.Text);
|
||||
|
||||
|
||||
// Versandkosten
|
||||
element = cd.FindElement(By.XPath("/html/body/main/section/div/div[1]/div/div[3]/div[1]/div[2]/div/div[3]/span[2]"));
|
||||
kunde.Versandskosten = portoberechnung[element.Text];
|
||||
Helper.Porto resul;
|
||||
if(portoberechnung.TryGetValue(element.Text, out resul))
|
||||
{
|
||||
kunde.Versandskosten = resul;
|
||||
}
|
||||
else
|
||||
{
|
||||
kunde.OverrideVersandskosten = element.Text;
|
||||
Console.WriteLine(@"Achtung bei ID {id} wurde kein Richtige Porto berechnet. Liegt es im Ausland?");
|
||||
}
|
||||
//kunde.Versandskosten = portoberechnung[element.Text];
|
||||
kunde.BestellungID = id;
|
||||
|
||||
|
||||
@@ -111,7 +127,6 @@ namespace CardmarketBot
|
||||
|
||||
|
||||
kunden.Add(kunde);
|
||||
counter++;
|
||||
Thread.Sleep(TimeSpan.FromSeconds(5));
|
||||
}
|
||||
return kunden;
|
||||
|
||||
15
ConsoleApp3/Contracts/IUsedRepository.cs
Normal file
15
ConsoleApp3/Contracts/IUsedRepository.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ConsoleApp3.Contracts
|
||||
{
|
||||
internal interface IUsedRepository
|
||||
{
|
||||
List<string> Query { get; }
|
||||
//void Insert(string key);
|
||||
void Insert(List<Kunde> kunden);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
namespace ConsoleApp3.DataContracts
|
||||
{
|
||||
public record Employee(string Name, int Number);
|
||||
}
|
||||
@@ -2,44 +2,558 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace ConsoleApp3.DataContracts
|
||||
{
|
||||
internal class Invoice
|
||||
{
|
||||
[JsonProperty("id")] public string Id { get; set; }
|
||||
//[JsonProperty("organizationId")] public string OrganizationId { get; set; }
|
||||
[JsonProperty("createdDate")] public string CreatedDate { get; set; }
|
||||
[JsonProperty("updatedDate")] public string UpdatedDate { get; set; }
|
||||
[JsonProperty("version")] public decimal Version { get; set; }
|
||||
[JsonProperty("language")] public string Language { get; set; }
|
||||
[JsonProperty("archived")] public bool Archived { get; set; }
|
||||
[JsonProperty("voucherStatus")] public string VoucherStatus { get; set; }
|
||||
[JsonProperty("voucherNumber")] public string VoucherNumber { get; set; }
|
||||
[JsonProperty("voucherDate")] public string VoucherDate { get; set; }
|
||||
[JsonProperty("dueDate")] public string DueDate { get; set; }
|
||||
[JsonProperty("address")] public InvoiceAddress Address { get; set; }
|
||||
[JsonProperty("lineItems")] public List<InvoiceLineItem> LineItems { get; set; }
|
||||
[JsonProperty("totalPrice")] public TotalPrice TotalPrice { get; set; }
|
||||
[JsonProperty("taxConditions")] public TaxConditions TaxConditions { get; set; }
|
||||
[JsonProperty("shippingConditions")] public ShippingConditions ShippingConditions { get; set; }
|
||||
[JsonProperty(PropertyName ="id")]
|
||||
public int? Id { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "objectName")]
|
||||
public string ObjectName { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "invoiceNumber", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "invoiceNumber")]
|
||||
public string InvoiceNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// the contact the invoice belongs to
|
||||
/// </summary>
|
||||
/// <value>the contact the invoice belongs to</value>
|
||||
[DataMember(Name = "contact", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "contact")]
|
||||
public ModelContact Contact { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// the date the invoice was created
|
||||
/// </summary>
|
||||
/// <value>the date the invoice was created</value>
|
||||
[DataMember(Name = "create", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "create")]
|
||||
public DateTime? Create { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// the date the invoice was last updated
|
||||
/// </summary>
|
||||
/// <value>the date the invoice was last updated</value>
|
||||
[DataMember(Name = "update", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "update")]
|
||||
public DateTime? Update { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// the date of the invoice
|
||||
/// </summary>
|
||||
/// <value>the date of the invoice</value>
|
||||
[DataMember(Name = "invoiceDate", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "invoiceDate")]
|
||||
public DateTime? InvoiceDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// header/subject of the invoice
|
||||
/// </summary>
|
||||
/// <value>header/subject of the invoice</value>
|
||||
[DataMember(Name = "header", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "header")]
|
||||
public string Header { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// head text of the invoice
|
||||
/// </summary>
|
||||
/// <value>head text of the invoice</value>
|
||||
[DataMember(Name = "headText", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "headText")]
|
||||
public string HeadText { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// foot text of the invoice
|
||||
/// </summary>
|
||||
/// <value>foot text of the invoice</value>
|
||||
[DataMember(Name = "footText", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "footText")]
|
||||
public string FootText { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// time left for paying the invoice, use format dd.MM.yyyy or number for number of days left
|
||||
/// </summary>
|
||||
/// <value>time left for paying the invoice, use format dd.MM.yyyy or number for number of days left</value>
|
||||
[DataMember(Name = "timeToPay", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "timeToPay")]
|
||||
public DateTime? TimeToPay { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
/*[DataMember(Name = "discountTime", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "discountTime")]
|
||||
public DateTime? DiscountTime { get; set; }
|
||||
*/
|
||||
/// <summary>
|
||||
/// the discount value in '%'
|
||||
/// </summary>
|
||||
/// <value>the discount value in '%'</value>
|
||||
[DataMember(Name = "discount", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "discount")]
|
||||
public float? Discount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// the name in the address, equals the contacts name
|
||||
/// </summary>
|
||||
/// <value>the name in the address, equals the contacts name</value>
|
||||
[DataMember(Name = "addressName", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "addressName")]
|
||||
public string AddressName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// the street in the address, equals the contacts street
|
||||
/// </summary>
|
||||
/// <value>the street in the address, equals the contacts street</value>
|
||||
[DataMember(Name = "addressStreet", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "addressStreet")]
|
||||
public string AddressStreet { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// the zip-code in the address, equals the contacts zip
|
||||
/// </summary>
|
||||
/// <value>the zip-code in the address, equals the contacts zip</value>
|
||||
[DataMember(Name = "addressZip", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "addressZip")]
|
||||
public string AddressZip { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// the city in the address, equals the contacts city
|
||||
/// </summary>
|
||||
/// <value>the city in the address, equals the contacts city</value>
|
||||
[DataMember(Name = "addressCity", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "addressCity")]
|
||||
public string AddressCity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// the country in the address, equals the contacts country
|
||||
/// </summary>
|
||||
/// <value>the country in the address, equals the contacts country</value>
|
||||
[DataMember(Name = "addressCountry", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "addressCountry")]
|
||||
public ModelStaticCountry AddressCountry { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// time left for paying the invoice, use format DD.MM.YYYY or number for number of days left
|
||||
/// </summary>
|
||||
/// <value>time left for paying the invoice, use format DD.MM.YYYY or number for number of days left</value>
|
||||
[DataMember(Name = "payDate", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "payDate")]
|
||||
public DateTime? PayDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// SevUser who created the invoice
|
||||
/// </summary>
|
||||
/// <value>SevUser who created the invoice</value>
|
||||
[DataMember(Name = "createUser", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "createUser")]
|
||||
public ModelSevUser CreateUser { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// sevClient is the unique id every customer has and is used in nearly all operations
|
||||
/// </summary>
|
||||
/// <value>sevClient is the unique id every customer has and is used in nearly all operations</value>
|
||||
[DataMember(Name = "sevClient", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "sevClient")]
|
||||
public Object SevClient { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// delivery date of the goods from the invoice, please use dd.MM.yyyy
|
||||
/// </summary>
|
||||
/// <value>delivery date of the goods from the invoice, please use dd.MM.yyyy</value>
|
||||
[DataMember(Name = "deliveryDate", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "deliveryDate")]
|
||||
public DateTime? DeliveryDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// status of the invoice
|
||||
/// </summary>
|
||||
/// <value>status of the invoice</value>
|
||||
[DataMember(Name = "status", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "status")]
|
||||
public EInvoiceStatus Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
/*[DataMember(Name = "smallSettlement", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "smallSettlement")]
|
||||
public bool? SmallSettlement { get; set; }
|
||||
*/
|
||||
/// <summary>
|
||||
/// SevUser who created the invoice and therefore is the contact person
|
||||
/// </summary>
|
||||
/// <value>SevUser who created the invoice and therefore is the contact person</value>
|
||||
[DataMember(Name = "contactPerson", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "contactPerson")]
|
||||
public ModelSevUser ContactPerson { get; set; } = new ModelSevUser()
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// tax rate used when adding a value added tax regulation
|
||||
/// </summary>
|
||||
/// <value>tax rate used when adding a value added tax regulation</value>
|
||||
[DataMember(Name = "taxRate", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "taxRate")]
|
||||
public float? TaxRate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// additional text when adding a value added tax regulation
|
||||
/// </summary>
|
||||
/// <value>additional text when adding a value added tax regulation</value>
|
||||
[DataMember(Name = "taxText", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "taxText")]
|
||||
public string TaxText { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// dunning level of the invoice
|
||||
/// </summary>
|
||||
/// <value>dunning level of the invoice</value>
|
||||
[DataMember(Name = "dunningLevel", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "dunningLevel")]
|
||||
public int? DunningLevel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// name of the contacts address
|
||||
/// </summary>
|
||||
/// <value>name of the contacts address</value>
|
||||
[DataMember(Name = "addressParentName", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "addressParentName")]
|
||||
public string AddressParentName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// a reference to the contacts address
|
||||
/// </summary>
|
||||
/// <value>a reference to the contacts address</value>
|
||||
[DataMember(Name = "addressContactRef", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "addressContactRef")]
|
||||
public ModelContactAddress AddressContactRef { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "taxType", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "taxType")]
|
||||
public string TaxType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "paymentMethod", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "paymentMethod")]
|
||||
public ModelPaymentMethod PaymentMethod { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "costCentre", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "costCentre")]
|
||||
public ModelCostCentre CostCentre { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "sendDate", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "sendDate")]
|
||||
public DateTime? SendDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "origin", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "origin")]
|
||||
public Object Origin { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// type of the invoice
|
||||
/// </summary>
|
||||
/// <value>type of the invoice</value>
|
||||
[DataMember(Name = "invoiceType", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "invoiceType")]
|
||||
public string InvoiceType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "accountIntervall", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "accountIntervall")]
|
||||
public int? AccountIntervall { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "accountLastInvoice", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "accountLastInvoice")]
|
||||
public DateTime? AccountLastInvoice { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "accountNextInvoice", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "accountNextInvoice")]
|
||||
public DateTime? AccountNextInvoice { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "reminderTotal", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "reminderTotal")]
|
||||
public float? ReminderTotal { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "reminderDebit", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "reminderDebit")]
|
||||
public float? ReminderDebit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "reminderDeadline", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "reminderDeadline")]
|
||||
public DateTime? ReminderDeadline { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "reminderCharge", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "reminderCharge")]
|
||||
public float? ReminderCharge { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "addressParentName2", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "addressParentName2")]
|
||||
public string AddressParentName2 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "addressName2", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "addressName2")]
|
||||
public string AddressName2 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "taxSet", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "taxSet")]
|
||||
public ModelTaxSet TaxSet { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "addressGender", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "addressGender")]
|
||||
public string AddressGender { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "accountEndDate", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "accountEndDate")]
|
||||
public DateTime? AccountEndDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "address", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "address")]
|
||||
public string Address { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "currency", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "currency")]
|
||||
public string Currency { get; set; } = "EUR";
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "sumNet", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "sumNet")]
|
||||
public float? SumNet { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "sumTax", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "sumTax")]
|
||||
public float? SumTax { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "sumGross", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "sumGross")]
|
||||
public float? SumGross { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "sumDiscounts", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "sumDiscounts")]
|
||||
public float? SumDiscounts { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "sumNetForeignCurrency", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "sumNetForeignCurrency")]
|
||||
public float? SumNetForeignCurrency { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "sumTaxForeignCurrency", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "sumTaxForeignCurrency")]
|
||||
public float? SumTaxForeignCurrency { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "sumGrossForeignCurrency", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "sumGrossForeignCurrency")]
|
||||
public float? SumGrossForeignCurrency { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "sumDiscountsForeignCurrency", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "sumDiscountsForeignCurrency")]
|
||||
public float? SumDiscountsForeignCurrency { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "sumNetAccounting", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "sumNetAccounting")]
|
||||
public float? SumNetAccounting { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "sumTaxAccounting", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "sumTaxAccounting")]
|
||||
public float? SumTaxAccounting { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "sumGrossAccounting", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "sumGrossAccounting")]
|
||||
public float? SumGrossAccounting { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "entryType", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "entryType")]
|
||||
public ModelEntryType EntryType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "costumerInternalNote", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "costumerInternalNote")]
|
||||
public string CostumerInternalNote { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "showNet", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "showNet")]
|
||||
public int ShowNet { get; set; } = 0;
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "enshrined", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "enshrined")]
|
||||
public bool? Enshrined { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "sendType", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "sendType")]
|
||||
public string SendType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "deliveryDateUntil", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "deliveryDateUntil")]
|
||||
public DateTime? DeliveryDateUntil { get; set; }
|
||||
|
||||
[DataMember(Name = "mapAll", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "mapAll")]
|
||||
public bool MapAll { get; set; } = true;
|
||||
|
||||
}
|
||||
|
||||
public class ShippingConditions
|
||||
enum EInvoiceStatus
|
||||
{
|
||||
[JsonProperty("shippingDate")] public string shippingDate { get; set; } = "2023-04-22T00:00:00.000+02:00";
|
||||
[JsonProperty("shippingType")] public string shippingType { get; set; } = "delivery";
|
||||
DEACTIVE = 50,
|
||||
DRAFT = 100,
|
||||
OPEN = 200,
|
||||
PAYED = 1000
|
||||
}
|
||||
|
||||
public class TaxConditions
|
||||
{
|
||||
[JsonProperty("taxType")] public string TaxType { get; set; } = "net";
|
||||
}
|
||||
|
||||
public class TotalPrice
|
||||
{
|
||||
[JsonProperty("currency")] public string Currency { get; set; } = "EUR";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ConsoleApp3.DataContracts
|
||||
{
|
||||
internal class InvoiceAddress
|
||||
{
|
||||
[JsonProperty("contactId")] public string ContactId { get; set; }
|
||||
|
||||
[JsonProperty("name")] public string Name { get; set; }
|
||||
|
||||
[JsonProperty("supplement")] public string Supplement { get; set; }
|
||||
|
||||
[JsonProperty("street")] public string Street { get; set; }
|
||||
|
||||
[JsonProperty("city")] public string City { get; set; }
|
||||
|
||||
[JsonProperty("zip")] public string Zip { get; set; }
|
||||
|
||||
[JsonProperty("countryCode")] public string CountryCode { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ConsoleApp3.DataContracts
|
||||
{
|
||||
public record InvoiceItem
|
||||
{
|
||||
internal InvoiceItem(string invoiceId, string customer, DateTime date, Employee employee, int account,
|
||||
string description, decimal amountHours, decimal price)
|
||||
{
|
||||
InvoiceId = invoiceId;
|
||||
Customer = customer;
|
||||
Date = date;
|
||||
Employee = employee;
|
||||
Account = account;
|
||||
Description = description;
|
||||
AmountHours = amountHours;
|
||||
Price = price;
|
||||
}
|
||||
|
||||
public string InvoiceId { get; }
|
||||
public string Customer { get; }
|
||||
public DateTime Date { get; }
|
||||
public Employee Employee { get; }
|
||||
public int Account { get; }
|
||||
public string Description { get; }
|
||||
public decimal AmountHours { get; }
|
||||
public decimal Price { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ConsoleApp3.DataContracts
|
||||
{
|
||||
internal class InvoiceLineItem
|
||||
{
|
||||
[JsonProperty("type")] public string Type { get; set; }
|
||||
[JsonProperty("name")] public string Name { get; set; }
|
||||
[JsonProperty("description")] public string Description { get; set; }
|
||||
[JsonProperty("quantity")] public decimal Quantity { get; set; }
|
||||
[JsonProperty("unitName")] public string UnitName { get; set; }
|
||||
[JsonProperty("unitPrice")] public InvoiceLineUnitPrice UnitPrice { get; set; }
|
||||
[JsonProperty("discountPercentage")] public decimal DiscountPercentage { get; set; }
|
||||
[JsonProperty("lineItemAmount")] public decimal LineItemAmount { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace ConsoleApp3.DataContracts
|
||||
{
|
||||
public class InvoiceLineUnitPrice
|
||||
{
|
||||
[JsonProperty("currency")] public string Currency { get; set; }
|
||||
|
||||
[JsonProperty("netAmount")] public decimal NetAmount { get; set; }
|
||||
|
||||
[JsonProperty("grossAmount")] public decimal GrossAmount { get; set; }
|
||||
|
||||
[JsonProperty("taxRatePercentage")] public decimal TaxRatePercentage { get; set; }
|
||||
}
|
||||
}
|
||||
67
ConsoleApp3/DataContracts/InvoicePosSave.cs
Normal file
67
ConsoleApp3/DataContracts/InvoicePosSave.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
using Newtonsoft.Json;
|
||||
using OpenQA.Selenium.DevTools.V112.DOM;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ConsoleApp3.DataContracts
|
||||
{
|
||||
[DataContract]
|
||||
internal class InvoicePosSave
|
||||
{
|
||||
[DataMember(Name = "id", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "id")]
|
||||
public int? Id { get; set; }
|
||||
|
||||
[DataMember(Name = "objectName", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "objectName")]
|
||||
public string ObjectName { get; set; } = "InvoicePos";
|
||||
|
||||
[DataMember(Name = "mapAll", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "mapAll")]
|
||||
public bool MapAll { get; set; } = true;
|
||||
|
||||
[DataMember(Name = "quantity", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "quantity")]
|
||||
public uint Quantity { get; set; }
|
||||
|
||||
[DataMember(Name = "price", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "price")]
|
||||
public decimal Price { get; set; }
|
||||
|
||||
[DataMember(Name = "name", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "name")]
|
||||
public string Name { get; set; } = "";
|
||||
|
||||
[DataMember(Name = "unity", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "unity")]
|
||||
public ModelUnity Unity { get; set; } = new ModelUnity();
|
||||
|
||||
[DataMember(Name = "positionNumber", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "positionNumber")]
|
||||
public uint PositionNumber { get; set; }
|
||||
|
||||
[DataMember(Name = "text", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "text")]
|
||||
public string? Text { get; set; }
|
||||
|
||||
[DataMember(Name = "discount", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "discount")]
|
||||
public int Discount { get; set; } = 0;
|
||||
|
||||
[DataMember(Name = "taxRate", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "taxRate")]
|
||||
public uint TaxRate { get; set; } = 19;
|
||||
|
||||
[DataMember(Name = "priceGross", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "priceGross")]
|
||||
public decimal PriceGross { get; set; }
|
||||
|
||||
[DataMember(Name = "priceTax", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "priceTax")]
|
||||
public int PriceTax { get; set; } = 19;
|
||||
}
|
||||
}
|
||||
12
ConsoleApp3/DataContracts/Invoices.cs
Normal file
12
ConsoleApp3/DataContracts/Invoices.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
// See https://aka.ms/new-console-template for more information
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace ConsoleApp3.DataContracts
|
||||
{
|
||||
internal class Invoices
|
||||
{
|
||||
[JsonProperty("objects")] public Invoice[] Invoice { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
110
ConsoleApp3/DataContracts/ModelCategory.cs
Normal file
110
ConsoleApp3/DataContracts/ModelCategory.cs
Normal file
@@ -0,0 +1,110 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace ConsoleApp3.DataContracts
|
||||
{
|
||||
[DataContract]
|
||||
public class ModelCategory
|
||||
{
|
||||
[DataMember(Name = "create", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "create")]
|
||||
public DateTime? Create { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// date the category was last updated
|
||||
/// </summary>
|
||||
/// <value>date the category was last updated</value>
|
||||
[DataMember(Name = "update", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "update")]
|
||||
public DateTime? Update { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "parent", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "parent")]
|
||||
public ModelCategory Parent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "name", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "objectType", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "objectType")]
|
||||
public string ObjectType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "priority", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "priority")]
|
||||
public int? Priority { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "code", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "code")]
|
||||
public string Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "color", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "color")]
|
||||
public string Color { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "sevClient", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "sevClient")]
|
||||
public Object SevClient { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "postingAccount", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "postingAccount")]
|
||||
public string PostingAccount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "type", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "type")]
|
||||
public string Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "translationCode", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "translationCode")]
|
||||
public string TranslationCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "entryType", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "entryType")]
|
||||
public ModelEntryType EntryType { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
232
ConsoleApp3/DataContracts/ModelContact.cs
Normal file
232
ConsoleApp3/DataContracts/ModelContact.cs
Normal file
@@ -0,0 +1,232 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace ConsoleApp3.DataContracts
|
||||
{
|
||||
[DataContract]
|
||||
public class ModelContact
|
||||
{
|
||||
[DataMember(Name = "id", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "id")]
|
||||
public int Id { get; set; }
|
||||
|
||||
[DataMember(Name = "objectName", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "objectName")]
|
||||
public string ObjectName { get; set; } = "";
|
||||
/// <summary>
|
||||
/// the contact address
|
||||
/// </summary>
|
||||
/// <value>the contact address</value>
|
||||
[DataMember(Name = "address", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "address")]
|
||||
public ModelContactAddress Address { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// the creation date of the contact
|
||||
/// </summary>
|
||||
/// <value>the creation date of the contact</value>
|
||||
[DataMember(Name = "create", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "create")]
|
||||
public DateTime? Create { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// date, the contact was last updated
|
||||
/// </summary>
|
||||
/// <value>date, the contact was last updated</value>
|
||||
[DataMember(Name = "update", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "update")]
|
||||
public DateTime? Update { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// name of the contact
|
||||
/// </summary>
|
||||
/// <value>name of the contact</value>
|
||||
[DataMember(Name = "name", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// status of the contact
|
||||
/// </summary>
|
||||
/// <value>status of the contact</value>
|
||||
[DataMember(Name = "status", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "status")]
|
||||
public int? Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// customer number of the contact
|
||||
/// </summary>
|
||||
/// <value>customer number of the contact</value>
|
||||
[DataMember(Name = "customerNumber", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "customerNumber")]
|
||||
public int? CustomerNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "parent", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "parent")]
|
||||
public ModelContact Parent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// surname of the contact
|
||||
/// </summary>
|
||||
/// <value>surname of the contact</value>
|
||||
[DataMember(Name = "surename", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "surename")]
|
||||
public string Surename { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// family name of the contact
|
||||
/// </summary>
|
||||
/// <value>family name of the contact</value>
|
||||
[DataMember(Name = "familyname", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "familyname")]
|
||||
public string Familyname { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// title of the contact
|
||||
/// </summary>
|
||||
/// <value>title of the contact</value>
|
||||
[DataMember(Name = "titel", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "titel")]
|
||||
public string Titel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// category of the contact
|
||||
/// </summary>
|
||||
/// <value>category of the contact</value>
|
||||
[DataMember(Name = "category", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "category")]
|
||||
public ModelCategory Category { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// description of the contact
|
||||
/// </summary>
|
||||
/// <value>description of the contact</value>
|
||||
[DataMember(Name = "description", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "description")]
|
||||
public string Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// any academic title of the contact
|
||||
/// </summary>
|
||||
/// <value>any academic title of the contact</value>
|
||||
[DataMember(Name = "academicTitle", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "academicTitle")]
|
||||
public string AcademicTitle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// gender of the contact
|
||||
/// </summary>
|
||||
/// <value>gender of the contact</value>
|
||||
[DataMember(Name = "gender", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "gender")]
|
||||
public string Gender { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// sevClient is the unique id every customer has and is used in nearly all operations
|
||||
/// </summary>
|
||||
/// <value>sevClient is the unique id every customer has and is used in nearly all operations</value>
|
||||
[DataMember(Name = "sevClient", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "sevClient")]
|
||||
public Object SevClient { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// second name of the contact
|
||||
/// </summary>
|
||||
/// <value>second name of the contact</value>
|
||||
[DataMember(Name = "name2", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "name2")]
|
||||
public string Name2 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// birthday of the contact
|
||||
/// </summary>
|
||||
/// <value>birthday of the contact</value>
|
||||
[DataMember(Name = "birthday", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "birthday")]
|
||||
public DateTime? Birthday { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// vat number of the contact
|
||||
/// </summary>
|
||||
/// <value>vat number of the contact</value>
|
||||
[DataMember(Name = "vatNumber", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "vatNumber")]
|
||||
public string VatNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// bank account of the contact
|
||||
/// </summary>
|
||||
/// <value>bank account of the contact</value>
|
||||
[DataMember(Name = "bankAccount", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "bankAccount")]
|
||||
public string BankAccount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// bank number of the contact
|
||||
/// </summary>
|
||||
/// <value>bank number of the contact</value>
|
||||
[DataMember(Name = "bankNumber", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "bankNumber")]
|
||||
public string BankNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// desired payment method of the customer
|
||||
/// </summary>
|
||||
/// <value>desired payment method of the customer</value>
|
||||
[DataMember(Name = "paymentMethod", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "paymentMethod")]
|
||||
public ModelPaymentMethod PaymentMethod { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "entryType", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "entryType")]
|
||||
public ModelEntryType EntryType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// default cashback time of the contact
|
||||
/// </summary>
|
||||
/// <value>default cashback time of the contact</value>
|
||||
[DataMember(Name = "defaultCashbackTime", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "defaultCashbackTime")]
|
||||
public int? DefaultCashbackTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// default cashback percentage of the contact
|
||||
/// </summary>
|
||||
/// <value>default cashback percentage of the contact</value>
|
||||
[DataMember(Name = "defaultCashbackPercent", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "defaultCashbackPercent")]
|
||||
public int? DefaultCashbackPercent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// default time to pay of the contact
|
||||
/// </summary>
|
||||
/// <value>default time to pay of the contact</value>
|
||||
[DataMember(Name = "defaultTimeToPay", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "defaultTimeToPay")]
|
||||
public int? DefaultTimeToPay { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// tax number of the contact
|
||||
/// </summary>
|
||||
/// <value>tax number of the contact</value>
|
||||
[DataMember(Name = "taxNumber", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "taxNumber")]
|
||||
public string TaxNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// tax office of the contact
|
||||
/// </summary>
|
||||
/// <value>tax office of the contact</value>
|
||||
[DataMember(Name = "taxOffice", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "taxOffice")]
|
||||
public string TaxOffice { get; set; }
|
||||
}
|
||||
}
|
||||
114
ConsoleApp3/DataContracts/ModelContactAddress.cs
Normal file
114
ConsoleApp3/DataContracts/ModelContactAddress.cs
Normal file
@@ -0,0 +1,114 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace ConsoleApp3.DataContracts
|
||||
{
|
||||
[DataContract]
|
||||
public class ModelContactAddress
|
||||
{
|
||||
/// <summary>
|
||||
/// the creation date of the contact
|
||||
/// </summary>
|
||||
/// <value>the creation date of the contact</value>
|
||||
[DataMember(Name = "create", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "create")]
|
||||
public DateTime? Create { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// date, the contact was last updated
|
||||
/// </summary>
|
||||
/// <value>date, the contact was last updated</value>
|
||||
[DataMember(Name = "update", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "update")]
|
||||
public DateTime? Update { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// the contact the address belongs to
|
||||
/// </summary>
|
||||
/// <value>the contact the address belongs to</value>
|
||||
[DataMember(Name = "contact", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "contact")]
|
||||
public ModelContact Contact { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "street", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "street")]
|
||||
public string Street { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// zip of the city/village
|
||||
/// </summary>
|
||||
/// <value>zip of the city/village</value>
|
||||
[DataMember(Name = "zip", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "zip")]
|
||||
public string Zip { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "city", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "city")]
|
||||
public string City { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "country", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "country")]
|
||||
public ModelStaticCountry Country { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// category of the address
|
||||
/// </summary>
|
||||
/// <value>category of the address</value>
|
||||
[DataMember(Name = "category", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "category")]
|
||||
public ModelCategory Category { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "name", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// sevClient is the unique id every customer has and is used in nearly all operations
|
||||
/// </summary>
|
||||
/// <value>sevClient is the unique id every customer has and is used in nearly all operations</value>
|
||||
[DataMember(Name = "sevClient", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "sevClient")]
|
||||
public Object SevClient { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "name2", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "name2")]
|
||||
public string Name2 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "name3", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "name3")]
|
||||
public string Name3 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "name4", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "name4")]
|
||||
public string Name4 { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
62
ConsoleApp3/DataContracts/ModelCostCentre.cs
Normal file
62
ConsoleApp3/DataContracts/ModelCostCentre.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace ConsoleApp3.DataContracts
|
||||
{
|
||||
[DataContract]
|
||||
public class ModelCostCentre
|
||||
{
|
||||
[DataMember(Name = "create", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "create")]
|
||||
public DateTime? Create { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// date the cost centre was last updated
|
||||
/// </summary>
|
||||
/// <value>date the cost centre was last updated</value>
|
||||
[DataMember(Name = "update", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "update")]
|
||||
public DateTime? Update { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// sevClient is the unique id every customer has and is used in nearly all operations
|
||||
/// </summary>
|
||||
/// <value>sevClient is the unique id every customer has and is used in nearly all operations</value>
|
||||
[DataMember(Name = "sevClient", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "sevClient")]
|
||||
public Object SevClient { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "number", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "number")]
|
||||
public string Number { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "name", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "color", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "color")]
|
||||
public string Color { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "postingAccount", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "postingAccount")]
|
||||
public string PostingAccount { get; set; }
|
||||
}
|
||||
}
|
||||
37
ConsoleApp3/DataContracts/ModelEntryType.cs
Normal file
37
ConsoleApp3/DataContracts/ModelEntryType.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace ConsoleApp3.DataContracts
|
||||
{
|
||||
[DataContract]
|
||||
public class ModelEntryType
|
||||
{
|
||||
[DataMember(Name = "create", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "create")]
|
||||
public DateTime? Create { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// date the entry type was last updated
|
||||
/// </summary>
|
||||
/// <value>date the entry type was last updated</value>
|
||||
[DataMember(Name = "update", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "update")]
|
||||
public DateTime? Update { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// sevClient is the unique id every customer has and is used in nearly all operations
|
||||
/// </summary>
|
||||
/// <value>sevClient is the unique id every customer has and is used in nearly all operations</value>
|
||||
[DataMember(Name = "sevClient", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "sevClient")]
|
||||
public Object SevClient { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "name", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "name")]
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
||||
50
ConsoleApp3/DataContracts/ModelPaymentMethod.cs
Normal file
50
ConsoleApp3/DataContracts/ModelPaymentMethod.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace ConsoleApp3.DataContracts
|
||||
{
|
||||
[DataContract]
|
||||
public class ModelPaymentMethod
|
||||
{
|
||||
/// <summary>
|
||||
/// date the payment method was created
|
||||
/// </summary>
|
||||
/// <value>date the payment method was created</value>
|
||||
[DataMember(Name = "create", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "create")]
|
||||
public DateTime? Create { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// date the payment method was last updated
|
||||
/// </summary>
|
||||
/// <value>date the payment method was last updated</value>
|
||||
[DataMember(Name = "update", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "update")]
|
||||
public DateTime? Update { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// sevClient is the unique id every customer has and is used in nearly all operations
|
||||
/// </summary>
|
||||
/// <value>sevClient is the unique id every customer has and is used in nearly all operations</value>
|
||||
[DataMember(Name = "sevClient", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "sevClient")]
|
||||
public Object SevClient { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "name", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "text", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "text")]
|
||||
public string Text { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
22
ConsoleApp3/DataContracts/ModelRechnung.cs
Normal file
22
ConsoleApp3/DataContracts/ModelRechnung.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ConsoleApp3.DataContracts
|
||||
{
|
||||
[DataContract]
|
||||
internal class ModelRechnung
|
||||
{
|
||||
[DataMember(Name = "invoice", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "invoice")]
|
||||
public Invoice Invoice { get; set; }
|
||||
|
||||
[DataMember(Name = "invoicePosSave", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "invoicePosSave")]
|
||||
public InvoicePosSave[] InvoicePosSaves { get; set; }
|
||||
}
|
||||
}
|
||||
26
ConsoleApp3/DataContracts/ModelSevUser.cs
Normal file
26
ConsoleApp3/DataContracts/ModelSevUser.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace ConsoleApp3.DataContracts
|
||||
{
|
||||
[DataContract]
|
||||
public class ModelSevUser
|
||||
{
|
||||
[DataMember(Name = "id", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "id")]
|
||||
public int Id { get; set; } = 995002;
|
||||
|
||||
[DataMember(Name = "objectName", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "objectName")]
|
||||
public string objectName { get; set; } = "SevUser";
|
||||
|
||||
/// <summary>
|
||||
/// This information is not visible for you
|
||||
/// </summary>
|
||||
/// <value>This information is not visible for you</value>
|
||||
[DataMember(Name = "hidden", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "hidden")]
|
||||
public string Hidden { get; set; }
|
||||
}
|
||||
}
|
||||
66
ConsoleApp3/DataContracts/ModelStaticCountry.cs
Normal file
66
ConsoleApp3/DataContracts/ModelStaticCountry.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace ConsoleApp3.DataContracts
|
||||
{
|
||||
[DataContract]
|
||||
public class ModelStaticCountry
|
||||
{
|
||||
[DataMember(Name = "id", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "id")]
|
||||
public int Id { get; set; }
|
||||
|
||||
[DataMember(Name = "objectName", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "objectName")]
|
||||
public string ObjectName { get; set; } = "StaticCountry";
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "code", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "code")]
|
||||
public string Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "name", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "nameEn", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "nameEn")]
|
||||
public string NameEn { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "translationCode", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "translationCode")]
|
||||
public string TranslationCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "locale", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "locale")]
|
||||
public string Locale { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "priority", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "priority")]
|
||||
public int? Priority { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
123
ConsoleApp3/DataContracts/ModelTaxSet.cs
Normal file
123
ConsoleApp3/DataContracts/ModelTaxSet.cs
Normal file
@@ -0,0 +1,123 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace ConsoleApp3.DataContracts
|
||||
{
|
||||
[DataContract]
|
||||
public class ModelTaxSet
|
||||
{
|
||||
/// <summary>
|
||||
/// date the tax set was created
|
||||
/// </summary>
|
||||
/// <value>date the tax set was created</value>
|
||||
[DataMember(Name = "create", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "create")]
|
||||
public DateTime? Create { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// date the tax set was last updated
|
||||
/// </summary>
|
||||
/// <value>date the tax set was last updated</value>
|
||||
[DataMember(Name = "update", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "update")]
|
||||
public DateTime? Update { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// sevClient is the unique id every customer has and is used in nearly all operations
|
||||
/// </summary>
|
||||
/// <value>sevClient is the unique id every customer has and is used in nearly all operations</value>
|
||||
[DataMember(Name = "sevClient", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "sevClient")]
|
||||
public Object SevClient { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "text", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "text")]
|
||||
public string Text { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "taxRate", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "taxRate")]
|
||||
public float? TaxRate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "code", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "code")]
|
||||
public float? Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "displayText", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "displayText")]
|
||||
public string DisplayText { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "vatReportFieldNet", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "vatReportFieldNet")]
|
||||
public string VatReportFieldNet { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "vatReportFieldTax", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "vatReportFieldTax")]
|
||||
public string VatReportFieldTax { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "accountingExportVatField", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "accountingExportVatField")]
|
||||
public string AccountingExportVatField { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "showInvoice", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "showInvoice")]
|
||||
public bool? ShowInvoice { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "showDebitVoucher", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "showDebitVoucher")]
|
||||
public bool? ShowDebitVoucher { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "showCreditVoucher", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "showCreditVoucher")]
|
||||
public bool? ShowCreditVoucher { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "onlyForVatDec", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "onlyForVatDec")]
|
||||
public bool? OnlyForVatDec { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
17
ConsoleApp3/DataContracts/ModelUnity.cs
Normal file
17
ConsoleApp3/DataContracts/ModelUnity.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace ConsoleApp3.DataContracts
|
||||
{
|
||||
[DataContract]
|
||||
public class ModelUnity
|
||||
{
|
||||
[DataMember(Name = "id", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "id")]
|
||||
public int Id { get; set; } = 1;
|
||||
|
||||
[DataMember(Name = "objectName", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "objectName")]
|
||||
public string ObjectName { get; set; } = "Unity";
|
||||
}
|
||||
}
|
||||
@@ -61,6 +61,16 @@ static class Helper
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
internal static DateTime ConvertBezahlDatum(string text)
|
||||
{
|
||||
//21.06.202308:39
|
||||
int uhrzeitsignature = text.IndexOf(':');
|
||||
string datum = text.Substring(0, uhrzeitsignature - 2);
|
||||
string uhrzeit = text.Substring(uhrzeitsignature-2,text.Length - uhrzeitsignature + 2);
|
||||
|
||||
return DateTime.Parse(string.Format("{0} {1}", datum, uhrzeit));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -43,64 +43,86 @@ namespace CardmarketBot
|
||||
{
|
||||
this.kunden = kunden;
|
||||
}
|
||||
|
||||
public List<Invoice> GetInvoices()
|
||||
|
||||
public List<ModelRechnung> GetInvoices()
|
||||
{
|
||||
List<Invoice> result = new List<Invoice>();
|
||||
List<ModelRechnung> result = new List<ModelRechnung>();
|
||||
|
||||
foreach (Kunde kunde in kunden)
|
||||
{
|
||||
Invoice invoice = new Invoice();
|
||||
invoice.Language = "de";
|
||||
invoice.VoucherDate = DateTimeConverter(kunde.Bezahldatum); // "2023-02-22T00:00:00.000+01:00"; //
|
||||
invoice.Address = new InvoiceAddress()
|
||||
ModelRechnung temp = new ModelRechnung();
|
||||
Invoice rechnung = new Invoice();
|
||||
rechnung.Id = null;
|
||||
rechnung.ObjectName = "Invoice";
|
||||
//rechnung.InvoiceNumber = string.Format("RE-{0}", await GetNextInvoiceNumber()); => Should be done by services.
|
||||
rechnung.InvoiceDate = kunde.Bezahldatum;
|
||||
rechnung.Header = string.Format("Verkauf #{0}",kunde.BestellungID);
|
||||
rechnung.HeadText = "Sehr geehrte Damen und Herren," +
|
||||
"Wir stellen Ihnen für Ihre bestellung folgende Rechnung." +
|
||||
"Bitte Beachte, dass der Lieferdatum die Bestelldatum entspricht.";
|
||||
rechnung.FootText = "Ihre Rechnung ist bereits über Cardmarket beglichen worden.";
|
||||
rechnung.TimeToPay = new DateTime(0);
|
||||
rechnung.Discount = 0;
|
||||
rechnung.Address = string.Format("{0}\n{1} {2}\n{3} {4}", kunde.Name, kunde.Strasse, kunde.Hausnummer, kunde.Plz, kunde.Ort); //"Damian Wessels\nDät Haartje 27A\n26683 Saterland";
|
||||
rechnung.AddressCountry = new ModelStaticCountry()
|
||||
{
|
||||
Name = kunde.Name,
|
||||
Street = kunde.Strasse + " " + kunde.Hausnummer,
|
||||
City = kunde.Ort,
|
||||
Zip = kunde.Plz,
|
||||
CountryCode = "DE"
|
||||
Id = 1
|
||||
};
|
||||
invoice.LineItems = new List<InvoiceLineItem>();
|
||||
foreach (var artikel in kunde.Artikels)
|
||||
{
|
||||
invoice.LineItems.Add(new InvoiceLineItem()
|
||||
{
|
||||
Type = "custom",
|
||||
Name = artikel.ENGName + "(" + artikel.Source + ")",
|
||||
Quantity = artikel.Amount,
|
||||
UnitName = "Stück",
|
||||
UnitPrice = new InvoiceLineUnitPrice()
|
||||
{
|
||||
Currency = "EUR",
|
||||
GrossAmount = Convert.ToDecimal(artikel.Preis),
|
||||
TaxRatePercentage = 19
|
||||
}
|
||||
});
|
||||
}
|
||||
invoice.LineItems.Add(new InvoiceLineItem()
|
||||
{
|
||||
Type = "custom",
|
||||
Name = "Versandkosten",
|
||||
Quantity = 1,
|
||||
UnitName = "Stück",
|
||||
UnitPrice = new InvoiceLineUnitPrice()
|
||||
{
|
||||
Currency = "EUR",
|
||||
GrossAmount = PortoPreis[kunde.Versandskosten],
|
||||
TaxRatePercentage = 19
|
||||
}
|
||||
});
|
||||
//rechnung.PayDate = new DateTime(2019, 08, 24, 14, 15, 22);
|
||||
rechnung.DeliveryDate = kunde.Bezahldatum;
|
||||
rechnung.Status = EInvoiceStatus.OPEN;
|
||||
rechnung.TaxRate = 19;
|
||||
rechnung.TaxText = "Umsatzsteuer 19%";
|
||||
rechnung.TaxType = "default";
|
||||
rechnung.SendDate = kunde.Bezahldatum;
|
||||
rechnung.InvoiceType = "RE";
|
||||
|
||||
invoice.TotalPrice = new TotalPrice() { Currency = "EUR" };
|
||||
invoice.TaxConditions = new TaxConditions() { TaxType = "gross" };
|
||||
invoice.ShippingConditions = new ShippingConditions()
|
||||
rechnung.Contact = new ModelContact()
|
||||
{
|
||||
shippingDate = "2023-04-22T00:00:00.000+02:00",
|
||||
shippingType = "delivery"
|
||||
Id = 64055231,
|
||||
ObjectName = "Contact"
|
||||
};
|
||||
result.Add(invoice);
|
||||
|
||||
temp.Invoice = rechnung;
|
||||
|
||||
temp.InvoicePosSaves = new InvoicePosSave[kunde.Artikels.Count + 1];
|
||||
|
||||
for(int i = 0; i < kunde.Artikels.Count; i++)
|
||||
{
|
||||
temp.InvoicePosSaves[i] = new InvoicePosSave()
|
||||
{
|
||||
Id = null,
|
||||
MapAll = true,
|
||||
Quantity = (uint)kunde.Artikels[i].Amount,
|
||||
Name = string.Format("{0} ({1})", kunde.Artikels[i].ENGName, kunde.Artikels[i].Source),
|
||||
PositionNumber = 0,
|
||||
TaxRate = 19,
|
||||
Price = Convert.ToDecimal(kunde.Artikels[i].Preis),
|
||||
Discount = 0,
|
||||
PriceGross = Convert.ToDecimal(kunde.Artikels[i].Preis),
|
||||
PriceTax = 19
|
||||
};
|
||||
}
|
||||
|
||||
// Versandskosten
|
||||
temp.InvoicePosSaves[temp.InvoicePosSaves.Length - 1] = new InvoicePosSave()
|
||||
{
|
||||
Id = null,
|
||||
MapAll = true,
|
||||
Quantity = 1,
|
||||
Price = PortoPreis[kunde.Versandskosten],
|
||||
Name = "Versandskosten",
|
||||
PositionNumber = 0,
|
||||
Discount = 0,
|
||||
TaxRate = 19,
|
||||
PriceGross = PortoPreis[kunde.Versandskosten],
|
||||
PriceTax = 19
|
||||
};
|
||||
result.Add(temp);
|
||||
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
// See https://aka.ms/new-console-template for more information
|
||||
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using ConsoleApp3.DataContracts;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
/*
|
||||
*
|
||||
* referalPage: /de/OnePiece
|
||||
username: Skywalkerex
|
||||
userPassword: Magnatpower310!!
|
||||
/de/OnePiece/PostGetAction/User_Login
|
||||
|
||||
curbpJUJmtup1t.Tq0awbHIhIRwhzMW7vrsWxLAJu.pI9X4r
|
||||
*/
|
||||
|
||||
namespace CardmarketBot
|
||||
{
|
||||
class InvoiceService
|
||||
{
|
||||
private readonly WebRequest request;
|
||||
|
||||
|
||||
public InvoiceService(string apiKey)
|
||||
{
|
||||
request = WebRequest.Create("https://api.lexoffice.io/v1/invoices");
|
||||
request.Method = "POST";
|
||||
request.Headers.Add("Authorization", string.Format("Bearer {0}",apiKey));
|
||||
request.Headers.Add("Accept", "application/json");
|
||||
|
||||
}
|
||||
|
||||
public void InsertInvoice(Invoice invoice)
|
||||
{
|
||||
var json = JsonConvert.SerializeObject(invoice);
|
||||
byte[] bytearray = Encoding.UTF8.GetBytes(json);
|
||||
request.ContentType = "application/json";
|
||||
using var reqStream = request.GetRequestStream();
|
||||
reqStream.Write(bytearray, 0, bytearray.Length);
|
||||
using var response = request.GetResponse();
|
||||
Console.WriteLine(((HttpWebResponse)response).StatusDescription);
|
||||
reqStream.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ class Kunde
|
||||
{
|
||||
string bestellungID = "";
|
||||
Helper.Porto versandskosten;
|
||||
string? overrideVersandskosten;
|
||||
string name;
|
||||
string strasse;
|
||||
string hausnummer;
|
||||
@@ -11,7 +12,7 @@ class Kunde
|
||||
string ort;
|
||||
string land;
|
||||
List<Artikel> artikels = new List<Artikel>();
|
||||
public string Bezahldatum { get; set; } = "";
|
||||
public DateTime Bezahldatum { get; set; }
|
||||
|
||||
public string Name { get => name; set => name = value; }
|
||||
public string Strasse { get => strasse; set => strasse = value; }
|
||||
@@ -20,8 +21,24 @@ class Kunde
|
||||
public string Land { get => land; set => land = value; }
|
||||
public string BestellungID { get => bestellungID; set => bestellungID = value; }
|
||||
public Helper.Porto Versandskosten { get => versandskosten; set => versandskosten = value; }
|
||||
|
||||
public string Hausnummer { get => hausnummer; set => hausnummer = value; }
|
||||
internal List<Artikel> Artikels { get => artikels; set => artikels = value; }
|
||||
public string? OverrideVersandskosten {
|
||||
get => overrideVersandskosten;
|
||||
set
|
||||
{
|
||||
string[] parts = value.Split(' ');
|
||||
if(parts.Length < 2)
|
||||
{
|
||||
overrideVersandskosten = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
overrideVersandskosten = parts[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Kunde(string Name, string Strasse, string Hausnummer, string PLZ, string Ort, string Land)
|
||||
{
|
||||
@@ -32,26 +49,4 @@ class Kunde
|
||||
ort = Ort;
|
||||
land = Land;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
HttpWebRequest hwr = (HttpWebRequest)HttpWebRequest.Create(@"https://www.cardmarket.com/de/OnePiece/Orders/Sales/Paid");
|
||||
hwr.CookieContainer = cookieContainer;
|
||||
hwr.Method = "GET";
|
||||
hwr.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36";
|
||||
WebResponse wr = hwr.GetResponse();
|
||||
string s = new StreamReader(wr.GetResponseStream()).ReadToEnd();
|
||||
Console.WriteLine(s);
|
||||
|
||||
string GetHashKey(string line)
|
||||
{
|
||||
var x = line.IndexOf("__cmtkn");
|
||||
var d = line.Substring(x + 16);
|
||||
var m = d.IndexOf("\"");
|
||||
var a = d.Substring(0, m);
|
||||
return a;
|
||||
}
|
||||
|
||||
*/
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
// See https://aka.ms/new-console-template for more information
|
||||
|
||||
using System.Text;
|
||||
using ConsoleApp3.DataContracts;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
/*
|
||||
*
|
||||
* referalPage: /de/OnePiece
|
||||
username: Skywalkerex
|
||||
userPassword: Magnatpower310!!
|
||||
/de/OnePiece/PostGetAction/User_Login
|
||||
|
||||
curbpJUJmtup1t.Tq0awbHIhIRwhzMW7vrsWxLAJu.pI9X4r
|
||||
*/
|
||||
|
||||
namespace CardmarketBot
|
||||
{
|
||||
class LexofficeService
|
||||
{
|
||||
private readonly HttpClient _client;
|
||||
private readonly Random _random = new();
|
||||
|
||||
public LexofficeService()
|
||||
{
|
||||
_client = new HttpClient
|
||||
{
|
||||
DefaultRequestHeaders =
|
||||
{
|
||||
{ "Authorization", "Bearer curbpJUJmtup1t.Tq0awbHIhIRwhzMW7vrsWxLAJu.pI9X4r" },
|
||||
{ "Accept", "application/json" }
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void test()
|
||||
{
|
||||
var d = GetInvoiceAsync("d47936c1-71c6-4e22-b394-3630d7354ebf");
|
||||
var m = d.Result;
|
||||
Console.WriteLine(m);
|
||||
}
|
||||
|
||||
public void m(Invoice invoice)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
public async void WriteInvoice(Invoice invoice)
|
||||
{
|
||||
|
||||
|
||||
|
||||
var jsonSerializerSettings = new JsonSerializerSettings
|
||||
{
|
||||
MissingMemberHandling = MissingMemberHandling.Ignore
|
||||
};
|
||||
|
||||
var s = JsonConvert.SerializeObject(invoice, jsonSerializerSettings);
|
||||
|
||||
var content = new StringContent(invoice.ToString(), Encoding.UTF8, "application/json");
|
||||
|
||||
var uri = LexofficeApiAddressesBuilder.CreateInvoice();
|
||||
var result = await _client.PostAsync(uri, content);
|
||||
Console.WriteLine(result.Content);
|
||||
}
|
||||
|
||||
private async Task<Invoice> GetInvoiceAsync(string id)
|
||||
{
|
||||
var uri = LexofficeApiAddressesBuilder.InvoiceUri(id);
|
||||
var response = await _client.GetAsync(uri).ConfigureAwait(false);
|
||||
|
||||
response.EnsureSuccessStatusCode();
|
||||
|
||||
var contents = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
|
||||
|
||||
var jsonSerializerSettings = new JsonSerializerSettings
|
||||
{
|
||||
MissingMemberHandling = MissingMemberHandling.Ignore
|
||||
};
|
||||
return JsonConvert.DeserializeObject<Invoice>(contents, jsonSerializerSettings);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,6 @@
|
||||
// See https://aka.ms/new-console-template for more information
|
||||
|
||||
using System.Diagnostics;
|
||||
using static System.Collections.Specialized.BitVector32;
|
||||
using ConsoleApp3.DataContracts;
|
||||
using ConsoleApp3.DataContracts;
|
||||
using ConsoleApp3;
|
||||
using ConsoleApp3.Contracts;
|
||||
|
||||
namespace CardmarketBot
|
||||
{
|
||||
@@ -10,26 +8,38 @@ namespace CardmarketBot
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
|
||||
IUsedRepository usedRepository = new UsedRepository();
|
||||
|
||||
|
||||
// Kunden aus Cardmarket erstellen
|
||||
List<Kunde> kunden = new List<Kunde>();
|
||||
CardMarketParser cardMarketParser = new CardMarketParser("Skywalkerex", "Magnatpower310!!");
|
||||
CardMarketParser cardMarketParser = new CardMarketParser("More-Tcg", "Magnatpower310!!", usedRepository);
|
||||
kunden = cardMarketParser.ParseCardMarket();
|
||||
|
||||
|
||||
|
||||
// Rechnungen generieren
|
||||
List<Invoice> rechnungen = new List<Invoice>();
|
||||
List<ModelRechnung> rechnungen = new List<ModelRechnung>();
|
||||
InvoiceParser invoiceParser = new InvoiceParser(kunden);
|
||||
rechnungen = invoiceParser.GetInvoices();
|
||||
|
||||
|
||||
|
||||
foreach (var item in rechnungen)
|
||||
{
|
||||
InvoiceService invoiceService = new InvoiceService("curbpJUJmtup1t.Tq0awbHIhIRwhzMW7vrsWxLAJu.pI9X4r");
|
||||
invoiceService.InsertInvoice(item);
|
||||
SevdeskService sevdeskService = new SevdeskService("7251554968610b78ca865b2b774b4134");
|
||||
sevdeskService.Create(item);
|
||||
|
||||
}
|
||||
|
||||
// Post CSV Erstellen
|
||||
DeutschePost deutschePost = new DeutschePost(kunden);
|
||||
deutschePost.GenerateCSV();
|
||||
|
||||
|
||||
usedRepository.Insert(kunden);
|
||||
|
||||
Console.WriteLine("Fertig");
|
||||
Console.ReadLine();
|
||||
}
|
||||
|
||||
101
ConsoleApp3/SevdeskService.cs
Normal file
101
ConsoleApp3/SevdeskService.cs
Normal file
@@ -0,0 +1,101 @@
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using ConsoleApp3.DataContracts;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
|
||||
namespace CardmarketBot
|
||||
{
|
||||
class SevdeskService
|
||||
{
|
||||
private readonly HttpClient _client;
|
||||
private readonly Random _random = new();
|
||||
|
||||
public SevdeskService(string key)
|
||||
{
|
||||
_client = new HttpClient
|
||||
{
|
||||
DefaultRequestHeaders =
|
||||
{
|
||||
{ "Authorization", "7251554968610b78ca865b2b774b4134" },
|
||||
{ "Accept", "application/json" }
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public async void Create(ModelRechnung rechnung)
|
||||
{
|
||||
|
||||
rechnung.Invoice.InvoiceNumber = string.Format("RE-{0}", await GetNextInvoiceNumber());
|
||||
await WriteInv(rechnung);
|
||||
}
|
||||
|
||||
|
||||
private async Task<bool> WriteInv(ModelRechnung invoice)
|
||||
{
|
||||
var uri = "https://my.sevdesk.de/api/v1/Invoice/Factory/saveInvoice";
|
||||
|
||||
var t = JsonConvert.SerializeObject(invoice);
|
||||
var content = new StringContent(JsonConvert.SerializeObject(invoice),Encoding.UTF8, "application/json");
|
||||
|
||||
var resp = await _client.PostAsync(uri, content);
|
||||
//Console.WriteLine(resp.EnsureSuccessStatusCode());
|
||||
var contents = await resp.Content.ReadAsStringAsync();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private async Task<Invoices> GetInvoiceAsync(string id)
|
||||
{
|
||||
//var uri = LexofficeApiAddressesBuilder.InvoiceUri(id);
|
||||
var uri = "https://my.sevdesk.de/api/v1/Invoice/56501411/getPositions";
|
||||
var response = await _client.GetAsync(uri).ConfigureAwait(false);
|
||||
|
||||
response.EnsureSuccessStatusCode();
|
||||
|
||||
var contents = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
|
||||
|
||||
var jsonSerializerSettings = new JsonSerializerSettings
|
||||
{
|
||||
MissingMemberHandling = MissingMemberHandling.Ignore
|
||||
};
|
||||
return JsonConvert.DeserializeObject<Invoices>(contents, jsonSerializerSettings);
|
||||
}
|
||||
|
||||
private async Task<string> GetNextInvoiceNumber()
|
||||
{
|
||||
var uri = "https://my.sevdesk.de/api/v1/SevSequence/Factory/getByType?objectType=Invoice&type=RE";
|
||||
var response = await _client.GetAsync(uri).ConfigureAwait(false);
|
||||
response.EnsureSuccessStatusCode();
|
||||
var contents = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
|
||||
|
||||
var jsonSerializerSettings = new JsonSerializerSettings
|
||||
{
|
||||
MissingMemberHandling = MissingMemberHandling.Ignore
|
||||
};
|
||||
var ob = JsonConvert.DeserializeObject<RNumbers>(contents, jsonSerializerSettings);
|
||||
|
||||
return ob.ConfigRechnungsnummer.NextNumber;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
class RNumbers
|
||||
{
|
||||
[JsonProperty("objects")] public ConfigRechnungnummer ConfigRechnungsnummer { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
class ConfigRechnungnummer
|
||||
{
|
||||
[DataMember(Name = "format", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "format")]
|
||||
public string Format { get; set; } = "";
|
||||
|
||||
[DataMember(Name = "nextSequence", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "nextSequence")]
|
||||
public string NextNumber { get; set; } = "";
|
||||
}
|
||||
}
|
||||
27
ConsoleApp3/UsedRepository.cs
Normal file
27
ConsoleApp3/UsedRepository.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using ConsoleApp3.Contracts;
|
||||
|
||||
namespace ConsoleApp3
|
||||
{
|
||||
internal class UsedRepository : IUsedRepository
|
||||
{
|
||||
public List<string> Query => File
|
||||
.ReadLines("usedList.csv")
|
||||
.Select(l => l.Split(','))
|
||||
.Select(p => new String(p[0]))
|
||||
.ToList();
|
||||
|
||||
public void insert(string key)
|
||||
{
|
||||
key += Environment.NewLine;
|
||||
File.AppendAllText("usedList.csv", key);
|
||||
}
|
||||
|
||||
public void Insert(List<Kunde> list)
|
||||
{
|
||||
foreach(var kunde in list)
|
||||
{
|
||||
insert(kunde.BestellungID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
1
ConsoleApp3/usedList.csv
Normal file
1
ConsoleApp3/usedList.csv
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
|
|
Reference in New Issue
Block a user