Esempio n. 1
0
 public string Transfer(string tnxId, string fromAccountNumber, int fromBankId, string toAccountNumber, int toBankId, 
     decimal amount, string content, string callBackUrl)
 {
     try
     {
         this.CallBackURL = callBackUrl;
         this.tnxId = tnxId;
         StepContext stepContext = new StepContext(fromBankId);
         stepContext.InitTransactionModel(fromAccountNumber, fromBankId, toAccountNumber, toBankId, amount, content);
         Worker worker = new Worker(stepContext);
         worker.OnStart += OnTransactionStart;
         worker.OnSuccess += OnTransactionSuccess;
         worker.OnFail += OnTransactionFail;
         worker.OnInprogress += OnTransactionInprogress;
         worker.Execute();
         return string.Join("-", tnxId, fromAccountNumber, fromBankId, toAccountNumber, toBankId, amount, content);
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex.Message);
         throw new WebFaultException(HttpStatusCode.BadRequest);// Use it for REST
     }
     //catch (Exception ex)
     //{
     //    //throw new FaultException<ProductFault>(new ProductFault(ex.Message), "unknown reason");
     //    throw new FaultException(ex.Message, new FaultCode("internal error"));// Use it for SOAP
     //}
 }
Esempio n. 2
0
 static void Main(string[] args)
 {
     int bankId = 1;
     StepContext stepContext = new StepContext(bankId);
     stepContext.InitTransactionModel("123456789", 1, "987654321", 1, 10000, "transfer money");
     worker = new Worker(stepContext);
     worker.OnStart += OnTransactionStart;
     worker.OnSuccess += OnTransactionSuccess;
     worker.OnFail += OnTransactionFail;
     worker.OnInprogress += OnTransactionInprogress;
     worker.Execute();
 }
Esempio n. 3
0
 public EnterInputStep(int currentStepId, StepContext context)
 {
     Initialize(currentStepId, context);
 }
Esempio n. 4
0
 public GetOTPStep(int currentStepId, StepContext context)
 {
     Initialize(currentStepId, context);
 }
Esempio n. 5
0
 public HttpPostStep(int currentStepId, StepContext context)
 {
     Initialize(currentStepId, context);
 }
Esempio n. 6
0
 public MatchingStep(int currentStepId, StepContext context)
 {
     Initialize(currentStepId, context);
 }
Esempio n. 7
0
 public ClickStep(int currentStepId, StepContext context)
 {
     Initialize(currentStepId, context);
 }
Esempio n. 8
0
 public Worker(StepContext stepContext)
 {
     Step firstStep = new EnterPageStep(1, stepContext);
     this.Step = firstStep;
 }
Esempio n. 9
0
 public ClickStep(int currentStepId, StepContext context)
 {
     Initialize(currentStepId, context);
 }
Esempio n. 10
0
 public void Initialize(int currentStepId, StepContext context)
 {
     using (var db = new Entities())
     {
         var step = db.Steps.Where(x => x.Bank.Id == context.BankId && x.CurrentStepId == currentStepId).FirstOrDefault();
         if (step != null)
         {
             this.Context = context;
             this.CurrentStepId = currentStepId;
             this.Name = step.Name;
             this.Url = step.Url;
             this.PreviousStepId = step.PreviousStepId;
             this.Sign = step.Sign;
             this.Pattern = step.Pattern;
             this.XPath = step.XPath;
             this.XPathAttribute = step.XPathAttribute;
             this.NextStepId = step.NextStepId0;// default next step
             this.SecondNextStepId = step.NextStepId1;// default next step
             this.InputType = step.InputType.Name;
             this.QueryStrings = step.QueyStrings.InitHttpRequestParams(';');
             this.Params = step.Params.InitHttpRequestParams(';');
         }
     }
         
 }