public BraintreeGateway GetGateway() { var merchantId = _systemServices.GetSetting("BraintreeMerchantId"); var publicKey = _systemServices.GetSetting("BraintreePublicKey"); var privateKey = _systemServices.GetSetting("BraintreePrivateKey"); var isProduction = _systemServices.GetSetting("BraintreeIsProduction"); Gateway = new BraintreeGateway() { Environment = isProduction.Value.ToLower().Equals("true") ? Braintree.Environment.PRODUCTION : Braintree.Environment.SANDBOX, MerchantId = merchantId.Value, PublicKey = publicKey.Value, PrivateKey = privateKey.Value }; return(Gateway); }
//[ValidateRecaptcha] public IActionResult Index() { var model = new DonationViewModel(); var states = _context.States.ToList(); model.BrainTreePayment.States = (states.Select(i => new SelectListItem { Text = i.Text, Value = i.Id.ToString() })).AsEnumerable(); #region Payment // Values needed for submitting a payment to BrainTree var token = _paymentService.GetClientToken(string.Empty); ViewData.Add("clientToken", token); ViewData.Add("merchantId", _systemServices.GetSetting("BraintreeMerchantId").Value); ViewData.Add("environment", _systemServices.GetSetting("BraintreeIsProduction").Value); #endregion return(View(model)); }
public IActionResult Register() { var model = new Register(); var states = _context.States.ToList(); model.Attendee1AddressStateList = new List <SelectListItem>(); model.Attendee1AddressStateList = (states.Select(i => new SelectListItem { Text = i.Text, Value = i.Id.ToString() })).AsEnumerable(); model.Attendee2AddressStateList = (states.Select(i => new SelectListItem { Text = i.Text, Value = i.Id.ToString() })).AsEnumerable(); model.Attendee3AddressStateList = (states.Select(i => new SelectListItem { Text = i.Text, Value = i.Id.ToString() })).AsEnumerable(); model.Attendee4AddressStateList = (states.Select(i => new SelectListItem { Text = i.Text, Value = i.Id.ToString() })).AsEnumerable(); model.BrainTreePayment.States = (states.Select(i => new SelectListItem { Text = i.Text, Value = i.Id.ToString() })).AsEnumerable(); #region Payment // Values needed for submitting a payment to BrainTree var token = _paymentService.GetClientToken(string.Empty); ViewData.Add("clientToken", token); ViewData.Add("merchantId", _systemServices.GetSetting("BraintreeMerchantId").Value); ViewData.Add("environment", _systemServices.GetSetting("BraintreeIsProduction").Value); model.GolfTicketCost = decimal.Parse(_systemServices.GetSetting("GolfTicketCost").Value); model.BanquetTicketCost = decimal.Parse(_systemServices.GetSetting("GolfBanquetTicketCost").Value); #endregion return(View(model)); }
public IActionResult Apply() { _logger.LogInformation("Start Apply Get"); var model = new ApplyToAdoptViewModel(); model.AppAddressStateList = new List <SelectListItem>(); var states = _context.States.ToList(); model.AppAddressStateList = (states.Select(i => new SelectListItem { Text = i.Text, Value = i.Id.ToString() })).AsEnumerable(); model.BrainTreePayment.States = (states.Select(i => new SelectListItem { Text = i.Text, Value = i.Id.ToString() })).AsEnumerable(); model.ResidenceOwnershipList = new List <SelectListItem>(); var ownershipTypes = _context.ApplicationResidenceOwnershipType.ToList(); foreach (var item in ownershipTypes.Where(w => w.Code == "0")) { item.Code = string.Empty; } model.ResidenceOwnershipList = (ownershipTypes.Select(i => new SelectListItem { Text = i.Text, Value = i.Code })).AsEnumerable(); model.ResidencePetDepositCoverageList = new List <SelectListItem>(); var coverageTypes = _context.ApplicationResidencePetDepositCoverageType.ToList(); foreach (var item in coverageTypes.Where(w => w.Code == "0")) { item.Code = string.Empty; } model.ResidencePetDepositCoverageList = (coverageTypes.Select(i => new SelectListItem { Text = i.Text, Value = i.Code })).AsEnumerable(); model.ResidenceTypeList = new List <SelectListItem>(); var residenceTypes = _context.ApplicationResidenceType.ToList(); foreach (var item in residenceTypes.Where(w => w.Code == "0")) { item.Code = string.Empty; } model.ResidenceTypeList = (residenceTypes.Select(i => new SelectListItem { Text = i.Text, Value = i.Code })).AsEnumerable(); model.StudentTypeList = new List <SelectListItem>(); var studentTypes = _context.ApplicationStudentType.ToList(); foreach (var item in studentTypes.Where(w => w.Code == "0")) { item.Code = string.Empty; } model.StudentTypeList = (studentTypes.Select(i => new SelectListItem { Text = i.Text, Value = i.Code })).AsEnumerable(); model.AppDateBirth = DateTime.Now.AddYears(-21); #region Payment // Values needed for submitting a payment to BrainTree var token = _paymentService.GetClientToken(string.Empty); ViewData.Add("clientToken", token); ViewData.Add("merchantId", _systemServices.GetSetting("BraintreeMerchantId").Value); ViewData.Add("environment", _systemServices.GetSetting("BraintreeIsProduction").Value); model.ApplicationFeeAmount = decimal.Parse(_systemServices.GetSetting("AdoptionApplicationFee").Value); #endregion _logger.LogInformation("End Apply Get: {@model}", model); return(View(model)); }