public void Create(PaymentMethods item) { var Data = paymentMethodsRepository.FindLastPaymentMethodID() + 1; item.PaymentMethodID = Data; paymentMethodsRepository.Create(item); }
public static String GetTemplateMollieData(String templatename, NBrightInfo pluginInfo) { var templ = GetTemplateData(templatename, pluginInfo); #region "Get Mollie options from API" var info = ProviderUtils.GetProviderSettings("DnnCMolliepayment"); var testMode = info.GetXmlPropertyBool("genxml/checkbox/testmode"); var testApiKey = info.GetXmlProperty("genxml/textbox/testapikey"); var liveApiKey = info.GetXmlProperty("genxml/textbox/liveapikey"); // Check to see if the test api keys is filled in, stops the error with the settings in the backoffice if (testApiKey != "") { var apiKey = testApiKey; if (!testMode) { apiKey = liveApiKey; } MollieClient mollieClient = new MollieClient(); mollieClient.setApiKey(apiKey); var strPayOptions = ""; PaymentMethods methods = mollieClient.GetPaymentMethods(); Issuers issuers = mollieClient.GetIssuers(); foreach (PaymentMethod method in methods.data) { strPayOptions += "<tr>"; strPayOptions += "<td><input type='radio' id='" + method.id + "' value='" + method.id + "' name='group1' class='rdoBanks' /></td>"; strPayOptions += "<td><img src='" + method.image.normal + "' /></td>"; strPayOptions += "<td><strong>" + method.description + "</strong></td>"; strPayOptions += "</tr>"; if (method.id == "ideal") { strPayOptions += "<tr><td colspan='3'><div id='bank-holder' class='hidden'>"; strPayOptions += "<select id='mollieidealgatewaybankselectordropdown' name='mollieidealgatewaybankselectordropdown' class='bankSelector'>"; strPayOptions += "<option>" + info.GetXmlProperty("genxml/textbox/bankdropdowntext") + "</option>"; foreach (Issuer issuer in issuers.data) { strPayOptions += string.Format("<option value=\"{0}\">{1}</option>", issuer.id, issuer.name); } strPayOptions += "</select>"; strPayOptions += "</div></td></tr>"; } strPayOptions += "<tr><td colspan='3'><hr/></td></tr>"; } templ = templ.Replace("[PAYMENTMETHODS]", strPayOptions); } #endregion return(templ); }
public ActionResult GetDefaultPayment(string userId) { PaymentMethods paymentMethod = _paymentMethodService.GetUserDefaultPaymentMethod(userId); if (paymentMethod == null) { return(new JsonResult(null) { StatusCode = StatusCodes.Status404NotFound }); } PaymentMethodViewModel paymentMethodVM = new PaymentMethodViewModel() { Id = paymentMethod.Id, CreatedTime = paymentMethod.CreatedTime, InUsed = paymentMethod.InUsed, IsDefault = paymentMethod.IsDefault, PaymentType = paymentMethod.PaymentType, UserId = paymentMethod.UserId }; if (paymentMethodVM.PaymentType == PaymentType.Wallet) { paymentMethodVM.Wallets = paymentMethod.Wallets; } return(new JsonResult(paymentMethodVM) { StatusCode = StatusCodes.Status200OK }); }
public bool Pay(string senderId, string receiverId, string paymentType, decimal amount) { try { PaymentMethods senderPM = GetUserPaymentMethodByType(senderId, paymentType); PaymentMethods receiverPM = GetUserPaymentMethodByType(receiverId, paymentType); if (paymentType == PaymentType.Wallet) { if (senderPM != null && receiverPM != null) { //Check balance after transaction is more than minimum balance if (senderPM.Wallets.Balance - amount < PaymentAmount.MinimumBalance) { return(false); } Transactions depositTransaction = new Transactions() { Amount = amount, CurrencyCode = CurrencyConstants.VND, Detail = TransactionDetail.PaidTransaction, State = TransactionState.Completed, SenderName = senderPM.User.FullName, SenderPaymentMethodId = senderPM.Wallets.IdNavigation.Id, ReceiverName = receiverPM.User.FullName, ReceiverPaymentMethodId = receiverPM.Wallets.IdNavigation.Id, Time = DateTime.Now }; _transactionRepository.Add(depositTransaction); senderPM.Wallets.Balance = senderPM.Wallets.Balance - amount; receiverPM.Wallets.Balance = receiverPM.Wallets.Balance + amount; _walletRepository.Update(senderPM.Wallets); _walletRepository.Update(receiverPM.Wallets); } } else if (paymentType == PaymentType.Cash) { Transactions depositTransaction = new Transactions() { Amount = amount, CurrencyCode = CurrencyConstants.VND, Detail = TransactionDetail.PaidTransaction, State = TransactionState.Completed, SenderName = senderPM.User.FullName, SenderPaymentMethodId = senderPM.Id, ReceiverName = receiverPM.User.FullName, ReceiverPaymentMethodId = receiverPM.Id, Time = DateTime.Now }; _transactionRepository.Add(depositTransaction); } } catch (Exception) { return(false); } return(true); }
public JsonResult Get(int pageIndex, int pageSize, string pageOrder) { var list = PaymentMethods.Get(pageIndex, pageSize, pageOrder); int total = PaymentMethods.Count(); int totalPage = (int)Math.Ceiling((decimal)total / pageSize); if (pageSize > total) { pageSize = total; } if (list.Count < pageSize) { pageSize = list.Count; } JsonResult result = new JsonResult() { Data = new { TotalPages = totalPage, PageIndex = pageIndex, PageSize = pageSize, Rows = list }, JsonRequestBehavior = JsonRequestBehavior.AllowGet }; return(result); }
void SetCoordination(CoordinationPaymentMethod model) { CoordinationPaymentMethodViewModel coordinationPaymentMethodViewModel = new CoordinationPaymentMethodViewModel(); ViewModelHelper.SetCoordinationPaymentMethodToCoordinationPaymentMethodViewModel(model, coordinationPaymentMethodViewModel); PaymentMethods.Add(coordinationPaymentMethodViewModel); }
private void SetPayPalVisibility(CartViewModel model) { var isRecurring = CurrentCart != null ? CurrentCart.IsRecurring : false; var enabledMethods = PaymentMethods.EnabledMethods(HccApp.CurrentStore, isRecurring); model.PayPalExpressAvailable = enabledMethods.Any(m => m.MethodId == PaymentMethods.PaypalExpressId); }
static void Main(string[] args) { Vindi VindiSdk = new Vindi() { Config = new Configuration("https://app.vindi.com.br", 1, "XlZBPa4zUhX1In4T9yHloj83WNaJf0i7V386V_Q2xQk") }; PaymentMethods PayMethodsEdit; Service service = new Service(VindiSdk.Config); //Metodo de Pagamento Debito Automatico /*PayMethodsEdit = new PaymentMethods() { * Code = "bank_debit" * };*/ //Metodo de Pagamento Cartão de Credito PayMethodsEdit = new PaymentMethods() { Code = "credit_card" }; Product NewProduct = new Product(); NewProduct.Code = "5376"; NewProduct.Name = "Mensalidade 54,90"; NewProduct.PricingSchema = new PricingSchema() { Price = "54.9" }; var Pt = service.GetByAnythingAsync(new Product()); var Find = VindiSdk.GetByAnythingAsync(NewProduct); }
public void PaymentMethodsTest_CheckDefault() { // Arrange var sut = new PaymentMethods() { Items = new System.Collections.Generic.List <PaymentMethod>() { { new PaymentMethod() { Title = "pm1", Disabled = true, Checked = true } }, { new PaymentMethod() { Title = "pm2", Disabled = false, Checked = false } }, { new PaymentMethod() { Title = "pm3", Disabled = false, Checked = false } } } }; // Act sut.CheckDefault(); // Assert Assert.True(sut.Items.Where(i => i.Checked).Count() == 1); Assert.Equal("pm2", sut.Items.First(i => i.Checked).Title); }
private async void ValidateResponseCoordinationPaymentMethod(ResponseCoordinationPaymentMethod response) { dialogService.HideProgress(); if (response.Success) { PaymentMethods.Clear(); CoordinationPaymentMethod ExternalMethod = response.CoordinationPaymentMethods.Where(x => x.ExternalMethod).FirstOrDefault(); if (ExternalMethod != null) { ExternalMethod.IconApp = "pasarela"; ExternalMethod.PaymentMethodName = "Pago en línea"; ExternalMethod.PaymentMethodDescription = string.Empty; SetCoordination(ExternalMethod); } foreach (CoordinationPaymentMethod item in response.CoordinationPaymentMethods) { if (item.ExternalMethod == false) { SetCoordination(item); } } await navigationService.Navigate(AppPages.CoordinationPaymentMethodPage); } else { await dialogService.ShowMessage(response.Title, response.Message); } }
public ActionResult Edit(PaymentMethod paymentMethod) { try { var files = Utilities.SaveFiles(Request.Files, Utilities.GetNormalFileName(paymentMethod.Title), StaticPaths.PaymentMethods); if (files.Count > 0) { paymentMethod.Filename = files[0].Title; } paymentMethod.LastUpdate = DateTime.Now; ViewBag.Success = true; if (paymentMethod.ID == -1) { PaymentMethods.Insert(paymentMethod); UserNotifications.Send(UserID, String.Format("جدید - روش پرداخت '{0}'", paymentMethod.Title), "/Admin/PaymentMethod/Edit/" + paymentMethod.ID, NotificationType.Success); paymentMethod = new PaymentMethod(); } else { PaymentMethods.Update(paymentMethod); } } catch (Exception ex) { SetErrors(ex); } return(ClearView(paymentMethod)); }
public Payment(PaymentMethods paymentMethods, Customer customer, List <Product> products, decimal amount) { PayMethod = paymentMethods; PayCustomer = customer; ProductsPayingFor = products; Amount = amount; }
public async Task <bool> PayAsync(PaymentMethods paymentMethods, decimal price, params string[] paymentParameters) { if (paymentParameters == null) { throw new ArgumentNullException(nameof(paymentParameters)); } if (!Enum.IsDefined(typeof(PaymentMethods), paymentMethods)) { throw new InvalidEnumArgumentException(nameof(paymentMethods), (int)paymentMethods, typeof(PaymentMethods)); } if (price <= 0) { throw new ArgumentOutOfRangeException(nameof(price)); } switch (paymentMethods) { case PaymentMethods.Creditcard: return(await PayCreditCardAsync(price, paymentParameters)); } return(await Task.FromResult(false)); }
public async Task <IActionResult> Edit(int id, [Bind("ActorID,ActorFullName,ActorNotes")] PaymentMethods paymentMethods) { if (id != paymentMethods.PaymentMethodsID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(paymentMethods); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PaymentMethodsExists(paymentMethods.PaymentMethodsID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(paymentMethods)); }
public Payment(PaymentMethods paymentMethods, Customer customer, Product product, decimal amount) { PayMethod = paymentMethods; PayCustomer = customer; ProductsPayingFor.Add(product); Amount = amount; }
private void CardAdded(PaymentMethod paymentMethod) { var paymentMethodViewModel = new PaymentMethodViewModel(paymentMethod, PaymentMethodSelected); PaymentMethods.Add(paymentMethodViewModel); SelectPaymentMethod(paymentMethodViewModel); _methodSelectedCallback(); }
public void RemovePaymentMethod(PaymentMethodId paymentMethodId) { if (!PaymentMethods.Contains(paymentMethodId)) { return; } PaymentMethods.Remove(paymentMethodId); }
public Order(int number, decimal amount, PaymentMethods method, Customer customer, List <Product> products) { Number = number; Amount = amount; PaymentMethod = method; Customer = customer; LineItems = products; }
public ActionResult DeleteConfirmed(int id) { PaymentMethods paymentMethods = db.PaymentMethods.Find(id); db.PaymentMethods.Remove(paymentMethods); db.SaveChanges(); return(RedirectToAction("Index")); }
public void AddPaymentMethod(PaymentMethodId paymentMethodId) { if (PaymentMethods.Contains(paymentMethodId)) { return; } PaymentMethods.Add(paymentMethodId); }
public void LoadPaymentMethods() { //Arrange var count = _irepo.GetTotalPaymentMethodCount(); var resultcount = PaymentMethods.AvailableMethods().Count; //Assert Assert.AreEqual(count, resultcount); }
public async Task CanRetrieveSinglePaymentMethod(PaymentMethods method) { // When: retrieving a payment method var paymentMethod = await PaymentMethodClient.GetPaymentMethodAsync(method); // Then: Make sure it can be retrieved Assert.NotNull(paymentMethod); Assert.Equal(method, paymentMethod.Id); }
public Checkout(Client client) : base(client) { IsApiKeyRequired = true; _payments = new Payments(this); _paymentMethods = new PaymentMethods(this); _paymentDetails = new PaymentDetails(this); _paymentSession = new PaymentSession(this); _paymentsResult = new PaymentsResult(this); }
public void Should_Get_All_Payment_Methods() { var netoStore = GetStoreManager(); PaymentMethods result = netoStore.Payment.GetPaymentMethods(); Assert.IsNotNull(result); Assert.IsNotNull(result.PaymentMethod); }
public JsonResult Save(PaymentMethods data) { _Context = new ApplicationDbContext(); _Context.PaymentMethodses.Add(data); _Context.SaveChanges(); return(new JsonResult()); }
public List <string> GetPaymentMethodsWithId() { GetPaymentMethods(); PaymentMethodsNames = PaymentMethods.AsEnumerable().Select(r => r.Field <string>(1)).ToList(); PaymentMethodsIds = PaymentMethods.AsEnumerable().Select(r => r.Field <int>(0)).ToList(); return(DatabasetablesHelpers.CombineIdWithName(PaymentMethodsIds, PaymentMethodsNames)); }
public Task <PaymentMethodResponse> GetPaymentMethodAsync(PaymentMethods paymentMethod, bool?includeIssuers = null, string locale = null, bool?includePricing = null, string profileId = null, bool?testmode = null) { Dictionary <string, string> parameters = new Dictionary <string, string>(); parameters.AddValueIfNotNullOrEmpty("locale", locale); AddOauthParameters(parameters, profileId, testmode); BuildIncludeParameter(parameters, includeIssuers, includePricing); return(ClientService.GetAsync <PaymentMethodResponse>($"methods/{paymentMethod.ToString().ToLower()}{parameters.ToQueryString()}")); }
public ActionResult Edit([Bind(Include = "ID,Method")] PaymentMethods paymentMethods) { if (ModelState.IsValid) { db.Entry(paymentMethods).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(paymentMethods)); }
public PaymentMethods GetUserDefaultPaymentMethod(string userId) { PaymentMethods paymentMethods = _paymentMethodRepository .GetAll() .Where(pm => pm.UserId == userId && pm.IsDefault == true) .Include(pm => pm.Wallets) .FirstOrDefault(); return(paymentMethods); }
/// <summary> /// Returns the string presentation of the object /// </summary> /// <returns>String presentation of the object</returns> public override string ToString() { var sb = new StringBuilder(); sb.Append("class PaymentMethodsResponse {\n"); sb.Append(" PaymentMethods: ").Append(PaymentMethods.ObjectListToString()).Append("\n"); sb.Append(" StoredPaymentMethods: ").Append(StoredPaymentMethods.ObjectListToString()).Append("\n"); sb.Append("}\n"); return(sb.ToString()); }
public static PaymentMethods ModelToEnity(this PaymentMethodsModel model, bool virtualActive = false) { PaymentMethods entity = new PaymentMethods() { Name=model.Name, Id = model.Id, IsActive = model.IsActive }; if (virtualActive) { entity.Sales = model.Sales; } return entity; }
private void Calculate(double total, double cost, PaymentMethods paymentMethod, JobPricing jobPricing) { //gross calc if (paymentMethod == PaymentMethods.Cash) { _gross = total; } else if (paymentMethod == PaymentMethods.Check) { _gross = total - (total * Globals.checkFee); } else { _gross = total - (total * Globals.creditCardFee); } //techCut calc if (jobPricing == JobPricing.Day) { _techCut = (_gross - cost) * 0.2; } else if (jobPricing == JobPricing.Night) { _techCut = (_gross - cost) * 0.35; } else { _techCut = (_gross - cost) * 0.5; } _grossMinusCost = _gross - cost; _techPayout = cost + _techCut; _company = _grossMinusCost * 0.5; _businessNet = _gross - _techPayout - _company; _sumCash = _company + _businessNet; }
public NewJobCalculator(double total, double cost, PaymentMethods paymentMethod, JobPricing jobPricing) { Calculate(total, cost, paymentMethod, jobPricing); }
public ActionResult CheckOutStep4(PaymentMethods payment) { var cartModel = GetCart(); cartModel.Payment = payment; SaveCart(cartModel); return View(cartModel); }