endpoint for preview ecb, instead of only commited one

This commit is contained in:
Priec
2026-07-18 15:50:11 +02:00
parent 0c113831ef
commit dd8f94c9ee
4 changed files with 228 additions and 10 deletions

View File

@@ -2,16 +2,62 @@ syntax = "proto3";
package komp_ac.ecb;
// Read-only access to ECB conversion audit evidence.
// Read-only access to ECB conversion previews and audit evidence.
//
// This service exists for manual visual verification. It exposes conversions
// already recorded by backend posting workflows and never recalculates money.
// This service exists for manual visual verification before and after posting.
// Preview performs the authoritative unrounded backend calculation without
// writing; evidence exposes conversions already recorded by posting workflows.
service EcbService {
// Preview the exact conversion the backend would currently perform.
// This reads local verified ECB data and never persists conversion evidence.
rpc PreviewEcbConversion(PreviewEcbConversionRequest)
returns (PreviewEcbConversionResponse);
// List immutable ECB conversion evidence for one money value.
rpc ListEcbConversionEvidence(ListEcbConversionEvidenceRequest)
returns (ListEcbConversionEvidenceResponse);
}
// Accounting date rule used to select an ECB publication.
enum EcbConversionContext {
ECB_CONVERSION_CONTEXT_UNSPECIFIED = 0;
ECB_CONVERSION_CONTEXT_ORDINARY_TRANSACTION = 1;
ECB_CONVERSION_CONTEXT_FINANCIAL_STATEMENT = 2;
ECB_CONVERSION_CONTEXT_DECISIVE_DATE = 3;
}
// Exact inputs for a conversion preview. Decimal values are strings so the
// client never loses precision through binary floating point.
message PreviewEcbConversionRequest {
string original_amount = 1;
string original_currency = 2;
EcbConversionContext conversion_context = 3;
// ISO calendar date (YYYY-MM-DD). Its meaning is selected by
// conversion_context: transaction, statement, or decisive date.
string anchor_date = 4;
}
// The conversion and immutable local ECB observation that would be used now.
// No rounding is performed and no conversion evidence is persisted.
message PreviewEcbConversionResponse {
string original_amount = 1;
string original_currency = 2;
string eur_amount = 3;
EcbConversionContext conversion_context = 4;
string anchor_date = 5;
string determination_method = 6;
string rounding_method = 7;
optional string rate_date = 8;
optional string units_per_eur = 9;
optional int64 rate_observation_id = 10;
optional string observation_hash = 11;
optional string source_payload_hash = 12;
optional string rate_fetched_at = 13;
optional int64 import_batch_id = 14;
optional string source_endpoint = 15;
}
// Identify one logical money cell whose conversion history should be inspected.
message ListEcbConversionEvidenceRequest {
// Required. Profile containing the table.