From 85b19cb5f362dad129cdd7df1e1d86310481d5c6 Mon Sep 17 00:00:00 2001 From: Aleksey Kashapov Date: Wed, 3 Jul 2024 12:58:11 +0300 Subject: [PATCH] TD-933: Adds support for deviation direction for amount randomization (#47) --- apps/capi/src/capi_mutation.erl | 3 +++ rebar.lock | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/capi/src/capi_mutation.erl b/apps/capi/src/capi_mutation.erl index af6e9d7..6077843 100644 --- a/apps/capi/src/capi_mutation.erl +++ b/apps/capi/src/capi_mutation.erl @@ -18,6 +18,7 @@ encode_amount_randomization_params(Opts) when is_map(Opts) -> {randomization, #domain_RandomizationMutationParams{ deviation = maps:get(<<"deviation">>, Opts), precision = maps:get(<<"precision">>, Opts, 2), + direction = binary_to_existing_atom(maps:get(<<"direction">>, Opts, <<"both">>)), min_amount_condition = maps:get(<<"minAmountCondition">>, Opts, undefined), max_amount_condition = maps:get(<<"maxAmountCondition">>, Opts, 2), amount_multiplicity_condition = maps:get(<<"amountMultiplicityCondition">>, Opts, undefined) @@ -35,6 +36,7 @@ decode_amount_randomization_params(Mutations) when is_list(Mutations) -> {randomization, #domain_RandomizationMutationParams{ deviation = Deviation, precision = Precision, + direction = Direction, min_amount_condition = MinAmountCondition, max_amount_condition = MaxAmountCondition, amount_multiplicity_condition = AmountMultiplicityCondition @@ -44,6 +46,7 @@ decode_amount_randomization_params(Mutations) when is_list(Mutations) -> #{ <<"deviation">> => Deviation, <<"precision">> => Precision, + <<"direction">> => atom_to_binary(Direction), <<"minAmountCondition">> => MinAmountCondition, <<"maxAmountCondition">> => MaxAmountCondition, <<"amountMultiplicityCondition">> => AmountMultiplicityCondition diff --git a/rebar.lock b/rebar.lock index bab34ed..a5d91ab 100644 --- a/rebar.lock +++ b/rebar.lock @@ -134,11 +134,11 @@ {<<"ssl_verify_fun">>,{pkg,<<"ssl_verify_fun">>,<<"1.1.7">>},2}, {<<"swag_client">>, {git,"https://github.com/valitydev/swag-payments", - {ref,"400015842b1a53a93dd1ea298914510a13a66f5d"}}, + {ref,"078842bf8c25f7b962103943034544cc93d0459c"}}, 0}, {<<"swag_server">>, {git,"https://github.com/valitydev/swag-payments", - {ref,"79a46abf70bbf72394baa5dc14bafcc51d71fbd9"}}, + {ref,"40e01d346c4902ec2ef5a66f11b88429cbcdcccd"}}, 0}, {<<"thrift">>, {git,"https://github.com/valitydev/thrift_erlang.git",