public async Task account_already_exists_and_closed() { const string response = @" <SVCMessage language=""en-US"" retransmit=""n"" sequence=""00"" currency=""DKK"" posIntfcVersion=""1.00"" posIntfcName=""posInterfaceName"" version=""1"" hostVersion=""9.1.0000.2301""> <RequestCode>POINT_ISSUE</RequestCode> <TraceID>190829140000N000000</TraceID> <Amount>0</Amount> <SVAN>2200000</SVAN> <ResponseCode hostCode=""106"">D</ResponseCode> <DisplayMessage>This account cannot be used, it is closed</DisplayMessage> </SVCMessage>"; var handler = CreateMockMessageHandler(HttpStatusCode.OK, CreateSoapResponse(response.Trim())); var executor = new OracleHospitalityExecutor(_options, _executorLogger, new HttpClient(handler)); var sut = new PosClient(_messageSequencingStrategy, executor); using (new TimeProviderTestScope(() => DateTime.Parse("2019-08-29T14:00:00"))) { var e = await Assert.ThrowsAsync <OracleHospitalityClientException>(() => sut.PointIssueAsync(new AccountNumber("2200000"))); Assert.Equal("106", e.Code); Assert.Equal("This account cannot be used, it is closed", e.Message); } }
public async Task loyalty_account_created_with_rule_awards_pos_print_text_non_empty() { const string response = @" <SVCMessage hostVersion=""9.1.0000.2301"" version=""1"" posIntfcName=""posInterfaceName"" posIntfcVersion=""1.00"" language=""en-US"" currency=""DKK"" sequence=""00"" retransmit=""n""> <RequestCode>POINT_ISSUE</RequestCode> <TraceID>190826145135N000000</TraceID> <Amount>0</Amount> <SVAN>luxo7wt7mrm8rj4t0j24twi3</SVAN> <ItemType>T</ItemType> <ItemNumber>1234</ItemNumber> <AccountCurrency>DKK</AccountCurrency> <AccountBalance>0.00</AccountBalance> <LocalBalance>0.00</LocalBalance> <ExchangeRate>1.00</ExchangeRate> <ResponseCode>A</ResponseCode> <ProgramCode>lux</ProgramCode> <ProgramName>lux</ProgramName> <PointsIssued>0</PointsIssued> <BonusPointsIssued>0</BonusPointsIssued> <PrintLines> <PrintLine>LUX BENEFIT</PrintLine> </PrintLines> <DisplayMessage>Transaction Complete. </DisplayMessage> </SVCMessage>"; var handler = CreateMockMessageHandler(HttpStatusCode.OK, CreateSoapResponse(response.Trim())); var executor = new OracleHospitalityExecutor(_options, _executorLogger, new HttpClient(handler)); var sut = new PosClient(_messageSequencingStrategy, executor); using (new TimeProviderTestScope(() => DateTime.Parse("2019-08-26T14:51:35"))) { var actual = await sut.PointIssueAsync(new AccountNumber("luxo7wt7mrm8rj4t0j24twi3")); Assert.Equal(ItemType.Kind.Tender, actual.ItemType.Value); Assert.Equal(1234, actual.ItemNumber.Value); Assert.Equal(Currency.Kind.DKK, actual.AccountCurrency.Value); Assert.Equal(0.00m, actual.AccountBalance.Value); Assert.Equal(0.00m, actual.LocalBalance.Value); Assert.Equal(1.00m, actual.ExchangeRate.Value); Assert.Equal("lux", actual.ProgramCode.Value); Assert.Equal("lux", actual.ProgramName.Value); Assert.Equal(0m, actual.PointsIssued.Value); Assert.Equal(0m, actual.BonusPointsIssued.Value); Assert.Single(actual.PrintLines.Values); Assert.Equal("LUX BENEFIT", actual.PrintLines.Values[0].Value); Assert.Equal("Transaction Complete. ", actual.DisplayMessage.Value); } }
public async Task end_to_end() { // To create a new account, specify a non-existing account number. // Creating an account isn't part of this test because (1) accounts // can never be deleted and (2) we'd have to determine next // available account number prior to creating the account. var accountNumber = new AccountNumber("2200000"); var client = new PosClient(_messageSequencingStrategy, _executor); var pointIssue = await client.PointIssueAsync(accountNumber); var couponInquiry = await client.CouponInquiryAsync(pointIssue.AccountNumber); var couponCode = new CouponCode("10DKK"); var couponIssue = await client.CouponIssueAsync(accountNumber, couponCode); var couponAccept = await client.CouponAcceptAsync(accountNumber, couponIssue.CouponCode); }