protected virtual void OnStatusFailed(TransactionConfig transactionConfig, string message) { if (StatusChanged != null) { StatusChanged(this, new TransactionEventArgs(TransactionEventArgs.eStatus.Failed, transactionConfig, message)); // for example } }
protected virtual void OnStatusPassed(TransactionConfig transactionConfig) { if (StatusChanged != null) { StatusChanged(this, new TransactionEventArgs(TransactionEventArgs.eStatus.Passed, transactionConfig)); // for example } }
public Plan(string description, List <Object> expectedResultCollection, Network network, TransactionConfig transactionConfig) { _transactionConfig = transactionConfig; _description = description; Transactions = new List <Transaction>(); _network = network; _expectedResultCollection = expectedResultCollection; // TODO: call CreateTransactions() this.CreateTransactions(); this.ShowTransactions(); }
public NdcTransactionRequestMessage(TransactionConfig transactionConfig) : base(transactionConfig) { _requestMessage = new StringBuilder(); //TODO: the below information must get from config Track2Data = ";5894631511409724=99105061710399300020?"; //Track2Data = transactionConfig.Card.Track; Track3Data = ""; PinBufferA = ">106<?1>82<7>9=2"; //PinBufferA = transactionConfig.Card.PinBufferA; // Contains a 16-character PIN, encrypted as specified in the FIT, for remote PIN verification. TransactionStatusDataIdentifier = "20000100000000000000000000"; LastTransactionStatusData = ""; }
public ConditionBasedPlan(string description, List <Object> expectedResultCollection, Network network, TransactionConfig transactionConfig) : base(description, expectedResultCollection, network, transactionConfig) { }
public FFile(TransactionConfig transactionConfig) : base(transactionConfig) { }
public void GeneratePlans() { ///Application.EnableVisualStyles(); //Form4 form4 = new Form4(); //form4.ShowDialog(); //Application.Run(form4); Console.WriteLine("===Start PlanFactory.GeneratePlans()==="); //_plans = new List<Plan>(); //TODO: generate the list of plans base on the config file /** * expectedResultCollection: the first element would be the list of the names of the transactions for expected result * the second element would be the list of condition as key of dictionary and expected result as value */ var expectedResultCollection = new List <Object>(); expectedResultCollection.Add(_config.ExpectedResultNames); expectedResultCollection.Add(_config.ExpectedResultList); var formSubscriber = new FormSubscriber(); // subscriber // Condition-based plans foreach (var financial in _config.Financial) { // return the confluence(eshterak) of active conditions of the specific transaction and condition part of the config yaml file var activeConditions = GetActiveConditions(financial); var conditionsStrings = GenerateConditionStrings(activeConditions); // now conditionsStrings is the strings of different real conditions foreach (var condition in conditionsStrings) { var transactionConfig = new TransactionConfig(_config.Amount, _config.BadData, _config.Card[0]); _plans.Add(new ConditionBasedPlan(financial + "," + condition, expectedResultCollection, _config.GetNetwork("ATM"), transactionConfig)); OnPlanAdded(financial + ": " + condition); //_config._form4. foreach (var transaction in _plans[_plans.Count - 1].Transactions) { transaction.StatusChanged += formSubscriber.OnTransactionChangeStatus; // subscribe to the event transaction.StatusChanged += _config._form4.OnTransactionChangeStatus; // subscribe to the event } //_plans[_plans.Count - 1].Transactions[0].StatusChanged += formSubscriber.OnTransactionChangeStatus; // subscribe to the event } } //_config._form4.Show(); //form4.ShowDialog(); Console.WriteLine("Condition-based plans Completed"); /* * // Reverse plans * * foreach (var financial in _config.Financial) * { * if (financial.Equals("Withdrawal", StringComparison.InvariantCultureIgnoreCase)) * { * if (_config.Reverse.Contains("Not_Withdrawal", StringComparer.InvariantCultureIgnoreCase)) * _plans.Add(new ReversePlan("Not_Withdrawal; don't take card", _config.GetNetwork("ATM"), new TransactionConfig(_config.Card[0]))); * } * } * * // BadData plans * * foreach (var financial in _config.Financial) * { * if (financial.Equals("Withdrawal", StringComparison.InvariantCultureIgnoreCase)) * { * if (_config.BadData.Contains("Amount", StringComparer.InvariantCultureIgnoreCase)) * _plans.Add(new BadDataPlan("Bad Amount Data", _config.GetNetwork("ATM"), new TransactionConfig(_config.Card[0]))); // TODO: transaction config should be corrected * * if (_config.BadData.Contains("PIN", StringComparer.InvariantCultureIgnoreCase)) * _plans.Add(new BadDataPlan("Bad PIN Data", _config.GetNetwork("ATM"), new TransactionConfig(_config.Card[0]))); // TODO: transaction config should be corrected * * if (_config.BadData.Contains("Track", StringComparer.InvariantCultureIgnoreCase)) * _plans.Add(new BadDataPlan("Bad Track Data", _config.GetNetwork("ATM"), new TransactionConfig(_config.Card[0]))); // TODO: transaction config should be corrected * } * } * * // Complete plans * * foreach (var complete in _config.Complete) * { * if (complete.Equals("Balance", StringComparison.InvariantCultureIgnoreCase)) * { * if (_config.Condition.Contains("Incorrect_PIN", StringComparer.InvariantCultureIgnoreCase)) * _plans.Add(new CompletePlan("Incorrect Pin", _config.GetNetwork("ATM"), new TransactionConfig(_config.Card[0]))); // TODO: transaction config should be corrected * * _plans.Add(new CompletePlan("All inputs are Correct", _config.GetNetwork("ATM"), new TransactionConfig(_config.Card[0]))); * } * } */ for (int i = 0; i < _plans.Count; i++) { if (i % 4 == 0) { _plan1.Add(_plans[i]); } else if (i % 4 == 1) { _plan2.Add(_plans[i]); } else if (i % 4 == 2) { _plan3.Add(_plans[i]); } else if (i % 4 == 3) { _plan4.Add(_plans[i]); } } Console.WriteLine("plans: " + _plans.Count); Console.WriteLine("plan1: " + _plan1.Count); Console.WriteLine("plan2: " + _plan2.Count); Console.WriteLine("plan3: " + _plan3.Count); Console.WriteLine("plan4: " + _plan4.Count); _plansList.Add(_plan1); _plansList.Add(_plan2); _plansList.Add(_plan3); _plansList.Add(_plan4); }
public DB(TransactionConfig transactionConfig) : base(transactionConfig) { }
public Socket(TransactionConfig transactionConfig) : base(transactionConfig) { }
public Transaction(TransactionConfig transactionConfig) { TransactionConfig = transactionConfig; }
public TransactionEventArgs(eStatus eventType, TransactionConfig eventMessage, string message) { this.EventType = eventType; this.EventMessage = eventMessage; this.Message = message; }
public void fff(TransactionConfig tf) { Console.WriteLine(tf.Card.CardNumber); }
public Balance(TransactionConfig transactionConfig) : base(transactionConfig) { AmountEntryField = "000000000000"; OperationCodeData = "AAAC A"; }
public void SetTransactionConfig(TransactionConfig tc) { this.TransactionConfig = tc; }
public Transfer(TransactionConfig transactionConfig) : base(transactionConfig) { //TODO: is not correct AmountEntryField = "000000000000"; OperationCodeData = "AAAC A"; }
public Withdrawal(TransactionConfig transactionConfig) : base(transactionConfig) { // AmountEntryField = config.Amount.PadLeft(12, '0'); AmountEntryField = transactionConfig.Amount.PadLeft(12, '0'); OperationCodeData = "ADFI A"; }