Esempio n. 1
0
        public void SendUpdateNewEmailCode(Guid accountId, string emailAddress)
        {
            var dac     = new MerchantAccountDAC();
            var account = dac.GetById(accountId);

            if (account.Email == emailAddress)
            {
                throw new CommonException(ReasonCode.ORIGIN_NEW_EMAIL_SAME, Resources.新邮箱不能和原来的邮箱一致);
            }

            var accountByEmail = dac.GetByEmail(emailAddress);

            if (accountByEmail != null && accountByEmail.Id != accountId)
            {
                throw new CommonException(ReasonCode.EMAIL_BINDBYOTHER, Resources.此邮箱已经绑定到其他邮箱);
            }

            string subject = Resources.验证码邮箱标题;

            SecurityVerify.SendCode(new UpdateEmailNewVerifier(), SystemPlatform.FiiiPOS, accountId.ToString(), emailAddress, subject);
            var model = SecurityVerify.GetModel <FiiiPosUpdateEmailVerify>(new CustomVerifier("UpdateEmail"), SystemPlatform.FiiiPOS, accountId.ToString());

            model.NewEmail = emailAddress;
            SecurityVerify.SetModel(new CustomVerifier("UpdateEmail"), SystemPlatform.FiiiPOS, accountId.ToString(), model);
        }
