APM-18: Properly handle terminal paytool w/ no metadata (#8)

* Switch to proper bouncer-client upstream
  * valitydev/bouncer-client-erlang@b6c7be0
  * valitydev/token-keeper-client@06cc712
This commit is contained in:
Andrew Mayorov 2022-03-23 15:00:30 +03:00 committed by GitHub
parent fbd0ba8f2c
commit b905604897
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 28 additions and 10 deletions

View File

@ -6,7 +6,7 @@ on:
- 'master'
- 'epic/**'
pull_request:
branches: [ '**' ]
branches: ['**']
env:
REGISTRY: ghcr.io

View File

@ -6,7 +6,7 @@ on:
- 'master'
- 'epic/**'
pull_request:
branches: [ '**' ]
branches: ['**']
jobs:
setup:

View File

@ -394,7 +394,7 @@ process_payment_terminal_data(Data) ->
Ref = encode_payment_service_ref(maps:get(<<"provider">>, Data)),
case validate_payment_service_ref(Ref) of
{ok, _} ->
Metadata = maps:get(<<"metadata">>, Data),
Metadata = maps:get(<<"metadata">>, Data, undefined),
PaymentTerminal = #domain_PaymentTerminal{
payment_service = Ref,
metadata = capi_utils:maybe(Metadata, fun encode_resource_metadata/1)

View File

@ -35,6 +35,7 @@
create_visa_payment_resource_idemp_fail_test/1,
create_nspkmir_payment_resource_ok_test/1,
create_euroset_payment_resource_ok_test/1,
create_euroset_no_metadata_payment_resource_ok_test/1,
create_mobile_payment_resource_ok_test/1,
create_qw_payment_resource_ok_test/1,
create_qw_payment_resource_with_access_token_generates_different_payment_token/1,
@ -111,6 +112,7 @@ groups() ->
create_visa_payment_resource_idemp_fail_test,
create_nspkmir_payment_resource_ok_test,
create_euroset_payment_resource_ok_test,
create_euroset_no_metadata_payment_resource_ok_test,
create_mobile_payment_resource_ok_test,
create_qw_payment_resource_ok_test,
create_qw_payment_resource_with_access_token_generates_different_payment_token,
@ -661,6 +663,22 @@ create_euroset_payment_resource_ok_test(Config) ->
<<"clientInfo">> => ClientInfo
}).
-spec create_euroset_no_metadata_payment_resource_ok_test(_) -> _.
create_euroset_no_metadata_payment_resource_ok_test(Config) ->
ClientInfo = #{<<"fingerprint">> => <<"test fingerprint">>},
{ok, #{
<<"paymentToolDetails">> := #{
<<"detailsType">> := <<"PaymentToolDetailsPaymentTerminal">>,
<<"provider">> := <<"euroset">>
}
}} = capi_client_tokens:create_payment_resource(?config(context, Config), #{
<<"paymentTool">> => #{
<<"paymentToolType">> => <<"PaymentTerminalData">>,
<<"provider">> => <<"euroset">>
},
<<"clientInfo">> => ClientInfo
}).
-spec create_mobile_payment_resource_ok_test(_) -> _.
create_mobile_payment_resource_ok_test(Config) ->
_ = capi_ct_helper:mock_services(

View File

@ -48,7 +48,7 @@
{cds_proto, {git, "https://github.com/valitydev/cds-proto.git", {branch, "master"}}},
{bankcard_validator, {git, "https://github.com/valitydev/bankcard_validator.git", {branch, "master"}}},
{bouncer_proto, {git, "https://github.com/valitydev/bouncer-proto.git", {branch, "master"}}},
{bouncer_client, {git, "https://github.com/valitydev/bouncer_client_erlang.git", {branch, "master"}}},
{bouncer_client, {git, "https://github.com/valitydev/bouncer-client-erlang.git", {branch, "master"}}},
{token_keeper_client, {git, "https://github.com/valitydev/token-keeper-client.git", {branch, "master"}}},
{dmt_client, {git, "https://github.com/valitydev/dmt_client.git", {branch, master}}},
% Generated dependencies

View File

@ -12,8 +12,8 @@
{ref,"410b2c241d199e3cd42a9b8b553e8aa645d6ff19"}},
0},
{<<"bouncer_client">>,
{git,"https://github.com/valitydev/bouncer_client_erlang.git",
{ref,"535449a459b70643836c440a863b42656f2a1409"}},
{git,"https://github.com/valitydev/bouncer-client-erlang.git",
{ref,"b6c7be05e24f46121f42ae5a48232b94f78c9c5c"}},
0},
{<<"bouncer_proto">>,
{git,"https://github.com/valitydev/bouncer-proto.git",
@ -95,8 +95,8 @@
{ref,"ec15d5e854ea60c58467373077d90c2faf6273d8"}},
1},
{<<"org_management_proto">>,
{git,"https://github.com/valitydev/org-management-proto.git",
{ref,"06c5c8430e445cb7874e54358e457cbb5697fc32"}},
{git,"https://github.com/valitydev/org-management-proto",
{ref,"f433223706284000694e54e839fafb10db84e2b3"}},
1},
{<<"parse_trans">>,{pkg,<<"parse_trans">>,<<"3.4.1">>},0},
{<<"payproc_errors">>,
@ -131,11 +131,11 @@
1},
{<<"token_keeper_client">>,
{git,"https://github.com/valitydev/token-keeper-client.git",
{ref,"d3673e72c4c3480b4b8ddff85f1450a6ffd5dd34"}},
{ref,"06cc71293e28f3e01fe981069c48c9782d0ab1f2"}},
0},
{<<"token_keeper_proto">>,
{git,"https://github.com/valitydev/token-keeper-proto.git",
{ref,"e52cb1ca0ea9ca5fbf3792ae211ae87bdc1d4cc5"}},
{ref,"448afd93571f4f7feea655e29ea4b0e98fd808f5"}},
1},
{<<"unicode_util_compat">>,{pkg,<<"unicode_util_compat">>,<<"0.7.0">>},1},
{<<"woody">>,