private static string ImportExternalReference(int transactionId, ITaxCode taxCode) { var suffix = taxCode switch { GstTaxCode _ => "-GST", NonGstTaxCode _ => "-GSTFree", _ => "" }; return($"GX-{transactionId}{suffix}"); }
private static string GenerateDescription(Transaction source, ITaxCode taxCode) { var gstTerm = taxCode switch { GstTaxCode _ => ", GST Taxable", NonGstTaxCode _ => ", GST Free", _ => ", GST Unknown" }; return($"GlobalX order {source.OrderId}" + $", product '{source.Product.ProductDescription}'" + gstTerm); } }
private static Disbursement CreateDisbursement(Transaction source, int matter, decimal unitPrice, ITaxCode taxCode) { var disbursement = new Disbursement() { Date = LocalDate.FromDateTime(source.TransactionDateTime.Date), Description = GenerateDescription(source, taxCode), Quantity = 1, UnitPrice = unitPrice, UnitPriceIncludesTax = false, ImportExternalReference = ImportExternalReference(source.TransactionId, taxCode) }; disbursement.Links.Action = matter; disbursement.Links.TaxCode = taxCode.TaxCode; return(disbursement); }