Esempio n. 2
0
        public void VerifyModifyCellphoneCombine(Guid accountId, string smsCode, string googleCode)
        {
            MerchantAccount merchant = new MerchantAccountDAC().GetById(accountId);

            if (merchant == null)
            {
                throw new CommonException(ReasonCode.ACCOUNT_NOT_EXISTS, Resources.用户不存在);
            }
            List <CombinedVerifyOption> options = new List <CombinedVerifyOption>
            {
                new CombinedVerifyOption {
                    AuthType = (byte)ValidationFlag.Cellphone, Code = smsCode
                },
                new CombinedVerifyOption {
                    AuthType = (byte)ValidationFlag.GooogleAuthenticator, Code = googleCode
                }
            };
            UserSecrets userSecrets = new UserSecrets
            {
                ValidationFlag      = merchant.ValidationFlag,
                GoogleAuthSecretKey = merchant.AuthSecretKey
            };

            SecurityVerify.CombinedVerify(SystemPlatform.FiiiPOS, accountId.ToString(), userSecrets, options);

            var model = SecurityVerify.GetModel <ModifyCellphoneVerify>(new CustomVerifier("ModifyCellphone"), SystemPlatform.FiiiPOS, accountId.ToString());

            model.CombinedVerified = true;
            SecurityVerify.SetModel(new CustomVerifier("ModifyCellphone"), SystemPlatform.FiiiPOS, accountId.ToString(), model);
        }
        public string TransferInto(Guid openId, string pin, string coinCode, decimal amount)
        {
            var coin = new CryptocurrencyDAC().GetByCode(coinCode);

            if (coin == null)
            {
                throw new CommonException(ReasonCode.CRYPTO_NOT_EXISTS, R.ErrorCryptoCode);
            }

            var openAccountDac = new OpenAccountDAC();
            var openAccount    = openAccountDac.GetOpenAccount(openId);

            if (openAccount == null)
            {
                throw new CommonException(ReasonCode.ACCOUNT_NOT_EXISTS, R.AccountNotExist);
            }
            switch (openAccount.FiiiType)
            {
            case FiiiType.FiiiPay:
                var accountDac  = new UserAccountDAC();
                var userAccount = accountDac.GetById(openAccount.AccountId);
                new SecurityComponent().VerifyPin(userAccount, pin);
                return(this.FiiiPayTransferInto(userAccount, coin, amount));

            case FiiiType.FiiiPOS:
                MerchantAccount merchantAccount = new MerchantAccountDAC().GetById(openAccount.AccountId);
                new SecurityComponent().FiiiPOSVerifyPin(merchantAccount, pin);
                return(this.FiiiPOSTransferInto(merchantAccount, coin, amount));

            default:
                throw new CommonException(ReasonCode.ACCOUNT_NOT_EXISTS, R.AccountNotExist);
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="tuple">
        /// Guid为fiiipay用户的id,long为POSMerchantBindRecords的主键
        /// </param>
        public void InviteFiiiposSuccess(Tuple <Guid, long> tuple)
        {
            var record    = new POSMerchantBindRecordDAC().GetById(tuple.Item2);
            var accountId = tuple.Item1;
            var merchant  = new MerchantAccountDAC().GetById(record.MerchantId);

            var regId = RedisHelper.StringGet($"FiiiPay:Notice:UserId:{accountId}");
            var lang  = RedisHelper.StringGet(REDIS_LANGUAGE_DBINDEX, $"FiiiPay:Language:{accountId}") ?? "en";

            string titleKey    = "InviteFiiiposSuccessTitle";
            string subTitleKey = "InviteFiiiposSuccessSubTitle";

            if (!(_resourcePropertyNames.Contains(titleKey) && _resourcePropertyNames.Contains(subTitleKey)))
            {
                throw new Exception("没有找到资源");
            }
            var title    = ResourceHelper.FiiiPay.GetResource(titleKey, new CultureInfo(lang));
            var subTitle = ResourceHelper.FiiiPay.GetFormatResource(subTitleKey, new CultureInfo(lang), merchant.MerchantName);

            string noticeId = "";

            MessagesComponent.AddMessage(accountId, UserType.User, record.Id.ToString(), FiiiPayPushType.TYPE_INVITE_FIIIPOS_SUCCESS, titleKey, subTitleKey, merchant.MerchantName, title, subTitle, out noticeId);

            RegPush(FiiiPayPushType.TYPE_INVITE_FIIIPOS_SUCCESS, new List <string> {
                regId
            }, record.Id, title, subTitle, noticeId);

            LogHelper.Info($"--------{lang}------{title}----------{subTitle}");
        }
Esempio n. 5
0
        public void ModifyCellphone(Guid accountId, string cellphone)
        {
            var dac     = new MerchantAccountDAC();
            var account = dac.GetById(accountId);

            SecurityVerify.Verify <ModifyCellphoneVerify>(new CustomVerifier("ModifyCellphone"), SystemPlatform.FiiiPOS, account.Id.ToString(), (model) =>
            {
                return(model.PinVerified && model.NewCellphoneVerified && model.CombinedVerified);
            });

            if (account.Cellphone == cellphone)
            {
                throw new CommonException(10000, Resources.新手机号码不能与原来的一致);
            }

            //修改手机号
            dac.UpdateCellphone(accountId, cellphone);

            var agent   = new MerchantProfileAgent();
            var profile = new MerchantProfile
            {
                MerchantId = accountId,
                Cellphone  = cellphone,
                Country    = account.CountryId
            };

            agent.UpdateCellphone(profile);
        }
        //public string GetByPosSn(string sn)
        //{
        //    MerchantAccountDAC dac = new MerchantAccountDAC();

        //    MerchantAccount account = dac.GetByPosSn(sn);
        //    return account?.Username;
        //}
        public MerchantAccount GetByPosSn(string posSn, string merchantAccount)
        {
            MerchantAccount account = new MerchantAccountDAC().GetByUsername(merchantAccount);

            if (account == null)
            {
                throw new CommonException(ReasonCode.UNAUTHORIZED, "UNAUTHORIZED");
            }
            if (!account.POSId.HasValue)
            {
                throw new CommonException(ReasonCode.ACCOUNT_UNBUNDLED, Resources.AccountUnbundled);
            }

            if (account.Status == AccountStatus.Locked)
            {
                throw new CommonException(ReasonCode.ACCOUNT_LOCKED, "Account is locked");
            }

            POS pos = new POSDAC().GetBySn(posSn);

            if (pos == null || pos.Id != account.POSId)
            {
                throw new CommonException(ReasonCode.POSSN_ERROR, Resources.SN码不存在);
            }
            return(account);
        }
        public void CheckAccount(string username, string sn)
        {
            POS pos = new POSDAC().GetBySn(sn);

            if (pos == null || !pos.Status)
            {
                throw new CommonException(ReasonCode.POSSN_ERROR, Resources.SN码不存在);
            }

            if (!pos.IsMiningEnabled)
            {
                throw new CommonException(ReasonCode.NOT_ALLOW_MINING, "Not allow mining");
            }

            MerchantAccount account = new MerchantAccountDAC().GetByPosSn(sn, username);

            if (account == null)
            {
                throw new CommonException(ReasonCode.ACCOUNT_NOT_EXISTS, "Account not exist");
            }

            if (account.Status == AccountStatus.Locked)
            {
                throw new CommonException(ReasonCode.ACCOUNT_LOCKED, "Account locked");
            }
        }
        public SignonDTO Signon(string possn, string merchantAccount, string pin)
        {
            var account = new MerchantAccountDAC().GetByUsername(merchantAccount);

            // 账号不存在
            if (account == null)
            {
                throw new CommonException(ReasonCode.GENERAL_ERROR, Resources.AccountNotExists);
            }
            // 账号未绑定到POS机
            if (!account.POSId.HasValue)
            {
                throw new CommonException(ReasonCode.ACCOUNT_UNBUNDLED, Resources.AccountNotExists);
            }
            if (account.Status == AccountStatus.Locked)
            {
                throw new CommonException(ReasonCode.ACCOUNT_LOCKED, Resources.帐号已锁定);
            }

            var pos = new POSDAC().GetBySn(possn);

            // 不存在和未激活提示SN异常
            if (pos == null || !pos.Status)
            {
                throw new CommonException(ReasonCode.POSSN_ERROR, Resources.SN码不存在);
            }
            if (account.POSId != pos.Id)
            {
                throw new CommonException(ReasonCode.GENERAL_ERROR, Resources.NoBindRelationship);
            }

            new SecurityComponent().FiiiPOSVerifyPin(account, pin);

            return(GetAccessToken(pos, account));
        }
Esempio n. 9
0
        /// <summary>
        /// 获取商家实体[token filter用到]
        /// </summary>
        /// <param name="token"></param>
        /// <returns></returns>
        public MerchantAccount GetMerchantAccountByToken(string token)
        {
            MerchantAccount account    = null;
            string          merchantId = string.Empty;

            WebRedis.GetWebTokenIndRedis(token, out merchantId);
            var result = Guid.TryParse(merchantId, out Guid guid);

            if (result)
            {
                account = new MerchantAccountDAC().GetById(guid);
                if (account == null)
                {
                    throw new CommonException(ReasonCode.UNAUTHORIZED, "未授权");
                }
                if (!account.POSId.HasValue)
                {
                    throw new CommonException(ReasonCode.ACCOUNT_UNBUNDLED, "帐号已被解绑");
                }

                if (account.Status == AccountStatus.Locked)
                {
                    throw new CommonException(ReasonCode.ACCOUNT_LOCKED, "账户已锁定");
                }
            }
            return(account);
        }
        public MerchantSupportReceiptWalletDTO GetSupportReceiptByFiatCurrency(Guid accountId, string fiatCurrency, int coinId)
        {
            var account = new MerchantAccountDAC().GetById(accountId);
            var crypto  = new CryptocurrencyDAC().GetById(coinId);

            var marketPriceComponent = new MarketPriceComponent();
            var marketPrice          = marketPriceComponent.GetMarketPrice(fiatCurrency, crypto.Code);

            var supportReceiptWallets = new MerchantWalletDAC().SupportReceiptList(accountId);
            var singleSupportWallet   = supportReceiptWallets.FirstOrDefault(e => e.CryptoId == crypto.Id);

            if (singleSupportWallet == null)
            {
                return(new MerchantSupportReceiptWalletDTO());
            }

            return(new MerchantSupportReceiptWalletDTO
            {
                WalletId = singleSupportWallet.Id,
                CryptoId = crypto.Id,
                CryptoStatus = crypto.Status,
                CryptoCode = crypto.Code,
                CryptoName = crypto.Name,
                IconURL = crypto.IconURL,
                DecimalPlace = crypto.DecimalPlace,
                Markup = account.Markup,
                MarketPrice = marketPrice?.Price.ToString("F"),
                CryptoEnable = crypto.Enable
            });
        }
Esempio n. 11
0
        public void VerifyCloseCombine(Guid merchantId, string smsCode, string googleCode)
        {
            var merchant = new MerchantAccountDAC().GetById(merchantId);
            List <CombinedVerifyOption> options = new List <CombinedVerifyOption>
            {
                new CombinedVerifyOption {
                    AuthType = (byte)ValidationFlag.Cellphone, Code = smsCode
                },
                new CombinedVerifyOption {
                    AuthType = (byte)ValidationFlag.GooogleAuthenticator, Code = googleCode
                }
            };
            UserSecrets userSecrets = new UserSecrets
            {
                ValidationFlag      = merchant.ValidationFlag,
                GoogleAuthSecretKey = merchant.AuthSecretKey
            };

            SecurityVerify.CombinedVerify(SystemPlatform.FiiiPOS, merchant.Id.ToString(), userSecrets, options, null);

            var model = SecurityVerify.GetModel <CloseGoogleAuth>(new CustomVerifier("CloseGoogleAuth"), SystemPlatform.FiiiPOS, merchant.Id.ToString());

            model.CombinedVerified = true;
            SecurityVerify.SetModel(new CustomVerifier("CloseGoogleAuth"), SystemPlatform.FiiiPOS, merchant.Id.ToString(), model);
        }
Esempio n. 12
0
        /// <summary>
        /// 发送原邮箱验证码 20180523
        /// </summary>
        /// <param name="accountId"></param>
        /// <param name="emailAddress"></param>
        public async Task SendVerifyOriginalEmail(Guid accountId, string emailAddress)
        {
            var dac     = new MerchantAccountDAC();
            var account = dac.GetById(accountId);

            var accountByEmail = dac.GetByEmail(emailAddress);

            if (accountByEmail != null && accountByEmail.Id != accountId)
            {
                throw new CommonException(ReasonCode.FiiiPosReasonCode.EMAIL_BINDED, "该邮箱已绑定到其他账户");
            }

            string key  = $"{RedisKeys.FiiiPOS_WEB_EmailVerification}:{accountId}";
            string code = RandomAlphaNumericGenerator.GenerateAllNumber(6);

            Dictionary <string, string> dic = new Dictionary <string, string>
            {
                { "AccountId", accountId.ToString() },
                { "EmailAddress", emailAddress },
                { "Code", code }
            };

            RedisHelper.Set(key, dic, new TimeSpan(0, Constant.EMAIL_EXPIRED_TIME, 0));

            string subject = Resources.验证码邮箱标题;
            string content = string.Format(Resources.验证码邮箱模版, code, Constant.EMAIL_EXPIRED_TIME);

            EmailAgent agent = new EmailAgent();
            await agent.SendAsync(emailAddress, subject, content, 5);
        }
Esempio n. 13
0
        public void ModifyCellphone(Guid accountId, string cellphone, string smsToken, string token, string gToken)
        {
            //
            var dac     = new MerchantAccountDAC();
            var account = dac.GetById(accountId);

            if (account.Cellphone == cellphone)
            {
                throw new CommonException(ReasonCode.FiiiPosReasonCode.CELLPHONE_MUST_BE_DIFFERENT, "新手机号码不能与原来的一致");
            }

            //验证短信码
            SecurityVerification sv = new SecurityVerification(SystemPlatform.FiiiPOS);

            sv.VerifyToken(accountId, smsToken, SecurityMethod.CellphoneCode);

            //验证pin码
            sv.VerifyToken(accountId, token, SecurityMethod.Pin);

            //验证google token 20180521
            new SecurityVerification(SystemPlatform.FiiiPOS).VerifyToken(accountId, gToken, SecurityMethod.SecurityValidate);

            //修改手机号
            dac.UpdateCellphone(accountId, cellphone);
        }
        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());
        }
