Beispiel #1
0
        //make new eft
        public PaymentAccount makeneweft()
        {
            AccountTypes Acounttype = new AccountTypes();

            switch (cbPaymentType.SelectedIndex)
            {
            case 0:
                Acounttype = AccountTypes.Savings;
                break;

            case 1:
                Acounttype = AccountTypes.Cheque;
                break;

            case 2:
                Acounttype = AccountTypes.Credit;
                break;

            default:
                break;
            }
            PaymentAccount neweft = new PaymentAccount(txtEFTNum.Text, txtEFTHolder.Text, txtEFTReference.Text, Acounttype, "", user.RsaID);

            return(neweft);
        }
        public IHttpActionResult PostPaymentAccount(StripeBindingModel stripeBindingModel)
        {
            int     accountId = this.GetAccountId();
            Account account   = db.Accounts.Find(accountId);

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            // Use stripe to get the customer token
            string stripeCustomerToken = "";

            var myCustomer = new StripeCustomerCreateOptions();

            myCustomer.SourceToken = stripeBindingModel.CardToken;
            var customerService = new StripeCustomerService();
            var stripeCustomer  = customerService.Create(myCustomer);

            PaymentAccount paymentAccount = new PaymentAccount(PaymentMethod.Stripe, stripeCustomerToken);

            paymentAccount.AccountId = accountId;

            // updae the default payment account as the new account
            account.DefaultPaymentAccount = paymentAccount;
            db.SetModified(account);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = paymentAccount.Id }, paymentAccount));
        }
Beispiel #3
0
        public IEnumerable <PaymentAccount> Get(string userID, userType type)//gets all the accounts and its details for a specific User or beneficiary
        {
            if (type == userType.Client)
            {
                PaymentAccount pa = new PaymentAccount {
                    UserID = userID
                };
                Dictionary <Expression <Func <PaymentAccount, object> >, Func <PaymentAccount, object> > Filters = new Dictionary <Expression <Func <PaymentAccount, object> >, Func <PaymentAccount, object> >();
                Filters.Add(c => c.UserID, c => c.UserID);
                List <PaymentAccount> us = DatabaseHandler <PaymentAccount> .getDocumentContent(pa, Filters);

                return(us);
            }
            else
            {
                PaymentAccount pa = new PaymentAccount {
                    BeneficiaryID = userID
                };
                Dictionary <Expression <Func <PaymentAccount, object> >, Func <PaymentAccount, object> > Filters = new Dictionary <Expression <Func <PaymentAccount, object> >, Func <PaymentAccount, object> >();
                Filters.Add(c => c.BeneficiaryID, c => c.BeneficiaryID);
                List <PaymentAccount> us = DatabaseHandler <PaymentAccount> .getDocumentContent(pa, Filters);

                return(us);
            }
        }
Beispiel #4
0
        // Do the actual charging of a users account
        private bool ChargeAccount(int campaignId)
        {
            var            campaign       = db.Campaigns.Find(campaignId);
            int            totalPrice     = campaign.PriceOfCampaign;
            Currency       currency       = db.Currencies.Find(Currency.DefaultCurrency);
            PaymentAccount paymentAccount = campaign.Account.DefaultPaymentAccount;

            // Charge the account
            try
            {
                PaymentProcessor paymentProcessor = new PaymentProcessor();
                paymentProcessor.ChargePaymentAccount(paymentAccount, totalPrice, currency);
            }
            catch (Exception e)
            {
                return(false);
            }

            // Add a transaction record
            var paymentTransaction = new PaymentTransaction();

            paymentTransaction.Ammount        = totalPrice;
            paymentTransaction.CurrencyId     = currency.Id;
            paymentTransaction.Campaign       = campaign;
            paymentTransaction.PaymentAccount = paymentAccount;

            db.SaveChanges();

            return(true);
        }
        public PaymentAccount AddNewPaymentAccount(PaymentAccount paymentAccount)
        {
            IndicatorUtil Util = new IndicatorService();

            if (Util.BankIsEmpty(paymentAccount))
            {
                throw new BadRequestException("Banco deve estar preenchido");
            }

            if (Util.AgencyIsEmpty(paymentAccount))
            {
                throw new BadRequestException("Agência deve estar preenchida");
            }

            if (Util.AccountIsEmpty(paymentAccount))
            {
                throw new BadRequestException("Conta deve estar preenchida");
            }

            if (Util.ImageIsEmpty(paymentAccount))
            {
                throw new BadRequestException("Tire uma foto com documento");
            }

            try
            {
                _paymentAccountRepository.Create(paymentAccount);
                return(paymentAccount);
            }
            catch (Exception e)
            {
                throw new Exception($"Algo deu errado: {e}");
            }
        }
