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

            CheckXeroIntegration(instanceConfig);
            if (request.is_unlink)
            {
                try
                {
                    Xero.UnlinkXeroInvoice(hdUser.OrganizationId, hdUser.DepartmentId, request.key);
                    return(new HttpResult("", HttpStatusCode.OK));
                }
                catch (Exception ex)
                {
                    throw new HttpError(Utils.ClearString(ex.Message));
                }
            }
            else
            {
                try
                {
                    Xero.DeleteAndUnlinkInvoice(hdUser.OrganizationId, hdUser.DepartmentId, instanceConfig, instanceConfig.XeroAuthConsumerKey, request.key, instanceConfig.XeroRSAPrivateKey);
                    return(new HttpResult("", HttpStatusCode.OK));
                }
                catch (Exception ex)
                {
                    throw new HttpError(Utils.ClearString(ex.Message));
                }
            }
        }