private string GetBIZ(ApplyRefund_BizContent _biz_content) { string biz = "{{\"out_trade_no\":\"{0}\",\"out_refund_no\":\"{1}\",\"total_fee\":\"{2}\",\"refund_fee\":\"{3}\"}}"; string bizstr = string.Format(biz, _biz_content.out_trade_no, _biz_content.out_refund_no, _biz_content.total_fee, _biz_content.refund_fee); return(bizstr); }
private string GetSign(ApplyRefund_BizContent _biz_content, string key) { string sign = "api_from_type={0}&app_id={1}&biz_content={{\"out_trade_no\":\"{2}\",\"out_refund_no\":\"{3}\",\"total_fee\":\"{4}\",\"refund_fee\":\"{5}\"}}&charset={6}&mch_uid={7}&method={8}&sign_type={9}×tamp={10}&version={11}&key={12}"; string signstr = string.Format(sign, this.api_from_type, this.app_id, _biz_content.out_trade_no, _biz_content.out_refund_no, _biz_content.total_fee, _biz_content.refund_fee, this.charset, this.mch_uid, this.method, this.sign_type, this.timestamp, this.version, key); string MD5Str = Util.Tools.MD5Encrypt(signstr); return(MD5Str); }
public ApplyRefundRequest(ApplyRefund_BizContent _biz_content) { var config = new Utility.SiteConfig(); this.api_from_type = "Out_Api"; this.method = "heemoney.pay.refund"; this.version = "1.0"; this.app_id = config.HuiShouYin_APPID; this.mch_uid = config.HuiShouYin_MCHUID; this.charset = "utf-8"; this.sign_type = "MD5"; this.timestamp = DateTime.Now.ToString("yyyyMMddHHmmss"); this.biz_content = GetBIZ(_biz_content); this.sign = GetSign(_biz_content, config.HuiShouYin_KEY); }