Feature: Complete order management for pending orders

- Added delete order functionality with identity verification
- OrderDetailsMenu now shows conditional buttons based on order/payment state
- Retry payment if no payments exist
- View payment details if payment pending
- Delete order option for all pending orders
- Full client SDK implementation for CancelOrderAsync

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-06 04:19:47 +01:00
parent 3cc7092967
commit f440042204
5 changed files with 113 additions and 4 deletions

View File

@@ -11,4 +11,5 @@ public interface IOrderService
Task<ApiResponse<Order>> GetOrderByCustomerIdAsync(Guid customerId, Guid orderId);
Task<ApiResponse<CryptoPayment>> CreatePaymentAsync(Guid orderId, int currency);
Task<ApiResponse<List<CryptoPayment>>> GetOrderPaymentsAsync(Guid orderId);
Task<ApiResponse<bool>> CancelOrderAsync(Guid orderId, string identityReference);
}

View File

@@ -185,8 +185,31 @@ public class OrderService : IOrderService
{
_logger.LogError(ex, "Failed to get payments for order {OrderId}", orderId);
return ApiResponse<List<CryptoPayment>>.Failure(
ex.Message,
ex.Message,
System.Net.HttpStatusCode.InternalServerError);
}
}
public async Task<ApiResponse<bool>> CancelOrderAsync(Guid orderId, string identityReference)
{
try
{
var response = await _httpClient.PostAsJsonAsync(
$"api/orders/{orderId}/cancel",
new { IdentityReference = identityReference }
);
if (response.IsSuccessStatusCode)
{
return ApiResponse<bool>.Success(true, response.StatusCode);
}
return ApiResponse<bool>.Failure("Failed to cancel order", response.StatusCode);
}
catch (Exception ex)
{
_logger.LogError(ex, "Error cancelling order {OrderId}", orderId);
return ApiResponse<bool>.Failure($"Error: {ex.Message}", System.Net.HttpStatusCode.InternalServerError);
}
}
}