TestChangeMerchantCardSetUtil.cs 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Threading.Tasks;
  5. using Aop.Api.Util;
  6. using GraphQL;
  7. using Library;
  8. using LitJson;
  9. using MySystem;
  10. using MySystem.Models.Main;
  11. namespace MySystem
  12. {
  13. /// <summary>
  14. /// 好哒商户修改银行卡参数赋值(测试)
  15. /// </summary>
  16. public class TestChangeMerchantCardSetUtil
  17. {
  18. // bankCard 银行卡正面 结算类型为1和2时必填,0不填,传上传图片接口得到的token
  19. // openAccountLicenses 开户许可证 企业类型商户或结算类型为0时必填,1和2不填,传上传图片接口得到的token
  20. // priLicAgreement 企业法人对私授权书 结算类型为1且为企业商户时必填,传上传图片接口得到的token
  21. // agentProtocol 委托结算授权书 结算类型为2时必填,传上传图片接口得到的token
  22. // agentIdCardFront 被委托人身份证人像面 结算类型为2时必填,传上传图片接口得到的token
  23. // agentIdCardBack 被委托人身份证国徽面 结算类型为2时必填,传上传图片接口得到的token
  24. // holdAgentProtocol 法人手持委托结算授权书 结算类型为2时必填,传上传图片接口得到的token
  25. public static ChangeMerchantCard SetValue(MerchantAddInfo AddInfo, string BankCard = "/static/upload/2024/3/12/Card.jpg")
  26. {
  27. ChangeMerchantCard changeMerchantCard = new ChangeMerchantCard();
  28. changeMerchantCard.mchtNo = "030510106722615"; //收款商户号
  29. changeMerchantCard.accountNo = "694330345"; //卡号(账户类型 0-对公 时填写对公账号,1-对私 时填写银行卡号)
  30. changeMerchantCard.accoutType = "0"; //账户类型 0-对公,1-对私
  31. if (changeMerchantCard.accoutType == "1")
  32. {
  33. changeMerchantCard.accountName = "黄全芳"; //开户名(账户名称 账户类型 0-对公 时填写对公账户名,1-对私 时填写银行卡户名)
  34. }
  35. else
  36. {
  37. changeMerchantCard.accountName = "四川佰人商贸有限公司"; //开户名(账户名称 账户类型 0-对公 时填写对公账户名,1-对私 时填写银行卡户名)
  38. }
  39. changeMerchantCard.zbankNo = "305651000261"; //开户支行号
  40. changeMerchantCard.alterType = "0"; //结算类型:0-对公结算银行卡;1-法人对私结算银行卡;2-非法人结算
  41. // if (AddInfo.AccountType == "0" && AddInfo.LicenceType == "0") changeMerchantCard.alterType = "0"; //结算类型:0-对公结算银行卡;1-法人对私结算银行卡;2-非法人结算
  42. // if (AddInfo.AccountType == "1" && (AddInfo.LicenceType == "0" || AddInfo.LicenceType == "1")) changeMerchantCard.alterType = "1"; //结算类型:0-对公结算银行卡;1-法人对私结算银行卡;2-非法人结算
  43. // if (AddInfo.AccountType == "1" && AddInfo.LicenceType == null) changeMerchantCard.alterType = "2"; //结算类型:0-对公结算银行卡;1-法人对私结算银行卡;2-非法人结算
  44. changeMerchantCard.acctZbankCode = "510107"; //开户支行地区码
  45. // changeMerchantCard.idCard = ""; //非法人身份证号
  46. // if (changeMerchantCard.alterType == "2")
  47. // {
  48. // changeMerchantCard.idCard = "340123200410150349"; //非法人身份证号(结算类型为2时必填)
  49. // if (AddInfo.CardPeriodEnd.Value.Year == 2050)
  50. // {
  51. // changeMerchantCard.agentCardDate = AddInfo.CardPeriodBegin.Value.ToString("yyyyMMdd") + "-" + "长期"; //法人身份证有效期 格式:20150101-20200101,若结束日期为长期填20150101-长期
  52. // }
  53. // else
  54. // {
  55. // changeMerchantCard.agentCardDate = AddInfo.CardPeriodBegin.Value.ToString("yyyyMMdd") + "-" + AddInfo.CardPeriodEnd.Value.ToString("yyyyMMdd"); //法人身份证有效期 格式:20150101-20200101,若结束日期为长期填20150101-长期
  56. // }
  57. // // changeMerchantCard.agentCardDate = "" + "-" + "长期"; //非法人身份证有效期(结算类型为2时必填,格式:20210101-20220101,如长期:20210101-长期)
  58. // // changeMerchantCard.agentCardDate = "" + "-" + ""; //非法人身份证有效期(结算类型为2时必填,格式:20210101-20220101,如长期:20210101-长期)
  59. // }
  60. List<PhotoItem> photoList = new List<PhotoItem>();
  61. PhotoItem photoItem = new PhotoItem();
  62. // alterType结算类型为 0 时,上传 开户许可证照片
  63. // alterType结算类型为1时,上传 银行卡照片
  64. // alterType结算类型为2时,上传 银行卡照片、非法人身份证正面照片、非法人身份证反
  65. // 面照片、委托结算授权书照片、法人手持委托结算授权书
  66. if (changeMerchantCard.alterType == "0")
  67. {
  68. var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.BankCard.Substring(AddInfo.BankCard.LastIndexOf("/")).Trim('/'), "0", AddInfo.BrandId));
  69. if (tokenInfo["code"].ToString() == "1")
  70. {
  71. var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.BankCard, AddInfo.BrandId);
  72. if (returnInfo != "false")
  73. {
  74. photoItem = new PhotoItem();
  75. photoItem.mediaCode = "openAccountLicenses";
  76. photoItem.mediaPath = returnInfo;
  77. photoList.Add(photoItem);
  78. }
  79. }
  80. }
  81. if (changeMerchantCard.alterType == "1")
  82. {
  83. var info = "/static/upload/2024/3/12/Card.jpg";
  84. if (!string.IsNullOrEmpty(info))
  85. {
  86. var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(info.Substring(info.LastIndexOf("/")).Trim('/'), "0", AddInfo.BrandId));
  87. if (tokenInfo["code"].ToString() == "1")
  88. {
  89. var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), info, AddInfo.BrandId);
  90. if (returnInfo != "false")
  91. {
  92. photoItem = new PhotoItem();
  93. photoItem.mediaCode = "openAccountLicenses";
  94. photoItem.mediaPath = returnInfo;
  95. photoList.Add(photoItem);
  96. }
  97. }
  98. }
  99. if (!string.IsNullOrEmpty(BankCard))
  100. {
  101. var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(BankCard.Substring(BankCard.LastIndexOf("/")).Trim('/'), "0", AddInfo.BrandId));
  102. if (tokenInfo["code"].ToString() == "1")
  103. {
  104. var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), BankCard, AddInfo.BrandId);
  105. if (returnInfo != "false")
  106. {
  107. photoItem = new PhotoItem();
  108. photoItem.mediaCode = "bankCard";
  109. photoItem.mediaPath = returnInfo;
  110. photoList.Add(photoItem);
  111. }
  112. }
  113. }
  114. }
  115. if (changeMerchantCard.alterType == "2")
  116. {
  117. var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.BankCard.Substring(AddInfo.BankCard.LastIndexOf("/")).Trim('/'), "0", AddInfo.BrandId));
  118. if (tokenInfo["code"].ToString() == "1")
  119. {
  120. var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.BankCard, AddInfo.BrandId);
  121. if (returnInfo != "false")
  122. {
  123. photoItem = new PhotoItem();
  124. photoItem.mediaCode = "openAccountLicenses";
  125. photoItem.mediaPath = returnInfo;
  126. photoList.Add(photoItem);
  127. }
  128. }
  129. }
  130. changeMerchantCard.photoList = photoList; //图片列表
  131. return changeMerchantCard;
  132. }
  133. }
  134. }