public void Given_Valid_Account_Deatils_FastPayment_Should_Process() { _fastPayment = new FastPayment(); _account = new DeveloperTest.Types.Account { AccountNumber = "1223456", AllowedPaymentSchemes = DeveloperTest.Types.AllowedPaymentSchemes.FasterPayments, Balance = 890M }; Assert.AreEqual(true, _fastPayment.isAllowedPayementScheme(_account, 23M)); }
public void UpdateFastPaymentStatus(FastPayment fastPayment, FastPaymentDTOStatus newStatus, DateTime statusDate) { var oldStatus = fastPayment.FastPaymentStatus; _fastPaymentManager.UpdateFastPaymentStatus(_uow, fastPayment, newStatus, statusDate); Save(fastPayment); _logger.LogInformation($"Статус платежа с externalId: {fastPayment.ExternalId} изменён c {oldStatus} на {newStatus}"); }
public void Given_Valid_Account_Deatils_With_Higher_Balance_Should_Get_Payment() { AccountDataStore accountDataStore = new AccountDataStore(); var result = accountDataStore.GetAccount("19202122"); FastPayment fastPayment = new FastPayment(); Assert.AreEqual(true, fastPayment.CheckBalance(result, 450M)); }
public void Given_Valid_Account_Deatils_With_Lower_Balance_Should_not_Get_Payment() { AccountDataStore accountDataStore = new AccountDataStore(); var result = accountDataStore.GetAccount("15161718"); FastPayment fastPayment = new FastPayment(); Assert.AreEqual(false, fastPayment.CheckBalance(result, 450M)); }
private void Initialize(FastPayment fastPayment) { if (fastPayment.Order != null) { FillOrderData(fastPayment.Order.Id, fastPayment.Order.DeliveryDate, fastPayment.Order.OrderSum); } else { FillOrderData(fastPayment.OnlineOrderId.Value, DateTime.Today, fastPayment.Amount); IsOnlineOrder = true; } Ticket = fastPayment.Ticket; _fastPaymentStatus = fastPayment.FastPaymentStatus; }
public void UpdateFastPaymentStatus(IUnitOfWork uow, FastPayment fastPayment, FastPaymentDTOStatus newStatus, DateTime statusDate) { switch (newStatus) { case FastPaymentDTOStatus.Processing: fastPayment.SetProcessingStatus(); break; case FastPaymentDTOStatus.Performed: if (fastPayment.Order != null) { var paymentFrom = fastPayment.FastPaymentPayType == FastPaymentPayType.ByCard ? _orderParametersProvider.GetPaymentByCardFromAvangardId : _orderParametersProvider.GetPaymentByCardFromFastPaymentServiceId; fastPayment.SetPerformedStatusForOrder( uow, statusDate, uow.GetById <PaymentFrom>(paymentFrom), _standartNomenclatures, _routeListItemRepository, _selfDeliveryRepository, _cashRepository); } else { fastPayment.SetPerformedStatusForOnlineOrder(statusDate); } break; case FastPaymentDTOStatus.Rejected: fastPayment.SetRejectedStatus(); break; default: throw new InvalidOperationException("Неизвестный статус оплаты"); } }
public PayViewModel(IFastPaymentParametersProvider fastPaymentParametersProvider, FastPayment fastPayment) { _fastPaymentParametersProvider = fastPaymentParametersProvider ?? throw new ArgumentNullException(nameof(fastPaymentParametersProvider)); if (fastPayment == null) { throw new ArgumentNullException(nameof(fastPayment)); } Initialize(fastPayment); }
public PayViewModel CreateNewPayViewModel(FastPayment fastPayment) => new PayViewModel(_fastPaymentParametersProvider, fastPayment);