public List <CryptoAddressIndexES> GetMerchantCryptoAddress(Guid merchantAccountId) { var list = new CryptoAddressDAC().GetByAccountId(merchantAccountId); var cryptoList = new CryptocurrencyDAC().GetAllActived(); cryptoList.MoveTop(t => t.Code == "FIII"); var account = new MerchantAccountDAC().GetById(merchantAccountId); var pos = new POSDAC().GetById(account.POSId.Value); if (!pos.IsWhiteLabel) { cryptoList.RemoveAll(t => t.IsWhiteLabel == 1); } else { cryptoList.MoveTop(t => t.Code == pos.FirstCrypto); } return(cryptoList.Select(e => { return new CryptoAddressIndexES { CryptoId = e.Id, Code = e.Code, NeedTag = e.NeedTag, Count = list.Count(c => c.CryptoId == e.Id) }; }).ToList()); }
public void DeleteAddress(UserAccount user, long id) { var address = new CryptoAddressDAC().GetById(id); if (address == null || address.AccountId != user.Id) { throw new ApplicationException(MessageResources.AddressNotExist); } new CryptoAddressDAC().Delete(id); }
public void DeleteAddress(Guid merchantAccountId, long addressId) { var dac = new CryptoAddressDAC(); var entities = dac.GetById(addressId); if (entities?.AccountId != merchantAccountId) { return; } dac.Delete(addressId); }
public List <ListForManageWithdrawalAddressOMItem> ListForManageWithdrawalAddress(UserAccount user) { var dac = new CryptoAddressDAC(); var list = dac.GetByAccountId(user.Id); var cryptoList = new CryptocurrencyDAC().GetAllActived(); return(cryptoList.Select(e => { return new ListForManageWithdrawalAddressOMItem { Id = e.Id, Code = e.Code, AddressCount = list.Count(c => c.CryptoId == e.Id), NeedTag = e.NeedTag }; }).ToList()); }
public AddAddressOM AddAddress(UserAccount user, string address, string tag, string alias, int coinId) { var crypto = new CryptocurrencyDAC().GetById(coinId); CryptoAddressValidation.ValidateAddress(crypto.Code, address); if (!string.IsNullOrEmpty(tag)) { CryptoAddressValidation.ValidateTag(crypto.Code, tag); } var agent = new FiiiFinanceAgent(); try { if (!agent.ValidateAddress(crypto.Code, address)) { throw new CommonException(ReasonCode.GENERAL_ERROR, GeneralResources.EMInvalidAddress); } } catch (FiiiFinanceException ex) { if (ex.ReasonCode == 20002) { throw new CommonException(ReasonCode.GENERAL_ERROR, GeneralResources.EMInvalidAddress); } } var id = new CryptoAddressDAC().Insert(new CryptoAddress { AccountId = user.Id, AccountType = AccountType.User, Address = address, Tag = tag, Alias = alias, CryptoId = coinId, }); return(new AddAddressOM { Id = id }); }
public void AddAddress(Guid merchantAccountId, int cryptoId, string address, string tag, string remark) { var crypto = new CryptocurrencyDAC().GetById(cryptoId); CryptoAddressValidation.ValidateAddress(crypto.Code, address); if (!string.IsNullOrEmpty(tag)) { CryptoAddressValidation.ValidateTag(crypto.Code, tag); } //var merchant = new MerchantAccountDAC().GetById(merchantAccountId); try { if (!new FiiiFinanceAgent().ValidateAddress(crypto.Code, address)) { throw new CommonException(ReasonCode.GENERAL_ERROR, GeneralResources.EMInvalidAddress); } } catch (FiiiFinanceException ex) { if (ex.ReasonCode == 20002) { throw new CommonException(ReasonCode.GENERAL_ERROR, GeneralResources.EMInvalidAddress); } } var dac = new CryptoAddressDAC(); var entities = new CryptoAddress { AccountId = merchantAccountId, AccountType = AccountType.Merchant, CryptoId = cryptoId, Address = address, Tag = tag, Alias = remark }; dac.Insert(entities); }
public List <CryptoAddress> GetMerchantCryptoAddress(Guid merchantAccountId, int cryptoId) { var dac = new CryptoAddressDAC(); return(dac.GetByCryptoId(merchantAccountId, cryptoId)); }