Esempio n. 15
0
        public void BindMerchantAccount(BindMerchantAuthIM im, Guid merchantId)
        {
            SecurityVerify.Verify <BindGoogleAuth>(new CustomVerifier("BindGoogleAuth"), SystemPlatform.FiiiPOS, merchantId.ToString(), (model) =>
            {
                return(model.PinVerified && model.GoogleVerified && model.CombinedVerified);
            });

            var mDAC     = new MerchantAccountDAC();
            var merchant = mDAC.GetById(merchantId);

            if (merchant == null)
            {
                throw new CommonException(ReasonCode.ACCOUNT_NOT_EXISTS, Resources.用户不存在);
            }

            if (string.IsNullOrEmpty(merchant.AuthSecretKey))
            {
                var oldFlag = merchant.ValidationFlag;
                var newFlag = ValidationFlagComponent.AddValidationFlag(oldFlag, ValidationFlag.GooogleAuthenticator);
                mDAC.UpdateGoogleAuthencator(merchant.Id, im.SecretKey, newFlag);
            }
            else
            {
                mDAC.SetAuthSecretById(merchant.Id, im.SecretKey);
            }
        }
        public MerchantAccount GetById(Guid accountId)
        {
            MerchantAccountDAC dac = new MerchantAccountDAC();

            MerchantAccount account = dac.GetById(accountId);

            return(account);
        }