Beispiel #6
0
        // PUT api/<controller>/5
        public HttpResponseMessage Put([FromBody] PaymentAccount pay)
        {
            if (pay.BeneficiaryID != null && pay.UserID == null)
            {
                DBFilterClass <PaymentAccount> pa = new DBFilterClass <PaymentAccount> {
                    Field = c => c.BeneficiaryID, FieldValues = c => c.BeneficiaryID, condition = FilterCondition.equals
                };
                DatabaseHandler <PaymentAccount> .UpdateDocument(pay, pa);

                return(new HttpResponseMessage(HttpStatusCode.OK));
            }
            else if (pay.BeneficiaryID == null && pay.UserID != null)
            {
                DBFilterClass <PaymentAccount> pa = new DBFilterClass <PaymentAccount> {
                    Field = c => c.UserID, FieldValues = c => c.UserID, condition = FilterCondition.equals
                };
                DatabaseHandler <PaymentAccount> .UpdateDocument(pay, pa);

                return(new HttpResponseMessage(HttpStatusCode.OK));
            }
            else
            {
                return(new HttpResponseMessage(HttpStatusCode.InternalServerError));
            }
        }
        /// <summary>
        /// 支付通知
        /// </summary>
        /// <param name="thirdpayId"></param>
        /// <param name="paymentAccount"></param>
        /// <returns></returns>
        public async Task <bool> Notify(Guid thirdpayId, PaymentAccount paymentAccount, string trackingNumber, string notification)
        {
            var thirdpay = await dbContext.Thirdpay.FirstOrDefaultAsync(_ => _.Id == thirdpayId);

            if (thirdpay == null)
            {
                return(false);
            }

            thirdpay.TrackingNumber = trackingNumber;
            thirdpay.Notification   = notification;

            var payment = await dbContext.Payment.FirstOrDefaultAsync(_ => _.Id == thirdpay.PaymentId);

            payment.Account     = (int)paymentAccount;
            payment.Status      = (int)PaymentStatus.Paid;
            payment.Thirdpay_Id = thirdpay.Id;

            if (await dbContext.SaveAsync())
            {
                //发布支付消息
                rabbitMQService.Publish <PaymentPaidEvent>(new PaymentPaidEvent {
                    PaymentId = payment.Id, Identity_Id = payment.Identity_Id, Type = (PaymentType)payment.Type, Amount = payment.Amount
                }, "PaymentPaidEvent");
                return(true);
            }

            return(false);
        }
Beispiel #8
0
 /// <summary>
 /// Validate the object.
 /// </summary>
 /// <exception cref="ValidationException">
 /// Thrown if validation fails
 /// </exception>
 public virtual void Validate()
 {
     if (Booker == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "Booker");
     }
     if (Id == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "Id");
     }
     if (Booker != null)
     {
         Booker.Validate();
     }
     if (PaymentAccount != null)
     {
         PaymentAccount.Validate();
     }
     if (Reservations != null)
     {
         foreach (var element in Reservations)
         {
             if (element != null)
             {
                 element.Validate();
             }
         }
     }
 }
Beispiel #9
0
        private static void AddEmployee()
        {
            Console.WriteLine("First name: ");
            string firstName = Console.ReadLine();

            Console.WriteLine("Last Name: ");
            string lastName = Console.ReadLine();

            Console.WriteLine("Social security number: ");
            string socialSecurityNumber = Console.ReadLine();



            Console.WriteLine("Clearing nr.: ");
            string clearingNr = Console.ReadLine();

            Console.WriteLine("Account nr.: ");
            string accountNr = Console.ReadLine();

            Console.WriteLine("Bank: ");
            string bank = Console.ReadLine();

            PaymentAccount paymentAccount = new PaymentAccount(clearingNr, accountNr, bank);

            Employee employee = new Employee(firstName, lastName, socialSecurityNumber, paymentAccount);
        }
