Implement complete e-commerce functionality with shipping and order management
Features Added: - Standard e-commerce properties (Price, Weight, shipping fields) - Order management with Create/Edit views and shipping information - ShippingRates system for weight-based shipping calculations - Comprehensive test coverage with JWT authentication tests - Sample data seeder with 5 orders demonstrating full workflow - Photo upload functionality for products - Multi-cryptocurrency payment support (BTC, XMR, USDT, etc.) Database Changes: - Added ShippingRates table - Added shipping fields to Orders (Name, Address, City, PostCode, Country) - Renamed properties to standard names (BasePrice to Price, ProductWeight to Weight) - Added UpdatedAt timestamps to models UI Improvements: - Added Create/Edit views for Orders - Added ShippingRates management UI - Updated navigation menu with Shipping option - Enhanced Order Details view with shipping information Sample Data: - 3 Categories (Electronics, Clothing, Books) - 5 Products with various prices - 5 Shipping rates (Royal Mail options) - 5 Orders in different statuses (Pending to Delivered) - 3 Crypto payments demonstrating payment flow Security: - All API endpoints secured with JWT authentication - No public endpoints - client apps must authenticate - Privacy-focused design with minimal data collection Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
96
TeleBot/TeleBotClient/Program.cs
Normal file
96
TeleBot/TeleBotClient/Program.cs
Normal file
@@ -0,0 +1,96 @@
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
class TelegramClient
|
||||
{
|
||||
private static readonly string BotToken = "7330819864:AAHx9GEL-G-WeH2ON5-ncdsbbhV6YaOqZzg";
|
||||
private static readonly string ApiUrl = $"https://api.telegram.org/bot{BotToken}/";
|
||||
|
||||
static async Task Main()
|
||||
{
|
||||
Console.WriteLine("Telegram Bot Client Started...");
|
||||
|
||||
while (true)
|
||||
{
|
||||
await ReceiveMessagesAsync();
|
||||
await Task.Delay(5000); // Polling delay
|
||||
}
|
||||
}
|
||||
|
||||
private static async Task SendMessageAsync(string chatId, string message)
|
||||
{
|
||||
using HttpClient client = new HttpClient();
|
||||
var payload = new
|
||||
{
|
||||
chat_id = chatId,
|
||||
text = message
|
||||
};
|
||||
|
||||
var content = new StringContent(JsonSerializer.Serialize(payload), Encoding.UTF8, "application/json");
|
||||
try
|
||||
{
|
||||
var response = await client.PostAsync(ApiUrl + "sendMessage", content);
|
||||
var responseText = await response.Content.ReadAsStringAsync();
|
||||
|
||||
Console.WriteLine($"Response: {responseText}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Error sending message: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private static async Task ReceiveMessagesAsync()
|
||||
{
|
||||
using HttpClient client = new HttpClient();
|
||||
try
|
||||
{
|
||||
var response = await client.GetAsync(ApiUrl + "getUpdates");
|
||||
response.EnsureSuccessStatusCode();
|
||||
|
||||
var responseText = await response.Content.ReadAsStringAsync();
|
||||
var updates = JsonSerializer.Deserialize<TelegramUpdateResponse>(responseText);
|
||||
|
||||
if (updates?.Result != null)
|
||||
{
|
||||
foreach (var update in updates.Result)
|
||||
{
|
||||
Console.WriteLine($"Received message from {update.Message.Chat.Id}: {update.Message.Text}");
|
||||
await SendMessageAsync(update.Message.Chat.Id.ToString(), "Message received!");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (HttpRequestException httpEx)
|
||||
{
|
||||
Console.WriteLine($"HTTP error: {httpEx.Message}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Unexpected error: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class TelegramUpdateResponse
|
||||
{
|
||||
public TelegramUpdate[] Result { get; set; }
|
||||
}
|
||||
|
||||
class TelegramUpdate
|
||||
{
|
||||
public TelegramMessage Message { get; set; }
|
||||
}
|
||||
|
||||
class TelegramMessage
|
||||
{
|
||||
public TelegramChat Chat { get; set; }
|
||||
public string Text { get; set; }
|
||||
}
|
||||
|
||||
class TelegramChat
|
||||
{
|
||||
public long Id { get; set; }
|
||||
}
|
||||
10
TeleBot/TeleBotClient/TeleBotClient.csproj
Normal file
10
TeleBot/TeleBotClient/TeleBotClient.csproj
Normal file
@@ -0,0 +1,10 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user