/// <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 gateway = "https://www.alipay.com/cooperate/gateway.do?";
            string service = "create_direct_pay_by_user";

            string seller_email = _aliPayPaymentSettings.SellerEmail;
            string sign_type = "MD5";
            string key = _aliPayPaymentSettings.Key;
            string partner = _aliPayPaymentSettings.Partner;

            string input_charset = "utf-8";

            string show_url = "http://www.alipay.com/";

            string out_trade_no = postProcessPaymentRequest.Order.Id.ToString();
            string subject = _storeContext.CurrentStore.Name;
            string body = "Order from " + _storeContext.CurrentStore.Name;
            string total_fee = postProcessPaymentRequest.Order.OrderTotal.ToString("0.00", CultureInfo.InvariantCulture);

            string notify_url = _webHelper.GetStoreLocation(false) + "Plugins/PaymentAliPay/Notify";
            string return_url = _webHelper.GetStoreLocation(false) + "Plugins/PaymentAliPay/Return";
            string[] para ={
                               "service="+service,
                               "partner=" + partner,
                               "seller_email=" + seller_email,
                               "out_trade_no=" + out_trade_no,
                               "subject=" + subject,
                               "body=" + body,
                               "total_fee=" + total_fee,
                               "show_url=" + show_url,
                               "payment_type=1",
                               "notify_url=" + notify_url,
                               "return_url=" + return_url,
                               "_input_charset=" + input_charset
                           };

            string aliay_url = CreatUrl(
                para,
                input_charset,
                key
                );
            var post = new RemotePost();
            post.FormName = "alipaysubmit";
            post.Url = "https://www.alipay.com/cooperate/gateway.do?_input_charset=utf-8";
            post.Method = "POST";

            post.Add("service", service);
            post.Add("partner", partner);
            post.Add("seller_email", seller_email);
            post.Add("out_trade_no", out_trade_no);
            post.Add("subject", subject);
            post.Add("body", body);
            post.Add("total_fee", total_fee);
            post.Add("show_url", show_url);
            post.Add("return_url", return_url);
            post.Add("notify_url", notify_url);
            post.Add("payment_type", "1");
            post.Add("sign", aliay_url);
            post.Add("sign_type", sign_type);

            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)
        {
            RemotePost post = new RemotePost();
            post.FormName = "chinabanksubmit";
            post.Url = "https://pay3.chinabank.com.cn/PayGate";
            post.Method = "POST";

            //��Ҫ�Ľ�����Ϣ
            string v_amount;       // �������
            string v_moneytype;    // ����
            string v_md5info;      // ��ƴ�մ�MD5˽Կ���ܺ��ֵ
            string v_mid;		 // �̻���
            string v_url;		 // ����ҳ��ַ
            string v_oid;		 // �Ƽ������Ź��ɸ�ʽΪ ������-�̻���-Сʱ������
            //�ջ���Ϣ
            string v_rcvname;      // �ջ���
            string v_rcvaddr;      // �ջ���ַ
            string v_rcvtel;       // �ջ��˵绰
            string v_rcvpost;      // �ջ����ʱ�
            string v_rcvemail;     // �ջ����ʼ�
            string v_rcvmobile;    // �ջ����ֻ���
            //��������Ϣ
            string v_ordername;    // ����������
            string v_orderaddr;    // �����˵�ַ
            string v_ordertel;     // �����˵绰
            string v_orderpost;    // �������ʱ�
            string v_orderemail;   // �������ʼ�
            string v_ordermobile;  // �������ֻ���

            //������ע
            string remark1;
            string remark2;

            v_mid = _chinabankPayPaymentSettings.Vmid;
            v_url = _webHelper.GetStoreLocation(false) + "Plugins/PaymentChinabank/Notify";
            string key = _chinabankPayPaymentSettings.Key;
            v_oid = postProcessPaymentRequest.Order.Id.ToString();

            if (v_oid == null || v_oid.Equals(""))
            {
                DateTime dt = DateTime.Now;
                string v_ymd = dt.ToString("yyyyMMdd"); // yyyyMMdd
                string timeStr = dt.ToString("HHmmss"); // HHmmss
                v_oid = v_ymd + v_mid + timeStr;
            }

            v_amount = postProcessPaymentRequest.Order.OrderTotal.ToString("0.00", CultureInfo.InvariantCulture);
            v_moneytype = "CNY";
            string text = v_amount + v_moneytype + v_oid + v_mid + v_url + key; // ƴ�ռ��ܴ�
            v_md5info = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(text, "md5").ToUpper();

            //�ջ���Ϣ
            v_rcvname = String.Empty;
            v_rcvaddr = postProcessPaymentRequest.Order.BillingAddress.Address1;
            v_rcvtel = postProcessPaymentRequest.Order.BillingAddress.PhoneNumber;
            v_rcvpost = postProcessPaymentRequest.Order.BillingAddress.ZipPostalCode;
            v_rcvemail = postProcessPaymentRequest.Order.BillingAddress.Email;
            v_rcvmobile = postProcessPaymentRequest.Order.BillingAddress.PhoneNumber;
            //��������Ϣ
            v_ordername = String.Empty;
            v_orderaddr = postProcessPaymentRequest.Order.ShippingAddress.Address1;
            v_ordertel = postProcessPaymentRequest.Order.ShippingAddress.PhoneNumber;
            v_orderpost = postProcessPaymentRequest.Order.ShippingAddress.ZipPostalCode;
            v_orderemail = postProcessPaymentRequest.Order.ShippingAddress.Email;
            v_ordermobile = postProcessPaymentRequest.Order.ShippingAddress.PhoneNumber;
            //������Ϣ
            remark1 = "";
            remark2 = "";

            post.Add("v_md5info", v_md5info);
            post.Add("v_mid", v_mid);
            post.Add("v_oid", v_oid);
            post.Add("v_amount", v_amount);
            post.Add("v_moneytype", v_moneytype);
            post.Add("v_url", v_url);
            post.Add("v_rcvname", v_rcvname);
            post.Add("v_rcvaddr", v_rcvaddr);
            post.Add("v_rcvtel", v_rcvtel);
            post.Add("v_rcvpost", v_rcvpost);
            post.Add("v_rcvemail", v_rcvemail);
            post.Add("v_rcvmobile", v_rcvmobile);
            post.Add("v_ordername", v_ordername);
            post.Add("v_orderaddr", v_orderaddr);
            post.Add("v_ordertel", v_ordertel);
            post.Add("v_orderpost", v_orderpost);
            post.Add("v_orderemail", v_orderemail);
            post.Add("v_ordermobile", v_ordermobile);
            post.Add("remark1", remark1);
            post.Add("remark2", remark2);

            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)
        {
            //��ѯ΢��֧���Ƿ����
            WxPayApi.OrderQuery()
            string service = "create_direct_pay_by_user";

            string seller_email = _weixinPayPaymentSettings.SellerEmail;
            string sign_type = "MD5";
            string key = _weixinPayPaymentSettings.Key;
            string partner = _weixinPayPaymentSettings.Partner;
            string input_charset = "utf-8";

            string show_url = _webHelper.GetStoreLocation(false);

            string out_trade_no = postProcessPaymentRequest.Order.OrderGuid.ToString();
            string subject = string.IsNullOrEmpty(_weixinPayPaymentSettings.InvoiceSubject) ? _storeContext.CurrentStore.Name : _weixinPayPaymentSettings.InvoiceSubject;
            //string body = _weixinPayPaymentSettings.InvoiceBody;
            string body = "";
            foreach (var item in postProcessPaymentRequest.Order.OrderItems)
            {
                if (item.Product.Name.Length > 100)
                    body += item.Product.Name.Substring(0, 100) + "...,";
                else
                    body += item.Product.Name + ",";

            }
            body = body.Substring(0, body.Length - 1);
            if (body.Length > 999)
            {
                body = body.Substring(0, 996) + "...";
            }

            string total_fee = postProcessPaymentRequest.Order.OrderTotal.ToString("0.00", CultureInfo.InvariantCulture);

            string notify_url = _webHelper.GetStoreLocation(false) + "Plugins/PaymentWeiXinPay/Notify";
            string return_url = _webHelper.GetStoreLocation(false) + "Plugins/PaymentWeiXinPay/Return";

            var paymethod = "directPay"; //bankPay:����֧���� directPay:֧������ʱ����
            var defaultBank = "";

            var customInfo = postProcessPaymentRequest.Order.DeserializeCustomValues();
            if (customInfo != null && customInfo.Count > 0)
            {
                if (customInfo.ContainsKey(WeiXinPayPaymentSystemNames.SelectedAlipayPayMethod))
                {
                    paymethod = customInfo[WeiXinPayPaymentSystemNames.SelectedAlipayPayMethod].ToString();
                    if (!string.IsNullOrEmpty(paymethod) && paymethod != WeiXinPayPaymentSystemNames.DirectPay)
                    {
                        //Ĭ������
                        defaultBank = paymethod;//������ݵ�paymethod������directPay,���ʾʹ������֧����paymethod��ʾ���б���

                        //Ĭ��֧����ʽ
                        paymethod = WeiXinPayPaymentSystemNames.BankPay;
                    }
                }
            }

            IList<string> paraList = new List<string>();
            paraList.Add("service=" + service);
            paraList.Add("partner=" + partner);
            paraList.Add("seller_email=" + seller_email);
            paraList.Add("out_trade_no=" + out_trade_no);
            paraList.Add("subject=" + subject);
            paraList.Add("body=" + body);
            paraList.Add("total_fee=" + total_fee);
            paraList.Add("show_url=" + show_url);
            paraList.Add("return_url=" + return_url);
            paraList.Add("notify_url=" + notify_url);
            paraList.Add("payment_type=1");
            paraList.Add("paymethod=" + paymethod);
            if (!string.IsNullOrEmpty(defaultBank))
            {
                paraList.Add("defaultbank=" + defaultBank);
            }
            paraList.Add("_input_charset=" + input_charset);

            string aliay_url = CreatUrl(
                paraList.ToArray(),
                input_charset,
                key
                );
            var post = new RemotePost();
            post.FormName = "weixinpaysubmit";
            post.Url = "https://mapi.weixinpay.com/gateway.do?_input_charset=utf-8";
            post.Method = "POST";

            post.Add("service", service);
            post.Add("partner", partner);
            post.Add("seller_email", seller_email);
            post.Add("out_trade_no", out_trade_no);
            post.Add("subject", subject);
            post.Add("body", body);
            post.Add("total_fee", total_fee);
            post.Add("show_url", show_url);
            post.Add("return_url", return_url);
            post.Add("notify_url", notify_url);
            post.Add("payment_type", "1");
            post.Add("paymethod", paymethod);
            if (!string.IsNullOrEmpty(defaultBank))
            {
                post.Add("defaultbank", defaultBank);
            }
            post.Add("sign", aliay_url);
            post.Add("sign_type", sign_type);

            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 myUtility = new PayuHelper();
            var orderId= postProcessPaymentRequest.Order.Id;
            var remotePostHelper = new RemotePost();
            remotePostHelper.FormName = "PayuForm";
            remotePostHelper.Url = _PayuPaymentSettings.PayUri;
            remotePostHelper.Add("key", _PayuPaymentSettings.MerchantId.ToString());
            remotePostHelper.Add("amount", postProcessPaymentRequest.Order.TotalTransactionAmount.ToString(new CultureInfo("en-US", false).NumberFormat));
			remotePostHelper.Add("productinfo", "productinfo");
            remotePostHelper.Add("Currency", _currencyService.GetCurrencyById(_currencySettings.PrimaryStoreCurrencyId).CurrencyCode);
            remotePostHelper.Add("Order_Id", orderId.ToString());
			remotePostHelper.Add("txnid", postProcessPaymentRequest.Order.OrderGuid.ToString());
			
            remotePostHelper.Add("surl", _webHelper.GetStoreLocation(true) + "PaymentPayu/Return");
			remotePostHelper.Add("furl", _webHelper.GetStoreLocation(true) + "PaymentPayu/Return");
            remotePostHelper.Add("hash", myUtility.getchecksum(_PayuPaymentSettings.MerchantId.ToString(),
                postProcessPaymentRequest.Order.OrderGuid.ToString(), postProcessPaymentRequest.Order.TotalTransactionAmount.ToString(new CultureInfo("en-US", false).NumberFormat),
                "productinfo",postProcessPaymentRequest.Order.BillingAddress.FirstName.ToString(),
                postProcessPaymentRequest.Order.BillingAddress.Email.ToString(),_PayuPaymentSettings.Key));


            //Billing details
            remotePostHelper.Add("firstname", postProcessPaymentRequest.Order.BillingAddress.FirstName.ToString());
            remotePostHelper.Add("billing_cust_address", postProcessPaymentRequest.Order.BillingAddress.Address1);
            remotePostHelper.Add("phone", postProcessPaymentRequest.Order.BillingAddress.PhoneNumber);
            remotePostHelper.Add("email", postProcessPaymentRequest.Order.BillingAddress.Email.ToString());
            remotePostHelper.Add("billing_cust_city", postProcessPaymentRequest.Order.BillingAddress.City);
            var billingStateProvince = postProcessPaymentRequest.Order.BillingAddress.StateProvince;
            if (billingStateProvince != null)
                remotePostHelper.Add("billing_cust_state", billingStateProvince.Abbreviation);
            else
                remotePostHelper.Add("billing_cust_state", "");
            remotePostHelper.Add("billing_zip_code", postProcessPaymentRequest.Order.BillingAddress.ZipPostalCode);
            var billingCountry = postProcessPaymentRequest.Order.BillingAddress.Country;
            if (billingCountry != null)
                remotePostHelper.Add("billing_cust_country", billingCountry.ThreeLetterIsoCode);
            else
                remotePostHelper.Add("billing_cust_country", "");

            //Delivery details

            if (postProcessPaymentRequest.Order.ShippingStatus != ShippingStatus.ShippingNotRequired)
            {
                remotePostHelper.Add("delivery_cust_name", postProcessPaymentRequest.Order.ShippingAddress.FirstName);
                remotePostHelper.Add("delivery_cust_address", postProcessPaymentRequest.Order.ShippingAddress.Address1);
                remotePostHelper.Add("delivery_cust_notes", string.Empty);
                remotePostHelper.Add("delivery_cust_tel", postProcessPaymentRequest.Order.ShippingAddress.PhoneNumber);
                remotePostHelper.Add("delivery_cust_city", postProcessPaymentRequest.Order.ShippingAddress.City);
                var deliveryStateProvince = postProcessPaymentRequest.Order.ShippingAddress.StateProvince;
                if (deliveryStateProvince != null)
                    remotePostHelper.Add("delivery_cust_state", deliveryStateProvince.Abbreviation);
                else
                    remotePostHelper.Add("delivery_cust_state", "");
                remotePostHelper.Add("delivery_zip_code", postProcessPaymentRequest.Order.ShippingAddress.ZipPostalCode);
                var deliveryCountry = postProcessPaymentRequest.Order.ShippingAddress.Country;
                if (deliveryCountry != null)
                    remotePostHelper.Add("delivery_cust_country", deliveryCountry.ThreeLetterIsoCode);
                else
                    remotePostHelper.Add("delivery_cust_country", "");
            }

          //  remotePostHelper.Add("Merchant_Param", _PayuPaymentSettings.MerchantParam);
            remotePostHelper.Post();
        }
        public void PostProcessPayment(PostProcessPaymentRequest postProcessPaymentRequest)
        {
            var customer = _customerService.GetCustomerById(postProcessPaymentRequest.Order.CustomerId);
            var post = new RemotePost();

            var processPaymentRequest = _httpContext.Session["OrderPaymentInfo"] as ProcessPaymentRequest;


            post.FormName = "YandexKassaPaymentForm";
            post.Url = GetYandexKassaUrl();
            post.Method = "POST";

            post.Add("shopId", _yandexKassaSettings.ShopId.ToString());
            post.Add("scid", _yandexKassaSettings.Scid.ToString());
            post.Add("sum", String.Format(CultureInfo.InvariantCulture, "{0:0.00}", postProcessPaymentRequest.Order.OrderTotal));
            post.Add("customerNumber", postProcessPaymentRequest.Order.BillingAddress.Email);
            post.Add("orderNumber", postProcessPaymentRequest.Order.Id.ToString());
            post.Add("shopSuccessURL", String.Format("{0}Plugins/PaymentYandexKassa/Return", _webHelper.GetStoreLocation(false)));
            post.Add("shopFailURL", String.Format("{0}Plugins/PaymentYandexKassa/Return", _webHelper.GetStoreLocation(false)) );
            post.Add("cps_email", customer.Email);
            post.Add("cps_phone", customer.BillingAddress.PhoneNumber);
            post.Add("paymentType", postProcessPaymentRequest.Order.SubscriptionTransactionId);
            post.Add("custName", postProcessPaymentRequest.Order.BillingAddress.LastName + postProcessPaymentRequest.Order.BillingAddress.FirstName);
            post.Add("custAddr", customer.BillingAddress.Address1);
            post.Add("custEMail", postProcessPaymentRequest.Order.BillingAddress.Email);
            post.Add("orderDetails", "without");

            post.Post();

        }
