Fix Fake Data Generator for the reports

This commit is contained in:
nicolas.dorier 2024-07-04 19:01:58 +09:00
parent 1157e2d04b
commit 4eb155696c
No known key found for this signature in database
GPG key ID: 6618763EF09186FE
2 changed files with 8 additions and 6 deletions

View file

@ -92,8 +92,10 @@ public partial class UIReportsController
return Encoders.Base58.EncodeData(GenerateBytes(20)); return Encoders.Base58.EncodeData(GenerateBytes(20));
if (f.Type == "boolean") if (f.Type == "boolean")
return GenerateBytes(1)[0] % 2 == 0; return GenerateBytes(1)[0] % 2 == 0;
if (f.Name == "PaymentType") if (f.Name == "PaymentType" || f.Name == "Category")
return TakeOne("On-Chain", "Lightning"); return TakeOne("On-Chain", "Lightning");
if (f.Name == "PaymentMethodId")
return TakeOne("BTC-CHAIN", "BTC-LN", "BTC-LNURL");
if (f.Name == "PaymentId") if (f.Name == "PaymentId")
if (row[fi -1] is "On-Chain") if (row[fi -1] is "On-Chain")
return Encoders.Hex.EncodeData(GenerateBytes(32)) + "-" + rand.NextInt64(0, 4); return Encoders.Hex.EncodeData(GenerateBytes(32)) + "-" + rand.NextInt64(0, 4);
@ -101,9 +103,9 @@ public partial class UIReportsController
return Encoders.Hex.EncodeData(GenerateBytes(32)); return Encoders.Hex.EncodeData(GenerateBytes(32));
if (f.Name == "Address") if (f.Name == "Address")
return Encoders.Bech32("bc1").Encode(0, GenerateBytes(20)); return Encoders.Bech32("bc1").Encode(0, GenerateBytes(20));
if (f.Name == "Crypto") if (f.Name == "Crypto" || f.Name == "PaymentCurrency")
return cryptoCurrency; return cryptoCurrency;
if (f.Name == "CryptoAmount") if (f.Name == "CryptoAmount" || f.Name == "PaymentAmount")
return DisplayFormatter.ToFormattedAmount(GenerateDecimal(0.1m, 5m, 8), cryptoCurrency); return DisplayFormatter.ToFormattedAmount(GenerateDecimal(0.1m, 5m, 8), cryptoCurrency);
if (f.Name == "LightningAddress") if (f.Name == "LightningAddress")
return TakeOne("satoshi", "satosan", "satoichi") + "@bitcoin.org"; return TakeOne("satoshi", "satosan", "satoichi") + "@bitcoin.org";
@ -119,9 +121,9 @@ public partial class UIReportsController
return TakeOne("AppA", "AppB"); return TakeOne("AppA", "AppB");
if (f.Name == "Quantity") if (f.Name == "Quantity")
return TakeOne(1, 2, 3, 4, 5); return TakeOne(1, 2, 3, 4, 5);
if (f.Name == "Currency") if (f.Name.EndsWith("Currency"))
return fiatCurrency; return fiatCurrency;
if (f.Name == "CurrencyAmount") if (f.Name.EndsWith("CurrencyAmount"))
{ {
var curr = row[fi - 1]?.ToString(); var curr = row[fi - 1]?.ToString();
var value = curr switch var value = curr switch

View file

@ -33,7 +33,7 @@ public class LegacyInvoiceExportReportProvider : ReportProvider
new("ReceivedDate", "datetime"), new("ReceivedDate", "datetime"),
new("StoreId", "text"), new("StoreId", "text"),
new("OrderId", "text"), new("OrderId", "text"),
new("InvoiceId", "text"), new("InvoiceId", "invoice_id"),
new("InvoiceCreatedDate", "datetime"), new("InvoiceCreatedDate", "datetime"),
new("InvoiceExpirationDate", "datetime"), new("InvoiceExpirationDate", "datetime"),
new("InvoiceMonitoringDate", "datetime"), new("InvoiceMonitoringDate", "datetime"),