Преглед изворни кода

添加服务商平台查询申请单状态API

lcl пре 1 година
родитељ
комит
0ae0ccb37f
4 измењених фајлова са 78 додато и 5 уклоњено
  1. BIN
      .DS_Store
  2. 1 1
      AppStart/Alipay/AlipayFunctionForHD.cs
  3. 72 2
      AppStart/WeChatFunctionForHD.cs
  4. 5 2
      Controllers/HomeController.cs

+ 1 - 1
AppStart/Alipay/AlipayFunctionForHD.cs

@@ -136,7 +136,7 @@ namespace MySystem
             IAopClient client = new DefaultAopClient("https://openapi.alipay.com/gateway.do", AppId, PrivateKey, "json", "1.0", "RSA2", AlipayPublicKey, "utf-8", false);
             string fileName = path.Substring(path.LastIndexOf("/") + 1);
             string imageBase64 = function.imageToBase64String(function.getPath(path));
-            imageBase64 = imageBase64.Substring(imageBase64.IndexOf(";base64,") + 8);
+            // imageBase64 = imageBase64.Substring(imageBase64.IndexOf(";base64,") + 8);
             AntMerchantExpandIndirectImageUploadRequest request = new AntMerchantExpandIndirectImageUploadRequest();
             FileItem imageContent = new FileItem(fileName,Convert.FromBase64String(imageBase64));
             request.ImageContent = imageContent;

+ 72 - 2
AppStart/WeChatFunctionForHD.cs

@@ -86,16 +86,17 @@ namespace MySystem
             identification_info.Add("identification_valid_date", "[\"" + info.CardPeriodBegin.Value.ToString("yyyy-MM-dd") + "\",\"" + CardPeriodEnd + "\"]"); //身份证有效期
             identification_info.Add("identification_front_copy", GetMediaId("/" + info.IdCardCopy)); //身份证件正面照片
             identification_info.Add("identification_back_copy", GetMediaId("/" + info.IdCardNational)); //身份证件反面照片
+            bool owner = true;
             if(info.SubjectType == "SUBJECT_TYPE_ENTERPRISE")
             {
                 identification_info.Add("identification_address", RSAEncrypt(info.IdCardAddress)); //身份证居住地址
-                identification_info.Add("owner", true);
+                identification_info.Add("owner", owner);
             }
             result.Add("identification_info", identification_info); //经营者/法人身份证件
 
 
             //最终受益人信息列表(UBO)----仅企业需要填写
