Add missing crypto currency decoding to search (#452)

This commit is contained in:
Sergey Yelin 2019-12-17 19:36:52 +03:00 committed by GitHub
parent 6cc06e8464
commit ccd4ba3cc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -307,7 +307,9 @@ decode_stat_payment_tool_token({bank_card, BankCard}) ->
decode_stat_payment_tool_token({payment_terminal, PaymentTerminal}) ->
decode_payment_terminal(PaymentTerminal);
decode_stat_payment_tool_token({digital_wallet, DigitalWallet}) ->
decode_digital_wallet(DigitalWallet).
decode_digital_wallet(DigitalWallet);
decode_stat_payment_tool_token({crypto_currency, CryptoCurrency}) ->
decode_crypto_wallet(CryptoCurrency).
decode_bank_card(#merchstat_BankCard{
'token' = Token,
@ -346,12 +348,23 @@ decode_digital_wallet(#merchstat_DigitalWallet{
<<"id" >> => ID
}).
decode_crypto_wallet(CryptoCurrency) ->
capi_utils:map_to_base64url(#{
<<"type" >> => <<"crypto_wallet">>,
<<"crypto_currency">> => capi_handler_decoder_utils:convert_crypto_currency_to_swag(CryptoCurrency)
}).
decode_stat_payment_tool_details({bank_card, V}) ->
decode_bank_card_details(V, #{<<"detailsType">> => <<"PaymentToolDetailsBankCard">>});
decode_stat_payment_tool_details({payment_terminal, V}) ->
decode_payment_terminal_details(V, #{<<"detailsType">> => <<"PaymentToolDetailsPaymentTerminal">>});
decode_stat_payment_tool_details({digital_wallet, V}) ->
decode_digital_wallet_details(V, #{<<"detailsType">> => <<"PaymentToolDetailsDigitalWallet">>}).
decode_digital_wallet_details(V, #{<<"detailsType">> => <<"PaymentToolDetailsDigitalWallet">>});
decode_stat_payment_tool_details({crypto_currency, CryptoCurrency}) ->
#{
<<"detailsType">> => <<"PaymentToolDetailsCryptoWallet">>,
<<"cryptoCurrency">> => capi_handler_decoder_utils:convert_crypto_currency_to_swag(CryptoCurrency)
}.
decode_bank_card_details(BankCard, V) ->
LastDigits = capi_handler_decoder_utils:decode_last_digits(BankCard#merchstat_BankCard.masked_pan),