"Fix-order-details-for-customers"
This commit is contained in:
@@ -113,6 +113,31 @@ public class OrderService : IOrderService
|
||||
System.Net.HttpStatusCode.InternalServerError);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<ApiResponse<Order>> GetOrderByCustomerIdAsync(Guid customerId, Guid orderId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = await _httpClient.GetAsync($"api/orders/by-customer/{customerId}/{orderId}");
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
var order = await response.Content.ReadFromJsonAsync<Order>();
|
||||
if (order != null)
|
||||
return ApiResponse<Order>.Success(order);
|
||||
}
|
||||
|
||||
var error = await response.Content.ReadAsStringAsync();
|
||||
return ApiResponse<Order>.Failure(error, response.StatusCode);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Failed to get order {OrderId} for customer {CustomerId}", orderId, customerId);
|
||||
return ApiResponse<Order>.Failure(
|
||||
ex.Message,
|
||||
System.Net.HttpStatusCode.InternalServerError);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<ApiResponse<CryptoPayment>> CreatePaymentAsync(Guid orderId, int currency)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user