api: finance api implementation

This commit is contained in:
Kwoth
2024-10-29 08:15:53 +00:00
parent df5eced904
commit 8f16b11d02
5 changed files with 191 additions and 10 deletions

View File

@@ -110,7 +110,7 @@ public sealed class NCanvasService : INCanvasService, IReadyExecutor, INService
var wallet = await _cs.GetWalletAsync(userId);
var paid = await wallet.Take(price, new("canvas", "pixel", $"Bought pixel #{position}"));
var paid = await wallet.Take(price, new("canvas", "pixel-buy", $"Bought pixel {new kwum(position)}"));
if (!paid)
{
return SetPixelResult.NotEnoughMoney;
@@ -138,7 +138,7 @@ public sealed class NCanvasService : INCanvasService, IReadyExecutor, INService
if (!success)
{
await wallet.Add(price, new("canvas", "pixel-refund", $"Refund pixel #{position} purchase"));
await wallet.Add(price, new("canvas", "pixel-refund", $"Refund pixel {new kwum(position)} purchase"));
}
return success ? SetPixelResult.Success : SetPixelResult.InsufficientPayment;