From b0cf79aeac6e9d089754414c2a477937d80182d1 Mon Sep 17 00:00:00 2001 From: Aleksey Kashapov Date: Thu, 29 Aug 2024 11:43:18 +0300 Subject: [PATCH] IMP-293: Retires payouts methods and bumps damsel (#86) * IMP-293: Retires payouts methods and bumps damsel * Bumps damsel * Bumps damsel --- .github/workflows/erlang-checks.yml | 2 +- apps/ff_cth/src/ct_payment_system.erl | 4 ---- apps/ff_server/src/ff_server.app.src | 2 ++ apps/ff_server/src/ff_server.erl | 7 +++++++ apps/ff_transfer/src/ff_withdrawal.erl | 1 - apps/ff_transfer/src/ff_withdrawal_routing.erl | 4 ---- apps/fistful/src/ff_varset.erl | 2 -- apps/fistful/src/fistful.app.src | 2 ++ compose.yaml | 2 +- config/sys.config | 14 ++++---------- rebar.config | 4 ---- rebar.lock | 10 +++++----- 12 files changed, 22 insertions(+), 32 deletions(-) diff --git a/.github/workflows/erlang-checks.yml b/.github/workflows/erlang-checks.yml index 69167f1..35c3bd6 100644 --- a/.github/workflows/erlang-checks.yml +++ b/.github/workflows/erlang-checks.yml @@ -29,7 +29,7 @@ jobs: run: name: Run checks needs: setup - uses: valitydev/erlang-workflows/.github/workflows/erlang-parallel-build.yml@v1.0.14 + uses: valitydev/erlang-workflows/.github/workflows/erlang-parallel-build.yml@v1.0.15 with: otp-version: ${{ needs.setup.outputs.otp-version }} rebar-version: ${{ needs.setup.outputs.rebar-version }} diff --git a/apps/ff_cth/src/ct_payment_system.erl b/apps/ff_cth/src/ct_payment_system.erl index 34fca05..b461ff1 100644 --- a/apps/ff_cth/src/ct_payment_system.erl +++ b/apps/ff_cth/src/ct_payment_system.erl @@ -281,7 +281,6 @@ domain_config_add_version(Options) -> wallet = #domain_WalletProvisionTerms{ withdrawals = #domain_WithdrawalProvisionTerms{ currencies = {value, ?ordset([?cur(<<"RUB">>)])}, - payout_methods = {value, ?ordset([])}, cash_limit = {value, ?cashrng( @@ -319,7 +318,6 @@ domain_config(Options) -> wallet = #domain_WalletProvisionTerms{ withdrawals = #domain_WithdrawalProvisionTerms{ currencies = {value, ?ordset([?cur(<<"RUB">>)])}, - payout_methods = {value, ?ordset([])}, cash_limit = {value, ?cashrng( @@ -352,7 +350,6 @@ domain_config(Options) -> wallet = #domain_WalletProvisionTerms{ withdrawals = #domain_WithdrawalProvisionTerms{ currencies = {value, ?ordset([?cur(<<"RUB">>)])}, - payout_methods = {value, ?ordset([])}, cash_limit = {value, ?cashrng( @@ -895,7 +892,6 @@ domain_config(Options) -> wallet = #domain_WalletProvisionTerms{ withdrawals = #domain_WithdrawalProvisionTerms{ currencies = {value, ?ordset([?cur(<<"BTC">>)])}, - payout_methods = {value, ?ordset([])}, cash_limit = {value, ?cashrng( diff --git a/apps/ff_server/src/ff_server.app.src b/apps/ff_server/src/ff_server.app.src index 9cae026..0e05917 100644 --- a/apps/ff_server/src/ff_server.app.src +++ b/apps/ff_server/src/ff_server.app.src @@ -6,6 +6,8 @@ {applications, [ kernel, stdlib, + prometheus, + prometheus_cowboy, woody, erl_health, scoper, diff --git a/apps/ff_server/src/ff_server.erl b/apps/ff_server/src/ff_server.erl index ea7f11f..dd4df2f 100644 --- a/apps/ff_server/src/ff_server.erl +++ b/apps/ff_server/src/ff_server.erl @@ -38,6 +38,7 @@ start() -> -spec start(normal, any()) -> {ok, pid()} | {error, any()}. start(_StartType, _StartArgs) -> + ok = setup_metrics(), supervisor:start_link({local, ?MODULE}, ?MODULE, []). -spec stop(any()) -> ok. @@ -192,3 +193,9 @@ get_namespace_schema('ff/w2w_transfer_v1') -> wrap_handler(Handler, WrapperOpts) -> FullOpts = maps:merge(#{handler => Handler}, WrapperOpts), {ff_woody_wrapper, FullOpts}. + +%% + +setup_metrics() -> + ok = woody_ranch_prometheus_collector:setup(), + ok = woody_hackney_prometheus_collector:setup(). diff --git a/apps/ff_transfer/src/ff_withdrawal.erl b/apps/ff_transfer/src/ff_withdrawal.erl index 3bc16f3..572ccec 100644 --- a/apps/ff_transfer/src/ff_withdrawal.erl +++ b/apps/ff_transfer/src/ff_withdrawal.erl @@ -1237,7 +1237,6 @@ build_party_varset(#{body := Body, wallet_id := WalletID, party_id := PartyID} = cost => ff_dmsl_codec:marshal(cash, Body), party_id => PartyID, wallet_id => WalletID, - payout_method => #domain_PayoutMethodRef{id = wallet_info}, % TODO it's not fair, because it's PAYOUT not PAYMENT tool. payment_tool => PaymentTool, bin_data => ff_dmsl_codec:marshal(bin_data, BinData) diff --git a/apps/ff_transfer/src/ff_withdrawal_routing.erl b/apps/ff_transfer/src/ff_withdrawal_routing.erl index 0bb7697..1a43dc6 100644 --- a/apps/ff_transfer/src/ff_withdrawal_routing.erl +++ b/apps/ff_transfer/src/ff_withdrawal_routing.erl @@ -321,9 +321,6 @@ do_validate_terms(CombinedTerms, PartyVarset, _Route, _RoutingContext) -> allow = Allow, global_allow = GAllow, currencies = CurrenciesSelector, - %% PayoutMethodsSelector is useless for withdrawals - %% so we can just ignore it - %% payout_methods = PayoutMethodsSelector, cash_limit = CashLimitSelector } = CombinedTerms, valid = unwrap(validate_selectors_defined(CombinedTerms)), @@ -339,7 +336,6 @@ do_validate_terms(CombinedTerms, PartyVarset, _Route, _RoutingContext) -> validate_selectors_defined(Terms) -> Selectors = [ Terms#domain_WithdrawalProvisionTerms.currencies, - Terms#domain_WithdrawalProvisionTerms.payout_methods, Terms#domain_WithdrawalProvisionTerms.cash_limit, Terms#domain_WithdrawalProvisionTerms.cash_flow ], diff --git a/apps/fistful/src/ff_varset.erl b/apps/fistful/src/ff_varset.erl index 356fd62..93b541f 100644 --- a/apps/fistful/src/ff_varset.erl +++ b/apps/fistful/src/ff_varset.erl @@ -18,7 +18,6 @@ shop_id => dmsl_domain_thrift:'ShopID'(), risk_score => dmsl_domain_thrift:'RiskScore'(), flow => instant | {hold, dmsl_domain_thrift:'HoldLifetime'()}, - payout_method => dmsl_domain_thrift:'PayoutMethodRef'(), wallet_id => dmsl_domain_thrift:'WalletID'(), identification_level => dmsl_domain_thrift:'ContractorIdentificationLevel'(), bin_data => dmsl_domain_thrift:'BinData'() @@ -46,7 +45,6 @@ encode_contract_terms_varset(Varset) -> currency = genlib_map:get(currency, Varset), amount = genlib_map:get(cost, Varset), shop_id = genlib_map:get(shop_id, Varset), - payout_method = genlib_map:get(payout_method, Varset), payment_tool = genlib_map:get(payment_tool, Varset), wallet_id = genlib_map:get(wallet_id, Varset), bin_data = genlib_map:get(bin_data, Varset) diff --git a/apps/fistful/src/fistful.app.src b/apps/fistful/src/fistful.app.src index 358f03e..0769133 100644 --- a/apps/fistful/src/fistful.app.src +++ b/apps/fistful/src/fistful.app.src @@ -6,6 +6,8 @@ kernel, stdlib, genlib, + prometheus, + prometheus_cowboy, ff_core, snowflake, machinery, diff --git a/compose.yaml b/compose.yaml index 04d4162..eb2e87c 100644 --- a/compose.yaml +++ b/compose.yaml @@ -40,7 +40,7 @@ services: retries: 10 machinegun: - image: ghcr.io/valitydev/mg2:sha-436f723 + image: ghcr.io/valitydev/mg2:sha-8bbcd29 command: /opt/machinegun/bin/machinegun foreground volumes: - ./test/machinegun/config.yaml:/opt/machinegun/etc/config.yaml diff --git a/config/sys.config b/config/sys.config index 9143e43..eecb8cf 100644 --- a/config/sys.config +++ b/config/sys.config @@ -135,21 +135,15 @@ }} ]}, - {how_are_you, [ - {metrics_publishers, [ - % {hay_statsd_publisher, #{ - % key_prefix => <<"fistful-server.">>, - % host => "localhost", - % port => 8125 - % }} - ]} - ]}, - {snowflake, [ % {machine_id, 42} ]}, {prometheus, [ {collectors, [default]} + ]}, + + {hackney, [ + {mod_metrics, woody_hackney_prometheus} ]} ]. diff --git a/rebar.config b/rebar.config index 1e952f5..1bbcd15 100644 --- a/rebar.config +++ b/rebar.config @@ -81,8 +81,6 @@ {profiles, [ {prod, [ {deps, [ - {how_are_you, {git, "https://github.com/valitydev/how_are_you.git", {ref, "2fd80134"}}}, - {woody_api_hay, {git, "https://github.com/valitydev/woody_api_hay.git", {ref, "4c39134cd"}}}, % Introspect a node running in production {recon, "2.5.2"}, {logger_logstash_formatter, @@ -101,8 +99,6 @@ {logger_logstash_formatter, load}, prometheus, prometheus_cowboy, - woody_api_hay, - how_are_you, sasl, ff_server ]}, diff --git a/rebar.lock b/rebar.lock index 0da9a9f..cc0f31a 100644 --- a/rebar.lock +++ b/rebar.lock @@ -25,15 +25,15 @@ {<<"ctx">>,{pkg,<<"ctx">>,<<"0.6.0">>},2}, {<<"damsel">>, {git,"https://github.com/valitydev/damsel.git", - {ref,"3a25a01f89423e1fc7dbabc8a3f777647b659f45"}}, + {ref,"8e034bc74b1f4ed0e00dd63d0c3ca9c922be1c47"}}, 0}, {<<"dmt_client">>, {git,"https://github.com/valitydev/dmt_client.git", - {ref,"b8bc0281dbf1e55a1a67ef6da861e0353ff14913"}}, + {ref,"d8a4f490d49c038d96f1cbc2a279164c6f4039f9"}}, 0}, {<<"dmt_core">>, {git,"https://github.com/valitydev/dmt-core.git", - {ref,"75841332fe0b40a77da0c12ea8d5dbb994da8e82"}}, + {ref,"19d8f57198f2cbe5b64aa4a923ba32774e505503"}}, 1}, {<<"erl_health">>, {git,"https://github.com/valitydev/erlang-health.git", @@ -82,7 +82,7 @@ {<<"parse_trans">>,{pkg,<<"parse_trans">>,<<"3.3.1">>},2}, {<<"party_client">>, {git,"https://github.com/valitydev/party-client-erlang.git", - {ref,"38c7782286877a63087c19de49f26ab175a37de7"}}, + {ref,"a82682b6f55f41ff4962b2666bbd12cb5f1ece25"}}, 0}, {<<"prometheus">>,{pkg,<<"prometheus">>,<<"4.8.1">>},0}, {<<"prometheus_cowboy">>,{pkg,<<"prometheus_cowboy">>,<<"0.1.8">>},0}, @@ -120,7 +120,7 @@ 0}, {<<"woody">>, {git,"https://github.com/valitydev/woody_erlang.git", - {ref,"81219ba5408e1c67f5eaed3c7e566ede42da88d4"}}, + {ref,"072825ee7179825a4078feb0649df71303c74157"}}, 0}]}. [ {pkg_hash,[