public TransactionResult AgilePayment(string customerId, string title, TransactionDTO transaction, string language) { var transactionResult = new TransactionResult(false, ""); IHasBalances debitProduct = helper.GetProduct(transaction.DebitProductType, transaction.DebitProductId, out transactionResult, language); transactionResult = transferServices.CheckDebitBalance(debitProduct, transaction.Amount, language); IHasInstallment productForPayment = (IHasInstallment)helper.GetProduct(transaction.CreditProductType, transaction.CreditProductId, out transactionResult, language); if (!transactionResult.HasError) { transactionResult = CheckDebt(productForPayment, transaction.Amount, language); if (!transactionResult.HasError) { Payment(debitProduct, productForPayment, transaction.Amount, transaction.Expenses); transactionResult = helper.UpdateProduct(transaction.CreditProductType, (IHasBalances)productForPayment, language); if (!transactionResult.HasError) { transactionResult = helper.UpdateProduct(transaction.DebitProductType, debitProduct, language); if (!transactionResult.HasError) { transactionServices.LogTransaction(customerId, title, debitProduct.AvailableBalance, transaction); } } } } return(transactionResult); }
public TransactionResult PrepaidCardLoad(string customerId, TransactionDTO transaction, string language) { TransactionResult transactionResult = new TransactionResult(false, ""); IHasBalances debitProduct = helper.GetProduct(transaction.DebitProductType, transaction.DebitProductId, out transactionResult, language); transactionResult = transferServices.CheckDebitBalance(debitProduct, transaction.Amount, language); if (!transactionResult.HasError) { var prepaidCard = cardServices.GetPrePaidCardById(transaction.CreditProductId, out transactionResult, language); if (!transactionResult.HasError) { transferServices.DebitProduct(debitProduct, transaction.Amount, transaction.Expenses); LoadPrepaidCard(prepaidCard, transaction.Amount); transactionResult = helper.UpdateProduct(transaction.DebitProductType, debitProduct, language); if (!transactionResult.HasError) { transactionResult = cardServices.UpdatePrepaidCard(prepaidCard, language); if (!transactionResult.HasError) { transactionServices.LogTransaction(customerId, "ΦΟΡΤΙΣΗ ΠΡΟΠΛ. ΚΑΡΤΑΣ", debitProduct.AvailableBalance, transaction); } } } } return(transactionResult); }
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); }