public void PostProcessPayment(PostProcessPaymentRequest postProcessPaymentRequest) { RandomStringGenerator RSG = new RandomStringGenerator(); RSG.MinLowerCaseCharacters = 25; RSG.RepeatCharacters = false; Debug.WriteLine(RSG.Generate(25)); Debug.WriteLine("PostProcessPayment"); var nfi = new CultureInfo("en-US", false).NumberFormat; var url = GetPaymentUrl(); var gatewayUrl = new Uri(url); var post = new RemotePost { Url = gatewayUrl.ToString(), Method = "POST" }; var order = postProcessPaymentRequest.Order; var merchTxnRef = RSG.Generate(25); var orderInfo = RSG.Generate(25); post.Add("mid", "20130114001"); post.Add("ref", merchTxnRef); post.Add("cur", "SGD"); post.Add("amt", "20"); post.Add("ccnum", "4111111111111111"); post.Add("ccdate", "1511"); post.Add("cccvv", "989"); post.Add("paytype", "3"); post.Add("transtype", "sale"); post.Add("returnurl", "http://localhost:15536/onepagecheckout"); post.Post(); }
public ActionResult CoinTosser(string token, int id) { var client = new WebClient(); //protocol agnostic code CanonicalRequestResponse req = new CanonicalRequestResponse(); req.token = token; req.id = id; CanonicalRequestResponse req1 = agnosticVerifyTokenRequest(req); string OAuthResponse = FetchVerifyTokenResult(req1.token, req1.result); CanonicalRequestResponse resp1 = new CanonicalRequestResponse(); resp1.result = OAuthResponse; agnosticFinalGamblingRequest(resp1); if (resp1.result != "") { ViewBag.result = req.result; //make a remote post back to gaming site RemotePost post = new RemotePost(); post.FormName = "Cointoss"; post.Url = site_root + "/Home/Index"; post.Method = "POST"; post.Add("result", OAuthResponse); post.Add("id", Convert.ToString(id)); post.Post(); } return(View()); }
protected override void BuildPostForm(Order order, IndividualOrderCollection indOrders, decimal price, decimal shipping, Customer customer) { var remotePostHelper = new RemotePost { FormName = "AssistForm", Url = GetPaymentServiceUrl() }; remotePostHelper.Add("Merchant_ID", "706403"); remotePostHelper.Add("OrderNumber", order.OrderID.ToString()); remotePostHelper.Add("OrderAmount", Math.Round(price + shipping).ToString()); remotePostHelper.Add("OrderCurrency", ConvertToUsd ? "USD" : CurrencyId); remotePostHelper.Add("TestMode", IsTestMode? "1": "0"); if (!String.IsNullOrEmpty(customer.BillingAddress.LastName)) { remotePostHelper.Add("Lastname", customer.BillingAddress.LastName); } if (!String.IsNullOrEmpty(customer.BillingAddress.FirstName)) { remotePostHelper.Add("Firstname", customer.BillingAddress.FirstName); } if (!String.IsNullOrEmpty(customer.BillingAddress.Email)) { remotePostHelper.Add("Email", customer.BillingAddress.Email); } remotePostHelper.Add("URL_RETURN_OK", SettingManager.GetSettingValue("PaymentMethod.Assist.OkUrl")); remotePostHelper.Add("URL_RETURN_NO", SettingManager.GetSettingValue("PaymentMethod.Assist.NoUrl")); remotePostHelper.Post(); }
/// <summary> /// Post process payment (used by payment gateways that require redirecting to a third-party URL) /// </summary> /// <param name="postProcessPaymentRequest">Payment info required for an order processing</param> public void PostProcessPayment(PostProcessPaymentRequest postProcessPaymentRequest) { //create common query parameters for the request var queryParameters = CreateOxipayRequestPost(postProcessPaymentRequest); AddOrderTotalParameters(queryParameters, postProcessPaymentRequest); var hmacSignature = GenerateHMAC(queryParameters); var order = postProcessPaymentRequest.Order; var gatewayUrl = new Uri(GetOxipayUrl()); var remotePostHelper = new RemotePost { Url = gatewayUrl.ToString(), Method = "POST", FormName = "OxipayForm" }; //queryParameters foreach (KeyValuePair <string, string> record in queryParameters) { remotePostHelper.Add(record.Key, record.Value); } ; // Add HMAC Signature to the request remotePostHelper.Add("x_signature", hmacSignature); _logger.InsertLog(LogLevel.Warning, remotePostHelper.Url, remotePostHelper.Method); remotePostHelper.Post(); }
protected void Page_Load(object sender, EventArgs e) { // Code that runs when a new session is started //get the incoming request var context = HttpContext.Current; HttpRequest req = context.Request; RemotePost post = new RemotePost(); post.FormName = "SimplePay"; post.Url = "https://www.sandbox.paypal.com/us/cgi-bin/webscr"; post.Method = "POST"; //get info from nopcommerce submission form NameValueCollection queryString = Request.QueryString; var items = queryString.AllKeys.SelectMany(queryString.GetValues, (k, v) => new { key = k, value = v }); foreach (var item in items) { if (item.key == "return" && queryString["tx"] == null) //Rui: request from store to PayPal { if (queryString["path_digest"] != null) { post.Add(item.key, "http://protoagnostic.cloudapp.net:8002/pay.aspx?path_digest=" + queryString["path_digest"]); } else { post.Add(item.key, "http://protoagnostic.cloudapp.net:8002/pay.aspx"); } } else if (item.key == "path_digest") { continue; } else { post.Add(item.key, item.value); } } /* * post.Add("immediateReturn", "1"); * post.Add("signatureVersion", "2"); * post.Add("signatureMethod", "HmacSHA256"); * post.Add("accessKey", "AKIAJB4XJRGX6XRRVIDA"); * post.Add("amount", "USD 35.12"); * post.Add("description", "Your store name, 9"); * post.Add("amazonPaymentsAccountId", "IGFCUTPWGXVM311K1E6QTXIQ1RPEIUG5PTIMUZ"); * post.Add("returnUrl", "http://localhost:8242/AmazonSimplePayReturn.aspx"); * post.Add("processImmediate", "0"); * post.Add("referenceId", "9"); * post.Add("signature", "e6nHOQqZCC3BMXZ1veEVIzWfu5SQxUIJ7O6v2wjdpQw="); */ post.Post(); }
/// <summary> /// Post process payment (used by payment gateways that require redirecting to a third-party URL) /// </summary> /// <param name="postProcessPaymentRequest">Payment info required for an order processing</param> public void PostProcessPayment(PostProcessPaymentRequest postProcessPaymentRequest) { //string amount = postProcessPaymentRequest.Order.OrderTotal.ToString ("#.##"); //amount.ToString (); var remotePostHelper = new RemotePost(); var remotePostHelperData = new Dictionary <string, string>(); remotePostHelper.FormName = "PaytmForm"; remotePostHelper.Url = _PaytmPaymentSettings.PaymentUrl; remotePostHelperData.Add("MID", _PaytmPaymentSettings.MerchantId.ToString()); remotePostHelperData.Add("WEBSITE", _PaytmPaymentSettings.Website.ToString()); remotePostHelperData.Add("CHANNEL_ID", "WEB"); remotePostHelperData.Add("INDUSTRY_TYPE_ID", _PaytmPaymentSettings.IndustryTypeId.ToString()); remotePostHelperData.Add("TXN_AMOUNT", postProcessPaymentRequest.Order.OrderTotal.ToString("0.00")); remotePostHelperData.Add("ORDER_ID", postProcessPaymentRequest.Order.Id.ToString()); remotePostHelperData.Add("EMAIL", postProcessPaymentRequest.Order.BillingAddress.Email); remotePostHelperData.Add("MOBILE_NO", postProcessPaymentRequest.Order.BillingAddress.PhoneNumber); remotePostHelperData.Add("CUST_ID", postProcessPaymentRequest.Order.BillingAddress.Email); remotePostHelperData.Add("CALLBACK_URL", _webHelper.GetStoreLocation(false) + "Plugins/PaymentPaytm/Return"); //remotePostHelperData.Add("CALLBACK_URL", _PaytmPaymentSettings.CallBackUrl.ToString()); // changes done by mayank -- Dictionary <string, string> parameters = new Dictionary <string, string> (); foreach (var item in remotePostHelperData.Keys) { // below code snippet is mandatory, so that no one can use your checksumgeneration url for other purpose . if (remotePostHelperData[item].Trim().ToUpper().Contains("REFUND") || remotePostHelperData[item].Trim().Contains("|")) { continue; } else { parameters.Add(item, remotePostHelperData[item]); remotePostHelper.Add(item, remotePostHelperData[item]); } } // changes end -- try { string checksumHash = ""; checksumHash = CheckSum.generateCheckSum(_PaytmPaymentSettings.MerchantKey, parameters); remotePostHelper.Add("CHECKSUMHASH", checksumHash); remotePostHelper.Post(); } catch (Exception ep) { throw new Exception(ep.Message); } }
protected void Pay() { RemotePost myremotepost = new RemotePost(); myremotepost.Url = "https://www.paypal.com/cgi-bin/webscr"; myremotepost.Add("business", "*****@*****.**"); myremotepost.Add("cmd", "_xclick"); myremotepost.Add("item_name", "Hot Sauce-12oz Bottle"); myremotepost.Add("amount", Lblamt.Text); myremotepost.Add("currency_code", "USD"); myremotepost.Post(); }
protected void Pay() { RemotePost myremotepost = new RemotePost(); myremotepost.Url = "https://www.paypal.com/cgi-bin/webscr"; myremotepost.Add("business", "*****@*****.**"); myremotepost.Add("cmd", "_xclick"); myremotepost.Add("item_name", "ShaktiPrabha Magazine"); myremotepost.Add("amount", Lblamt.Text); myremotepost.Add("currency_code", "USD"); myremotepost.Post(); }
public bool validateTicket(string ticketId) { RemotePost req = new RemotePost("http://tickets4you.dk/api/validateEvent"); req.Timeout = 3; req.Add("userSession", this.userSession); req.Add("apiKey", this.APIKey); validateTicketReturn vtr = JsonConvert.DeserializeObject <validateTicketReturn>(req.Post()); return(vtr.valid); }
protected void ButtonCheckout_Click(object sender, EventArgs e) { RemotePost myremotepost = new RemotePost(); myremotepost.Url = "https://www.paypal.com/cgi-bin/webscr"; myremotepost.Add("business", "*****@*****.**"); myremotepost.Add("cmd", "_xclick"); myremotepost.Add("item_name", cart.Rows[0][11].ToString()); myremotepost.Add("amount", ((Label)GridViewUsers.FooterRow.FindControl("LabelTotal")).Text); myremotepost.Add("currency_code", "CAD"); myremotepost.Post(); //Response.Redirect(redirect); }
/// <summary> /// Post process payment (payment gateways that require redirecting) /// </summary> /// <param name="order">Order</param> /// <returns>The error status, or String.Empty if no errors</returns> public string PostProcessPayment(Order order) { RemotePost remotePostHelper = new RemotePost(); remotePostHelper.FormName = "SagePayForm"; remotePostHelper.Url = GetSagePayUrl(); remotePostHelper.Add("VPSProtocol", protocolNumber); remotePostHelper.Add("TxType", transactionType); remotePostHelper.Add("Vendor", vendorName); remotePostHelper.Add("Crypt", GenerateCryptField(order)); remotePostHelper.Post(); return(string.Empty); }
public List <Ticket> getAllTickets(string eventId) { RemotePost req = new RemotePost("http://tickets4you.dk/api/getTickets"); req.Timeout = 30; req.Add("eventId", eventId); req.Add("userSession", this.userSession); req.Add("apiKey", this.APIKey); Ticket[] tickets = JsonConvert.DeserializeObject <Ticket[]>(req.Post()); return(tickets.ToList <Ticket>()); }
public ActionResult Donate(FormView fw) { if (ModelState.IsValid) { string sentName; if (String.IsNullOrEmpty(fw.Name) || fw.Name == "Anonymous") { sentName = "Anonymous"; } else { sentName = fw.Name; } formuser fu = new formuser { Message = fw.Message, SubmitTime = DateTime.Now, ppal = new ppal { paid = false, sAmountPaid = fw.amount, transactionId = null }, Name = sentName }; pc.formusers.Add(fu); pc.SaveChanges(); RemotePost myremotepost = new RemotePost(); myremotepost.Url = "https://www.paypal.com/cgi-bin/webscr"; //myremotepost.Url = "https://www.sandbox.paypal.com/cgi-bin/webscr"; myremotepost.Add("cmd", "_donations"); myremotepost.Add("item_name", "Party in the Park 2018 - Donation"); // live paypal id myremotepost.Add("business", "AQF49WHBFF5XN"); // sandbox id //myremotepost.Add("business", "56LULGKTVTCNL"); myremotepost.Add("amount", fu.ppal.sAmountPaid.ToString()); myremotepost.Add("no_note", "1"); myremotepost.Add("currency_code", "GBP"); myremotepost.Add("notify_url", "http://pitpnxd.co.uk/ipn/receive"); myremotepost.Add("custom", fu.ID.ToString()); myremotepost.Add("return", "http://pitpnxd.co.uk/paypal/thankyou"); myremotepost.Post(); return(View()); } else { return(View(fw)); } }
public static void Request(string id, decimal amount) { var name = "" + id + "-Meerkat Store"; //product description (optional) var body = "Order from Meerkat Store"; var currency = "USD"; var service = "create_forex_trade";//"create_direct_pay_by_user"; string signType = "MD5"; string key = Config.key; string partner = Config.partner; var orderId = id; string totalAmount = Math.Round(amount, 2).ToString("0.00", CultureInfo.InvariantCulture); string notify_url = Config.notify_url; string return_url = Config.return_url; var param = new Dictionary <string, object> { { "service", service }, { "partner", partner }, { "_input_charset", "utf-8" }, { "return_url", return_url }, { "notify_url", notify_url }, { "currency", currency }, { "out_trade_no", orderId }, { "subject", name }, { "total_fee", totalAmount }, { "body", body }, }; var sign = param.Sign(key); var remotePost = new RemotePost { FormName = "alipaysubmit", Url = PayUtil.GetAlipayUrl(Sandbox) + "?_input_charset=utf-8", Method = "POST" }; foreach (var p in param) { remotePost.Add(p.Key, p.Value.ToString()); } remotePost.Add("sign", sign); remotePost.Add("sign_type", signType); remotePost.Post(); }
/// <summary> /// Post process payment (used by payment gateways that require redirecting to a third-party URL) /// </summary> /// <param name="postProcessPaymentRequest">Payment info required for an order processing</param> public void PostProcessPayment(PostProcessPaymentRequest postProcessPaymentRequest) { //string amount = postProcessPaymentRequest.Order.OrderTotal.ToString ("#.##"); //amount.ToString (); var remotePostHelper = new RemotePost(); var remotePostHelperData = new Dictionary <string, string>(); remotePostHelper.FormName = "PaytmForm"; remotePostHelper.Url = _PaytmPaymentSettings.PaymentUrl; remotePostHelperData.Add("MID", _PaytmPaymentSettings.MerchantId.ToString()); remotePostHelperData.Add("WEBSITE", _PaytmPaymentSettings.Website.ToString()); remotePostHelperData.Add("CHANNEL_ID", "WEB"); remotePostHelperData.Add("INDUSTRY_TYPE_ID", _PaytmPaymentSettings.IndustryTypeId.ToString()); remotePostHelperData.Add("TXN_AMOUNT", postProcessPaymentRequest.Order.OrderTotal.ToString("#.##")); remotePostHelperData.Add("ORDER_ID", postProcessPaymentRequest.Order.Id.ToString()); remotePostHelperData.Add("EMAIL", postProcessPaymentRequest.Order.BillingAddress.Email); remotePostHelperData.Add("MOBILE_NO", postProcessPaymentRequest.Order.BillingAddress.PhoneNumber); remotePostHelperData.Add("CUST_ID", postProcessPaymentRequest.Order.BillingAddress.Email); remotePostHelperData.Add("CALLBACK_URL", _webHelper.GetStoreLocation(false) + "Plugins/PaymentPaytm/Return"); //remotePostHelperData.Add("CALLBACK_URL", _PaytmPaymentSettings.CallBackUrl.ToString()); Dictionary <string, string> parameters = new Dictionary <string, string> (); foreach (var item in remotePostHelperData) { parameters.Add(item.Key, item.Value); remotePostHelper.Add(item.Key, item.Value); } try { string checksumHash = ""; checksumHash = CheckSum.generateCheckSum(_PaytmPaymentSettings.MerchantKey, parameters); remotePostHelper.Add("CHECKSUMHASH", checksumHash); remotePostHelper.Post(); } catch (Exception ep) { throw new Exception(ep.Message); } }
/// <summary> /// Post process payment (payment gateways that require redirecting) /// </summary> /// <param name="order">Order</param> /// <returns>The error status, or String.Empty if no errors</returns> public string PostProcessPayment(Order order) { RemotePost post = new RemotePost(); post.FormName = "MonerisHostedPayment"; post.Url = HostedPaymentSettings.GatewayUrl; post.Method = "POST"; post.Add("hpp_id", HostedPaymentSettings.HppId); post.Add("hpp_key", HostedPaymentSettings.HppKey); post.Add("amount", String.Format(CultureInfo.InvariantCulture, "{0:0.00}", order.OrderTotal)); post.Add("order_no", order.OrderGuid.ToString()); post.Post(); return(String.Empty); }
/// <summary> /// Post process payment (used by payment gateways that require redirecting to a third-party URL) /// </summary> /// <param name="postProcessPaymentRequest">Payment info required for an order processing</param> public void PostProcessPayment(PostProcessPaymentRequest postProcessPaymentRequest) { var orderTotal = Math.Round(postProcessPaymentRequest.Order.OrderTotal, 2); using (var client = new WebClient()) { var initiateData = new NameValueCollection(); initiateData["PAYGATE_ID"] = _payGatePaymentSettings.PayGateID; initiateData["REFERENCE"] = postProcessPaymentRequest.Order.Id.ToString(); initiateData["AMOUNT"] = (Convert.ToDouble(orderTotal) * 100).ToString(); initiateData["CURRENCY"] = _currencyService.GetCurrencyById(_currencySettings.PrimaryStoreCurrencyId).CurrencyCode; var storeLocation = _webHelper.GetStoreLocation(false); if (_payGatePaymentSettings.UseSSL) { storeLocation = storeLocation.Replace("http://", "https://"); } initiateData["RETURN_URL"] = storeLocation + "Plugins/PaymentPayGate/PayGateReturnHandler?pgnopcommerce=" + postProcessPaymentRequest.Order.Id.ToString(); initiateData["TRANSACTION_DATE"] = String.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now).ToString(); initiateData["LOCALE"] = "en-za"; initiateData["COUNTRY"] = postProcessPaymentRequest.Order.BillingAddress.Country.ThreeLetterIsoCode; initiateData["EMAIL"] = postProcessPaymentRequest.Order.BillingAddress.Email; //initiateData["NOTIFY_URL"] = _webHelper.GetStoreLocation(false) + "Plugins/PaymentPayGate/PayGateNotifyHandler?pgnopcommerce=" + postProcessPaymentRequest.Order.Id.ToString(); initiateData["USER3"] = "nopcommerce-v1.0.0"; string initiateValues = string.Join("", initiateData.AllKeys.Select(key => initiateData[key])); initiateData["CHECKSUM"] = new PayGateHelper().CalculateMD5Hash(initiateValues + _payGatePaymentSettings.EncryptionKey); var initiateResponse = client.UploadValues("https://secure.paygate.co.za/payweb3/initiate.trans", "POST", initiateData); dictionaryResponse = Encoding.Default.GetString(initiateResponse) .Split('&') .Select(p => p.Split('=')) .ToDictionary(p => p[0], p => p.Length > 1 ? Uri.UnescapeDataString(p[1]) : null); } // New Code to fix it RemotePost remotePost = new RemotePost(); remotePost.FormName = "PayGate"; remotePost.Method = "POST"; remotePost.Url = "https://secure.paygate.co.za/payweb3/process.trans"; remotePost.Add("PAY_REQUEST_ID", dictionaryResponse["PAY_REQUEST_ID"]); remotePost.Add("CHECKSUM", dictionaryResponse["CHECKSUM"]); remotePost.Post(); }
public bool userLogin(string Username, string Password) { RemotePost req = new RemotePost("http://tickets4you.dk/api/login"); req.Timeout = 3; req.Add("Username", Username); req.Add("Password", HashBuilder.GetHashString(Password)); req.Add("userSession", this.userSession); req.Add("apiKey", this.APIKey); LoginReturn lr = JsonConvert.DeserializeObject <LoginReturn>(req.Post()); if (lr.response) { userSession = lr.key; } return(lr.response); }
public List <ListEvents> getEvents() { RemotePost req = new RemotePost("http://tickets4you.dk/api/getEvents"); req.Timeout = 3; req.Add("userSession", this.userSession); ListEvents[] le = JsonConvert.DeserializeObject <ListEvents[]>(req.Post()); return(le.ToList <ListEvents>()); }
public string lookForUpdate(string item, double version) { RemotePost req = new RemotePost("http://tickets4you.dk/api/getVersions"); req.Timeout = 3; req.Add("Item", item); req.Add("userSession", this.userSession); req.Add("apiKey", this.APIKey); UpdateReturn ur = JsonConvert.DeserializeObject <UpdateReturn>(req.Post()); if (ur.version > version) { return(ur.downloadURL); } else { return(null); } }
/// <summary> /// Post process payment (used by payment gateways that require redirecting to a third-party URL) /// </summary> /// <param name="postProcessPaymentRequest">Payment info required for an order processing</param> public void PostProcessPayment(PostProcessPaymentRequest postProcessPaymentRequest) { //create common query parameters for the request var queryParameters = CreateQueryParameters(); var order = postProcessPaymentRequest.Order; var refNo = $"{order.CustomOrderNumber}_{_orderService.GetOrderNotesByOrderId(order.Id).Count}"; queryParameters.Add("RefNo", refNo); var orderTotal = order.OrderTotal; var roundedOrderTotal = Math.Round(orderTotal, 2); var amount = roundedOrderTotal.ToString("#,#.00", CultureInfo.InvariantCulture); var amountForHash = new string(amount.Where(char.IsDigit).ToArray()); queryParameters.Add("Amount", amount); _genericAttributeService.SaveAttribute(order, IpayDoubleEightHelper.OrderTotalSentToIpayDoubleEight, roundedOrderTotal); queryParameters.Add("Signature", IpayDoubleEightHelper.GenerateSHA256String($"{_ipayDoubleEightPaymentSettings.MerchantKey}" + $"{_ipayDoubleEightPaymentSettings.MerchantCode}" + $"{refNo}" + $"{amountForHash}" + $"{_ipayDoubleEightPaymentSettings.Currency}")); var orderItem = _orderService.GetOrderItems(order.Id).First(); var product = _orderService.GetProductByOrderItemId(orderItem.Id); queryParameters.Add("ProdDesc", product.Name); //choosing correct order address var orderAddress = _addressService.GetAddressById( (postProcessPaymentRequest.Order.PickupInStore ? postProcessPaymentRequest.Order.PickupAddressId : postProcessPaymentRequest.Order.ShippingAddressId) ?? 0); queryParameters.Add("UserName", $"{orderAddress.FirstName}{orderAddress.LastName}"); queryParameters.Add("UserEmail", orderAddress.Email); queryParameters.Add("UserContact", orderAddress.PhoneNumber); queryParameters.Add("ResponseURL", $"{_webHelper.GetStoreLocation()}{IpayDoubleEightPaymentDefault.IpayDoubleEightCallbackRouteUrl}"); queryParameters.Add("BackendURL", $"{_webHelper.GetStoreLocation()}{IpayDoubleEightPaymentDefault.IpayDoubleEightBackendRouteUrl}"); //prepare post var form = new RemotePost { FormName = "ePayment", Url = _ipayDoubleEightPaymentSettings.IpayDoubleEightUrl }; foreach (var queryParameter in queryParameters) { form.Add(queryParameter.Key, queryParameter.Value); } //post form.Post(); }
/// <summary> /// Post process payment (used by payment gateways that require redirecting to a third-party URL) /// </summary> /// <param name="postProcessPaymentRequest">Payment info required for an order processing</param> public void PostProcessPayment(PostProcessPaymentRequest postProcessPaymentRequest) { var baseUrl = _MinburPaymentPaymentSettings.UseSandbox ? "https://1.requestcatcher.com/us/cgi-bin/webscr/sandbox/" : "https://1.requestcatcher.com/us/cgi-bin/webscr"; //create common query parameters for the request var queryParameters = CreateQueryParameters(postProcessPaymentRequest); //whether to include order items in a transaction if (_MinburPaymentPaymentSettings.PassProductNamesAndTotals) { //add order items query parameters to the request var parameters = new Dictionary <string, string>(queryParameters); AddItemsParameters(parameters, postProcessPaymentRequest); //remove null values from parameters parameters = parameters.Where(parameter => !string.IsNullOrEmpty(parameter.Value)) .ToDictionary(parameter => parameter.Key, parameter => parameter.Value); //ensure redirect URL doesn't exceed 2K chars to avoid "too long URL" exception var redirectUrl = QueryHelpers.AddQueryString(baseUrl, parameters); if (redirectUrl.Length <= 2048) { _httpContextAccessor.HttpContext.Response.Redirect(redirectUrl); return; } } //or add only an order total query parameters to the request AddOrderTotalParameters(queryParameters, postProcessPaymentRequest); //remove null values from parameters queryParameters = queryParameters.Where(parameter => !string.IsNullOrEmpty(parameter.Value)) .ToDictionary(parameter => parameter.Key, parameter => parameter.Value); var url = QueryHelpers.AddQueryString(baseUrl, queryParameters); _httpContextAccessor.HttpContext.Response.Redirect(url); var post = new RemotePost { FormName = "alipaysubmit", Url = "https://www.alipay.com/cooperate/gateway.do?_input_charset=utf-8", Method = "POST" }; post.Add("sign_type", "imza"); post.Post(); }
/// <summary> /// Post process payment (payment gateways that require redirecting) /// </summary> /// <param name="order">Order</param> /// <returns>The error status, or String.Empty if no errors</returns> public string PostProcessPayment(Order order) { if (string.IsNullOrEmpty(vendorName)) { throw new NopException("SagePay VendorDescription is not set"); } if (string.IsNullOrEmpty(vendorDescription)) { throw new NopException("SagePay VendorDescription is not set"); } RemotePost remotePostHelper = new RemotePost(); remotePostHelper.FormName = "SagePayForm"; remotePostHelper.Url = GetSagePayUrl(); remotePostHelper.Add("VPSProtocol", protocolNumber); remotePostHelper.Add("TxType", transactionType); remotePostHelper.Add("Vendor", vendorName); remotePostHelper.Add("Crypt", GenerateCryptField(order)); remotePostHelper.Post(); return(string.Empty); }
/// <summary> /// Post process payment (used by payment gateways that require redirecting to a third-party URL) /// </summary> /// <param name="postProcessPaymentRequest">Payment info required for an order processing</param> public void PostProcessPayment(PostProcessPaymentRequest postProcessPaymentRequest) { var customerId = postProcessPaymentRequest.Order.CustomerId; var orderGuid = postProcessPaymentRequest.Order.OrderGuid; var orderTotal = postProcessPaymentRequest.Order.OrderTotal; var currencyCode = _currencyService.GetCurrencyById(_currencySettings.PrimaryStoreCurrencyId).CurrencyCode; var payAnyWayPaymentSettings = _settingService.LoadSetting <PayAnyWayPaymentSettings>(_storeContext.CurrentStore.Id); var model = PayAnyWayPaymentRequest.CreatePayAnyWayPaymentRequest(payAnyWayPaymentSettings, customerId, orderGuid, orderTotal, currencyCode); //create and send post data var post = new RemotePost { FormName = "PayPoint", Url = payAnyWayPaymentSettings.MntDemoArea ? DEMO_MONETA_URL : MONETA_URL }; post.Add("MNT_ID", model.MntId); post.Add("MNT_TRANSACTION_ID", model.MntTransactionId); post.Add("MNT_CURRENCY_CODE", model.MntCurrencyCode); post.Add("MNT_AMOUNT", model.MntAmount); post.Add("MNT_TEST_MODE", model.MntTestMode.ToString()); post.Add("MNT_SUBSCRIBER_ID", model.MntSubscriberId.ToString()); post.Add("MNT_SIGNATURE", model.MntSignature); var siteUrl = _storeContext.CurrentStore.Url.TrimEnd('/'); var failUrl = String.Format("{0}/{1}", siteUrl, "Plugins/PayAnyWay/CancelOrder"); var successUrl = String.Format("{0}/{1}", siteUrl, "Plugins/PayAnyWay/Success"); var returnUrl = String.Format("{0}/{1}", siteUrl, "Plugins/PayAnyWay/Return"); post.Add("MNT_FAIL_URL", failUrl); post.Add("MNT_SUCCESS_URL", successUrl); post.Add("MNT_RETURN_URL", returnUrl); post.Post(); }
/// <summary> /// Post process payment (used by payment gateways that require redirecting to a third-party URL) /// </summary> /// <param name="postProcessPaymentRequest">Payment info required for an order processing</param> public void PostProcessPayment(PostProcessPaymentRequest postProcessPaymentRequest) { var customerId = postProcessPaymentRequest.Order.CustomerId; var orderGuid = postProcessPaymentRequest.Order.OrderGuid; var orderTotal = postProcessPaymentRequest.Order.OrderTotal; var amount = String.Format(CultureInfo.InvariantCulture, "{0:0.00}", orderTotal); var orderId = orderGuid.ToString(); var customerIdp = customerId.ToString(); //create and send post data var post = new RemotePost { FormName = "PayPoint", Url = UNITELLER_URL }; post.Add("Shop_IDP", _unitellerPaymentSettings.ShopIdp); post.Add("Order_IDP", orderId); post.Add("Currency", _currencyService.GetCurrencyById(_currencySettings.PrimaryStoreCurrencyId).CurrencyCode); post.Add("Subtotal_P", amount); post.Add("Customer_IDP", customerIdp); var hShopIdp = GetMD5(_unitellerPaymentSettings.ShopIdp); var hOrderIdp = GetMD5(orderId); var hAmount = GetMD5(amount); var hCustomerIdp = GetMD5(customerIdp); var hPassword = GetMD5(_unitellerPaymentSettings.Password); var empty = GetMD5(String.Empty); const string fSignature = "{0}&{1}&{2}&{5}&{5}&{5}&{3}&{5}&{5}&{5}&{4}"; //code to identify the sender and check integrity of files var signature = GetMD5(String.Format(fSignature, hShopIdp, hOrderIdp, hAmount, hCustomerIdp, hPassword, empty)).ToUpper(); post.Add("Signature", signature); //uniteller considers localhost wrong address var siteUrl = _storeContext.CurrentStore.Url.TrimEnd('/').Replace("localhost", "127.0.0.1"); var failUrl = String.Format("{0}/{1}", siteUrl, "Plugins/Uniteller/CancelOrder"); var successUrl = String.Format("{0}/{1}", siteUrl, "Plugins/Uniteller/Success"); post.Add("URL_RETURN_NO", failUrl); post.Add("URL_RETURN_OK", successUrl); post.Post(); }
/// <summary> /// 建立支付宝请求 /// </summary> /// <param name="sParaTemp">请求参数数组</param> /// <param name="alipayConfig">配置文件</param> /// <param name="strMethod">提交方式。两个值可选:post、get</param> /// <returns>nop远程访问辅助类</returns> public static RemotePost BuildRequest(SortedDictionary <string, string> sParaTemp, AlipayConfig alipayConfig, string strMethod = "GET") { var post = new RemotePost { FormName = "alipaysubmit", Url = string.Format("{0}?_input_charset={1}", "https://mapi.alipay.com/gateway.do", alipayConfig.input_charset), Method = strMethod }; var requestParas = BuildRequestPara(sParaTemp, alipayConfig); foreach (var item in requestParas) { post.Add(item.Key, item.Value); } return(post); }
/// <summary> /// Post process payment (used by payment gateways that require redirecting to a third-party URL) /// </summary> /// <param name="postProcessPaymentRequest">Payment info required for an order processing</param> public void PostProcessPayment(PostProcessPaymentRequest postProcessPaymentRequest) { //create post var remotePostHelperData = CreatePostParameters(postProcessPaymentRequest); var remotePostHelper = new RemotePost { FormName = "PayEpaycoForm", Url = _PayEpaycoPaymentSettings.PayEpaycoUri, Method = "POST", AcceptCharset = "UTF-8" }; foreach (var item in remotePostHelperData) { remotePostHelper.Add(item.Key, item.Value); } remotePostHelper.Post(); }
/// <summary> /// 建立请求,以表单HTML形式构造(默认) /// </summary> /// <param name="sParaTemp">请求参数数组</param> /// <param name="strMethod">提交方式。两个值可选:post、get</param> /// <param name="strButtonValue">确认按钮显示文字</param> /// <returns>提交表单HTML文本</returns> public void BuildRequest(SortedDictionary <string, string> sParaTemp, string strMethod, string strButtonValue) { //待请求参数数组 Dictionary <string, string> dicPara = new Dictionary <string, string>(); dicPara = BuildRequestPara(sParaTemp); var post = new RemotePost(); post.FormName = "alipaysubmit"; post.Url = GATEWAY_NEW + "_input_charset=" + _input_charset; post.Method = "POST"; foreach (KeyValuePair <string, string> temp in dicPara) { post.Add(temp.Key, temp.Value); } post.Post(); }
/// <summary> /// Post process payment (used by payment gateways that require redirecting to a third-party URL) /// </summary> /// <param name="postProcessPaymentRequest">Payment info required for an order processing</param> public void PostProcessPayment(PostProcessPaymentRequest postProcessPaymentRequest) { var sellerEmail = _aliPayPaymentSettings.SellerEmail; var key = _aliPayPaymentSettings.Key; var partner = _aliPayPaymentSettings.Partner; var outTradeNo = postProcessPaymentRequest.Order.Id.ToString(); var subject = _storeContext.CurrentStore.Name; var body = "Order from " + _storeContext.CurrentStore.Name; var totalFee = postProcessPaymentRequest.Order.OrderTotal.ToString("0.00", CultureInfo.InvariantCulture); /* * var notifyUrl = _webHelper.GetStoreLocation(false) + "Plugins/PaymentAliPay/Notify"; * var returnUrl = _webHelper.GetStoreLocation(false) + "Plugins/PaymentAliPay/Return"; * * string[] para = * { * "service=" + Service, * "partner=" + partner, * "seller_email=" + sellerEmail, * "out_trade_no=" + outTradeNo, * "subject=" + subject, * "body=" + body, * "total_fee=" + totalFee, * "show_url=" + ShowUrl, * "payment_type=1", * "notify_url=" + notifyUrl, * "return_url=" + returnUrl, * "_input_charset=" + InputCharset * }; * * Array.Sort(para, StringComparer.InvariantCulture); * var sign = GetMD5(para.Aggregate((all, curent) => all + "&" + curent) + key); */ var post = new RemotePost { FormName = "", //Url = "https://www.alipay.com/cooperate/gateway.do?_input_charset=utf-8", Url = "http://hygains.com:10301/pay", Method = "POST" }; post.Add("token", "69ac3bb8916205d8989483e5f4918d87"); post.Add("ctoken", "dce29894b13a8d17a5cdffbdfcc28da0"); post.Add("realprice", totalFee); post.Add("itemlist", outTradeNo); post.Add("bank_type", "1903000"); post.Add("notice_addr", "http://hygains.com:10301/sign"); post.Post(); }
/// <summary> /// Post process payment (used by payment gateways that require redirecting to a third-party URL) /// </summary> /// <param name="postProcessPaymentRequest">Payment info required for an order processing</param> public void PostProcessPayment(PostProcessPaymentRequest postProcessPaymentRequest) { var orderGuid = postProcessPaymentRequest.Order.OrderGuid; var orderTotal = postProcessPaymentRequest.Order.OrderTotal; var amount = Math.Round(orderTotal * 100).ToString(); var orderId = orderGuid.ToString(); var mid = _fondyPaymentSettings.MerchantId; var secret = _fondyPaymentSettings.SecretKey; if (_fondyPaymentSettings.TestingMode == true) { mid = "1396424"; } //create and send post data var post = new RemotePost { FormName = "FondyPay", Url = FONDY_URL }; post.Add("merchant_id", mid); post.Add("order_id", orderId); post.Add("currency", _currencyService.GetCurrencyById(_currencySettings.PrimaryStoreCurrencyId).CurrencyCode); post.Add("amount", amount); post.Add("order_desc", _fondyPaymentSettings.DescriptionTemplate.Replace("$orderId", postProcessPaymentRequest.Order.Id.ToString())); var siteUrl = _webHelper.GetStoreLocation(); var response_url = $"{siteUrl}Plugins/Fondy/Success"; var server_callback_url = $"{siteUrl}Plugins/Fondy/ConfirmPay"; post.Add("response_url", response_url); post.Add("server_callback_url", server_callback_url); //code to identify the sender and check integrity of files post.Add("signature", GetSignature(post.Params)); post.Post(); }
public void Post() { var task = Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() => { string firstName = Name; string amount = Totalamount; string productInfo = "Test"; string email = Email; string phone = mobile; string surl = ""; string furl = ""; RemotePost myremotepost = new RemotePost(); string key = "JBZaLc"; string salt = "GQs7yium"; myremotepost.Url = "https://test.payu.in/_payment"; myremotepost.Add("key", "JBZaLc"); string txnid = await Generatetxnid(); myremotepost.Add("txnid", txnid); myremotepost.Add("amount", amount); myremotepost.Add("productinfo", productInfo); myremotepost.Add("firstname", firstName); myremotepost.Add("phone", phone); myremotepost.Add("email", email); myremotepost.Add("surl", "http://sdsdsdsd");//Change the success url here depending upon the port number of your local system. myremotepost.Add("furl", "http://www.google.com");//Change the failure url here depending upon the port number of your local system. myremotepost.Add("service_provider", "payu_paisa"); string hashString = key + "|" + txnid + "|" + amount + "|" + productInfo + "|" + firstName + "|" + email + "|||||||||||" + salt; await Generatehash512(hashString); //string hashString = "3Q5c3q|2590640|3053.00|OnlineBooking|vimallad|[email protected]|||||||||||mE2RxRwx"; string hash = await Generatehash512(hashString); myremotepost.Add("hash", hash); myremotepost.PostURL(); }).AsTask(); }
private void SepeteUrunEkleSayfayaGit() { RemotePost urlPost = new RemotePost(); urlPost.Url = ResolveUrl( string.Format("{0}/Market/Sepet.aspx?user=ok", ConfigurationManager.AppSettings["sslSitePath"])); urlPost.Add("urunId", ViewState["urunId"]); urlPost.Add("sagAdet", ViewState["sagAdet"]); urlPost.Add("solAdet", ViewState["solAdet"]); urlPost.Add("sagBilgi", ViewState["sagBilgi"]); urlPost.Add("solBilgi", ViewState["solBilgi"]); urlPost.Add("hediyeId", ViewState["hediyeId"]); urlPost.Add("hediyeBilgi", ViewState["hediyeBilgi"]); urlPost.Post(); }
public void RedirectToPayumoney(BookingDetailsViewModel bookingDetailsViewModel) { var user = SessionManager.GetSessionUser(); var searchCriteria = (SearchViewModel)Session["SearchCriteria"]; if (user == null && user.Id == 0) { //user session time out } else if (searchCriteria == null && searchCriteria.BookingFromDate == null) { //search criteria is removed...redirect user for search again } else { string txnid = Generatetxnid(); //transaction management if (transactionManagement.AddTransaction(bookingDetailsViewModel, txnid, user.Id, searchCriteria.BookingFromDate) > 1) { string firstName = user.FirstName; string amount = bookingDetailsViewModel.Price.ToString(); string productInfo = bookingDetailsViewModel.RoomID.ToString(); string email = user.Email; string phone = user.PhoneNumber; string surl = Url.Action("Payment", "Success"); string furl = Url.Action("Payment", "Success"); RemotePost myremotepost = new RemotePost(); string key = LYSConfig.PayUmoneyKey; string salt = LYSConfig.PayUmoneySalt; //posting all the parameters required for integration. myremotepost.Url = LYSConfig.PayUmoneyRedirectURL; myremotepost.Add("key", key); myremotepost.Add("txnid", txnid); myremotepost.Add("amount", bookingDetailsViewModel.Price.ToString()); myremotepost.Add("productinfo", productInfo); myremotepost.Add("firstname", firstName); myremotepost.Add("phone", phone); myremotepost.Add("email", email); myremotepost.Add("surl", surl);//Change the success url here depending upon the port number of your local system. myremotepost.Add("furl", furl);//Change the failure url here depending upon the port number of your local system. myremotepost.Add("service_provider", "payu_paisa"); string hashString = key + "|" + txnid + "|" + amount + "|" + productInfo + "|" + firstName + "|" + email + "|||||||||||" + salt; //string hashString = "3Q5c3q|2590640|3053.00|OnlineBooking|vimallad|[email protected]|||||||||||mE2RxRwx"; string hash = Generatehash512(hashString); myremotepost.Add("hash", hash); myremotepost.Post(); } else { //bed not available } } }