Beispiel #10
0
        public static request.Services.PaymentAccountUpdate sampleServicesPaymentAccountUpdate()
        {
            request.Services.PaymentAccountUpdate paymentAccountUpdateRequest = new request.Services.PaymentAccountUpdate();

            Credentials credentials = new Credentials();

            credentials.AcceptorID = "1147003";
            paymentAccountUpdateRequest.Credentials = credentials;

            Reports reports = new Reports();

            reports.ReportGroup = "1243";
            paymentAccountUpdateRequest.Reports = reports;

            Card card = new Card();

            card.CVV = "123";
            paymentAccountUpdateRequest.Card = card;

            Application application = new Application();

            application.ApplicationID = "1234";
            paymentAccountUpdateRequest.Application = application;

            PaymentAccount paymentAccount = new PaymentAccount();

            paymentAccount.PaymentAccountID            = "1112000188575454";
            paymentAccountUpdateRequest.PaymentAccount = paymentAccount;

            return(paymentAccountUpdateRequest);
        }
 public Employee(string firstName, string lastName, string socialSecurityNumber, PaymentAccount paymentAccount)
 {
     this.FirstName            = firstName;
     this.LastName             = lastName;
     this.SocialSecurityNumber = socialSecurityNumber;
     PaymentAccount            = paymentAccount;
 }
        private void dgvEFT_RowEnter(object sender, DataGridViewCellEventArgs e)
        {
            int index = e.RowIndex;

            EFTtemp = BenEFTListS[index];
            foreach (PaymentAccount item in BenEFTList)
            {
                if (EFTtemp == item)
                {
                    EFT = item;
                }
            }
            switch (EFT.TypeAcc)
            {
            case AccountTypes.Savings:
                cbEFTAccType.SelectedIndex = 0;
                break;

            case AccountTypes.Cheque:
                cbEFTAccType.SelectedIndex = 1;
                break;

            case AccountTypes.Credit:
                cbEFTAccType.SelectedIndex = 2;
                break;

            default:
                break;
            }
            txtAccHolder.Text    = EFT.AccountHolder;
            txtEFTAccNum.Text    = EFT.AccountNumber;
            txtEFTRefernce.Text  = EFT.Reference;
            btnUpdateEFT.Visible = true;
            btnDeletEFT.Visible  = true;
        }
Beispiel #13
0
        private void dgvEFT_RowEnter(object sender, DataGridViewCellEventArgs e)
        {
            int index = e.RowIndex;

            EFT                  = UserEFTList[index];
            txtEFTNum.Text       = EFT.AccountNumber;
            txtEFTReference.Text = EFT.Reference;
            txtEFTHolder.Text    = EFT.AccountHolder;
            switch (EFT.TypeAcc)
            {
            case AccountTypes.Savings:
                cbPaymentType.SelectedIndex = 0;
                break;

            case AccountTypes.Cheque:
                cbPaymentType.SelectedIndex = 1;
                break;

            case AccountTypes.Credit:
                cbPaymentType.SelectedIndex = 2;
                break;

            default:
                break;
            }
        }
Beispiel #14
0
        protected async Task ImportPaymentsIZettle()
        {
            using (var scope = ScopeFactory.CreateScope())
            {
                var db = scope.ServiceProvider.GetService <TandemBookingContext>();

                var purchases = await IZettleService.GetPayments(DateTime.Now.AddYears(-1), null);

                var payments = purchases.Purchases
                               .SelectMany(purchase => purchase.Payments
                                           .Select(payment => new
                {
                    Purchase = purchase,
                    Payment  = payment,
                })
                                           )
                               .ToList();

                var paymentAccounts = db.PaymentAccounts
                                      .Where(a => a.PaymentType == PaymentType.IZettle)
                                      .ToList();

                foreach (var x in payments)
                {
                    if (!db.Payments.Any(p => p.PaymentType == PaymentType.IZettle && p.ExternalRef == x.Payment.Uuid))
                    {
                        var paymentAccount = paymentAccounts.FirstOrDefault(a => a.PaymentType == PaymentType.IZettle && a.ExternalRef == x.Purchase.UserId.ToString());
                        if (paymentAccount == null)
                        {
                            paymentAccount = new PaymentAccount
                            {
                                Active      = true,
                                PaymentType = PaymentType.IZettle,
                                ExternalRef = x.Purchase.UserId.ToString(),
                                Name        = x.Purchase.UserDisplayName,
                            };
                            paymentAccounts.Add(paymentAccount);
                        }

                        var payment = new Payment
                        {
                            PaymentType        = PaymentType.IZettle,
                            ExternalRef        = x.Payment.Uuid,
                            Amount             = x.Payment.Amount / 100m,
                            UnreconciledAmount = x.Payment.Amount / 100m,
                            Fee            = 0m,
                            PaymentDate    = x.Purchase.Timestamp,
                            InsertDate     = DateTimeOffset.Now,
                            PaymentAccount = paymentAccount,
                        };
                        db.Add(payment);
                    }
                }

                await db.SaveChangesAsync();
            }

            await Load();
        }
