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

            CheckXeroIntegration(instanceConfig);
            try
            {
                XeroInvoice xeroInvoice;
                string      result = Xero.CreateInvoice(hdUser.OrganizationId, hdUser.DepartmentId, instanceConfig, instanceConfig.XeroAuthConsumerKey, request.invoice_id, out xeroInvoice,
                                                        instanceConfig.XeroRSAPrivateKey);
                if (result != "ok")
                {
                    throw new HttpError(HttpStatusCode.NotFound, Utils.ClearString(result));
                }
                return(xeroInvoice);
            }
            catch (Exception ex)
            {
                throw new HttpError(Utils.ClearString(ex.Message));
            }
        }