diff --git a/rebar.config b/rebar.config index 96605aa..e186d36 100644 --- a/rebar.config +++ b/rebar.config @@ -78,8 +78,8 @@ {test, [ {deps, [ %% Libraries generated with swagger-codegen-erlang from valitydev/swag-wallets - {swag_server_wallet, {git, "https://github.com/valitydev/swag-wallets", {ref, "d1cf2f3"}}}, - {swag_client_wallet, {git, "https://github.com/valitydev/swag-wallets", {ref, "04d849e"}}}, + {swag_server_wallet, {git, "https://github.com/valitydev/swag-wallets", {ref, "f8e0875"}}}, + {swag_client_wallet, {git, "https://github.com/valitydev/swag-wallets", {ref, "592cdb4"}}}, {meck, "0.9.2"} ]}, {cover_enabled, true}, diff --git a/rebar.lock b/rebar.lock index f2d9d69..515aaa6 100644 --- a/rebar.lock +++ b/rebar.lock @@ -21,7 +21,7 @@ {<<"cowlib">>,{pkg,<<"cowlib">>,<<"2.11.0">>},2}, {<<"damsel">>, {git,"https://github.com/valitydev/damsel.git", - {ref,"f718741970470474efcd32800daf885cb8d75584"}}, + {ref,"3a25a01f89423e1fc7dbabc8a3f777647b659f45"}}, 0}, {<<"dmt_client">>, {git,"https://github.com/valitydev/dmt-client.git", @@ -37,7 +37,7 @@ 0}, {<<"fistful_proto">>, {git,"https://github.com/valitydev/fistful-proto.git", - {ref,"3aa8dfd15e9d1336d5d89246bc2fca9443dcebb9"}}, + {ref,"1c2861893e55d7323e25cd3c5b6d90b2cb5abb9a"}}, 0}, {<<"fistful_reporter_proto">>, {git,"https://github.com/valitydev/fistful-reporter-proto.git", diff --git a/src/wapi_codec.erl b/src/wapi_codec.erl index 7daf7d8..00e0e8a 100644 --- a/src/wapi_codec.erl +++ b/src/wapi_codec.erl @@ -138,7 +138,8 @@ marshal(digital_wallet, Wallet = #{id := ID, payment_service := PaymentService}) id = marshal(string, ID), token = maybe_marshal(string, maps:get(token, Wallet, undefined)), payment_service = marshal(payment_service, PaymentService), - account_name = maps:get(account_name, Wallet, undefined) + account_name = maps:get(account_name, Wallet, undefined), + account_identity_number = maps:get(account_identity_number, Wallet, undefined) }; marshal(generic_resource, Resource = #{payment_service := PaymentService}) -> Data = maybe_marshal(content, maps:get(data, Resource, undefined)), @@ -342,13 +343,15 @@ unmarshal(digital_wallet, #'fistful_base_DigitalWallet'{ id = ID, token = Token, payment_service = PaymentService, - account_name = AccountName + account_name = AccountName, + account_identity_number = AccountIdentityNumber }) -> genlib_map:compact(#{ id => unmarshal(string, ID), token => maybe_marshal(string, Token), payment_service => unmarshal(payment_service, PaymentService), - account_name => unmarshal(string, AccountName) + account_name => unmarshal(string, AccountName), + account_identity_number => unmarshal(string, AccountIdentityNumber) }); unmarshal(generic_resource, #'fistful_base_ResourceGenericData'{ provider = PaymentService, diff --git a/src/wapi_destination_backend.erl b/src/wapi_destination_backend.erl index 4949cb7..e93dfac 100644 --- a/src/wapi_destination_backend.erl +++ b/src/wapi_destination_backend.erl @@ -207,7 +207,11 @@ construct_resource( id => marshal(string, DigitalWalletID), payment_service => #{id => marshal(string, Provider)}, token => maybe_marshal(string, maps:get(<<"token">>, Resource, undefined)), - account_name => maybe_marshal(string, maps:get(<<"accountName">>, Resource, undefined)) + account_name => maybe_marshal(string, maps:get(<<"accountName">>, Resource, undefined)), + account_identity_number => maybe_marshal( + string, + maps:get(<<"accountIdentityNumber">>, Resource, undefined) + ) } }}, {ok, wapi_codec:marshal(resource, ConstructedResource)}; @@ -381,7 +385,8 @@ unmarshal( digital_wallet = #'fistful_base_DigitalWallet'{ id = DigitalWalletID, payment_service = #'fistful_base_PaymentServiceRef'{id = Provider}, - account_name = AccountName + account_name = AccountName, + account_identity_number = AccountIdentityNumber } }} ) -> @@ -389,7 +394,8 @@ unmarshal( <<"type">> => <<"DigitalWalletDestinationResource">>, <<"id">> => unmarshal(string, DigitalWalletID), <<"provider">> => unmarshal(string, Provider), - <<"accountName">> => maybe_unmarshal(string, AccountName) + <<"accountName">> => maybe_unmarshal(string, AccountName), + <<"accountIdentityNumber">> => maybe_unmarshal(string, AccountIdentityNumber) }); unmarshal( resource, diff --git a/src/wapi_stat_backend.erl b/src/wapi_stat_backend.erl index 82ac7a5..3a29763 100644 --- a/src/wapi_stat_backend.erl +++ b/src/wapi_stat_backend.erl @@ -399,11 +399,13 @@ unmarshal_crypto_wallet(#'fistful_base_CryptoWallet'{ unmarshal_digital_wallet(#'fistful_base_DigitalWallet'{ id = DigitalWalletID, payment_service = #'fistful_base_PaymentServiceRef'{id = Provider}, - account_name = AccountName + account_name = AccountName, + account_identity_number = AccountIdentityNumber }) -> genlib_map:compact(#{ <<"type">> => <<"DigitalWalletDestinationResource">>, <<"id">> => DigitalWalletID, <<"provider">> => Provider, - <<"accountName">> => AccountName + <<"accountName">> => AccountName, + <<"accountIdentityNumber">> => AccountIdentityNumber }). diff --git a/test/wapi_destination_tests_SUITE.erl b/test/wapi_destination_tests_SUITE.erl index cca7101..5c1c69c 100644 --- a/test/wapi_destination_tests_SUITE.erl +++ b/test/wapi_destination_tests_SUITE.erl @@ -330,6 +330,7 @@ digital_wallet_resource_test(C) -> ?assertEqual(<<"DigitalWalletDestinationResource">>, maps:get(<<"type">>, SwagResource)), ?assertEqual(<<"nomoney">>, maps:get(<<"provider">>, SwagResource)), ?assertEqual(<<"AccountNAME">>, maps:get(<<"accountName">>, SwagResource)), + ?assertEqual(<<"AccountIdentityNumber">>, maps:get(<<"accountIdentityNumber">>, SwagResource)), {digital_wallet, #'fistful_base_ResourceDigitalWallet'{digital_wallet = #'fistful_base_DigitalWallet'{id = ID}}} = Resource, ?assertEqual(ID, maps:get(<<"id">>, SwagResource)). @@ -345,7 +346,8 @@ digital_wallet_w_token_resource_test(C) -> <<"id">> => ?STRING, <<"provider">> => Provider, <<"token">> => Token, - <<"accountName">> => ?STRING + <<"accountName">> => ?STRING, + <<"accountIdentityNumber">> => ?STRING }, Destination = #{ <<"name">> => ?STRING, @@ -653,7 +655,8 @@ generate_resource(digital_wallet) -> digital_wallet = #'fistful_base_DigitalWallet'{ id = uniq(), payment_service = #'fistful_base_PaymentServiceRef'{id = generate_digital_wallet_provider()}, - account_name = <<"AccountNAME">> + account_name = <<"AccountNAME">>, + account_identity_number = <<"AccountIdentityNumber">> } }}. diff --git a/test/wapi_wallet_dummy_data.hrl b/test/wapi_wallet_dummy_data.hrl index 505c7fb..d080fc5 100644 --- a/test/wapi_wallet_dummy_data.hrl +++ b/test/wapi_wallet_dummy_data.hrl @@ -175,7 +175,8 @@ id = ?STRING, token = ?STRING, payment_service = #'fistful_base_PaymentServiceRef'{id = <<"nomoney">>}, - account_name = ?STRING + account_name = ?STRING, + account_identity_number = ?STRING }). -define(RESOURCE_DIGITAL_WALLET,