Beispiel #15
0
        public void PayBill(DateTime date, decimal amount = 0)
        {
            decimal amountToPay = amount == 0 ? Amount : amount;

            PaymentAccount.NewDebitTransaction(new Transaction()
            {
                Description = Name, Date = date, Amount = amount
            });
            incrementNextBillDue();
        }
        public void MakePaymentAccountAndLookItUp()
        {
            Assert.That(_accountToken, Is.Not.Empty, "Please fill in the account token in the setup");

            var ptAcctNo = 1234;

            var address = new Address
            {
                BillingName    = "somebody guy",
                BillingZipcode = "33913"
            };

            var paymentAccount = new PaymentAccount
            {
                PaymentAccountReferenceNumber = $"EV{ptAcctNo}_{DateTime.UtcNow.ToString("yyyyMMddHHmmssffff")}"
            };

            var acctCreateResp = _proxy.PaymentAccountCreate(
                GetCreds(),
                GetApplication(),
                paymentAccount,
                new Card
            {
                CardNumber      = "4895281000000006",
                CVV             = "123",
                CardholderName  = "somebody guy",
                ExpirationMonth = "12",
                ExpirationYear  = "25"
            },
                new DemandDepositAccount {
            },
                address,
                new ExtendedParameters[] { }
                );

            Assert.That(acctCreateResp.ExpressResponseCode, Is.EqualTo("0"));
            Assert.That(acctCreateResp.ExpressResponseMessage, Is.EqualTo("PaymentAccount created"));

            var queryResp = _proxy.PaymentAccountQuery(
                GetCreds(),
                GetApplication(),
                new PaymentAccountParameters
            {
                PaymentAccountID =
                    acctCreateResp.PaymentAccount.PaymentAccountID
            },
                new ExtendedParameters[] { }
                );

            var queryData = XDocument.Parse(queryResp.QueryData);

            Assert.That(queryData.Descendants("BillingName").FirstOrDefault()?.Value, Is.EqualTo(address.BillingName));
            Assert.That(queryData.Descendants("PaymentAccountReferenceNumber").FirstOrDefault()?.Value, Is.EqualTo(paymentAccount.PaymentAccountReferenceNumber));
        }
Beispiel #17
0
        public async Task <IHttpActionResult> Patch([FromUri] Guid id, [FromUri] PaymentAccount paymentAccount)
        {
            var result = await PaymentBusiness.SelectAccount(UserID, id, paymentAccount);

            if (result.Success)
            {
                return(Ok(result.Data));
            }

            return(BadRequest(result.Message));
        }
Beispiel #18
0
        // GET api/<controller>/5

        // POST api/<controller>
        public HttpResponseMessage Post([FromBody] PaymentAccount pay)
        {
            try
            {
                DatabaseHandler <PaymentAccount> .insertData(pay);
            }
            catch (Exception)
            {
                return(new HttpResponseMessage(HttpStatusCode.InternalServerError));
            }
            return(new HttpResponseMessage(HttpStatusCode.OK));
        }
        public IHttpActionResult GetDefaultPaymentAccount()
        {
            int            accountId      = this.GetAccountId();
            PaymentAccount paymentAccount = db.Accounts.Where(a => a.Id == accountId).FirstOrDefault().DefaultPaymentAccount;

            if (paymentAccount == null || paymentAccount.IsDeleted == true)
            {
                return(NotFound());
            }

            return(Ok(paymentAccount));
        }
