Updated endpoints
This commit is contained in:
parent
1f27bcb564
commit
0f725666c0
@ -38,18 +38,8 @@
|
|||||||
|
|
||||||
public string RegisterWebsite { get; set; }
|
public string RegisterWebsite { get; set; }
|
||||||
|
|
||||||
public string CatalogEndpoint { get; set; }
|
|
||||||
|
|
||||||
public string OrdersEndpoint { get; set; }
|
|
||||||
|
|
||||||
public string BasketEndpoint { get; set; }
|
|
||||||
|
|
||||||
public string IdentityEndpoint { get; set; }
|
public string IdentityEndpoint { get; set; }
|
||||||
|
|
||||||
public string LocationEndpoint { get; set; }
|
|
||||||
|
|
||||||
public string MarketingEndpoint { get; set; }
|
|
||||||
|
|
||||||
public string UserInfoEndpoint { get; set; }
|
public string UserInfoEndpoint { get; set; }
|
||||||
|
|
||||||
public string TokenEndpoint { get; set; }
|
public string TokenEndpoint { get; set; }
|
||||||
@ -73,12 +63,6 @@
|
|||||||
LogoutEndpoint = $"{connectBaseEndpoint}/endsession";
|
LogoutEndpoint = $"{connectBaseEndpoint}/endsession";
|
||||||
|
|
||||||
IdentityCallback = $"{baseEndpoint}/xamarincallback";
|
IdentityCallback = $"{baseEndpoint}/xamarincallback";
|
||||||
|
|
||||||
CatalogEndpoint = $"{baseEndpoint}:5101";
|
|
||||||
OrdersEndpoint = $"{baseEndpoint}:5102";
|
|
||||||
BasketEndpoint = $"{baseEndpoint}:5103";
|
|
||||||
LocationEndpoint = $"{baseEndpoint}:5109";
|
|
||||||
MarketingEndpoint = $"{baseEndpoint}:5110";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -11,7 +11,7 @@ namespace eShopOnContainers.Core.Services.Basket
|
|||||||
private readonly IRequestProvider _requestProvider;
|
private readonly IRequestProvider _requestProvider;
|
||||||
private readonly IFixUriService _fixUriService;
|
private readonly IFixUriService _fixUriService;
|
||||||
|
|
||||||
private const string ApiUrlBase = "api/v1/basket";
|
private const string ApiUrlBase = "mobileshoppingapigw/api/v1/b/basket";
|
||||||
|
|
||||||
public BasketService(IRequestProvider requestProvider, IFixUriService fixUriService)
|
public BasketService(IRequestProvider requestProvider, IFixUriService fixUriService)
|
||||||
{
|
{
|
||||||
@ -21,15 +21,23 @@ namespace eShopOnContainers.Core.Services.Basket
|
|||||||
|
|
||||||
public async Task<CustomerBasket> GetBasketAsync(string guidUser, string token)
|
public async Task<CustomerBasket> GetBasketAsync(string guidUser, string token)
|
||||||
{
|
{
|
||||||
var builder = new UriBuilder(GlobalSetting.Instance.BasketEndpoint)
|
var builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint)
|
||||||
{
|
{
|
||||||
Path = $"{ApiUrlBase}/{guidUser}"
|
Path = $"{ApiUrlBase}/{guidUser}"
|
||||||
};
|
};
|
||||||
|
|
||||||
var uri = builder.ToString();
|
var uri = builder.ToString();
|
||||||
|
|
||||||
CustomerBasket basket =
|
CustomerBasket basket;
|
||||||
await _requestProvider.GetAsync<CustomerBasket>(uri, token);
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
basket = await _requestProvider.GetAsync<CustomerBasket>(uri, token);
|
||||||
|
}
|
||||||
|
catch (HttpRequestExceptionEx exception) when (exception.HttpCode == System.Net.HttpStatusCode.NotFound)
|
||||||
|
{
|
||||||
|
basket = null;
|
||||||
|
}
|
||||||
|
|
||||||
_fixUriService.FixBasketItemPictureUri(basket?.Items);
|
_fixUriService.FixBasketItemPictureUri(basket?.Items);
|
||||||
return basket;
|
return basket;
|
||||||
@ -37,7 +45,7 @@ namespace eShopOnContainers.Core.Services.Basket
|
|||||||
|
|
||||||
public async Task<CustomerBasket> UpdateBasketAsync(CustomerBasket customerBasket, string token)
|
public async Task<CustomerBasket> UpdateBasketAsync(CustomerBasket customerBasket, string token)
|
||||||
{
|
{
|
||||||
var builder = new UriBuilder(GlobalSetting.Instance.BasketEndpoint)
|
var builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint)
|
||||||
{
|
{
|
||||||
Path = ApiUrlBase
|
Path = ApiUrlBase
|
||||||
};
|
};
|
||||||
@ -49,7 +57,7 @@ namespace eShopOnContainers.Core.Services.Basket
|
|||||||
|
|
||||||
public async Task CheckoutAsync(BasketCheckout basketCheckout, string token)
|
public async Task CheckoutAsync(BasketCheckout basketCheckout, string token)
|
||||||
{
|
{
|
||||||
var builder = new UriBuilder(GlobalSetting.Instance.BasketEndpoint)
|
var builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint)
|
||||||
{
|
{
|
||||||
Path = $"{ApiUrlBase}/checkout"
|
Path = $"{ApiUrlBase}/checkout"
|
||||||
};
|
};
|
||||||
@ -60,7 +68,7 @@ namespace eShopOnContainers.Core.Services.Basket
|
|||||||
|
|
||||||
public async Task ClearBasketAsync(string guidUser, string token)
|
public async Task ClearBasketAsync(string guidUser, string token)
|
||||||
{
|
{
|
||||||
var builder = new UriBuilder(GlobalSetting.Instance.BasketEndpoint)
|
var builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint)
|
||||||
{
|
{
|
||||||
Path = $"{ApiUrlBase}/{guidUser}"
|
Path = $"{ApiUrlBase}/{guidUser}"
|
||||||
};
|
};
|
||||||
|
@ -13,6 +13,8 @@ namespace eShopOnContainers.Core.Services.Catalog
|
|||||||
{
|
{
|
||||||
private readonly IRequestProvider _requestProvider;
|
private readonly IRequestProvider _requestProvider;
|
||||||
private readonly IFixUriService _fixUriService;
|
private readonly IFixUriService _fixUriService;
|
||||||
|
|
||||||
|
private const string ApiUrlBase = "mobileshoppingapigw/api/v1/c/catalog";
|
||||||
|
|
||||||
public CatalogService(IRequestProvider requestProvider, IFixUriService fixUriService)
|
public CatalogService(IRequestProvider requestProvider, IFixUriService fixUriService)
|
||||||
{
|
{
|
||||||
@ -22,8 +24,8 @@ namespace eShopOnContainers.Core.Services.Catalog
|
|||||||
|
|
||||||
public async Task<ObservableCollection<CatalogItem>> FilterAsync(int catalogBrandId, int catalogTypeId)
|
public async Task<ObservableCollection<CatalogItem>> FilterAsync(int catalogBrandId, int catalogTypeId)
|
||||||
{
|
{
|
||||||
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.CatalogEndpoint);
|
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint);
|
||||||
builder.Path = string.Format("api/v1/catalog/items/type/{0}/brand/{1}", catalogTypeId, catalogBrandId);
|
builder.Path = string.Format($"{ApiUrlBase}/items/type/{0}/brand/{1}", catalogTypeId, catalogBrandId);
|
||||||
string uri = builder.ToString();
|
string uri = builder.ToString();
|
||||||
|
|
||||||
CatalogRoot catalog = await _requestProvider.GetAsync<CatalogRoot>(uri);
|
CatalogRoot catalog = await _requestProvider.GetAsync<CatalogRoot>(uri);
|
||||||
@ -36,8 +38,8 @@ namespace eShopOnContainers.Core.Services.Catalog
|
|||||||
|
|
||||||
public async Task<ObservableCollection<CatalogItem>> GetCatalogAsync()
|
public async Task<ObservableCollection<CatalogItem>> GetCatalogAsync()
|
||||||
{
|
{
|
||||||
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.CatalogEndpoint);
|
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint);
|
||||||
builder.Path = "api/v1/catalog/items";
|
builder.Path = $"{ApiUrlBase}/items";
|
||||||
string uri = builder.ToString();
|
string uri = builder.ToString();
|
||||||
|
|
||||||
CatalogRoot catalog = await _requestProvider.GetAsync<CatalogRoot>(uri);
|
CatalogRoot catalog = await _requestProvider.GetAsync<CatalogRoot>(uri);
|
||||||
@ -53,8 +55,8 @@ namespace eShopOnContainers.Core.Services.Catalog
|
|||||||
|
|
||||||
public async Task<ObservableCollection<CatalogBrand>> GetCatalogBrandAsync()
|
public async Task<ObservableCollection<CatalogBrand>> GetCatalogBrandAsync()
|
||||||
{
|
{
|
||||||
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.CatalogEndpoint);
|
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint);
|
||||||
builder.Path = "api/v1/catalog/catalogbrands";
|
builder.Path = $"{ApiUrlBase}/catalogbrands";
|
||||||
string uri = builder.ToString();
|
string uri = builder.ToString();
|
||||||
|
|
||||||
IEnumerable<CatalogBrand> brands = await _requestProvider.GetAsync<IEnumerable<CatalogBrand>>(uri);
|
IEnumerable<CatalogBrand> brands = await _requestProvider.GetAsync<IEnumerable<CatalogBrand>>(uri);
|
||||||
@ -67,8 +69,8 @@ namespace eShopOnContainers.Core.Services.Catalog
|
|||||||
|
|
||||||
public async Task<ObservableCollection<CatalogType>> GetCatalogTypeAsync()
|
public async Task<ObservableCollection<CatalogType>> GetCatalogTypeAsync()
|
||||||
{
|
{
|
||||||
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.CatalogEndpoint);
|
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint);
|
||||||
builder.Path = "api/v1/catalog/catalogtypes";
|
builder.Path = $"{ApiUrlBase}/catalogtypes";
|
||||||
string uri = builder.ToString();
|
string uri = builder.ToString();
|
||||||
|
|
||||||
IEnumerable<CatalogType> types = await _requestProvider.GetAsync<IEnumerable<CatalogType>>(uri);
|
IEnumerable<CatalogType> types = await _requestProvider.GetAsync<IEnumerable<CatalogType>>(uri);
|
||||||
|
@ -15,8 +15,8 @@ namespace eShopOnContainers.Core.Services.Location
|
|||||||
|
|
||||||
public async Task UpdateUserLocation(eShopOnContainers.Core.Models.Location.Location newLocReq, string token)
|
public async Task UpdateUserLocation(eShopOnContainers.Core.Models.Location.Location newLocReq, string token)
|
||||||
{
|
{
|
||||||
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.LocationEndpoint);
|
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint);
|
||||||
builder.Path = "api/v1/locations";
|
builder.Path = "/mobilemarketingapigw/api/v1/l/locations";
|
||||||
string uri = builder.ToString();
|
string uri = builder.ToString();
|
||||||
await _requestProvider.PostAsync(uri, newLocReq, token);
|
await _requestProvider.PostAsync(uri, newLocReq, token);
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,8 @@ namespace eShopOnContainers.Core.Services.Marketing
|
|||||||
private readonly IRequestProvider _requestProvider;
|
private readonly IRequestProvider _requestProvider;
|
||||||
private readonly IFixUriService _fixUriService;
|
private readonly IFixUriService _fixUriService;
|
||||||
|
|
||||||
|
private const string ApiUrlBase = "mobilemarketingapigw/api/v1/m/campaigns";
|
||||||
|
|
||||||
public CampaignService(IRequestProvider requestProvider, IFixUriService fixUriService)
|
public CampaignService(IRequestProvider requestProvider, IFixUriService fixUriService)
|
||||||
{
|
{
|
||||||
_requestProvider = requestProvider;
|
_requestProvider = requestProvider;
|
||||||
@ -21,8 +23,8 @@ namespace eShopOnContainers.Core.Services.Marketing
|
|||||||
|
|
||||||
public async Task<ObservableCollection<CampaignItem>> GetAllCampaignsAsync(string token)
|
public async Task<ObservableCollection<CampaignItem>> GetAllCampaignsAsync(string token)
|
||||||
{
|
{
|
||||||
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.MarketingEndpoint);
|
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint);
|
||||||
builder.Path = "api/v1/campaigns/user";
|
builder.Path = $"{ApiUrlBase}/user";
|
||||||
string uri = builder.ToString();
|
string uri = builder.ToString();
|
||||||
|
|
||||||
CampaignRoot campaign = await _requestProvider.GetAsync<CampaignRoot>(uri, token);
|
CampaignRoot campaign = await _requestProvider.GetAsync<CampaignRoot>(uri, token);
|
||||||
@ -38,8 +40,8 @@ namespace eShopOnContainers.Core.Services.Marketing
|
|||||||
|
|
||||||
public async Task<CampaignItem> GetCampaignByIdAsync(int campaignId, string token)
|
public async Task<CampaignItem> GetCampaignByIdAsync(int campaignId, string token)
|
||||||
{
|
{
|
||||||
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.MarketingEndpoint);
|
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint);
|
||||||
builder.Path = $"api/v1/campaigns/{campaignId}";
|
builder.Path = $"{ApiUrlBase}/{campaignId}";
|
||||||
string uri = builder.ToString();
|
string uri = builder.ToString();
|
||||||
return await _requestProvider.GetAsync<CampaignItem>(uri, token);
|
return await _requestProvider.GetAsync<CampaignItem>(uri, token);
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,8 @@ namespace eShopOnContainers.Core.Services.Order
|
|||||||
{
|
{
|
||||||
private readonly IRequestProvider _requestProvider;
|
private readonly IRequestProvider _requestProvider;
|
||||||
|
|
||||||
|
private const string ApiUrlBase = "mobileshoppingapigw/api/v1/o/orders";
|
||||||
|
|
||||||
public OrderService(IRequestProvider requestProvider)
|
public OrderService(IRequestProvider requestProvider)
|
||||||
{
|
{
|
||||||
_requestProvider = requestProvider;
|
_requestProvider = requestProvider;
|
||||||
@ -23,9 +25,9 @@ namespace eShopOnContainers.Core.Services.Order
|
|||||||
|
|
||||||
public async Task<ObservableCollection<Models.Orders.Order>> GetOrdersAsync(string token)
|
public async Task<ObservableCollection<Models.Orders.Order>> GetOrdersAsync(string token)
|
||||||
{
|
{
|
||||||
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.OrdersEndpoint);
|
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint);
|
||||||
|
|
||||||
builder.Path = "api/v1/orders";
|
builder.Path = ApiUrlBase;
|
||||||
|
|
||||||
string uri = builder.ToString();
|
string uri = builder.ToString();
|
||||||
|
|
||||||
@ -40,9 +42,9 @@ namespace eShopOnContainers.Core.Services.Order
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.OrdersEndpoint);
|
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint);
|
||||||
|
|
||||||
builder.Path = string.Format("api/v1/orders/{0}", orderId);
|
builder.Path = string.Format($"{ApiUrlBase}/{0}", orderId);
|
||||||
|
|
||||||
string uri = builder.ToString();
|
string uri = builder.ToString();
|
||||||
|
|
||||||
@ -76,9 +78,9 @@ namespace eShopOnContainers.Core.Services.Order
|
|||||||
|
|
||||||
public async Task<bool> CancelOrderAsync(int orderId, string token)
|
public async Task<bool> CancelOrderAsync(int orderId, string token)
|
||||||
{
|
{
|
||||||
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.OrdersEndpoint);
|
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint);
|
||||||
|
|
||||||
builder.Path = "api/v1/orders/cancel";
|
builder.Path = $"{ApiUrlBase}/cancel";
|
||||||
|
|
||||||
var cancelOrderCommand = new CancelOrderCommand(orderId);
|
var cancelOrderCommand = new CancelOrderCommand(orderId);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user