Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -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
15 changes: 11 additions & 4 deletions apps/hellgate/src/hg_invoice_payment.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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'().
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -2567,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)).
Expand Down Expand Up @@ -3129,8 +3135,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.

%%

Expand Down
2 changes: 1 addition & 1 deletion apps/hellgate/src/hg_retry.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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]).

Expand Down
6 changes: 4 additions & 2 deletions apps/hellgate/src/hg_varset.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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'().
Expand All @@ -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)
}.
3 changes: 2 additions & 1 deletion apps/hellgate/test/hg_ct_helper.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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().
Expand Down
4 changes: 2 additions & 2 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ services:
command: /sbin/init

dmt:
image: ghcr.io/valitydev/dominant-v2:sha-815385c
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
Expand Down Expand Up @@ -109,7 +109,7 @@ services:
retries: 20

party-management:
image: ghcr.io/valitydev/party-management:sha-2296944
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
Expand Down
3 changes: 2 additions & 1 deletion rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -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", {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"}}},
Expand Down
16 changes: 8 additions & 8 deletions rebar.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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,"e7a302a684deba1bb18a00d1056879329219d280"}},
0},
{<<"dmt_client">>,
{git,"https://github.com/valitydev/dmt-client.git",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -142,8 +142,8 @@
{<<"cache">>, <<"B23A5FE7095445A88412A6E614C933377E0137B44FFED77C9B3FEF1A731A20B2">>},
{<<"certifi">>, <<"D4FB0A6BB20B7C9C3643E22507E42F356AC090A1DCEA9AB99E27E0376D695EBA">>},
{<<"chatterbox">>, <<"5CAC4D15DD7AD61FC3C4415CE4826FC563D4643DEE897A558EC4EA0B1C835C9C">>},
{<<"cowboy">>, <<"865DD8B6607E14CF03282E10E934023A1BD8BE6F6BACF921A7E2A96D800CD452">>},
{<<"cowlib">>, <<"0B9FF9C346629256C42EBE1EEB769A83C6CB771A6EE5960BD110AB0B9B872063">>},
{<<"cowboy">>, <<"F276D521A1FF88B2B9B4C54D0E753DA6C66DD7BE6C9FCA3D9418B561828A3731">>},
{<<"cowlib">>, <<"DB8F7505D8332D98EF50A3EF34B34C1AFDDEC7506E4EE4DD4A3A266285D282CA">>},
{<<"crc32cer">>, <<"B550DA6D615FEB72A882D15D020F8F7DEE72DFB2CB1BCDF3B1EE8DC2AFD68CFC">>},
{<<"ctx">>, <<"8FF88B70E6400C4DF90142E7F130625B82086077A45364A78D208ED3ED53C7FE">>},
{<<"erlydtl">>, <<"964B2DC84F8C17ACFAA69C59BA129EF26AC45D2BA898C3C6AD9B5BDC8BA13CED">>},
Expand Down Expand Up @@ -177,8 +177,8 @@
{<<"cache">>, <<"44516CE6FA03594D3A2AF025DD3A87BFE711000EB730219E1DDEFC816E0AA2F4">>},
{<<"certifi">>, <<"6AC7EFC1C6F8600B08D625292D4BBF584E14847CE1B6B5C44D983D273E1097EA">>},
{<<"chatterbox">>, <<"4F75B91451338BC0DA5F52F3480FA6EF6E3A2AEECFC33686D6B3D0A0948F31AA">>},
{<<"cowboy">>, <<"2C729F934B4E1AA149AFF882F57C6372C15399A20D54F65C8D67BEF583021BDE">>},
{<<"cowlib">>, <<"2B3E9DA0B21C4565751A6D4901C20D1B4CC25CBB7FD50D91D2AB6DD287BC86A9">>},
{<<"cowboy">>, <<"8A7ABE6D183372CEB21CAA2709BEC928AB2B72E18A3911AA1771639BEF82651E">>},
{<<"cowlib">>, <<"E1E1284DC3FC030A64B1AD0D8382AE7E99DA46C3246B815318A4B848873800A4">>},
{<<"crc32cer">>, <<"A39B8F0B1990AC1BF06C3A247FC6A178B740CDFC33C3B53688DC7DD6B1855942">>},
{<<"ctx">>, <<"A14ED2D1B67723DBEBBE423B28D7615EB0BDCBA6FF28F2D1F1B0A7E1D4AA5FC2">>},
{<<"erlydtl">>, <<"D80EC044CD8F58809C19D29AC5605BE09E955040911B644505E31E9DD8143431">>},
Expand Down
Loading