Beispiel #20
0
        public static request.Check.Sale sampleCheckSale()
        {
            request.Check.Sale saleRequest = new request.Check.Sale();

            Credentials credentials = new Credentials();

            credentials.AcceptorID  = "1147003";
            saleRequest.Credentials = credentials;

            Transaction transaction = new Transaction();

            transaction.ReferenceNumber   = "1";
            transaction.TransactionAmount = "100.10";
            transaction.OrderSource       = transaction.OrderSourceDict["ECOMMERCE"];
            saleRequest.Transaction       = transaction;

            Address address = new Address();

            address.BillingName     = "John Smith";
            address.BillingAddress1 = "1 Main St.";
            address.BillingCity     = "Burlington";
            address.BillingState    = "MA";
            address.BillingZipcode  = "01803-3747";
            address.BillingEmail    = "*****@*****.**";
            address.BillingPhone    = "978-551-0040";
            address.BillingCountry  = address.BillingCountryDict["USA"];
            saleRequest.Address     = address;

            DemandDepositAccount demandDepositAccount = new DemandDepositAccount();

            demandDepositAccount.RoutingNumber  = "123234345";
            demandDepositAccount.DDAAccountType = "Checking";
            demandDepositAccount.CheckNumber    = "456";
            saleRequest.DemandDepositAccount    = demandDepositAccount;

            PaymentAccount paymentAccount = new PaymentAccount();

            paymentAccount.PaymentAccountID = "1232343454565";
            saleRequest.PaymentAccount      = paymentAccount;

            Reports reports = new Reports();

            reports.ReportGroup = "1243";
            saleRequest.Reports = reports;

            Application application = new Application();

            application.ApplicationID = "1234";
            saleRequest.Application   = application;

            return(saleRequest);
        }
        public PaymentAccountDTO Insert(PaymentAccountDTO accountDTO)
        {
            PaymentAccount payment = new PaymentAccount
            {
                PaymentAccId = accountDTO.PaymentAccId,
                CardHolder   = accountDTO.CardHolder,
                CardNumber   = accountDTO.CardNumber,
            };

            DbConnection.iceCreamDb.PaymentAccounts.Add(payment);
            DbConnection.iceCreamDb.SaveChanges();
            return(accountDTO);
        }
        public IHttpActionResult GetPaymentAccount(int id)
        {
            int accountId = this.GetAccountId();

            PaymentAccount paymentAccount = db.PaymentAccount.Where(p => p.Id == id && p.AccountId == accountId).FirstOrDefault();

            if (paymentAccount == null || paymentAccount.IsDeleted == true)
            {
                return(NotFound());
            }

            return(Ok(paymentAccount));
        }
Beispiel #23
0
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PaymentAccount image = _repo.Get(id.Value);

            if (image == null)
            {
                return(HttpNotFound());
            }
            return(PartialView(image));
        }
        public bool ChargePaymentAccount(PaymentAccount paymentAccount, int ammount, Currency currency)
        {
            string currencyCode = currency.Code;

            switch (paymentAccount.PaymentMethodId)
            {
            // Use stripe.net to retrieve payment
            case PaymentMethod.Stripe:
                return(this.ChargeStripe(paymentAccount.StripeCustomerToken, ammount, currencyCode));

            default:
                return(false);
            }
        }
        public IHttpActionResult DeletePaymentAccount(int id)
        {
            PaymentAccount paymentAccount = db.PaymentAccount.Find(id);

            if (paymentAccount == null || paymentAccount.IsDeleted == true)
            {
                return(NotFound());
            }

            paymentAccount.IsDeleted = true;
            db.SetModified(paymentAccount);
            db.SaveChanges();

            return(Ok(paymentAccount));
        }
        public PaymentAccount UpdateBank(PaymentAccount paymentAccount)
        {
            if (paymentAccount.Account.Length < 1)
            {
                throw new BadRequestException("CONTA não pode ser em branco");
            }

            if (paymentAccount.Bank.Length < 1)
            {
                throw new BadRequestException("BANCO não pode ser em branco");
            }

            if (paymentAccount.Agency.Length < 1)
            {
                throw new BadRequestException("AGÊNCIA não pode ser em branco");
            }

            PaymentAccount newPaymentAccount = new PaymentAccount();

            try
            {
                newPaymentAccount = _paymentAccountRepository.GetByAccount(paymentAccount.Account);
            }
            catch (Exception e)
            {
                throw new Exception($"Algo deu errado, error: {e}");
            }

            if (newPaymentAccount == null)
            {
                throw new NotFoundException("Nenhuma conta encontrado");
            }

            newPaymentAccount.Agency  = paymentAccount.Agency;
            newPaymentAccount.Account = paymentAccount.Account;
            newPaymentAccount.Bank    = paymentAccount.Bank;

            try
            {
                _paymentAccountRepository.Update(newPaymentAccount);
            }
            catch (Exception e)
            {
                throw new Exception($"Algo deu errado, error: {e}");
            }

            return(newPaymentAccount);
        }
