From f6f93d29845e171cb1743b0f84d10693d5b318b6 Mon Sep 17 00:00:00 2001 From: ttt161 Date: Sun, 17 May 2026 11:08:47 +0300 Subject: [PATCH 1/4] add trust_level condition --- .env | 4 ++-- apps/hellgate/src/hg_invoice_payment.erl | 12 ++++++++++-- apps/hellgate/src/hg_varset.erl | 6 ++++-- apps/hellgate/test/hg_ct_helper.erl | 3 ++- compose.yaml | 4 ++-- rebar.config | 3 ++- rebar.lock | 16 ++++++++-------- 7 files changed, 30 insertions(+), 18 deletions(-) diff --git a/.env b/.env index 953039f2..f7970193 100644 --- a/.env +++ b/.env @@ -2,6 +2,6 @@ # You SHOULD specify point releases here so that build time and run time Erlang/OTPs # are the same. See: https://github.com/erlware/relx/pull/902 SERVICE_NAME=hellgate -OTP_VERSION=27.3.4 -REBAR_VERSION=3.24 +OTP_VERSION=28.5.0 +REBAR_VERSION=3.26 THRIFT_VERSION=0.14.2.3 diff --git a/apps/hellgate/src/hg_invoice_payment.erl b/apps/hellgate/src/hg_invoice_payment.erl index f8281a66..d4083fa7 100644 --- a/apps/hellgate/src/hg_invoice_payment.erl +++ b/apps/hellgate/src/hg_invoice_payment.erl @@ -605,6 +605,13 @@ reconstruct_payment_flow(?invoice_payment_flow_hold(_OnHoldExpiration, HeldUntil Seconds = hg_datetime:parse_ts(HeldUntil) - hg_datetime:parse_ts(CreatedAt), VS#{flow => {hold, ?hold_lifetime(Seconds)}}. +add_trust_level(#domain_Invoice{client_info = undefined}, VS) -> + VS; +add_trust_level(#domain_Invoice{client_info = #domain_InvoiceClientInfo{trust_level = undefined}}, VS) -> + VS; +add_trust_level(#domain_Invoice{client_info = #domain_InvoiceClientInfo{trust_level = TrustLevel}}, VS) -> + VS#{trust_level => TrustLevel}. + -spec get_predefined_route(payer()) -> {ok, route()} | undefined. get_predefined_route(?payment_resource_payer()) -> undefined; @@ -3129,8 +3136,9 @@ get_varset(St, InitialValue) -> Payment = get_payment(St), Revision = get_payment_revision(St), VS0 = reconstruct_payment_flow(Payment, InitialValue), - VS1 = collect_validation_varset(get_party_config_ref(Opts), get_shop_obj(Opts, Revision), Payment, VS0), - VS1. + VS1 = add_trust_level(get_invoice(Opts), VS0), + VS2 = collect_validation_varset(get_party_config_ref(Opts), get_shop_obj(Opts, Revision), Payment, VS1), + VS2. %% diff --git a/apps/hellgate/src/hg_varset.erl b/apps/hellgate/src/hg_varset.erl index ee98390b..186e10dc 100644 --- a/apps/hellgate/src/hg_varset.erl +++ b/apps/hellgate/src/hg_varset.erl @@ -16,7 +16,8 @@ shop_id => dmsl_base_thrift:'ID'(), risk_score => hg_inspector:risk_score(), flow => instant | {hold, dmsl_domain_thrift:'HoldLifetime'()}, - wallet_id => dmsl_base_thrift:'ID'() + wallet_id => dmsl_base_thrift:'ID'(), + trust_level => dmsl_domain_thrift:'ClientTrustLevel'() }. -spec prepare_varset(varset()) -> dmsl_payproc_thrift:'Varset'(). @@ -28,5 +29,6 @@ prepare_varset(Varset) -> wallet_id = genlib_map:get(wallet_id, Varset), payment_tool = genlib_map:get(payment_tool, Varset), party_ref = genlib_map:get(party_config_ref, Varset), - shop_id = genlib_map:get(shop_id, Varset) + shop_id = genlib_map:get(shop_id, Varset), + trust_level = genlib_map:get(trust_level, Varset) }. diff --git a/apps/hellgate/test/hg_ct_helper.erl b/apps/hellgate/test/hg_ct_helper.erl index b28777c3..37e6b445 100644 --- a/apps/hellgate/test/hg_ct_helper.erl +++ b/apps/hellgate/test/hg_ct_helper.erl @@ -841,7 +841,8 @@ make_invoice_params( due = hg_datetime:format_ts(Due), cost = Cost, context = make_invoice_context(), - allocation = AllocationPrototype + allocation = AllocationPrototype, + client_info = #domain_InvoiceClientInfo{trust_level = unknown} }. -spec make_invoice_params_tpl(invoice_tpl_id()) -> invoice_params_tpl(). diff --git a/compose.yaml b/compose.yaml index cfb1969d..d481d40e 100644 --- a/compose.yaml +++ b/compose.yaml @@ -29,7 +29,7 @@ services: command: /sbin/init dmt: - image: ghcr.io/valitydev/dominant-v2:sha-815385c + image: ghcr.io/valitydev/dominant-v2:sha-72c1f5a-epic-TECH-6-add-trust-level-condition command: /opt/dmt/bin/dmt foreground volumes: - ./test/dmt/sys.config:/opt/dmt/releases/0.1/sys.config @@ -109,7 +109,7 @@ services: retries: 20 party-management: - image: ghcr.io/valitydev/party-management:sha-2296944 + image: ghcr.io/valitydev/party-management:sha-7633755-epic-TECH-6-trust-level-condition command: /opt/party-management/bin/party-management foreground volumes: - ./test/party-management/sys.config:/opt/party-management/releases/0.1/sys.config diff --git a/rebar.config b/rebar.config index f9d463df..372bec18 100644 --- a/rebar.config +++ b/rebar.config @@ -26,12 +26,13 @@ % Common project dependencies. {deps, [ + {cowboy, "2.12.0"}, {recon, "2.5.2"}, {cache, "2.3.3"}, {gproc, "0.9.0"}, {genlib, {git, "https://github.com/valitydev/genlib.git", {tag, "v1.1.0"}}}, {woody, {git, "https://github.com/valitydev/woody_erlang.git", {tag, "v1.1.1"}}}, - {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"}}}, {payproc_errors, {git, "https://github.com/valitydev/payproc-errors-erlang.git", {branch, "master"}}}, {mg_proto, {git, "https://github.com/valitydev/machinegun-proto.git", {branch, "master"}}}, {dmt_client, {git, "https://github.com/valitydev/dmt-client.git", {tag, "v2.0.3"}}}, diff --git a/rebar.lock b/rebar.lock index 4e097bad..34068b3a 100644 --- a/rebar.lock +++ b/rebar.lock @@ -21,13 +21,13 @@ {ref,"5a87a37694e42b6592d3b4164ae54e0e87e24e18"}}, 1}, {<<"chatterbox">>,{pkg,<<"ts_chatterbox">>,<<"0.15.1">>},2}, - {<<"cowboy">>,{pkg,<<"cowboy">>,<<"2.9.0">>},1}, - {<<"cowlib">>,{pkg,<<"cowlib">>,<<"2.11.0">>},2}, + {<<"cowboy">>,{pkg,<<"cowboy">>,<<"2.12.0">>},0}, + {<<"cowlib">>,{pkg,<<"cowlib">>,<<"2.13.0">>},1}, {<<"crc32cer">>,{pkg,<<"crc32cer">>,<<"0.1.11">>},3}, {<<"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", @@ -111,7 +111,7 @@ {<<"prometheus_cowboy">>,{pkg,<<"prometheus_cowboy">>,<<"0.1.9">>},0}, {<<"prometheus_httpd">>,{pkg,<<"prometheus_httpd">>,<<"2.1.15">>},1}, {<<"quantile_estimator">>,{pkg,<<"quantile_estimator">>,<<"0.2.1">>},1}, - {<<"ranch">>,{pkg,<<"ranch">>,<<"1.8.0">>},2}, + {<<"ranch">>,{pkg,<<"ranch">>,<<"1.8.0">>},1}, {<<"recon">>,{pkg,<<"recon">>,<<"2.5.2">>},0}, {<<"scoper">>, {git,"https://github.com/valitydev/scoper.git", @@ -142,8 +142,8 @@ {<<"cache">>, <<"B23A5FE7095445A88412A6E614C933377E0137B44FFED77C9B3FEF1A731A20B2">>}, {<<"certifi">>, <<"D4FB0A6BB20B7C9C3643E22507E42F356AC090A1DCEA9AB99E27E0376D695EBA">>}, {<<"chatterbox">>, <<"5CAC4D15DD7AD61FC3C4415CE4826FC563D4643DEE897A558EC4EA0B1C835C9C">>}, - {<<"cowboy">>, <<"865DD8B6607E14CF03282E10E934023A1BD8BE6F6BACF921A7E2A96D800CD452">>}, - {<<"cowlib">>, <<"0B9FF9C346629256C42EBE1EEB769A83C6CB771A6EE5960BD110AB0B9B872063">>}, + {<<"cowboy">>, <<"F276D521A1FF88B2B9B4C54D0E753DA6C66DD7BE6C9FCA3D9418B561828A3731">>}, + {<<"cowlib">>, <<"DB8F7505D8332D98EF50A3EF34B34C1AFDDEC7506E4EE4DD4A3A266285D282CA">>}, {<<"crc32cer">>, <<"B550DA6D615FEB72A882D15D020F8F7DEE72DFB2CB1BCDF3B1EE8DC2AFD68CFC">>}, {<<"ctx">>, <<"8FF88B70E6400C4DF90142E7F130625B82086077A45364A78D208ED3ED53C7FE">>}, {<<"erlydtl">>, <<"964B2DC84F8C17ACFAA69C59BA129EF26AC45D2BA898C3C6AD9B5BDC8BA13CED">>}, @@ -177,8 +177,8 @@ {<<"cache">>, <<"44516CE6FA03594D3A2AF025DD3A87BFE711000EB730219E1DDEFC816E0AA2F4">>}, {<<"certifi">>, <<"6AC7EFC1C6F8600B08D625292D4BBF584E14847CE1B6B5C44D983D273E1097EA">>}, {<<"chatterbox">>, <<"4F75B91451338BC0DA5F52F3480FA6EF6E3A2AEECFC33686D6B3D0A0948F31AA">>}, - {<<"cowboy">>, <<"2C729F934B4E1AA149AFF882F57C6372C15399A20D54F65C8D67BEF583021BDE">>}, - {<<"cowlib">>, <<"2B3E9DA0B21C4565751A6D4901C20D1B4CC25CBB7FD50D91D2AB6DD287BC86A9">>}, + {<<"cowboy">>, <<"8A7ABE6D183372CEB21CAA2709BEC928AB2B72E18A3911AA1771639BEF82651E">>}, + {<<"cowlib">>, <<"E1E1284DC3FC030A64B1AD0D8382AE7E99DA46C3246B815318A4B848873800A4">>}, {<<"crc32cer">>, <<"A39B8F0B1990AC1BF06C3A247FC6A178B740CDFC33C3B53688DC7DD6B1855942">>}, {<<"ctx">>, <<"A14ED2D1B67723DBEBBE423B28D7615EB0BDCBA6FF28F2D1F1B0A7E1D4AA5FC2">>}, {<<"erlydtl">>, <<"D80EC044CD8F58809C19D29AC5605BE09E955040911B644505E31E9DD8143431">>}, From a94b107193f0bc9749e79ae80ee5bc5e26914ef9 Mon Sep 17 00:00:00 2001 From: ttt161 Date: Sun, 17 May 2026 13:38:37 +0300 Subject: [PATCH 2/4] fix dialyzer --- apps/hellgate/src/hg_invoice_payment.erl | 3 +-- apps/hellgate/src/hg_retry.erl | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/hellgate/src/hg_invoice_payment.erl b/apps/hellgate/src/hg_invoice_payment.erl index d4083fa7..5f139560 100644 --- a/apps/hellgate/src/hg_invoice_payment.erl +++ b/apps/hellgate/src/hg_invoice_payment.erl @@ -205,7 +205,7 @@ -type session_change() :: hg_session:change(). -type callback_response() :: dmsl_proxy_provider_thrift:'CallbackResponse'(). -type make_recurrent() :: true | false. --type retry_strategy() :: hg_retry:strategy(). + -type capture_data() :: dmsl_payproc_thrift:'InvoicePaymentCaptureData'(). -type payment_session() :: dmsl_payproc_thrift:'InvoicePaymentSession'(). -type failure() :: dmsl_domain_thrift:'OperationFailure'(). @@ -2574,7 +2574,6 @@ get_actual_retry_strategy(Target, #st{retry_attempts = Attempts}) -> AttemptNum = maps:get(get_target_type(Target), Attempts, 0), hg_retry:skip_steps(get_initial_retry_strategy(get_target_type(Target)), AttemptNum). --spec get_initial_retry_strategy(session_target_type()) -> retry_strategy(). get_initial_retry_strategy(TargetType) -> PolicyConfig = genlib_app:env(hellgate, payment_retry_policy, #{}), hg_retry:new_strategy(maps:get(TargetType, PolicyConfig, no_retry)). diff --git a/apps/hellgate/src/hg_retry.erl b/apps/hellgate/src/hg_retry.erl index 4058cad9..ccfe696f 100644 --- a/apps/hellgate/src/hg_retry.erl +++ b/apps/hellgate/src/hg_retry.erl @@ -37,7 +37,7 @@ new_strategy({intervals, Array}) -> new_strategy({timecap, Timeout, Policy}) -> genlib_retry:timecap(Timeout, new_strategy(Policy)); new_strategy(no_retry) -> - finish; + genlib_retry:timecap(0, genlib_retry:linear(1, 1)); new_strategy(BadPolicy) -> erlang:error(badarg, [BadPolicy]). From fa9c1ad0ecf527cde19967cd026cd997fc496a4e Mon Sep 17 00:00:00 2001 From: ttt161 Date: Mon, 18 May 2026 11:49:54 +0300 Subject: [PATCH 3/4] 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 372bec18..a72d6f1c 100644 --- a/rebar.config +++ b/rebar.config @@ -32,7 +32,7 @@ {gproc, "0.9.0"}, {genlib, {git, "https://github.com/valitydev/genlib.git", {tag, "v1.1.0"}}}, {woody, {git, "https://github.com/valitydev/woody_erlang.git", {tag, "v1.1.1"}}}, - {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"}}}, {payproc_errors, {git, "https://github.com/valitydev/payproc-errors-erlang.git", {branch, "master"}}}, {mg_proto, {git, "https://github.com/valitydev/machinegun-proto.git", {branch, "master"}}}, {dmt_client, {git, "https://github.com/valitydev/dmt-client.git", {tag, "v2.0.3"}}}, diff --git a/rebar.lock b/rebar.lock index 34068b3a..51bd6080 100644 --- a/rebar.lock +++ b/rebar.lock @@ -27,7 +27,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", From 59892668f7fa36085faf78c749e31919efbfccc7 Mon Sep 17 00:00:00 2001 From: ttt161 Date: Mon, 18 May 2026 11:51:23 +0300 Subject: [PATCH 4/4] bump images for dominant, party-management --- compose.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compose.yaml b/compose.yaml index d481d40e..72297479 100644 --- a/compose.yaml +++ b/compose.yaml @@ -29,7 +29,7 @@ services: command: /sbin/init dmt: - image: ghcr.io/valitydev/dominant-v2:sha-72c1f5a-epic-TECH-6-add-trust-level-condition + image: ghcr.io/valitydev/dominant-v2:sha-c9430b5 command: /opt/dmt/bin/dmt foreground volumes: - ./test/dmt/sys.config:/opt/dmt/releases/0.1/sys.config @@ -109,7 +109,7 @@ services: retries: 20 party-management: - image: ghcr.io/valitydev/party-management:sha-7633755-epic-TECH-6-trust-level-condition + image: ghcr.io/valitydev/party-management:sha-8a58cd5 command: /opt/party-management/bin/party-management foreground volumes: - ./test/party-management/sys.config:/opt/party-management/releases/0.1/sys.config