public DebitCardWithLinkedProducts GetDebitCardWithLinkedProducts(string cardId) { var debitCard = cardManager.GetDebitCardById(cardId); var transactionResult = new TransactionResult(false, ""); var linkedProducts = cardManager .GetDebitCardLinkedProducts(cardId) .Select(linkedProduct => accountServices.GetAccountById(linkedProduct.ProductId, out transactionResult, "greek")) .ToList(); return(new DebitCardWithLinkedProducts(debitCard, linkedProducts)); }
public TransactionResult Transfer(string customerId, TransactionDTO transaction, string language) { var transactionResult = new TransactionResult(false, ""); IHasBalances debitProduct = helper.GetProduct(transaction.DebitProductType, transaction.DebitProductId, out transactionResult, language); transactionResult = CheckDebitBalance(debitProduct, transaction.Amount, language); if (!transactionResult.HasError) { DebitProduct(debitProduct, transaction.Amount, transaction.Expenses); transactionResult = helper.UpdateProduct(transaction.DebitProductType, debitProduct, language); if (!transactionResult.HasError && transaction.Bank == "AGILGRAA") { Account creditProduct = accountServices.GetAccountById(transaction.CreditProductId, out transactionResult, language); if (!transactionResult.HasError) { CreditProduct(creditProduct, transaction.Amount); transactionResult = accountServices.UpdateAccount(creditProduct, language); } } if (!transactionResult.HasError) { transactionResult = helper.UpdateProduct(transaction.DebitProductType, debitProduct, language); if (!transactionResult.HasError) { transactionServices.LogTransaction(customerId, "ΜΕΤΑΦΟΡΑ ΧΡΗΜΑΤΩΝ", debitProduct.AvailableBalance, transaction); } } } return(transactionResult); }