예제 #1
0
 public ProfitSharingRemoveReceiverResult(string resultXml)
     : base(resultXml)
 {
     if (base.IsReturnCodeSuccess())
     {
         var receiverJsonString = GetXmlValue("receiver"); //xml中包含有Json字符串,但是 CommonJson
         this.receiver = SerializerHelper.GetObject <TenpayV3ProfitShareing_ReceiverInfo>(receiverJsonString);
     }
 }
예제 #2
0
        /// <summary>
        /// 服务商
        /// </summary>
        /// <param name="appId"></param>
        /// <param name="mchId"></param>
        /// <param name="subappid">子商户公众账号ID</param>
        /// <param name="submchid">子商户号</param>
        /// <param name="key"></param>
        /// <param name="nonceStr"></param>
        /// <param name="receiver">需要删除的的分账接收方对象</param>
        /// <param name="version">统一下单接口参数,参考:https://pay.weixin.qq.com/wiki/doc/api/danpin.php?chapter=9_203&amp;index=6</param>
        public TenpayV3ProfitShareingRemoveReceiverRequestData(
            string appId, string mchId, string subappid, string submchid, string key, string nonceStr,
            TenpayV3ProfitShareing_ReceiverInfo receiver, string version = null
            )
        {
            AppId    = appId;
            MchId    = mchId;
            NonceStr = nonceStr;
            Key      = key;
            SubAppId = subappid;
            SubMchId = submchid;
            Receiver = receiver;
            Version  = version;
            if (Receiver == null)
            {
                throw new ArgumentNullException("必须指定待删除的分账接收方");
            }


            #region 设置RequestHandler

            //创建支付应答对象
            PackageRequestHandler = new RequestHandler(null);
            //初始化
            PackageRequestHandler.Init();

            //设置package订单参数
            //以下设置顺序按照官方文档排序,方便维护:https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_1

            PackageRequestHandler.SetParameterWhenNotNull("version", Version);
            PackageRequestHandler.SetParameter("appid", this.AppId);                        //公众账号ID
            PackageRequestHandler.SetParameter("mch_id", this.MchId);                       //商户号
            PackageRequestHandler.SetParameterWhenNotNull("sub_appid", this.SubAppId);      //子商户公众账号ID
            PackageRequestHandler.SetParameterWhenNotNull("sub_mch_id", this.SubMchId);     //子商户号
            PackageRequestHandler.SetParameter("nonce_str", this.NonceStr);                 //随机字符串
            PackageRequestHandler.SetParameter("sign_type", this.SignType);                 //签名类型,默认为MD5

            JsonSerializerSettings setting = new JsonSerializerSettings();
            setting.NullValueHandling = NullValueHandling.Ignore;
            PackageRequestHandler.SetParameter("receiver", Receiver.ToJson(false, setting));//场景信息

            Sign = PackageRequestHandler.CreateSha256Sign("key", this.Key);

            PackageRequestHandler.SetParameter("sign", Sign);                               //签名
            #endregion
        }