From fe523357167e4354de5ad3c0f87bb94e0b7b30f9 Mon Sep 17 00:00:00 2001 From: ttt161 Date: Sun, 17 May 2026 12:02:02 +0300 Subject: [PATCH 1/2] fix InvoiceClientInfo --- apps/capi/src/capi_handler_decoder_invoicing.erl | 10 +++++++++- apps/capi/test/capi_base_api_token_tests_SUITE.erl | 3 ++- apps/capi/test/capi_dummy_data.hrl | 6 ++++-- rebar.config | 4 ++-- rebar.lock | 14 +++++++------- 5 files changed, 24 insertions(+), 13 deletions(-) diff --git a/apps/capi/src/capi_handler_decoder_invoicing.erl b/apps/capi/src/capi_handler_decoder_invoicing.erl index 71e9d7d..49ba856 100644 --- a/apps/capi/src/capi_handler_decoder_invoicing.erl +++ b/apps/capi/src/capi_handler_decoder_invoicing.erl @@ -493,7 +493,8 @@ decode_invoice(Invoice) -> <<"bankAccount">> => decode_invoice_bank_account(Details#domain_InvoiceDetails.bank_account), <<"invoiceTemplateID">> => Invoice#domain_Invoice.template_id, <<"allocation">> => capi_allocation:decode(Invoice#domain_Invoice.allocation), - <<"amountRandomized">> => capi_mutation:decode_invoice_amount_mutation(Invoice#domain_Invoice.mutations) + <<"amountRandomized">> => capi_mutation:decode_invoice_amount_mutation(Invoice#domain_Invoice.mutations), + <<"clientInfo">> => decode_invoice_client_info(Invoice#domain_Invoice.client_info) }, decode_invoice_status(Invoice#domain_Invoice.status) ). @@ -547,6 +548,13 @@ decode_invoice_line_tax_mode(#{<<"TaxMode">> := {str, TM}}) -> decode_invoice_line_tax_mode(_) -> undefined. +decode_invoice_client_info(#domain_InvoiceClientInfo{trust_level = well_known}) -> + #{<<"trustLevel">> => <<"wellKnown">>}; +decode_invoice_client_info(#domain_InvoiceClientInfo{trust_level = unknown}) -> + #{<<"trustLevel">> => <<"unknown">>}; +decode_invoice_client_info(_) -> + undefined. + -spec decode_payment_methods(undefined | list()) -> list(decode_data()). decode_payment_methods(undefined) -> []; diff --git a/apps/capi/test/capi_base_api_token_tests_SUITE.erl b/apps/capi/test/capi_base_api_token_tests_SUITE.erl index 7e22ce2..1987669 100644 --- a/apps/capi/test/capi_base_api_token_tests_SUITE.erl +++ b/apps/capi/test/capi_base_api_token_tests_SUITE.erl @@ -256,7 +256,8 @@ create_invoice_ok_test(Config) -> Config ), _ = capi_ct_helper_bouncer:mock_assert_shop_op_ctx(<<"CreateInvoice">>, ?STRING, ?STRING, Config), - {ok, _} = capi_client_invoices:create_invoice(?config(context, Config), ?INVOICE_PARAMS). + {ok, #{<<"invoice">> := Invoice}} = capi_client_invoices:create_invoice(?config(context, Config), ?INVOICE_PARAMS), + ?assertMatch(#{<<"clientInfo">> := #{<<"trustLevel">> := <<"wellKnown">>}}, Invoice). -spec create_invoice_rand_amount_ok_test(config()) -> _. create_invoice_rand_amount_ok_test(Config) -> diff --git a/apps/capi/test/capi_dummy_data.hrl b/apps/capi/test/capi_dummy_data.hrl index fd47741..55c71ce 100644 --- a/apps/capi/test/capi_dummy_data.hrl +++ b/apps/capi/test/capi_dummy_data.hrl @@ -108,7 +108,8 @@ shop_ref = #domain_ShopConfigRef{id = ?STRING}, party_ref = #domain_PartyConfigRef{id = OwnerID}, template_id = ?STRING, - external_id = EID + external_id = EID, + client_info = #domain_InvoiceClientInfo{trust_level = well_known} }). -define(SWAG_INVOICE_CART, [ @@ -1421,7 +1422,8 @@ <<"accountType">> => <<"InvoiceRussianBankAccount">>, <<"account">> => <<"12345678901234567890">>, <<"bankBik">> => <<"123456789">> - } + }, + <<"clientInfo">> => #{<<"trustLevel">> => <<"wellKnown">>} }). -define(PAYMENT_PARAMS(EID, Token), #{ diff --git a/rebar.config b/rebar.config index ca6fcbf..0e51eb6 100644 --- a/rebar.config +++ b/rebar.config @@ -28,7 +28,7 @@ {deps, [ {prometheus, "4.11.0"}, {prometheus_cowboy, "0.1.9"}, - {cowboy, "2.9.0"}, + {cowboy, "2.12.0"}, %% NOTE %% Pinning to version "1.11.2" from hex here causes constant upgrading and recompilation of the entire project {jose, {git, "https://github.com/potatosalad/erlang-jose.git", {tag, "1.11.2"}}}, @@ -36,7 +36,7 @@ {cowboy_draining_server, {git, "https://github.com/valitydev/cowboy_draining_server.git", {branch, "master"}}}, {woody, {git, "https://github.com/valitydev/woody_erlang.git", {tag, "v1.1.0"}}}, {woody_user_identity, {git, "https://github.com/valitydev/woody_erlang_user_identity.git", {tag, "v1.1.0"}}}, - {damsel, {git, "https://github.com/valitydev/damsel.git", {tag, "v2.2.32"}}}, + {damsel, {git, "https://github.com/valitydev/damsel.git", {branch, "ft/TECH-6/trust-level-condition"}}}, {bender_proto, {git, "https://github.com/valitydev/bender-proto.git", {branch, "master"}}}, {bender_client, {git, "https://github.com/valitydev/bender-client-erlang.git", {tag, "v1.1.0"}}}, {dmt_client, {git, "https://github.com/valitydev/dmt_client.git", {tag, "v2.0.3"}}}, diff --git a/rebar.lock b/rebar.lock index 57fc4e6..2c88aab 100644 --- a/rebar.lock +++ b/rebar.lock @@ -24,7 +24,7 @@ {ref,"5a87a37694e42b6592d3b4164ae54e0e87e24e18"}}, 1}, {<<"chatterbox">>,{pkg,<<"ts_chatterbox">>,<<"0.15.1">>},2}, - {<<"cowboy">>,{pkg,<<"cowboy">>,<<"2.9.0">>},0}, + {<<"cowboy">>,{pkg,<<"cowboy">>,<<"2.12.0">>},0}, {<<"cowboy_access_log">>, {git,"https://github.com/valitydev/cowboy_access_log.git", {ref,"04da359e022cf05c5c93812504d5791d6bc97453"}}, @@ -37,11 +37,11 @@ {git,"https://github.com/valitydev/cowboy_draining_server.git", {ref,"186cf4d0722d4ad79afe73d371df6b1371e51905"}}, 0}, - {<<"cowlib">>,{pkg,<<"cowlib">>,<<"2.11.0">>},1}, + {<<"cowlib">>,{pkg,<<"cowlib">>,<<"2.13.0">>},1}, {<<"ctx">>,{pkg,<<"ctx">>,<<"0.6.0">>},2}, {<<"damsel">>, {git,"https://github.com/valitydev/damsel.git", - {ref,"31495ce9d95c5d1b627b349c01d9937a5ef0231c"}}, + {ref,"bb7f1ef3eecaef7fc4786ef3344d438ac309f6a0"}}, 0}, {<<"dmt_client">>, {git,"https://github.com/valitydev/dmt_client.git", @@ -163,8 +163,8 @@ {<<"cache">>, <<"B23A5FE7095445A88412A6E614C933377E0137B44FFED77C9B3FEF1A731A20B2">>}, {<<"certifi">>, <<"DBAB8E5E155A0763EEA978C913CA280A6B544BFA115633FA20249C3D396D9493">>}, {<<"chatterbox">>, <<"5CAC4D15DD7AD61FC3C4415CE4826FC563D4643DEE897A558EC4EA0B1C835C9C">>}, - {<<"cowboy">>, <<"865DD8B6607E14CF03282E10E934023A1BD8BE6F6BACF921A7E2A96D800CD452">>}, - {<<"cowlib">>, <<"0B9FF9C346629256C42EBE1EEB769A83C6CB771A6EE5960BD110AB0B9B872063">>}, + {<<"cowboy">>, <<"F276D521A1FF88B2B9B4C54D0E753DA6C66DD7BE6C9FCA3D9418B561828A3731">>}, + {<<"cowlib">>, <<"DB8F7505D8332D98EF50A3EF34B34C1AFDDEC7506E4EE4DD4A3A266285D282CA">>}, {<<"ctx">>, <<"8FF88B70E6400C4DF90142E7F130625B82086077A45364A78D208ED3ED53C7FE">>}, {<<"email_validator">>, <<"7E09A862E9AA99AE2CA6FD2A718D2B94360E32940A1339B53DFEE6B774BCDB03">>}, {<<"gproc">>, <<"853CCB7805E9ADA25D227A157BA966F7B34508F386A3E7E21992B1B484230699">>}, @@ -193,8 +193,8 @@ {<<"cache">>, <<"44516CE6FA03594D3A2AF025DD3A87BFE711000EB730219E1DDEFC816E0AA2F4">>}, {<<"certifi">>, <<"524C97B4991B3849DD5C17A631223896272C6B0AF446778BA4675A1DFF53BB7E">>}, {<<"chatterbox">>, <<"4F75B91451338BC0DA5F52F3480FA6EF6E3A2AEECFC33686D6B3D0A0948F31AA">>}, - {<<"cowboy">>, <<"2C729F934B4E1AA149AFF882F57C6372C15399A20D54F65C8D67BEF583021BDE">>}, - {<<"cowlib">>, <<"2B3E9DA0B21C4565751A6D4901C20D1B4CC25CBB7FD50D91D2AB6DD287BC86A9">>}, + {<<"cowboy">>, <<"8A7ABE6D183372CEB21CAA2709BEC928AB2B72E18A3911AA1771639BEF82651E">>}, + {<<"cowlib">>, <<"E1E1284DC3FC030A64B1AD0D8382AE7E99DA46C3246B815318A4B848873800A4">>}, {<<"ctx">>, <<"A14ED2D1B67723DBEBBE423B28D7615EB0BDCBA6FF28F2D1F1B0A7E1D4AA5FC2">>}, {<<"email_validator">>, <<"2B1E6DF7BB14155C8D7D131F1C95CF4676200BC056EEBA82123396833FF94DA2">>}, {<<"gproc">>, <<"587E8AF698CCD3504CF4BA8D90F893EDE2B0F58CABB8A916E2BF9321DE3CF10B">>}, From 447e2805da97cd6a6cba6ca74a984b33f440a72c Mon Sep 17 00:00:00 2001 From: ttt161 Date: Mon, 18 May 2026 11:41:16 +0300 Subject: [PATCH 2/2] bump damsel-2.2.33 --- rebar.config | 2 +- rebar.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rebar.config b/rebar.config index 0e51eb6..b4a57b6 100644 --- a/rebar.config +++ b/rebar.config @@ -36,7 +36,7 @@ {cowboy_draining_server, {git, "https://github.com/valitydev/cowboy_draining_server.git", {branch, "master"}}}, {woody, {git, "https://github.com/valitydev/woody_erlang.git", {tag, "v1.1.0"}}}, {woody_user_identity, {git, "https://github.com/valitydev/woody_erlang_user_identity.git", {tag, "v1.1.0"}}}, - {damsel, {git, "https://github.com/valitydev/damsel.git", {branch, "ft/TECH-6/trust-level-condition"}}}, + {damsel, {git, "https://github.com/valitydev/damsel.git", {tag, "v2.2.33"}}}, {bender_proto, {git, "https://github.com/valitydev/bender-proto.git", {branch, "master"}}}, {bender_client, {git, "https://github.com/valitydev/bender-client-erlang.git", {tag, "v1.1.0"}}}, {dmt_client, {git, "https://github.com/valitydev/dmt_client.git", {tag, "v2.0.3"}}}, diff --git a/rebar.lock b/rebar.lock index 2c88aab..c9de94e 100644 --- a/rebar.lock +++ b/rebar.lock @@ -41,7 +41,7 @@ {<<"ctx">>,{pkg,<<"ctx">>,<<"0.6.0">>},2}, {<<"damsel">>, {git,"https://github.com/valitydev/damsel.git", - {ref,"bb7f1ef3eecaef7fc4786ef3344d438ac309f6a0"}}, + {ref,"e7a302a684deba1bb18a00d1056879329219d280"}}, 0}, {<<"dmt_client">>, {git,"https://github.com/valitydev/dmt_client.git",