Exemple #1
0
 public ChuckNorrisPolicy(MoneyConverter converter, IRepository<UserBankOperation> userBankOperationRepository)
 {
     Argument.NotNull(converter, "converter");
     Argument.NotNull(userBankOperationRepository, "userBankOperationRepository");
     _converter = converter;
     _userBankOperationRepository = userBankOperationRepository;
 }
Exemple #2
0
        public CardPaymentFactory(
            IRepository<Account> accounts, 
            IRepository<UserPaymentProfile> paymentProfiles,
            IRepository<Currency> currencies,
            IQueryRepository<CorrespondentAccount> correspondentAccounts, 
            TransactionReferenceBook transactionReferenceBook,
            MoneyConverter moneyConverter,
            PaymentFormFactory paymentFormFactory)
        {
            Argument.NotNull(accounts, "accounts");
            Argument.NotNull(paymentProfiles, "paymentProfiles");
            Argument.NotNull(currencies, "currencies");
            Argument.NotNull(correspondentAccounts, "correspondentAccounts");
            Argument.NotNull(transactionReferenceBook, "transactionReferenceBook");
            Argument.NotNull(moneyConverter, "moneyConverter");
            Argument.NotNull(paymentFormFactory, "paymentFormFactory");

            _settings = new BankSettings();
            _currencies = currencies;
            _correspondentAccounts = correspondentAccounts;
            _paymentProfiles = paymentProfiles;
            _accounts = accounts;
            _transactionReferenceBook = transactionReferenceBook;
            _moneyConverter = moneyConverter;
            _paymentFormFactory = paymentFormFactory;
        }
        internal BaseOperationProcessor(BaseOperationProcessorDependencies baseDependencies)
        {
            Argument.NotNull(baseDependencies, "baseDependencies");
            baseDependencies.EnsureIsResolved();
            Logger = LogManager.GetLogger(GetType().FullName);

            MoneyConverter = baseDependencies.MoneyConverter;
            TransactionRepository = baseDependencies.TransactionRepository;
            TransactionReferenceBook = baseDependencies.TransactionReferenceBook;
            Settings = new BankSettings();
        }
        public static Transaction Withdraw(this Account account,
            string code,
            string description,
            string location,
            Money money,
            MoneyConverter moneyConverter)
        {
            Argument.NotEmpty(code, "code");
            Argument.NotEmpty(description, "description");
            Argument.NotNull(account, "account");
            Argument.NotNull(money, "money");
            Argument.NotNull(moneyConverter, "moneyConverter");
            Argument.Satisfies(money, x => x.Amount > 0, "money", "Money amount should be greater than 0.");

            var convertedMoney = moneyConverter.Convert(money, account.Currency.ISOName);
            return new Transaction(account, money.Currency, - money.Amount, - convertedMoney.Amount, code, description, location);
        }
        public static Transaction Withdraw(this Account account,
                                           string code,
                                           string description,
                                           string location,
                                           Money money,
                                           MoneyConverter moneyConverter)
        {
            Argument.NotEmpty(code, "code");
            Argument.NotEmpty(description, "description");
            Argument.NotNull(account, "account");
            Argument.NotNull(money, "money");
            Argument.NotNull(moneyConverter, "moneyConverter");
            Argument.Satisfies(money, x => x.Amount > 0, "money", "Money amount should be greater than 0.");

            var convertedMoney = moneyConverter.Convert(money, account.Currency.ISOName);

            return(new Transaction(account, money.Currency, -money.Amount, -convertedMoney.Amount, code, description, location));
        }