Renaming
start.bat added
This commit is contained in:
34
CardMarketBot/Artikel.cs
Normal file
34
CardMarketBot/Artikel.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
// See https://aka.ms/new-console-template for more information
|
||||
|
||||
internal class Artikel
|
||||
{
|
||||
public int Amount { get; set; }
|
||||
public string GERName { get; set; } = "";
|
||||
public string ENGName { get; set; } = "";
|
||||
public string CardNumber { get; set; } = "";
|
||||
public string Source { get; set; } = "";
|
||||
public string Raritaet { get; set; } = "";
|
||||
public string Preis { get; set; } = "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
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;
|
||||
}
|
||||
|
||||
*/
|
||||
14
CardMarketBot/CardMarketBot.csproj
Normal file
14
CardMarketBot/CardMarketBot.csproj
Normal file
@@ -0,0 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Selenium.WebDriver" Version="4.10.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
132
CardMarketBot/CardMarketParser.cs
Normal file
132
CardMarketBot/CardMarketParser.cs
Normal file
@@ -0,0 +1,132 @@
|
||||
// See https://aka.ms/new-console-template for more information
|
||||
|
||||
using OpenQA.Selenium.Chrome;
|
||||
using OpenQA.Selenium;
|
||||
using System.Net;
|
||||
using System.Diagnostics;
|
||||
using ConsoleApp3.Contracts;
|
||||
|
||||
namespace CardmarketBot
|
||||
{
|
||||
class CardMarketParser
|
||||
{
|
||||
private readonly string username;
|
||||
private readonly string password;
|
||||
|
||||
Dictionary<string, Helper.Porto> portoberechnung = new Dictionary<string, Helper.Porto>()
|
||||
{
|
||||
{"1,15 €", Helper.Porto.BRIEF085 },
|
||||
{"1,30 €", Helper.Porto.BRIEF100 },
|
||||
{"2,10 €", Helper.Porto.BRIEF160 },
|
||||
{"3,25 €", Helper.Porto.BRIEF275 },
|
||||
{"2,60 €", Helper.Porto.PRIO210 },
|
||||
{"3,20 €", Helper.Porto.PRIO270 },
|
||||
};
|
||||
|
||||
public CardMarketParser(string username, string password)
|
||||
{
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public List<Kunde> ParseCardMarket()
|
||||
{
|
||||
ChromeOptions options = new ChromeOptions();
|
||||
options.AddArgument("start-maximized");
|
||||
IWebDriver cd = new ChromeDriver(options);
|
||||
cd.Url = @"https://www.cardmarket.com/de/OnePiece";
|
||||
|
||||
cd.Navigate();
|
||||
|
||||
cd.FindElement(By.CssSelector("#CookiesConsent > div > div > form > button")).Click();
|
||||
Thread.Sleep(10);
|
||||
cd.FindElement(By.Name("username")).Click();
|
||||
cd.FindElement(By.Name("username")).SendKeys(username);
|
||||
|
||||
cd.FindElement(By.Name("userPassword")).Click();
|
||||
cd.FindElement(By.Name("userPassword")).SendKeys(password);
|
||||
|
||||
cd.FindElement(By.CssSelector("#header-login > input.btn.btn-outline-primary.btn-sm")).Click();
|
||||
|
||||
|
||||
CookieContainer cookieContainer = new CookieContainer();
|
||||
foreach (var c in cd.Manage().Cookies.AllCookies)
|
||||
{
|
||||
string name = c.Name;
|
||||
string value = c.Value;
|
||||
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");
|
||||
|
||||
List<string> ids = new List<string>();
|
||||
List<Kunde> kunden = new List<Kunde>();
|
||||
|
||||
IWebElement element;
|
||||
try
|
||||
{
|
||||
element = cd.FindElement(By.XPath("/html/body/main/section/div[3]/div[4]"));
|
||||
|
||||
string content = element.Text;
|
||||
|
||||
|
||||
string[] datas = content.Split("\r\n");
|
||||
|
||||
|
||||
for (int i = 8; i < datas.Length; i += 7)
|
||||
{
|
||||
ids.Add(datas[i]);
|
||||
}
|
||||
}
|
||||
catch(OpenQA.Selenium.NotFoundException)
|
||||
{
|
||||
Console.WriteLine("Keine Verkäufe aktuell");
|
||||
return kunden;
|
||||
}
|
||||
|
||||
foreach (string id in ids)
|
||||
{
|
||||
//if (id != "1121844928") continue;
|
||||
//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"));
|
||||
|
||||
Kunde kunde = Helper.ConvertToKunde(element.Text);
|
||||
|
||||
// Bezahldatum
|
||||
element = cd.FindElement(By.XPath("/html/body/main/section/div/div[1]/div/div[2]/div/div[2]/div[2]"));
|
||||
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]"));
|
||||
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;
|
||||
|
||||
|
||||
|
||||
// Artikeln
|
||||
element = cd.FindElement(By.XPath("/html/body/main/section/div/div[1]/div/div[5]/table/tbody"));
|
||||
string artikeln = element.Text;
|
||||
kunde.Artikels = Helper.ParseArtikeln(element.Text);
|
||||
|
||||
|
||||
kunden.Add(kunde);
|
||||
Thread.Sleep(TimeSpan.FromSeconds(3));
|
||||
}
|
||||
cd.Quit();
|
||||
return kunden;
|
||||
}
|
||||
}
|
||||
}
|
||||
118
CardMarketBot/CheckSevDeskPublicList.cs
Normal file
118
CardMarketBot/CheckSevDeskPublicList.cs
Normal file
@@ -0,0 +1,118 @@
|
||||
using ConsoleApp3.Contracts;
|
||||
using OpenQA.Selenium.DevTools;
|
||||
using OpenQA.Selenium.Support.UI;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CardMarketBot
|
||||
{
|
||||
internal class CheckSevDeskPublicList : ICheckSevDesk
|
||||
{
|
||||
private static readonly object _lock = new object();
|
||||
private static bool _closed;
|
||||
|
||||
enum EResult
|
||||
{
|
||||
FAILED,
|
||||
AVAIBLE,
|
||||
OK,
|
||||
WRITTEN
|
||||
}
|
||||
private static void Write(TcpClient client, string str)
|
||||
{
|
||||
try
|
||||
{
|
||||
//SocketShutdown reason = SocketShutdown.Send;
|
||||
lock (_lock)
|
||||
{
|
||||
BinaryWriter writer = new BinaryWriter(client.GetStream());
|
||||
writer.Write(str);
|
||||
if (_closed)
|
||||
{
|
||||
//reason = SocketShutdown.Both;
|
||||
}
|
||||
}
|
||||
//client.Client.Shutdown(reason);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
Console.WriteLine($"IOException writing to socket: {e.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private static EResult Read(TcpClient client)
|
||||
{
|
||||
try
|
||||
{
|
||||
//while(true)
|
||||
//{
|
||||
try
|
||||
{
|
||||
if (!client.Connected)
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
_closed = true;
|
||||
//break;
|
||||
}
|
||||
}
|
||||
BinaryReader reader = new BinaryReader(client.GetStream());
|
||||
string res = reader.ReadString();
|
||||
if (res.Contains("OK"))
|
||||
return EResult.OK;
|
||||
return EResult.FAILED;
|
||||
}
|
||||
catch (EndOfStreamException)
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
_closed = true;
|
||||
}
|
||||
return EResult.FAILED;
|
||||
}
|
||||
//client.Client.Shutdown(SocketShutdown.Receive);
|
||||
//}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
Console.WriteLine(e.Message);
|
||||
return EResult.FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool AlreadyKnown(string verkaufsnummer)
|
||||
{
|
||||
try
|
||||
{
|
||||
TcpClient client = new TcpClient("nas.cosysda.de", 4000);
|
||||
Write(client, string.Format("#TEST#{0}", verkaufsnummer));
|
||||
EResult result = Read(client);
|
||||
|
||||
client.Client.Shutdown(SocketShutdown.Both);
|
||||
client.Close();
|
||||
|
||||
return result == EResult.OK;
|
||||
}
|
||||
catch(SocketException)
|
||||
{
|
||||
throw new SocketException();
|
||||
}
|
||||
}
|
||||
|
||||
public bool Write(string verkaufsnummer)
|
||||
{
|
||||
TcpClient client = new TcpClient("nas.cosysda.de", 4000);
|
||||
Write(client, string.Format("#WRITE#{0}", verkaufsnummer));
|
||||
EResult result = Read(client);
|
||||
client.Client.Shutdown(SocketShutdown.Both);
|
||||
client.Close();
|
||||
return result == EResult.OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
8
CardMarketBot/Contracts/ICheckSevDesk.cs
Normal file
8
CardMarketBot/Contracts/ICheckSevDesk.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace ConsoleApp3.Contracts
|
||||
{
|
||||
internal interface ICheckSevDesk
|
||||
{
|
||||
bool AlreadyKnown(string verkaufsnummer);
|
||||
bool Write(string verkaufsnummer);
|
||||
}
|
||||
}
|
||||
15
CardMarketBot/Contracts/IUsedRepository.cs
Normal file
15
CardMarketBot/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);
|
||||
}
|
||||
}
|
||||
559
CardMarketBot/DataContracts/Invoice.cs
Normal file
559
CardMarketBot/DataContracts/Invoice.cs
Normal file
@@ -0,0 +1,559 @@
|
||||
using Newtonsoft.Json;
|
||||
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(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 int? 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;
|
||||
|
||||
}
|
||||
|
||||
enum EInvoiceStatus
|
||||
{
|
||||
DEACTIVE = 50,
|
||||
DRAFT = 100,
|
||||
OPEN = 200,
|
||||
PAYED = 1000
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
67
CardMarketBot/DataContracts/InvoicePosSave.cs
Normal file
67
CardMarketBot/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
CardMarketBot/DataContracts/Invoices.cs
Normal file
12
CardMarketBot/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
CardMarketBot/DataContracts/ModelCategory.cs
Normal file
110
CardMarketBot/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
CardMarketBot/DataContracts/ModelContact.cs
Normal file
232
CardMarketBot/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
CardMarketBot/DataContracts/ModelContactAddress.cs
Normal file
114
CardMarketBot/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; } = new object();
|
||||
|
||||
/// <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
CardMarketBot/DataContracts/ModelCostCentre.cs
Normal file
62
CardMarketBot/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
CardMarketBot/DataContracts/ModelEntryType.cs
Normal file
37
CardMarketBot/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
CardMarketBot/DataContracts/ModelPaymentMethod.cs
Normal file
50
CardMarketBot/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
CardMarketBot/DataContracts/ModelRechnung.cs
Normal file
22
CardMarketBot/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
CardMarketBot/DataContracts/ModelSevUser.cs
Normal file
26
CardMarketBot/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
CardMarketBot/DataContracts/ModelStaticCountry.cs
Normal file
66
CardMarketBot/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
CardMarketBot/DataContracts/ModelTaxSet.cs
Normal file
123
CardMarketBot/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
CardMarketBot/DataContracts/ModelUnity.cs
Normal file
17
CardMarketBot/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
CardMarketBot/DeutschePost.cs
Normal file
61
CardMarketBot/DeutschePost.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
// See https://aka.ms/new-console-template for more information
|
||||
|
||||
using System.Text;
|
||||
|
||||
/*
|
||||
*
|
||||
* referalPage: /de/OnePiece
|
||||
username: Skywalkerex
|
||||
userPassword: Magnatpower310!!
|
||||
/de/OnePiece/PostGetAction/User_Login
|
||||
|
||||
curbpJUJmtup1t.Tq0awbHIhIRwhzMW7vrsWxLAJu.pI9X4r
|
||||
*/
|
||||
|
||||
namespace CardmarketBot
|
||||
{
|
||||
class DeutschePost
|
||||
{
|
||||
List<Kunde> kundenlist;
|
||||
public DeutschePost(List<Kunde> kunden)
|
||||
{
|
||||
kundenlist = kunden;
|
||||
}
|
||||
|
||||
public void GenerateCSV()
|
||||
{
|
||||
IEnumerable<IGrouping<Helper.Porto, Kunde>> groupedPorto = kundenlist.GroupBy(x => x.Versandskosten).Distinct();
|
||||
|
||||
foreach (IGrouping<Helper.Porto, Kunde> gkunde in groupedPorto)
|
||||
{
|
||||
//FileStream stream = File.Create(string.Format("test_{0}.csv", gkunde.Key.ToString()));
|
||||
Helper.Porto porto = gkunde.Key;
|
||||
using (StreamWriter writer = new StreamWriter(string.Format("./test_{0}.csv", gkunde.Key.ToString()), false, Encoding.Latin1))
|
||||
{
|
||||
|
||||
string header = "NAME;ZUSATZ;STRASSE;NUMMER;PLZ;STADT;LAND;ADRESS_TYP;REFERENZ";
|
||||
writer.WriteLine(header);
|
||||
string absender = "W&W TECH UG;Lukas Winkelmann;Schwedenschanze;70;49808;LINGEN;DEU;HOUSE";
|
||||
writer.WriteLine(absender);
|
||||
foreach (Kunde n in gkunde)
|
||||
{
|
||||
string empfanger = string.Format("{0};{1};{2};{3};{4};{5};{6};{7};{8}",
|
||||
n.Name,
|
||||
"",
|
||||
n.Strasse,
|
||||
n.Hausnummer,
|
||||
n.Plz,
|
||||
n.Ort,
|
||||
"DEU",
|
||||
//n.Land,
|
||||
"HOUSE",
|
||||
n.BestellungID
|
||||
);
|
||||
writer.WriteLine(empfanger);
|
||||
}
|
||||
writer.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
112
CardMarketBot/Helper.cs
Normal file
112
CardMarketBot/Helper.cs
Normal file
@@ -0,0 +1,112 @@
|
||||
// See https://aka.ms/new-console-template for more information
|
||||
|
||||
using System.Diagnostics;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
static class Helper
|
||||
{
|
||||
public enum Porto
|
||||
{
|
||||
FAILED,
|
||||
BRIEF085,
|
||||
BRIEF100,
|
||||
BRIEF160,
|
||||
BRIEF275,
|
||||
PRIO210,
|
||||
PRIO270
|
||||
}
|
||||
internal static Kunde ConvertToKunde(string text)
|
||||
{
|
||||
|
||||
string[] datas = text.Split("\r\n");
|
||||
string name = datas[0];
|
||||
string adresseUNDHausnummer = datas[datas.Length-3];
|
||||
string plzUNDOrt = datas[datas.Length-2];
|
||||
string land = datas[datas.Length-1];
|
||||
|
||||
datas = plzUNDOrt.Split(" ");
|
||||
string plz = datas[0];
|
||||
string ort = datas[1];
|
||||
|
||||
datas = adresseUNDHausnummer.Split(" ");
|
||||
string strasse = "";
|
||||
string hausnummer = "";
|
||||
Trace.WriteLine(datas.Length);
|
||||
if (datas.Length <= 1)
|
||||
{
|
||||
Regex myRegex = new Regex("[0-9]*$");
|
||||
var matched = myRegex.Match(adresseUNDHausnummer);
|
||||
strasse = adresseUNDHausnummer.Substring(0, matched.Index);
|
||||
hausnummer = adresseUNDHausnummer.Substring(matched.Index);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
for (int i = 0; i < datas.Length - 1; i++)
|
||||
{
|
||||
strasse += datas[i] + " ";
|
||||
}
|
||||
strasse = strasse.Trim();
|
||||
hausnummer = datas[datas.Length - 1];
|
||||
}
|
||||
return new Kunde(name, strasse, hausnummer, plz, ort, land);
|
||||
|
||||
}
|
||||
|
||||
internal static List<Artikel> ParseArtikeln(string text)
|
||||
{
|
||||
List<Artikel> result = new List<Artikel>();
|
||||
string[] datas = text.Split("\r\n");
|
||||
|
||||
|
||||
int anzahl = datas.Length / 6;
|
||||
|
||||
for (int i = 0; i < datas.Length; i += 6)
|
||||
{
|
||||
Artikel temp = new Artikel();
|
||||
var xFound = datas[i].IndexOf("x");
|
||||
var am = datas[i].Substring(0, xFound);
|
||||
temp.Amount = Convert.ToInt32(am);
|
||||
temp.GERName = datas[i].Substring(xFound + 1);
|
||||
temp.ENGName = datas[i + 1];
|
||||
temp.CardNumber = datas[i + 2];
|
||||
temp.Source = datas[i + 3];
|
||||
temp.Raritaet = datas[i + 4];
|
||||
temp.Preis = datas[i + 5].Split(' ')[0];
|
||||
result.Add(temp);
|
||||
}
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
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;
|
||||
}
|
||||
|
||||
*/
|
||||
171
CardMarketBot/InvoiceParser.cs
Normal file
171
CardMarketBot/InvoiceParser.cs
Normal file
@@ -0,0 +1,171 @@
|
||||
// See https://aka.ms/new-console-template for more information
|
||||
|
||||
using ConsoleApp3.DataContracts;
|
||||
using System.Diagnostics;
|
||||
|
||||
/*
|
||||
*
|
||||
* referalPage: /de/OnePiece
|
||||
username: Skywalkerex
|
||||
userPassword: Magnatpower310!!
|
||||
/de/OnePiece/PostGetAction/User_Login
|
||||
|
||||
curbpJUJmtup1t.Tq0awbHIhIRwhzMW7vrsWxLAJu.pI9X4r
|
||||
*/
|
||||
|
||||
namespace CardmarketBot
|
||||
{
|
||||
class InvoiceParser
|
||||
{
|
||||
Dictionary<Helper.Porto, decimal> PortoPreis = new Dictionary<Helper.Porto, decimal>()
|
||||
{
|
||||
{Helper.Porto.BRIEF085, 1.15m },
|
||||
{Helper.Porto.BRIEF100, 1.30m },
|
||||
{Helper.Porto.BRIEF160, 2.10m },
|
||||
{Helper.Porto.BRIEF275, 3.25m },
|
||||
{Helper.Porto.PRIO210, 2.60m },
|
||||
{Helper.Porto.PRIO270, 3.20m }
|
||||
};
|
||||
private static string DateTimeConverter(string input)
|
||||
{
|
||||
//2023-06-20T11:30:00"
|
||||
//2023-02-22T00:00:00.000+01:0
|
||||
string datum = input.Substring(0, 10);
|
||||
string uhrzeit = input.Substring(10, input.Length - 10);
|
||||
input = string.Format("{0} {1}", datum, uhrzeit);
|
||||
DateTime converted = Convert.ToDateTime(input);
|
||||
var format = "yyyy-MM-ddTHH:mm:ssK";
|
||||
string res = converted.ToString(format);
|
||||
return string.Format("{0}.000+01:00", res);
|
||||
|
||||
}
|
||||
List<Kunde> kunden;
|
||||
public InvoiceParser(List<Kunde> kunden)
|
||||
{
|
||||
this.kunden = kunden;
|
||||
}
|
||||
|
||||
public List<ModelRechnung> GetInvoices()
|
||||
{
|
||||
List<ModelRechnung> result = new List<ModelRechnung>();
|
||||
|
||||
// 1 => Deutschland
|
||||
// 2 => Schweiz
|
||||
// 3 => Österreich
|
||||
// 6 => Belgien
|
||||
// 11 => Frankreich
|
||||
// 13 => Irland
|
||||
// 14 => Italien
|
||||
// 17 => Luxemburg
|
||||
|
||||
Dictionary<string, int> LaenderCodes = new Dictionary<string, int>()
|
||||
{
|
||||
{ "Deutschland", 1 },
|
||||
{ "Schweiz", 2 },
|
||||
{ "Österreich", 3 },
|
||||
{ "Belgien",6 },
|
||||
{ "Dänemark", 8 },
|
||||
{ "Frankreich", 11 },
|
||||
{ "Irland", 13 },
|
||||
{ "Italien", 14 },
|
||||
{ "Luxemburg", 17 }
|
||||
};
|
||||
|
||||
|
||||
|
||||
foreach (Kunde kunde in kunden)
|
||||
{
|
||||
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 das Lieferdatum dem Bestelldatum entspricht.";
|
||||
rechnung.FootText = "Ihre Rechnung ist bereits über Cardmarket beglichen worden.";
|
||||
rechnung.TimeToPay = 14;
|
||||
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();
|
||||
|
||||
if(LaenderCodes.ContainsKey(kunde.Land))
|
||||
{
|
||||
rechnung.AddressCountry.Id = LaenderCodes[kunde.Land];
|
||||
}
|
||||
else
|
||||
{
|
||||
rechnung.AddressCountry.Id = 1;
|
||||
Console.WriteLine($"Fehler Land wurde nicht richtig gefunden {kunde.Land} Bitte in Sevdesk kontrollieren und Damian die\n" +
|
||||
$"Fehlercode #LC01#{kunde.BestellungID} melden");
|
||||
}
|
||||
|
||||
|
||||
//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";
|
||||
|
||||
rechnung.Contact = new ModelContact()
|
||||
{
|
||||
Id = 64055231,
|
||||
ObjectName = "Contact"
|
||||
};
|
||||
|
||||
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,
|
||||
Name = "Versandskosten",
|
||||
PositionNumber = 0,
|
||||
Discount = 0,
|
||||
TaxRate = 19,
|
||||
PriceTax = 19
|
||||
};
|
||||
if(kunde.OverrideVersandskosten != null)
|
||||
{
|
||||
temp.InvoicePosSaves[temp.InvoicePosSaves.Length - 1].Price = Convert.ToDecimal(kunde.OverrideVersandskosten);
|
||||
temp.InvoicePosSaves[temp.InvoicePosSaves.Length - 1].Price = Convert.ToDecimal(kunde.OverrideVersandskosten);
|
||||
}
|
||||
else
|
||||
{
|
||||
temp.InvoicePosSaves[temp.InvoicePosSaves.Length - 1].Price = PortoPreis[kunde.Versandskosten];
|
||||
temp.InvoicePosSaves[temp.InvoicePosSaves.Length - 1].PriceGross = PortoPreis[kunde.Versandskosten];
|
||||
}
|
||||
result.Add(temp);
|
||||
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
55
CardMarketBot/Kunde.cs
Normal file
55
CardMarketBot/Kunde.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
// See https://aka.ms/new-console-template for more information
|
||||
|
||||
class Kunde
|
||||
{
|
||||
string bestellungID = "";
|
||||
Helper.Porto versandskosten;
|
||||
string? overrideVersandskosten;
|
||||
string name;
|
||||
string strasse;
|
||||
string hausnummer;
|
||||
string plz;
|
||||
string ort;
|
||||
string land;
|
||||
|
||||
List<Artikel> artikels = new List<Artikel>();
|
||||
public DateTime Bezahldatum { get; set; }
|
||||
|
||||
public string Name { get => name; set => name = value; }
|
||||
public string Strasse { get => strasse; set => strasse = value; }
|
||||
public string Plz { get => plz; set => plz = value; }
|
||||
public string Ort { get => ort; set => ort = value; }
|
||||
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
|
||||
{
|
||||
if (value == null) return;
|
||||
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)
|
||||
{
|
||||
name = Name;
|
||||
hausnummer = Hausnummer;
|
||||
strasse = Strasse;
|
||||
plz = PLZ;
|
||||
ort = Ort;
|
||||
land = Land;
|
||||
Versandskosten = Helper.Porto.FAILED;
|
||||
}
|
||||
}
|
||||
31
CardMarketBot/LexofficeApiAddressesBuilder.cs
Normal file
31
CardMarketBot/LexofficeApiAddressesBuilder.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
// See https://aka.ms/new-console-template for more information
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* referalPage: /de/OnePiece
|
||||
username: Skywalkerex
|
||||
userPassword: Magnatpower310!!
|
||||
/de/OnePiece/PostGetAction/User_Login
|
||||
|
||||
curbpJUJmtup1t.Tq0awbHIhIRwhzMW7vrsWxLAJu.pI9X4r
|
||||
*/
|
||||
|
||||
namespace CardmarketBot
|
||||
{
|
||||
static class LexofficeApiAddressesBuilder
|
||||
{
|
||||
private static string BaseAddress = @"https://api.lexoffice.io";
|
||||
private static string Invoice = "v1/invoices";
|
||||
|
||||
public static string InvoiceUri(string id)
|
||||
{
|
||||
return $"{BaseAddress}/{Invoice}/{id}";
|
||||
}
|
||||
|
||||
public static string CreateInvoice()
|
||||
{
|
||||
return $"{BaseAddress}/{Invoice}";
|
||||
}
|
||||
}
|
||||
}
|
||||
78
CardMarketBot/Program.cs
Normal file
78
CardMarketBot/Program.cs
Normal file
@@ -0,0 +1,78 @@
|
||||
using ConsoleApp3.DataContracts;
|
||||
using ConsoleApp3;
|
||||
using ConsoleApp3.Contracts;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Diagnostics;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using OpenQA.Selenium.DevTools.V112.Network;
|
||||
using OpenQA.Selenium.DevTools.V112.Debugger;
|
||||
using CardMarketBot;
|
||||
|
||||
namespace CardmarketBot
|
||||
{
|
||||
internal class Programm
|
||||
{
|
||||
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
ICheckSevDesk checkSevDesk = new CheckSevDeskPublicList();
|
||||
|
||||
|
||||
|
||||
// Kunden aus Cardmarket erstellen
|
||||
List<Kunde> kunden = new List<Kunde>();
|
||||
CardMarketParser cardMarketParser = new CardMarketParser("More-Tcg", "Magnatpower310!!");
|
||||
kunden = cardMarketParser.ParseCardMarket();
|
||||
|
||||
|
||||
|
||||
// Rechnungen generieren
|
||||
List<ModelRechnung> rechnungen = new List<ModelRechnung>();
|
||||
InvoiceParser invoiceParser = new InvoiceParser(kunden);
|
||||
rechnungen = invoiceParser.GetInvoices();
|
||||
|
||||
|
||||
|
||||
foreach (ModelRechnung item in rechnungen)
|
||||
{
|
||||
if(item.Invoice == null) continue;
|
||||
var str_header = item.Invoice.Header;
|
||||
if (str_header != null)
|
||||
{
|
||||
Regex regex = new Regex("[0-9]*$");
|
||||
Match matched = regex.Match(str_header);
|
||||
string verkaufnummer = str_header.Substring(matched.Index);
|
||||
Console.Write($"Teste {verkaufnummer} : ");
|
||||
if (checkSevDesk.AlreadyKnown(verkaufnummer))
|
||||
{
|
||||
Console.Write("wurde noch nicht in Sevdesk erfasst ");
|
||||
SevdeskService sevdeskService = new SevdeskService("7251554968610b78ca865b2b774b4134");
|
||||
sevdeskService.Create(item);
|
||||
Console.WriteLine("nun in Sevdesk eingetragen");
|
||||
checkSevDesk.Write(verkaufnummer);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("wurde bereits in Sevdesk erfasst, wird somit übersprungen. Jedoch wird PostCSV erstellt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Post CSV Erstellen
|
||||
DeutschePost deutschePost = new DeutschePost(kunden);
|
||||
deutschePost.GenerateCSV();
|
||||
|
||||
Console.WriteLine("Fertig");
|
||||
Console.ReadLine();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
105
CardMarketBot/SevdeskService.cs
Normal file
105
CardMarketBot/SevdeskService.cs
Normal file
@@ -0,0 +1,105 @@
|
||||
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)
|
||||
{
|
||||
if (rechnung.Invoice == null) return;
|
||||
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
|
||||
};
|
||||
#pragma warning disable CS8603 // Mögliche Nullverweisrückgabe.
|
||||
return JsonConvert.DeserializeObject<Invoices>(contents, jsonSerializerSettings);
|
||||
#pragma warning restore CS8603 // Mögliche Nullverweisrückgabe.
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
if (ob == null) return "";
|
||||
if (ob.ConfigRechnungsnummer == null) return "";
|
||||
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; } = "";
|
||||
}
|
||||
}
|
||||
12
CardMarketBot/SocketClient.cs
Normal file
12
CardMarketBot/SocketClient.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CardMarketBot
|
||||
{
|
||||
internal class SocketClient
|
||||
{
|
||||
}
|
||||
}
|
||||
27
CardMarketBot/UsedRepository.cs
Normal file
27
CardMarketBot/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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
6
CardMarketBot/test_BRIEF085.csv
Normal file
6
CardMarketBot/test_BRIEF085.csv
Normal file
@@ -0,0 +1,6 @@
|
||||
NAME;ZUSATZ;STRASSE;NUMMER;PLZ;STADT;LAND;ADRESS_TYP;REFERENZ
|
||||
W&W TECH UG;Lukas Winkelmann;Schwedenschanze;70;49808;LINGEN;DEU;HOUSE
|
||||
Pierre KOch;;Zum Kuckeshof;22;47239;Duisburg;DEU;HOUSE;1122664505
|
||||
Yunus Elitok;;Heckteichstra<72>e;13;40627;D<>sseldorf;DEU;HOUSE;1122677794
|
||||
Dennis Wolf;;Edelherr-Ludolf-Ring;13;48432;Rheine;DEU;HOUSE;1122347599
|
||||
Corin Repina;;Richard-Wagner-Str.;47;78224;Singen;DEU;HOUSE;1122723098
|
||||
|
3
CardMarketBot/test_BRIEF100.csv
Normal file
3
CardMarketBot/test_BRIEF100.csv
Normal file
@@ -0,0 +1,3 @@
|
||||
NAME;ZUSATZ;STRASSE;NUMMER;PLZ;STADT;LAND;ADRESS_TYP;REFERENZ
|
||||
W&W TECH UG;Lukas Winkelmann;Schwedenschanze;70;49808;LINGEN;DEU;HOUSE
|
||||
Bastian Himmel;;Heinrich-Rau-Stra<72>e;17;16816;Neuruppin;DEU;HOUSE;1122659468
|
||||
|
3
CardMarketBot/test_FAILED.csv
Normal file
3
CardMarketBot/test_FAILED.csv
Normal file
@@ -0,0 +1,3 @@
|
||||
NAME;ZUSATZ;STRASSE;NUMMER;PLZ;STADT;LAND;ADRESS_TYP;REFERENZ
|
||||
W&W TECH UG;Lukas Winkelmann;Schwedenschanze;70;49808;LINGEN;DEU;HOUSE
|
||||
Alan Hoban;;9 Kings Hall Phibsboro;Road;D07KX07;Dublin,;DEU;HOUSE;1122708517
|
||||
|
3
CardMarketBot/test_PRIO210.csv
Normal file
3
CardMarketBot/test_PRIO210.csv
Normal file
@@ -0,0 +1,3 @@
|
||||
NAME;ZUSATZ;STRASSE;NUMMER;PLZ;STADT;LAND;ADRESS_TYP;REFERENZ
|
||||
W&W TECH UG;Lukas Winkelmann;Schwedenschanze;70;49808;LINGEN;DEU;HOUSE
|
||||
Torben Clewinig;;Goslarer Stra<72>e;79;70499;Stuttgart;DEU;HOUSE;1122380365
|
||||
|
Reference in New Issue
Block a user