Beispiel #1
0
        private static string ImportExternalReference(int transactionId, ITaxCode taxCode)
        {
            var suffix = taxCode switch
            {
                GstTaxCode _ => "-GST",
                NonGstTaxCode _ => "-GSTFree",
                _ => ""
            };

            return($"GX-{transactionId}{suffix}");
        }
Beispiel #2
0
        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);
        }
    }
Beispiel #3
0
        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);
        }