- Removed all BTCPay references from services and configuration
- Implemented SilverPAY as sole payment provider (no fallback)
- Fixed JWT authentication with proper key length (256+ bits)
- Added UsersController with full CRUD operations
- Updated User model with Email and Role properties
- Configured TeleBot with real Telegram bot token
- Fixed launchSettings.json with JWT environment variable
- E2E tests passing for authentication, catalog, orders
- Payment creation pending SilverPAY server fix
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
83 lines
3.1 KiB
C#
83 lines
3.1 KiB
C#
using LittleShop.Enums;
|
|
|
|
namespace LittleShop.Services;
|
|
|
|
public interface ISilverPayService
|
|
{
|
|
/// <summary>
|
|
/// Create a new payment order in SilverPAY
|
|
/// </summary>
|
|
/// <param name="externalId">External order ID (LittleShop order ID)</param>
|
|
/// <param name="amount">Amount in fiat currency (GBP)</param>
|
|
/// <param name="currency">Cryptocurrency to accept</param>
|
|
/// <param name="description">Optional order description</param>
|
|
/// <param name="webhookUrl">Optional webhook URL for payment notifications</param>
|
|
/// <returns>SilverPAY order details including payment address</returns>
|
|
Task<SilverPayOrderResponse> CreateOrderAsync(
|
|
string externalId,
|
|
decimal amount,
|
|
CryptoCurrency currency,
|
|
string? description = null,
|
|
string? webhookUrl = null);
|
|
|
|
/// <summary>
|
|
/// Get the status of a SilverPAY order
|
|
/// </summary>
|
|
/// <param name="orderId">SilverPAY order ID</param>
|
|
/// <returns>Order status and payment details</returns>
|
|
Task<SilverPayOrderResponse?> GetOrderStatusAsync(string orderId);
|
|
|
|
/// <summary>
|
|
/// Validate webhook signature from SilverPAY
|
|
/// </summary>
|
|
/// <param name="payload">Webhook payload</param>
|
|
/// <param name="signature">Webhook signature header</param>
|
|
/// <returns>True if signature is valid</returns>
|
|
Task<bool> ValidateWebhookAsync(string payload, string signature);
|
|
|
|
/// <summary>
|
|
/// Get current exchange rate for crypto to fiat
|
|
/// </summary>
|
|
/// <param name="cryptoCurrency">Cryptocurrency symbol</param>
|
|
/// <param name="fiatCurrency">Fiat currency (GBP, USD, EUR)</param>
|
|
/// <returns>Current exchange rate</returns>
|
|
Task<decimal?> GetExchangeRateAsync(string cryptoCurrency, string fiatCurrency = "GBP");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Response from SilverPAY order creation/status
|
|
/// </summary>
|
|
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<string, object>? PaymentDetails { get; set; }
|
|
|
|
// Additional fields for crypto amounts
|
|
public decimal? CryptoAmount { get; set; }
|
|
public string? TransactionHash { get; set; }
|
|
public int? Confirmations { get; set; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Webhook notification from SilverPAY
|
|
/// </summary>
|
|
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; }
|
|
} |