Beispiel #27
0
        public void PerformAutoPay(DateTime date)
        {
            if (AutoPay == false)
            {
                return;
            }

            while (NextBillDue <= date)
            {
                PaymentAccount.NewDebitTransaction(new Transaction()
                {
                    Description = Name, Date = NextBillDue, Amount = Amount
                });
                incrementNextBillDue();
            }
        }
Beispiel #28
0
        public IActionResult MakePayment(PaymentAccount paymentAccount)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var result = _service.MakePayment(paymentAccount);

            if (result == null)
            {
                return(BadRequest());
            }

            return(Ok(result));
        }
Beispiel #29
0
 public void Setup()
 {
     // mailMoq = new Mock<IMailService>();
     packingSlipBuilderMoq = new Mock <IPackingSlipBuilder>();
     productCatalogMoq     = new Mock <IProductCatalog>();
     membershipMoq         = new Mock <IMembershipService>();
     commissionMoq         = new Mock <ICommisionService>();
     paymentHandler        = new PaymentHandler(
         () => { return(packingSlipBuilderMoq.Object); },
         productCatalogMoq.Object,
         membershipMoq.Object,
         commissionMoq.Object);
     defaultPaymentAccout = new PaymentAccount()
     {
     };
 }
        private void btnAddEFT_Click(object sender, EventArgs e)
        {
            bool go = false;

            foreach (PaymentAccount item in BenEFTList)
            {
                if (txtEFTAccNum.Text.Trim() == item.AccountNumber)
                {
                    go = true;
                    break;
                }
            }
            if (go == false)
            {
                AccountTypes Acounttype = new AccountTypes();
                switch (cbEFTAccType.SelectedIndex)
                {
                case 0:
                    Acounttype = AccountTypes.Savings;
                    break;

                case 1:
                    Acounttype = AccountTypes.Cheque;
                    break;

                case 2:
                    Acounttype = AccountTypes.Credit;
                    break;

                default:
                    break;
                }
                EFT = new PaymentAccount(txtEFTAccNum.Text.Trim(), txtAccHolder.Text.Trim(), txtEFTRefernce.Text.Trim(), Acounttype, ben.BeneficairyID, "");

                PaymentsAccountController.AddBenPaymentAcount(EFT);
                BenEFTList.Add(EFT);
                FillEFTDatagrid(BenEFTList);
                txtEFTAccNum.Text          = "";
                txtAccHolder.Text          = "";
                txtEFTRefernce.Text        = "";
                cbEFTAccType.SelectedIndex = -1;
            }
            else
            {
                MetroMessageBox.Show(this, "Account Already Exists!", "Account Exists");
            }
        }
 /// <summary>
 /// Merges another account with this account
 /// </summary>
 /// <param name="other"></param>
 public void Merge(PaymentAccount other)
 {
     if (!String.IsNullOrEmpty(other.BankNumber))
         AddBank(other.BankNumber);
     if (!String.IsNullOrEmpty(other.GiroNumber))
         AddGiro(other.GiroNumber);
     if (other.Email == null)
         AddEmail(other.Email);
 }
            /// <summary>
            /// Creates a new account from email
            /// </summary>
            /// <param name="contents"></param>
            /// <returns></returns>
            public static PaymentAccount FromEmail(MailAddress contents)
            {
                PaymentAccount result = new PaymentAccount();
                result.AddEmail(contents);

                return result;
            }
            /// <summary>
            /// Creates a new account from a bank number
            /// </summary>
            /// <param name="contents"></param>
            /// <returns></returns>
            public static PaymentAccount FromBank(String contents)
            {
                PaymentAccount result = new PaymentAccount();
                result.AddBank(contents);

                return result;
            }
        private ExtendedParameters[] GetExtendedParameters(string token)
        {
            PaymentAccount pa = new PaymentAccount();
            ExtendedParameters[] arExt = new ExtendedParameters[1];
            ExtendedParameters ext = new ExtendedParameters();

            pa.PaymentAccountID = token;
            ext.Key = "PaymentAccount";
            ext.Value = pa;
            arExt[0] = ext;

            return arExt;
        }
        private void GetPaymentAccount(UserModel user)
        {
            paymentAccount = new PaymentAccount();

            // ##### TODO: Please change this to an actual account reference number attributed to the user #####
            string referenceId = GetSha1Hash(user.UserName + "{" + user.Email + "}");
            paymentAccount.PaymentAccountReferenceNumber = referenceId;
        }