Пример #1
0
 protected override void InitBuilder(WechatpayParameterBuilder builder, WechatEntrustWebRequest param)
 {
     builder.Add("plan_id", param.PlanId).Add("contract_code", param.ContractCode)
     .Add("request_serial", param.RequestSerial).Add("contract_display_account", param.ContractDisplayAccount)
     .NotifyUrl(param.NotifyUrl).Add("version", "1.0").Timestamp().Add("return_app", param.ReturnApp).Add("return_web", param.ReturnWeb)
     .Remove(WechatpayConst.SignType).Remove(WechatpayConst.NonceStr).Remove(WechatpayConst.SpbillCreateIp);
 }
Пример #2
0
 protected override void InitBuilder(WechatpayParameterBuilder builder, WechatTransfersRequest param)
 {
     builder.Add(WechatpayConst.MchAppId, Config.AppId).Add(WechatpayConst.MchId, Config.MerchantId).Add(WechatpayConst.DeviceInfo, param.DeviceInfo)
     .Add(WechatpayConst.PartnerTradeNo, param.PartnerTradeNo).OpenId(param.OpenId)
     .Add(WechatpayConst.CheckName, param.CheckName?.ToString()).Add(WechatpayConst.ReUserName, param.ReUserName)
     .Add(WechatpayConst.Amount, (param.Amount * 100).ToInt()).Add(WechatpayConst.Desc, param.Desc);
 }
 protected override void InitBuilder(WechatpayParameterBuilder builder, WechatRefundOrderRequest param)
 {
     builder.Add(WechatpayConst.TransactionId, param.TransactionId).Add(WechatpayConst.OutTradeNo, param.OrderId)
     .Add(WechatpayConst.OutRefundNo, param.OutRefundNo).TotalFee(param.Money)
     .RefundTotalFee(param.RefundMoney).NotifyUrl(param.NotifyUrl).Add(WechatpayConst.RefundDesc, param.RefundDesc)
     .Remove(WechatpayConst.SpbillCreateIp).Remove(WechatpayConst.NotifyUrl);
 }
 protected override void InitBuilder(WechatpayParameterBuilder builder, WechatContractOrderRequest param)
 {
     builder.Add("contract_mchid", Config.MerchantId).Add("contract_appid", Config.AppId).OutTradeNo(param.OutTradeNo)
     .DeviceInfo(param.DeviceInfo).Body(param.Body).Detail(param.Detail).Attach(param.Attach).NotifyUrl(param.NotifyUrl)
     .TotalFee(param.TotalFee).TimeStart(param.TimeStart).TimeExpire(param.TimeExpire).GoodsTag(param.GoodsTag)
     .TradeType(param.TradeType).ProductId(param.ProductId).LimitPay(param.LimitPay).OpenId(param.OpenId).Add("plan_id", param.PlanId)
     .Add("contract_code", param.ContractCode).Add("request_serial", param.RequestSerial).Add("contract_display_account", param.ContractDisplayAccount)
     .Add("contract_notify_url", param.ContractNotifyUrl);
 }
Пример #5
0
        public async Task <HttpResponseMessage> ReturnMessage(WechatpayNativePayRequest request)
        {
            HttpResponseMessage response   = null;
            var validationResultCollection = await ValidateAsync();

            if (validationResultCollection.IsValid)
            {
                var result = await NativePayService.PayAsync(request);

                WechatpayParameterBuilder paramBuilder = new WechatpayParameterBuilder(Config);
                paramBuilder.Init();
                paramBuilder.PrepayId(result.Data?.PrepayId);
                paramBuilder.ReturnCode(result.Data?.ReturnCode);
                paramBuilder.ResultCode(result.Data?.ResultCode);
                paramBuilder.Add(WechatpayConst.ErrorCodeDescription, result.Data?.ReturnMsg);
                string xmlContent = paramBuilder.ToXml();
                response = xmlContent.XmlToHttpResponseMessage();
            }
            else
            {
                throw new PayException(validationResultCollection);
            }
            return(response);
        }
 protected override void InitBuilder(WechatpayParameterBuilder builder, WechatOrderQueryRequest param)
 {
     builder.Add(WechatpayConst.TransactionId, param.TransactionId).Add(WechatpayConst.OutTradeNo, param.OrderId);
 }
 protected override void InitBuilder(WechatpayParameterBuilder builder, WechatDeleteContractRequest param)
 {
     builder.Add("plan_id", param.PlanId).Add("contract_code", param.ContractCode).Add("contract_id", param.ContractId).Add("contract_termination_remark", param.ContractTerminationRemark)
     .Add("version", "1.0")
     .Remove(WechatpayConst.NonceStr).Remove(WechatpayConst.SpbillCreateIp);
 }
Пример #8
0
 protected override void InitBuilder(WechatpayParameterBuilder builder, WechatRefundQueryRequest param)
 {
     builder.Add(WechatpayConst.TransactionId, param.TransactionId).Add(WechatpayConst.OutTradeNo, param.OrderId)
     .Add(WechatpayConst.OutRefundNo, param.OutRefundNo).Add(WechatpayConst.RefundId, param.RefundId)
     .Remove(WechatpayConst.SpbillCreateIp).Remove(WechatpayConst.NotifyUrl);;
 }
 protected override void InitBuilder(WechatpayParameterBuilder builder, WechatCloseOrderRequest param)
 {
     builder.Add(WechatpayConst.TransactionId, param.TransactionId).Add(WechatpayConst.OutTradeNo, param.OrderId).Remove(WechatpayConst.SpbillCreateIp);
 }
Пример #10
0
 /// <summary>
 /// 配置参数生成器
 /// </summary>
 /// <param name="builder">参数生成器</param>
 /// <param name="param">请求参数</param>
 protected override void ConfigBuilder(WechatpayParameterBuilder builder, WechatpayDownloadBillRequest param)
 {
     builder.Init();
     builder.Add("bill_date", param.GetBillDate());
     builder.Add("bill_type", param.BillType.Description());
 }