Esempio n. 1
0
        public async Task <GetCouponsResponse> GetCouponsAsync(string condition, ColumnValue[] columnValues, CancellationToken cancellationToken = default)
        {
            try
            {
                var request     = new GetCouponsRequest(_options.CustomerRelationshipManagementOperations.RequestSourceName, condition, columnValues);
                var requestXml  = request.BuildRequestDocument();
                var responseXml = await _executor.ExecuteAsync(requestXml, cancellationToken);

                return(new GetCouponsResponse(requestXml, responseXml));
            }
            catch (OracleHospitalityClientException)
            {
                throw;
            }
            catch (Exception e)
            {
                throw new OracleHospitalityClientException($"{RequestCode.Kind.GetCoupons} operation failed", e);
            }
        }
Esempio n. 2
0
        public void request_generation()
        {
            const string expected = @"
                <CRMMessage language=""en_US"" currency=""DKK"">
                  <RequestSource name=""acme.com"" version=""1"" />
                  <RequestCode>GetCoupons</RequestCode>
                  <QueryCriteria conditions=""accountposref = ?"">
                    <Condition name=""accountposref"" value=""123"" />
                  </QueryCriteria>
                </CRMMessage>";

            var request = new GetCouponsRequest(
                "acme.com",
                "accountposref = ?",
                new[]
            {
                new ColumnValue("accountposref", "123")
            });
            var requestXml = request.BuildRequestDocument();

            Assert.Equal(XE.Parse(expected).ToString(), requestXml.ToString());
        }