예제 #1
0
        [Test] // 1
        public void AddBankAccount_AddsANewAccountAnd_ReturnsNewAccountId_WhenCalled()
        {
            //Arrange
            BankAccount bankAccount = new BankAccount {
                CustomerId = 1, BankAccountTypeId = 1, Interestrate = 0
            };
            BankAccountRepository bankAccountRepository = new BankAccountRepository(context);
            var             expected1        = bankAccount;
            BankAccountType bankAccountType1 = new BankAccountType
            {
                BankAccountTypeId = 1, BankAccountTypeName = "Saving Account"
            };
            BankAccountType bankAccountType2 = new BankAccountType
            {
                BankAccountTypeId = 2, BankAccountTypeName = "Check Account"
            };

            context.BankAccountTypes.Add(bankAccountType1);
            context.BankAccountTypes.Add(bankAccountType2);
            context.SaveChanges();
            int expected2 = 1;

            //Act
            int actual2 = bankAccountRepository.AddBankAccount(bankAccount);
            var actual1 = context.BankAccounts.ToList().ElementAt(0);

            //Assert
            Assert.AreEqual(expected1, actual1);
            Assert.AreEqual(expected2, actual2);
        }
예제 #2
0
 public ChargeBankEasy(ulong channel, BankAccountType type, string no)
 {
     Type        = 2;
     Channel     = channel;
     AccountType = type;
     No          = no;
 }
예제 #3
0
        public void CanReturnBankAccountTypes()
        {
            //arrange
            var mockedAccountTypes = new BankAccountType[]
            {
                new BankAccountType()
                {
                    Id = 1, Name = "ABCD"
                },
                new BankAccountType()
                {
                    Id = 2, Name = "test"
                }
            };

            _bankAccountTypeRepository.Setup(t => t.GetAll()).Returns(mockedAccountTypes.AsQueryable());
            var service = new BankAccountTypeService(_bankAccountTypeRepository.Object);

            //act
            var result = service.GetBankAccountTypes();
            var types  = result.ToList();

            //assert
            Assert.IsInstanceOf <IEnumerable <BankAccountTypeDto> >(result);
            Assert.AreEqual(2, result.Count());
            Assert.AreEqual(1, types[0].Id);
            Assert.AreEqual(2, types[1].Id);
            Assert.AreEqual("ABCD", types[0].Name);
            Assert.AreEqual("test", types[1].Name);
        }
