更新20260316
This commit is contained in:
@@ -32,13 +32,13 @@ public class ApiService
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<Order?> CreateOrderAsync(int packageId)
|
||||
public async Task<CreateOrderResponse?> CreateOrderAsync(int packageId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = await _httpClient.PostAsJsonAsync("api/orders", new { packageId });
|
||||
response.EnsureSuccessStatusCode();
|
||||
return await response.Content.ReadFromJsonAsync<Order>();
|
||||
return await response.Content.ReadFromJsonAsync<CreateOrderResponse>();
|
||||
}
|
||||
catch (HttpRequestException ex)
|
||||
{
|
||||
@@ -60,6 +60,19 @@ public class ApiService
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<PaymentStatusResponse?> GetPaymentStatusAsync(int orderId, string outTradeNo)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await _httpClient.GetFromJsonAsync<PaymentStatusResponse>(
|
||||
$"api/orders/{orderId}/payment-status?outTradeNo={Uri.EscapeDataString(outTradeNo)}");
|
||||
}
|
||||
catch (HttpRequestException ex)
|
||||
{
|
||||
throw new Exception($"获取支付状态失败: {ex.Message}", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<Order?> GetOrderAsync(int orderId)
|
||||
{
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user