diff --git a/FortnoxSDK.Tests/ConnectorTests/PredefinedAccountsTests.cs b/FortnoxSDK.Tests/ConnectorTests/PredefinedAccountsTests.cs index c75abedb..7ead8302 100644 --- a/FortnoxSDK.Tests/ConnectorTests/PredefinedAccountsTests.cs +++ b/FortnoxSDK.Tests/ConnectorTests/PredefinedAccountsTests.cs @@ -1,7 +1,8 @@ -using System.Linq; -using System.Threading.Tasks; using Fortnox.SDK; +using Fortnox.SDK.Entities; using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Linq; +using System.Threading.Tasks; namespace FortnoxSDK.Tests.ConnectorTests; @@ -16,10 +17,10 @@ public async Task Test_PredefinedAccounts_CRUD() var connector = FortnoxClient.PredefinedAccountsConnector; //Get - var bygAccount = await connector.GetAsync("CONSTRUCTION_DEB"); + var bygAccount = await connector.GetAsync(PredefinedAccountName.ReverseChargeSEDebit); Assert.AreEqual(2647, bygAccount.Account); - var patentAccount = await connector.GetAsync("PRODUCT_DEB"); + var patentAccount = await connector.GetAsync(PredefinedAccountName.ReverseChargeGoodsEUDebit); Assert.AreEqual(2645, patentAccount.Account); //Update @@ -52,4 +53,25 @@ public async Task Test_Find() Assert.AreEqual(42, limitedCollection.TotalResources); */ } + + /// + /// It looks like that not all the Fortnox account have all accounts + /// so this test may fail. Further investigations are needed in this regard. + /// + /// + //[TestMethod] + //public async Task Test_FindAllAccounts() + //{ + // var connector = FortnoxClient.PredefinedAccountsConnector; + + // var fields = typeof(PredefinedAccountName) + // .GetFields(BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy) + // .Where(fi => fi.IsLiteral && !fi.IsInitOnly); + + // foreach (var field in fields) + // { + // var predefineradAccount = await connector.GetAsync((string?)field.GetValue(null)); + // Assert.IsNotNull(predefineradAccount); + // } + //} } \ No newline at end of file diff --git a/FortnoxSDK/Entities/Predefined Accounts/PredefinedAccountName.cs b/FortnoxSDK/Entities/Predefined Accounts/PredefinedAccountName.cs new file mode 100644 index 00000000..7e235172 --- /dev/null +++ b/FortnoxSDK/Entities/Predefined Accounts/PredefinedAccountName.cs @@ -0,0 +1,214 @@ +namespace Fortnox.SDK.Entities; + +public static class PredefinedAccountName +{ + #region Payment Accounts / Betalkonton + /// + /// Bankgiro + /// + public const string Bankgiro = "BG"; + /// + /// Plusgiro + /// + public const string Plusgiro = "PG"; + /// + /// Kontantbetalning + /// + public const string Cash = "CASH"; + /// + /// Kontantbet. via kontokort + /// + public const string CashByCard = "CASHBYCARD"; + /// + /// Autogiro + /// + public const string Autogiro = "AG"; + #endregion + + #region Purchase Accounts / Inköp + /// + /// Inköp + /// + public const string Purchases = "PURCASE"; + /// + /// Leverantörsskuld + /// + public const string AccountsPayable = "SUPDEBT"; + /// + /// Faktureringsavgift levfakt + /// + public const string PurchasesInvoiceFee = "SUPADMFEE"; + /// + /// Frakt levfakt + /// + public const string PurchasesFreight = "SUPFREIGHT"; + /// + /// Kassarabatt, erhållen + /// + public const string PurchasesCashDiscount = "CASHDISCOUNTIN"; + #endregion + + #region Sale Accounts / Försäljning + /// + /// Försäljning 25% vara + /// + public const string Sales25Goods = "SALES_25_SE"; + /// + /// Försäljning 25% tjänst + /// + public const string Sales25Services = "SALES_25_SE2"; + /// + /// Försäljning 12% vara + /// + public const string Sales12Goods = "SALES_12_SE"; + /// + /// Försäljning 12% tjänst + /// + public const string Sales12Services = "SALES_12_SE2"; + /// + /// Försäljning 6% vara + /// + public const string Sales6Goods = "SALES_6_SE"; + /// + /// Försäljning 6% tjänst + /// + public const string Sales6Services = "SALES_6_SE2"; + /// + /// Försäljning 0% vara + /// + public const string Sales0Goods = "SALES_0_SE"; + /// + /// Försäljning 0% tjänst + /// + public const string Sales0Services = "SALES_0_SE2"; + /// + /// Försäljning SE, omvänd skattskyldighet + /// + public const string SalesSEReverseCharge = "SALESCONSTR2"; + /// + /// Försäljning EU vara, omvänd skattskyldighet + /// + public const string SalesEUGoodsReverseCharge = "SALESEUREV"; + /// + /// Försäljning EU tjänst, omvänd skattskyldighet + /// + public const string SalesEUServicesReverseCharge = "SALESEUREV2"; + /// + /// Försäljning EU vara, momspliktig + /// + public const string SalesEUGoodsVat = "SALESEUVAT"; + /// + /// Försäljning EU tjänst, momspliktig + /// + public const string SalesEUServicesVat = "SALESEUVAT2"; + /// + /// Försäljning Export vara + /// + public const string SalesExtraEUGoods = "SALESEXPORT"; + /// + /// Försäljning Export tjänst + /// + public const string SalesExtraEUServices = "SALESEXPORT2"; + /// + /// Kundfordran + /// + public const string AccountsReceivable = "CUSTCLAIM"; + /// + /// Faktureringsavgift + /// + public const string SalesInvoiceFee = "ADMFEE"; + /// + /// Frakt + /// + public const string SalesFreight = "FREIGHT"; + /// + /// Kassarabatt, lämnad + /// + public const string SalesCashDiscount = "CASHDISCOUNTOUT"; + /// + /// Påminnelseavgift + /// + public const string ReminderFee = "DEMAND"; + /// + /// Dröjsmålsränta + /// + public const string PenaltyInterest = "INTEREST"; + /// + /// Avrundning + /// + public const string Rounding = "ROUNDOFF"; + #endregion + + #region Vat Accounts / Moms + /// + /// Utgående Moms MP1 25% + /// + public const string SalesVat1 = "OUTVAT_MP1"; + /// + /// Utgående Moms MP2 12% + /// + public const string SalesVat2 = "OUTVAT_MP2"; + /// + /// Utgående Moms MP3 6% + /// + public const string SalesVat3 = "OUTVAT_MP3"; + /// + /// Ingående moms + /// + public const string PurchasesVat = "INVAT"; + /// + /// Vara unionsinternt förvärv debit + /// + public const string ReverseChargeGoodsEUDebit = "PRODUCT_DEB"; + /// + /// Vara unionsinternt förvärv credit + /// + public const string ReverseChargeGoodsEUCredit = "PRODUCT_CRE"; + /// + /// Tjänst unionsinternt förvärv debit + /// + public const string ReverseChargeServicesEUDebit = "SERVICE_DEB"; + /// + /// Tjänst unionsinternt förvärv credit + /// + public const string ReverseChargeServicesEUCredit = "SERVICE_CRE"; + /// + /// Inköp SE, omvänd skattskyldighet debit + /// + public const string ReverseChargeSEDebit = "CONSTRUCTION_DEB"; + /// + /// Inköp SE, omvänd skattskyldighet credit + /// + public const string ReverseChargeSECredit = "CONSTRUCTION_CRE"; + #endregion + + #region Accrual Accounts / Periodisering + /// + /// Periodiseringskonto levfakt + /// + public const string AccrualAccountSupplierInvoice = "ACCRSINVOICE"; + /// + /// Periodiseringskonto kundfakt + /// + public const string AccrualAccountCustomerInvoice = "ACCRINVOICE"; + /// + /// Intäktskonto periodisering + /// + public const string AccruedIncome = "ACCRINCOME"; + /// + /// Kostnadskonto periodisering + /// + public const string AccruedCost = "ACCRCOST"; + #endregion + + #region Other Accounts / Övrigt + /// + /// Valutakursvinster + /// + public const string ExchangeGain = "CURRENCYWIN"; + /// + /// Valutakursförluster + /// + public const string ExchangeLoss = "CURRENCYLOSS"; + #endregion +}