示例#1
0
        public BaseApiResponse WeChatPay(PaymentRequest request)
        {
            request.CheckNotNull(nameof(request));

            //向微信提交订单获取prepayid
            var apiPay = new ApiPay(Convert.ToInt32(request.Amount));

            WxPayData data = new WxPayData();

            data.SetValue("appid", WxPayConfig.APPID);
            data.SetValue("partnerid", WxPayConfig.MCHID);
            data.SetValue("prepayid", apiPay.GeneratePrepayId());
            data.SetValue("package", "Sign=WXPay");
            data.SetValue("noncestr", WxPayApi.GenerateNonceStr());
            data.SetValue("timestamp", WxPayApi.GenerateTimeStamp());
            data.SetValue("sign", data.MakeSign());//签名

            return(new WeChatPayResponse {
                partnerid = data.GetValue("partnerid").ToString(),
                prepayid = data.GetValue("prepayid").ToString(),
                noncestr = data.GetValue("noncestr").ToString(),
                timestamp = data.GetValue("timestamp").ToString(),
                sign = data.GetValue("sign").ToString()
            });
        }
示例#2
0
        public BaseApiResponse AliPay(PaymentRequest request)
        {
            request.CheckNotNull(nameof(request));

            var orderInfo = AliPayApi.GetAlipayOrderInfo(request.Amount, DateTime.Now.ToSerialNumber());

            return(new BaseApiResponse {
                Message = orderInfo
            });
        }