FF-101: Destination tag (#92)

This commit is contained in:
Артем 2019-07-16 12:14:46 +03:00 committed by GitHub
parent b21866269e
commit dbcdcffc43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 16 additions and 10 deletions

View File

@ -29,7 +29,8 @@
-type resource_crypto_wallet() :: #{
id := binary(),
currency := atom()
currency := atom(),
tag => binary()
}.
-type destination() :: ff_instrument:instrument(resource()).

View File

@ -600,7 +600,8 @@ construct_payment_tool({bank_card, ResourceBankCard}) ->
construct_payment_tool({crypto_wallet, CryptoWallet}) ->
{crypto_currency, #domain_CryptoWallet{
id = maps:get(id, CryptoWallet),
crypto_currency = maps:get(currency, CryptoWallet)
crypto_currency = maps:get(currency, CryptoWallet),
destination_tag = maps:get(tag, CryptoWallet, undefined)
}}.
-spec get_quote(quote_params()) ->

View File

@ -1018,15 +1018,17 @@ from_swag(destination_resource, #{
bin => maps:get(<<"bin">>, BankCard),
masked_pan => maps:get(<<"lastDigits">>, BankCard)
}};
from_swag(destination_resource, #{
from_swag(destination_resource, Resource = #{
<<"type">> := <<"CryptoWalletDestinationResource">>,
<<"id">> := CryptoWalletID,
<<"currency">> := CryptoWalletCurrency
}) ->
{crypto_wallet, #{
Tag = maps:get(<<"tag">>, Resource, undefined),
{crypto_wallet, genlib_map:compact(#{
id => CryptoWalletID,
currency => from_swag(crypto_wallet_currency, CryptoWalletCurrency)
}};
currency => from_swag(crypto_wallet_currency, CryptoWalletCurrency),
tag => Tag
})};
from_swag(crypto_wallet_currency, <<"Bitcoin">>) -> bitcoin;
from_swag(crypto_wallet_currency, <<"Litecoin">>) -> litecoin;
@ -1210,7 +1212,8 @@ to_swag(destination_resource, {crypto_wallet, CryptoWallet}) ->
to_swag(map, #{
<<"type">> => <<"CryptoWalletDestinationResource">>,
<<"id">> => maps:get(id, CryptoWallet),
<<"currency">> => to_swag(crypto_wallet_currency, maps:get(currency, CryptoWallet))
<<"currency">> => to_swag(crypto_wallet_currency, maps:get(currency, CryptoWallet)),
<<"tag">> => maps:get(tag, CryptoWallet, undefined)
});
to_swag(pan_last_digits, MaskedPan) ->

View File

@ -439,7 +439,8 @@ make_crypto_wallet_resource() ->
#{
<<"type">> => <<"CryptoWalletDestinationResource">>,
<<"id">> => <<"0610899fa9a3a4300e375ce582762273">>,
<<"currency">> => <<"Ethereum">>
<<"currency">> => <<"Ethereum">>,
<<"tag">> => <<"test_tag">>
}.
create_desination(IdentityID, Resource, C) ->

View File

@ -18,7 +18,7 @@
{<<"cowlib">>,{pkg,<<"cowlib">>,<<"1.0.2">>},1},
{<<"dmsl">>,
{git,"git@github.com:rbkmoney/damsel.git",
{ref,"2350582f2457bef14781a416777f3d324e0e143f"}},
{ref,"7c8c363a22367488a03e1bf081e33ea8279f0e71"}},
0},
{<<"dmt_client">>,
{git,"git@github.com:rbkmoney/dmt_client.git",

@ -1 +1 @@
Subproject commit 2c3fa28b2f331ef65f0b0cc8ce54ec41800cb7c8
Subproject commit a711262451b890109d8dbd06700aa3959822e64b