Ejemplo n.º 1
0
        public object Delete(QB_Bill_Delete request)
        {
            ApiUser         hdUser         = request.ApiUser;
            Instance_Config instanceConfig = new Instance_Config(hdUser);

            CheckQBOnlineIntegration(instanceConfig);
            PaymentsService.CheckPaymentEnable(instanceConfig);
            if (request.is_unlink)
            {
                try
                {
                    QBBills.UnlinkQuickBooksBill(hdUser, request.key);
                    return(new HttpResult("", HttpStatusCode.OK));
                }
                catch (Exception ex)
                {
                    throw new HttpError(Utils.ClearString(ex.Message));
                }
            }
            else
            {
                try
                {
                    QBBills.DeleteQuickBooksBill(hdUser, instanceConfig, request.key);
                    return(new HttpResult("", HttpStatusCode.OK));
                }
                catch (Exception ex)
                {
                    throw new HttpError(Utils.ClearString(ex.Message));
                }
            }
        }
Ejemplo n.º 2
0
        public object Post(QB_Bill_Create request)
        {
            ApiUser         hdUser         = request.ApiUser;
            Instance_Config instanceConfig = new Instance_Config(hdUser);

            CheckQBOnlineIntegration(instanceConfig);
            PaymentsService.CheckPaymentEnable(instanceConfig);
            try
            {
                string result = QBBills.CreateBill(hdUser, instanceConfig, request.bill_id);
                if (result == "ok")
                {
                    return(new HttpResult("", HttpStatusCode.OK));
                }
                else
                {
                    throw new HttpError(Utils.ClearString(result));
                }
            }
            catch (Exception ex)
            {
                throw new HttpError(Utils.ClearString(ex.Message));
            }
        }