Esempio n. 17
0
        public OrderDetailDTO GetById(Guid merchantAccountId, Guid orderId)
        {
            var order = new OrderDAC().GetById(orderId);

            var merchantAccount = new MerchantAccountDAC().GetById(merchantAccountId);

            var pos = new POSDAC().GetById(merchantAccount.POSId.Value);

            if (order == null)
            {
                throw new CommonException(10000, Resources.订单不存在);
            }

            if (order.MerchantAccountId != merchantAccountId)
            {
                throw new CommonException(10000, Resources.只能查看自己的订单);
            }

            var coin  = new CryptocurrencyDAC().GetById(order.CryptoId);
            var er    = order.ExchangeRate;
            var cer   = GetExchangeRate(merchantAccount.CountryId, order.FiatCurrency, coin);
            var iRate = ((cer - er) / er) * 100;

            var result = new OrderDetailDTO
            {
                Id                  = order.Id,
                OrderNo             = order.OrderNo,
                OrderStatus         = order.Status,
                Timestamp           = order.Timestamp.ToUnixTime(),
                CryptoStatus        = coin.Status,
                CryptoEnable        = coin.Enable,
                CryptoCode          = coin.Code,
                CryptoAmount        = order.CryptoAmount.ToString(coin.DecimalPlace),
                FiatCurrency        = order.FiatCurrency,
                FiatAmount          = order.FiatAmount.ToString(2),
                Markup              = order.Markup,
                ActualFiatAmount    = order.ActualFiatAmount.ToString(2),
                TransactionFee      = order.TransactionFee.ToString(coin.DecimalPlace),
                ActualCryptoAmount  = order.ActualCryptoAmount.ToString(coin.DecimalPlace),
                UserAccount         = order.UserAccountId.HasValue ? GetUserMastMaskedCellphone(order.UserAccountId.Value) : string.Empty,
                SN                  = pos.Sn,
                ExchangeRate        = er.ToString(4),
                CurrentExchangeRate = cer.ToString(4),
                IncreaseRate        = iRate > 0 ? $"+{iRate.ToString(2)}" : iRate.ToString(2)
            };

            if (result.OrderStatus == OrderStatus.Refunded)
            {
                var refund = new RefundDAC().GetByOrderId(result.Id);
                if (refund?.Timestamp != null)
                {
                    result.RefundTimestamp = refund.Timestamp.ToUnixTime();
                }
            }
            return(result);
        }
