From c170117e5fde4ebdc6878e75dcd37ca2779dfb82 Mon Sep 17 00:00:00 2001 From: Aleksey Kashapov Date: Wed, 19 Jun 2024 17:20:33 +0300 Subject: [PATCH] OPS-474: Defines protocol for invoice amount randomization (#134) * OPS-474: Defines protocol for invoice amount randomization * Updates fields names and types, updates rounding methods enum * Fixes missing renaming for invoice template params * Simplifies changes w/ typedef from domain ns * Makes 'precision' and 'rounding' params required * Retires 'rounding' option in amount randomization --- proto/domain.thrift | 27 +++++++++++++++++++++++++++ proto/payment_processing.thrift | 5 +++++ 2 files changed, 32 insertions(+) diff --git a/proto/domain.thrift b/proto/domain.thrift index 96b3ede..2f04a22 100644 --- a/proto/domain.thrift +++ b/proto/domain.thrift @@ -153,6 +153,16 @@ struct Invoice { 14: optional string external_id 15: optional InvoiceClientInfo client_info 16: optional Allocation allocation + 17: optional list mutations +} + +union InvoiceMutation { + 1: InvoiceAmountMutation amount +} + +struct InvoiceAmountMutation { + 1: required Amount original + 2: required Amount mutated } struct InvoiceDetails { @@ -358,6 +368,23 @@ struct InvoiceTemplate { 12: optional base.Timestamp created_at 8: required InvoiceTemplateDetails details 7: optional InvoiceContext context + 13: optional list mutations +} + +union InvoiceMutationParams { + 1: InvoiceAmountMutationParams amount +} + +union InvoiceAmountMutationParams { + 1: RandomizationMutationParams randomization +} + +struct RandomizationMutationParams { + 1: required Amount deviation + 2: required i64 precision + 4: optional Amount min_amount_condition + 5: optional Amount max_amount_condition + 6: optional Amount amount_multiplicity_condition } union InvoiceTemplateDetails { diff --git a/proto/payment_processing.thrift b/proto/payment_processing.thrift index 9391ca2..c067a5b 100644 --- a/proto/payment_processing.thrift +++ b/proto/payment_processing.thrift @@ -509,6 +509,8 @@ struct EventRange { /* Invoicing service definitions */ +typedef domain.InvoiceMutationParams InvoiceMutationParams + struct InvoiceParams { 1: required PartyID party_id 2: required ShopID shop_id @@ -520,6 +522,7 @@ struct InvoiceParams { 8: optional string external_id 9: optional domain.InvoiceClientInfo client_info 10: optional domain.AllocationPrototype allocation + 11: optional list mutations } struct InvoiceWithTemplateParams { @@ -540,6 +543,7 @@ struct InvoiceTemplateCreateParams { 8: optional string description 9: required domain.InvoiceTemplateDetails details 6: required domain.InvoiceContext context + 12: optional list mutations } struct InvoiceTemplateUpdateParams { @@ -549,6 +553,7 @@ struct InvoiceTemplateUpdateParams { 6: optional string description 7: optional domain.InvoiceTemplateDetails details 4: optional domain.InvoiceContext context + 9: optional list mutations } struct InvoicePaymentParams {