Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
{dmt_client, {git, "https://github.com/valitydev/dmt-client.git", {tag, "v2.0.3"}}},
{damsel, {git, "https://github.com/valitydev/damsel.git", {tag, "v2.2.43"}}},
{identdocstore_proto, {git, "https://github.com/valitydev/identdocstore-proto.git", {branch, "master"}}},
{fistful_proto, {git, "https://github.com/valitydev/fistful-proto.git", {tag, "v2.0.1"}}},
{fistful_proto, {git, "https://github.com/valitydev/fistful-proto.git", {branch, "master"}}},
{fistful_reporter_proto, {git, "https://github.com/valitydev/fistful-reporter-proto.git", {branch, "master"}}},
{file_storage_proto, {git, "https://github.com/valitydev/file-storage-proto.git", {branch, "master"}}},
{bender_client, {git, "https://github.com/valitydev/bender-client-erlang.git", {tag, "v1.1.0"}}},
Expand Down
2 changes: 1 addition & 1 deletion rebar.lock
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
0},
{<<"fistful_proto">>,
{git,"https://github.com/valitydev/fistful-proto.git",
{ref,"7c61ac50ddb658bee477538f32133f815bc45876"}},
{ref,"360c737c83b627af5084a1e47e31755fb30c2239"}},
0},
{<<"fistful_reporter_proto">>,
{git,"https://github.com/valitydev/fistful-reporter-proto.git",
Expand Down
6 changes: 4 additions & 2 deletions src/wapi_withdrawal_backend.erl
Original file line number Diff line number Diff line change
Expand Up @@ -450,17 +450,19 @@ unmarshal(withdrawal, #wthd_WithdrawalState{
wallet_id = WalletID,
party_id = PartyID,
destination_id = DestinationID,
body = Body,
body = Body0,
external_id = ExternalID,
status = Status,
created_at = CreatedAt,
metadata = Metadata,
quote = Quote,
contact_info = ContactInfo,
effective_final_cash_flow = EffectiveFinalCashFlow
effective_final_cash_flow = EffectiveFinalCashFlow,
new_body = NewBody
}) ->
UnmarshaledMetadata = maybe_unmarshal(context, Metadata),
Fee = maybe_unmarshal_fee(Status, EffectiveFinalCashFlow),
Body = genlib:define(NewBody, Body0),
genlib_map:compact(
maps:merge(
#{
Expand Down
6 changes: 4 additions & 2 deletions test/wapi_wallet_dummy_data.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@
-define(PAYMENT_SERVICE_REF(ID), #'fistful_base_PaymentServiceRef'{id = ID}).
-define(CRYPTO_CURRENCY_REF(ID), #'fistful_base_CryptoCurrencyRef'{id = ID}).

-define(CASH, #'fistful_base_Cash'{
amount = ?INTEGER,
-define(CASH, ?CASH(?INTEGER)).

-define(CASH(Amount), #'fistful_base_Cash'{
amount = Amount,
currency = #'fistful_base_CurrencyRef'{
symbolic_code = ?RUB
}
Expand Down
34 changes: 34 additions & 0 deletions test/wapi_withdrawal_tests_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
get_failed_wo_colon/1,
get_fail_withdrawal_notfound/1,
get_by_external_id_ok/1,
get_with_new_body_ok/1,
create_quote_ok/1,
get_quote_fail_wallet_notfound/1,
get_quote_fail_destination_notfound/1,
Expand Down Expand Up @@ -90,6 +91,7 @@ groups() ->
get_failed_wo_colon,
get_fail_withdrawal_notfound,
get_by_external_id_ok,
get_with_new_body_ok,
create_quote_ok,
get_quote_fail_wallet_notfound,
get_quote_fail_destination_notfound,
Expand Down Expand Up @@ -436,6 +438,38 @@ get_by_external_id_ok(C) ->
wapi_ct_helper:cfg(context, C)
).

-spec get_with_new_body_ok(config()) -> _.
get_with_new_body_ok(C) ->
PartyID = ?config(party, C),
Withdrawal0 = ?WITHDRAWAL(PartyID),
Withdrawal = Withdrawal0#wthd_WithdrawalState{
new_body = ?CASH(100500)
},
_ = wapi_ct_helper_bouncer:mock_assert_withdrawal_op_ctx(<<"GetWithdrawal">>, ?STRING, PartyID, C),
_ = wapi_ct_helper:mock_services(
[
{fistful_withdrawal, fun
('GetContext', _) -> {ok, ?DEFAULT_CONTEXT(PartyID)};
('Get', _) -> {ok, Withdrawal}
end}
],
C
),
{ok, #{
<<"body">> := #{
<<"amount">> := 100500,
<<"currency">> := <<"RUB">>
}
}} = call_api(
fun swag_client_wallet_withdrawals_api:get_withdrawal/3,
#{
binding => #{
<<"withdrawalID">> => ?STRING
}
},
wapi_ct_helper:cfg(context, C)
).

-spec create_quote_ok(config()) -> _.
create_quote_ok(C) ->
_ = get_quote_start_mocks(C, fun() -> {ok, ?WITHDRAWAL_QUOTE} end),
Expand Down
Loading