public async Task <CouponInquiryResponse> CouponInquiryAsync(AccountNumber accountNumber, CancellationToken cancellationToken = default)
        {
            try
            {
                var messageId = _messageSequencingStrategy.Next();
                var request   =
                    new CouponInquiryRequest(
                        TimeProvider.Now,
                        messageId,
                        accountNumber);
                var requestXml  = request.BuildRequestDocument();
                var responseXml = await _executor.ExecuteAsync(requestXml, cancellationToken);

                return(new CouponInquiryResponse(requestXml, responseXml));
            }
            catch (OracleHospitalityClientException)
            {
                throw;
            }
            catch (Exception e)
            {
                throw new OracleHospitalityClientException($"{TransactionKind.COUPON_INQUIRY} operation failed", e);
            }
        }
Exemple #2
0
        public void request_generation()
        {
            using (new TimeProviderTestScope(() => DateTime.Parse("2019-08-26T14:51:35")))
            {
                var request = new CouponInquiryRequest(
                    TimeProvider.Now,
                    new MessageId(new TerminalId(0), new SequenceNumber(42), new CheckNumber(13)),
                    new AccountNumber("123"));
                var requestXml = request.BuildRequestDocument();

                const string expected = @"
                    <SVCMessage version=""1"" 
                                posIntfcName=""posInterfaceName"" 
                                posIntfcVersion=""1.00"" 
                                language=""en-US"" 
                                currency=""DKK"" 
                                sequence=""42"" 
                                retransmit=""n"">
                        <RequestCode>COUPON_INQUIRY</RequestCode>
                        <TraceID>190826145135N420013</TraceID>
                        <TerminalID>0</TerminalID>
                        <TerminalType>Service</TerminalType>
                        <LocalDate>20190826</LocalDate>
                        <LocalTime>145135</LocalTime>                        
                        <Amount>0.00</Amount>
                        <LocalCurrency>DKK</LocalCurrency>
                        <BusinessDate>20190826</BusinessDate>
                        <TransactionEmployee>0</TransactionEmployee>
                        <RevenueCenter>0</RevenueCenter>
                        <CheckNumber>0013</CheckNumber>
                        <SVAN>123</SVAN>
                    </SVCMessage>";

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