public async Task update_failed_on_invalid_account()
        {
            const string response = @"
                <CRMMessage language=""en_US"" currency=""DKK"" hostversion=""1.00"">
                  <RequestCode>SetCustomer</RequestCode>
                  <ResponseCode>D</ResponseCode>
                  <DisplayMessage>com.micros.storedValue.worker.SetRollbackException: Update failed for row ID = 123</DisplayMessage>
                </CRMMessage>";

            var handler  = CreateMockMessageHandler(HttpStatusCode.OK, CreateSoapResponse(response.Trim()));
            var executor = new OracleHospitalityExecutor(_options, _executorLogger, new HttpClient(handler));
            var sut      = new CrmClient(_options, executor);

            var e = await Assert.ThrowsAsync <OracleHospitalityClientException>(
                () =>
                sut.SetCustomerAsync(
                    123,
                    new[]
            {
                new ColumnValue("firstname", "Rubber"),
                new ColumnValue("lastname", "Duck")
            }));

            Assert.Contains("Update failed for row ID = 123", e.Message);
        }
Exemplo n.º 2
0
        private async Task <SetCustomerResponse> SetCustomer(CrmClient client, GetCustomerResponse customer)
        {
            var now           = DateTime.Now;
            var accountNumber = (string)customer.Rows[0].Columns["PRIMARYPOSREF"];
            var setCustomer   = await client.SetCustomerAsync(customer.Rows.Single().Id, new[]
            {
                new ColumnValue("firstname", "Rubber"),
                new ColumnValue("lastname", now.ToString()),
            });

            var getCustomerUpdated = await GetCustomer(client, accountNumber);

            var lastname = (string)getCustomerUpdated.Rows.Single().Columns["LASTNAME"];

            // UNDOCUMENTED: updating account to ACTIVE = false doesn't cause
            // the SetCustomer API call to fail or the account state to change.
            // Oracle Hospitality carries out the update and returns Approved
            // response code to client. But the web UI remains frozen in that it
            // doesn't show updated values, but remains stuck on the value at
            // the time of closing. Only clicking an account will show the
            // updated name (likely a bug in Web UI). In order to change the
            // account state, one must use the PostAccountTransaction
            // transaction. The ACTIVE attribute value is likely replicated from
            // somewhere else by the backend and therefore any updated to it are
            // ignored.
            Assert.Equal(getCustomerUpdated.Rows[0].Id, setCustomer.RowId);
            Assert.Equal(
                new DateTime(now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second),
                DateTime.Parse(lastname));

            return(setCustomer);
        }
Exemplo n.º 3
0
 public async Task SetCustomerCreateNewCustomerAndAssociateWithExistingAccountTest()
 {
     var client = new CrmClient(_options, _executor);
     var _      = await client.SetCustomerAsync(null, new[]
     {
         new ColumnValue("firstname", "Rubber"),
         new ColumnValue("lastname", "Duck"),
         new ColumnValue("sortvalue", "1"),
         new ColumnValue("primaryposref", "2200000")
     });
 }
        public async Task create_and_update_success_response()
        {
            const string response = @"
                <CRMMessage language=""en_US"" currency=""DKK"" isTrustedSAT=""false"" hostversion=""1.00"">
                  <RequestCode>SetCustomer</RequestCode>
                  <ResponseCode>A</ResponseCode>
                  <Row id=""456663"" />
                </CRMMessage>";

            var handler  = CreateMockMessageHandler(HttpStatusCode.OK, CreateSoapResponse(response.Trim()));
            var executor = new OracleHospitalityExecutor(_options, _executorLogger, new HttpClient(handler));
            var sut      = new CrmClient(_options, executor);

            var actual = await sut.SetCustomerAsync(
                123,
                new[]
            {
                new ColumnValue("FIRSTNAME", "Rubber"),
                new ColumnValue("LASTNAME", "Duck")
            });

            Assert.Equal(456663, actual.RowId);
        }