ChangeMerchantCardSetUtil.cs 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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 ChangeMerchantCardSetUtil
  17. {
  18. public static ChangeMerchantCard SetValue(MerchantAddInfo AddInfo, string accountNo, string accoutType, string accountName, string zbankNo, string alterType, string acctZbankCode, string idCard, string idCardStartDate, string idCardEndDate, string openAccountLicenses, string BankCard = "/static/upload/2023/9/11/nb.jpg")
  19. {
  20. ChangeMerchantCard changeMerchantCard = new ChangeMerchantCard();
  21. changeMerchantCard.mchtNo = AddInfo.MchtNo; //收款商户号
  22. changeMerchantCard.accountNo = accountNo; //卡号(账户类型 0-对公 时填写对公账号,1-对私 时填写银行卡号)
  23. changeMerchantCard.accoutType = accoutType; //账户类型 0-对公,1-对私
  24. if (changeMerchantCard.accoutType == "1")
  25. {
  26. changeMerchantCard.accountName = accountName; //开户名(账户名称 账户类型 0-对公 时填写对公账户名,1-对私 时填写银行卡户名)
  27. }
  28. else
  29. {
  30. changeMerchantCard.accountName = accountName; //开户名(账户名称 账户类型 0-对公 时填写对公账户名,1-对私 时填写银行卡户名)
  31. }
  32. changeMerchantCard.zbankNo = zbankNo; //开户支行号
  33. changeMerchantCard.alterType = alterType; //结算类型: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 = acctZbankCode; //开户支行地区码
  38. if (changeMerchantCard.alterType == "2")
  39. {
  40. changeMerchantCard.idCard = idCard; //非法人身份证号(结算类型为2时必填)
  41. changeMerchantCard.agentCardDate = "" + "-" + "长期"; //非法人身份证有效期(结算类型为2时必填,格式:20210101-20220101,如长期:20210101-长期)
  42. changeMerchantCard.agentCardDate = "" + "-" + ""; //非法人身份证有效期(结算类型为2时必填,格式:20210101-20220101,如长期:20210101-长期)
  43. }
  44. List<PhotoItem> photoList = new List<PhotoItem>();
  45. PhotoItem photoItem = new PhotoItem();
  46. // alterType结算类型为 0 时,上传 开户许可证照片
  47. // alterType结算类型为1时,上传 银行卡照片
  48. // alterType结算类型为2时,上传 银行卡照片、非法人身份证正面照片、非法人身份证反
  49. // 面照片、委托结算授权书照片、法人手持委托结算授权书
  50. if (alterType == "0")
  51. {
  52. var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.BankCard.Substring(AddInfo.BankCard.LastIndexOf("/")).Trim('/'), "0", AddInfo.BrandId));
  53. if (tokenInfo["code"].ToString() == "1")
  54. {
  55. var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.BankCard, AddInfo.BrandId);
  56. if (returnInfo != "false")
  57. {
  58. photoItem = new PhotoItem();
  59. photoItem.mediaCode = "openAccountLicenses";
  60. photoItem.mediaPath = returnInfo;
  61. photoList.Add(photoItem);
  62. }
  63. }
  64. }
  65. if (alterType == "1")
  66. {
  67. if (!string.IsNullOrEmpty(AddInfo.OpenAccountLicenses))
  68. {
  69. var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.BankCard.Substring(AddInfo.OpenAccountLicenses.LastIndexOf("/")).Trim('/'), "0", AddInfo.BrandId));
  70. if (tokenInfo["code"].ToString() == "1")
  71. {
  72. var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.OpenAccountLicenses, AddInfo.BrandId);
  73. if (returnInfo != "false")
  74. {
  75. photoItem = new PhotoItem();
  76. photoItem.mediaCode = "openAccountLicenses";
  77. photoItem.mediaPath = returnInfo;
  78. photoList.Add(photoItem);
  79. }
  80. }
  81. }
  82. if (!string.IsNullOrEmpty(BankCard))
  83. {
  84. var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.BankCard.Substring(BankCard.LastIndexOf("/")).Trim('/'), "0", AddInfo.BrandId));
  85. if (tokenInfo["code"].ToString() == "1")
  86. {
  87. var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), BankCard, AddInfo.BrandId);
  88. if (returnInfo != "false")
  89. {
  90. photoItem = new PhotoItem();
  91. photoItem.mediaCode = "bankCard";
  92. photoItem.mediaPath = returnInfo;
  93. photoList.Add(photoItem);
  94. }
  95. }
  96. }
  97. }
  98. if (alterType == "2")
  99. {
  100. var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.BankCard.Substring(AddInfo.BankCard.LastIndexOf("/")).Trim('/'), "0", AddInfo.BrandId));
  101. if (tokenInfo["code"].ToString() == "1")
  102. {
  103. var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.BankCard, AddInfo.BrandId);
  104. if (returnInfo != "false")
  105. {
  106. photoItem = new PhotoItem();
  107. photoItem.mediaCode = "openAccountLicenses";
  108. photoItem.mediaPath = returnInfo;
  109. photoList.Add(photoItem);
  110. }
  111. }
  112. }
  113. changeMerchantCard.photoList = photoList; //图片列表
  114. return changeMerchantCard;
  115. }
  116. }
  117. }