Ejemplo n.º 1
0
        /// <summary>
        /// 校验支付结果参数及签名是否合法(请勿修改本代码)
        /// </summary>
        /// <param name="data">通联支付数据</param>
        /// <returns></returns>
        public static bool VerifyResultSign(AllinpayData data)
        {
            PaymentResult paymentResult = new PaymentResult();

            paymentResult.setMerchantId(data.GetValue("merchantId"));
            paymentResult.setVersion(data.GetValue("version"));
            paymentResult.setLanguage(data.GetValue("language"));
            paymentResult.setSignType(data.GetValue("signType"));
            paymentResult.setPayType(data.GetValue("payType"));
            paymentResult.setIssuerId(data.GetValue("issuerId"));
            paymentResult.setPaymentOrderId(data.GetValue("paymentOrderId"));
            paymentResult.setOrderNo(data.GetValue("orderNo"));
            paymentResult.setOrderDatetime(data.GetValue("orderDatetime"));
            paymentResult.setOrderAmount(data.GetValue("orderAmount"));
            paymentResult.setPayDatetime(data.GetValue("payDatetime"));
            paymentResult.setPayAmount(data.GetValue("payAmount"));
            paymentResult.setExt1(data.GetValue("ext1"));
            paymentResult.setExt2(data.GetValue("ext2"));
            paymentResult.setPayResult(data.GetValue("payResult"));
            paymentResult.setErrorCode(data.GetValue("errorCode"));
            paymentResult.setReturnDatetime(data.GetValue("returnDatetime"));
            paymentResult.setKey(AppConfig.Global.AllinpayKey);
            paymentResult.setSignMsg(data.GetValue("signMsg"));
            string certPath = Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, AppConfig.Global.AllinpaySSLCertPath);

            paymentResult.setCertPath(certPath);
            bool verifyResult = paymentResult.verify();

            return(verifyResult);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 退款参数签名(请勿修改本代码,特别是参数顺序)
        /// </summary>
        /// <param name="data">通联支付数据</param>
        /// <returns></returns>
        public static string RefundSign(AllinpayData data)
        {
            StringBuilder buf = new StringBuilder();

            StringUtil.appendSignPara(buf, "version", data.GetValue("version"));
            StringUtil.appendSignPara(buf, "signType", data.GetValue("signType"));
            StringUtil.appendSignPara(buf, "merchantId", data.GetValue("merchantId"));
            StringUtil.appendSignPara(buf, "orderNo", data.GetValue("orderNo"));
            StringUtil.appendSignPara(buf, "refundAmount", data.GetValue("refundAmount"));
            StringUtil.appendSignPara(buf, "orderDatetime", data.GetValue("orderDatetime"));
            StringUtil.appendLastSignPara(buf, "key", AppConfig.Global.AllinpayKey);
            string sign = SecurityUtil.MD5Encode(buf.ToString());

            return(sign);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 支付参数签名(请勿修改本代码)
        /// </summary>
        /// <param name="data">通联支付数据</param>
        /// <returns></returns>
        public static string RequestSign(AllinpayData data)
        {
            RequestOrder requestOrder = new RequestOrder();

            requestOrder.setInputCharset(data.GetValue("inputCharset"));
            requestOrder.setPickupUrl(data.GetValue("pickupUrl"));
            requestOrder.setReceiveUrl(data.GetValue("receiveUrl"));
            requestOrder.setVersion(data.GetValue("version"));
            requestOrder.setLanguage(data.GetValue("language"));
            requestOrder.setSignType(data.GetValue("signType"));
            requestOrder.setMerchantId(data.GetValue("merchantId"));
            requestOrder.setPayerName(data.GetValue("payerName"));
            requestOrder.setPayerEmail(data.GetValue("payerEmail"));
            requestOrder.setPayerTelephone(data.GetValue("payerTelephone"));
            requestOrder.setPayerIDCard(data.GetValue("payerIDCard"));
            requestOrder.setPid(data.GetValue("pid"));
            requestOrder.setOrderNo(data.GetValue("orderNo"));
            requestOrder.setOrderAmount(data.GetValue("orderAmount"));
            requestOrder.setOrderCurrency(data.GetValue("orderCurrency"));
            requestOrder.setOrderDatetime(data.GetValue("orderDatetime"));
            requestOrder.setOrderExpireDatetime(data.GetValue("orderExpireDatetime"));
            requestOrder.setProductName(data.GetValue("productName"));
            requestOrder.setProductPrice(data.GetValue("productPrice"));
            requestOrder.setProductNum(data.GetValue("productNum"));
            requestOrder.setProductId(data.GetValue("productId"));
            requestOrder.setProductDesc(data.GetValue("productDesc"));
            requestOrder.setExt1(data.GetValue("ext1"));
            requestOrder.setExt2(data.GetValue("ext2"));
            requestOrder.setExtTL(data.GetValue("extTL"));
            requestOrder.setPayType(data.GetValue("payType"));
            requestOrder.setIssuerId(data.GetValue("issuerId"));
            requestOrder.setPan(data.GetValue("pan"));
            requestOrder.setTradeNature(data.GetValue("tradeNature"));
            requestOrder.setKey(AppConfig.Global.AllinpayKey);
            string sign = requestOrder.doSign();

            return(sign);
        }