ecb conversions with corrections2

This commit is contained in:
Priec
2026-08-13 11:41:28 +02:00
parent 8f8b5b4601
commit 774c9a3ce0
9 changed files with 569 additions and 112 deletions

View File

@@ -1,4 +1,22 @@
// This file is @generated by prost-build.
/// Accountant-controlled conversion treatment. Exceptional choices remain
/// explicit and auditable rather than being inferred from a legal label.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ExchangeRateSelection {
#[prost(enumeration = "ExchangeRateDateRule", tag = "1")]
pub date_rule: i32,
#[prost(enumeration = "ExchangeRateSource", tag = "2")]
pub source: i32,
/// Required for SPECIFIC_PUBLICATION_DATE and MANUAL; YYYY-MM-DD.
#[prost(string, optional, tag = "3")]
pub specific_rate_date: ::core::option::Option<::prost::alloc::string::String>,
/// Required only for MANUAL. Exact foreign-currency units per EUR.
#[prost(string, optional, tag = "4")]
pub manual_units_per_eur: ::core::option::Option<::prost::alloc::string::String>,
/// Required for SPECIFIC_PUBLICATION_DATE and MANUAL.
#[prost(string, tag = "5")]
pub reason: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetEcbPipelineStatusRequest {
/// Optional. How many recent import attempts to return. Zero uses 20; the
@@ -94,22 +112,16 @@ pub struct PreviewEcbConversionRequest {
pub original_amount: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub original_currency: ::prost::alloc::string::String,
#[prost(enumeration = "EcbConversionContext", tag = "3")]
pub conversion_context: i32,
/// ISO calendar date (YYYY-MM-DD) from which the applicable publication date
/// is derived. Its meaning is selected by conversion_context: transaction,
/// statement, or decisive date.
#[prost(string, tag = "4")]
/// ISO calendar date (YYYY-MM-DD) of the accounting case.
#[prost(string, tag = "3")]
pub conversion_basis_date: ::prost::alloc::string::String,
/// Required. Profile whose rates apply. Only consulted when use_custom_rate is
/// set, but always required so a preview names the books it describes.
#[prost(string, tag = "5")]
/// Required. Profile whose rates apply. Consulted when the selection requests
/// a saved custom rate, and always required so the preview names its books.
#[prost(string, tag = "4")]
pub profile_name: ::prost::alloc::string::String,
/// Preview the profile's own rate for the publication date rather than the ECB
/// reference rate. Must match what the posting will ask for, or the preview
/// describes a conversion that will not happen.
#[prost(bool, tag = "6")]
pub use_custom_rate: bool,
/// Empty uses previous publication and ECB.
#[prost(message, optional, tag = "5")]
pub exchange_rate_selection: ::core::option::Option<ExchangeRateSelection>,
}
/// The conversion and immutable local ECB observation that would be used now.
/// No rounding is performed and no conversion evidence is persisted.
@@ -121,41 +133,47 @@ pub struct PreviewEcbConversionResponse {
pub original_currency: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub eur_amount: ::prost::alloc::string::String,
#[prost(enumeration = "EcbConversionContext", tag = "4")]
pub conversion_context: i32,
#[prost(string, tag = "5")]
#[prost(string, tag = "4")]
pub conversion_basis_date: ::prost::alloc::string::String,
#[prost(string, tag = "6")]
#[prost(string, tag = "5")]
pub determination_method: ::prost::alloc::string::String,
#[prost(string, tag = "7")]
#[prost(string, tag = "6")]
pub rounding_method: ::prost::alloc::string::String,
#[prost(string, optional, tag = "8")]
#[prost(string, optional, tag = "7")]
pub rate_date: ::core::option::Option<::prost::alloc::string::String>,
#[prost(string, optional, tag = "9")]
#[prost(string, optional, tag = "8")]
pub units_per_eur: ::core::option::Option<::prost::alloc::string::String>,
#[prost(int64, optional, tag = "10")]
#[prost(int64, optional, tag = "9")]
pub rate_observation_id: ::core::option::Option<i64>,
#[prost(string, optional, tag = "11")]
#[prost(string, optional, tag = "10")]
pub observation_hash: ::core::option::Option<::prost::alloc::string::String>,
#[prost(string, optional, tag = "12")]
#[prost(string, optional, tag = "11")]
pub source_payload_hash: ::core::option::Option<::prost::alloc::string::String>,
#[prost(string, optional, tag = "13")]
#[prost(string, optional, tag = "12")]
pub rate_fetched_at: ::core::option::Option<::prost::alloc::string::String>,
#[prost(int64, optional, tag = "14")]
#[prost(int64, optional, tag = "13")]
pub import_batch_id: ::core::option::Option<i64>,
#[prost(string, optional, tag = "15")]
#[prost(string, optional, tag = "14")]
pub source_endpoint: ::core::option::Option<::prost::alloc::string::String>,
/// Present only when determination_method is custom_rate. rate_date and
/// units_per_eur then describe the hand-entered row identified here, and the
/// ECB observation fields above are empty.
#[prost(int64, optional, tag = "16")]
#[prost(int64, optional, tag = "15")]
pub custom_rate_table_definition_id: ::core::option::Option<i64>,
#[prost(int64, optional, tag = "17")]
#[prost(int64, optional, tag = "16")]
pub custom_rate_record_id: ::core::option::Option<i64>,
#[prost(int64, optional, tag = "18")]
#[prost(int64, optional, tag = "17")]
pub custom_rate_row_revision: ::core::option::Option<i64>,
#[prost(string, optional, tag = "19")]
#[prost(string, optional, tag = "18")]
pub custom_rate_note: ::core::option::Option<::prost::alloc::string::String>,
/// Accountant-supplied justification for an exceptional publication date or
/// one-off manual rate. Empty for the normal/default rule.
#[prost(enumeration = "ExchangeRateDateRule", tag = "19")]
pub applied_date_rule: i32,
#[prost(enumeration = "ExchangeRateSource", tag = "20")]
pub applied_source: i32,
#[prost(string, tag = "21")]
pub selection_reason: ::prost::alloc::string::String,
}
/// Identify one logical money cell whose conversion history should be inspected.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
@@ -231,11 +249,16 @@ pub struct EcbConversionEvidence {
pub custom_rate_row_revision: ::core::option::Option<i64>,
#[prost(string, optional, tag = "22")]
pub custom_rate_note: ::core::option::Option<::prost::alloc::string::String>,
/// Immutable audit data for an accountant-controlled exception.
#[prost(string, tag = "23")]
pub selection_reason: ::prost::alloc::string::String,
#[prost(string, optional, tag = "24")]
pub selected_by_user_id: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListEcbConversionEvidenceResponse {
/// True when at least one evidence row for this cell used a rate, whether it
/// came from ECB or from a hand-entered custom row.
/// True when at least one evidence row for this cell used an ECB, saved
/// custom, or one-off manual rate.
#[prost(bool, tag = "1")]
pub has_exchange: bool,
/// Newest-first immutable history for this page.
@@ -245,39 +268,78 @@ pub struct ListEcbConversionEvidenceResponse {
#[prost(bool, tag = "3")]
pub has_more: bool,
}
/// Conversion basis rule used to select an ECB publication.
/// How the publication date is selected from the accounting basis date.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum EcbConversionContext {
pub enum ExchangeRateDateRule {
Unspecified = 0,
OrdinaryTransaction = 1,
FinancialStatement = 2,
DecisiveDate = 3,
/// Latest TARGET publication strictly before the basis date.
PreviousPublication = 1,
/// Latest TARGET publication on or before the basis date.
OnOrBeforeDate = 2,
/// The exact publication date supplied in specific_rate_date.
SpecificPublicationDate = 3,
}
impl EcbConversionContext {
impl ExchangeRateDateRule {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "ECB_CONVERSION_CONTEXT_UNSPECIFIED",
Self::OrdinaryTransaction => "ECB_CONVERSION_CONTEXT_ORDINARY_TRANSACTION",
Self::FinancialStatement => "ECB_CONVERSION_CONTEXT_FINANCIAL_STATEMENT",
Self::DecisiveDate => "ECB_CONVERSION_CONTEXT_DECISIVE_DATE",
Self::Unspecified => "EXCHANGE_RATE_DATE_RULE_UNSPECIFIED",
Self::PreviousPublication => "EXCHANGE_RATE_DATE_RULE_PREVIOUS_PUBLICATION",
Self::OnOrBeforeDate => "EXCHANGE_RATE_DATE_RULE_ON_OR_BEFORE_DATE",
Self::SpecificPublicationDate => {
"EXCHANGE_RATE_DATE_RULE_SPECIFIC_PUBLICATION_DATE"
}
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"ECB_CONVERSION_CONTEXT_UNSPECIFIED" => Some(Self::Unspecified),
"ECB_CONVERSION_CONTEXT_ORDINARY_TRANSACTION" => {
Some(Self::OrdinaryTransaction)
"EXCHANGE_RATE_DATE_RULE_UNSPECIFIED" => Some(Self::Unspecified),
"EXCHANGE_RATE_DATE_RULE_PREVIOUS_PUBLICATION" => {
Some(Self::PreviousPublication)
}
"ECB_CONVERSION_CONTEXT_FINANCIAL_STATEMENT" => {
Some(Self::FinancialStatement)
"EXCHANGE_RATE_DATE_RULE_ON_OR_BEFORE_DATE" => Some(Self::OnOrBeforeDate),
"EXCHANGE_RATE_DATE_RULE_SPECIFIC_PUBLICATION_DATE" => {
Some(Self::SpecificPublicationDate)
}
"ECB_CONVERSION_CONTEXT_DECISIVE_DATE" => Some(Self::DecisiveDate),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ExchangeRateSource {
Unspecified = 0,
Ecb = 1,
/// A reusable rate from the profile's custom_exchange_rates table.
SavedCustom = 2,
/// A one-off rate recorded only in this posting's immutable evidence.
Manual = 3,
}
impl ExchangeRateSource {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "EXCHANGE_RATE_SOURCE_UNSPECIFIED",
Self::Ecb => "EXCHANGE_RATE_SOURCE_ECB",
Self::SavedCustom => "EXCHANGE_RATE_SOURCE_SAVED_CUSTOM",
Self::Manual => "EXCHANGE_RATE_SOURCE_MANUAL",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"EXCHANGE_RATE_SOURCE_UNSPECIFIED" => Some(Self::Unspecified),
"EXCHANGE_RATE_SOURCE_ECB" => Some(Self::Ecb),
"EXCHANGE_RATE_SOURCE_SAVED_CUSTOM" => Some(Self::SavedCustom),
"EXCHANGE_RATE_SOURCE_MANUAL" => Some(Self::Manual),
_ => None,
}
}