Example #6
0
        /// <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)
        {
            //֧������֧������ʾ��
            //�̻������ţ��˴���ϵͳʱ���3λ�������Ϊ�����ţ��̻�Ӧ�����Լ����������ȷ���ö��������̻�ϵͳ�е�ȫ��Ψһ
            string num = DateTime.Now.ToString("yyyyMMddHHmmss") + new Random().Next(999);
            string out_trade_no = postProcessPaymentRequest.Order.Id.ToString(); //���Dz��������������������
            //֧�����
            string total_fee = postProcessPaymentRequest.Order.OrderTotal.ToString("0.00", CultureInfo.InvariantCulture);
            //���Ҵ��룬����ң�RMB���۱ң�HKD����Ԫ��USD ����������յ�ҵ����Ҫ��ҵ����Ա��ϵ��ͨ��
            string currency_type = "RMB";
            //���������Ŀͻ���IP�������ߵ��Թ���IP��
            //string order_create_ip = Request.UserHostAddress;  //���������Ŀͻ���IP�������ߵ��Թ���IP�����ڷ�����֧����
            //string order_create_ip = "";
            //ǩ������
            string sign_type = "SHA256";
            //������ɺ���ת��URL�������������ص�ҳ��ת����ʱ֪ͨ���
            string return_url = _webHelper.GetStoreLocation(false) + "Plugins/PaymentAjPay/Return";
            string notify_url = _webHelper.GetStoreLocation(false) + "Plugins/PaymentAjPay/Notify";
            ////ֱ�����в�������μ��ĵ���
            //string pay_id = "gonghang";
            //������ע������Ϣʹ��64λ�����ύ��������������֧����ɺ���֧�����ԭ������
            var sbItemName = new StringBuilder();
            foreach (var orderItem in postProcessPaymentRequest.Order.OrderItems)
            {
                sbItemName.Append(orderItem.Product.Name + " ");
            }

            string memo = sbItemName.ToString();
            string store_oi_type = "0";
            byte[] bytes = System.Text.Encoding.Default.GetBytes(memo);
            string base64_memo = Convert.ToBase64String(bytes);
            //=======================�����������===========================

            string key = "h0iy0osxkkaplpxkpscc52x7o2dr0597";
            string partner = "TEST";

            IList<string> paraList = new List<string>();

            paraList.Add("out_trade_no=" + out_trade_no);
            paraList.Add("total_fee=" + total_fee);
            paraList.Add("return_url=" + return_url);
            paraList.Add("currency_type=" + currency_type);
            //paraList.Add("order_create_ip=" + order_create_ip);
            paraList.Add("sign_type=" + sign_type);

            //��ѡ����
            //paraList.Add("pay_id=" + pay_id);	        		//ֱ�����в�����������ֱ��ת������������ʱ�IJ���
            paraList.Add("base64_memo=" + base64_memo);		//������ע��BASE64����
            paraList.Add("store_oi_type=" + store_oi_type);		//������ע��BASE64����

            paraList.Add("partner=" + partner);

            string aandj_url = CreatUrl(
                paraList.ToArray(),
                key
                );
            var post = new RemotePost();
            post.FormName = "aandjsubmit";
            post.Url = "http://testgateway.ajmcl.com/paygateway/payment";
            post.Method = "GET";

            post.Add("out_trade_no", out_trade_no);
            post.Add("total_fee", total_fee);
            post.Add("return_url", return_url);
            post.Add("currency_type", currency_type);
            //post.Add("order_create_ip", order_create_ip);
            post.Add("sign_type", sign_type);

            //��ѡ����
            //post.Add("pay_id", pay_id);	        		//ֱ�����в�����������ֱ��ת������������ʱ�IJ���
            post.Add("base64_memo", base64_memo);		//������ע��BASE64����
            post.Add("store_oi_type", store_oi_type);		//������ע��BASE64����

            post.Add("partner" , partner);

            post.Add("sign", aandj_url);

            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 ("#.##"));
            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);
            }
        }