ERPXTpl 1.1.0
dotnet add package ERPXTpl --version 1.1.0
NuGet\Install-Package ERPXTpl -Version 1.1.0
<PackageReference Include="ERPXTpl" Version="1.1.0" />
paket add ERPXTpl --version 1.1.0
#r "nuget: ERPXTpl, 1.1.0"
// Install ERPXTpl as a Cake Addin
#addin nuget:?package=ERPXTpl&version=1.1.0
// Install ERPXTpl as a Cake Tool
#tool nuget:?package=ERPXTpl&version=1.1.0
# ERPXT.pl - .NET Helper library
A library that is to facilitate the use of the ERP XT API without unnecessary implementation.
Requirements
You need to have ClientId and SecretKey to authorize API server. More information about how to get this data you can found on this page ERPXT-Authorization
Installation
Package Manager
Install-Package ERPXTpl
.NET CLI
dotnet add package ERPXTpl
or just find library in Nuget Package Manager in Visual Studio 😉
Usage
You need to create a main object that takes two parameters - ClientId and SecretKey.
ERPXT erpxt = new ERPXT(clientId, secretKey);
The token is saved in the memory cache. Prior to each request to the API, its validity is checked. If the token is expired, the server is asked for a new token which is saved to the cache.
Each request is wrapped in a Result object. Result consists of Data, StatusCode, and Message
Data = returned object from response.
StatusCode = HttpCode from response or "ERROR" if something went wrong before send request.
Message = Message from server if something went wrong or message from internal validator.
Examples
Methods are really simple and readable but if you need more information, you can ask me by creating issue 😃
Bank Accounts
Add Bank Account
BankAccount bankAccount = new BankAccount();
bankAccount.AccountNumber = "51239841214300002211";
bankAccount.BankName = "Best Bank Ever";
bankAccount.Symbol = "BBE";
bankAccount.ReportingPeriod = ReportingPeriod.MONTHLY;
bankAccount.Primary = false;
var addBankAcc = await erp.AddBankAccount(bankAccount);
Modify Bank Account
BankAccount bankAccount = new BankAccount();
bankAccount.Id = 10176471;
bankAccount.AccountNumber = "44991234888800002244";
bankAccount.BankName = "Our Best Bank";
bankAccount.Symbol = "BBE";
bankAccount.ReportingPeriod = ReportingPeriod.MONTHLY;
var modifyBank = await erp.ModifyBankAccount(bankAccount);
Take all Bank Accounts
var bankList = await erp.GetBankAccount();
Take a specific Bank Account based on Id
var getBank = await erp.GetBankAccount(10176471);
Delete Bank Account
var deleteBank = await erp.DeleteBankAccount(10176471);
Payment Methods
Add Payment Method
PaymentMethod paymentMethod = new PaymentMethod();
paymentMethod.Name = "FastPayOnline";
paymentMethod.Primary = false;
paymentMethod.Deadline = 14;
paymentMethod.Type = PaymentMethodType.ACCOUNT_PAYMENT;
var addPayment = await erp.AddPaymentMethod(paymentMethod);
Modify Payment Method
PaymentMethod paymentMethod = new PaymentMethod();
paymentMethod.Id = 10331712;
paymentMethod.Name = "2Fast2PayOnline";
paymentMethod.Primary = false;
paymentMethod.Deadline = 1;
paymentMethod.Type = PaymentMethodType.ACCOUNT_PAYMENT;
var modifyPaymentMethod = await erp.ModifyPaymentMethod(paymentMethod);
Take list of Payment Methods
var listOfPaymentMethods = await erp.GetPaymentMethod();
Take specific Payment Method based on Id
var getPaymentMethod = await erp.GetPaymentMethod(10331712);
Delete Payment Method
var deletePaymentMethod = await erp.DeletePaymentMethod(10331712);
Products
Add Product
Product product = new Product();
product.Name = "Epic Premium Product";
product.Description = "Best description ever!";
product.ItemCode = "27.11.22.0";
product.ProductCode = "EPP";
product.UnitOfMeasurment = "piece";
product.SaleNetPrice = 139.99;
product.Rate = Rate.TWENTY_THREE_PERCENT;
var addProduct = await erp.AddProduct(product);
Modify Product
Product product = new Product();
product.Id = 11661992;
product.Name = "Epic Premium Product";
product.Description = "Useful information!";
product.ItemCode = "27.11.22.0";
product.ProductCode = "EPP/1";
product.UnitOfMeasurment = "packaging";
product.SaleGrossPrice = 169.99;
product.Rate = Rate.FIVE_PERCENT;
var modifyProduct = await erp.ModifyProduct(product);
Take list of Products
var listOfProducts = await erp.GetProduct();
Take specific product based on Id
var getProduct = await erp.GetProduct(11661992);
Delete product
var deleteProduct = await erp.DeleteProduct(11661992);
Customers
Add Customer
Customer customer = new Customer();
customer.Name = "Comarch S.A";
customer.CountryCode = "PL";
customer.CustomerTaxNumber = "6770065406";
customer.CustomerCode = "Customer/PL/1";
customer.CustomerType = CustomerType.BUSINESS_ENTITY;
customer.CustomerStatus = CustomerStatus.DOMESTIC;
customer.Mail = "erpxt@comarch.pl";
customer.PhoneNumber = "126814300";
customer.Address.BuildingNumber = "39A";
customer.Address.FlatNumber = "1";
customer.Address.Street = "Al.Jana Paw�a II";
customer.Address.PostalCode = "31-864";
customer.Address.City = "Cracow";
var addCustomer = await erp.AddCustomer(customer);
Modify Customer
Customer customer = new Customer();
customer.Id = 13632471;
customer.Name = "Comarch Spolka Akcyjna";
customer.CountryCode = "PL";
customer.CustomerTaxNumber = "6770065406";
customer.CustomerCode = "Customer/PL/1";
customer.CustomerType = CustomerType.BUSINESS_ENTITY;
customer.CustomerStatus = CustomerStatus.DOMESTIC;
customer.Mail = "erpxt@comarch.pl";
customer.PhoneNumber = "126814300";
customer.Address.BuildingNumber = "39A";
customer.Address.FlatNumber = "3";
customer.Address.Street = "Al.Jana Paw�a II";
customer.Address.PostalCode = "31-864";
customer.Address.City = "Cracow";
var modifyCustomer = await erp.ModifyCustomer(customer);
Take list of Customers
var listOfCustomers = await erp.GetCustomer();
Take specific Customer based on Id
var getCustomer = await erp.GetCustomer(13632471);
Take specific Customer based on TIN
var getCustomer = await erp.GetCustomer("6770065406");
Take specific Customer based on Email
var getCustomer = await erp.GetCustomerByEmail("erpxt@comarch.pl"); // Can return more than one customer if few of them have same email
Delete Customer
var deleteCustomer = await erp.DeleteCustomer(13632471);
OSS Procedure
Take list of EU Country codes
var listOfCodes = await erp.GetCountries();
Take list of foreign VAT rates
var listOfVatRates = await erp.GetVatRates();
Sales Invoices
Add Sales Invoice
SalesInvoice invoice = new SalesInvoice();
invoice.PaymentStatus = PaymentStatus.PAID;
invoice.OSSProcedureCountryCode = "DE";
invoice.IsOSSProcedure = true;
invoice.PurchasingPartyId = 13632511;
invoice.ReceivingPartyId = 13632511;
invoice.PaymentTypeId = 10199423;
invoice.BankAccountId = 10176453;
invoice.IssueDate = "2022-01-01";
invoice.SalesDate = "2022-01-02";
invoice.InvoiceType = InvoiceType.TOTAL;
invoice.Description = "Invoice for our business partner.";
invoice.Items.AddRange(new List<Item>
{
new Item() { ProductId = 11626227, Quantity = 99, ProductCurrencyPrice = 15.52M, VatRateId = 75 },
new Item() { ProductId = 11290439, Quantity = 1, ProductCurrencyPrice = 25.00M, ProductDescription = "Hello2", VatRateId = 75 }
});
var addInvoice = await erp.AddSalesInvoice(invoice);
Modify Sales Invoice
SalesInvoice invoice = new SalesInvoice();
invoice.Id = 22386347;
invoice.PaymentStatus = PaymentStatus.UNPAID;
invoice.IsOSSProcedure = false;
invoice.PurchasingPartyId = 12466411;
invoice.ReceivingPartyId = 12466411;
invoice.PaymentTypeId = 10199423;
invoice.BankAccountId = 10176453;
invoice.IssueDate = "2022-01-01";
invoice.SalesDate = "2022-01-05";
invoice.InvoiceType = InvoiceType.TOTAL;
invoice.Description = "Send invoice by email";
invoice.Items.AddRange(new List<Item>
{
new Item() { ProductId = 11626227, Quantity = 35, ProductCurrencyPrice = 12.21M},
new Item() { ProductId = 11290439, Quantity = 7, ProductCurrencyPrice = 125.00M, ProductDescription = "Color RED",}
});
var modifyInvoice = await erp.ModifySalesInvoice(invoice);
Take list of Sales Invoices
var listOfInvoices = await erp.GetSalesInvoice();
Take Sales Invoice based on Id
var invoice = await erp.GetSalesInvoice(22386352);
Take Sales Invoice based on Number
var invoice = await erp.GetSalesInvoice("2022/1/FS/5")
Get last X issued Sales Invoices
var lastInvoices = await erp.GetLastInvoices(5); // Last 5 invoices
Delete Sales Invoice
var deleteInvoice = await erp.DeleteSalesInvoice(22386353);
Proforma Invoices
Add Proforma Invoice
ProformaInvoice proforma = new ProformaInvoice();
proforma.OSSProcedureCountryCode = "DE";
proforma.IsOSSProcedure = true;
proforma.PurchasingPartyId = 13632511;
proforma.ReceivingPartyId = 13632511;
proforma.PaymentTypeId = 10199423;
proforma.BankAccountId = 10176453;
proforma.IssueDate = "2022-01-01";
proforma.InvoiceType = InvoiceType.SUBTOTAL;
proforma.Description = "Proforma with our best offer.";
proforma.Items.AddRange(new List<Item>
{
new Item() { ProductId = 11626227, Quantity = 12, ProductCurrencyPrice = 88.11M, VatRateId = 75 },
new Item() { ProductId = 11290439, Quantity = 3, ProductCurrencyPrice = 55.00M, ProductDescription = "Test description", VatRateId = 75 }
});
var addProforma = await erp.AddProformaInvoice(proforma);
Modify Proforma Invoice
ProformaInvoice proforma = new ProformaInvoice();
proforma.Id = 22386743;
proforma.OSSProcedureCountryCode = "DE";
proforma.IsOSSProcedure = true;
proforma.PurchasingPartyId = 13632511;
proforma.ReceivingPartyId = 13632511;
proforma.PaymentTypeId = 10199423;
proforma.BankAccountId = 10176453;
proforma.IssueDate = "2022-01-05";
proforma.InvoiceType = InvoiceType.SUBTOTAL;
proforma.Description = "Proforma with our worst offer.";
proforma.Items.AddRange(new List<Item>
{
new Item() { ProductId = 11626227, Quantity = 12, ProductCurrencyPrice = 300.11M, VatRateId = 75 },
new Item() { ProductId = 11290439, Quantity = 3, ProductCurrencyPrice = 155.00M, ProductDescription = "Sell with 100 percent margin", VatRateId = 75 }
});
var modifyProforma = await erp.ModifyProformaInvoice(proforma);
Take all Proforma Invoices
var listOfProforms = await erp.GetProformaInvoice();
Take Proforma Invoice based on Id
var getProforma = await erp.GetProformaInvoice(14745129);
Take Proforma Invoice which are converted to other documents or not
var getConvertedProforms = await erp.GetProformaInvoice(true); // if false, you will get unconverted proforms
Delete Proforma Invoice
var deleteProforma = await erp.DeleteProformaInvoice(22386743);
Prints
Take list of Custom Prints
var listOfCustomPrints = await erp.GetPrintTemplates();
Take default Sales Invoice print for Customer
var defaultSalesPrintForCustomer = await erp.GetInvoicePrintByCustomer(22386352);
Take custom Sales Invoice Print
var customInvoicePrint = await erp.GetInvoiceCustomPrint(22386352, 10161077);
Take default Proforma Invoice print for Customer
var defaultProformaPrintForCustomer = await erp.GetProformaPrintByCustomer(15339936);
Take custom Proforma Invoice Print
var customProformaPrint = await erp.GetProformaCustomPrint(15339936, 10177498);
Save print to PDF
string base64Print = customProformaPrint.Data.ToString();
string path = "Z:\\OurCompany\\PrintsForCustomers\\";
var getPrintPdf = await erp.SavePrintToFile(base64Print, path);
License
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.Extensions.Caching.Abstractions (>= 6.0.0)
- Microsoft.Extensions.Caching.Memory (>= 6.0.0)
- Microsoft.Extensions.Http (>= 6.0.0)
- Newtonsoft.Json (>= 13.0.1)
- System.Text.Json (>= 6.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.