Esempio n. 18
0
        public void SendModifyCellphoneSMS(Guid accountId, string cellphone)
        {
            MerchantAccount account = new MerchantAccountDAC().GetById(accountId);
            Country         country = new CountryComponent().GetById(account.CountryId);

            //加上区号
            cellphone = $"{country.PhoneCode}{cellphone}";

            SecurityVerify.SendCode(new ModifyCellphoneVerifier(), SystemPlatform.FiiiPOS, account.Id.ToString(), cellphone);
        }
Esempio n. 19
0
        /// <summary>
        /// 获取商家账户信息
        /// </summary>
        /// <param name="merchantId"></param>
        /// <returns></returns>
        public MerchantAccount GetMerchantAccount(Guid merchantId)
        {
            var account = new MerchantAccountDAC().GetById(merchantId);

            if (account == null)
            {
                throw new CommonException(ReasonCode.FiiiPosReasonCode.ACCOUNT_NOT_EXISTS, "用户不存在");
            }
            return(account);
        }
Esempio n. 20
0
        public void VerifySetEmailPin(Guid accountId, string pin)
        {
            var account = new MerchantAccountDAC().GetById(accountId);

            SecurityVerify.Verify(new PinVerifier(), SystemPlatform.FiiiPOS, account.Id.ToString(), account.PIN, pin);
            var model = SecurityVerify.GetModel <FiiiPosSetEmailVerify>(new CustomVerifier("SetEmail"), SystemPlatform.FiiiPOS, account.Id.ToString());

            model.PinVerified = true;
            SecurityVerify.SetModel(new CustomVerifier("SetEmail"), SystemPlatform.FiiiPOS, account.Id.ToString(), model);
        }
