public MerchantAccount GetMerchantAccountByIdOrCode(Guid?merchantId, string code) { if (!merchantId.HasValue) { merchantId = new TokenAgent().GetMerchantIntoByCode(code)?.MerchantId; } return(merchantId.HasValue ? new MerchantAccountDAC().GetById(merchantId.Value) : null); }
public GetListByCodeListOM GetListByCodeList(string codes) { //LogHelper.Info("GetListByCodeList = " + codes); try { var codeInfoList = new TokenAgent().GetMerchantIntoListByCodes(codes, false); var idList = codeInfoList.Select(a => a.MerchantId).ToList(); var merchantAccountList = new MerchantAccountDAC().GetListByIdList(idList).Where(e => e.POSId != null).ToList(); //var profileList = GetMerchanstProfileInfo(merchantAccountList); var list = new List <GetListByCodeListOMItem>(); foreach (var merchantAccount in merchantAccountList) { //var profile = profileList.FirstOrDefault(e => e.MerchantId == merchantAccount.Id); var codeInfo = codeInfoList.FirstOrDefault(b => b.MerchantId == merchantAccount.Id); list.Add(new GetListByCodeListOMItem { Id = merchantAccount.Id.ToString(), MerchantAccount = GetMasked(merchantAccount.Username), MerchantName = merchantAccount.MerchantName, IconUrl = merchantAccount.Photo, IsAllowAcceptPayment = merchantAccount.IsAllowAcceptPayment && (merchantAccount.Status == AccountStatus.Active), L1VerifyStatus = (byte)merchantAccount.L1VerifyStatus, L2VerifyStatus = (byte)merchantAccount.L2VerifyStatus, RandomCode = codeInfo?.MerchantCode }); } return(new GetListByCodeListOM { List = list }); } catch (Exception exception) { Error(exception); } return(null); }