private void OnMessage(AccountInquiry command) { this.CommandCount++; this.Logger.LogInformation(LogId.Trading, $"{Received}{Command} {command}."); this.gateway.AccountInquiry(); }
/// <summary> /// Checks provided credit card against the Lost/Stolen Account List /// </summary> /// <param name="accountInquiry">XML to send to MasterCard containing the Account Number</param> /// <returns>Account - Account Object containing status information</returns> public Account GetLostStolen(AccountInquiry accountInquiry) { string response = ""; Dictionary <string, string> responseMap = doRequest(GetURL(), "PUT", Serializer <AccountInquiry> .Serialize(accountInquiry).InnerXml); responseMap.TryGetValue(MESSAGE, out response); return(Serializer <Account> .Deserialize(response)); }
public void TestLostStolenService_NotListed() { AccountInquiry accountInquiry = new AccountInquiry(); accountInquiry.AccountNumber = 343434343434343; Account account = service.GetLostStolen(accountInquiry); Assert.AreEqual(true, account.ReasonCode.Equals("")); }
public void TestLostStolenService_Counterfeit() { AccountInquiry accountInquiry = new AccountInquiry(); accountInquiry.AccountNumber = 4444333322221111; Account account = service.GetLostStolen(accountInquiry); Assert.AreEqual(true, account.ReasonCode.Equals("X")); }
public void TestLostStolenService_UnauthorizedUse() { AccountInquiry accountInquiry = new AccountInquiry(); accountInquiry.AccountNumber = 6011111111111117; Account account = service.GetLostStolen(accountInquiry); Assert.AreEqual(true, account.ReasonCode.Equals("U")); }
public void TestLostStolenService_CaptureCard() { AccountInquiry accountInquiry = new AccountInquiry(); accountInquiry.AccountNumber = 5305305305305300; Account account = service.GetLostStolen(accountInquiry); Assert.AreEqual(true, account.ReasonCode.Equals("P")); }
public void TestLostStolenService_Lost() { AccountInquiry accountInquiry = new AccountInquiry(); accountInquiry.AccountNumber = 5222222222222200; Account account = service.GetLostStolen(accountInquiry); Assert.AreEqual(true, account.ReasonCode.Equals("L")); }
public override async Task <AccountInquiryResponse> GetAccountBalance(AccountInquiry request, ServerCallContext context) { await Task.Delay(100); return(new AccountInquiryResponse { AccountBalance = int.MaxValue - 1, AccountNumber = request.AccountNumber }); }
internal void CanSerializeAndDeserialize_AccountInquiryCommands() { // Arrange var command = new AccountInquiry( TraderId.FromString("TESTER-000"), new AccountId("FXCM", "028999999", "SIMULATED"), Guid.NewGuid(), StubZonedDateTime.UnixEpoch()); // Act var packed = this.serializer.Serialize(command); var unpacked = (AccountInquiry)this.serializer.Deserialize(packed); // Assert Assert.Equal(command, unpacked); this.Output.WriteLine(Convert.ToBase64String(packed)); this.Output.WriteLine(Encoding.UTF8.GetString(packed)); }
internal void OnAccountInquiryCommand_SendsToGateway() { // Arrange var command = new AccountInquiry( TraderId.FromString("TESTER-000"), AccountId.FromString("NAUTILUS-000-SIMULATED"), Guid.NewGuid(), StubZonedDateTime.UnixEpoch()); // Act this.engine.Endpoint.SendAsync(command).Wait(); Task.Delay(100).Wait(); // Buffer to avoid intermittent tests // Assert Assert.Null(this.engine.UnhandledMessages.FirstOrDefault()); Assert.Equal(2, this.engine.ProcessedCount); Assert.Equal(1, this.engine.CommandCount); Assert.Single(this.tradingGateway.CalledMethods); Assert.Equal("AccountInquiry", this.tradingGateway.CalledMethods[0]); }
private void OnMessage(AccountInquiry command) { this.commandThrottler.Endpoint.Send(command); this.SendReceived(command); }