public object Delete(QB_Invoice_Delete request)
        {
            ApiUser         hdUser         = request.ApiUser;
            Instance_Config instanceConfig = new Instance_Config(hdUser);

            CheckQBOnlineIntegration(instanceConfig);
            if (request.is_unlink)
            {
                try
                {
                    QBInvoices.UnlinkQuickBooksInvoice(hdUser, request.key);
                    return(new HttpResult("", HttpStatusCode.OK));
                }
                catch (Exception ex)
                {
                    throw new HttpError(Utils.ClearString(ex.Message));
                }
            }
            else
            {
                try
                {
                    QBInvoices.DeleteQuickBooksInvoice(hdUser, instanceConfig, request.key);
                    return(new HttpResult("", HttpStatusCode.OK));
                }
                catch (Exception ex)
                {
                    throw new HttpError(Utils.ClearString(ex.Message));
                }
            }
        }
        public void saveFactura(Factura factura)
        {
            QBInvoices qbInvoices = new QBInvoices();
            Invoice    invoice    = qbInvoices.saveInvoice(factura);

            factura.CustomerName = factura.Customer.Name;
            factura.Invoice      = invoice;
            factura.Status       = EstatusFactura.Guardada;
            this.repositoryFacturas.Register(factura);
        }
        public object Post(QB_Invoice_Create request)
        {
            ApiUser         hdUser         = request.ApiUser;
            Instance_Config instanceConfig = new Instance_Config(hdUser);

            CheckQBOnlineIntegration(instanceConfig);
            try
            {
                return(QBInvoices.CreateInvoice(hdUser, instanceConfig, request.invoice_id));
            }
            catch (Exception ex)
            {
                throw new HttpError(Utils.ClearString(ex.Message));
            }
        }
        public void deleteFactura(Invoice invoice)
        {
            QBInvoices qbInvoice = new QBInvoices();

            qbInvoice.deleteInvoice(invoice);
        }
        public void cancelFactura(Invoice invoice, Customer customer)
        {
            QBInvoices qbInvoice = new QBInvoices();

            qbInvoice.cancelInvoice(invoice, customer);
        }