fix
This commit is contained in:
parent
d25a3bdaea
commit
e84356411d
@ -147,15 +147,15 @@ public class PaymentController : ControllerBase
|
||||
}
|
||||
|
||||
[HttpGet("payment/quotas")]
|
||||
public IEnumerable<QuotaDto> GetQuotas()
|
||||
public IAsyncEnumerable<QuotaDto> GetQuotas()
|
||||
{
|
||||
return _quotaHelper.GetQuotas();
|
||||
}
|
||||
|
||||
[HttpGet("payment/quota")]
|
||||
public QuotaDto GetQuota()
|
||||
public async Task<QuotaDto> GetQuota()
|
||||
{
|
||||
return _quotaHelper.GetCurrentQuota();
|
||||
return await _quotaHelper.GetCurrentQuota();
|
||||
}
|
||||
|
||||
[HttpPost("payment/request")]
|
||||
|
@ -37,7 +37,7 @@ public class QuotaDto
|
||||
public bool Free { get; set; }
|
||||
public bool Trial { get; set; }
|
||||
|
||||
public IAsyncEnumerable<TenantQuotaFeatureDto> Features { get; set; }
|
||||
public IEnumerable<TenantQuotaFeatureDto> Features { get; set; }
|
||||
}
|
||||
|
||||
public class TenantQuotaFeatureDto : IEquatable<TenantQuotaFeatureDto>
|
||||
|
@ -40,28 +40,31 @@ public class QuotaHelper
|
||||
_serviceProvider = serviceProvider;
|
||||
}
|
||||
|
||||
public IEnumerable<QuotaDto> GetQuotas()
|
||||
public async IAsyncEnumerable<QuotaDto> GetQuotas()
|
||||
{
|
||||
var quotaList = _tenantManager.GetTenantQuotas(false);
|
||||
var priceInfo = _tenantManager.GetProductPriceInfo();
|
||||
var currentRegion = _regionHelper.GetCurrentRegionInfo();
|
||||
|
||||
return quotaList.Select(x => ToQuotaDto(x, priceInfo, currentRegion)).ToList();
|
||||
foreach (var quota in quotaList)
|
||||
{
|
||||
yield return await ToQuotaDto(quota, priceInfo, currentRegion);
|
||||
}
|
||||
}
|
||||
|
||||
public QuotaDto GetCurrentQuota()
|
||||
public async Task<QuotaDto> GetCurrentQuota()
|
||||
{
|
||||
var quota = _tenantManager.GetCurrentTenantQuota();
|
||||
var priceInfo = _tenantManager.GetProductPriceInfo();
|
||||
var currentRegion = _regionHelper.GetCurrentRegionInfo();
|
||||
|
||||
return ToQuotaDto(quota, priceInfo, currentRegion, true);
|
||||
return await ToQuotaDto(quota, priceInfo, currentRegion, true);
|
||||
}
|
||||
|
||||
private QuotaDto ToQuotaDto(TenantQuota quota, IDictionary<string, Dictionary<string, decimal>> priceInfo, RegionInfo currentRegion, bool getUsed = false)
|
||||
private async Task<QuotaDto> ToQuotaDto(TenantQuota quota, IDictionary<string, Dictionary<string, decimal>> priceInfo, RegionInfo currentRegion, bool getUsed = false)
|
||||
{
|
||||
var price = GetPrice(quota, priceInfo, currentRegion);
|
||||
var features = GetFeatures(quota, getUsed);
|
||||
var features = await GetFeatures(quota, getUsed).ToListAsync();
|
||||
|
||||
return new QuotaDto
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user