-            if(info.SubjectType == "SUBJECT_TYPE_ENTERPRISE")
+            if(info.SubjectType == "SUBJECT_TYPE_ENTERPRISE" && !owner)
             {
                 List<Dictionary<string, object>> ubo_info_list = new List<Dictionary<string, object>>();
                 Dictionary<string, object> ubo_info_list_item = new Dictionary<string, object>();
@@ -131,6 +132,75 @@ namespace MySystem
         #endregion
 
 
+        #region 服务商平台查询申请单状态API
+
+        public Dictionary<string, object> QueryMerchant(string BusinessCode)
+        {
+            Dictionary<string, object> return_result = new Dictionary<string, object>();
+            try
+            {
+                string result = postJson("https://api.mch.weixin.qq.com/v3/apply4subject/applyment?applyment_id=" + BusinessCode, "", "GET");
+                //"{\"applyment_state\":\"APPLYMENT_STATE_REJECTED\",\"reject_param\":\"licence_valid_date|cert_valid_date\",\"reject_reason\":\"有效期开始日期填写有误,请填写与营业执照上一致的开始日期,如影印件上无开始日期请填写成立日期/注册日期;有效期结束日期填写有误,请填写与营业执照上一致的日期,如影印件上无结束日期请填写“长期”\"}"
+
+
+                
+                //{\"applyment_id\":2000002247709762,\"applyment_state\":\"APPLYMENT_STATE_FINISHED\",\"applyment_state_msg\":\"商户入驻申请已完成\",\"audit_detail\":[],\"business_code\":\"0123456789\",\"sign_url\":\"https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=gQFv7zwAAAAAAAAAAS5odHRwOi8vd2VpeGluLnFxLmNvbS9xLzAyUXE1czkzb3JlUjIxZHpXbTF5Y2YAAgRjbe9hAwQAjScA\",\"sub_mchid\":\"1619775262\"}
+                JsonData jsonObj = JsonMapper.ToObject(result);
+                bool logFlag = true;
+                if (jsonObj["applyment_state"].ToString() == "APPLYMENT_STATE_AUDITING" || jsonObj["applyment_state"].ToString() == "APPLYMENT_STATE_TO_BE_SIGNED" || jsonObj["applyment_state"].ToString() == "APPLYMENT_STATE_TO_BE_CONFIRMED")
+                {
+                    string check = RedisDbconn.Instance.Get<string>("WeChatQueryMerchant:" + BusinessCode + ":" + jsonObj["applyment_state"].ToString());
+                    if(!string.IsNullOrEmpty(check))
+                    {
+                        logFlag = false;
+                    }
+                    else
+                    {
+                        RedisDbconn.Instance.Set("WeChatQueryMerchant:" + BusinessCode + ":" + jsonObj["applyment_state"].ToString(), result);
+                        RedisDbconn.Instance.SetExpire("WeChatQueryMerchant:" + BusinessCode + ":" + jsonObj["applyment_state"].ToString(), 7200);
+                    }
+                }
+                if(logFlag)
+                {
+                    function.WriteLog(BusinessCode, "服务商平台商户进件提交申请单API");
+                    function.WriteLog(result + "\n\n", "服务商平台查询申请单状态API");
+                }
+                return_result.Add("applyment_id", jsonObj["applyment_id"].ToString()); //微信支付申请单号
+                return_result.Add("applyment_state", jsonObj["applyment_state"].ToString()); //申请单状态
+                return_result.Add("applyment_state_msg", jsonObj["applyment_state_msg"].ToString()); //申请状态描述
+                if (jsonObj["applyment_state"].ToString() == "APPLYMENT_STATE_TO_BE_SIGNED" || jsonObj["applyment_state"].ToString() == "APPLYMENT_STATE_FINISHED")
+                {
+                    return_result.Add("sub_mchid", jsonObj["sub_mchid"].ToString());
+                }
+                if (jsonObj["applyment_state"].ToString() == "APPLYMENT_STATE_REJECTED")
+                {
+                    List<Dictionary<string, string>> audit_detail = new List<Dictionary<string, string>>();
+                    JsonData auditObj = jsonObj["audit_detail"]; //驳回原因详情
+                    // for (int i = 0; i < auditObj.Count; i++)
+                    // {
+                    //     Dictionary<string, string> row = new Dictionary<string, string>();
+                    //     // row.Add("field", auditObj[i]["field"].ToString()); //字段名
+                    //     // row.Add("field_name", auditObj[i]["field_name"].ToString()); //字段名称
+                    //     row.Add("reject_reason", auditObj[i]["reject_reason"].ToString()); //驳回原因
+                    //     audit_detail.Add(row);
+                    // }
+                    return_result.Add("reject_reason", auditObj[0]["reject_reason"].ToString());
+                    return_result.Add("audit_detail", audit_detail); //申请状态描述
+                }
+                if (result.Contains("\"sign_url\":"))
+                { 
+                    return_result.Add("sign_url", jsonObj["sign_url"].ToString()); //进件通过申请,待商家签约的地址
+                }
+            }
+            catch (Exception ex)
+            {
+                function.WriteLog(DateTime.Now.ToString() + "\r\n" + ex.ToString(), "服务商平台查询申请单状态API异常");
+            }
+            return return_result;
+        }
+        #endregion
+        
+
 
         #region 获取平台证书
 

Разлика између датотеке није приказан због своје велике величине
+ 5 - 2
Controllers/HomeController.cs


Неке датотеке нису приказане због велике количине промена