Esempio n. 21
0
        /// <summary>
        /// 查询所有门店信息
        /// </summary>
        /// <param name="account"></param>
        public MerchantInformationES SelectMerchantInformation(Guid accountId, int countryId)
        {
            var account = new MerchantAccountDAC().GetById(accountId);

            if (account == null)
            {
                throw new CommonException(ReasonCode.FiiiPosReasonCode.ACCOUNT_NOT_EXISTS, "商家账户未注册或不存在");
            }
            var information = new MerchantInformationDAC().GetByMerchantAccountId(account.Id);
            var country     = new CountryDAC().GetById(countryId);

            if (information == null)
            {
                throw new CommonException(ReasonCode.MERCHANT_NONE, "商家没有门店");
                //return new MerchantInformationES()
                //{
                //    Countrys = new Countrys()
                //    {
                //        Name_CN = country.Name_CN,
                //        Name = country.Name
                //    }
                //};
            }

            var figures   = new MerchantOwnersFigureDAC().GetOwnersFiguresById(information.Id);
            var category  = new MerchantCategoryDAC().GetByMerchantInformationId(information.Id);
            var recommend = new MerchantRecommendDAC().GetRecommendsById(information.Id);

            return(new MerchantInformationES()
            {
                MerchantName = information.MerchantName,
                Categorys = category.Select(item => item.Category).ToList(),
                Week = information.Week,
                StartTime = information.StartTime,
                EndTime = information.EndTime,
                Tags = information.Tags,
                Phone = information.Phone,
                Introduce = information.Introduce,
                Address = information.Address,
                Lng = information.Lng,
                Lat = information.Lat,
                VerifyStatus = information.VerifyStatus,
                OwnersFigures = figures.Select(item => item.FileId).ToList(),
                Recommends = recommend.Select(item => new Recommend()
                {
                    Content = item.RecommendContent, Picture = item.RecommendPicture
                }).ToList(),
                Countrys = new Countrys()
                {
                    Name_CN = country.Name_CN,
                    Name = country.Name
                },
                IsPublic = information.IsPublic
            });
        }
Esempio n. 22
0
        public void VerifyOpenGoogleAuth(Guid merchantId, string code)
        {
            var merchant = new MerchantAccountDAC().GetById(merchantId);

            SecurityVerify.Verify(new GoogleVerifier(), SystemPlatform.FiiiPOS, merchant.Id.ToString(), merchant.AuthSecretKey, code);
            var model = new OpenGoogleAuth {
                GoogleVerified = true
            };

            SecurityVerify.SetModel(new CustomVerifier("OpenGoogleAuth"), SystemPlatform.FiiiPOS, merchant.Id.ToString(), model);
        }
        public MerchantAccount GetMerchantAccountBySN(string sn)
        {
            MerchantAccount account = new MerchantAccountDAC().GetByPosSn(sn);

            if (account == null)
            {
                return(null);
            }

            return(account);
        }
        public void VerifyPINByMerchantAccount(string pin, string merchantAccount)
        {
            var dac     = new MerchantAccountDAC();
            var account = dac.GetByUsername(merchantAccount);

            SecurityVerify.Verify(new PinVerifier(), SystemPlatform.FiiiPOS, account.Id.ToString(), account.PIN, pin);
            var model = SecurityVerify.GetModel <BindAccountVerify>(new CustomVerifier("BindAccount"), SystemPlatform.FiiiPOS, merchantAccount);

            model.PinVerified = true;
            SecurityVerify.SetModel(new CustomVerifier("BindAccount"), SystemPlatform.FiiiPOS, merchantAccount, model);
        }
        public void VerifyGoogleAuthByMerchantAccount(string googleCode, string merchantAccount)
        {
            var dac     = new MerchantAccountDAC();
            var account = dac.GetByUsername(merchantAccount);

            SecurityVerify.Verify(new GoogleVerifier(), SystemPlatform.FiiiPOS, account.Id.ToString(), account.AuthSecretKey, googleCode);
            var model = SecurityVerify.GetModel <BindAccountVerify>(new CustomVerifier("BindAccount"), SystemPlatform.FiiiPOS, merchantAccount);

            model.GoogleVerified = true;
            SecurityVerify.SetModel(new CustomVerifier("BindAccount"), SystemPlatform.FiiiPOS, merchantAccount, model);
        }
Esempio n. 26
0
        public string FiiiPOSVerfiyPinReturnToken(Guid accountId, string pin)
        {
            MerchantAccount merchant = new MerchantAccountDAC().GetById(accountId);

            if (merchant == null)
            {
                throw new CommonException(ReasonCode.ACCOUNT_NOT_EXISTS, Resources.用户不存在);
            }
            FiiiPOSVerifyPin(merchant, pin);
            return(new SecurityVerification(SystemPlatform.FiiiPOS).GenegeToken(accountId, SecurityMethod.Pin));
        }
