Skip to content

Commit f1882f7

Browse files
committed
Merge branch 'master' into epic/dmt-client-v2
2 parents 2150901 + 08cdd07 commit f1882f7

File tree

5 files changed

+12
-37
lines changed

5 files changed

+12
-37
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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,7 @@ commit_with_email_scope_ok(C) ->
716716

717717
-spec commit_with_wallet_scope_ok(config()) -> _.
718718
commit_with_wallet_scope_ok(C) ->
719-
{ID, Version} = configure_limit(?time_range_month(), ?scope([?scope_wallet()]), C),
719+
{ID, Version} = configure_limit(?time_range_month(), ?scope([?scope_party(), ?scope_wallet()]), C),
720720
Context = ?wthdproc_ctx_withdrawal(?cash(10, <<"RUB">>)),
721721
{ok, {vector, _}} = hold_and_commit(?LIMIT_CHANGE(ID, ?CHANGE_ID, Version), Context, ?config(client, C)),
722722
{ok, #limiter_Limit{}} = lim_client:get(ID, Version, Context, ?config(client, C)).

0 commit comments

Comments
 (0)