public override bool OnMoneyReceived(ChargeModel model) { var diamonds = (int)(Math.Round(model.Amount, 2) * 100); var chargeRec = new VipChargeRecord() { QQNum = model.QQNum, ChargeAmount = model.Amount, ChargeTime = DateTime.Now, DiamondAmount = diamonds, Message = model.Message, OrderID = model.OrderID }; chargeRec.Insert(); var osPerson = OSPerson.GetPerson(model.QQNum); osPerson.Diamonds += diamonds; osPerson.Update(); MsgSender.PushMsg(0, model.QQNum, $"恭喜充值成功!当前余额:{osPerson.Diamonds}{Emoji.钻石}", model.BindAi); MsgSender.PushMsg(0, Global.DeveloperNumber, $"{model.QQNum}充值{model.Amount}元!", Global.DefaultConfig.MainAi); return(true); }
public ActionResult Custom(ChargeModel chargeModel) { // Set your secret key: remember to change this to your live secret key in production // See your keys here: https://dashboard.stripe.com/account/apikeys StripeConfiguration.SetApiKey("sk_test_n9ph6eUYkYPByT2ua06v6Bdv"); // Token is created using Checkout or Elements! // Get the payment token submitted by the form: var token = chargeModel.Token; // Using ASP.NET MVC var options = new ChargeCreateOptions { Amount = 1999, Currency = "usd", Description = "Example charge", SourceId = token, Capture = false, ReceiptEmail = "*****@*****.**", }; var service = new ChargeService(); Charge charge = service.Create(options); return(RedirectToAction("Confirmation")); }
public IHttpActionResult ChargeUserAccount(ChargeModel model) { try { var user = AppUserManager.FindByName(model.MobileNo); if (user == null) { _responseProvider.SetBusinessMessage(new MessageResponse() { Type = ResponseTypes.Error, Message = getResource.getMessage("UserNotFound") }); return(Json(_responseProvider.GenerateBadRequestResponse())); } else { var res = _paymentManager.ChargeAccount(user.Id, model.ChargeValue, GetUserNameFamilyString(user)); return(Json(res)); } } catch (Exception e) { _logProvider.Log(Tag, "ChargeUserAccount", e.Message); } return(Json(_responseProvider.GenerateUnknownErrorResponse())); }
/// <summary> /// 转账事件 /// </summary> /// <param name="model"></param> public void OnMoneyReceived(ChargeModel model) { var worldLine = JudgeWorldLine(0); var world = AllWorlds.FirstOrDefault(p => p.Name == worldLine); world?.OnMoneyReceived(model); }
public IActionResult ChargeCreate() { ChargeModel response = epayco.ChargeCreate( "Q4pAwLRw39CYLxYFQ", "2CeoeeoWZBCZRAJ7p", "CC", "1026150902", "Alejandro", "castañeda", "*****@*****.**", "OR-4154754", "pago de prueba", "150000", "0", "0", "COP", "6", "calle falsa", "3146254435", "3146254435", "https:/secure.payco.co/restpagos/testRest/endpagopse.php", "https:/secure.payco.co/restpagos/testRest/endpagopse.php", "0.0.0.0"); return(Ok(response)); }
public decimal Charge(ChargeModel body) { var service = new PowerUsage(); var currentPower = service.Charge(body.SiteId, body.Amount); PushUpdate.BroadcastPowerLevel(currentPower); return(currentPower); }
public ActionResult Charge(ChargeModel model) { if (ModelState.IsValid) { //ChargeBridge cb = new ChargeBridge(); ChargeOrder order = new ChargeOrder() { ChargeType = 0, AgencyId = 0, Id = 0, Province = model.Province, City = model.City, MobileSP = model.SPName, MobileNumber = model.Mobile, OutId = "", ResourceId = 0, ResourceTaocanId = model.ResourceTaocanId, RouteId = 0, CreatedTime = DateTimeUtil.ConvertDateTimeToInt(DateTime.Now) }; // OrderManagement orderMgt = new OrderManagement(); ResourceManagement resourceMgr = new ResourceManagement(0); order = orderMgt.GenerateOrder(order); int total = 0; List <BResourceTaocan> taocans = resourceMgr.FindResourceTaocans(order.ResourceTaocanId, 0, 0, out total); if (taocans == null || taocans.Count == 0) { ViewBag.Message = "当前套餐不可用"; return(View()); } BResourceTaocan taocan = taocans[0]; //Redirct to the payment page. //TBD //After the payment is done then process below steps AlipayConfig config = new AlipayConfig(System.IO.Path.Combine(Request.PhysicalApplicationPath, "Config\\AliPayConfig.xml")); Submit submit = new Submit(config); SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>(); sParaTemp.Add("partner", config.Partner); sParaTemp.Add("seller_email", "*****@*****.**"); sParaTemp.Add("_input_charset", config.Input_charset.ToLower()); sParaTemp.Add("service", "create_direct_pay_by_user"); sParaTemp.Add("payment_type", "1"); sParaTemp.Add("notify_url", config.Notify_Url); sParaTemp.Add("return_url", config.Return_Url); sParaTemp.Add("out_trade_no", order.PaymentId.ToString()); sParaTemp.Add("subject", string.Format("{0}M", taocan.Taocan.Quantity)); sParaTemp.Add("total_fee", taocan.Taocan.Sale_price.ToString("0.00")); sParaTemp.Add("body", string.Format("{0}M", taocan.Taocan.Quantity)); sParaTemp.Add("show_url", ""); sParaTemp.Add("seller_id", config.Partner); //sParaTemp.Add("anti_phishing_key", ""); //sParaTemp.Add("exter_invoke_ip", ""); //建立请求 string sHtmlText = submit.BuildRequest(sParaTemp, "get", "确认"); //Response.Write("ok"); Response.Clear(); Response.Charset = "utf-8"; Response.Write(sHtmlText); //ChargeResult result = cb.Charge(order); //ViewBag.Message = result.Message; } return(View()); }
public IActionResult Charge(ChargeModel model) { var invoice = _invoiceService.GetByIdentifierGuid(model.InvoiceIdentifier); if (invoice == null || invoice.Id == 0) { return(RedirectToAction("NoInvoice")); } var token = model.StripeToken; var subtotal = invoice.LineItem.Sum(s => s.Quantity * s.ItemPrice) ?? 0; var tax = invoice.LineItem.Sum(s => s.TaxAmount * s.Quantity); var total = subtotal + tax + (invoice.ShipCost ?? 0); var options = new ChargeCreateOptions { Amount = (long)(total * 100), //stripe takes LONG, convert decimal Currency = "usd", Description = $"Invoice #{invoice.Id} for {invoice.Customer.DisplayName}", Metadata = new Dictionary <string, string> { { "InvoiceIdentifier", invoice.Identifier } }, Source = token }; var customerEmail = invoice.Customer.Email ?? invoice.Customer.SecondaryEmail; if (!string.IsNullOrWhiteSpace(customerEmail)) { options.ReceiptEmail = customerEmail; } Charge charge = _chargeService.Create(options); if (charge == null) { return(RedirectToAction("NoInvoice")); } var log = _logService.Get(0); log.Date = DateTime.Now; log.LogType = "StripePaymentInfo"; log.InvoiceId = invoice.Id; log.Summary = JsonConvert.SerializeObject(charge); _logService.Add(log); if (charge.Paid) { _invoiceService.SetInvoiceStatus(invoice.Id, Domain.Infrastructure.Enums.InvoiceTypeEnum.Paid, charge.Id); } return(View("ChargeResult", charge)); }
public ActionResult Custom() { string stripePublishableKey = ConfigurationManager.AppSettings["pk_test_xyxrTGDcuvs2YlTTIu9Ak5M1"]; var model = new ChargeModel() { StripePublishableKey = stripePublishableKey, PaymentFormHidden = true }; return(View(model)); }
public ActionResult Custom() { string stripePublishableKey = ConfigurationManager.AppSettings["stripePublishableKey"]; var model = new ChargeModel() { StripePublishableKey = stripePublishableKey, PaymentFormHidden = true }; return(View(model)); }
/// <summary> /// 查询充值订单 /// </summary> /// <param name="argChargeId"></param> /// <returns></returns> public ChargeModel Retrieve(string argChargeId) { ChargeModel model = null; string url = PaymaxConfig.API_BASE_URL + PaymaxConfig.CREATE_CHARGE + "/" + argChargeId; Dictionary <string, string> result = Request(url, null); model = convertToModel <ChargeModel>(result); return(model); }
/// <summary> /// 创建充值订单 /// </summary> /// <param name="argParams"></param> /// <returns></returns> public ChargeModel Charge(Dictionary <string, object> argParams) { ChargeModel model = null; string url = PaymaxConfig.API_BASE_URL + PaymaxConfig.CREATE_CHARGE;// + "?a=1&b=2&c=3"; string jsonData = JsonUtility.ToJsonString(argParams); Dictionary <string, string> result = Request(url, jsonData); model = convertToModel <ChargeModel>(result); return(model); }
public async Task <ActionResult> MobileDonation(ChargeModel model) { var result = await MakeStripeCharge(model); if (result.Succeeded) { ViewBag.Message = $"The pledge of {model.PledgeAmount:C} was processed successfully. Thank you!"; } else { ViewBag.ErrorMessage = $"There was a problem processing your pledge"; } return(View()); }
public static string CreateChargeJson(string shop) { var charge = new ChargeModel(); charge.Name = Name; charge.Price = Price; charge.ReturnUrl = string.Format("https://{0}/{1}/AuthResult?shop={2}", Domain, InstallControllerName, shop); charge.Test = Test; charge.TrialDays = TrialDays; var c = new { recurring_application_charge = charge }; return(JsonConvert.SerializeObject(c, Formatting.Indented)); }
// GET: Expenses/NewCharge public async Task <ActionResult> NewCharge() { var employee = await this.GetEmployee(); var employeeId = employee.Item1; ViewBag.UserName = employee.Item2; var newCharge = new ChargeModel() { ExpenseDate = DateTime.Today, }; return(View(newCharge)); }
/// <summary> /// 查询支付订单 /// </summary> /// <param name="payClient"></param> private static void RetriveCharge(PaymaxClient payClient) { String chargeId = "ch_db8c1014e985bdf6f9fa562e"; ChargeModel model = payClient.RetrieveCharge(chargeId); if (model != null) { Debug.WriteLine("查询订单:" + model.id); Console.WriteLine(model); } else { Console.WriteLine("查询订单失败"); } }
public ActionResult Create(ChargeDto chargeDto) { try { var charge = ChargeModel.MapCharge(chargeDto); var ep = new ChargeProcess(); var lista = ep.Add(chargeDto.IdUser, charge); return(RedirectToAction("Index")); } catch { return(View()); } }
/// <summary> /// 创建支付订单 /// </summary> /// <param name="payClient"></param> /// <param name="paramDic"></param> private static void CreateCharge(PaymaxClient payClient, Dictionary <string, object> paramDic) { ChargeModel result = payClient.Charge(paramDic); if (result != null) { Console.WriteLine("下单成功"); Debug.WriteLine(result); //输出订单信息 Console.WriteLine(result); } else { Console.WriteLine("下单失败"); } }
public async Task <ActionResult> Charge(ChargeModel model) { var result = await MakeStripeCharge(model); if (result.Succeeded) { var currentPledge = model.PledgeAmount.ToString().FirstOrDefault(); ViewBag.Message = $"The pledge of {model.PledgeAmount:C} was processed successfully. Thank you!"; } else { ViewBag.ErrorMessage = $"There was a problem processing your pledge"; } return(View("Index")); }
/* * PAYMENT */ public ChargeModel ChargeCreate( string token_card, string customer_id, string doc_type, string doc_number, string name, string last_name, string email, string bill, string description, string value, string tax, string tax_base, string currency, string dues, string address, string phone, string cell_phone, string url_response, string url_confirmation, string ip, string extra1 = "N/A", string extra2 = "N/A", string extra3 = "N/A", string extra4 = "N/A", string extra5 = "N/A", string extra6 = "N/A", string extra7 = "N/A", string extra8 = "N/A", string extra9 = "N/A", string extra10 = "N/A") { ENDPOINT = Constants.url_charge; PARAMETER = body.getBodyChargeCreate(token_card, customer_id, doc_type, doc_number, name, last_name, email, bill, description, value, tax, tax_base, currency, dues, address, phone, cell_phone, url_response, url_confirmation, ip, extra1, extra2, extra3, extra4, extra5, extra6, extra7, extra8, extra9, extra10); string content = _request.Execute( ENDPOINT, "POST", _auxiliars.ConvertToBase64(_PUBLIC_KEY), PARAMETER); ChargeModel payment = JsonConvert.DeserializeObject <ChargeModel>(content); return(payment); }
/// <summary> /// Runs task of making the charge /// </summary> /// <param name="model"></param> /// <returns></returns> private async Task <StripeResult> MakeStripeCharge(ChargeModel model) { var secretKey = ConfigurationManager.AppSettings["StripeSecretKey"]; var chargeSvc = new ChargeService(secretKey); var options = new ChargeCreateOptions(); options.Amount = Convert.ToInt64(model.PledgeAmount * 100m); options.SourceId = model.StripeToken; options.Currency = "usd"; options.Description = "Pledge"; var charge = await chargeSvc.CreateAsync(options); return(new StripeResult { Succeeded = charge.Status == "succeeded" }); }
public Plan CreatePlanObject(HttpContext httpContext) { var shippingChargeModel = new ChargeModel() { type = "SHIPPING", amount = GetCurrency("9.99") }; return(new Plan { name = "Webvnue", description = "Monthly Subscription", type = "INFINITE", merchant_preferences = new MerchantPreferences() { setup_fee = GetCurrency("0"), return_url = httpContext.Request.Url.ToString(), cancel_url = httpContext.Request.Url.ToString() + "?cancel", auto_bill_amount = "YES", initial_fail_amount_action = "CONTINUE", max_fail_attempts = "0" }, payment_definitions = new List <PaymentDefinition> { new PaymentDefinition { name = "Monthly Subscription", type = "REGULAR", frequency = "MONTH", frequency_interval = "1", amount = GetCurrency("7.00"), cycles = "0", charge_models = new List <ChargeModel> { new ChargeModel { type = "TAX", amount = GetCurrency("2.47") }, shippingChargeModel } } } }); }
public async Task <ActionResult> NewCharge(ChargeModel chargeModel) { var employee = await this.GetEmployee(); var employeeId = employee.Item1; ViewBag.UserName = employee.Item2; if (ModelState.IsValid) { db.Charges.Add(chargeModel.ConvertToDbCharge(employeeId)); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(chargeModel)); }
public async Task <ActionResult> Charge(ChargeModel chargeModel) { var employee = await this.GetEmployee(); var employeeId = employee.Item1; ViewBag.UserName = employee.Item2; if (ModelState.IsValid) { var dbCharge = chargeModel.ConvertToDbCharge(employeeId); db.Entry(dbCharge).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(chargeModel)); }
// POST api/charge public JsonResult <Charge> Post([FromBody] ChargeModel form) { var clientIP = HttpContext.Current.Request.UserHostAddress; if (clientIP == "::1") { clientIP = "127.0.0.1"; } var orderID = Guid.NewGuid().ToString().Replace("-", ""); var pingpp = new Pingpp.Lib.Pingpp(ConfigurationManager.AppSettings["pingpp_key"], ConfigurationManager.AppSettings["pingpp_api_base"]); Error error; var charge = pingpp.CreateCharge(new ChargeCreateParam() { OrderNo = orderID, App = new Dictionary <string, string>() { { "id", ConfigurationManager.AppSettings["pingpp_appid"] } }, Amount = form.Amount, Channel = form.Channel, Currency = "cny", ClientIp = clientIP, Subject = "Your Subject", Body = "Your Body", Extra = null }, out error); if (error == null) { return(Json(charge, new JsonSerializerSettings() { ContractResolver = new CamelCasePropertyNamesContractResolver() })); } else { return(null); } }
public ActionResult Custom(ChargeModel chargeModel) { var chargeOptions = new StripeChargeCreateOptions() { Amount = 1999, Currency = "usd", ReceiptEmail = chargeModel.StripeEmail, SourceTokenOrExistingSourceId = chargeModel.StripeToken, }; var chargeService = new StripeChargeService(); try { var stripeCharge = chargeService.Create(chargeOptions); } catch (StripeException stripeException) { ModelState.AddModelError(string.Empty, stripeException.Message); return(View(chargeModel)); } return(RedirectToAction("Confirmation")); }
public override IPaymentFactory UseChargeModel(ChargeModel chargeModel) { this.request.HEADER.ChargeModel = chargeModel; return(this); }
public static Plan CreatePlanObject(HttpContext httpContext) { // Both the trial and standard plans will use the same shipping // charge for this example, so for simplicity we'll create a // single object to use with both payment definitions. var shippingChargeModel = new ChargeModel() { type = "SHIPPING", amount = GetCurrency("9.99") }; // Define a trial plan that will only charge $9.99 for the first // month. After that, the standard plan will take over for the // remaining 11 months of the year. var trialPlanPaymentDefinition = new PaymentDefinition() { name = "Trial Plan", type = "TRIAL", frequency = "MONTH", frequency_interval = "1", amount = GetCurrency("9.99"), cycles = "1" }; trialPlanPaymentDefinition.charge_models = new List <ChargeModel>(); trialPlanPaymentDefinition.charge_models.Add(new ChargeModel() { type = "TAX", amount = GetCurrency("1.65") }); trialPlanPaymentDefinition.charge_models.Add(shippingChargeModel); // Define the standard payment plan. It will represent a monthly // plan for $19.99 USD that charges once month for 11 months. var regularPlanPaymentDefinition = new PaymentDefinition() { name = "Standard Plan", type = "REGULAR", frequency = "MONTH", frequency_interval = "1", amount = GetCurrency("19.99"), cycles = "11" }; regularPlanPaymentDefinition.charge_models = new List <ChargeModel>(); regularPlanPaymentDefinition.charge_models.Add(new ChargeModel() { type = "TAX", amount = GetCurrency("2.47") }); regularPlanPaymentDefinition.charge_models.Add(shippingChargeModel); // Define the merchant preferences. // More Information: https://developer.paypal.com/webapps/developer/docs/api/#merchantpreferences-object var merchantPreferences = new MerchantPreferences() { setup_fee = GetCurrency("1"), return_url = httpContext.Request.Url.ToString(), cancel_url = httpContext.Request.Url.ToString() + "?cancel", auto_bill_amount = "YES", initial_fail_amount_action = "CONTINUE", max_fail_attempts = "0" }; // Define the plan and attach the payment definitions and merchant preferences. // More Information: https://developer.paypal.com/webapps/developer/docs/api/#create-a-plan var plan = new Plan() { name = "T-Shirt of the Month Club Plan", description = "Monthly plan for getting the t-shirt of the month.", type = "fixed", merchant_preferences = merchantPreferences }; plan.payment_definitions = new List <PaymentDefinition>(); plan.payment_definitions.Add(trialPlanPaymentDefinition); plan.payment_definitions.Add(regularPlanPaymentDefinition); return(plan); }
public async Task <Charge> Index([FromBody] ChargeModel input) { Pingpp.Pingpp.SetApiKey("sk_test_ibbTe5jLGCi5rzfH4OqPW9KC"); const string appId = "app_1Gqj58ynP0mHeX1q"; var extra = new Dictionary <string, object>(); if (input.Channel.Equals("alipay_wap")) { extra.Add("success_url", "http://www.yourdomain.com/success"); extra.Add("cancel_url", "http://www.yourdomain.com/cancel"); } else if (input.Channel.Equals("wx_pub")) { extra.Add("open_id", "asdfasdfsadfasdf"); } else if (input.Channel.Equals("upacp_wap")) { extra.Add("result_url", "http://www.yourdomain.com/result"); } else if (input.Channel.Equals("upmp_wap")) { extra.Add("result_url", "http://www.yourdomain.com/result?code="); } else if (input.Channel.Equals("bfb_wap")) { extra.Add("result_url", "http://www.yourdomain.com/result"); extra.Add("bfb_login", true); } else if (input.Channel.Equals("wx_pub_qr")) { extra.Add("product_id", "asdfsadfadsf"); } else if (input.Channel.Equals("yeepay_wap")) { extra.Add("product_category", "1"); extra.Add("identity_id", "sadfsdaf"); extra.Add("identity_type", 1); extra.Add("terminal_type", 1); extra.Add("terminal_id", "sadfsadf"); extra.Add("user_ua", "sadfsdaf"); extra.Add("result_url", "http://www.yourdomain.com/result"); } else if (input.Channel.Equals("jdpay_wap")) { extra.Add("success_url", "http://www.yourdomain.com/success"); extra.Add("fail_url", "http://www.yourdomain.com/fail"); extra.Add("token", "fjdilkkydoqlpiunchdysiqkanczxude"); //32 位字符串,京东支付成功后会返回 } var param = new Dictionary <string, object> { { "order_no", input.Order_no }, { "amount", input.Amount }, { "channel", input.Channel }, { "currency", "cny" }, { "subject", "test" }, { "body", "tests" }, { "client_ip", "127.0.0.1" }, { "app", new Dictionary <string, string> { { "id", appId } } }, { "extra", extra } }; var charge = await Charge.Create(param); return(charge); }
public ActionResult Charge(ChargeModel chargeModel) { return(RedirectToAction("Confirmation")); }