Esempio n. 27
0
        public BonusMessageOM InviteFiiiposSuccessMessage(long id)
        {
            var record   = new POSMerchantBindRecordDAC().GetById(id);
            var merchant = new MerchantAccountDAC().GetById(record.MerchantId);

            return(new BonusMessageOM()
            {
                Title = Resources.InviteFiiiposSuccessTitle,
                Content = Format(Resources.InviteFiiiposSuccessSubTitle, merchant.MerchantName),
                Timestamp = record.BindTime.ToUnixTime().ToString()
            });
        }
Esempio n. 28
0
        public void FiiiPOSSendSecurityValidateCellphoneCode(Guid merchantId, string code)
        {
            MerchantAccount merchant = new MerchantAccountDAC().GetById(merchantId);

            if (merchant == null)
            {
                throw new CommonException(ReasonCode.ACCOUNT_NOT_EXISTS, Resources.用户不存在);
            }
            string fullCellphone = $"{merchant.PhoneCode}{merchant.Cellphone}";

            SecurityVerify.SendCode(new MandatoryCellphoneVerifier(), SystemPlatform.FiiiPOS, code + merchant.Id.ToString(), fullCellphone);
        }
Esempio n. 29
0
        private PrePayOM GetMerchantPrePayOM(Guid userAccountId, MerchantInformation merchantInfo)
        {
            var merchantAccount = new MerchantAccountDAC().GetById(merchantInfo.MerchantAccountId);
            var userWallets     = new UserWalletDAC().GetUserWallets(userAccountId);
            var merchantWallets = new MerchantWalletDAC().GetByAccountId(merchantAccount.Id);
            var coins           = new CryptocurrencyDAC().GetAllActived();
            var priceList       = new PriceInfoDAC().GetPrice(merchantAccount.FiatCurrency);

            bool showWhiteLable = false;

            if (merchantAccount.POSId.HasValue)
            {
                var pos = new POSDAC().GetById(merchantAccount.POSId.Value);
                if (pos.IsWhiteLabel)
                {
                    showWhiteLable = true;
                }
            }

            if (!showWhiteLable)
            {
                var whilteLabelCryptoCode = new POSDAC().GetWhiteLabelCryptoCode();
                coins.RemoveAll(t => t.Code == whilteLabelCryptoCode);
            }

            return(new PrePayOM
            {
                FiatCurrency = merchantAccount.FiatCurrency,
                MarkupRate = merchantAccount.Markup.ToString(CultureInfo.InvariantCulture),
                WaletList = coins.Select(a =>
                {
                    var userWallet = userWallets.FirstOrDefault(b => b.CryptoId == a.Id);
                    decimal rate = 0;
                    rate = priceList.Where(t => t.CryptoID == a.Id).Select(t => t.Price).FirstOrDefault();
                    return GetItem(userWallet, a, merchantWallets, rate);
                }).OrderByDescending(a => a.MerchantSupported).ThenBy(a => a.PayRank).Select(a => new WalletItem
                {
                    Code = a.Code,
                    NewStatus = a.NewStatus,
                    ExchangeRate = a.ExchangeRate,
                    FrozenBalance = a.FrozenBalance,
                    IconUrl = a.IconUrl,
                    Id = a.Id,
                    MerchantSupported = a.MerchantSupported,
                    Name = a.Name,
                    UseableBalance = a.UseableBalance,
                    FiatBalance = a.FiatBalance,
                    DecimalPlace = a.DecimalPlace,
                    CryptoEnable = a.CryptoEnable
                }).ToList()
            });
        }
Esempio n. 30
0
        public void VerifyBindPin(Guid accountId, string pin)
        {
            var merchant = new MerchantAccountDAC().GetById(accountId);

            SecurityVerify.Verify(new PinVerifier(), SystemPlatform.FiiiPOS, merchant.Id.ToString(), merchant.PIN, pin);

            var model = new BindGoogleAuth
            {
                PinVerified = true
            };

            SecurityVerify.SetModel(new CustomVerifier("BindGoogleAuth"), SystemPlatform.FiiiPOS, merchant.Id.ToString(), model);
        }