internal static void DoPayment(InPaymentRequest data, JsonFEResult jsonResult) { var item = AccountRepository.GetAccounts().Where(x => x.AccountNumber == data.AccountNumber).ToList().FirstOrDefault(); if (item == null) { jsonResult.Success = false; jsonResult.ErrorMessage.Add($"Transaction is not possible not valid accountnumber"); return; } item.Balance += data.PriceNumber; AccountRepository.UpdateAccount(item); }
internal static bool IsValidDataForPayment(InPaymentRequest data, JsonFEResult jsonResult) { if (!ExistAccountNumber(data.AccountNumber, jsonResult)) { jsonResult.Success = false; jsonResult.ErrorMessage.Add($"Wrong account number {data.AccountNumber}"); return(false); } if (data.PriceNumber <= 0) { jsonResult.Success = false; jsonResult.ErrorMessage.Add("Price must to be biger then 0 (zero)"); return(false); } return(true); }