using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Aop.Api.Util;
using GraphQL;
using Library;
using LitJson;
using MySystem;
using MySystem.Models.Main;
namespace MySystem
{
///
/// 好哒商户修改银行卡参数赋值
///
public class ChangeMerchantCardSetUtil
{
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")
{
ChangeMerchantCard changeMerchantCard = new ChangeMerchantCard();
changeMerchantCard.mchtNo = AddInfo.MchtNo; //收款商户号
changeMerchantCard.accountNo = accountNo; //卡号(账户类型 0-对公 时填写对公账号,1-对私 时填写银行卡号)
changeMerchantCard.accoutType = accoutType; //账户类型 0-对公,1-对私
if (changeMerchantCard.accoutType == "1")
{
changeMerchantCard.accountName = accountName; //开户名(账户名称 账户类型 0-对公 时填写对公账户名,1-对私 时填写银行卡户名)
}
else
{
changeMerchantCard.accountName = accountName; //开户名(账户名称 账户类型 0-对公 时填写对公账户名,1-对私 时填写银行卡户名)
}
changeMerchantCard.zbankNo = zbankNo; //开户支行号
changeMerchantCard.alterType = alterType; //结算类型:0-对公结算银行卡;1-法人对私结算银行卡;2-非法人结算
// if (AddInfo.AccountType == "0" && AddInfo.LicenceType == "0") changeMerchantCard.alterType = "0"; //结算类型:0-对公结算银行卡;1-法人对私结算银行卡;2-非法人结算
// if (AddInfo.AccountType == "1" && (AddInfo.LicenceType == "0" || AddInfo.LicenceType == "1")) changeMerchantCard.alterType = "1"; //结算类型:0-对公结算银行卡;1-法人对私结算银行卡;2-非法人结算
// if (AddInfo.AccountType == "1" && AddInfo.LicenceType == null) changeMerchantCard.alterType = "2"; //结算类型:0-对公结算银行卡;1-法人对私结算银行卡;2-非法人结算
changeMerchantCard.acctZbankCode = acctZbankCode; //开户支行地区码
if (changeMerchantCard.alterType == "2")
{
changeMerchantCard.idCard = idCard; //非法人身份证号(结算类型为2时必填)
changeMerchantCard.agentCardDate = "" + "-" + "长期"; //非法人身份证有效期(结算类型为2时必填,格式:20210101-20220101,如长期:20210101-长期)
changeMerchantCard.agentCardDate = "" + "-" + ""; //非法人身份证有效期(结算类型为2时必填,格式:20210101-20220101,如长期:20210101-长期)
}
List photoList = new List();
PhotoItem photoItem = new PhotoItem();
// alterType结算类型为 0 时,上传 开户许可证照片
// alterType结算类型为1时,上传 银行卡照片
// alterType结算类型为2时,上传 银行卡照片、非法人身份证正面照片、非法人身份证反
// 面照片、委托结算授权书照片、法人手持委托结算授权书
if (alterType == "0")
{
var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.BankCard.Substring(AddInfo.BankCard.LastIndexOf("/")).Trim('/'), "0", AddInfo.BrandId));
if (tokenInfo["code"].ToString() == "1")
{
var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.BankCard, AddInfo.BrandId);
if (returnInfo != "false")
{
photoItem = new PhotoItem();
photoItem.mediaCode = "openAccountLicenses";
photoItem.mediaPath = returnInfo;
photoList.Add(photoItem);
}
}
}
if (alterType == "1")
{
if (!string.IsNullOrEmpty(AddInfo.OpenAccountLicenses))
{
var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.BankCard.Substring(AddInfo.OpenAccountLicenses.LastIndexOf("/")).Trim('/'), "0", AddInfo.BrandId));
if (tokenInfo["code"].ToString() == "1")
{
var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.OpenAccountLicenses, AddInfo.BrandId);
if (returnInfo != "false")
{
photoItem = new PhotoItem();
photoItem.mediaCode = "openAccountLicenses";
photoItem.mediaPath = returnInfo;
photoList.Add(photoItem);
}
}
}
if (!string.IsNullOrEmpty(BankCard))
{
var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.BankCard.Substring(BankCard.LastIndexOf("/")).Trim('/'), "0", AddInfo.BrandId));
if (tokenInfo["code"].ToString() == "1")
{
var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), BankCard, AddInfo.BrandId);
if (returnInfo != "false")
{
photoItem = new PhotoItem();
photoItem.mediaCode = "bankCard";
photoItem.mediaPath = returnInfo;
photoList.Add(photoItem);
}
}
}
}
if (alterType == "2")
{
var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.BankCard.Substring(AddInfo.BankCard.LastIndexOf("/")).Trim('/'), "0", AddInfo.BrandId));
if (tokenInfo["code"].ToString() == "1")
{
var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.BankCard, AddInfo.BrandId);
if (returnInfo != "false")
{
photoItem = new PhotoItem();
photoItem.mediaCode = "openAccountLicenses";
photoItem.mediaPath = returnInfo;
photoList.Add(photoItem);
}
}
}
changeMerchantCard.photoList = photoList; //图片列表
return changeMerchantCard;
}
}
}