public ActionResult CardPaymentConfirmation() { if (TempData["orderId"] == null || TempData["cardNumber"] == null || TempData["price"] == null || TempData["currency"] == null || TempData["date"] == null || TempData["acquirer"] == null) { return(RedirectToAction("Index", "Home")); } int orderId = (int)TempData["orderId"]; string cardNumber = TempData["cardNumber"].ToString(); decimal price = (decimal)TempData["price"]; string currency = TempData["currency"].ToString(); DateTime date = DateTime.Parse(TempData["date"].ToString()); Acquirer acquirer = (Acquirer)TempData["acquirer"]; ViewBag.orderId = orderId; ViewBag.cardNumber = cardNumber; ViewBag.price = price; ViewBag.currency = currency; ViewBag.date = date; ViewBag.acquirer = acquirer; TempData["orderId"] = orderId; TempData["cardNumber"] = cardNumber; TempData["price"] = price; TempData["currency"] = currency; TempData["date"] = date; TempData["acquirer"] = acquirer; return(View("Payment")); }
public static void SeedAsync(ApplicationDbContext context) { if (!context.Banks.Any()) { var acquirer = new Acquirer() { Name = "Giga Pizza", URL = "https://localhost:44395/", ApiKey = "ad777c2b-d332-4107-838a-b37738fa8e1f" }; context.Acquirers.Add(acquirer); context.SaveChanges(); var bank = new Bank() { Name = "Bank", URL = "https://localhost:44377/", Path = "paymentCards/cardSecured", ApiKey = "06b9e986-9609-4892-933f-9ced84f3e1c8" }; context.Banks.Add(bank); context.SaveChanges(); } }
public Acquirer Add(Acquirer t) { var maxId = applicationCache.Acquirers.Max(a => a.Id); t.Id = maxId + 1; applicationCache.Acquirers.Add(t); return(t); }
public async Task <ActionResult> DeleteConfirmed(int id) { Acquirer acquirer = await db.Acquirers.FindAsync(id); db.Acquirers.Remove(acquirer); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
private Brand GetBrand(Acquirer acquirer, string bandeira) { var mdr = acquirer.DiscountRates.FirstOrDefault(m => m.Brand.Name.ToLower() == bandeira); if (mdr == null) { throw new ArgumentNullException(nameof(bandeira), "Bandeira inválida"); } return(mdr.Brand); }
public async Task <ActionResult> Edit([Bind(Include = "ID,Name,URL,OrderDetailsPath,UpdateOrderStatusPath,OrderSummaryPath,Description")] Acquirer acquirer) { if (ModelState.IsValid) { db.Entry(acquirer).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(acquirer)); }
public IAcquirerService CreateService(Acquirer acquirer) { switch (acquirer) { case Acquirer.Cielo: return(CieloService); case Acquirer.Stone: return(StoneService); default: throw new ArgumentException("Requested provider not yet implemented."); } }
public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Acquirer acquirer = await db.Acquirers.FindAsync(id); if (acquirer == null) { return(HttpNotFound()); } return(View(acquirer)); }
public async Task <GetAcquirerOperationOperationResponse> ProcessAsync(GetAcquirerOperationRequest request) { Acquirer acquirer = request.ForceRetrievingFromDatabase ? await this._acquirerRepository.GetByIdAsync(request.Id) : await this.GetAndStoreAcquirerInCacheAsync(request.Id); return(new GetAcquirerOperationOperationResponse { Data = new AcquirerResponseData { Id = acquirer.Id, Name = acquirer.Name } }); }
public Acquirer GetAcquirerInfo(int acquirerId) { AcquirerTable acquirerTable = db.AcquirerTables.SingleOrDefault(c => c.Id == acquirerId); Acquirer acquirer = new Acquirer() { Address = acquirerTable.Address, BinName = acquirerTable.BinName, City = acquirerTable.City, Latitude = acquirerTable.Latitude, Longitude = acquirerTable.Longitude, UserName = acquirerTable.UserName, Phone = acquirerTable.Phone }; return(acquirer); }
void Awake() { // Setup Dependancies animator = GetComponent<Animation>(); audioSource = GetComponent<AudioSource>(); locomotor = GetComponent<Locomotor>(); acquirer = GetComponent<Acquirer>(); stats = GetComponent<Stats>(); // Setup Components if (animationClip != null) { animationClip.wrapMode = WrapMode.Loop; animator.clip = animationClip; animator.Play(); } rigidbody.freezeRotation = true; //rigidbody.useGravity = false; Hungry = true; }
override public void Form_Load(object sender, EventArgs e) { m_Acq = new Acquirer(); m_Acq.Open(oscillo, graphControl.GetConsumer()); SetToolbar(new DigitalArduinoToolStrip(oscillo, graphControl)); commonToolStrip = new CommonToolStrip(this, m_Acq, graphControl, oscillo); float[] divs = { 1.0f, 0.5f, 0.2f, 0.1f, 0.05f, 0.02f, 0.01f, 0.005f, 0.002f, 0.001f, 0.0002f, 0.0005f }; foreach (float t in divs) { commonToolStrip.time.Items.Add(t); } commonToolStrip.time.SelectedIndex = 10; SetToolbar(commonToolStrip); gd.SetVerticalRange(0, 255, (float)(255.0 / 6.5), "Volts"); graphControl.SetRenderer(gd); }
override public void Form_Load(object sender, EventArgs e) { m_Acq = new Acquirer(); m_Acq.Open(oscillo, GetFirstConsumerInChain()); gf.drawSlidingFFT = true; commonToolStrip = new CommonToolStrip(this, m_Acq, graphControl, oscillo); foreach (float t in divs) { commonToolStrip.time.Items.Add(t); } commonToolStrip.selectedIndexChanged += this.time_SelectedIndexChanged; commonToolStrip.time.SelectedIndex = 10; SetToolbar(GetFilteringToolStrip()); SetToolbar(GetFftToolStrip()); SetToolbar(new ParallaxToolStrip(oscillo, graphControl)); SetToolbar(commonToolStrip); ga.SetVerticalRange(0, 255, 32, "Volts"); }
override public void Form_Load(object sender, EventArgs e) { m_Acq = new Acquirer(); m_Acq.Open(oscillo, GetFirstConsumerInChain()); gf.drawSlidingFFT = true; commonToolStrip = new CommonToolStrip(this, m_Acq, graphControl, oscillo); float[] divs = { 1.0f, 0.5f, 0.2f, 0.1f, 0.05f, 0.02f, 0.01f, 0.005f, 0.002f, 0.001f, 0.0002f, 0.0005f }; foreach (float t in divs) { commonToolStrip.time.Items.Add(t); } commonToolStrip.time.SelectedIndex = 10; AnalogArduinoToolbar aat = new AnalogArduinoToolbar(oscillo, graphControl); SetToolbar(GetFilteringToolStrip()); SetToolbar(GetFftToolStrip()); SetToolbar(aat); SetToolbar(commonToolStrip); ga.SetVerticalRange(255, 0, 32, "Volts"); }
public List <Acquirer> GetAcquirer(int userId) { List <Acquirer> list_Acquirer = new List <Acquirer>(); UserTable user = db.UserTables.SingleOrDefault(c => c.Id == userId); foreach (AcquirerTable item in db.AcquirerTables) { if (item.City == user.City) { Acquirer acquirer = new Acquirer() { Address = item.Address, BinName = item.BinName, Latitude = item.Latitude, Longitude = item.Longitude, Phone = item.Phone, UserName = item.UserName, AcquirerId = item.Id }; list_Acquirer.Add(acquirer); } } return(list_Acquirer); }
void OnFixationDrop(Acquirer acquirer) { highlighter.SwitchOff(); }
/** * Gets the Acquirer and Launcher. */ private void Awake() { acquirer = GetComponent<Acquirer>(); launcher = GetComponentInChildren<Launcher>(); }
/** * Returns the acquirable's distance from the given acquirer. */ public float DistanceFrom(Acquirer acquirer) { return (acquirer.transform.position - transform.position).magnitude; }
public string Register(Acquirer acquirer) { throw new NotImplementedException(); }
void Start() { SetupJoysticks(); locomotor = GetComponent<Locomotor> (); acquirer = GetComponent<Acquirer> (); thrower = GetComponent<InventoryThrower> (); Screen.showCursor = false; }
private DataContracts.LocalDb.Transaction StonePayment(PaymentRequest pPaymentRequest, Acquirer pAcquirer) { //Create transaction. var transaction = new CreditCardTransaction() { AmountInCents = 10000, CreditCard = new CreditCard() { CreditCardBrand = CreditCardBrandEnum.Mastercard, CreditCardNumber = pPaymentRequest.CreditCardNumber, ExpMonth = Convert.ToInt32(pPaymentRequest.ExpMonth), ExpYear = Convert.ToInt32(pPaymentRequest.ExpYear), HolderName = pPaymentRequest.HolderName, SecurityCode = pPaymentRequest.SecurityCode }, InstallmentCount = 1, Options = new CreditCardTransactionOptions { PaymentMethodCode = 1 } }; //Create request. var createSaleRequest = new CreateSaleRequest() { // Adiciona a transação na requisição. CreditCardTransactionCollection = new Collection <CreditCardTransaction>(new CreditCardTransaction[] { transaction }), Order = new StonePaymentGateway.DataContracts.Order() { OrderReference = "Simulador" } }; Guid merchantKey = Guid.Parse(pAcquirer.MerchanteKey); var serviceClient = new GatewayServiceClient(merchantKey, new Uri("https://transaction.stone.com.br")); var httpResponse = serviceClient.Sale.Create(createSaleRequest); var result = httpResponse.Response.CreditCardTransactionResultCollection.FirstOrDefault(); var transactionDb = new DataContracts.LocalDb.Transaction(); transactionDb.Authorization = result.AuthorizationCode; transactionDb.AuthAmountInCents = result.AuthorizedAmountInCents.ToString(); transactionDb.CardExpiration = pPaymentRequest.ExpYear + pPaymentRequest.ExpMonth; transactionDb.CardNumber = pPaymentRequest.CreditCardNumber; transactionDb.Date = (DateTime)result.CapturedDate; transactionDb.MerchanteKey = pAcquirer.MerchanteKey; transactionDb.Message = result.AcquirerMessage; transactionDb.CardName = pPaymentRequest.HolderName; transactionDb.CardSecurityCode = pPaymentRequest.SecurityCode; return(transactionDb); }
private DataContracts.LocalDb.Transaction CieloPayment(PaymentRequest pPaymentRequest, Acquirer pAcquirer) { ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; var cielo = new Cielo("1006993069", pAcquirer.MerchanteKey, Cielo.TEST); var holder = cielo.holder(pPaymentRequest.CreditCardNumber, pPaymentRequest.ExpYear, pPaymentRequest.ExpMonth, pPaymentRequest.SecurityCode); holder.name = "Fulano Portador da Silva"; var randomOrder = new Random(); var order = cielo.order(randomOrder.Next(1000, 10000).ToString(), 10000); var paymentMethod = cielo.paymentMethod(PaymentMethod.VISA, PaymentMethod.CREDITO_A_VISTA); var transaction = cielo.transactionRequest( holder, order, paymentMethod, "http://localhost/cielo", CieloEcommerce.Transaction.AuthorizationMethod.AUTHORIZE_WITHOUT_AUTHENTICATION, false ); var transactionDb = new DataContracts.LocalDb.Transaction(); transactionDb.Authorization = transaction.authorization.code.ToString(); transactionDb.AuthAmountInCents = transaction.order.total.ToString(); transactionDb.CardExpiration = pPaymentRequest.ExpYear + pPaymentRequest.ExpMonth; transactionDb.CardNumber = pPaymentRequest.CreditCardNumber; transactionDb.Date = Convert.ToDateTime(transaction.authorization.dateTime); transactionDb.MerchanteKey = pAcquirer.MerchanteKey; transactionDb.Message = transaction.authentication.message; transactionDb.CardName = pPaymentRequest.HolderName; transactionDb.CardSecurityCode = pPaymentRequest.SecurityCode; return(transactionDb); }
/** * Highlights the acquirable when an acquirer is fixated on it. */ void OnFixation(Acquirer acquirer) { highlighter.SwitchOn(); }
public void Remove(Acquirer t) { applicationCache.Acquirers.Remove(t); }
public ActionResult Status(bool status) { if (TempData["orderId"] == null || TempData["cardNumber"] == null || TempData["price"] == null || TempData["currency"] == null || TempData["date"] == null || TempData["acquirer"] == null) { return(RedirectToAction("Index", "Home")); } int orderId = (int)TempData["orderId"]; string cardNumber = TempData["cardNumber"].ToString(); decimal price = (decimal)TempData["price"]; string currency = TempData["currency"].ToString(); DateTime date = DateTime.Parse(TempData["date"].ToString()); Acquirer acquirer = (Acquirer)TempData["acquirer"]; TempData.Remove("orderId"); TempData.Remove("cardNumber"); TempData.Remove("price"); TempData.Remove("currency"); TempData.Remove("date"); TempData.Remove("acquirer"); if (status) { var bankAccount = db.PaymentCards .Include(p => p.BankAccount) .Single(b => b.PaymentCardNumber == cardNumber).BankAccount; var currencyTo = db.Currencies.SingleOrDefault(c => c.Code == currency); if (currencyTo != null) { var commision = bankAccount.BankAccountType.Commission / 100; decimal value; if (bankAccount.Currency.Code == currencyTo.Code) { value = price + (price * commision); } else { var exchangedCurrency = CurrenciesController.ExchangeCurrencyBid(bankAccount.Currency.Code, currencyTo.Code, price); value = exchangedCurrency + (exchangedCurrency * commision); } if (bankAccount.AvailableFounds >= value) { bankAccount.AvailableFounds -= value; bankAccount.Balance -= value; Transaction transaction = new Transaction { ValueTo = value, BalanceAfterTransactionUserTo = bankAccount.Balance, FromBankAccountNumber = bankAccount.BankAccountNumber, ToBankAccountNumber = acquirer.BankAccountNumebr, ReceiverName = acquirer.Name, Description = "Płatność kartą", CurrencyTo = bankAccount.Currency, TransactionTypeID = db.TransactionTypes.Single(t => t.Type == "CARD_PAYMENT").ID, Date = DateTime.Now }; db.Transactions.Add(transaction); db.SaveChanges(); } else { status = false; } } else { status = false; } } client.PostAsJsonAsync(acquirer.URL + acquirer.UpdateOrderStatusPath, new { id = orderId, status = status, apiKey = acquirer.ApiKey }); AuthenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie); return(Redirect(acquirer.URL + acquirer.OrderSummaryPath + orderId)); }
public CommonToolStrip(VizForm vf, Acquirer acq, GraphControl gc, Oscillo os) { vizForm = vf; m_acquirer = acq; graphControl = gc; m_Oscillo = os; this.timeLabel = new System.Windows.Forms.ToolStripLabel(); this.clone = new System.Windows.Forms.ToolStripButton(); this.play = new System.Windows.Forms.ToolStripButton(); this.time = new System.Windows.Forms.ToolStripComboBox(); this.toolStrip.Dock = System.Windows.Forms.DockStyle.None; this.toolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.timeLabel, this.time, this.clone, this.play}); this.toolStrip.Location = new System.Drawing.Point(0, 0); this.toolStrip.Name = "toolStrip2"; this.toolStrip.Size = new System.Drawing.Size(497, 25); this.toolStrip.TabIndex = 1; this.toolStrip.Text = "toolStrip2"; // // time // this.time.Name = "time"; this.time.Size = new System.Drawing.Size(50, 25); this.time.SelectedIndexChanged += new System.EventHandler(this.time_SelectedIndexChanged); // // clone // this.clone.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; this.clone.Image = null;// ((System.Drawing.Image)(resources.GetObject("clone.Image"))); this.clone.ImageTransparentColor = System.Drawing.Color.Magenta; this.clone.Name = "clone"; this.clone.Size = new System.Drawing.Size(42, 22); this.clone.Text = "Clone"; this.clone.Click += new System.EventHandler(this.clone_Click); // // play // if (m_acquirer != null) { this.play.CheckOnClick = true; this.play.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.play.Image = global::XOscillo.Properties.Resources.play; this.play.ImageTransparentColor = System.Drawing.Color.Magenta; this.play.Margin = new System.Windows.Forms.Padding(1); this.play.Name = "play"; this.play.Size = new System.Drawing.Size(23, 23); this.play.Text = "toolStripButton2"; this.play.CheckedChanged += new System.EventHandler(this.play_CheckedChanged); this.play.Checked = true; } this.toolStrip.Items.Add(new System.Windows.Forms.ToolStripSeparator()); // // Channels // if (m_Oscillo != null) { for (int i = 0; i < m_Oscillo.GetNumberOfSupportedChannels(); i++) { CheckBox cb = new CheckBox(); cb.Text = "Ch" + i; cb.Tag = i; cb.Appearance = Appearance.Button; cb.CheckStateChanged += ((s, ex) => { m_Oscillo.SetChannel((int)cb.Tag, cb.CheckState == CheckState.Checked); SetAcquirerStatus(); // since the above doesnt fire a CheckStateChanged }); ToolStripControlHost host = new ToolStripControlHost(cb); if (i == 0) { cb.Checked = true; } this.toolStrip.Items.Add(host); } } }
protected override void Seed(BankContext context) { var roleManager = new RoleManager <IdentityRole>( new RoleStore <IdentityRole>(new ApplicationDbContext())); var userManager = new UserManager <ApplicationUser>( new UserStore <ApplicationUser>(new ApplicationDbContext())); roleManager.Create(new IdentityRole("Admin")); roleManager.Create(new IdentityRole("User")); roleManager.Create(new IdentityRole("Worker")); var user = new ApplicationUser { UserName = "******" }; string password = "******"; userManager.Create(user, password); userManager.AddToRole(user.Id, "User"); var user2 = new ApplicationUser { UserName = "******" }; string password2 = "Password.2"; userManager.Create(user2, password2); userManager.AddToRole(user2.Id, "User"); var user3 = new ApplicationUser { UserName = "******" }; string password3 = "Admin.1"; userManager.Create(user3, password3); userManager.AddToRole(user3.Id, "Admin"); var worker = new ApplicationUser { UserName = "******" }; string workerpass = "******"; userManager.Create(worker, workerpass); userManager.AddToRole(worker.Id, "Worker"); var currencies = new List <Currency> { new Currency { Name = "złoty", Code = "PLN", EffectiveDate = DateTime.Now, Bid = 1.0000m, Ask = 1.0000m }, new Currency { Name = "euro", Code = "EUR", EffectiveDate = DateTime.Now, Bid = 4.4601m, Ask = 4.5503m }, new Currency { Name = "dolar amerykański", Code = "USD", EffectiveDate = DateTime.Now, Bid = 3.6382m, Ask = 3.7118m }, new Currency { Name = "frank szwajcarski", Code = "CHF", EffectiveDate = DateTime.Now, Bid = 4.1106m, Ask = 4.1936m }, new Currency { Name = "funt szterling", Code = "GBP", EffectiveDate = DateTime.Now, Bid = 4.9354m, Ask = 5.0352m }, }; currencies.ForEach(c => context.Currencies.Add(c)); context.SaveChanges(); RefreshCurrency.RefreshCurrenciesAsync().ConfigureAwait(false); var transactionTypes = new List <TransactionType> { new TransactionType { Type = "TRANSFER" }, new TransactionType { Type = "CARD_PAYMENT" }, new TransactionType { Type = "CASH_WITHDRAWAL" }, new TransactionType { Type = "CASH_DEPOSIT" }, new TransactionType { Type = "CURR_EXCHANGE" }, new TransactionType { Type = "CREDIT_TRANSFER" }, }; transactionTypes.ForEach(t => context.TransactionTypes.Add(t)); context.SaveChanges(); var bankAccountTypes = new List <BankAccountType> { new BankAccountType { Type = "PAY_ACC_FOR_YOUNG", Commission = 0m }, new BankAccountType { Type = "PAY_ACC_FOR_ADULT", Commission = 5m }, new BankAccountType { Type = "FOR_CUR_ACC", Commission = 7m } }; bankAccountTypes.ForEach(b => context.BankAccountTypes.Add(b)); context.SaveChanges(); var creditType = new CreditType { Name = "kredyt gotówkowy", Commission = 8.99m, Rates = 0m }; context.CreditTypes.Add(creditType); context.SaveChanges(); var bankAccounts = new List <BankAccount> { new BankAccount { Balance = 100.50m, AvailableFounds = 100.50m, Lock = 0m, BankAccountNumber = "12 1234 1234 1234 1234 1234 1230", CreationDate = new DateTime(2020, 06, 04), BankAccountType = bankAccountTypes[0], Currency = currencies[0], }, new BankAccount { Balance = 50m, AvailableFounds = 50m, Lock = 0m, BankAccountNumber = "12 1234 1234 1234 1234 1234 1231", CreationDate = new DateTime(2020, 06, 03), BankAccountType = bankAccountTypes[1], Currency = currencies[0], }, new BankAccount { Balance = 20m, AvailableFounds = 20m, Lock = 0m, BankAccountNumber = "12 1234 1234 1234 1234 1234 1232", CreationDate = new DateTime(2020, 09, 06), BankAccountType = bankAccountTypes[2], Currency = currencies[1] } }; bankAccounts.ForEach(b => context.BankAccounts.Add(b)); context.SaveChanges(); var paymentCards = new List <PaymentCard> { new PaymentCard { PaymentCardNumber = "1234 1234 1234 1230", Code = "0321", Blocked = false, SecureCard = true, BankAccount = bankAccounts[0] }, new PaymentCard { PaymentCardNumber = "1234 1234 1234 1231", Code = "3021", Blocked = true, SecureCard = false, BankAccount = bankAccounts[1] }, new PaymentCard { PaymentCardNumber = "1234 1234 1234 1232", Code = "3201", Blocked = false, SecureCard = true, BankAccount = bankAccounts[2] }, }; paymentCards.ForEach(p => context.PaymentCards.Add(p)); context.SaveChanges(); var profiles = new List <Profile> { new Profile { FirstName = "John", LastName = "Travolta", Email = user.UserName, BankAccounts = new List <BankAccount>() { bankAccounts[0], bankAccounts[2] } }, new Profile { FirstName = "John", LastName = "Travolta", Email = user2.UserName, BankAccounts = new List <BankAccount>() { bankAccounts[1] } }, new Profile { Email = user3.UserName }, new Profile { Email = worker.UserName }, }; profiles.ForEach(p => context.Profiles.Add(p)); context.SaveChanges(); var acquirer = new Acquirer() { Name = "Giga Pizza", URL = "https://localhost:44395/", OrderDetailsPath = "api/orders/", UpdateOrderStatusPath = "api/orders/updateStatus", OrderSummaryPath = "summary/", Description = "Brak pomysłu na obiad? Zamów pizzę online. Giga Pizza to giga przyjemność!", BankAccountNumebr = "52 7949 1333 2906 6136 7434 4779", ApiKey = "2a9f86fc-8fd6-439d-99af-30d743180d6a" }; context.Acquirers.Add(acquirer); context.SaveChanges(); var directoryServer = new DirectoryServer() { Name = "Main Directory Server", ApiKey = "06b9e986-9609-4892-933f-9ced84f3e1c8" }; context.DirectoryServers.Add(directoryServer); context.SaveChanges(); }