From 6500afb460c48d2af7d05a477b58b38f21c28dea Mon Sep 17 00:00:00 2001 From: ttt161 Date: Thu, 11 Jun 2026 08:42:06 +0300 Subject: [PATCH 1/6] support for changing payment currency --- proto/domain.thrift | 5 +++++ proto/payment_processing.thrift | 11 +++++++++++ proto/proxy_provider.thrift | 5 +++++ 3 files changed, 21 insertions(+) diff --git a/proto/domain.thrift b/proto/domain.thrift index 2773628e..8d110ff0 100644 --- a/proto/domain.thrift +++ b/proto/domain.thrift @@ -335,6 +335,11 @@ struct InvoicePayment { * Type matches customer.CustomerID (typedef base.ID). */ 19: optional base.ID customer_id + /** + * Сумма платежа, сконвертированная в валюту терминала + * для случаев, когда валюта терминала отличается от валюты магазина + */ + 20: optional Cash target_cost } struct InvoicePaymentPending {} diff --git a/proto/payment_processing.thrift b/proto/payment_processing.thrift index 175d789a..b7d97923 100644 --- a/proto/payment_processing.thrift +++ b/proto/payment_processing.thrift @@ -149,6 +149,7 @@ union InvoicePaymentChangePayload { 17: InvoicePaymentShopLimitInitiated invoice_payment_shop_limit_initiated 18: InvoicePaymentShopLimitApplied invoice_payment_shop_limit_applied 19: InvoicePaymentCascadeTokensLoaded invoice_payment_cascade_tokens_loaded + 20: InvoicePaymentCurrencyChanged invoice_payment_currency_changed } /** @@ -204,6 +205,16 @@ struct InvoicePaymentRouteChanged { 5: optional RouteDecisionContext decision } +/** + * Событие об изменении целевой валюты платежа. + * Возникает, когда валюта терминала отличается от валюты магазина + */ +struct InvoicePaymentCurrencyChanged { + 1: required domain.CurrencySymbolicCode source_currency + 2: required domain.CurrencySymbolicCode destination_currency + 3: required base.Rational exchange_rate +} + /** * Событие об изменении данных финансового взаимодействия. */ diff --git a/proto/proxy_provider.thrift b/proto/proxy_provider.thrift index ba916061..2cb2a13b 100644 --- a/proto/proxy_provider.thrift +++ b/proto/proxy_provider.thrift @@ -176,6 +176,11 @@ struct InvoicePayment { 8: optional bool make_recurrent 12: optional bool skip_recurrent 9: optional base.Timestamp processing_deadline + /** + * Сумма платежа в исходной валюте + * для случаев, когда валюта терминала отличается от валюты магазина + */ + 13: optional Cash original_cost } struct InvoicePaymentRefund { From 3b528d7bcb0af9374396ac0d62acd7d681e88d1e Mon Sep 17 00:00:00 2001 From: ttt161 Date: Fri, 19 Jun 2026 09:30:06 +0300 Subject: [PATCH 2/6] cleanup --- proto/domain.thrift | 5 ----- proto/proxy_provider.thrift | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/proto/domain.thrift b/proto/domain.thrift index 8d110ff0..2773628e 100644 --- a/proto/domain.thrift +++ b/proto/domain.thrift @@ -335,11 +335,6 @@ struct InvoicePayment { * Type matches customer.CustomerID (typedef base.ID). */ 19: optional base.ID customer_id - /** - * Сумма платежа, сконвертированная в валюту терминала - * для случаев, когда валюта терминала отличается от валюты магазина - */ - 20: optional Cash target_cost } struct InvoicePaymentPending {} diff --git a/proto/proxy_provider.thrift b/proto/proxy_provider.thrift index 2cb2a13b..6914477b 100644 --- a/proto/proxy_provider.thrift +++ b/proto/proxy_provider.thrift @@ -152,6 +152,11 @@ struct Invoice { 3: required base.Timestamp due 7: required domain.InvoiceDetails details 6: required Cash cost + /** + * Сумма инвойса в исходной валюте + * для случаев, когда валюта терминала отличается от валюты магазина + */ + 8: optional Cash original_cost } union PaymentResource { From 9b725828e809190b01d5e53f4b49de6b9262057f Mon Sep 17 00:00:00 2001 From: ttt161 Date: Sun, 21 Jun 2026 14:31:09 +0300 Subject: [PATCH 3/6] fix issues --- proto/accounter.thrift | 1 + proto/domain.thrift | 10 ++++++++++ proto/proxy_provider.thrift | 5 ----- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/proto/accounter.thrift b/proto/accounter.thrift index 6f3cb69f..a565e055 100644 --- a/proto/accounter.thrift +++ b/proto/accounter.thrift @@ -61,6 +61,7 @@ struct Posting { 3: required domain.Amount amount 4: required domain.CurrencySymbolicCode currency_sym_code 5: required string description + 6: optional domain.ExchangeContext exchange_context } /** diff --git a/proto/domain.thrift b/proto/domain.thrift index 04fcf68c..1d268d0b 100644 --- a/proto/domain.thrift +++ b/proto/domain.thrift @@ -1889,6 +1889,15 @@ struct CashFlowPosting { 2: required CashFlowAccount destination 3: required CashVolume volume 4: optional string details + /** заполняется если выполнялась конвертация валюты */ + /** например, если валюта магазина (операции) отличается от валюты терминала */ + 5: optional ExchangeContext exchange_context +} + +struct ExchangeContext { + 1: required CurrencySymbolicCode source_currency + 2: required CurrencySymbolicCode destination_currency + 3: required base.Rational exchange_rate } /** Полностью вычисленный граф финансовых потоков с проводками всех участников. */ @@ -1900,6 +1909,7 @@ struct FinalCashFlowPosting { 2: required FinalCashFlowAccount destination 3: required Cash volume 4: optional string details + 5: optional ExchangeContext exchange_context } struct FinalCashFlowAccount { diff --git a/proto/proxy_provider.thrift b/proto/proxy_provider.thrift index 6914477b..2cb2a13b 100644 --- a/proto/proxy_provider.thrift +++ b/proto/proxy_provider.thrift @@ -152,11 +152,6 @@ struct Invoice { 3: required base.Timestamp due 7: required domain.InvoiceDetails details 6: required Cash cost - /** - * Сумма инвойса в исходной валюте - * для случаев, когда валюта терминала отличается от валюты магазина - */ - 8: optional Cash original_cost } union PaymentResource { From c4716e7ecc8f84469888bf49494483cbdc35204a Mon Sep 17 00:00:00 2001 From: ttt161 Date: Thu, 25 Jun 2026 11:48:49 +0300 Subject: [PATCH 4/6] fix issues --- proto/accounter.thrift | 4 ++++ proto/domain.thrift | 4 +--- proto/payment_processing.thrift | 10 +++++----- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/proto/accounter.thrift b/proto/accounter.thrift index a565e055..95fdcfaf 100644 --- a/proto/accounter.thrift +++ b/proto/accounter.thrift @@ -54,6 +54,10 @@ struct Account { * amount - объем переводимых средств (не может быть отрицательным) * currency_sym_code - код валюты, должен совпадать с кодами задействованных счетов * description - описание проводки +* exchange_context - курс валюты, используемый для конвертации исходной суммы операции в валюту терминала +* Заполняется только если валюта терминала отличается от валюты операции (платежа) и проводки +* source_currency - валюта исходной операции (совпадает с валютой проводки) +* destination_currency - валюта терминала */ struct Posting { 1: required AccountID from_id diff --git a/proto/domain.thrift b/proto/domain.thrift index 1d268d0b..a7f836d2 100644 --- a/proto/domain.thrift +++ b/proto/domain.thrift @@ -1889,9 +1889,6 @@ struct CashFlowPosting { 2: required CashFlowAccount destination 3: required CashVolume volume 4: optional string details - /** заполняется если выполнялась конвертация валюты */ - /** например, если валюта магазина (операции) отличается от валюты терминала */ - 5: optional ExchangeContext exchange_context } struct ExchangeContext { @@ -2113,6 +2110,7 @@ struct PaymentsProvisionTerms { 10: optional PaymentChargebackProvisionTerms chargebacks 11: optional RiskScoreSelector risk_coverage 12: optional TurnoverLimitSelector turnover_limits + 13: optional Predicate allow_exchange } union RiskScoreSelector { diff --git a/proto/payment_processing.thrift b/proto/payment_processing.thrift index b7d97923..1e4047a2 100644 --- a/proto/payment_processing.thrift +++ b/proto/payment_processing.thrift @@ -206,13 +206,13 @@ struct InvoicePaymentRouteChanged { } /** - * Событие об изменении целевой валюты платежа. + * Событие об изменении валютного контекста. * Возникает, когда валюта терминала отличается от валюты магазина + * source_currency - валюта магазина + * destination_currency - валюта терминала */ -struct InvoicePaymentCurrencyChanged { - 1: required domain.CurrencySymbolicCode source_currency - 2: required domain.CurrencySymbolicCode destination_currency - 3: required base.Rational exchange_rate +struct InvoicePaymentExchangeContextChanged { + 1: required domain.ExchangeContext exchange_context } /** From 93ad0190d7066114e9412cd4c343b5f6162bade3 Mon Sep 17 00:00:00 2001 From: ttt161 Date: Thu, 25 Jun 2026 11:58:31 +0300 Subject: [PATCH 5/6] fix typo --- proto/payment_processing.thrift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/payment_processing.thrift b/proto/payment_processing.thrift index 1e4047a2..50b9d896 100644 --- a/proto/payment_processing.thrift +++ b/proto/payment_processing.thrift @@ -149,7 +149,7 @@ union InvoicePaymentChangePayload { 17: InvoicePaymentShopLimitInitiated invoice_payment_shop_limit_initiated 18: InvoicePaymentShopLimitApplied invoice_payment_shop_limit_applied 19: InvoicePaymentCascadeTokensLoaded invoice_payment_cascade_tokens_loaded - 20: InvoicePaymentCurrencyChanged invoice_payment_currency_changed + 20: InvoicePaymentExchangeContextChanged invoice_payment_currency_changed } /** From 389e46e908c21486d06bf5eea50bcd4b60b8cd45 Mon Sep 17 00:00:00 2001 From: ttt161 Date: Thu, 25 Jun 2026 12:17:55 +0300 Subject: [PATCH 6/6] fix typo --- proto/payment_processing.thrift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/payment_processing.thrift b/proto/payment_processing.thrift index 50b9d896..c248ae84 100644 --- a/proto/payment_processing.thrift +++ b/proto/payment_processing.thrift @@ -149,7 +149,7 @@ union InvoicePaymentChangePayload { 17: InvoicePaymentShopLimitInitiated invoice_payment_shop_limit_initiated 18: InvoicePaymentShopLimitApplied invoice_payment_shop_limit_applied 19: InvoicePaymentCascadeTokensLoaded invoice_payment_cascade_tokens_loaded - 20: InvoicePaymentExchangeContextChanged invoice_payment_currency_changed + 20: InvoicePaymentExchangeContextChanged invoice_payment_exchange_context_changed } /**