From 853659ca8f72ac240fb99e96174aee1ec1e787b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D0=B5=D0=BC?= Date: Tue, 6 Nov 2018 14:47:44 +0300 Subject: [PATCH] HG-384: Update fistful proto (#32) --- .../src/ff_identity_eventsink_handler.erl | 4 ++-- .../src/ff_wallet_eventsink_handler.erl | 4 ++-- .../src/ff_withdrawal_eventsink_handler.erl | 4 ++-- apps/ff_server/test/ff_eventsink_SUITE.erl | 24 +++++++++---------- rebar.lock | 2 +- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/apps/ff_server/src/ff_identity_eventsink_handler.erl b/apps/ff_server/src/ff_identity_eventsink_handler.erl index 2b91827..2e72fa9 100644 --- a/apps/ff_server/src/ff_identity_eventsink_handler.erl +++ b/apps/ff_server/src/ff_identity_eventsink_handler.erl @@ -66,11 +66,11 @@ publish_event(#{ } }) -> #'idnt_SinkEvent'{ - 'sequence' = marshal(event_id, ID), + 'id' = marshal(event_id, ID), 'created_at' = marshal(timestamp, Dt), 'source' = marshal(id, SourceID), 'payload' = #'idnt_Event'{ - 'id' = marshal(event_id, EventID), + 'sequence' = marshal(event_id, EventID), 'occured_at' = marshal(timestamp, EventDt), 'changes' = [marshal(event, Payload)] } diff --git a/apps/ff_server/src/ff_wallet_eventsink_handler.erl b/apps/ff_server/src/ff_wallet_eventsink_handler.erl index 94be5e2..7edcd2e 100644 --- a/apps/ff_server/src/ff_wallet_eventsink_handler.erl +++ b/apps/ff_server/src/ff_wallet_eventsink_handler.erl @@ -66,11 +66,11 @@ publish_event(#{ } }) -> #'wlt_SinkEvent'{ - 'sequence' = marshal(event_id, ID), + 'id' = marshal(event_id, ID), 'created_at' = marshal(timestamp, Dt), 'source' = marshal(id, SourceID), 'payload' = #'wlt_Event'{ - 'id' = marshal(event_id, EventID), + 'sequence' = marshal(event_id, EventID), 'occured_at' = marshal(timestamp, EventDt), 'changes' = [marshal(event, Payload)] } diff --git a/apps/ff_server/src/ff_withdrawal_eventsink_handler.erl b/apps/ff_server/src/ff_withdrawal_eventsink_handler.erl index 0d950dc..8f1b1fe 100644 --- a/apps/ff_server/src/ff_withdrawal_eventsink_handler.erl +++ b/apps/ff_server/src/ff_withdrawal_eventsink_handler.erl @@ -81,11 +81,11 @@ publish_event(#{ } }) -> #'wthd_SinkEvent'{ - 'sequence' = marshal(event_id, ID), + 'id' = marshal(event_id, ID), 'created_at' = marshal(timestamp, Dt), 'source' = marshal(id, SourceID), 'payload' = #'wthd_Event'{ - 'id' = marshal(event_id, EventID), + 'sequence' = marshal(event_id, EventID), 'occured_at' = marshal(timestamp, EventDt), 'changes' = [marshal(event, ff_transfer:maybe_migrate(Payload))] } diff --git a/apps/ff_server/test/ff_eventsink_SUITE.erl b/apps/ff_server/test/ff_eventsink_SUITE.erl index df70ecd..9196061 100644 --- a/apps/ff_server/test/ff_eventsink_SUITE.erl +++ b/apps/ff_server/test/ff_eventsink_SUITE.erl @@ -127,8 +127,8 @@ get_identity_events_ok(C) -> {ok, RawEvents} = ff_identity_machine:events(ID, {undefined, 1000, forward}), {ok, Events} = call_eventsink_handler('GetEvents', Service, [#'evsink_EventRange'{'after' = LastEvent, limit = 1000}]), - MaxID = get_max_sinkevent_sequence(Events), - MaxID = LastEvent + length(RawEvents). + MaxID = get_max_sinkevent_id(Events), + MaxID = LastEvent + length(RawEvents). -spec get_create_wallet_events_ok(config()) -> test_return(). @@ -153,8 +153,8 @@ get_create_wallet_events_ok(C) -> {ok, RawEvents} = ff_wallet_machine:events(ID, {undefined, 1000, forward}), {ok, Events} = call_eventsink_handler('GetEvents', Service, [#'evsink_EventRange'{'after' = LastEvent, limit = 1000}]), - MaxID = get_max_sinkevent_sequence(Events), - MaxID = LastEvent + length(RawEvents). + MaxID = get_max_sinkevent_id(Events), + MaxID = LastEvent + length(RawEvents). -spec get_withdrawal_events_ok(config()) -> test_return(). @@ -174,8 +174,8 @@ get_withdrawal_events_ok(C) -> {ok, RawEvents} = ff_withdrawal:events(WdrID, {undefined, 1000, forward}), {ok, Events} = call_eventsink_handler('GetEvents', Service, [#'evsink_EventRange'{'after' = LastEvent, limit = 1000}]), - MaxID = get_max_sinkevent_sequence(Events), - MaxID = LastEvent + length(RawEvents). + MaxID = get_max_sinkevent_id(Events), + MaxID = LastEvent + length(RawEvents). create_identity(Party, C) -> create_identity(Party, <<"good-one">>, <<"person">>, C). @@ -293,14 +293,14 @@ process_withdrawal(WalID, DestID) -> WdrID. --spec get_max_sinkevent_sequence(list(evsink_event())) -> evsink_id(). +-spec get_max_sinkevent_id(list(evsink_event())) -> evsink_id(). -get_max_sinkevent_sequence(Events) when is_list(Events) -> - lists:foldl(fun (Ev, Max) -> erlang:max(get_sinkevent_sequence(Ev), Max) end, 0, Events). +get_max_sinkevent_id(Events) when is_list(Events) -> + lists:foldl(fun (Ev, Max) -> erlang:max(get_sinkevent_id(Ev), Max) end, 0, Events). -get_sinkevent_sequence(#'wlt_SinkEvent'{sequence = Sequence}) -> Sequence; -get_sinkevent_sequence(#'wthd_SinkEvent'{sequence = Sequence}) -> Sequence; -get_sinkevent_sequence(#'idnt_SinkEvent'{sequence = Sequence}) -> Sequence. +get_sinkevent_id(#'wlt_SinkEvent'{id = ID}) -> ID; +get_sinkevent_id(#'wthd_SinkEvent'{id = ID}) -> ID; +get_sinkevent_id(#'idnt_SinkEvent'{id = ID}) -> ID. -spec unwrap_last_sinkevent_id({ok | error, evsink_id()}) -> evsink_id(). diff --git a/rebar.lock b/rebar.lock index 05d5ae5..133eeb8 100644 --- a/rebar.lock +++ b/rebar.lock @@ -38,7 +38,7 @@ 0}, {<<"fistful_proto">>, {git,"git@github.com:rbkmoney/fistful-proto.git", - {ref,"325e57d3da4c3a935bd2a99e913d97718fc9fd52"}}, + {ref,"08df5e92ad077d4434da133859d7b7852dd79f65"}}, 0}, {<<"genlib">>, {git,"https://github.com/rbkmoney/genlib.git",