Skip to content

Commit 08cdd07

Browse files
authored
Epic: Party here! (#36)
* bumped damsel * fixed * bumped again * bumped compose * removed identity * bumped damsel * bumped * bumped dmt
1 parent bcf48f3 commit 08cdd07

File tree

8 files changed

+16
-52
lines changed

8 files changed

+16
-52
lines changed

apps/limiter/src/lim_config_codec.erl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,6 @@ marshal_scope_type(shop) ->
129129
{shop, #config_LimitScopeEmptyDetails{}};
130130
marshal_scope_type(wallet) ->
131131
{wallet, #config_LimitScopeEmptyDetails{}};
132-
marshal_scope_type(identity) ->
133-
{identity, #config_LimitScopeEmptyDetails{}};
134132
marshal_scope_type(payment_tool) ->
135133
{payment_tool, #config_LimitScopeEmptyDetails{}};
136134
marshal_scope_type(provider) ->
@@ -346,8 +344,6 @@ unmarshal_scope_type({shop, _}) ->
346344
shop;
347345
unmarshal_scope_type({wallet, _}) ->
348346
wallet;
349-
unmarshal_scope_type({identity, _}) ->
350-
identity;
351347
unmarshal_scope_type({payment_tool, _}) ->
352348
payment_tool;
353349
unmarshal_scope_type({provider, _}) ->

apps/limiter/src/lim_config_machine.erl

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
party
5252
| shop
5353
| wallet
54-
| identity
5554
| payment_tool
5655
| provider
5756
| terminal
@@ -675,7 +674,6 @@ enumerate_context_bits(Types) ->
675674
[
676675
party,
677676
shop,
678-
identity,
679677
wallet,
680678
payment_tool,
681679
provider,
@@ -707,13 +705,13 @@ squash_scope_types([party, shop | Rest]) ->
707705
% NOTE
708706
% Shop scope implies party scope.
709707
[shop | squash_scope_types(Rest)];
710-
squash_scope_types([identity, wallet | Rest]) ->
708+
squash_scope_types([party, wallet | Rest]) ->
711709
% NOTE
712-
% Wallet scope implies identity scope.
710+
% Wallet scope implies party scope.
713711
[wallet | squash_scope_types(Rest)];
714712
squash_scope_types([provider, terminal | Rest]) ->
715713
% NOTE
716-
% Provider scope implies identity scope.
714+
% Provider scope implies provider scope.
717715
[terminal | squash_scope_types(Rest)];
718716
squash_scope_types([Type | Rest]) ->
719717
[Type | squash_scope_types(Rest)];
@@ -729,10 +727,8 @@ get_context_bits(shop) ->
729727
[{from, owner_id}, {from, shop_id}];
730728
get_context_bits(payment_tool) ->
731729
[{from, payment_tool}];
732-
get_context_bits(identity) ->
733-
[{prefix, <<"identity">>}, {from, identity_id}];
734730
get_context_bits(wallet) ->
735-
[{prefix, <<"wallet">>}, {from, identity_id}, {from, wallet_id}];
731+
[{prefix, <<"wallet">>}, {from, owner_id}, {from, wallet_id}];
736732
get_context_bits(provider) ->
737733
[{prefix, <<"provider">>}, {from, provider_id}];
738734
get_context_bits(terminal) ->
@@ -1066,9 +1062,9 @@ check_calculate_year_shard_id_test() ->
10661062
}
10671063
}).
10681064

1069-
-define(WITHDRAWAL(OwnerID, IdentityID, PaymentTool), #wthd_domain_Withdrawal{
1065+
-define(WITHDRAWAL(OwnerID, PaymentTool), #wthd_domain_Withdrawal{
10701066
destination = PaymentTool,
1071-
sender = #wthd_domain_Identity{id = IdentityID, owner_id = OwnerID},
1067+
sender = OwnerID,
10721068
created_at = <<"2000-02-02T12:12:12Z">>,
10731069
body = #domain_Cash{amount = 42, currency = #domain_CurrencyRef{symbolic_code = <<"CNY">>}}
10741070
}).
@@ -1112,7 +1108,7 @@ prefix_content_test_() ->
11121108
},
11131109
WithdrawalContext = #{
11141110
context => ?WITHDRAWAL_CTX(
1115-
?WITHDRAWAL(<<"OWNER">>, <<"IDENTITY">>, ?PAYMENT_TOOL),
1111+
?WITHDRAWAL(<<"OWNER">>, ?PAYMENT_TOOL),
11161112
<<"WALLET">>,
11171113
?ROUTE(22, 2)
11181114
)
@@ -1138,13 +1134,12 @@ prefix_content_test_() ->
11381134
),
11391135
?_assertEqual(
11401136
{ok,
1141-
{<<"/OWNER/wallet/IDENTITY/WALLET">>, #{
1142-
<<"Scope.identity_id">> => <<"IDENTITY">>,
1137+
{<<"/wallet/OWNER/WALLET">>, #{
11431138
<<"Scope.owner_id">> => <<"OWNER">>,
11441139
<<"Scope.prefix">> => <<"wallet">>,
11451140
<<"Scope.wallet_id">> => <<"WALLET">>
11461141
}}},
1147-
mk_scope_prefix_impl(ordsets:from_list([wallet, identity, party]), withdrawal_processing, WithdrawalContext)
1142+
mk_scope_prefix_impl(ordsets:from_list([wallet, party]), withdrawal_processing, WithdrawalContext)
11481143
),
11491144
?_assertEqual(
11501145
{ok,

apps/limiter/src/lim_wthdproc_context.erl

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ make_change_context(
3737
genlib_map:compact(#{
3838
<<"Context.op">> => genlib:to_binary(Operation),
3939
<<"Context.owner_id">> => try_get_value(owner_id, Context, undefined),
40-
<<"Context.identity_id">> => try_get_value(identity_id, Context, undefined),
4140
<<"Context.wallet_id">> => try_get_value(wallet_id, Context, undefined)
4241
})}.
4342

@@ -71,8 +70,6 @@ get_value(cost, Operation, Context) ->
7170
get_cost(Operation, Context);
7271
get_value(payment_tool, Operation, Context) ->
7372
get_payment_tool(Operation, Context);
74-
get_value(identity_id, Operation, Context) ->
75-
get_identity_id(Operation, Context);
7673
get_value(wallet_id, Operation, Context) ->
7774
get_wallet_id(Operation, Context);
7875
get_value(provider_id, Operation, Context) ->
@@ -113,8 +110,7 @@ get_value(ValueName, _Operation, _Context) ->
113110
-define(SENDER_RECEIVER(V), ?AUTH_DATA({sender_receiver, V})).
114111

115112
get_owner_id(?WITHDRAWAL(Wthd)) ->
116-
Identity = Wthd#wthd_domain_Withdrawal.sender,
117-
{ok, Identity#wthd_domain_Identity.owner_id};
113+
{ok, Wthd#wthd_domain_Withdrawal.sender};
118114
get_owner_id(_CtxWithdrawal) ->
119115
{error, notfound}.
120116

@@ -135,12 +131,6 @@ get_payment_tool(withdrawal, ?WITHDRAWAL(Wthd)) ->
135131
get_payment_tool(_, _CtxWithdrawal) ->
136132
{error, notfound}.
137133

138-
get_identity_id(withdrawal, ?WITHDRAWAL(Wthd)) ->
139-
Identity = Wthd#wthd_domain_Withdrawal.sender,
140-
{ok, Identity#wthd_domain_Identity.id};
141-
get_identity_id(_, _CtxWithdrawal) ->
142-
{error, notfound}.
143-
144134
get_wallet_id(withdrawal, ?WALLET_ID(WalletID)) ->
145135
{ok, WalletID};
146136
get_wallet_id(_, _CtxWithdrawal) ->

apps/limiter/test/lim_ct_helper.hrl

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
-define(scope_provider(), {provider, #config_LimitScopeEmptyDetails{}}).
3939
-define(scope_terminal(), {terminal, #config_LimitScopeEmptyDetails{}}).
4040
-define(scope_payer_contact_email(), {payer_contact_email, #config_LimitScopeEmptyDetails{}}).
41-
-define(scope_identity(), {identity, #config_LimitScopeEmptyDetails{}}).
4241
-define(scope_wallet(), {wallet, #config_LimitScopeEmptyDetails{}}).
4342
-define(scope_sender(), {sender, #config_LimitScopeEmptyDetails{}}).
4443
-define(scope_receiver(), {receiver, #config_LimitScopeEmptyDetails{}}).
@@ -231,11 +230,6 @@
231230

232231
%% Wthdproc
233232

234-
-define(identity(OwnerID), #wthd_domain_Identity{
235-
id = OwnerID,
236-
owner_id = OwnerID
237-
}).
238-
239233
-define(auth_data(Sender, Receiver),
240234
{sender_receiver, #wthd_domain_SenderReceiverAuthData{sender = Sender, receiver = Receiver}}
241235
).
@@ -248,7 +242,7 @@
248242
body = Body,
249243
created_at = ?timestamp,
250244
destination = Destination,
251-
sender = ?identity(OwnerID),
245+
sender = OwnerID,
252246
auth_data = AuthData
253247
}).
254248

apps/limiter/test/lim_turnover_SUITE.erl

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
-export([commit_with_terminal_scope_ok/1]).
5555
-export([commit_with_email_scope_ok/1]).
5656

57-
-export([commit_with_identity_scope_ok/1]).
5857
-export([commit_with_wallet_scope_ok/1]).
5958
-export([commit_with_multi_scope_ok/1]).
6059
-export([hold_with_sender_notfound/1]).
@@ -156,7 +155,6 @@ groups() ->
156155
commit_with_party_scope_ok,
157156
commit_with_provider_scope_ok,
158157
commit_with_terminal_scope_ok,
159-
commit_with_identity_scope_ok,
160158
commit_with_wallet_scope_ok,
161159
commit_with_sender_scope_ok,
162160
commit_with_receiver_scope_ok,
@@ -714,16 +712,9 @@ commit_with_email_scope_ok(C) ->
714712
{ok, {vector, _}} = hold_and_commit(?LIMIT_CHANGE(ID, ?CHANGE_ID, Version), Context, ?config(client, C)),
715713
{ok, #limiter_Limit{}} = lim_client:get(ID, Version, Context, ?config(client, C)).
716714

717-
-spec commit_with_identity_scope_ok(config()) -> _.
718-
commit_with_identity_scope_ok(C) ->
719-
{ID, Version} = configure_limit(?time_range_month(), ?scope([?scope_identity()]), C),
720-
Context = ?wthdproc_ctx_withdrawal(?cash(10, <<"RUB">>)),
721-
{ok, {vector, _}} = hold_and_commit(?LIMIT_CHANGE(ID, ?CHANGE_ID, Version), Context, ?config(client, C)),
722-
{ok, #limiter_Limit{}} = lim_client:get(ID, Version, Context, ?config(client, C)).
723-
724715
-spec commit_with_wallet_scope_ok(config()) -> _.
725716
commit_with_wallet_scope_ok(C) ->
726-
{ID, Version} = configure_limit(?time_range_month(), ?scope([?scope_wallet()]), C),
717+
{ID, Version} = configure_limit(?time_range_month(), ?scope([?scope_party(), ?scope_wallet()]), C),
727718
Context = ?wthdproc_ctx_withdrawal(?cash(10, <<"RUB">>)),
728719
{ok, {vector, _}} = hold_and_commit(?LIMIT_CHANGE(ID, ?CHANGE_ID, Version), Context, ?config(client, C)),
729720
{ok, #limiter_Limit{}} = lim_client:get(ID, Version, Context, ?config(client, C)).

compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ services:
2424
condition: service_healthy
2525

2626
dominant:
27-
image: ghcr.io/valitydev/dominant:sha-2150eea
27+
image: ghcr.io/valitydev/dominant:sha-ef03371-epic-party_here
2828
command: /opt/dominant/bin/dominant foreground
2929
depends_on:
3030
machinegun:

rebar.config

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,10 @@
6969
% for introspection on production
7070
{recon, "2.5.2"},
7171
{logger_logstash_formatter,
72-
{git, "https://github.com/valitydev/logger_logstash_formatter.git", {ref, "08a66a6"}}},
73-
{iosetopts, {git, "https://github.com/valitydev/iosetopts.git", {ref, "edb445c"}}}
72+
{git, "https://github.com/valitydev/logger_logstash_formatter.git", {ref, "08a66a6"}}}
7473
]},
7574
{relx, [
7675
{release, {limiter, "1.0.0"}, [
77-
iosetopts,
7876
{recon, load},
7977
{runtime_tools, load},
8078
{tools, load},

rebar.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
{<<"ctx">>,{pkg,<<"ctx">>,<<"0.6.0">>},2},
2020
{<<"damsel">>,
2121
{git,"https://github.com/valitydev/damsel.git",
22-
{ref,"81d1edce2043500e4581867da3f5f4c31e682f44"}},
22+
{ref,"ab44b9db25a76a2c50545fd884e4cdf3d3e3b628"}},
2323
0},
2424
{<<"dmt_client">>,
2525
{git,"https://github.com/valitydev/dmt_client.git",
@@ -59,7 +59,7 @@
5959
0},
6060
{<<"limiter_proto">>,
6161
{git,"https://github.com/valitydev/limiter-proto.git",
62-
{ref,"efeb7d4a05bd13c95fada18514509b34b107fcb9"}},
62+
{ref,"d4cdf0f6328125996ee705c3da87461f99dde7f4"}},
6363
0},
6464
{<<"machinery">>,
6565
{git,"https://github.com/valitydev/machinery-erlang.git",

0 commit comments

Comments
 (0)