diff --git a/apps/limiter/src/lim_config_codec.erl b/apps/limiter/src/lim_config_codec.erl index 911591b..76caa6f 100644 --- a/apps/limiter/src/lim_config_codec.erl +++ b/apps/limiter/src/lim_config_codec.erl @@ -129,8 +129,6 @@ marshal_scope_type(shop) -> {shop, #config_LimitScopeEmptyDetails{}}; marshal_scope_type(wallet) -> {wallet, #config_LimitScopeEmptyDetails{}}; -marshal_scope_type(identity) -> - {identity, #config_LimitScopeEmptyDetails{}}; marshal_scope_type(payment_tool) -> {payment_tool, #config_LimitScopeEmptyDetails{}}; marshal_scope_type(provider) -> @@ -346,8 +344,6 @@ unmarshal_scope_type({shop, _}) -> shop; unmarshal_scope_type({wallet, _}) -> wallet; -unmarshal_scope_type({identity, _}) -> - identity; unmarshal_scope_type({payment_tool, _}) -> payment_tool; unmarshal_scope_type({provider, _}) -> diff --git a/apps/limiter/src/lim_config_machine.erl b/apps/limiter/src/lim_config_machine.erl index 4884c68..cfac8c9 100644 --- a/apps/limiter/src/lim_config_machine.erl +++ b/apps/limiter/src/lim_config_machine.erl @@ -51,7 +51,6 @@ party | shop | wallet - | identity | payment_tool | provider | terminal @@ -675,7 +674,6 @@ enumerate_context_bits(Types) -> [ party, shop, - identity, wallet, payment_tool, provider, @@ -707,13 +705,13 @@ squash_scope_types([party, shop | Rest]) -> % NOTE % Shop scope implies party scope. [shop | squash_scope_types(Rest)]; -squash_scope_types([identity, wallet | Rest]) -> +squash_scope_types([party, wallet | Rest]) -> % NOTE - % Wallet scope implies identity scope. + % Wallet scope implies party scope. [wallet | squash_scope_types(Rest)]; squash_scope_types([provider, terminal | Rest]) -> % NOTE - % Provider scope implies identity scope. + % Provider scope implies provider scope. [terminal | squash_scope_types(Rest)]; squash_scope_types([Type | Rest]) -> [Type | squash_scope_types(Rest)]; @@ -729,10 +727,8 @@ get_context_bits(shop) -> [{from, owner_id}, {from, shop_id}]; get_context_bits(payment_tool) -> [{from, payment_tool}]; -get_context_bits(identity) -> - [{prefix, <<"identity">>}, {from, identity_id}]; get_context_bits(wallet) -> - [{prefix, <<"wallet">>}, {from, identity_id}, {from, wallet_id}]; + [{prefix, <<"wallet">>}, {from, owner_id}, {from, wallet_id}]; get_context_bits(provider) -> [{prefix, <<"provider">>}, {from, provider_id}]; get_context_bits(terminal) -> @@ -1066,9 +1062,9 @@ check_calculate_year_shard_id_test() -> } }). --define(WITHDRAWAL(OwnerID, IdentityID, PaymentTool), #wthd_domain_Withdrawal{ +-define(WITHDRAWAL(OwnerID, PaymentTool), #wthd_domain_Withdrawal{ destination = PaymentTool, - sender = #wthd_domain_Identity{id = IdentityID, owner_id = OwnerID}, + sender = OwnerID, created_at = <<"2000-02-02T12:12:12Z">>, body = #domain_Cash{amount = 42, currency = #domain_CurrencyRef{symbolic_code = <<"CNY">>}} }). @@ -1112,7 +1108,7 @@ prefix_content_test_() -> }, WithdrawalContext = #{ context => ?WITHDRAWAL_CTX( - ?WITHDRAWAL(<<"OWNER">>, <<"IDENTITY">>, ?PAYMENT_TOOL), + ?WITHDRAWAL(<<"OWNER">>, ?PAYMENT_TOOL), <<"WALLET">>, ?ROUTE(22, 2) ) @@ -1138,13 +1134,12 @@ prefix_content_test_() -> ), ?_assertEqual( {ok, - {<<"/OWNER/wallet/IDENTITY/WALLET">>, #{ - <<"Scope.identity_id">> => <<"IDENTITY">>, + {<<"/wallet/OWNER/WALLET">>, #{ <<"Scope.owner_id">> => <<"OWNER">>, <<"Scope.prefix">> => <<"wallet">>, <<"Scope.wallet_id">> => <<"WALLET">> }}}, - mk_scope_prefix_impl(ordsets:from_list([wallet, identity, party]), withdrawal_processing, WithdrawalContext) + mk_scope_prefix_impl(ordsets:from_list([wallet, party]), withdrawal_processing, WithdrawalContext) ), ?_assertEqual( {ok, diff --git a/apps/limiter/src/lim_wthdproc_context.erl b/apps/limiter/src/lim_wthdproc_context.erl index 595222f..f9aad8e 100644 --- a/apps/limiter/src/lim_wthdproc_context.erl +++ b/apps/limiter/src/lim_wthdproc_context.erl @@ -37,7 +37,6 @@ make_change_context( genlib_map:compact(#{ <<"Context.op">> => genlib:to_binary(Operation), <<"Context.owner_id">> => try_get_value(owner_id, Context, undefined), - <<"Context.identity_id">> => try_get_value(identity_id, Context, undefined), <<"Context.wallet_id">> => try_get_value(wallet_id, Context, undefined) })}. @@ -71,8 +70,6 @@ get_value(cost, Operation, Context) -> get_cost(Operation, Context); get_value(payment_tool, Operation, Context) -> get_payment_tool(Operation, Context); -get_value(identity_id, Operation, Context) -> - get_identity_id(Operation, Context); get_value(wallet_id, Operation, Context) -> get_wallet_id(Operation, Context); get_value(provider_id, Operation, Context) -> @@ -113,8 +110,7 @@ get_value(ValueName, _Operation, _Context) -> -define(SENDER_RECEIVER(V), ?AUTH_DATA({sender_receiver, V})). get_owner_id(?WITHDRAWAL(Wthd)) -> - Identity = Wthd#wthd_domain_Withdrawal.sender, - {ok, Identity#wthd_domain_Identity.owner_id}; + {ok, Wthd#wthd_domain_Withdrawal.sender}; get_owner_id(_CtxWithdrawal) -> {error, notfound}. @@ -135,12 +131,6 @@ get_payment_tool(withdrawal, ?WITHDRAWAL(Wthd)) -> get_payment_tool(_, _CtxWithdrawal) -> {error, notfound}. -get_identity_id(withdrawal, ?WITHDRAWAL(Wthd)) -> - Identity = Wthd#wthd_domain_Withdrawal.sender, - {ok, Identity#wthd_domain_Identity.id}; -get_identity_id(_, _CtxWithdrawal) -> - {error, notfound}. - get_wallet_id(withdrawal, ?WALLET_ID(WalletID)) -> {ok, WalletID}; get_wallet_id(_, _CtxWithdrawal) -> diff --git a/apps/limiter/test/lim_ct_helper.hrl b/apps/limiter/test/lim_ct_helper.hrl index d0e54b5..46a175e 100644 --- a/apps/limiter/test/lim_ct_helper.hrl +++ b/apps/limiter/test/lim_ct_helper.hrl @@ -38,7 +38,6 @@ -define(scope_provider(), {provider, #config_LimitScopeEmptyDetails{}}). -define(scope_terminal(), {terminal, #config_LimitScopeEmptyDetails{}}). -define(scope_payer_contact_email(), {payer_contact_email, #config_LimitScopeEmptyDetails{}}). --define(scope_identity(), {identity, #config_LimitScopeEmptyDetails{}}). -define(scope_wallet(), {wallet, #config_LimitScopeEmptyDetails{}}). -define(scope_sender(), {sender, #config_LimitScopeEmptyDetails{}}). -define(scope_receiver(), {receiver, #config_LimitScopeEmptyDetails{}}). @@ -231,11 +230,6 @@ %% Wthdproc --define(identity(OwnerID), #wthd_domain_Identity{ - id = OwnerID, - owner_id = OwnerID -}). - -define(auth_data(Sender, Receiver), {sender_receiver, #wthd_domain_SenderReceiverAuthData{sender = Sender, receiver = Receiver}} ). @@ -248,7 +242,7 @@ body = Body, created_at = ?timestamp, destination = Destination, - sender = ?identity(OwnerID), + sender = OwnerID, auth_data = AuthData }). diff --git a/apps/limiter/test/lim_turnover_SUITE.erl b/apps/limiter/test/lim_turnover_SUITE.erl index 27ac719..eaeeac4 100644 --- a/apps/limiter/test/lim_turnover_SUITE.erl +++ b/apps/limiter/test/lim_turnover_SUITE.erl @@ -54,7 +54,6 @@ -export([commit_with_terminal_scope_ok/1]). -export([commit_with_email_scope_ok/1]). --export([commit_with_identity_scope_ok/1]). -export([commit_with_wallet_scope_ok/1]). -export([commit_with_multi_scope_ok/1]). -export([hold_with_sender_notfound/1]). @@ -156,7 +155,6 @@ groups() -> commit_with_party_scope_ok, commit_with_provider_scope_ok, commit_with_terminal_scope_ok, - commit_with_identity_scope_ok, commit_with_wallet_scope_ok, commit_with_sender_scope_ok, commit_with_receiver_scope_ok, @@ -714,16 +712,9 @@ commit_with_email_scope_ok(C) -> {ok, {vector, _}} = hold_and_commit(?LIMIT_CHANGE(ID, ?CHANGE_ID, Version), Context, ?config(client, C)), {ok, #limiter_Limit{}} = lim_client:get(ID, Version, Context, ?config(client, C)). --spec commit_with_identity_scope_ok(config()) -> _. -commit_with_identity_scope_ok(C) -> - {ID, Version} = configure_limit(?time_range_month(), ?scope([?scope_identity()]), C), - Context = ?wthdproc_ctx_withdrawal(?cash(10, <<"RUB">>)), - {ok, {vector, _}} = hold_and_commit(?LIMIT_CHANGE(ID, ?CHANGE_ID, Version), Context, ?config(client, C)), - {ok, #limiter_Limit{}} = lim_client:get(ID, Version, Context, ?config(client, C)). - -spec commit_with_wallet_scope_ok(config()) -> _. commit_with_wallet_scope_ok(C) -> - {ID, Version} = configure_limit(?time_range_month(), ?scope([?scope_wallet()]), C), + {ID, Version} = configure_limit(?time_range_month(), ?scope([?scope_party(), ?scope_wallet()]), C), Context = ?wthdproc_ctx_withdrawal(?cash(10, <<"RUB">>)), {ok, {vector, _}} = hold_and_commit(?LIMIT_CHANGE(ID, ?CHANGE_ID, Version), Context, ?config(client, C)), {ok, #limiter_Limit{}} = lim_client:get(ID, Version, Context, ?config(client, C)). diff --git a/compose.yaml b/compose.yaml index 70feb7b..ab48136 100644 --- a/compose.yaml +++ b/compose.yaml @@ -24,7 +24,7 @@ services: condition: service_healthy dominant: - image: ghcr.io/valitydev/dominant:sha-2150eea + image: ghcr.io/valitydev/dominant:sha-ef03371-epic-party_here command: /opt/dominant/bin/dominant foreground depends_on: machinegun: diff --git a/rebar.config b/rebar.config index 780fc4d..9d32db7 100644 --- a/rebar.config +++ b/rebar.config @@ -69,12 +69,10 @@ % for introspection on production {recon, "2.5.2"}, {logger_logstash_formatter, - {git, "https://github.com/valitydev/logger_logstash_formatter.git", {ref, "08a66a6"}}}, - {iosetopts, {git, "https://github.com/valitydev/iosetopts.git", {ref, "edb445c"}}} + {git, "https://github.com/valitydev/logger_logstash_formatter.git", {ref, "08a66a6"}}} ]}, {relx, [ {release, {limiter, "1.0.0"}, [ - iosetopts, {recon, load}, {runtime_tools, load}, {tools, load}, diff --git a/rebar.lock b/rebar.lock index b1520e5..35c9390 100644 --- a/rebar.lock +++ b/rebar.lock @@ -19,7 +19,7 @@ {<<"ctx">>,{pkg,<<"ctx">>,<<"0.6.0">>},2}, {<<"damsel">>, {git,"https://github.com/valitydev/damsel.git", - {ref,"81d1edce2043500e4581867da3f5f4c31e682f44"}}, + {ref,"ab44b9db25a76a2c50545fd884e4cdf3d3e3b628"}}, 0}, {<<"dmt_client">>, {git,"https://github.com/valitydev/dmt_client.git", @@ -59,7 +59,7 @@ 0}, {<<"limiter_proto">>, {git,"https://github.com/valitydev/limiter-proto.git", - {ref,"efeb7d4a05bd13c95fada18514509b34b107fcb9"}}, + {ref,"d4cdf0f6328125996ee705c3da87461f99dde7f4"}}, 0}, {<<"machinery">>, {git,"https://github.com/valitydev/machinery-erlang.git",