mirror of
https://github.com/valitydev/wapi-lib.git
synced 2024-11-06 10:15:17 +00:00
INT-1136: add identity number for digital wallet (#32)
* INT-1136: add identity number for digital wallet * INT-1136: code style * Update test/wapi_destination_tests_SUITE.erl Co-authored-by: Артем <WWW_cool@inbox.ru> * INT-1136: fix --------- Co-authored-by: Артем <WWW_cool@inbox.ru>
This commit is contained in:
parent
e316877528
commit
c80fd9c7ca
@ -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},
|
||||
|
@ -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",
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
}).
|
||||
|
@ -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">>
|
||||
}
|
||||
}}.
|
||||
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user