TestChangeMerchantCardSetUtil.cs 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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. public static ChangeMerchantCard SetValue(MerchantAddInfo AddInfo, string BankCard = "/static/upload/2023/9/11/nb.jpg")
  19. {
  20. ChangeMerchantCard changeMerchantCard = new ChangeMerchantCard();
  21. changeMerchantCard.mchtNo = "030510106621391"; //收款商户号
  22. changeMerchantCard.accountNo = "6217359952003511113"; //卡号(账户类型 0-对公 时填写对公账号,1-对私 时填写银行卡号)
  23. changeMerchantCard.accoutType = "1"; //账户类型 0-对公,1-对私
  24. if (changeMerchantCard.accoutType == "1")
  25. {
  26. changeMerchantCard.accountName = "王亦君"; //开户名(账户名称 账户类型 0-对公 时填写对公账户名,1-对私 时填写银行卡户名)
  27. }
  28. else
  29. {
  30. changeMerchantCard.accountName = "四川探火网络科技有限责任公司"; //开户名(账户名称 账户类型 0-对公 时填写对公账户名,1-对私 时填写银行卡户名)
  31. }
  32. changeMerchantCard.zbankNo = "313701013316"; //开户支行号
  33. changeMerchantCard.alterType = "1"; //结算类型:0-对公结算银行卡;1-法人对私结算银行卡;2-非法人结算
  34. // if (AddInfo.AccountType == "0" && AddInfo.LicenceType == "0") changeMerchantCard.alterType = "0"; //结算类型:0-对公结算银行卡;1-法人对私结算银行卡;2-非法人结算
  35. // if (AddInfo.AccountType == "1" && (AddInfo.LicenceType == "0" || AddInfo.LicenceType == "1")) changeMerchantCard.alterType = "1"; //结算类型:0-对公结算银行卡;1-法人对私结算银行卡;2-非法人结算
  36. // if (AddInfo.AccountType == "1" && AddInfo.LicenceType == null) changeMerchantCard.alterType = "2"; //结算类型:0-对公结算银行卡;1-法人对私结算银行卡;2-非法人结算
  37. changeMerchantCard.acctZbankCode = "510107"; //开户支行地区码
  38. changeMerchantCard.idCard = "620522199407080017"; //非法人身份证号
  39. if (changeMerchantCard.alterType == "2")
  40. {
  41. changeMerchantCard.idCard = "620522199407080017"; //非法人身份证号(结算类型为2时必填)
  42. if (AddInfo.CardPeriodEnd.Value.Year == 2050)
  43. {
  44. changeMerchantCard.agentCardDate = AddInfo.CardPeriodBegin.Value.ToString("yyyyMMdd") + "-" + "长期"; //法人身份证有效期 格式:20150101-20200101,若结束日期为长期填20150101-长期
  45. }
  46. else
  47. {
  48. changeMerchantCard.agentCardDate = AddInfo.CardPeriodBegin.Value.ToString("yyyyMMdd") + "-" + AddInfo.CardPeriodEnd.Value.ToString("yyyyMMdd"); //法人身份证有效期 格式:20150101-20200101,若结束日期为长期填20150101-长期
  49. }
  50. // changeMerchantCard.agentCardDate = "" + "-" + "长期"; //非法人身份证有效期(结算类型为2时必填,格式:20210101-20220101,如长期:20210101-长期)
  51. // changeMerchantCard.agentCardDate = "" + "-" + ""; //非法人身份证有效期(结算类型为2时必填,格式:20210101-20220101,如长期:20210101-长期)
  52. }
  53. List<PhotoItem> photoList = new List<PhotoItem>();
  54. PhotoItem photoItem = new PhotoItem();
  55. // alterType结算类型为 0 时,上传 开户许可证照片
  56. // alterType结算类型为1时,上传 银行卡照片
  57. // alterType结算类型为2时,上传 银行卡照片、非法人身份证正面照片、非法人身份证反
  58. // 面照片、委托结算授权书照片、法人手持委托结算授权书
  59. if (changeMerchantCard.alterType == "0")
  60. {
  61. var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.BankCard.Substring(AddInfo.BankCard.LastIndexOf("/")).Trim('/'), "0", AddInfo.BrandId));
  62. if (tokenInfo["code"].ToString() == "1")
  63. {
  64. var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.BankCard, AddInfo.BrandId);
  65. if (returnInfo != "false")
  66. {
  67. photoItem = new PhotoItem();
  68. photoItem.mediaCode = "openAccountLicenses";
  69. photoItem.mediaPath = returnInfo;
  70. photoList.Add(photoItem);
  71. }
  72. }
  73. }
  74. if (changeMerchantCard.alterType == "1")
  75. {
  76. var info = "/static/upload/2023/8/14/dd.jpg";
  77. if (!string.IsNullOrEmpty(info))
  78. {
  79. var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(info.Substring(info.LastIndexOf("/")).Trim('/'), "0", AddInfo.BrandId));
  80. if (tokenInfo["code"].ToString() == "1")
  81. {
  82. var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), info, AddInfo.BrandId);
  83. if (returnInfo != "false")
  84. {
  85. photoItem = new PhotoItem();
  86. photoItem.mediaCode = "openAccountLicenses";
  87. photoItem.mediaPath = returnInfo;
  88. photoList.Add(photoItem);
  89. }
  90. }
  91. }
  92. if (!string.IsNullOrEmpty(BankCard))
  93. {
  94. var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(BankCard.Substring(BankCard.LastIndexOf("/")).Trim('/'), "0", AddInfo.BrandId));
  95. if (tokenInfo["code"].ToString() == "1")
  96. {
  97. var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), BankCard, AddInfo.BrandId);
  98. if (returnInfo != "false")
  99. {
  100. photoItem = new PhotoItem();
  101. photoItem.mediaCode = "bankCard";
  102. photoItem.mediaPath = returnInfo;
  103. photoList.Add(photoItem);
  104. }
  105. }
  106. }
  107. }
  108. if (changeMerchantCard.alterType == "2")
  109. {
  110. var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.BankCard.Substring(AddInfo.BankCard.LastIndexOf("/")).Trim('/'), "0", AddInfo.BrandId));
  111. if (tokenInfo["code"].ToString() == "1")
  112. {
  113. var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.BankCard, AddInfo.BrandId);
  114. if (returnInfo != "false")
  115. {
  116. photoItem = new PhotoItem();
  117. photoItem.mediaCode = "openAccountLicenses";
  118. photoItem.mediaPath = returnInfo;
  119. photoList.Add(photoItem);
  120. }
  121. }
  122. }
  123. changeMerchantCard.photoList = photoList; //图片列表
  124. return changeMerchantCard;
  125. }
  126. }
  127. }