using LittleShop.Enums;
namespace LittleShop.Services;
public interface ISilverPayService
{
///
/// Create a new payment order in SilverPAY
///
/// External order ID (LittleShop order ID)
/// Amount in fiat currency (GBP)
/// Cryptocurrency to accept
/// Optional order description
/// Optional webhook URL for payment notifications
/// SilverPAY order details including payment address
Task CreateOrderAsync(
string externalId,
decimal amount,
CryptoCurrency currency,
string? description = null,
string? webhookUrl = null);
///
/// Get the status of a SilverPAY order
///
/// SilverPAY order ID
/// Order status and payment details
Task GetOrderStatusAsync(string orderId);
///
/// Validate webhook signature from SilverPAY
///
/// Webhook payload
/// Webhook signature header
/// True if signature is valid
Task ValidateWebhookAsync(string payload, string signature);
///
/// Get current exchange rate for crypto to fiat
///
/// Cryptocurrency symbol
/// Fiat currency (GBP, USD, EUR)
/// Current exchange rate
Task GetExchangeRateAsync(string cryptoCurrency, string fiatCurrency = "GBP");
///
/// Get list of supported cryptocurrencies from SilverPAY
///
/// List of supported currency codes
Task> GetSupportedCurrenciesAsync();
}
///
/// Response from SilverPAY order creation/status
///
public class SilverPayOrderResponse
{
public string Id { get; set; } = string.Empty;
public string ExternalId { get; set; } = string.Empty;
public decimal Amount { get; set; }
public string Currency { get; set; } = string.Empty;
public string PaymentAddress { get; set; } = string.Empty;
public string Status { get; set; } = string.Empty;
public DateTime CreatedAt { get; set; }
public DateTime ExpiresAt { get; set; }
public DateTime? PaidAt { get; set; }
public Dictionary? PaymentDetails { get; set; }
// Additional fields for crypto amounts
public decimal? CryptoAmount { get; set; }
public string? TransactionHash { get; set; }
public int? Confirmations { get; set; }
}
///
/// Webhook notification from SilverPAY
///
public class SilverPayWebhookNotification
{
public string OrderId { get; set; } = string.Empty;
public string ExternalId { get; set; } = string.Empty;
public string Status { get; set; } = string.Empty;
public string Address { get; set; } = string.Empty;
public string? TxHash { get; set; }
public decimal Amount { get; set; }
public int Confirmations { get; set; }
public int? BlockHeight { get; set; }
public DateTime Timestamp { get; set; }
}