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
This commit is contained in:
Aleksey Kashapov 2024-06-19 17:20:33 +03:00 committed by GitHub
parent b869c09c7a
commit c170117e5f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 32 additions and 0 deletions

View File

@ -153,6 +153,16 @@ struct Invoice {
14: optional string external_id 14: optional string external_id
15: optional InvoiceClientInfo client_info 15: optional InvoiceClientInfo client_info
16: optional Allocation allocation 16: optional Allocation allocation
17: optional list<InvoiceMutation> mutations
}
union InvoiceMutation {
1: InvoiceAmountMutation amount
}
struct InvoiceAmountMutation {
1: required Amount original
2: required Amount mutated
} }
struct InvoiceDetails { struct InvoiceDetails {
@ -358,6 +368,23 @@ struct InvoiceTemplate {
12: optional base.Timestamp created_at 12: optional base.Timestamp created_at
8: required InvoiceTemplateDetails details 8: required InvoiceTemplateDetails details
7: optional InvoiceContext context 7: optional InvoiceContext context
13: optional list<InvoiceMutationParams> 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 { union InvoiceTemplateDetails {

View File

@ -509,6 +509,8 @@ struct EventRange {
/* Invoicing service definitions */ /* Invoicing service definitions */
typedef domain.InvoiceMutationParams InvoiceMutationParams
struct InvoiceParams { struct InvoiceParams {
1: required PartyID party_id 1: required PartyID party_id
2: required ShopID shop_id 2: required ShopID shop_id
@ -520,6 +522,7 @@ struct InvoiceParams {
8: optional string external_id 8: optional string external_id
9: optional domain.InvoiceClientInfo client_info 9: optional domain.InvoiceClientInfo client_info
10: optional domain.AllocationPrototype allocation 10: optional domain.AllocationPrototype allocation
11: optional list<InvoiceMutationParams> mutations
} }
struct InvoiceWithTemplateParams { struct InvoiceWithTemplateParams {
@ -540,6 +543,7 @@ struct InvoiceTemplateCreateParams {
8: optional string description 8: optional string description
9: required domain.InvoiceTemplateDetails details 9: required domain.InvoiceTemplateDetails details
6: required domain.InvoiceContext context 6: required domain.InvoiceContext context
12: optional list<InvoiceMutationParams> mutations
} }
struct InvoiceTemplateUpdateParams { struct InvoiceTemplateUpdateParams {
@ -549,6 +553,7 @@ struct InvoiceTemplateUpdateParams {
6: optional string description 6: optional string description
7: optional domain.InvoiceTemplateDetails details 7: optional domain.InvoiceTemplateDetails details
4: optional domain.InvoiceContext context 4: optional domain.InvoiceContext context
9: optional list<InvoiceMutationParams> mutations
} }
struct InvoicePaymentParams { struct InvoicePaymentParams {