private static PaymentProvider GetDefaultProvider(bool userAction) { if (userAction == true) { return(ProviderListOpener.GetInstance()); } return(NullProvider.GetInstance()); }
/// <summary> /// Executes payment request. /// </summary> /// <param name="request">payment request</param> /// <returns>payment infor modified by the provider</returns> public virtual PaymentInfo Execute(PaymentRequest request) { // user logged? if (IsUserLogged(request) == false) { if (request.UserAction == true) { return(ProviderListOpener.GetInstance().Execute(request)); } else { return(request.PaymentInfo); } } if (Settings.Default.ReloadCount >= Settings.Default.MaxReload) { return(request.PaymentInfo); } Settings.Default.ReloadCount++; switch (request.PaymentInfo.State) { case State.INVALID: case State.PAID: request.PaymentInfo.State = State.INVALID; return(request.PaymentInfo); case State.IN_PROGRESS_CONFIRM: return(ProcessInProgressConfirm(request)); case State.IN_PROGRESS: String currentAccountNo = request.PaymentInfo.BankAccountNo; PaymentInfo info = ProcessInProgress(request); if (currentAccountNo.Equals(info.BankAccountNo) == false) { if (info.IsDefinedTransfer == true) { Util.ShowWarningMessage(Resources.WrongAccountNo); } else { info.State = State.INVALID; } } return(info); default: return(ProcessIdle(request)); } }