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

            CheckXeroIntegration(instanceConfig);
            try
            {
                string result = Xero.CreateBill(hdUser.OrganizationId, hdUser.DepartmentId, instanceConfig, instanceConfig.XeroAuthConsumerKey, request.bill_id, instanceConfig.XeroRSAPrivateKey);
                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));
            }
        }