Exemple #1
0
        public MessageModel <RemitAvailableAmount> GetAvailableAmount()
        {
            var userId = long.Parse(User.FindFirstValue("id"));
            RemitAvailableAmountSumVo amountSumVo = remitRecordQueryRepositories.QueryRemitAvailableAmount(userId, COUNTRY);


            return(new MessageModel <RemitAvailableAmount>
            {
                Data = new RemitAvailableAmount
                {
                    MonthlyAvailableRemitAmount = (int)amountSumVo.MonthlyAvailableRemitAmount,
                    YearlyAvailableRemitAmount = (int)amountSumVo.YearlyAvailableRemitAmount
                }
            });
        }
        private string CheckIfAmountOutOfRange(long userId, int amount, string country)
        {
            BussinessUnitRemitSetting remitSetting = remitSettingService.GetRemitSettingByCountry(country);

            if (remitSetting == null)
            {
                return("no remit setting for {country}");
            }
            if (amount < remitSetting.RemitMin || amount > remitSetting.RemitMax)
            {
                return(OUT_OF_RANGE);
            }
            RemitAvailableAmountSumVo amountSumVo = remitRecordQueryRepositories.QueryRemitAvailableAmount(userId, country);

            if (amountSumVo.MonthlyAvailableRemitAmount != null && amount > amountSumVo.MonthlyAvailableRemitAmount)
            {
                return(OUT_OF_MONTHLY_MAX);
            }
            if (amountSumVo.YearlyAvailableRemitAmount != null && amount > amountSumVo.YearlyAvailableRemitAmount)
            {
                return(OUT_OF_YEARLY_MAX);
            }
            return(null);
        }