예제 #4
0
 public void CreateBankAccount(BankAccountType type, double money = 0)
 {
     switch (type)
     {
     case BankAccountType.CreditAccount:
         bankAccounts.Add(new CreditAccount(bankAccounts.Count, this, thisBankClient));
         bankAccounts[^ 1].TopUpAccount(money);
예제 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ACHPaymentInfo"/> class.
 /// </summary>
 /// <param name="bankAccountNumber">The account number.</param>
 /// <param name="bankRoutingNumber">The routing number.</param>
 /// <param name="accountType">Type of the account.</param>
 public ACHPaymentInfo(string bankAccountNumber, string bankRoutingNumber, BankAccountType accountType)
     : this()
 {
     BankAccountNumber = bankAccountNumber;
     BankRoutingNumber = bankRoutingNumber;
     AccountType       = accountType;
 }
예제 #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ACHPaymentInfo"/> class.
 /// </summary>
 /// <param name="bankAccountNumber">The account number.</param>
 /// <param name="bankRoutingNumber">The routing number.</param>
 /// <param name="accountType">Type of the account.</param>
 public ACHPaymentInfo( string bankAccountNumber, string bankRoutingNumber, BankAccountType accountType )
     : this()
 {
     BankAccountNumber = bankAccountNumber;
     BankRoutingNumber = bankRoutingNumber;
     AccountType = accountType;
 }
예제 #7
0
        public static void AddAlibabaDefaultBankAccount(this Customer customer, ISortCodeChecker sortCodeChecker = null)
        {
            const string          bankAccount = "00000000";
            const string          sortCode    = "000000";
            const BankAccountType accountType = BankAccountType.Personal;

            if (customer == null)
            {
                ms_oLog.Debug("Customer not specified for adding an Alibaba default bank account (#{0}, code {1}, type {2}).",
                              bankAccount,
                              sortCode,
                              accountType
                              );

                return;
            }             // if

            if (customer.IsAlibaba)
            {
                customer.AddBankAccount("00000000", "000000", BankAccountType.Personal);
                return;
            }             // if

            ms_oLog.Debug(
                "Not adding an Alibaba default bank account (#{1}, code {2}, type {3}) to customer {0} because this is not an Alibaba customer.",
                customer.Stringify(),
                bankAccount,
                sortCode,
                accountType
                );
        }         // AddAlibabaDefaultBankAccount
예제 #8
0
        [Test] // 4
        public void DeleteBankAccount_AfterAddingANewBankAccountToTheContext_DeletesTheNewAddedBankAccountFromTheContextAndLeavesAnEmptyTableOfBankAccountsInContext_WhenCalledWithTheAddedBankAccount()
        {
            //Arrange
            BankAccountRepository bankAccountRepository = new BankAccountRepository(context);
            BankAccountType       bankAccountType1      = new BankAccountType {
                BankAccountTypeId = 1, BankAccountTypeName = "Saving Account"
            };

            context.BankAccountTypes.Add(bankAccountType1);
            BankAccount bankAccount = new BankAccount {
                CustomerId = 1, BankAccountTypeId = 1, Interestrate = 0
            };

            context.BankAccounts.Add(bankAccount);
            context.SaveChanges();
            List <BankAccount> expected = new List <BankAccount>();

            //Act
            bankAccountRepository.DeleteBankAccount(bankAccount);
            context.SaveChanges();
            var actual = context.BankAccounts.ToList();

            //Assert
            Assert.AreEqual(expected, actual);
        }
        [Test] // 2 CheckAccount Positive Withdaw amount <= balance
        public void Withdraw_Withdraws30FromNewCreatedBankAccountWithBankAccountId2IncontextWithBalance100And_NewBankAccountInContextHasBalance70Left_WhenCalled()
        {
            //Arrange
            BankAccount bankAccount = new BankAccount {
                CustomerId = 1, BankAccountTypeId = 2, Balance = 100
            };
            BankAccountType bankAccountType1 = new BankAccountType {
                BankAccountTypeId = 1, BankAccountTypeName = "Saving Account"
            };

            context.BankAccountTypes.Add(bankAccountType1);
            BankAccountType bankAccountType2 = new BankAccountType {
                BankAccountTypeId = 2, BankAccountTypeName = "Check Account"
            };

            context.BankAccountTypes.Add(bankAccountType2);
            context.BankAccounts.Add(bankAccount);
            context.SaveChanges();
            Withdrawing withdrawing = new Withdrawing(context);
            decimal     expected    = 70;

            //Act
            withdrawing.Withdraw(30, bankAccount);
            context.SaveChanges();
            decimal actual = context.BankAccounts.ToList().ElementAt(0).Balance;

            //Assert
            Assert.AreEqual(expected, actual);
        }
        [Test] // 6 CheckAccount Withdaw amount > Balance
        public void Test_Withdraw_Withdraws101_WhenCalledWithAWithdrawAmountOf101AndBalance100AndBankAccountTypeId2()
        {
            //Arrange
            BankAccount bankAccount = new BankAccount {
                CustomerId = 1, BankAccountTypeId = 2, Balance = 100
            };

            BankAccountType bankAccountType2 = new BankAccountType {
                BankAccountTypeId = 2, BankAccountTypeName = "Check Account"
            };
            BankAccountType bankAccountType1 = new BankAccountType {
                BankAccountTypeId = 1, BankAccountTypeName = "Saving Account"
            };

            context.BankAccountTypes.Add(bankAccountType1);
            context.BankAccountTypes.Add(bankAccountType2);
            context.SaveChanges();
            context.BankAccounts.Add(bankAccount);
            context.SaveChanges();
            Withdrawing withdrawing = new Withdrawing(context);
            var         expected    = -1;

            //Act
            withdrawing.Withdraw(101, bankAccount);
            context.SaveChanges();
            var actual = bankAccount.Balance;

            //Assert
            Assert.AreEqual(expected, actual);
        }
예제 #11
0
 public BankAccount(string accountNumber, double initialBalance, BankAccountType type)
 {
     this.AccountNumber = accountNumber;
     this.balance       = initialBalance;
     this.CreationDate  = DateTime.Now;
     this.Type          = type;
 }
        [Test] // 2 CheckAccount Positive corection
        public void Correcrint_CorrectsBalanceTo30ForNewCreatedBankAccountWithBankAccountId2IncontextWithBalance100And_NewBankAccountInContextHasBalance30Left_WhenCalled()
        {
            //Arrange
            BankAccount bankAccount = new BankAccount
            {
                CustomerId = 1, BankAccountTypeId = 2, Balance = 100
            };
            BankAccountType bankAccountType1 = new BankAccountType
            {
                BankAccountTypeId = 1, BankAccountTypeName = "Saving Account"
            };
            BankAccountType bankAccountType2 = new BankAccountType {
                BankAccountTypeId = 2, BankAccountTypeName = "Check Account"
            };

            context.BankAccountTypes.Add(bankAccountType1);
            context.BankAccountTypes.Add(bankAccountType2);
            context.BankAccounts.Add(bankAccount);
            context.SaveChanges();
            Correcting correcting = new Correcting(context);
            decimal    expected   = 30;

            //Act
            correcting.Correct(30, bankAccount);
            context.SaveChanges();
            decimal actual = context.BankAccounts.ToList().ElementAt(0).Balance;

            //Assert
            Assert.AreEqual(expected, actual);
        }
        [Test] // 4 CheckAccount negative Withdaw
        public void Withdraw_ThrowsExceptionOfInvalidWithdrawAmount_WhenCalledWithANegativeWithdrawAmountOfMinus1AndBankAccountTypeId2()
        {
            //Arrange
            BankAccount bankAccount = new BankAccount {
                CustomerId = 1, BankAccountTypeId = 2, Balance = 100
            };
            BankAccountType bankAccountType1 = new BankAccountType {
                BankAccountTypeId = 1, BankAccountTypeName = "Saving Account"
            };

            context.BankAccountTypes.Add(bankAccountType1);
            BankAccountType bankAccountType2 = new BankAccountType {
                BankAccountTypeId = 2, BankAccountTypeName = "Check Account"
            };

            context.BankAccountTypes.Add(bankAccountType2);
            context.BankAccounts.Add(bankAccount);
            context.SaveChanges();
            Withdrawing withdrawing = new Withdrawing(context);

            //Act
            var ex = Assert.Throws <Exception>(() => withdrawing.Withdraw(-1, bankAccount));

            //Assert
            Assert.That(ex.Message, Is.EqualTo("Invalid withdraw amount"));
        }
예제 #14
0
        private BankAccount CreateAccountByType(BankUser bankUser, BankAccountType typeAccount)
        {
            if (bankUser == null)
            {
                throw new ArgumentNullException(nameof(bankUser));
            }

            BankAccount newAccount;

            switch (typeAccount)
            {
            case BankAccountType.Base:
                newAccount = new BaseAccount(bankUser);
                break;

            case BankAccountType.Gold:
                newAccount = new GoldAccount(bankUser);
                break;

            case BankAccountType.Platinum:
                newAccount = new PlatinumAccount(bankUser);
                break;

            default:
                throw new InvalidEnumArgumentException(nameof(typeAccount));
            }

            return(newAccount);
        }
예제 #15
0
 public BankAccount(Customer cust, BankAccountType type, decimal balance, decimal interestRate)
 {
     this.AccountCustomer = cust;
     this.AccountType     = type;
     this.AccountBalance  = balance;
     this.InterestRate    = interestRate;
 }
예제 #16
0
 private DirectDeposit(int employeeId, string accountNumber, string routingNumber,
                       BankAccountType accountType)
 {
     EmployeeId    = employeeId;
     AccountNumber = accountNumber;
     RoutingNumber = routingNumber;
     AccountType   = accountType;
 }
예제 #17
0
        public BankAccount(Person owner, BankAccountType type)
        {
            Owner = owner;
            Type  = type;

            Transactions = new List <Transaction>();
            nextBankAccountNumber++;
        }
     public IBankAccountTypeBuilder WithDescription(string description)
     {
         _bankAccountType = _bankAccountType with {
             Description = description
         };
         return(this);
     }
 }
예제 #19
0
        public void Can_convert_to_string()
        {
            BankAccountType accountType = BankAccountType.Parse("Current");
            string          description = accountType;

            accountType.ToString().ShouldBe("Current");
            description.ShouldBe("Current");
        }
예제 #20
0
        public ActionResult DeleteConfirmed(int id)
        {
            BankAccountType bankAccountType = db.BankAccountTypes.Find(id);

            db.BankAccountTypes.Remove(bankAccountType);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #21
0
 internal static BankAccountTypeDto ToDto(this BankAccountType bat)
 {
     return(new BankAccountTypeDto()
     {
         Id = bat.Id,
         Wording = bat.Wording
     });
 }
예제 #22
0
 public BankAccount(string name, string accountNumber, string routingNumber, BankAccountType type)
     : base()
 {
     this.Name = name;
     this.AccountNumber = accountNumber;
     this.RoutingNumber = routingNumber;
     this.Type = type;
 }
예제 #23
0
파일: Pay.cs 프로젝트: BULUSDUAN/lottery_PC
 public PayBank(ulong channel, BankAccountType type, string name, string no)
 {
     Type        = 1;
     Channel     = channel;
     AccountType = type;
     Name        = name;
     No          = no;
 }
예제 #24
0
 /// <summary>
 /// Creates an ECheck transaction (defaulted to WEB) request for use with the AIM gateway
 /// </summary>
 /// <param name="amount"></param>
 /// <param name="bankABACode">The valid routing number of the customer’s bank</param>
 /// <param name="bankAccountNumber">The customer’s valid bank account number</param>
 /// <param name="acctType">CHECKING, BUSINESSCHECKING, SAVINGS</param>
 /// <param name="bankName">The name of the bank that holds the customer’s account</param>
 /// <param name="acctName">The name associated with the bank account</param>
 /// <param name="bankCheckNumber">The check number on the customer’s paper check</param>
 public EcheckAuthorizationRequest(decimal amount, string bankABACode, string bankAccountNumber,
                                   BankAccountType acctType, string bankName, string acctName,
                                   string bankCheckNumber) :
                                       this(
                                       EcheckType.WEB, amount, bankABACode, bankAccountNumber, acctType, bankName,
                                       acctName,
                                       bankCheckNumber)
 {
 }
예제 #25
0
        private void DeleteByEntity(BankAccountType deletedEntity)
        {
            var entity = this.Entities.FirstOrDefault(x => x.BankAccountTypeId == deletedEntity.BankAccountTypeId);

            if (entity != null)
            {
                this.Entities.Remove(entity);
            }
        }
예제 #26
0
 /// <summary>
 /// Creates an ECheck transaction (defaulted to WEB) request for use with the AIM gateway
 /// </summary>
 /// <param name="amount"></param>
 /// <param name="bankABACode">The valid routing number of the customer’s bank</param>
 /// <param name="bankAccountNumber">The customer’s valid bank account number</param>
 /// <param name="acctType">CHECKING, BUSINESSCHECKING, SAVINGS</param>
 /// <param name="bankName">The name of the bank that holds the customer’s account</param>
 /// <param name="acctName">The name associated with the bank account</param>
 /// <param name="bankCheckNumber">The check number on the customer’s paper check</param>
 public EcheckAuthorizationRequest(decimal amount, string bankABACode, string bankAccountNumber,
                                   BankAccountType acctType, string bankName, string acctName,
                                   string bankCheckNumber) :
     this(
         EcheckType.WEB, amount, bankABACode, bankAccountNumber, acctType, bankName,
         acctName,
         bankCheckNumber)
 {
 }
예제 #27
0
 /// <summary>
 /// Creates an ECheck transaction (defaulted to WEB) request for use with the AIM gateway
 /// </summary>
 /// <param name="authCode">The auth code.</param>
 /// <param name="amount"></param>
 /// <param name="bankABACode">The valid routing number of the customer’s bank</param>
 /// <param name="bankAccountNumber">The customer’s valid bank account number</param>
 /// <param name="acctType">CHECKING, BUSINESSCHECKING, SAVINGS</param>
 /// <param name="bankName">The name of the bank that holds the customer’s account</param>
 /// <param name="acctName">The name associated with the bank account</param>
 /// <param name="bankCheckNumber">The check number on the customer’s paper check</param>
 public EcheckCaptureRequest(string authCode, decimal amount, string bankABACode, string bankAccountNumber,
                             BankAccountType acctType, string bankName, string acctName,
                             string bankCheckNumber) :
     this(authCode,
          EcheckType.WEB, amount, bankABACode, bankAccountNumber, acctType, bankName,
          acctName,
          bankCheckNumber)
 {
 }
예제 #28
0
 /// <summary>
 /// Provides loaded from storage instance of bank account
 /// </summary>
 /// <param name="bankUser">Account owner</param>
 /// <param name="accountId">Account id</param>
 /// <param name="typeAccount">Type account</param>
 /// <param name="amount">Amount</param>
 /// <param name="bonus">Bonus</param>
 /// <param name="isClosed">Is account closed</param>
 public BankAccount(BankUser bankUser, string accountId, BankAccountType typeAccount, uint amount, uint bonus, bool isClosed)
 {
     this.User        = bankUser;
     this.AccountId   = accountId;
     this.TypeAccount = typeAccount;
     this.Amount      = amount;
     this.Bonus       = bonus;
     this.IsClosed    = isClosed;
 }
예제 #29
0
 /// <summary>
 /// Creates an ECheck transaction (defaulted to WEB) request for use with the AIM gateway
 /// </summary>
 /// <param name="amount"></param>
 /// <param name="bankABACode">The valid routing number of the customer’s bank</param>
 /// <param name="bankAccountNumber">The customer’s valid bank account number</param>
 /// <param name="acctType">CHECKING, BUSINESSCHECKING, SAVINGS</param>
 /// <param name="bankName">The name of the bank that holds the customer’s account</param>
 /// <param name="acctName">The name associated with the bank account</param>
 /// <param name="bankCheckNumber">The check number on the customer’s paper check</param>
 public EcheckUnlinkedCreditRequest(decimal amount, string bankABACode, string bankAccountNumber,
                                    BankAccountType acctType, string bankName, string acctName,
                                    string bankCheckNumber) :
     this(
         EcheckType.WEB, amount, bankABACode, bankAccountNumber, acctType, bankName,
         acctName,
         bankCheckNumber)
 {
 }
예제 #30
0
 /// <summary>
 /// Creates an ECheck transaction request for use with the AIM gateway
 /// </summary>
 /// <param name="type">The Echeck Transaction type: ARC, BOC, CCD, PPD, TEL, WEB</param>
 /// <param name="amount"></param>
 /// <param name="bankABACode">The valid routing number of the customer’s bank</param>
 /// <param name="bankAccountNumber">The customer’s valid bank account number</param>
 /// <param name="acctType">CHECKING, BUSINESSCHECKING, SAVINGS</param>
 /// <param name="bankName">The name of the bank that holds the customer’s account</param>
 /// <param name="acctName">The name associated with the bank account</param>
 /// <param name="bankCheckNumber">The check number on the customer’s paper check</param>
 public EcheckUnlinkedCreditRequest(EcheckType type, decimal amount, string bankABACode, string bankAccountNumber,
                                    BankAccountType acctType, string bankName, string acctName,
                                    string bankCheckNumber) :
     base(
         type, amount, bankABACode, bankAccountNumber, acctType, bankName, acctName,
         bankCheckNumber)
 {
     SetApiAction(RequestAction.UnlinkedCredit);
 }
예제 #31
0
 /// <summary>
 /// Creates an ECheck transaction (defaulted to WEB) request for use with the AIM gateway
 /// </summary>
 /// <param name="amount"></param>
 /// <param name="bankABACode">The valid routing number of the customer’s bank</param>
 /// <param name="bankAccountNumber">The customer’s valid bank account number</param>
 /// <param name="acctType">CHECKING, BUSINESSCHECKING, SAVINGS</param>
 /// <param name="bankName">The name of the bank that holds the customer’s account</param>
 /// <param name="acctName">The name associated with the bank account</param>
 /// <param name="bankCheckNumber">The check number on the customer’s paper check</param>
 /// <param name="includeCapture">Should the item also be captured</param>
 public EcheckAuthorizationRequest(decimal amount, string bankABACode, string bankAccountNumber,
                                   BankAccountType acctType, string bankName, string acctName,
                                   string bankCheckNumber, bool includeCapture = false) :
     this(
         EcheckType.WEB, amount, bankABACode, bankAccountNumber, acctType, bankName,
         acctName,
         bankCheckNumber, includeCapture)
 {
 }
예제 #32
0
 /// <summary>
 /// Creates an ECheck transaction request for use with the AIM gateway
 /// </summary>
 /// <param name="type">The Echeck Transaction type: ARC, BOC, CCD, PPD, TEL, WEB</param>
 /// <param name="amount"></param>
 /// <param name="bankABACode">The valid routing number of the customer’s bank</param>
 /// <param name="bankAccountNumber">The customer’s valid bank account number</param>
 /// <param name="acctType">CHECKING, BUSINESSCHECKING, SAVINGS</param>
 /// <param name="bankName">The name of the bank that holds the customer’s account</param>
 /// <param name="acctName">The name associated with the bank account</param>
 /// <param name="bankCheckNumber">The check number on the customer’s paper check</param>
 public EcheckAuthorizationRequest(EcheckType type, decimal amount, string bankABACode, string bankAccountNumber,
                                   BankAccountType acctType, string bankName, string acctName,
                                   string bankCheckNumber) :
     base(
         type, amount, bankABACode, bankAccountNumber, acctType, bankName, acctName,
         bankCheckNumber)
 {
     SetApiAction(RequestAction.Authorize);
 }
예제 #33
0
        private void UpdateEntity(BankAccountType updatedEntity)
        {
            var entity = this.Entities.FirstOrDefault(x => x.BankAccountTypeId == updatedEntity.BankAccountTypeId);

            if (entity != null)
            {
                entity = updatedEntity;
            }
        }
예제 #34
0
 /// <summary>
 /// Creates an ECheck transaction request for use with the AIM gateway
 /// </summary>
 /// <param name="type">The Echeck Transaction type: ARC, BOC, CCD, PPD, TEL, WEB</param>
 /// <param name="amount"></param>
 /// <param name="bankABACode">The valid routing number of the customer’s bank</param>
 /// <param name="bankAccountNumber">The customer’s valid bank account number</param>
 /// <param name="acctType">CHECKING, BUSINESSCHECKING, SAVINGS</param>
 /// <param name="bankName">The name of the bank that holds the customer’s account</param>
 /// <param name="acctName">The name associated with the bank account</param>
 /// <param name="bankCheckNumber">The check number on the customer’s paper check</param>
 public EcheckRequest(EcheckType type, decimal amount, string bankABACode, string bankAccountNumber,
     BankAccountType acctType, string bankName, string acctName, string bankCheckNumber)
 {
     Queue(ApiFields.Method, "ECHECK");
     this.BankABACode = bankABACode;
     this.BankAccountName = acctName;
     this.BankAccountNumber = bankAccountNumber;
     this.BankAccountType = acctType;
     this.BankCheckNumber = bankCheckNumber;
     this.Amount = amount.ToString();
 }
        /// <summary>
        /// Construct
        /// </summary>
        /// <param name="coreDriver">Core Driver</param>
        /// <param name="management">Matadata management</param>
        /// <param name="id"></param>
        /// <param name="descp"></param>
        /// <param name="accNumber"></param>
        /// <param name="bankKey"></param>
        /// <param name="type"></param>
        /// <exception cref="ArgumentNullException">Arguments null</exception>
        /// <exception cref="MasterDataIdentityNotDefined">Master data identity is not defined.</exception>
        public BankAccountMasterData(CoreDriver coreDriver, MasterDataManagement management,
                MasterDataIdentity id, String descp, BankAccountNumber accNumber,
                MasterDataIdentity bankKey, BankAccountType type)
            : base(coreDriver, management, id, descp)
        {
            _accNumber = accNumber;
            _bankAccType = type;

            MasterDataBase bankKeyId = management.GetMasterData(bankKey,
                    MasterDataType.BANK_KEY);
            if (bankKeyId == null)
            {
                throw new MasterDataIdentityNotDefined(bankKey,
                        MasterDataType.BANK_KEY);
            }
            _bankKey = bankKeyId.GetIdentity();
        }
예제 #36
0
 /// <summary>
 /// Creates an ECheck transaction request for use with the AIM gateway
 /// </summary>
 /// <param name="authCode">The auth code.</param>
 /// <param name="type">The Echeck Transaction type: ARC, BOC, CCD, PPD, TEL, WEB</param>
 /// <param name="amount"></param>
 /// <param name="bankABACode">The valid routing number of the customer’s bank</param>
 /// <param name="bankAccountNumber">The customer’s valid bank account number</param>
 /// <param name="acctType">CHECKING, BUSINESSCHECKING, SAVINGS</param>
 /// <param name="bankName">The name of the bank that holds the customer’s account</param>
 /// <param name="acctName">The name associated with the bank account</param>
 /// <param name="bankCheckNumber">The check number on the customer’s paper check</param>
 public EcheckCaptureRequest(string authCode, EcheckType type, decimal amount, string bankABACode,
                             string bankAccountNumber,
                             BankAccountType acctType, string bankName, string acctName,
                             string bankCheckNumber) :
                                 base(
                                 type, amount, bankABACode, bankAccountNumber, acctType, bankName, acctName,
                                 bankCheckNumber)
 {
     this.SetApiAction(RequestAction.Capture);
     this.Queue(ApiFields.AuthorizationCode, authCode);
 }
예제 #37
0
 public static BankAccount[] GetIndex(DefaultContext db, BankAccountType bankAccountType, int userId)
 {
     IQueryable<BankAccount> bankAccounts = db.BankAccounts.Where(ba => ba.BankAccountType == bankAccountType && ba.BankAccountUsers.Any(bau => bau.UserId == userId));
     return bankAccounts.ToArray();
 }
예제 #38
0
 /// <summary>
 /// Creates an ECheck transaction request for use with the AIM gateway
 /// </summary>
 /// <param name="type">The Echeck Transaction type: ARC, BOC, CCD, PPD, TEL, WEB</param>
 /// <param name="amount"></param>
 /// <param name="bankABACode">The valid routing number of the customer’s bank</param>
 /// <param name="bankAccountNumber">The customer’s valid bank account number</param>
 /// <param name="acctType">CHECKING, BUSINESSCHECKING, SAVINGS</param>
 /// <param name="bankName">The name of the bank that holds the customer’s account</param>
 /// <param name="acctName">The name associated with the bank account</param>
 /// <param name="bankCheckNumber">The check number on the customer’s paper check</param>
 public EcheckUnlinkedCreditRequest(EcheckType type, decimal amount, string bankABACode, string bankAccountNumber,
                                   BankAccountType acctType, string bankName, string acctName,
                                   string bankCheckNumber) :
                                       base(
                                       type, amount, bankABACode, bankAccountNumber, acctType, bankName, acctName,
                                       bankCheckNumber)
 {
     SetApiAction(RequestAction.UnlinkedCredit);
 }
예제 #39
0
 /// <summary>
 /// Creates an ECheck transaction (defaulted to WEB) request for use with the AIM gateway
 /// </summary>
 /// <param name="amount"></param>
 /// <param name="bankABACode">The valid routing number of the customer’s bank</param>
 /// <param name="bankAccountNumber">The customer’s valid bank account number</param>
 /// <param name="acctType">CHECKING, BUSINESSCHECKING, SAVINGS</param>
 /// <param name="bankName">The name of the bank that holds the customer’s account</param>
 /// <param name="acctName">The name associated with the bank account</param>
 /// <param name="bankCheckNumber">The check number on the customer’s paper check</param>
 public EcheckUnlinkedCreditRequest(decimal amount, string bankABACode, string bankAccountNumber,
                                   BankAccountType acctType, string bankName, string acctName,
                                   string bankCheckNumber) :
                                       this(
                                       EcheckType.WEB, amount, bankABACode, bankAccountNumber, acctType, bankName,
                                       acctName,
                                       bankCheckNumber)
 {
 }
 private void LoadFromNode(XmlNode rootNode)
 {
     foreach (XmlNode dataNode in rootNode.ChildNodes)
     {
         switch (dataNode.Name)
         {
             case IdKey:
                 Id = dataNode.GetNodeContentAsInt();
                 break;
             case CustomerIdKey:
                 _customerId = dataNode.GetNodeContentAsInt();
                 break;
             case FirstNameKey:
                 FirstName = dataNode.GetNodeContentAsString();
                 break;
             case LastNameKey:
                 LastName = dataNode.GetNodeContentAsString();
                 break;
             case FullNumberKey:
                 FullNumber = dataNode.GetNodeContentAsString();
                 break;
             case ExpirationMonthKey:
                 ExpirationMonth = dataNode.GetNodeContentAsInt();
                 break;
             case ExpirationYearKey:
                 ExpirationYear = dataNode.GetNodeContentAsInt();
                 break;
             case CvvKey:
                 _cvv = dataNode.GetNodeContentAsString();
                 break;
             case BillingAddressKey:
                 BillingAddress = dataNode.GetNodeContentAsString();
                 break;
             case BillingAddress2Key:
                 BillingAddress2 = dataNode.GetNodeContentAsString();
                 break;
             case BillingCityKey:
                 BillingCity = dataNode.GetNodeContentAsString();
                 break;
             case BillingCountryKey:
                 BillingCountry = dataNode.GetNodeContentAsString();
                 break;
             case BillingStateKey:
                 BillingState = dataNode.GetNodeContentAsString();
                 break;
             case BillingZipKey:
                 BillingZip = dataNode.GetNodeContentAsString();
                 break;
             case BankNameKey:
                 _bankName = dataNode.GetNodeContentAsString();
                 break;
             case BankRoutingNumberKey:
                 _bankRoutingNumber = dataNode.GetNodeContentAsString();
                 break;
             case BankAccountNumberKey:
                 _bankAccountNumber = dataNode.GetNodeContentAsString();
                 break;
             case BankAccountTypeKey:
                 _bankAccountType = dataNode.GetNodeContentAsEnum<BankAccountType>();
                 break;
             case BankAccountHolderTypeKey:
                 _bankAccountHolderType = dataNode.GetNodeContentAsEnum<BankAccountHolderType>();
                 break;
             case PaymentMethodNonceKey:
                 _paymentMethodNonce = dataNode.GetNodeContentAsString();
                 break;
             case PayPalEmailKey:
                 _payPalEmail = dataNode.GetNodeContentAsString();
                 break;
             case PaymentTypeKey:
                 _paymentType = dataNode.GetNodeContentAsEnum<PaymentProfileType>();
                 break;
             default:
                 break;
         }
     }
 }
예제 #41
0
 public static BankAccountHistory[] GetIndex(DefaultContext db, BankAccountType bankAccountType)
 {
     BankAccountHistory[] bankAccountHistories = db.BankAccountHistories.Where(bah => bah.BankAccount.BankAccountType == bankAccountType).ToArray();
     return bankAccountHistories;
 }
 public BankAccountOnFile(BankAccountType accountType)
 {
     this.AccountType = accountType;
 }
 private void LoadFromJSON(JsonObject obj)
 {
     foreach (string key in obj.Keys)
     {
         switch (key)
         {
             case IdKey:
                 Id = obj.GetJSONContentAsInt(key);
                 break;
             case CustomerIdKey:
                 _customerId = obj.GetJSONContentAsInt(key);
                 break;
             case FirstNameKey:
                 FirstName = obj.GetJSONContentAsString(key);
                 break;
             case LastNameKey:
                 LastName = obj.GetJSONContentAsString(key);
                 break;
             case FullNumberKey:
                 FullNumber = obj.GetJSONContentAsString(key);
                 break;
             case ExpirationMonthKey:
                 ExpirationMonth = obj.GetJSONContentAsInt(key);
                 break;
             case ExpirationYearKey:
                 ExpirationYear = obj.GetJSONContentAsInt(key);
                 break;
             case CvvKey:
                 _cvv = obj.GetJSONContentAsString(key);
                 break;
             case BillingAddressKey:
                 BillingAddress = obj.GetJSONContentAsString(key);
                 break;
             case BillingAddress2Key:
                 BillingAddress2 = obj.GetJSONContentAsString(key);
                 break;
             case BillingCityKey:
                 BillingCity = obj.GetJSONContentAsString(key);
                 break;
             case BillingCountryKey:
                 BillingCountry = obj.GetJSONContentAsString(key);
                 break;
             case BillingStateKey:
                 BillingState = obj.GetJSONContentAsString(key);
                 break;
             case BillingZipKey:
                 BillingZip = obj.GetJSONContentAsString(key);
                 break;
             case BankNameKey:
                 _bankName = obj.GetJSONContentAsString(key);
                 break;
             case BankRoutingNumberKey:
                 _bankRoutingNumber = obj.GetJSONContentAsString(key);
                 break;
             case BankAccountNumberKey:
                 _bankAccountNumber = obj.GetJSONContentAsString(key);
                 break;
             case BankAccountTypeKey:
                 _bankAccountType = obj.GetJSONContentAsEnum<BankAccountType>(key);
                 break;
             case BankAccountHolderTypeKey:
                 _bankAccountHolderType = obj.GetJSONContentAsEnum<BankAccountHolderType>(key);
                 break;
             case PaymentMethodNonceKey:
                 _paymentMethodNonce = obj.GetJSONContentAsString(key);
                 break;
             case PayPalEmailKey:
                 _payPalEmail = obj.GetJSONContentAsString(key);
                 break;
             case PaymentTypeKey:
                 _paymentType = obj.GetJSONContentAsEnum<PaymentProfileType>(key);
                 break;
             default:
                 break;
         }
     }
 }
예제 #44
0
 /// <summary>
 /// Creates an ECheck transaction request for use with the AIM gateway
 /// </summary>
 /// <param name="type">The Echeck Transaction type: ARC, BOC, CCD, PPD, TEL, WEB</param>
 /// <param name="amount"></param>
 /// <param name="bankABACode">The valid routing number of the customer’s bank</param>
 /// <param name="bankAccountNumber">The customer’s valid bank account number</param>
 /// <param name="acctType">CHECKING, BUSINESSCHECKING, SAVINGS</param>
 /// <param name="bankName">The name of the bank that holds the customer’s account</param>
 /// <param name="acctName">The name associated with the bank account</param>
 /// <param name="bankCheckNumber">The check number on the customer’s paper check</param>
 public EcheckAuthorizationRequest(EcheckType type, decimal amount, string bankABACode, string bankAccountNumber,
                                   BankAccountType acctType, string bankName, string acctName,
                                   string bankCheckNumber) :
                                       base(
                                       type, amount, bankABACode, bankAccountNumber, acctType, bankName, acctName,
                                       bankCheckNumber)
 {
     SetApiAction(RequestAction.Authorize);
 }
예제 #45
0
 /// <summary>
 /// Creates an ECheck transaction (defaulted to WEB) request for use with the AIM gateway
 /// </summary>
 /// <param name="authCode">The auth code.</param>
 /// <param name="amount"></param>
 /// <param name="bankABACode">The valid routing number of the customer’s bank</param>
 /// <param name="bankAccountNumber">The customer’s valid bank account number</param>
 /// <param name="acctType">CHECKING, BUSINESSCHECKING, SAVINGS</param>
 /// <param name="bankName">The name of the bank that holds the customer’s account</param>
 /// <param name="acctName">The name associated with the bank account</param>
 /// <param name="bankCheckNumber">The check number on the customer’s paper check</param>
 public EcheckCaptureRequest(string authCode, decimal amount, string bankABACode, string bankAccountNumber,
                             BankAccountType acctType, string bankName, string acctName,
                             string bankCheckNumber) :
                                 this(authCode,
                                      EcheckType.WEB, amount, bankABACode, bankAccountNumber, acctType, bankName,
                                      acctName,
                                      bankCheckNumber)
 {
 }
 /// <summary>
 /// Adds a eCheck bank account profile to the user and returns the profile ID
 /// </summary>
 /// <returns></returns>
 public string AddECheckBankAccount(string profileID, BankAccountType bankAccountType, string bankRoutingNumber, string bankAccountNumber, string personNameOnAccount)
 {
     return AddECheckBankAccount(profileID,
                                 new BankAccount()
                                     {
                                         accountTypeSpecified = true,
                                         accountType = bankAccountType,
                                         routingNumber = bankRoutingNumber,
                                         accountNumber = bankAccountNumber,
                                         nameOnAccount = personNameOnAccount
                                     }, null);
 }
예제 #47
0
 public BankAccount(BankAccountType type)
 {
     Type = type;
     BillingAddress = new Address();
 }
예제 #48
0
파일: Account.cs 프로젝트: jbob24/fp
        /// <summary>
        /// Initializes information specific to bank
        /// </summary>
        private void InitializeBank(XmlNode node)
        {
            BankID = node.GetValue("//BANKID");
            BranchID = node.GetValue("//BRANCHID");

            //Get Bank Account Type from XML
            string bankAccountType = node.GetValue("//ACCTTYPE");

            //Check that it has been set
            if (String.IsNullOrEmpty(bankAccountType))
                throw new OFXParseException("Bank Account type unknown");

            //Set bank account enum
            _BankAccountType = bankAccountType.GetBankAccountType();
        }
예제 #49
0
 public static BankAccount GetDetail(DefaultContext db, BankAccountType bankAccountType, CurrencyType currencyType)
 {
     BankAccount bankAccount = db.BankAccounts.FirstOrDefault(ba => ba.BankAccountType == bankAccountType && ba.CurrencyType == currencyType);
     return bankAccount;
 }
 /// <summary>
 /// set bank account type
 /// </summary>
 /// <param name="bankKey"></param>
 public void setBankAccType(BankAccountType bankAccType)
 {
     this.SetDirtyData();
     _bankAccType = bankAccType;
 }
예제 #51
0
 public Status<BankAccount> Create(string bankAccountUri, string name, string accountNumber,
     string routingNumber, BankAccountType type, Dictionary<string, string> meta = null)
 {
     Dictionary<string, string> parameters = new Dictionary<string, string>();
     parameters.Add("name", name);
     parameters.Add("account_number", accountNumber);
     parameters.Add("routing_number", routingNumber);
     parameters.Add("type", type.ToString().ToLower());
     if (meta != null)
         foreach (var key in meta.Keys)
             parameters.Add(string.Format("meta[{0}]", key), meta[key]);
     return this.rest.GetResult<BankAccount>(this.Service.BaseUrl + bankAccountUri, this.Service.Key, null, "post", parameters).AttachService(this.Service);
 }
예제 #52
0
        private static string GetApplicationAccessLongName(BankAccountType bankAccountType)
        {
            switch (bankAccountType)
            {
                case BankAccountType.ApplicationAccess:
                    return ListItemsResource.BankAccountType_ApplicationAccess_LongName;

                case BankAccountType.TeamMeeting:
                    return ListItemsResource.BankAccountType_TeamMeeting_LongName;

                case BankAccountType.LgsOrMspEveningOrWorkshopsOrLeaders:
                    return ListItemsResource.BankAccountType_LgsOrMspEveningOrWorkshopsOrLeaders_LongName;

                case BankAccountType.DavidKotasekTraining:
                    return ListItemsResource.BankAccountType_DavidKotasekTraining_LongName;

                case BankAccountType.Others:
                    return ListItemsResource.BankAccountType_Others_LongName;

                default:
                    throw new ArgumentOutOfRangeException();
            }
        }
예제 #53
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ACHPaymentInfo"/> class.
 /// </summary>
 public ACHPaymentInfo()
     : base()
 {
     AccountType = BankAccountType.Checking;
 }
예제 #54
0
 protected void PopulateBankAccountId(BankAccountType bankAccountType, int userId, object selectedBankAccountId = null)
 {
     BankAccount[] bankAccounts = BankAccountCache.GetIndex(Db, bankAccountType, userId);
     ViewBag.BankAccountId = new SelectList(bankAccounts, "BankAccountId", "Title", selectedBankAccountId);
 }
    public void RenderBankAccountOnFile(BankAccountType bankAccountType)
    {
        if (IsBankAccountOnFileValid(bankAccountType))
        {
            StringBuilder html = new StringBuilder();

            var bankAccountOnFile = BankAccountsOnFile.Where(b => b.AccountType == bankAccountType).FirstOrDefault();

            html.Append(@"
                <tr>
                    <td class='options'>
                        <a href=""" + Page.ClientScript.GetPostBackClientHyperlink(this, "UseBankAccount|" + bankAccountType.ToString()) + @""" class='btn btn-success Next'>
                        " + Resources.Shopping.UseThisCheckingAccount + @"</a>
                    </td>
                    <td class='description'>
                        <span class='producttitle'>
                            " + Resources.Shopping.CheckingAccountEndingIn + " " + bankAccountOnFile.AccountNumberDisplay.Replace("*", "") + @"</span>
                    </td>
                    <td class='nameoncard'>
                        " + bankAccountOnFile.BillingName + @"
                    </td>
                    <td class='expirationdate'>
                        ---
                    </td>
                </tr>
            ");


            HtmlTextWriter writer = new HtmlTextWriter(Response.Output);
            writer.Write(html.ToString());
        }
    }
    public bool IsBankAccountOnFileValid(BankAccountType bankAccountType)
    {
        var bankAccountOnFile = BankAccountsOnFile.Where(b => b.AccountType == bankAccountType).FirstOrDefault();

        if (bankAccountOnFile == null) return false;

        return (!string.IsNullOrEmpty(bankAccountOnFile.AccountNumberDisplay)
                && !string.IsNullOrEmpty(bankAccountOnFile.RoutingNumber)
                && !string.IsNullOrEmpty(bankAccountOnFile.BankName)
                && !string.IsNullOrEmpty(bankAccountOnFile.BillingName)
                && !string.IsNullOrEmpty(bankAccountOnFile.BillingAddress)
                && !string.IsNullOrEmpty(bankAccountOnFile.BillingCity)
                && !string.IsNullOrEmpty(bankAccountOnFile.BillingState)
                && !string.IsNullOrEmpty(bankAccountOnFile.BillingZip)
                && !string.IsNullOrEmpty(bankAccountOnFile.BillingCountry));
    }
예제 #57
0
        /// <summary>
        /// Process BankAccount
        /// </summary>
        /// <param name="businessId">BusinessId</param>
        /// <param name="bankAccount">BankAccount</param>
        /// <param name="bankAccountType">BankAccountType</param>
        /// <returns>true if processing of business account succeeds</returns>
        private bool ProcessBankAccount(long businessId, BankAccount bankAccount, BankAccountType bankAccountType)
        {
            if (bankAccount.Id == default(int))
            {
                var newMerchantAccountId = default(int);
                
                // write merchant bank account to table
                newMerchantAccountId = businessDao.CreateMerchantBankAccount(bankAccount);

                // determine business event code based on bank account type
                string businessEventCode = bankAccountType == BankAccountType.Merchant ? BusinessEventTypesEnum.MerchantBankAccountCreated.GetCode() :
                    bankAccountType == BankAccountType.Settlement ? BusinessEventTypesEnum.SettlementBankAccountCreated.GetCode() : string.Empty;

                // write business event to event table
                businessEventDao.Create(new BusinessEvent
                {
                    BusinessId = businessId,
                    EventType = new EnumEntity { Code = businessEventCode },
                    Reference = newMerchantAccountId.ToString()
                });

                bankAccount.Id = newMerchantAccountId;
                return newMerchantAccountId != default(int);
                
            }
            else
            {
                bool modifyAccountResult =  businessDao.ModifyBankAccount(bankAccount);

                // determine business event code based on bank account type
                string businessEventCode = bankAccountType == BankAccountType.Merchant ? BusinessEventTypesEnum.MerchantBankAccountModified.GetCode() :
                    bankAccountType == BankAccountType.Settlement ? BusinessEventTypesEnum.SettlementBankAccountModified.GetCode() : string.Empty;

                // write business event to event table
                businessEventDao.Create(new BusinessEvent
                {
                    BusinessId = businessId,
                    EventType = new EnumEntity { Code = businessEventCode },
                    Reference = bankAccount.Id.ToString()
                });

                return modifyAccountResult;
            }
        }
 /// <summary>
 /// Adds a bank account profile to the user and returns the profile ID
 /// </summary>
 /// <returns></returns>
 public string AddECheckBankAccount(string profileID, BankAccountType bankAccountType, string bankRoutingNumber,
                                    string bankAccountNumber,
                                    string personNameOnAccount, string bankName, EcheckType eCheckType,
                                    Address billToAddress)
 {
     return AddECheckBankAccount(profileID,
                                 new BankAccount()
                                     {
                                         accountTypeSpecified = true,
                                         accountType = bankAccountType,
                                         routingNumber = bankRoutingNumber,
                                         accountNumber = bankAccountNumber,
                                         nameOnAccount = personNameOnAccount,
                                         bankName = bankName,
                                         echeckTypeSpecified = true,
                                         echeckType = eCheckType
                                     }, billToAddress);
 }