コード例 #1
0
        //[Test]
        public void QATest()
        {
            _addressSvc.Configuration.Url = "http://qa.avalara.com/avatax.services";

            PingResult pingResult = _addressSvc.Ping("");

            Assert.IsTrue(pingResult.Version.StartsWith("4.0."));
            Assert.AreEqual(SeverityLevel.Success, pingResult.ResultCode);

            Address address = new Address();

            address.Line1      = "900 Winslow Way";
            address.Line2      = "Ste 130";
            address.City       = "Bainbridge Island";
            address.Region     = "WA";
            address.PostalCode = "98110";

            ValidateRequest validateRequest = new ValidateRequest();

            validateRequest.Address  = address;
            validateRequest.TextCase = TextCase.Upper;

            ValidateResult result = _addressSvc.Validate(validateRequest);

            Assert.AreEqual(SeverityLevel.Success, result.ResultCode);
        }
コード例 #2
0
        /// <summary>
        /// Stops the monitoring clock.
        /// </summary>
        public void Stop(AddressSvc svc, ref Avalara.AvaTax.Adapter.Proxies.AddressSvcProxy.ProxyValidateResult result)
        {
            _end = DateTime.Now;

            if (!_running)
            {
                throw new ApplicationException("An attempt was made to stop the performance timekeeper that was not running. Call the Start method prior to calling Stop method.");
            }

            try
            {
                if (Utilities.HasClientMetricMessage(result.Messages))
                {
                    //call Ping Method and send ClientMetric
                    //Sample Entry - ClientMetrics:17849,ClientDuration,1500
                    svc.Ping(Utilities.BuildAuditMetrics("", result.TransactionId, _end.Subtract(_start).Milliseconds));
                }
            }
            catch (Exception ex)
            {
                _avaLog.Error(string.Format("Error sending ClientMetrics: {0}", ex.Message));
            }

            _running = false;
        }
        private void buttonPing_Click(object sender, EventArgs e)
        {
            try
            {
                Util.PreMethodCall(this, lblStatus);

                AddressSvc addressSvc = new AddressSvc();
                SetConfig(addressSvc);

                PingResult result = addressSvc.Ping("");
                if (result.ResultCode >= SeverityLevel.Error)
                {
                    MessageBox.Show(result.Messages[0].Summary, "Ping Result", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    MessageBox.Show("Result Code: " + result.ResultCode.ToString() + "\r\n" +
                                    "# Messages: " + result.Messages.Count + "\r\n" +
                                    "Service Version: " + result.Version, "Ping Result", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                Util.ShowError(ex);
            }
            finally
            {
                Util.PostMethodCall(this, lblStatus);
            }
        }
コード例 #4
0
        private void buttonTestConnection_Click(object sender, System.EventArgs e)
        {
            //string settings = "";
            bool isConnectionSuccess = false;

            //if(_parent.Account != null || _parent.Account != "" || _parent.Key!= null|| _parent.Key!=""||_parent.UserName!=null||_parent.UserName!=""||_parent.Password!=null||_parent.Password!="")
            //settings = textAccount.Text +","+ textKey.Text +","+textUserName.Text+","+textPassword.Text;

            try
            {
                this.Cursor = Cursors.WaitCursor;

                ApplySettings();

                AddressSvc addressSvc = new AddressSvc();
                _parent.SetConfig(addressSvc);

                PingResult result = addressSvc.Ping("");
                if (result.ResultCode >= SeverityLevel.Error)
                {
                    MessageBox.Show(result.Messages[0].Summary, "Settings Result", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    IsAuthorizedResult isAuthorizedResult = addressSvc.IsAuthorized("Validate");

                    if (isAuthorizedResult.ResultCode >= SeverityLevel.Error)
                    {
                        MessageBox.Show(isAuthorizedResult.Messages[0].Summary, "Settings Result", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        isConnectionSuccess = true;
                        MessageBox.Show("Result Code: " + isAuthorizedResult.ResultCode + "\r\n" +
                                        "# Messages: " + isAuthorizedResult.Messages.Count + "\r\n" +
                                        "Expires: " + isAuthorizedResult.Expires + "\r\n" +
                                        "Operations: " + isAuthorizedResult.Operations, "Settings Result", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            catch (Exception ex)
            {
                isConnectionSuccess = false;
                Util.ShowError(ex);
            }
            finally
            {
                RejectChanges(settings);
                if (isConnectionSuccess)
                {
                    buttonApply.Enabled = true;
                }
                else
                {
                    buttonApply.Enabled = false;
                }
                this.Cursor = Cursors.Default;
            }
        }
コード例 #5
0
        public void Test()
        {
            AddressSvc adrssSvc = new AddressSvc();

            SetupService(this, adrssSvc);

            PingResult pres = adrssSvc.Ping("");

            if (pres.ResultCode == SeverityLevel.Success)
            {
                Setup.Ask(Setup.Current, Messages.AvalaraConnectSuccessAskHeader, PXMessages.LocalizeFormatNoPrefixNLA(Messages.AvalaraConnectSuccessAskMsg, pres.Version), MessageButtons.OK, MessageIcon.Information);
            }
            else
            {
                LogMessages(pres);
                throw new PXException(Messages.ConnectionToAvalaraFailed);
            }
        }
コード例 #6
0
        public void Test()
        {
            AddressSvc adrssSvc = new AddressSvc();

            SetupService(this, adrssSvc);

            PingResult pres = adrssSvc.Ping("");

            if (pres.ResultCode == SeverityLevel.Success)
            {
                string msg = string.Format("Connection to Avalara was successful. Version of service is {0}", pres.Version);
                Setup.Ask(Setup.Current, "Setup", msg, MessageButtons.OK, MessageIcon.Information);
            }
            else
            {
                LogMessages(pres);
                throw new PXException(Messages.ConnectionToAvalaraFailed);
            }
        }