diff --git a/apps/capi/src/capi_handler_search.erl b/apps/capi/src/capi_handler_search.erl index b5ef175..281c765 100644 --- a/apps/capi/src/capi_handler_search.erl +++ b/apps/capi/src/capi_handler_search.erl @@ -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),