public virtual AvaCreateOrAdjustTransactionModel FromOrder(CustomerOrder order, string companyCode, Address sourceAddress)
        {
            var transaction = AbstractTypeFactory <AvaCreateTransactionModel> .TryCreateInstance();

            transaction.FromOrder(order, companyCode, sourceAddress);
            createTransactionModel = transaction;

            return(this);
        }
        protected virtual async Task SendOrderToAvaTax(CustomerOrder order, string companyCode, Address sourceAddress, AvaTaxClient avaTaxClient)
        {
            if (!order.IsCancelled)
            {
                var createOrAdjustTransactionModel = AbstractTypeFactory <AvaCreateOrAdjustTransactionModel> .TryCreateInstance();

                createOrAdjustTransactionModel.FromOrder(order, companyCode, sourceAddress);
                var transactionModel = await avaTaxClient.CreateOrAdjustTransactionAsync(string.Empty, createOrAdjustTransactionModel);
            }
            else
            {
                var voidTransactionModel = new VoidTransactionModel {
                    code = VoidReasonCode.DocVoided
                };
                var transactionModel = await avaTaxClient.VoidTransactionAsync(companyCode, order.Number, DocumentType.Any, voidTransactionModel);
            }
        }