public void ShouldCreatePaymentInfoFromString() { String infoAsString = "[098765][PL92837465][120,23][211,24][200.10][Title][\\[\\[Original\\]\\]\\[\\[Street\\]\\]\\[\\[Name\\]\\]]" + "[66111][\\[Some Very Long Name of The\\\\City\\]][Biller][13.10.2010][EUR][CASH_FLOW][INVALID]"; PaymentInfo info = PaymentInfo.ValueOf(infoAsString); Assert.AreEqual("PL", info.CountryCode); Assert.AreEqual("098765", info.Id); Assert.AreEqual("92837465", info.BankAccountNo); Assert.AreEqual("120,23", info.Amount); Assert.AreEqual("211,24", info.AmountToPay); Assert.AreEqual(21124, info.AmountToPayInt); Assert.AreEqual("200.10", info.AmountPaid); Assert.AreEqual(20010, info.AmountPaidInt); Assert.AreEqual("Title", info.Title); Assert.AreEqual("[[Original]][[Street]][[Name]]", info.Street); Assert.AreEqual("66111", info.PostalCode); Assert.AreEqual("[Some Very Long Name of The\\City]", info.City); Assert.AreEqual("Biller", info.BillerName); Assert.AreEqual("EUR", info.Currency); Assert.AreEqual("CASH_FLOW", info.DefinedTransferName); Assert.AreEqual(State.INVALID, info.State); Assert.AreEqual(infoAsString, info.ToString()); }
public void ShouldCreateCorrectStates() { String infoAsString = "[123][ES0927465][][][][][][][][][][][][PAID]"; PaymentInfo info = PaymentInfo.ValueOf(infoAsString); Assert.AreEqual(State.PAID, info.State); Assert.AreEqual(infoAsString, info.ToString()); infoAsString = "[123][ES0927465][][][][][][][][][][][][IDLE]"; info = PaymentInfo.ValueOf(infoAsString); Assert.AreEqual(State.IDLE, info.State); Assert.AreEqual(infoAsString, info.ToString()); infoAsString = "[123][ES0927465][][][][][][][][][][][][IN_PROGRESS]"; info = PaymentInfo.ValueOf(infoAsString); Assert.AreEqual(State.IN_PROGRESS, info.State); Assert.AreEqual(infoAsString, info.ToString()); infoAsString = "[123][ES0927465][][][][][][][][][][][][IN_PROGRESS_CONFIRM]"; info = PaymentInfo.ValueOf(infoAsString); Assert.AreEqual(State.IN_PROGRESS_CONFIRM, info.State); Assert.AreEqual(infoAsString, info.ToString()); infoAsString = "[123][ES0927465][][][][][][][][][][][][INVALID]"; info = PaymentInfo.ValueOf(infoAsString); Assert.AreEqual(State.INVALID, info.State); Assert.AreEqual(infoAsString, info.ToString()); }
public void ShouldCreateStringFromNotFullPaymentInfo() { PaymentInfo info = new PaymentInfo(); info.AmountToPay = "11,24"; info.BankAccountNo = "123456778900"; info.BillerName = "Biller Name"; info.Currency = "PLN"; info.DueDate = "13.10.2009"; info.Id = "200566"; info.PostalCode = "80-111"; info.Title = "SomeTitle"; Assert.AreEqual("[200566][PL123456778900][][11,24][][SomeTitle][]" + "[80-111][][Biller Name][13.10.2009][PLN][][INVALID]", info.ToString()); PaymentInfo newOne = PaymentInfo.ValueOf(info.ToString()); Assert.AreEqual("", newOne.Street); Assert.AreEqual("", newOne.City); Assert.AreEqual(newOne.ToString(), info.ToString()); Assert.AreEqual(State.INVALID, newOne.State); Assert.IsFalse(newOne.IsDefinedTransfer); Assert.IsFalse(info.IsDefinedTransfer); }
/// <summary> /// Adds "Pay" links to the list of invoices. /// </summary> private void AddPayLinks() { HtmlElementCollection payActions = webBrowser.Document.GetElementsByTagName("td"); if (payActions == null) { return; } payActions = payActions.GetElementsByName("payAction"); button = new HtmlElement[payActions.Count]; paymentInfo = new PaymentInfo[payActions.Count]; for (int i = 0; i < payActions.Count; i++) { paymentInfo[i] = PaymentInfo.ValueOf(webBrowser.Document, payActions[i].Id); if (paymentInfo[i].Id != null && paymentInfoIndexMap.ContainsKey(paymentInfo[i].Id) == false) { paymentInfoIndexMap.Add(paymentInfo[i].Id, i); } if (payActions[i] != null && (payActions[i].GetAttribute("changed") == null || "".Equals(payActions[i].GetAttribute("changed")))) { button[i] = webBrowser.Document.CreateElement("a"); button[i].Id = "plugin_payButton_" + i; button[i].SetAttribute("index", i.ToString()); button[i].SetAttribute("class", "link"); payActions[i].AppendChild(button[i]); payActions[i].SetAttribute("changed", "true"); } } AddPayButtonHandlers(); }
/// <summary> /// Updates paid invoice in current tab. /// </summary> /// <param name="e">id of the payment info</param> private void SideBar_OnSendMessage(AddinExpress.IE.ADXIESendMessageEventArgs e) { try { int id = e.Message - MSG_BASE - WM_USER; switch (id) { case WM_REFRESH: ForceRefresh(); break; case WM_LOGOUT: ForceLogout(); break; case WM_LOGIN: ForceLogin(); break; default: PaymentInfo info = PaymentInfo.ValueOf(Application.UserAppDataRegistry.GetValue(Util.UPDATED_PAYMENT).ToString()); if (id.ToString().Equals(info.Id) && info.State == State.PAID) { MarkAsPaid(info, false); } break; } } catch { // ignore } }
public void ShouldCreateNullPaymentInfoFromString() { String infoAsString = "[098765]"; PaymentInfo info = PaymentInfo.ValueOf(infoAsString); Assert.IsNull(info.Id); Assert.AreEqual("[][][][][][][][][][][][][][INVALID]", info.ToString()); Assert.AreEqual(State.INVALID, info.State); }
public void ShouldExecuteWithInvalidInfo() { AbstractProvider provider = new DummyLoggedProvider(); paymentInfo.State = State.INVALID; PaymentInfo copy = PaymentInfo.ValueOf(paymentInfo.ToString()); PaymentInfo result = provider.Execute(new PaymentRequest(webBrowser, paymentInfo)); Assert.AreNotSame(copy, result); Assert.AreEqual(copy.ToString(), result.ToString()); }
public void ShouldSelectDefinedTransferOnTransferPageAfterIdleSomeTransferAlreadySelected() { PaymentInfo copy = PaymentInfo.ValueOf(paymentInfo.ToString()); PrepareReadyToPasteMocks(true, false); PrepareDefinedTransfersPageMocks(true, 3); PaymentInfo result = provider.Execute(request); Assert.AreNotSame(copy, result); Assert.AreEqual(copy.ToString(), result.ToString()); }
public void ShouldDoNothingAfterInProgressDefinedTransfer() { paymentInfo.State = State.IN_PROGRESS; PaymentInfo copy = PaymentInfo.ValueOf(paymentInfo.ToString()); PrepareReadyToPasteMocksForDefinedTransfer("<span>" + paymentInfo.DefinedTransferName + "</span>"); PaymentInfo result = provider.Execute(request); Assert.AreNotSame(copy, result); Assert.AreEqual(copy.ToString(), result.ToString()); }
public void ShouldGoToTransferPageAfterIdleDefinedTransfer() { PaymentInfo copy = PaymentInfo.ValueOf(paymentInfo.ToString()); PrepareReadyToPasteMocks(false); PrepareGoToTransferPageMocks(); PaymentInfo result = provider.Execute(request); Assert.AreNotSame(copy, result); Assert.AreEqual(copy.ToString(), result.ToString()); }
public void ShouldDoNothingAfterInProgress() { paymentInfo.State = State.IN_PROGRESS; PaymentInfo copy = PaymentInfo.ValueOf(paymentInfo.ToString()); PrepareReadyToPasteMocks(true); PaymentInfo result = provider.Execute(request); Assert.AreNotSame(copy, result); Assert.AreEqual(copy.ToString(), result.ToString()); }
public void ShouldSetPaymentStateAsInvalidAfterInProgressConfirm() { paymentInfo.State = State.IN_PROGRESS_CONFIRM; PaymentInfo copy = PaymentInfo.ValueOf(paymentInfo.ToString()); PrepareInProgressConfirmMocks(null, true); PaymentInfo result = provider.Execute(request); copy.State = State.INVALID; Assert.AreNotSame(copy, result); Assert.AreEqual(copy.ToString(), result.ToString()); }
public void ShouldSelectDefinedTransferPage() { PaymentInfo copy = PaymentInfo.ValueOf(paymentInfo.ToString()); PrepareReadyToPasteMocks(false); PrepareDefinedTransferPageMocks(true); PrepareSelectDefinedTransfer(paymentInfo.DefinedTransferName.ToUpper(), true); PaymentInfo result = provider.Execute(request); Assert.AreNotSame(copy, result); Assert.AreEqual(copy.ToString(), result.ToString()); }
public void ShouldPastePaymentInfoForDefinedTransfer() { PaymentInfo copy = PaymentInfo.ValueOf(paymentInfo.ToString()); PrepareReadyToPasteMocks(true); PreparePastePaymentInfoMocks(); PaymentInfo result = provider.Execute(request); copy.State = State.IN_PROGRESS; Assert.AreNotSame(copy, result); Assert.AreEqual(copy.ToString(), result.ToString()); }
public void ShouldSetPaymentStateUnchangedAfterInProgressConfirm() { paymentInfo.State = State.IN_PROGRESS_CONFIRM; PaymentInfo copy = PaymentInfo.ValueOf(paymentInfo.ToString()); PrepareConfirmationPageMocks(false, null, null); PrepareReadyToPasteMocks(true); PaymentInfo result = provider.Execute(request); Assert.AreNotSame(copy, result); Assert.AreEqual(copy.ToString(), result.ToString()); }
public void ShouldDoNothingAfterInProgessConfirm() { paymentInfo.State = State.IN_PROGRESS_CONFIRM; PaymentInfo copy = PaymentInfo.ValueOf(paymentInfo.ToString()); PrepareLoggedUserMocks(); PrepareConfirmPageMocks(true, null, null, false); PaymentInfo result = provider.Execute(request); Assert.AreNotSame(copy, result); Assert.AreEqual(copy.ToString(), result.ToString()); }
public void ShouldSetPaymentStateAsInvalidOnTransferPageAfterNoDefinedTransferFound() { PaymentInfo copy = PaymentInfo.ValueOf(paymentInfo.ToString()); PrepareReadyToPasteMocks(false, false); PrepareDefinedTransfersPageMocks(true, 0); PaymentInfo result = provider.Execute(request); copy.State = State.INVALID; Assert.AreNotSame(copy, result); Assert.AreEqual(copy.ToString(), result.ToString()); }
public void ShouldGoToTransferPageOnPastePaymentInfoForNotSelectedAnyTransfer() { paymentInfo.DefinedTransferName = ""; PaymentInfo copy = PaymentInfo.ValueOf(paymentInfo.ToString()); PrepareReadyToPasteMocks(true); PreparePastePaymentInfoMocks(false, true); PaymentInfo result = provider.Execute(request); Assert.AreNotSame(copy, result); Assert.AreEqual(copy.ToString(), result.ToString()); }
public void ShouldSetPaymentStateAsPaidAfterInProgressConfirm() { paymentInfo.State = State.IN_PROGRESS_CONFIRM; PaymentInfo copy = PaymentInfo.ValueOf(paymentInfo.ToString()); PrepareInProgressConfirmMocks("<p>Dyspozycja przelewu zosta³a przyjêta.</p>", false); PaymentInfo result = provider.Execute(request); copy.State = State.PAID; Assert.AreNotSame(copy, result); Assert.AreEqual(copy.ToString(), result.ToString()); }
public void ShouldSetPaymentStatusAsPaidAfterInProgressConfirmForDefinedTransfer() { paymentInfo.State = State.IN_PROGRESS_CONFIRM; PaymentInfo copy = PaymentInfo.ValueOf(paymentInfo.ToString()); PrepareIsConfirmationPageMocks("Twoja p³atnoœæ zostanie zrealizowana w dniu"); PaymentInfo result = provider.Execute(request); copy.State = State.PAID; Assert.AreNotSame(copy, result); Assert.AreEqual(copy.ToString(), result.ToString()); }
public void ShouldSelectSupportedAccountAfterIdleForDefinedTransfer() { PaymentInfo copy = PaymentInfo.ValueOf(paymentInfo.ToString()); PrepareReadyToPasteFalseMocks(); PrepareDefinedTransfersPageMocks(false); PrepareAccountsListPageMocks(true); PrepareSelectAccountAndGoToTransferPageMocks(1); PaymentInfo result = provider.Execute(request); Assert.AreNotSame(copy, result); Assert.AreEqual(copy.ToString(), result.ToString()); }
public void ShouldSetPaymentStateAsInvalidForNotExistingDefinedTransfer() { PaymentInfo copy = PaymentInfo.ValueOf(paymentInfo.ToString()); PrepareReadyToPasteMocks(false); PrepareDefinedTransferPageMocks(true); PrepareSelectDefinedTransfer(paymentInfo.DefinedTransferName + "123", false); PaymentInfo result = provider.Execute(request); copy.State = State.INVALID; Assert.AreNotSame(copy, result); Assert.AreEqual(copy.ToString(), result.ToString()); }
public void ShouldSetPaymentStateAsPaidAfterInProgressConfirm() { paymentInfo.State = State.IN_PROGRESS_CONFIRM; PaymentInfo copy = PaymentInfo.ValueOf(paymentInfo.ToString()); PrepareConfirmationPageMocks(true, paymentInfo.AmountToPay, paymentInfo.BankAccountNo); PaymentInfo result = provider.Execute(request); copy.State = State.PAID; copy.AmountPaid = paymentInfo.AmountToPay; Assert.AreNotSame(copy, result); Assert.AreEqual(copy.ToString(), result.ToString()); }
public void ShouldSetPaymentStatusAsInvalidAfterInProgressConfirmForAnyTransfer() { paymentInfo.State = State.IN_PROGRESS_CONFIRM; paymentInfo.DefinedTransferName = ""; PaymentInfo copy = PaymentInfo.ValueOf(paymentInfo.ToString()); PrepareIsConfirmationPageMocks(""); PaymentInfo result = provider.Execute(request); copy.State = State.INVALID; Assert.AreNotSame(copy, result); Assert.AreEqual(copy.ToString(), result.ToString()); }
public void ShouldSetPaymentStateAsInvalidAfterInProgress() { paymentInfo.State = State.IN_PROGRESS; PaymentInfo copy = PaymentInfo.ValueOf(paymentInfo.ToString()); PrepareReadyToPasteFalseMocks(); PrepareIsConfirmPageFalseMocks(); PaymentInfo result = provider.Execute(request); copy.State = State.INVALID; Assert.AreNotSame(copy, result); Assert.AreEqual(copy.ToString(), result.ToString()); }
public void ShouldSetPaymentStateAsInvalidAfterInProgressConfirmWrongAccountNo() { paymentInfo.State = State.IN_PROGRESS_CONFIRM; PaymentInfo copy = PaymentInfo.ValueOf(paymentInfo.ToString()); PrepareConfirmationPageMocks(true, paymentInfo.AmountToPay, "18273764643636363"); PaymentInfo result = provider.Execute(request); copy.State = State.INVALID; copy.BankAccountNo = "18273764643636363"; Assert.AreNotSame(copy, result); Assert.AreEqual(copy.ToString(), result.ToString()); }
public void ShouldGoToAnyTransferAfterIdleSomeTransferAlreadySelected() { url = String.Empty; paymentInfo.DefinedTransferName = ""; PaymentInfo copy = PaymentInfo.ValueOf(paymentInfo.ToString()); PrepareReadyToPasteMocks(true, false); PrepareGoToTransferPageMocks(); PaymentInfo result = provider.Execute(request); Assert.AreNotSame(copy, result); Assert.AreEqual(copy.ToString(), result.ToString()); }
public void ShouldSetPaymentStatusAsInvalidAfterIdleDefinedTransferNotExists() { PaymentInfo copy = PaymentInfo.ValueOf(paymentInfo.ToString()); PrepareReadyToPasteFalseMocks(); PrepareDefinedTransfersPageMocks(true); PrepareSelectDefinedTransferAndGoToTransferPage(0); PaymentInfo result = provider.Execute(request); copy.State = State.INVALID; Assert.AreNotSame(copy, result); Assert.AreEqual(copy.ToString(), result.ToString()); }
public void ShouldGoToTransferPageAfterIdleForDefinedTransfer() { PaymentInfo copy = PaymentInfo.ValueOf(paymentInfo.ToString()); PrepareLoggedUserMocks(); PrepareReadyToPasteMocks(false); browserMock.ExpectAndReturn("get_Document", documentMock.MockInstance); PrepareGoToTransferPageMocks(); PaymentInfo result = provider.Execute(request); Assert.AreNotSame(copy, result); Assert.AreEqual(copy.ToString(), result.ToString()); }
public void ShouldGoToAnyTransferAfterIdle() { paymentInfo.DefinedTransferName = ""; PaymentInfo copy = PaymentInfo.ValueOf(paymentInfo.ToString()); PrepareReadyToPasteFalseMocks(); PrepareAccountsListPageMocks(false); PrepareAnyAccountSelectedMock(true); PrepareGoToTransferPageMocks(); PaymentInfo result = provider.Execute(request); Assert.AreNotSame(copy, result); Assert.AreEqual(copy.ToString(), result.ToString()); }