public MerchantExTransferOrderDTO FiiiPOSTransferDetail(Guid accountId, long id) { var dac = new MerchantExTransferOrderDAC(); var order = dac.GetById(id); if (order == null) { return(null); } if (order.AccountId != accountId) { return(null); } var coin = new CryptocurrencyDAC().GetById(order.CryptoId); return(new MerchantExTransferOrderDTO { Id = order.Id, Amount = order.Amount.ToString(coin.DecimalPlace), ExTransferType = order.OrderType, CryptoCode = coin.Code, Status = order.Status, Timestamp = order.Timestamp.ToUnixTime(), OrderNo = order.OrderNo }); }
public List <MerchantExTransferOrderDTO> FiiiPOSTransferList(Guid accountId, int pageIndex, int pageSize) { var dac = new MerchantExTransferOrderDAC(); List <MerchantExTransferOrder> list = dac.PagedByAccountId(accountId, pageIndex, pageSize); var cryptoList = new CryptocurrencyDAC().GetAll(); return(list.Select(e => { var crypto = cryptoList.FirstOrDefault(c => c.Id == e.CryptoId); return new MerchantExTransferOrderDTO { Id = e.Id, Amount = e.Amount.ToString(crypto?.DecimalPlace ?? 8), CryptoCode = e.CryptoCode, ExTransferType = e.OrderType, OrderNo = e.OrderNo, Status = e.Status, Timestamp = e.Timestamp.ToUnixTime() }; }).ToList()); }
public void PushTransferToEx(long id) { var order = new MerchantExTransferOrderDAC().GetById(id); var crypto = new CryptocurrencyDAC().GetById(order.CryptoId); var regId = RedisHelper.StringGet($"{FiiiPOS_APP_Notice_MerchantId}:{order.AccountId}"); var lang = RedisHelper.StringGet(REDIS_LANGUAGE_DBINDEX, $"{FiiiPOS_APP_Language_MerchantId}:{order.AccountId}") ?? "en"; var titleKey = "TransferToFiiiExTitle"; var subTitleKey = "TransferToFiiiExSubTitle"; var title = ResourceHelper.FiiiPos.GetFormatResource(titleKey, lang, crypto.Code); var subTitle = ResourceHelper.FiiiPos.GetFormatResource(subTitleKey, lang, crypto.Code); string noticeId = ""; //写MongoDB [] MessagesComponent.AddMessage(order.AccountId, UserType.Merchant, id.ToString(), FiiiPayPushType.TYPE_TRANSFER_TO_EX, titleKey, subTitleKey, crypto.Code, title, subTitle, out noticeId); RegPush(FiiiPayPushType.TYPE_TRANSFER_TO_EX, new List <string> { regId }, id, title, subTitle, noticeId); LogHelper.Info($"--------{lang}------{title}----------{subTitle}"); }
public TransferResult FiiiPOSTransferToEx(Guid accountId, int cryptoId, decimal amount, string pinToken) { var securityVerify = new SecurityVerification(SystemPlatform.FiiiPOS); securityVerify.VerifyToken(accountId, pinToken, SecurityMethod.Pin); var openAccountDac = new OpenAccountDAC(); var openAccount = openAccountDac.GetOpenAccount(FiiiType.FiiiPOS, accountId); if (openAccount == null) { throw new CommonException(ReasonCode.GENERAL_ERROR, R.FiiiExAccountNotExist); } var crypto = new CryptocurrencyDAC().GetById(cryptoId); if (crypto == null) { throw new CommonException(ReasonCode.GENERAL_ERROR, R.CurrencyForbidden); } var walletDac = new MerchantWalletDAC(); var wallet = walletDac.GetByAccountId(accountId, crypto.Id); if (wallet.Balance < amount) { throw new CommonException(ReasonCode.GENERAL_ERROR, Resources.余额不足); } //10091=参数不符合要求 10013=用户信息不存在 10020=币不存在 0=成功 int result = FiiiExCoinIn(openAccount.OpenId, crypto.Code, amount, out string recordId); if (result != 0) { throw new CommonException(ReasonCode.GENERAL_ERROR, Resources.从FiiiEx划转失败); } MerchantExTransferOrder order; using (var scope = new TransactionScope()) { walletDac.Decrease(wallet.Id, amount); order = new MerchantExTransferOrder { Timestamp = DateTime.UtcNow, OrderNo = CreateOrderNo(), OrderType = ExTransferType.ToEx, AccountId = accountId, WalletId = wallet.Id, CryptoId = crypto.Id, CryptoCode = crypto.Code, Amount = amount, Status = 1, Remark = null, ExId = recordId }; order = new MerchantExTransferOrderDAC().Create(order); scope.Complete(); } try { FiiiEXTransferMSMQ.PubMerchantTransferToEx(order.Id, 0); } catch (Exception ex) { LogHelper.Info("FiiiPOSTransferToEx - error", ex); } return(new TransferResult { Id = order.Id, Amount = order.Amount.ToString(crypto.DecimalPlace), OrderNo = order.OrderNo, Timestamp = order.Timestamp.ToUnixTime(), CryptoCode = crypto.Code }); }