Esempio n. 1
0
        /// <summary>
        /// Creates a one-time credit, most likely to a landlord, on a specific date.
        /// </summary>
        /// <param name="bank">The user's bank account.</param>
        /// <param name="amount">The amount to credit the user's account.</param>
        /// <param name="payDate">The date to process the transaction.</param>
        /// <returns>The result of the payment type. If it failed, the ErrorMessage property
        /// will explain what happened.</returns>
        public SinglePayeeCreditResult CreateSinglePayeeCredit(UserBank bank, decimal amount, DateTime payDate)
        {
            if(bank.PayeeAlias == null)
                throw new ArgumentNullException("Bank account alias is null.");

            var payType = bank.AccountType == "Checking" ?
                PayforwardPaymentType.Checking : PayforwardPaymentType.Savings;

            return manager.CreateSinglePayeeCredit(bank.PayeeAlias.Value, amount, payDate, payType);
        }
Esempio n. 2
0
 public UserBank CreateBankForUser(UserBank bank)
 {
     throw new NotImplementedException();
 }
Esempio n. 3
0
        /// <summary>
        /// Takes care of storing the user's bank account information.
        /// If it is a new card, it will create a new entry in the payment system
        /// and in our own storage. If it is just an update (e.g. the user changing their
        /// address information), it will act accordingly.
        /// </summary>
        /// <param name="bank">The user's bank account.</param>
        public void UpdateBankForUser(UserBank bank)
        {
            bank = manager.UpdateCustomerBank(bank);

            if(bank.UserBankId == 0)
                CreateBankForUser(bank);
            else
            {
                using(var context = new RentlerContext())
                {
                    var toUpdate = (from u in context.UserBanks
                                    where u.UserId == bank.UserId &&
                                    u.UserBankId == bank.UserBankId
                                    select u).SingleOrDefault();

                    if(toUpdate == null)
                        throw new ArgumentNullException();

                    toUpdate.AccountName = bank.AccountName;
                    toUpdate.AccountNumber = bank.AccountNumber;
                    toUpdate.AccountType = bank.AccountType;
                    toUpdate.PayerAlias = bank.PayerAlias;
                    toUpdate.PayeeAlias = bank.PayeeAlias;
                    toUpdate.RoutingNumber = bank.RoutingNumber;
                    toUpdate.Address1 = bank.Address1;
                    toUpdate.Address2 = bank.Address2;
                    toUpdate.City = bank.City;
                    toUpdate.Email = bank.Email;
                    toUpdate.FirstName = bank.FirstName;
                    toUpdate.LastName = bank.LastName;
                    toUpdate.Phone = bank.Phone;
                    toUpdate.State = bank.State;
                    toUpdate.Zip = bank.Zip;
                    toUpdate.IsDeleted = bank.IsDeleted;

                    context.SaveChanges();
                }
            }
        }
Esempio n. 4
0
        public void DeleteUserBank(UserBank bank)
        {
            bank.IsDeleted = true;

            manager.UpdateCustomerBank(bank);
            UpdateBankForUser(bank);
        }
Esempio n. 5
0
        /// <summary>
        /// Creates a one-time payment, to be processed on a specific date.
        /// Use this method for move in/out stuff like security deposits, pro-rated rent, etc.
        /// </summary>
        /// <param name="bank">The user's bank account.</param>
        /// <param name="amount">The amount to charge the user.</param>
        /// <param name="payDate">The date to process the transaction.</param>
        /// <returns>The result of the payment type. If it failed, the ErrorMessage property
        /// will explain what happened.</returns>
        public SinglePaymentResult CreateSinglePayment(UserBank bank, decimal amount, DateTime payDate)
        {
            if(bank.PayerAlias == null)
                throw new ArgumentNullException("Bank account alias is null.");

            return manager.CreateSinglePayment(bank.PayerAlias.Value, amount, payDate, PaymentType.ACH);
        }
Esempio n. 6
0
 /// <summary>
 /// Create a new UserBank object.
 /// </summary>
 /// <param name="userBankId">Initial value of the UserBankId property.</param>
 /// <param name="userId">Initial value of the UserId property.</param>
 /// <param name="accountName">Initial value of the AccountName property.</param>
 /// <param name="routingNumber">Initial value of the RoutingNumber property.</param>
 /// <param name="accountNumber">Initial value of the AccountNumber property.</param>
 /// <param name="accountType">Initial value of the AccountType property.</param>
 /// <param name="firstName">Initial value of the FirstName property.</param>
 /// <param name="lastName">Initial value of the LastName property.</param>
 /// <param name="address1">Initial value of the Address1 property.</param>
 /// <param name="city">Initial value of the City property.</param>
 /// <param name="state">Initial value of the State property.</param>
 /// <param name="zip">Initial value of the Zip property.</param>
 /// <param name="isDeleted">Initial value of the IsDeleted property.</param>
 /// <param name="updateDate">Initial value of the UpdateDate property.</param>
 /// <param name="createDate">Initial value of the CreateDate property.</param>
 /// <param name="createdBy">Initial value of the CreatedBy property.</param>
 public static UserBank CreateUserBank(global::System.Int32 userBankId, global::System.Int32 userId, global::System.String accountName, global::System.String routingNumber, global::System.String accountNumber, global::System.String accountType, global::System.String firstName, global::System.String lastName, global::System.String address1, global::System.String city, global::System.String state, global::System.String zip, global::System.Boolean isDeleted, global::System.DateTime updateDate, global::System.DateTime createDate, global::System.String createdBy)
 {
     UserBank userBank = new UserBank();
     userBank.UserBankId = userBankId;
     userBank.UserId = userId;
     userBank.AccountName = accountName;
     userBank.RoutingNumber = routingNumber;
     userBank.AccountNumber = accountNumber;
     userBank.AccountType = accountType;
     userBank.FirstName = firstName;
     userBank.LastName = lastName;
     userBank.Address1 = address1;
     userBank.City = city;
     userBank.State = state;
     userBank.Zip = zip;
     userBank.IsDeleted = isDeleted;
     userBank.UpdateDate = updateDate;
     userBank.CreateDate = createDate;
     userBank.CreatedBy = createdBy;
     return userBank;
 }
Esempio n. 7
0
 /// <summary>
 /// Deprecated Method for adding a new object to the UserBanks EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToUserBanks(UserBank userBank)
 {
     base.AddObject("UserBanks", userBank);
 }