Added invoice export function and started implementation of unitofwork pattern (#43)

* complete read invoices from db

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* updated nuget package spapi

* WIP

* wip, now test

* wip, jut need to fix tax inclusive line amounts not supported

* wip

* wip, before I f everything up

* no, it complies now, this is the one before I f everything up

* wip

* wip

* wip, logic ready for testing

* wip it builds!!!!

* wip tested, working, need to complete the gui section

* wip

* wip

* wip - created export invoice data delete, time for testing

* wip testing phase

* wip - delete function fully tested and working

* wip on to sorting out the issue with settlement invoices not tallying

* wip

* wip

* wip

* wip

* wip before I complete change the ReadInvoiceLineItem sections

* that appears to have worked, on with the main quest

* no it's doesn't work, saving before i remove the confusing cache system (just use a dictionary!!)

* wipping picadilli

* wip

* wip

* implemented uow on inovice export, now for testing

* wip

* wip all tested do invoice currency convertion fearure

* wip

* pretty much done so long as xero accepts the exported invoices

* Complete!
This commit is contained in:
Bobbie Hodgetts
2025-06-26 23:29:22 +01:00
committed by GitHub
parent 8bbf885a48
commit 29f9fae508
82 changed files with 4606 additions and 2837 deletions
@@ -0,0 +1,23 @@
using bnhtrade.Core.Model.Account;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace bnhtrade.Core.Logic.Validate
{
public class AccountInvoiceLineItem : Validate
{
public bool IsValid(Model.Account.InvoiceLineItem invoiceLineItem)
{
return base.IsValid(invoiceLineItem);
}
public bool IsValid(List<Model.Account.InvoiceLineItem> invoiceLineItems)
{
return base.IsValid(invoiceLineItems);
}
}
}
@@ -1,4 +1,5 @@
using System;
using bnhtrade.Core.Model.Amazon;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -56,7 +57,7 @@ namespace bnhtrade.Core.Logic.Validate
{
if (ValidateMarketPlaceName) { ValidationResultAdd("MarketPlaceName is a required value."); }
}
else { IsValidMarketPlaceName(settlementList[i].MarketPlaceName); }
else { IsValidMarketPlaceName(settlementList[i].MarketPlace.GetMarketplaceUrl()); }
if (!settlementList[i].SettlementIdIsSet) { ValidationResultAdd("SettlementId is a required value."); }
else { IsValidSettlementId(settlementList[i].SettlementId); }
@@ -315,23 +316,6 @@ namespace bnhtrade.Core.Logic.Validate
return true;
}
public bool IsValidTransactionType(string transactionType)
{
if (!stringCheck.MaxLength(transactionType, 50))
@@ -6,27 +6,22 @@ using System.Threading.Tasks;
namespace bnhtrade.Core.Logic.Validate
{
public class SalesInvoice : Logic.Validate.Validate
public class Invoice : Logic.Validate.Validate
{
public SalesInvoice()
public Invoice()
{
}
public bool IsValidExportInvoice(IEnumerable<Model.Account.Invoice> invoiceList)
{
if (!IsValid(invoiceList))
bool valid = IsValid(invoiceList);
if (valid == false)
{
return false;
}
foreach (var invoice in invoiceList)
{
if (invoice.UnitAmountIsTaxExclusive == false)
{
ValidationResultAdd("Tax inclusive line unit amounts are not supported");
return false;
}
foreach (var invoiceLine in invoice.InvoiceLineList)
{
if (invoiceLine.Quantity != 1)