public PurchaseOrdersController(IUnitOfWork unitOfWork,
                                 IPurchaseOrderHandler handler,
                                 IPostEntriesService postEntriesService)
 {
     _unitOfWork         = unitOfWork;
     _handler            = handler;
     _postEntriesService = postEntriesService;
 }
        public dynamic Contabilize(AsientosDTO data, IPostEntriesService postEntriesService)
        {
            var accountingEntryDebit = new
            {
                data.description,
                auxiliaryAccountId = 8,
                account            = "80",
                movementType       = 1,
                period             = DateTime.UtcNow.AddMinutes(-240),
                data.amount,
                currencyTypeId = 1
            };


            var accountingEntryCredit = new
            {
                data.description,
                auxiliaryAccountId = 8,
                account            = "4",
                movementType       = 1,
                period             = DateTime.UtcNow.AddMinutes(-240),
                data.amount,
                currencyTypeId = 1
            };


            var Json = new
            {
                accountingEntryDebit,
                accountingEntryCredit
            };

            var result = postEntriesService.PostEntries(Json);

            _unitOfWork.PurchaseOrder.desactivatePurchases(data.purchaseOrders);

            _unitOfWork.Complete();

            return(result);
        }