upgrade: +image +deps +endpoints (#535)

This commit is contained in:
dinama 2021-01-31 17:39:04 +03:00 committed by GitHub
parent 5bbb1afcf8
commit c4eb9b4138
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
53 changed files with 590 additions and 599 deletions

2
Jenkinsfile vendored
View File

@ -18,5 +18,5 @@ build('hellgate', 'docker-host', finalHook) {
pipeErlangService = load("${env.JENKINS_LIB}/pipeErlangService.groovy") pipeErlangService = load("${env.JENKINS_LIB}/pipeErlangService.groovy")
} }
pipeErlangService.runPipe(true,false) pipeErlangService.runPipe(true, true, 'test')
} }

View File

@ -14,11 +14,11 @@ SERVICE_IMAGE_PUSH_TAG ?= $(SERVICE_IMAGE_TAG)
# Base image for the service # Base image for the service
BASE_IMAGE_NAME := service-erlang BASE_IMAGE_NAME := service-erlang
BASE_IMAGE_TAG := 54a794b4875ad79f90dba0a7708190b3b37d584f BASE_IMAGE_TAG := 51bd5f25d00cbf75616e2d672601dfe7351dcaa4
# Build image tag to be used # Build image tag to be used
BUILD_IMAGE_NAME := build-erlang BUILD_IMAGE_NAME := build-erlang
BUILD_IMAGE_TAG := 12beabfb5b6968c7566fa3d872ad1b3e8d612f46 BUILD_IMAGE_TAG := 61a001bbb48128895735a3ac35b0858484fdb2eb
CALL_ANYWHERE := all submodules rebar-update compile xref lint dialyze plt_update \ CALL_ANYWHERE := all submodules rebar-update compile xref lint dialyze plt_update \
release clean distclean format check_format release clean distclean format check_format
@ -49,7 +49,7 @@ xref: submodules
$(REBAR) xref $(REBAR) xref
lint: lint:
elvis rock elvis rock -V
check_format: check_format:
$(REBAR) fmt -c $(REBAR) fmt -c
@ -58,7 +58,7 @@ format:
$(REBAR) fmt -w $(REBAR) fmt -w
dialyze: submodules dialyze: submodules
$(REBAR) dialyzer $(REBAR) as test dialyzer
plt_update: plt_update:
$(REBAR) dialyzer -u true -s false $(REBAR) dialyzer -u true -s false

View File

@ -24,10 +24,10 @@
%% not exported from calendar module %% not exported from calendar module
-type rfc3339_time_unit() :: -type rfc3339_time_unit() ::
microsecond | microsecond
millisecond | | millisecond
nanosecond | | nanosecond
second. | second.
-export_type([timestamp/0]). -export_type([timestamp/0]).

View File

@ -46,8 +46,8 @@
-type id() :: binary() | atom() | number(). -type id() :: binary() | atom() | number().
-type fd_service_type() :: -type fd_service_type() ::
adapter_availability | adapter_availability
provider_conversion. | provider_conversion.
%% API %% API

View File

@ -66,10 +66,10 @@
-type invoice_change() :: dmsl_payment_processing_thrift:'InvoiceChange'(). -type invoice_change() :: dmsl_payment_processing_thrift:'InvoiceChange'().
-type activity() :: -type activity() ::
invoice | invoice
{payment, payment_id()} | | {payment, payment_id()}
{adjustment_new, adjustment_id()} | | {adjustment_new, adjustment_id()}
{adjustment_pending, adjustment_id()}. | {adjustment_pending, adjustment_id()}.
-type adjustment_id() :: dmsl_domain_thrift:'InvoiceAdjustmentID'(). -type adjustment_id() :: dmsl_domain_thrift:'InvoiceAdjustmentID'().
@ -1652,9 +1652,10 @@ create_dummy_refund_with_id(ID) ->
party_revision = 42, party_revision = 42,
status = ?refund_pending(), status = ?refund_pending(),
reason = <<"No reason">>, reason = <<"No reason">>,
cash = 1000, cash = ?cash(1000, <<"RUB">>),
cart = unefined cart = undefined
} },
sessions = []
}. }.
-spec construct_refund_id_test() -> _. -spec construct_refund_id_test() -> _.

View File

@ -170,8 +170,8 @@ build_log_param(_Key, _Value) ->
-spec get_log_message(EventType) -> string() when -spec get_log_message(EventType) -> string() when
EventType :: EventType ::
invoice_adjustment_created | invoice_adjustment_created
invoice_adjustment_status_changed. | invoice_adjustment_status_changed.
get_log_message(invoice_adjustment_created) -> get_log_message(invoice_adjustment_created) ->
"Invoice adjustment created"; "Invoice adjustment created";
get_log_message(invoice_adjustment_status_changed) -> get_log_message(invoice_adjustment_status_changed) ->

View File

@ -92,41 +92,41 @@
-export_type([payment/0]). -export_type([payment/0]).
-type activity() :: -type activity() ::
payment_activity() | payment_activity()
refund_activity() | | refund_activity()
adjustment_activity() | | adjustment_activity()
chargeback_activity() | | chargeback_activity()
idle. | idle.
-type payment_activity() :: {payment, payment_step()}. -type payment_activity() :: {payment, payment_step()}.
-type refund_activity() :: -type refund_activity() ::
{refund_new, refund_id()} | {refund_new, refund_id()}
{refund_session, refund_id()} | | {refund_session, refund_id()}
{refund_failure, refund_id()} | | {refund_failure, refund_id()}
{refund_accounter, refund_id()}. | {refund_accounter, refund_id()}.
-type adjustment_activity() :: -type adjustment_activity() ::
{adjustment_new, adjustment_id()} | {adjustment_new, adjustment_id()}
{adjustment_pending, adjustment_id()}. | {adjustment_pending, adjustment_id()}.
-type chargeback_activity() :: {chargeback, chargeback_id(), chargeback_activity_type()}. -type chargeback_activity() :: {chargeback, chargeback_id(), chargeback_activity_type()}.
-type chargeback_activity_type() :: hg_invoice_payment_chargeback:activity(). -type chargeback_activity_type() :: hg_invoice_payment_chargeback:activity().
-type payment_step() :: -type payment_step() ::
new | new
risk_scoring | | risk_scoring
routing | | routing
cash_flow_building | | cash_flow_building
processing_session | | processing_session
processing_accounter | | processing_accounter
processing_capture | | processing_capture
processing_failure | | processing_failure
updating_accounter | | updating_accounter
flow_waiting | | flow_waiting
finalizing_session | | finalizing_session
finalizing_accounter. | finalizing_accounter.
-record(st, { -record(st, {
activity :: activity(), activity :: activity(),

View File

@ -139,10 +139,10 @@
hg_machine_action:t(). hg_machine_action:t().
-type activity() :: -type activity() ::
preparing_initial_cash_flow | preparing_initial_cash_flow
updating_chargeback | | updating_chargeback
updating_cash_flow | | updating_cash_flow
finalising_accounter. | finalising_accounter.
-spec get(state()) -> chargeback(). -spec get(state()) -> chargeback().
get(#chargeback_st{chargeback = Chargeback}) -> get(#chargeback_st{chargeback = Chargeback}) ->

View File

@ -18,14 +18,14 @@
%% user types %% user types
-type action_type() :: -type action_type() ::
fail_pre_processing | fail_pre_processing
skip_inspector | | skip_inspector
fail_session. | fail_session.
-type scenario_result() :: -type scenario_result() ::
hg_invoice_payment:machine_result() | hg_invoice_payment:machine_result()
proxy_result() | | proxy_result()
risk_score(). | risk_score().
%% exported types %% exported types

View File

@ -267,9 +267,9 @@ handle_function_('ProcessCall', {Args}, #{ns := Ns} = _Opts) ->
-spec dispatch_signal(ns(), Signal, machine()) -> Result when -spec dispatch_signal(ns(), Signal, machine()) -> Result when
Signal :: Signal ::
mg_proto_state_processing_thrift:'InitSignal'() | mg_proto_state_processing_thrift:'InitSignal'()
mg_proto_state_processing_thrift:'TimeoutSignal'() | | mg_proto_state_processing_thrift:'TimeoutSignal'()
mg_proto_state_processing_thrift:'RepairSignal'(), | mg_proto_state_processing_thrift:'RepairSignal'(),
Result :: Result ::
mg_proto_state_processing_thrift:'SignalResult'(). mg_proto_state_processing_thrift:'SignalResult'().
dispatch_signal(Ns, #mg_stateproc_InitSignal{arg = Payload}, Machine) -> dispatch_signal(Ns, #mg_stateproc_InitSignal{arg = Payload}, Machine) ->

View File

@ -16,14 +16,14 @@
-type value() :: term(). -type value() :: term().
-type msgpack_value() :: -type msgpack_value() ::
undefined | undefined
boolean() | | boolean()
list() | | list()
map() | | map()
binary() | | binary()
{bin, binary()} | | {bin, binary()}
integer() | | integer()
float(). | float().
%% %%

View File

@ -19,9 +19,9 @@
-type callback() :: dmsl_proxy_provider_thrift:'Callback'(). -type callback() :: dmsl_proxy_provider_thrift:'Callback'().
-type callback_response() :: dmsl_proxy_provider_thrift:'CallbackResponse'(). -type callback_response() :: dmsl_proxy_provider_thrift:'CallbackResponse'().
-type callback_name() :: -type callback_name() ::
'ProcessPaymentCallback' | 'ProcessPaymentCallback'
'ProcessRecurrentTokenCallback' | | 'ProcessRecurrentTokenCallback'
'GetPayment'. | 'GetPayment'.
-spec handle_function(callback_name(), {tag()} | {tag(), callback()}, hg_woody_wrapper:handler_opts()) -> -spec handle_function(callback_name(), {tag()} | {tag(), callback()}, hg_woody_wrapper:handler_opts()) ->
term() | no_return(). term() | no_return().

View File

@ -8,12 +8,12 @@
-type retries_num() :: pos_integer() | infinity. -type retries_num() :: pos_integer() | infinity.
-type policy_spec() :: -type policy_spec() ::
{linear, retries_num() | {max_total_timeout, pos_integer()}, pos_integer()} | {linear, retries_num() | {max_total_timeout, pos_integer()}, pos_integer()}
{exponential, retries_num() | {max_total_timeout, pos_integer()}, number(), pos_integer()} | | {exponential, retries_num() | {max_total_timeout, pos_integer()}, number(), pos_integer()}
{exponential, retries_num() | {max_total_timeout, pos_integer()}, number(), pos_integer(), timeout()} | | {exponential, retries_num() | {max_total_timeout, pos_integer()}, number(), pos_integer(), timeout()}
{intervals, [pos_integer(), ...]} | | {intervals, [pos_integer(), ...]}
{timecap, timeout(), policy_spec()} | | {timecap, timeout(), policy_spec()}
no_retry. | no_retry.
-type strategy() :: genlib_retry:strategy(). -type strategy() :: genlib_retry:strategy().

View File

@ -25,9 +25,9 @@
-include("domain.hrl"). -include("domain.hrl").
-type terms() :: -type terms() ::
dmsl_domain_thrift:'PaymentsProvisionTerms'() | dmsl_domain_thrift:'PaymentsProvisionTerms'()
dmsl_domain_thrift:'RecurrentPaytoolsProvisionTerms'() | | dmsl_domain_thrift:'RecurrentPaytoolsProvisionTerms'()
undefined. | undefined.
-type payment_institution() :: dmsl_domain_thrift:'PaymentInstitution'(). -type payment_institution() :: dmsl_domain_thrift:'PaymentInstitution'().
-type route() :: dmsl_domain_thrift:'PaymentRoute'(). -type route() :: dmsl_domain_thrift:'PaymentRoute'().
@ -105,7 +105,7 @@
payment_tool => dmsl_domain_thrift:'PaymentTool'(), payment_tool => dmsl_domain_thrift:'PaymentTool'(),
party_id => dmsl_domain_thrift:'PartyID'(), party_id => dmsl_domain_thrift:'PartyID'(),
shop_id => dmsl_domain_thrift:'ShopID'(), shop_id => dmsl_domain_thrift:'ShopID'(),
risk_score := dmsl_domain_thrift:'RiskScore'(), risk_score => dmsl_domain_thrift:'RiskScore'(),
flow => instant | {hold, dmsl_domain_thrift:'HoldLifetime'()}, flow => instant | {hold, dmsl_domain_thrift:'HoldLifetime'()},
payout_method => dmsl_domain_thrift:'PayoutMethodRef'(), payout_method => dmsl_domain_thrift:'PayoutMethodRef'(),
wallet_id => dmsl_domain_thrift:'WalletID'(), wallet_id => dmsl_domain_thrift:'WalletID'(),
@ -149,8 +149,8 @@ gather_fail_rates(Routes) ->
score_routes_with_fault_detector(Routes). score_routes_with_fault_detector(Routes).
-spec choose_route([fail_rated_route()], reject_context(), risk_score() | undefined) -> -spec choose_route([fail_rated_route()], reject_context(), risk_score() | undefined) ->
{ok, route(), route_choice_meta()} | {ok, route(), route_choice_meta()}
{error, {no_route_found, {risk_score_is_too_high | unknown, reject_context()}}}. | {error, {no_route_found, {risk_score_is_too_high | unknown, reject_context()}}}.
choose_route(FailRatedRoutes, RejectContext, RiskScore) -> choose_route(FailRatedRoutes, RejectContext, RiskScore) ->
case check_risk_score(RiskScore) of case check_risk_score(RiskScore) of
ok -> ok ->
@ -198,7 +198,7 @@ select_providers(Predestination, PaymentInstitution, VS, Revision, RejectContext
varset(), varset(),
hg_domain:revision(), hg_domain:revision(),
reject_context() reject_context()
) -> {[route()], reject_context()}. ) -> {[non_fail_rated_route()], reject_context()}.
select_routes(Predestination, Providers, VS, Revision, RejectContext) -> select_routes(Predestination, Providers, VS, Revision, RejectContext) ->
{Accepted, Rejected} = lists:foldl( {Accepted, Rejected} = lists:foldl(
fun(Provider, {AcceptedTerminals, RejectedRoutes}) -> fun(Provider, {AcceptedTerminals, RejectedRoutes}) ->
@ -211,8 +211,8 @@ select_routes(Predestination, Providers, VS, Revision, RejectContext) ->
{Accepted, RejectContext#{rejected_routes => Rejected}}. {Accepted, RejectContext#{rejected_routes => Rejected}}.
-spec do_choose_route([fail_rated_route()], reject_context()) -> -spec do_choose_route([fail_rated_route()], reject_context()) ->
{ok, route(), route_choice_meta()} | {ok, route(), route_choice_meta()}
{error, {no_route_found, {unknown, reject_context()}}}. | {error, {no_route_found, {unknown, reject_context()}}}.
do_choose_route([] = _Routes, RejectContext) -> do_choose_route([] = _Routes, RejectContext) ->
{error, {no_route_found, {unknown, RejectContext}}}; {error, {no_route_found, {unknown, RejectContext}}};
do_choose_route(Routes, _RejectContext) -> do_choose_route(Routes, _RejectContext) ->
@ -853,9 +853,7 @@ unmarshal(_, Other) ->
-spec test() -> _. -spec test() -> _.
-type testcase() :: {_, fun()}. -spec record_comparsion_test() -> _.
-spec record_comparsion_test() -> [testcase()].
record_comparsion_test() -> record_comparsion_test() ->
Bigger = Bigger =
{#route_scores{ {#route_scores{
@ -879,7 +877,7 @@ record_comparsion_test() ->
{99, 99}}, {99, 99}},
Bigger = select_better_route(Bigger, Smaller). Bigger = select_better_route(Bigger, Smaller).
-spec balance_routes_test() -> [testcase()]. -spec balance_routes_test() -> list().
balance_routes_test() -> balance_routes_test() ->
WithWeight = [ WithWeight = [
{1, {test, test, {test, 1}}, test}, {1, {test, test, {test, 1}}, test},
@ -915,7 +913,7 @@ balance_routes_test() ->
?assertEqual(Result3, lists:reverse(calc_random_condition(0.0, 4.0, WithWeight, []))) ?assertEqual(Result3, lists:reverse(calc_random_condition(0.0, 4.0, WithWeight, [])))
]. ].
-spec balance_routes_without_weight_test() -> [testcase()]. -spec balance_routes_without_weight_test() -> list().
balance_routes_without_weight_test() -> balance_routes_without_weight_test() ->
Routes = [ Routes = [
{1, {test, test, {test, undefined}}, test}, {1, {test, test, {test, undefined}}, test},

View File

@ -15,7 +15,7 @@
-spec gather_routes( -spec gather_routes(
route_predestination(), route_predestination(),
payment_institution(), payment_institution(),
pm_selector:varset(), hg_routing:varset(),
hg_domain:revision() hg_domain:revision()
) -> {[non_fail_rated_route()], reject_context()}. ) -> {[non_fail_rated_route()], reject_context()}.
gather_routes(_, #domain_PaymentInstitution{payment_routing_rules = undefined} = PayInst, VS, _) -> gather_routes(_, #domain_PaymentInstitution{payment_routing_rules = undefined} = PayInst, VS, _) ->

View File

@ -11,14 +11,14 @@
-type value() :: term(). -type value() :: term().
-type msgpack_value() :: -type msgpack_value() ::
undefined | undefined
boolean() | | boolean()
list() | | list()
map() | | map()
binary() | | binary()
{bin, binary()} | | {bin, binary()}
integer() | | integer()
float(). | float().
-spec marshal(msgpack_value()) -> mg_proto_msgpack_thrift:'Value'(). -spec marshal(msgpack_value()) -> mg_proto_msgpack_thrift:'Value'().
marshal(undefined) -> marshal(undefined) ->

View File

@ -5,6 +5,7 @@
-define(ordset(Es), ordsets:from_list(Es)). -define(ordset(Es), ordsets:from_list(Es)).
-define(match(Term), erlang:binary_to_term(erlang:term_to_binary(Term))).
-define(glob(), #domain_GlobalsRef{}). -define(glob(), #domain_GlobalsRef{}).
-define(cur(ID), #domain_CurrencyRef{symbolic_code = ID}). -define(cur(ID), #domain_CurrencyRef{symbolic_code = ID}).
-define(pmt(C, T), #domain_PaymentMethodRef{id = {C, T}}). -define(pmt(C, T), #domain_PaymentMethodRef{id = {C, T}}).

View File

@ -145,7 +145,7 @@ construct_inspector(Ref, Name, ProxyRef) ->
construct_inspector(Ref, Name, ProxyRef, Additional) -> construct_inspector(Ref, Name, ProxyRef, Additional) ->
construct_inspector(Ref, Name, ProxyRef, Additional, undefined). construct_inspector(Ref, Name, ProxyRef, Additional, undefined).
-spec construct_inspector(inspector(), name(), proxy(), Additional :: map(), risk_score()) -> -spec construct_inspector(inspector(), name(), proxy(), Additional :: map(), undefined | risk_score()) ->
{inspector, dmsl_domain_thrift:'InspectorObject'()}. {inspector, dmsl_domain_thrift:'InspectorObject'()}.
construct_inspector(Ref, Name, ProxyRef, Additional, FallBackScore) -> construct_inspector(Ref, Name, ProxyRef, Additional, FallBackScore) ->
{inspector, #domain_InspectorObject{ {inspector, #domain_InspectorObject{
@ -218,12 +218,12 @@ construct_system_account_set(Ref, Name, ?cur(CurrencyCode)) ->
}}. }}.
-spec construct_external_account_set(external_account_set()) -> -spec construct_external_account_set(external_account_set()) ->
{system_account_set, dmsl_domain_thrift:'ExternalAccountSetObject'()}. {external_account_set, dmsl_domain_thrift:'ExternalAccountSetObject'()}.
construct_external_account_set(Ref) -> construct_external_account_set(Ref) ->
construct_external_account_set(Ref, <<"Primaries">>, ?cur(<<"RUB">>)). construct_external_account_set(Ref, <<"Primaries">>, ?cur(<<"RUB">>)).
-spec construct_external_account_set(external_account_set(), name(), currency()) -> -spec construct_external_account_set(external_account_set(), name(), currency()) ->
{system_account_set, dmsl_domain_thrift:'ExternalAccountSetObject'()}. {external_account_set, dmsl_domain_thrift:'ExternalAccountSetObject'()}.
construct_external_account_set(Ref, Name, ?cur(CurrencyCode)) -> construct_external_account_set(Ref, Name, ?cur(CurrencyCode)) ->
ok = hg_context:save(hg_context:create()), ok = hg_context:save(hg_context:create()),
AccountID1 = hg_accounting:create_account(CurrencyCode), AccountID1 = hg_accounting:create_account(CurrencyCode),
@ -266,8 +266,7 @@ construct_business_schedule(Ref) ->
construct_dummy_additional_info() -> construct_dummy_additional_info() ->
#domain_AdditionalTransactionInfo{rrn = <<"rrn">>, approval_code = <<"code">>}. #domain_AdditionalTransactionInfo{rrn = <<"rrn">>, approval_code = <<"code">>}.
-spec construct_payment_routing_ruleset(payment_routing_ruleset(), name(), _) -> -spec construct_payment_routing_ruleset(payment_routing_ruleset(), name(), _) -> dmsl_domain_thrift:'DomainObject'().
dmsl_domain_thrift:'RoutingRulesetObject'().
construct_payment_routing_ruleset(Ref, Name, Decisions) -> construct_payment_routing_ruleset(Ref, Name, Decisions) ->
{routing_rules, #domain_RoutingRulesObject{ {routing_rules, #domain_RoutingRulesObject{
ref = Ref, ref = Ref,

View File

@ -79,7 +79,7 @@
-type app_name() :: atom(). -type app_name() :: atom().
-spec start_app(app_name()) -> [app_name()]. -spec start_app(app_name()) -> {[app_name()], map()}.
start_app(scoper = AppName) -> start_app(scoper = AppName) ->
{start_app(AppName, [ {start_app(AppName, [
{storage, scoper_storage_logger} {storage, scoper_storage_logger}
@ -268,7 +268,7 @@ start_app(snowflake = AppName) ->
start_app(AppName) -> start_app(AppName) ->
{genlib_app:start_application(AppName), #{}}. {genlib_app:start_application(AppName), #{}}.
-spec start_app(app_name(), list()) -> [app_name()]. -spec start_app(app_name(), term()) -> [app_name()].
start_app(cowboy = AppName, Env) -> start_app(cowboy = AppName, Env) ->
#{ #{
listener_ref := Ref, listener_ref := Ref,
@ -276,12 +276,12 @@ start_app(cowboy = AppName, Env) ->
transport_opts := TransOpt, transport_opts := TransOpt,
proto_opts := ProtoOpt proto_opts := ProtoOpt
} = Env, } = Env,
cowboy:start_clear(Ref, [{num_acceptors, Count} | TransOpt], ProtoOpt), _ = cowboy:start_clear(Ref, [{num_acceptors, Count} | TransOpt], ProtoOpt),
[AppName]; [AppName];
start_app(AppName, Env) -> start_app(AppName, Env) ->
genlib_app:start_application_with(AppName, Env). genlib_app:start_application_with(AppName, Env).
-spec start_apps([app_name() | {app_name(), list()}]) -> [app_name()]. -spec start_apps([app_name() | {app_name(), term()}]) -> {[app_name()], map()}.
start_apps(Apps) -> start_apps(Apps) ->
lists:foldl( lists:foldl(
fun fun
@ -335,7 +335,6 @@ make_user_identity(UserID) ->
-type contract_id() :: dmsl_domain_thrift:'ContractID'(). -type contract_id() :: dmsl_domain_thrift:'ContractID'().
-type contract_tpl() :: dmsl_domain_thrift:'ContractTemplateRef'(). -type contract_tpl() :: dmsl_domain_thrift:'ContractTemplateRef'().
-type shop_id() :: dmsl_domain_thrift:'ShopID'(). -type shop_id() :: dmsl_domain_thrift:'ShopID'().
-type cost() :: integer() | {integer(), binary()}.
-type category() :: dmsl_domain_thrift:'CategoryRef'(). -type category() :: dmsl_domain_thrift:'CategoryRef'().
-type cash() :: dmsl_domain_thrift:'Cash'(). -type cash() :: dmsl_domain_thrift:'Cash'().
-type invoice_tpl_id() :: dmsl_domain_thrift:'InvoiceTemplateID'(). -type invoice_tpl_id() :: dmsl_domain_thrift:'InvoiceTemplateID'().
@ -346,7 +345,7 @@ make_user_identity(UserID) ->
-type lifetime_interval() :: dmsl_domain_thrift:'LifetimeInterval'(). -type lifetime_interval() :: dmsl_domain_thrift:'LifetimeInterval'().
-type invoice_details() :: dmsl_domain_thrift:'InvoiceDetails'(). -type invoice_details() :: dmsl_domain_thrift:'InvoiceDetails'().
-type invoice_tpl_details() :: dmsl_domain_thrift:'InvoiceTemplateDetails'(). -type invoice_tpl_details() :: dmsl_domain_thrift:'InvoiceTemplateDetails'().
-type invoice_tpl_cost() :: dmsl_domain_thrift:'InvoiceTemplateCost'(). -type invoice_tpl_cost() :: dmsl_domain_thrift:'InvoiceTemplateProductPrice'().
-type currency() :: dmsl_domain_thrift:'CurrencySymbolicCode'(). -type currency() :: dmsl_domain_thrift:'CurrencySymbolicCode'().
-type invoice_tpl_create_params() :: dmsl_payment_processing_thrift:'InvoiceTemplateCreateParams'(). -type invoice_tpl_create_params() :: dmsl_payment_processing_thrift:'InvoiceTemplateCreateParams'().
-type invoice_tpl_update_params() :: dmsl_payment_processing_thrift:'InvoiceTemplateUpdateParams'(). -type invoice_tpl_update_params() :: dmsl_payment_processing_thrift:'InvoiceTemplateUpdateParams'().
@ -502,7 +501,7 @@ make_battle_ready_contract_params(TemplateRef, PaymentInstitutionRef) ->
payment_institution = PaymentInstitutionRef payment_institution = PaymentInstitutionRef
}. }.
-spec make_battle_ready_contractor() -> dmsl_payment_processing_thrift:'Contractor'(). -spec make_battle_ready_contractor() -> dmsl_domain_thrift:'Contractor'().
make_battle_ready_contractor() -> make_battle_ready_contractor() ->
BankAccount = #domain_RussianBankAccount{ BankAccount = #domain_RussianBankAccount{
account = <<"4276300010908312893">>, account = <<"4276300010908312893">>,
@ -540,20 +539,18 @@ make_battle_ready_payout_tool_params() ->
make_userinfo(PartyID) -> make_userinfo(PartyID) ->
#payproc_UserInfo{id = PartyID, type = {external_user, #payproc_ExternalUser{}}}. #payproc_UserInfo{id = PartyID, type = {external_user, #payproc_ExternalUser{}}}.
-spec make_invoice_params(party_id(), shop_id(), binary(), cost()) -> invoice_params(). -spec make_invoice_params(party_id(), shop_id(), binary(), cash()) -> invoice_params().
make_invoice_params(PartyID, ShopID, Product, Cost) -> make_invoice_params(PartyID, ShopID, Product, Cost) ->
make_invoice_params(PartyID, ShopID, Product, make_due_date(), Cost). make_invoice_params(PartyID, ShopID, Product, make_due_date(), Cost).
-spec make_invoice_params(party_id(), shop_id(), binary(), timestamp(), cost()) -> invoice_params(). -spec make_invoice_params(party_id(), shop_id(), binary(), timestamp(), cash()) -> invoice_params().
make_invoice_params(PartyID, ShopID, Product, Due, Amount) when is_integer(Amount) -> make_invoice_params(PartyID, ShopID, Product, Due, Cost) ->
make_invoice_params(PartyID, ShopID, Product, Due, {Amount, <<"RUB">>});
make_invoice_params(PartyID, ShopID, Product, Due, {Amount, Currency}) ->
#payproc_InvoiceParams{ #payproc_InvoiceParams{
party_id = PartyID, party_id = PartyID,
shop_id = ShopID, shop_id = ShopID,
details = make_invoice_details(Product), details = make_invoice_details(Product),
due = hg_datetime:format_ts(Due), due = hg_datetime:format_ts(Due),
cost = make_cash(Amount, Currency), cost = Cost,
context = make_invoice_context() context = make_invoice_context()
}. }.
@ -561,11 +558,11 @@ make_invoice_params(PartyID, ShopID, Product, Due, {Amount, Currency}) ->
make_invoice_params_tpl(TplID) -> make_invoice_params_tpl(TplID) ->
make_invoice_params_tpl(TplID, undefined). make_invoice_params_tpl(TplID, undefined).
-spec make_invoice_params_tpl(invoice_tpl_id(), cost()) -> invoice_params_tpl(). -spec make_invoice_params_tpl(invoice_tpl_id(), undefined | cash()) -> invoice_params_tpl().
make_invoice_params_tpl(TplID, Cost) -> make_invoice_params_tpl(TplID, Cost) ->
make_invoice_params_tpl(TplID, Cost, undefined). make_invoice_params_tpl(TplID, Cost, undefined).
-spec make_invoice_params_tpl(invoice_tpl_id(), cost(), context()) -> invoice_params_tpl(). -spec make_invoice_params_tpl(invoice_tpl_id(), undefined | cash(), undefined | context()) -> invoice_params_tpl().
make_invoice_params_tpl(TplID, Cost, Context) -> make_invoice_params_tpl(TplID, Cost, Context) ->
#payproc_InvoiceWithTemplateParams{ #payproc_InvoiceWithTemplateParams{
template_id = TplID, template_id = TplID,
@ -596,7 +593,7 @@ make_invoice_tpl_create_params(PartyID, ShopID, Lifetime, Product, Details, Cont
context = Context context = Context
}. }.
-spec make_invoice_tpl_details(binary(), cost()) -> invoice_tpl_details(). -spec make_invoice_tpl_details(binary(), invoice_tpl_cost()) -> invoice_tpl_details().
make_invoice_tpl_details(Product, Price) -> make_invoice_tpl_details(Product, Price) ->
{product, #domain_InvoiceTemplateProduct{ {product, #domain_InvoiceTemplateProduct{
product = Product, product = Product,
@ -654,7 +651,7 @@ make_invoice_tpl_cost(range, {LowerType, LowerAm, LowerCur}, {UpperType, UpperAm
make_invoice_tpl_cost(unlim, _, _) -> make_invoice_tpl_cost(unlim, _, _) ->
{unlim, #domain_InvoiceTemplateCostUnlimited{}}. {unlim, #domain_InvoiceTemplateCostUnlimited{}}.
-spec make_cash(non_neg_integer(), currency()) -> cash(). -spec make_cash(integer(), currency()) -> cash().
make_cash(Amount, Currency) -> make_cash(Amount, Currency) ->
#domain_Cash{ #domain_Cash{
amount = Amount, amount = Amount,
@ -679,15 +676,15 @@ make_invoice_context(Data) ->
make_shop_details(Name) -> make_shop_details(Name) ->
make_shop_details(Name, undefined). make_shop_details(Name, undefined).
-spec make_shop_details(binary(), binary()) -> dmsl_domain_thrift:'ShopDetails'(). -spec make_shop_details(binary(), undefined | binary()) -> dmsl_domain_thrift:'ShopDetails'().
make_shop_details(Name, Description) -> make_shop_details(Name, Description) ->
#domain_ShopDetails{ #domain_ShopDetails{
name = Name, name = Name,
description = Description description = Description
}. }.
-spec make_disposable_payment_resource({dmsl_domain_thrift:'PaymentTool'(), dmsl_domain_thrift:'SessionID'()}) -> -spec make_disposable_payment_resource({dmsl_domain_thrift:'PaymentTool'(), dmsl_domain_thrift:'PaymentSessionID'()}) ->
hg_domain_thrift:'DisposablePaymentResource'(). dmsl_domain_thrift:'DisposablePaymentResource'().
make_disposable_payment_resource({PaymentTool, SessionID}) -> make_disposable_payment_resource({PaymentTool, SessionID}) ->
#domain_DisposablePaymentResource{ #domain_DisposablePaymentResource{
payment_tool = PaymentTool, payment_tool = PaymentTool,
@ -724,7 +721,7 @@ make_customer_params(PartyID, ShopID, EMail) ->
metadata = ?null() metadata = ?null()
}. }.
-spec make_customer_binding_params({dmsl_domain_thrift:'PaymentTool'(), dmsl_domain_thrift:'SessionID'()}) -> -spec make_customer_binding_params({dmsl_domain_thrift:'PaymentTool'(), dmsl_domain_thrift:'PaymentSessionID'()}) ->
dmsl_payment_processing_thrift:'CustomerBindingParams'(). dmsl_payment_processing_thrift:'CustomerBindingParams'().
make_customer_binding_params(PaymentToolSession) -> make_customer_binding_params(PaymentToolSession) ->
#payproc_CustomerBindingParams{ #payproc_CustomerBindingParams{

View File

@ -98,7 +98,7 @@ end_per_suite(C) ->
ok = hg_domain:cleanup(), ok = hg_domain:cleanup(),
[application:stop(App) || App <- cfg(apps, C)]. [application:stop(App) || App <- cfg(apps, C)].
-spec all() -> [test_case_name()]. -spec all() -> [{group, test_case_name()}].
all() -> all() ->
[ [
{group, invalid_customer_params}, {group, invalid_customer_params},
@ -150,7 +150,7 @@ init_per_testcase(Name, C) ->
| C | C
]. ].
-spec end_per_testcase(test_case_name(), config()) -> config(). -spec end_per_testcase(test_case_name(), config()) -> _.
end_per_testcase(_Name, _C) -> end_per_testcase(_Name, _C) ->
ok. ok.
@ -445,8 +445,8 @@ start_two_bindings(C) ->
?customer_created(_, _, _, _, _, _) ?customer_created(_, _, _, _, _, _)
] = next_event(CustomerID, Client), ] = next_event(CustomerID, Client),
StartChanges = [ StartChanges = [
?customer_binding_changed(CustomerBindingID1, ?customer_binding_started(CustomerBinding1, '_')), ?customer_binding_changed(CustomerBindingID1, ?customer_binding_started(CustomerBinding1, ?match('_'))),
?customer_binding_changed(CustomerBindingID2, ?customer_binding_started(CustomerBinding2, '_')), ?customer_binding_changed(CustomerBindingID2, ?customer_binding_started(CustomerBinding2, ?match('_'))),
?customer_binding_changed(CustomerBindingID2, ?customer_binding_status_changed(?customer_binding_succeeded())), ?customer_binding_changed(CustomerBindingID2, ?customer_binding_status_changed(?customer_binding_succeeded())),
?customer_binding_changed(CustomerBindingID1, ?customer_binding_status_changed(?customer_binding_succeeded())), ?customer_binding_changed(CustomerBindingID1, ?customer_binding_status_changed(?customer_binding_succeeded())),
?customer_status_changed(?customer_ready()) ?customer_status_changed(?customer_ready())
@ -473,10 +473,10 @@ start_two_bindings_w_tds(C) ->
?customer_created(_, _, _, _, _, _) ?customer_created(_, _, _, _, _, _)
] = next_event(CustomerID, Client), ] = next_event(CustomerID, Client),
StartChanges = [ StartChanges = [
?customer_binding_changed(CustomerBindingID1, ?customer_binding_started(CustomerBinding1, '_')), ?customer_binding_changed(CustomerBindingID1, ?customer_binding_started(CustomerBinding1, ?match('_'))),
?customer_binding_changed(CustomerBindingID1, ?customer_binding_interaction_requested('_')), ?customer_binding_changed(CustomerBindingID1, ?customer_binding_interaction_requested(?match('_'))),
?customer_binding_changed(CustomerBindingID2, ?customer_binding_started(CustomerBinding2, '_')), ?customer_binding_changed(CustomerBindingID2, ?customer_binding_started(CustomerBinding2, ?match('_'))),
?customer_binding_changed(CustomerBindingID2, ?customer_binding_interaction_requested('_')) ?customer_binding_changed(CustomerBindingID2, ?customer_binding_interaction_requested(?match('_')))
], ],
[ [
?customer_binding_changed(CustomerBindingID1, ?customer_binding_started(CustomerBinding1, _)), ?customer_binding_changed(CustomerBindingID1, ?customer_binding_started(CustomerBinding1, _)),

View File

@ -71,7 +71,7 @@ init([]) ->
%% Common tests callbacks %% Common tests callbacks
-spec all() -> [test_case_name()]. -spec all() -> [{group, test_case_name()}].
all() -> all() ->
[ [
{group, basic_operations}, {group, basic_operations},
@ -386,7 +386,8 @@ start_invoice(Product, Due, Amount, C) ->
start_invoice(ShopID, Product, Due, Amount, C) -> start_invoice(ShopID, Product, Due, Amount, C) ->
Client = cfg(client, C), Client = cfg(client, C),
PartyID = cfg(party_id, C), PartyID = cfg(party_id, C),
InvoiceParams = make_invoice_params(PartyID, ShopID, Product, Due, Amount), Cash = hg_ct_helper:make_cash(Amount, <<"RUB">>),
InvoiceParams = hg_ct_helper:make_invoice_params(PartyID, ShopID, Product, Due, Cash),
InvoiceID = create_invoice(InvoiceParams, Client), InvoiceID = create_invoice(InvoiceParams, Client),
_Events = await_events(InvoiceID, [?evp(?invoice_created(?invoice_w_status(?invoice_unpaid())))], Client), _Events = await_events(InvoiceID, [?evp(?invoice_created(?invoice_w_status(?invoice_unpaid())))], Client),
InvoiceID. InvoiceID.
@ -399,9 +400,6 @@ start_payment(InvoiceID, PaymentParams, Client) ->
{error, Exception} {error, Exception}
end. end.
make_invoice_params(PartyID, ShopID, Product, Due, Cost) ->
hg_ct_helper:make_invoice_params(PartyID, ShopID, Product, Due, Cost).
create_invoice(InvoiceParams, Client) -> create_invoice(InvoiceParams, Client) ->
?invoice_state(?invoice(InvoiceID)) = hg_client_invoicing:create(InvoiceParams, Client), ?invoice_state(?invoice(InvoiceID)) = hg_client_invoicing:create(InvoiceParams, Client),
InvoiceID. InvoiceID.

View File

@ -65,7 +65,7 @@
get_service_spec() -> get_service_spec() ->
{"/test/proxy/provider/dummy", {dmsl_proxy_provider_thrift, 'ProviderProxy'}}. {"/test/proxy/provider/dummy", {dmsl_proxy_provider_thrift, 'ProviderProxy'}}.
-spec get_http_cowboy_spec() -> #{}. -spec get_http_cowboy_spec() -> map().
get_http_cowboy_spec() -> get_http_cowboy_spec() ->
Dispatch = cowboy_router:compile([{'_', [{"/", ?MODULE, []}]}]), Dispatch = cowboy_router:compile([{'_', [{"/", ?MODULE, []}]}]),
#{ #{
@ -587,8 +587,9 @@ get_payment_tool_scenario({'mobile_commerce', #domain_MobileCommerce{operator =
mobile_commerce. mobile_commerce.
-spec make_payment_tool(PaymenToolCode) -> PaymenTool when -spec make_payment_tool(PaymenToolCode) -> PaymenTool when
PaymenToolCode :: atom() | {temporary_unavailability, failure_scenario()}, PaymenToolCode ::
PaymenTool :: {hg_domain_thrift:'PaymentTool'(), hg_domain_thrift:'PaymentSessionID'()}. atom() | {scenario, failure_scenario()} | {preauth_3ds, integer()} | {preauth_3ds_sleep, integer()},
PaymenTool :: {dmsl_domain_thrift:'PaymentTool'(), dmsl_domain_thrift:'PaymentSessionID'()}.
make_payment_tool(no_preauth) -> make_payment_tool(no_preauth) ->
make_simple_payment_tool(<<"no_preauth">>, visa); make_simple_payment_tool(<<"no_preauth">>, visa);
make_payment_tool(no_preauth_mc) -> make_payment_tool(no_preauth_mc) ->

View File

@ -36,7 +36,7 @@ all() ->
{group, history} {group, history}
]. ].
-spec groups() -> [{group_name(), [test_case_name()]}]. -spec groups() -> [{group_name(), list(), [test_case_name()]}].
groups() -> groups() ->
[ [
{initial, [], [events_observed]}, {initial, [], [events_observed]},
@ -72,7 +72,7 @@ init_per_testcase(_Name, C) ->
create_api(RootUrl, PartyID) -> create_api(RootUrl, PartyID) ->
hg_ct_helper:create_client(RootUrl, PartyID). hg_ct_helper:create_client(RootUrl, PartyID).
-spec end_per_testcase(test_case_name(), config()) -> config(). -spec end_per_testcase(test_case_name(), config()) -> _.
end_per_testcase(_Name, _C) -> end_per_testcase(_Name, _C) ->
ok. ok.

View File

@ -115,7 +115,7 @@ init_per_suite(C) ->
-spec end_per_suite(config()) -> _. -spec end_per_suite(config()) -> _.
end_per_suite(C) -> end_per_suite(C) ->
ok = hg_domain:cleanup(), ok = hg_domain:cleanup(),
[application:stop(App) || App <- cfg(apps, C)], _ = [application:stop(App) || App <- cfg(apps, C)],
exit(cfg(test_sup, C), shutdown). exit(cfg(test_sup, C), shutdown).
-spec init_per_testcase(test_case_name(), config()) -> config(). -spec init_per_testcase(test_case_name(), config()) -> config().
@ -129,7 +129,7 @@ init_per_testcase(C) ->
ok = hg_context:save(hg_context:create()), ok = hg_context:save(hg_context:create()),
[{client, Client}, {client_tpl, ClientTpl} | C]. [{client, Client}, {client_tpl, ClientTpl} | C].
-spec end_per_testcase(test_case_name(), config()) -> config(). -spec end_per_testcase(test_case_name(), config()) -> _.
end_per_testcase(_Name, _C) -> end_per_testcase(_Name, _C) ->
ok = hg_context:cleanup(). ok = hg_context:cleanup().
@ -154,7 +154,7 @@ invoice_adjustment_capture(C) ->
Client = cfg(client, C), Client = cfg(client, C),
ShopID = cfg(shop_id, C), ShopID = cfg(shop_id, C),
PartyID = cfg(party_id, C), PartyID = cfg(party_id, C),
InvoiceParams = make_invoice_params(PartyID, ShopID, <<"rubberduck">>, make_due_date(10), 10000), InvoiceParams = make_invoice_params(PartyID, ShopID, <<"rubberduck">>, make_due_date(10), make_cash(10000)),
InvoiceID = create_invoice(InvoiceParams, Client), InvoiceID = create_invoice(InvoiceParams, Client),
[?invoice_created(_Invoice)] = next_event(InvoiceID, Client), [?invoice_created(_Invoice)] = next_event(InvoiceID, Client),
PaymentID = process_payment(InvoiceID, make_payment_params(), Client), PaymentID = process_payment(InvoiceID, make_payment_params(), Client),
@ -183,7 +183,7 @@ invoice_adjustment_cancel(C) ->
Client = cfg(client, C), Client = cfg(client, C),
ShopID = cfg(shop_id, C), ShopID = cfg(shop_id, C),
PartyID = cfg(party_id, C), PartyID = cfg(party_id, C),
InvoiceParams = make_invoice_params(PartyID, ShopID, <<"rubberduck">>, 10000), InvoiceParams = make_invoice_params(PartyID, ShopID, <<"rubberduck">>, make_cash(10000)),
InvoiceID = create_invoice(InvoiceParams, Client), InvoiceID = create_invoice(InvoiceParams, Client),
[?invoice_created(_)] = next_event(InvoiceID, Client), [?invoice_created(_)] = next_event(InvoiceID, Client),
PaymentID = process_payment(InvoiceID, make_payment_params(), Client), PaymentID = process_payment(InvoiceID, make_payment_params(), Client),
@ -213,7 +213,7 @@ invoice_adjustment_invalid_invoice_status(C) ->
Client = cfg(client, C), Client = cfg(client, C),
ShopID = cfg(shop_id, C), ShopID = cfg(shop_id, C),
PartyID = cfg(party_id, C), PartyID = cfg(party_id, C),
InvoiceParams = make_invoice_params(PartyID, ShopID, <<"rubberduck">>, 10000), InvoiceParams = make_invoice_params(PartyID, ShopID, <<"rubberduck">>, make_cash(10000)),
InvoiceID = create_invoice(InvoiceParams, Client), InvoiceID = create_invoice(InvoiceParams, Client),
[?invoice_created(_)] = next_event(InvoiceID, Client), [?invoice_created(_)] = next_event(InvoiceID, Client),
PaymentID = process_payment(InvoiceID, make_payment_params(), Client), PaymentID = process_payment(InvoiceID, make_payment_params(), Client),
@ -234,7 +234,7 @@ invoice_adjustment_existing_invoice_status(C) ->
Client = cfg(client, C), Client = cfg(client, C),
ShopID = cfg(shop_id, C), ShopID = cfg(shop_id, C),
PartyID = cfg(party_id, C), PartyID = cfg(party_id, C),
InvoiceParams = make_invoice_params(PartyID, ShopID, <<"rubberduck">>, 10000), InvoiceParams = make_invoice_params(PartyID, ShopID, <<"rubberduck">>, make_cash(10000)),
InvoiceID = create_invoice(InvoiceParams, Client), InvoiceID = create_invoice(InvoiceParams, Client),
[?invoice_created(_)] = next_event(InvoiceID, Client), [?invoice_created(_)] = next_event(InvoiceID, Client),
PaymentID = process_payment(InvoiceID, make_payment_params(), Client), PaymentID = process_payment(InvoiceID, make_payment_params(), Client),
@ -255,7 +255,7 @@ invoice_adjustment_invalid_adjustment_status(C) ->
Client = cfg(client, C), Client = cfg(client, C),
ShopID = cfg(shop_id, C), ShopID = cfg(shop_id, C),
PartyID = cfg(party_id, C), PartyID = cfg(party_id, C),
InvoiceParams = make_invoice_params(PartyID, ShopID, <<"rubberduck">>, 10000), InvoiceParams = make_invoice_params(PartyID, ShopID, <<"rubberduck">>, make_cash(10000)),
InvoiceID = create_invoice(InvoiceParams, Client), InvoiceID = create_invoice(InvoiceParams, Client),
[?invoice_created(_)] = next_event(InvoiceID, Client), [?invoice_created(_)] = next_event(InvoiceID, Client),
PaymentID = process_payment(InvoiceID, make_payment_params(), Client), PaymentID = process_payment(InvoiceID, make_payment_params(), Client),
@ -286,7 +286,7 @@ invoice_adjustment_payment_pending(C) ->
Client = cfg(client, C), Client = cfg(client, C),
ShopID = cfg(shop_id, C), ShopID = cfg(shop_id, C),
PartyID = cfg(party_id, C), PartyID = cfg(party_id, C),
InvoiceParams = make_invoice_params(PartyID, ShopID, <<"rubberduck">>, make_due_date(10), 10000), InvoiceParams = make_invoice_params(PartyID, ShopID, <<"rubberduck">>, make_due_date(10), make_cash(10000)),
InvoiceID = create_invoice(InvoiceParams, Client), InvoiceID = create_invoice(InvoiceParams, Client),
[?invoice_created(_)] = next_event(InvoiceID, Client), [?invoice_created(_)] = next_event(InvoiceID, Client),
PaymentID = start_payment(InvoiceID, make_tds_payment_params(), Client), PaymentID = start_payment(InvoiceID, make_tds_payment_params(), Client),
@ -311,7 +311,7 @@ invoice_adjustment_pending_blocks_payment(C) ->
Client = cfg(client, C), Client = cfg(client, C),
ShopID = cfg(shop_id, C), ShopID = cfg(shop_id, C),
PartyID = cfg(party_id, C), PartyID = cfg(party_id, C),
InvoiceParams = make_invoice_params(PartyID, ShopID, <<"rubberduck">>, 10000), InvoiceParams = make_invoice_params(PartyID, ShopID, <<"rubberduck">>, make_cash(10000)),
InvoiceID = create_invoice(InvoiceParams, Client), InvoiceID = create_invoice(InvoiceParams, Client),
[?invoice_created(_Invoice)] = next_event(InvoiceID, Client), [?invoice_created(_Invoice)] = next_event(InvoiceID, Client),
PaymentParams = make_payment_params({hold, capture}), PaymentParams = make_payment_params({hold, capture}),
@ -341,7 +341,7 @@ invoice_adjustment_pending_no_invoice_expiration(C) ->
Client = cfg(client, C), Client = cfg(client, C),
ShopID = cfg(shop_id, C), ShopID = cfg(shop_id, C),
PartyID = cfg(party_id, C), PartyID = cfg(party_id, C),
InvoiceParams = make_invoice_params(PartyID, ShopID, <<"rubberduck">>, make_due_date(5), 10000), InvoiceParams = make_invoice_params(PartyID, ShopID, <<"rubberduck">>, make_due_date(5), make_cash(10000)),
InvoiceID = create_invoice(InvoiceParams, Client), InvoiceID = create_invoice(InvoiceParams, Client),
[?invoice_created(_)] = next_event(InvoiceID, Client), [?invoice_created(_)] = next_event(InvoiceID, Client),
Paid = {paid, #domain_InvoicePaid{}}, Paid = {paid, #domain_InvoicePaid{}},
@ -362,7 +362,7 @@ invoice_adjustment_invoice_expiration_after_capture(C) ->
Client = cfg(client, C), Client = cfg(client, C),
ShopID = cfg(shop_id, C), ShopID = cfg(shop_id, C),
PartyID = cfg(party_id, C), PartyID = cfg(party_id, C),
InvoiceParams = make_invoice_params(PartyID, ShopID, <<"rubberduck">>, make_due_date(10), 10000), InvoiceParams = make_invoice_params(PartyID, ShopID, <<"rubberduck">>, make_due_date(10), make_cash(10000)),
InvoiceID = create_invoice(InvoiceParams, Client), InvoiceID = create_invoice(InvoiceParams, Client),
[?invoice_created(_)] = next_event(InvoiceID, Client), [?invoice_created(_)] = next_event(InvoiceID, Client),
Context = #'Content'{ Context = #'Content'{
@ -769,6 +769,9 @@ construct_proxy(ID, Url, Options) ->
} }
}}. }}.
make_cash(Amount) ->
hg_ct_helper:make_cash(Amount, <<"RUB">>).
make_invoice_params(PartyID, ShopID, Product, Cost) -> make_invoice_params(PartyID, ShopID, Product, Cost) ->
hg_ct_helper:make_invoice_params(PartyID, ShopID, Product, Cost). hg_ct_helper:make_invoice_params(PartyID, ShopID, Product, Cost).
@ -964,6 +967,8 @@ await_payment_process_interaction(InvoiceID, PaymentID, Client) ->
] = Events1, ] = Events1,
UserInteraction. UserInteraction.
-dialyzer({no_match, await_sessions_restarts/5}).
await_sessions_restarts(PaymentID, _Target, _InvoiceID, _Client, 0) -> await_sessions_restarts(PaymentID, _Target, _InvoiceID, _Client, 0) ->
PaymentID; PaymentID;
await_sessions_restarts(PaymentID, ?refunded() = Target, InvoiceID, Client, Restarts) when Restarts > 0 -> await_sessions_restarts(PaymentID, ?refunded() = Target, InvoiceID, Client, Restarts) when Restarts > 0 ->

View File

@ -109,11 +109,11 @@ init_per_testcase(_Name, C) ->
Client = hg_client_invoice_templating:start_link(hg_ct_helper:create_client(RootUrl, PartyID)), Client = hg_client_invoice_templating:start_link(hg_ct_helper:create_client(RootUrl, PartyID)),
[{client, Client} | C]. [{client, Client} | C].
-spec end_per_testcase(test_case_name(), config()) -> config(). -spec end_per_testcase(test_case_name(), config()) -> _.
end_per_testcase(_Name, _C) -> end_per_testcase(_Name, _C) ->
ok. ok.
-spec create_invalid_party(config()) -> _ | no_return(). -spec create_invalid_party(config()) -> _.
create_invalid_party(C) -> create_invalid_party(C) ->
Client = cfg(client, C), Client = cfg(client, C),
ShopID = cfg(shop_id, C), ShopID = cfg(shop_id, C),
@ -121,7 +121,7 @@ create_invalid_party(C) ->
Params = make_invoice_tpl_create_params(PartyID, ShopID), Params = make_invoice_tpl_create_params(PartyID, ShopID),
{exception, #payproc_InvalidUser{}} = hg_client_invoice_templating:create(Params, Client). {exception, #payproc_InvalidUser{}} = hg_client_invoice_templating:create(Params, Client).
-spec create_invalid_shop(config()) -> _ | no_return(). -spec create_invalid_shop(config()) -> _.
create_invalid_shop(C) -> create_invalid_shop(C) ->
Client = cfg(client, C), Client = cfg(client, C),
ShopID = ?MISSING_SHOP_ID, ShopID = ?MISSING_SHOP_ID,
@ -129,7 +129,7 @@ create_invalid_shop(C) ->
Params = make_invoice_tpl_create_params(PartyID, ShopID), Params = make_invoice_tpl_create_params(PartyID, ShopID),
{exception, #payproc_ShopNotFound{}} = hg_client_invoice_templating:create(Params, Client). {exception, #payproc_ShopNotFound{}} = hg_client_invoice_templating:create(Params, Client).
-spec create_invalid_party_status(config()) -> _ | no_return(). -spec create_invalid_party_status(config()) -> _.
create_invalid_party_status(C) -> create_invalid_party_status(C) ->
PartyClient = cfg(party_client, C), PartyClient = cfg(party_client, C),
@ -145,7 +145,7 @@ create_invalid_party_status(C) ->
}} = create_invoice_tpl(C), }} = create_invoice_tpl(C),
ok = hg_client_party:unblock(<<"UNBLOOOCK">>, PartyClient). ok = hg_client_party:unblock(<<"UNBLOOOCK">>, PartyClient).
-spec create_invalid_shop_status(config()) -> _ | no_return(). -spec create_invalid_shop_status(config()) -> _.
create_invalid_shop_status(C) -> create_invalid_shop_status(C) ->
PartyClient = cfg(party_client, C), PartyClient = cfg(party_client, C),
ShopID = cfg(shop_id, C), ShopID = cfg(shop_id, C),
@ -162,34 +162,34 @@ create_invalid_shop_status(C) ->
}} = create_invoice_tpl(C), }} = create_invoice_tpl(C),
ok = hg_client_party:unblock_shop(ShopID, <<"UNBLOOOCK">>, PartyClient). ok = hg_client_party:unblock_shop(ShopID, <<"UNBLOOOCK">>, PartyClient).
-spec create_invalid_cost_fixed_amount(config()) -> _ | no_return(). -spec create_invalid_cost_fixed_amount(config()) -> _.
create_invalid_cost_fixed_amount(C) -> create_invalid_cost_fixed_amount(C) ->
Cost = make_cost(fixed, -100, <<"RUB">>), Cost = make_cost(fixed, -100, <<"RUB">>),
create_invalid_cost(Cost, amount, C). ok = create_invalid_cost(Cost, amount, C).
-spec create_invalid_cost_fixed_currency(config()) -> _ | no_return(). -spec create_invalid_cost_fixed_currency(config()) -> _.
create_invalid_cost_fixed_currency(C) -> create_invalid_cost_fixed_currency(C) ->
Cost = make_cost(fixed, 100, <<"KEK">>), Cost = make_cost(fixed, 100, <<"KEK">>),
create_invalid_cost(Cost, currency, C). ok = create_invalid_cost(Cost, currency, C).
-spec create_invalid_cost_range(config()) -> _ | no_return(). -spec create_invalid_cost_range(config()) -> _.
create_invalid_cost_range(C) -> create_invalid_cost_range(C) ->
Cost1 = make_cost(range, {exclusive, 100, <<"RUB">>}, {exclusive, 100, <<"RUB">>}), Cost1 = make_cost(range, {exclusive, 100, <<"RUB">>}, {exclusive, 100, <<"RUB">>}),
create_invalid_cost(Cost1, <<"Invalid cost range">>, C), ok = create_invalid_cost(Cost1, <<"Invalid cost range">>, C),
Cost2 = make_cost(range, {inclusive, 10000, <<"RUB">>}, {inclusive, 100, <<"RUB">>}), Cost2 = make_cost(range, {inclusive, 10000, <<"RUB">>}, {inclusive, 100, <<"RUB">>}),
create_invalid_cost(Cost2, <<"Invalid cost range">>, C), ok = create_invalid_cost(Cost2, <<"Invalid cost range">>, C),
Cost3 = make_cost(range, {inclusive, 100, <<"RUB">>}, {inclusive, 10000, <<"KEK">>}), Cost3 = make_cost(range, {inclusive, 100, <<"RUB">>}, {inclusive, 10000, <<"KEK">>}),
create_invalid_cost(Cost3, <<"Invalid cost range">>, C), ok = create_invalid_cost(Cost3, <<"Invalid cost range">>, C),
Cost4 = make_cost(range, {inclusive, 100, <<"KEK">>}, {inclusive, 10000, <<"KEK">>}), Cost4 = make_cost(range, {inclusive, 100, <<"KEK">>}, {inclusive, 10000, <<"KEK">>}),
create_invalid_cost(Cost4, currency, C), ok = create_invalid_cost(Cost4, currency, C),
Cost5 = make_cost(range, {inclusive, -100, <<"RUB">>}, {inclusive, 100, <<"RUB">>}), Cost5 = make_cost(range, {inclusive, -100, <<"RUB">>}, {inclusive, 100, <<"RUB">>}),
create_invalid_cost(Cost5, amount, C). ok = create_invalid_cost(Cost5, amount, C).
-spec create_invoice_template(config()) -> _ | no_return(). -spec create_invoice_template(config()) -> _.
create_invoice_template(C) -> create_invoice_template(C) ->
ok = create_cost(make_cost(unlim, sale, "50%"), C), ok = create_cost(make_cost(unlim, sale, "50%"), C),
ok = create_cost(make_cost(fixed, 42, <<"RUB">>), C), ok = create_cost(make_cost(fixed, 42, <<"RUB">>), C),
@ -207,7 +207,7 @@ create_cost(Cost, C) ->
} = create_invoice_tpl(C, Product, Lifetime, Cost), } = create_invoice_tpl(C, Product, Lifetime, Cost),
ok. ok.
-spec get_invoice_template_anyhow(config()) -> _ | no_return(). -spec get_invoice_template_anyhow(config()) -> _.
get_invoice_template_anyhow(C) -> get_invoice_template_anyhow(C) ->
Client = cfg(client, C), Client = cfg(client, C),
PartyClient = cfg(party_client, C), PartyClient = cfg(party_client, C),
@ -231,7 +231,7 @@ get_invoice_template_anyhow(C) ->
ok = hg_client_party:unblock_shop(ShopID, <<"UNBLOOOCK">>, PartyClient), ok = hg_client_party:unblock_shop(ShopID, <<"UNBLOOOCK">>, PartyClient),
InvoiceTpl = hg_client_invoice_templating:get(TplID, Client). InvoiceTpl = hg_client_invoice_templating:get(TplID, Client).
-spec update_invalid_party_status(config()) -> _ | no_return(). -spec update_invalid_party_status(config()) -> _.
update_invalid_party_status(C) -> update_invalid_party_status(C) ->
Client = cfg(client, C), Client = cfg(client, C),
PartyClient = cfg(party_client, C), PartyClient = cfg(party_client, C),
@ -251,7 +251,7 @@ update_invalid_party_status(C) ->
}} = hg_client_invoice_templating:update(TplID, Diff, Client), }} = hg_client_invoice_templating:update(TplID, Diff, Client),
ok = hg_client_party:unblock(<<"UNBLOOOCK">>, PartyClient). ok = hg_client_party:unblock(<<"UNBLOOOCK">>, PartyClient).
-spec update_invalid_shop_status(config()) -> _ | no_return(). -spec update_invalid_shop_status(config()) -> _.
update_invalid_shop_status(C) -> update_invalid_shop_status(C) ->
Client = cfg(client, C), Client = cfg(client, C),
PartyClient = cfg(party_client, C), PartyClient = cfg(party_client, C),
@ -272,41 +272,41 @@ update_invalid_shop_status(C) ->
}} = hg_client_invoice_templating:update(TplID, Diff, Client), }} = hg_client_invoice_templating:update(TplID, Diff, Client),
ok = hg_client_party:unblock_shop(ShopID, <<"UNBLOOOCK">>, PartyClient). ok = hg_client_party:unblock_shop(ShopID, <<"UNBLOOOCK">>, PartyClient).
-spec update_invalid_cost_fixed_amount(config()) -> _ | no_return(). -spec update_invalid_cost_fixed_amount(config()) -> _.
update_invalid_cost_fixed_amount(C) -> update_invalid_cost_fixed_amount(C) ->
Client = cfg(client, C), Client = cfg(client, C),
?invoice_tpl(TplID) = create_invoice_tpl(C), ?invoice_tpl(TplID) = create_invoice_tpl(C),
Cost = make_cost(fixed, -100, <<"RUB">>), Cost = make_cost(fixed, -100, <<"RUB">>),
update_invalid_cost(Cost, amount, TplID, Client). update_invalid_cost(Cost, amount, TplID, Client).
-spec update_invalid_cost_fixed_currency(config()) -> _ | no_return(). -spec update_invalid_cost_fixed_currency(config()) -> _.
update_invalid_cost_fixed_currency(C) -> update_invalid_cost_fixed_currency(C) ->
Client = cfg(client, C), Client = cfg(client, C),
?invoice_tpl(TplID) = create_invoice_tpl(C), ?invoice_tpl(TplID) = create_invoice_tpl(C),
Cost = make_cost(fixed, 100, <<"KEK">>), Cost = make_cost(fixed, 100, <<"KEK">>),
update_invalid_cost(Cost, currency, TplID, Client). update_invalid_cost(Cost, currency, TplID, Client).
-spec update_invalid_cost_range(config()) -> _ | no_return(). -spec update_invalid_cost_range(config()) -> _.
update_invalid_cost_range(C) -> update_invalid_cost_range(C) ->
Client = cfg(client, C), Client = cfg(client, C),
?invoice_tpl(TplID) = create_invoice_tpl(C), ?invoice_tpl(TplID) = create_invoice_tpl(C),
Cost1 = make_cost(range, {exclusive, 100, <<"RUB">>}, {exclusive, 100, <<"RUB">>}), Cost1 = make_cost(range, {exclusive, 100, <<"RUB">>}, {exclusive, 100, <<"RUB">>}),
update_invalid_cost(Cost1, <<"Invalid cost range">>, TplID, Client), ok = update_invalid_cost(Cost1, <<"Invalid cost range">>, TplID, Client),
Cost2 = make_cost(range, {inclusive, 10000, <<"RUB">>}, {inclusive, 100, <<"RUB">>}), Cost2 = make_cost(range, {inclusive, 10000, <<"RUB">>}, {inclusive, 100, <<"RUB">>}),
update_invalid_cost(Cost2, <<"Invalid cost range">>, TplID, Client), ok = update_invalid_cost(Cost2, <<"Invalid cost range">>, TplID, Client),
Cost3 = make_cost(range, {inclusive, 100, <<"RUB">>}, {inclusive, 10000, <<"KEK">>}), Cost3 = make_cost(range, {inclusive, 100, <<"RUB">>}, {inclusive, 10000, <<"KEK">>}),
update_invalid_cost(Cost3, <<"Invalid cost range">>, TplID, Client), ok = update_invalid_cost(Cost3, <<"Invalid cost range">>, TplID, Client),
Cost4 = make_cost(range, {inclusive, 100, <<"KEK">>}, {inclusive, 10000, <<"KEK">>}), Cost4 = make_cost(range, {inclusive, 100, <<"KEK">>}, {inclusive, 10000, <<"KEK">>}),
update_invalid_cost(Cost4, currency, TplID, Client), ok = update_invalid_cost(Cost4, currency, TplID, Client),
Cost5 = make_cost(range, {inclusive, -100, <<"RUB">>}, {inclusive, 100, <<"RUB">>}), Cost5 = make_cost(range, {inclusive, -100, <<"RUB">>}, {inclusive, 100, <<"RUB">>}),
update_invalid_cost(Cost5, amount, TplID, Client). ok = update_invalid_cost(Cost5, amount, TplID, Client).
-spec update_invoice_template(config()) -> _ | no_return(). -spec update_invoice_template(config()) -> _.
update_invoice_template(C) -> update_invoice_template(C) ->
Client = cfg(client, C), Client = cfg(client, C),
PartyID = cfg(party_id, C), PartyID = cfg(party_id, C),
@ -345,7 +345,7 @@ update_cost(Cost, Tpl, Client) ->
Client Client
). ).
-spec update_with_cart(config()) -> _ | no_return(). -spec update_with_cart(config()) -> _.
update_with_cart(C) -> update_with_cart(C) ->
Client = cfg(client, C), Client = cfg(client, C),
PartyID = cfg(party_id, C), PartyID = cfg(party_id, C),
@ -379,7 +379,7 @@ update_with_cart(C) ->
} = hg_client_invoice_templating:update(TplID, Diff, Client), } = hg_client_invoice_templating:update(TplID, Diff, Client),
#domain_InvoiceTemplate{} = hg_client_invoice_templating:get(TplID, Client). #domain_InvoiceTemplate{} = hg_client_invoice_templating:get(TplID, Client).
-spec delete_invalid_party_status(config()) -> _ | no_return(). -spec delete_invalid_party_status(config()) -> _.
delete_invalid_party_status(C) -> delete_invalid_party_status(C) ->
Client = cfg(client, C), Client = cfg(client, C),
PartyClient = cfg(party_client, C), PartyClient = cfg(party_client, C),
@ -397,7 +397,7 @@ delete_invalid_party_status(C) ->
}} = hg_client_invoice_templating:delete(TplID, Client), }} = hg_client_invoice_templating:delete(TplID, Client),
ok = hg_client_party:unblock(<<"UNBLOOOCK">>, PartyClient). ok = hg_client_party:unblock(<<"UNBLOOOCK">>, PartyClient).
-spec delete_invalid_shop_status(config()) -> _ | no_return(). -spec delete_invalid_shop_status(config()) -> _.
delete_invalid_shop_status(C) -> delete_invalid_shop_status(C) ->
Client = cfg(client, C), Client = cfg(client, C),
PartyClient = cfg(party_client, C), PartyClient = cfg(party_client, C),
@ -416,7 +416,7 @@ delete_invalid_shop_status(C) ->
}} = hg_client_invoice_templating:delete(TplID, Client), }} = hg_client_invoice_templating:delete(TplID, Client),
ok = hg_client_party:unblock_shop(ShopID, <<"UNBLOOOCK">>, PartyClient). ok = hg_client_party:unblock_shop(ShopID, <<"UNBLOOOCK">>, PartyClient).
-spec delete_invoice_template(config()) -> _ | no_return(). -spec delete_invoice_template(config()) -> _.
delete_invoice_template(C) -> delete_invoice_template(C) ->
Client = cfg(client, C), Client = cfg(client, C),
?invoice_tpl(TplID) = create_invoice_tpl(C), ?invoice_tpl(TplID) = create_invoice_tpl(C),
@ -426,7 +426,7 @@ delete_invoice_template(C) ->
{exception, #payproc_InvoiceTemplateRemoved{}} = hg_client_invoice_templating:update(TplID, Diff, Client), {exception, #payproc_InvoiceTemplateRemoved{}} = hg_client_invoice_templating:update(TplID, Diff, Client),
{exception, #payproc_InvoiceTemplateRemoved{}} = hg_client_invoice_templating:delete(TplID, Client). {exception, #payproc_InvoiceTemplateRemoved{}} = hg_client_invoice_templating:delete(TplID, Client).
-spec terms_retrieval(config()) -> _ | no_return(). -spec terms_retrieval(config()) -> _.
terms_retrieval(C) -> terms_retrieval(C) ->
Client = cfg(client, C), Client = cfg(client, C),
?invoice_tpl(TplID1) = create_invoice_tpl(C), ?invoice_tpl(TplID1) = create_invoice_tpl(C),
@ -483,9 +483,8 @@ update_invalid_cost(Cost, currency, TplID, Client) ->
update_invalid_cost(Cost, Error, TplID, Client) -> update_invalid_cost(Cost, Error, TplID, Client) ->
Details = hg_ct_helper:make_invoice_tpl_details(<<"RNGName">>, Cost), Details = hg_ct_helper:make_invoice_tpl_details(<<"RNGName">>, Cost),
Diff = make_invoice_tpl_update_params(#{details => Details}), Diff = make_invoice_tpl_update_params(#{details => Details}),
{exception, #'InvalidRequest'{ {exception, #'InvalidRequest'{errors = [Error]}} = hg_client_invoice_templating:update(TplID, Diff, Client),
errors = [Error] ok.
}} = hg_client_invoice_templating:update(TplID, Diff, Client).
create_invalid_cost(Cost, amount, Config) -> create_invalid_cost(Cost, amount, Config) ->
create_invalid_cost(Cost, <<"Invalid amount">>, Config); create_invalid_cost(Cost, <<"Invalid amount">>, Config);
@ -494,9 +493,8 @@ create_invalid_cost(Cost, currency, Config) ->
create_invalid_cost(Cost, Error, Config) -> create_invalid_cost(Cost, Error, Config) ->
Product = <<"rubberduck">>, Product = <<"rubberduck">>,
Lifetime = make_lifetime(0, 0, 2), Lifetime = make_lifetime(0, 0, 2),
{exception, #'InvalidRequest'{ {exception, #'InvalidRequest'{errors = [Error]}} = create_invoice_tpl(Config, Product, Lifetime, Cost),
errors = [Error] ok.
}} = create_invoice_tpl(Config, Product, Lifetime, Cost).
make_invoice_tpl_create_params(PartyID, ShopID) -> make_invoice_tpl_create_params(PartyID, ShopID) ->
Lifetime = make_lifetime(0, 0, 2), Lifetime = make_lifetime(0, 0, 2),

View File

@ -433,7 +433,7 @@ init_per_suite(C) ->
-spec end_per_suite(config()) -> _. -spec end_per_suite(config()) -> _.
end_per_suite(C) -> end_per_suite(C) ->
ok = hg_domain:cleanup(), ok = hg_domain:cleanup(),
[application:stop(App) || App <- cfg(apps, C)], _ = [application:stop(App) || App <- cfg(apps, C)],
exit(cfg(test_sup, C), shutdown). exit(cfg(test_sup, C), shutdown).
%% tests %% tests
@ -594,7 +594,7 @@ init_per_testcase(C) ->
ok = hg_context:save(hg_context:create()), ok = hg_context:save(hg_context:create()),
[{client, Client}, {client_tpl, ClientTpl} | C]. [{client, Client}, {client_tpl, ClientTpl} | C].
-spec end_per_testcase(test_case_name(), config()) -> config(). -spec end_per_testcase(test_case_name(), config()) -> _.
end_per_testcase(_Name, C) -> end_per_testcase(_Name, C) ->
ok = hg_context:cleanup(), ok = hg_context:cleanup(),
_ = _ =
@ -612,7 +612,7 @@ invoice_creation_idempotency(C) ->
PartyID = cfg(party_id, C), PartyID = cfg(party_id, C),
InvoiceID = hg_utils:unique_id(), InvoiceID = hg_utils:unique_id(),
ExternalID = <<"123">>, ExternalID = <<"123">>,
InvoiceParams0 = make_invoice_params(PartyID, ShopID, <<"rubberduck">>, {100000, <<"RUB">>}), InvoiceParams0 = make_invoice_params(PartyID, ShopID, <<"rubberduck">>, make_cash(100000, <<"RUB">>)),
InvoiceParams1 = InvoiceParams0#payproc_InvoiceParams{ InvoiceParams1 = InvoiceParams0#payproc_InvoiceParams{
id = InvoiceID, id = InvoiceID,
external_id = ExternalID external_id = ExternalID
@ -633,7 +633,7 @@ invalid_invoice_shop(C) ->
Client = cfg(client, C), Client = cfg(client, C),
ShopID = genlib:unique(), ShopID = genlib:unique(),
PartyID = cfg(party_id, C), PartyID = cfg(party_id, C),
InvoiceParams = make_invoice_params(PartyID, ShopID, <<"rubberduck">>, 10000), InvoiceParams = make_invoice_params(PartyID, ShopID, <<"rubberduck">>, make_cash(10000)),
{exception, #payproc_ShopNotFound{}} = hg_client_invoicing:create(InvoiceParams, Client). {exception, #payproc_ShopNotFound{}} = hg_client_invoicing:create(InvoiceParams, Client).
-spec invalid_invoice_amount(config()) -> test_return(). -spec invalid_invoice_amount(config()) -> test_return().
@ -641,14 +641,14 @@ invalid_invoice_amount(C) ->
Client = cfg(client, C), Client = cfg(client, C),
ShopID = cfg(shop_id, C), ShopID = cfg(shop_id, C),
PartyID = cfg(party_id, C), PartyID = cfg(party_id, C),
InvoiceParams0 = make_invoice_params(PartyID, ShopID, <<"rubberduck">>, -10000), InvoiceParams0 = make_invoice_params(PartyID, ShopID, <<"rubberduck">>, make_cash(-10000)),
{exception, #'InvalidRequest'{ {exception, #'InvalidRequest'{
errors = [<<"Invalid amount">>] errors = [<<"Invalid amount">>]
}} = hg_client_invoicing:create(InvoiceParams0, Client), }} = hg_client_invoicing:create(InvoiceParams0, Client),
InvoiceParams1 = make_invoice_params(PartyID, ShopID, <<"rubberduck">>, 5), InvoiceParams1 = make_invoice_params(PartyID, ShopID, <<"rubberduck">>, make_cash(5)),
{exception, #payproc_InvoiceTermsViolated{reason = {invoice_unpayable, _}}} = {exception, #payproc_InvoiceTermsViolated{reason = {invoice_unpayable, _}}} =
hg_client_invoicing:create(InvoiceParams1, Client), hg_client_invoicing:create(InvoiceParams1, Client),
InvoiceParams2 = make_invoice_params(PartyID, ShopID, <<"rubberduck">>, 42000000000), InvoiceParams2 = make_invoice_params(PartyID, ShopID, <<"rubberduck">>, make_cash(42000000000)),
{exception, #payproc_InvoiceTermsViolated{reason = {invoice_unpayable, _}}} = {exception, #payproc_InvoiceTermsViolated{reason = {invoice_unpayable, _}}} =
hg_client_invoicing:create(InvoiceParams2, Client). hg_client_invoicing:create(InvoiceParams2, Client).
@ -657,7 +657,7 @@ invalid_invoice_currency(C) ->
Client = cfg(client, C), Client = cfg(client, C),
ShopID = cfg(shop_id, C), ShopID = cfg(shop_id, C),
PartyID = cfg(party_id, C), PartyID = cfg(party_id, C),
InvoiceParams = make_invoice_params(PartyID, ShopID, <<"rubberduck">>, {100, <<"KEK">>}), InvoiceParams = make_invoice_params(PartyID, ShopID, <<"rubberduck">>, make_cash(100, <<"KEK">>)),
{exception, #'InvalidRequest'{ {exception, #'InvalidRequest'{
errors = [<<"Invalid currency">>] errors = [<<"Invalid currency">>]
}} = hg_client_invoicing:create(InvoiceParams, Client). }} = hg_client_invoicing:create(InvoiceParams, Client).
@ -668,7 +668,7 @@ invalid_party_status(C) ->
PartyClient = cfg(party_client, C), PartyClient = cfg(party_client, C),
ShopID = cfg(shop_id, C), ShopID = cfg(shop_id, C),
PartyID = cfg(party_id, C), PartyID = cfg(party_id, C),
InvoiceParams = make_invoice_params(PartyID, ShopID, <<"rubberduck">>, {100000, <<"RUB">>}), InvoiceParams = make_invoice_params(PartyID, ShopID, <<"rubberduck">>, make_cash(100000)),
TplID = create_invoice_tpl(C), TplID = create_invoice_tpl(C),
InvoiceParamsWithTpl = make_invoice_params_tpl(TplID), InvoiceParamsWithTpl = make_invoice_params_tpl(TplID),
@ -696,7 +696,7 @@ invalid_shop_status(C) ->
PartyClient = cfg(party_client, C), PartyClient = cfg(party_client, C),
ShopID = cfg(shop_id, C), ShopID = cfg(shop_id, C),
PartyID = cfg(party_id, C), PartyID = cfg(party_id, C),
InvoiceParams = make_invoice_params(PartyID, ShopID, <<"rubberduck">>, {100000, <<"RUB">>}), InvoiceParams = make_invoice_params(PartyID, ShopID, <<"rubberduck">>, make_cash(100000)),
TplID = create_invoice_tpl(C), TplID = create_invoice_tpl(C),
InvoiceParamsWithTpl = make_invoice_params_tpl(TplID), InvoiceParamsWithTpl = make_invoice_params_tpl(TplID),
@ -878,7 +878,7 @@ invoice_cancellation(C) ->
Client = cfg(client, C), Client = cfg(client, C),
ShopID = cfg(shop_id, C), ShopID = cfg(shop_id, C),
PartyID = cfg(party_id, C), PartyID = cfg(party_id, C),
InvoiceParams = make_invoice_params(PartyID, ShopID, <<"rubberduck">>, 10000), InvoiceParams = make_invoice_params(PartyID, ShopID, <<"rubberduck">>, make_cash(10000)),
InvoiceID = create_invoice(InvoiceParams, Client), InvoiceID = create_invoice(InvoiceParams, Client),
?invalid_invoice_status(_) = hg_client_invoicing:fulfill(InvoiceID, <<"perfect">>, Client), ?invalid_invoice_status(_) = hg_client_invoicing:fulfill(InvoiceID, <<"perfect">>, Client),
ok = hg_client_invoicing:rescind(InvoiceID, <<"whynot">>, Client). ok = hg_client_invoicing:rescind(InvoiceID, <<"whynot">>, Client).
@ -967,7 +967,7 @@ payment_success_ruleset(C) ->
PartyClient = hg_client_party:start(PartyID, hg_ct_helper:create_client(RootUrl, PartyID)), PartyClient = hg_client_party:start(PartyID, hg_ct_helper:create_client(RootUrl, PartyID)),
Client = hg_client_invoicing:start_link(hg_ct_helper:create_client(RootUrl, PartyID)), Client = hg_client_invoicing:start_link(hg_ct_helper:create_client(RootUrl, PartyID)),
ShopID = hg_ct_helper:create_party_and_shop(?cat(1), <<"RUB">>, ?tmpl(1), ?pinst(1), PartyClient), ShopID = hg_ct_helper:create_party_and_shop(?cat(1), <<"RUB">>, ?tmpl(1), ?pinst(1), PartyClient),
InvoiceParams = make_invoice_params(PartyID, ShopID, <<"rubberduck">>, make_due_date(10), 42000), InvoiceParams = make_invoice_params(PartyID, ShopID, <<"rubberduck">>, make_due_date(10), make_cash(42000)),
InvoiceID = create_invoice(InvoiceParams, Client), InvoiceID = create_invoice(InvoiceParams, Client),
[?invoice_created(?invoice_w_status(?invoice_unpaid()))] = next_event(InvoiceID, Client), [?invoice_created(?invoice_w_status(?invoice_unpaid()))] = next_event(InvoiceID, Client),
%% %%
@ -1629,7 +1629,7 @@ party_revision_check(C) ->
party_revision_increment(ShopID, PartyClient), party_revision_increment(ShopID, PartyClient),
% add some cash to make smooth refund after % add some cash to make smooth refund after
InvoiceParams2 = make_invoice_params(PartyID, ShopID, <<"rubbermoss">>, make_due_date(10), 200000), InvoiceParams2 = make_invoice_params(PartyID, ShopID, <<"rubbermoss">>, make_due_date(10), make_cash(200000)),
InvoiceID2 = create_invoice(InvoiceParams2, Client), InvoiceID2 = create_invoice(InvoiceParams2, Client),
[?invoice_created(?invoice_w_status(?invoice_unpaid()))] = next_event(InvoiceID2, Client), [?invoice_created(?invoice_w_status(?invoice_unpaid()))] = next_event(InvoiceID2, Client),
PaymentID2 = process_payment(InvoiceID2, make_payment_params(), Client), PaymentID2 = process_payment(InvoiceID2, make_payment_params(), Client),
@ -2179,7 +2179,7 @@ invalid_payment_w_deprived_party(C) ->
PartyClient = hg_client_party:start(PartyID, hg_ct_helper:create_client(RootUrl, PartyID)), PartyClient = hg_client_party:start(PartyID, hg_ct_helper:create_client(RootUrl, PartyID)),
InvoicingClient = hg_client_invoicing:start_link(hg_ct_helper:create_client(RootUrl, PartyID)), InvoicingClient = hg_client_invoicing:start_link(hg_ct_helper:create_client(RootUrl, PartyID)),
ShopID = hg_ct_helper:create_party_and_shop(?cat(1), <<"RUB">>, ?tmpl(1), ?pinst(1), PartyClient), ShopID = hg_ct_helper:create_party_and_shop(?cat(1), <<"RUB">>, ?tmpl(1), ?pinst(1), PartyClient),
InvoiceParams = make_invoice_params(PartyID, ShopID, <<"rubberduck">>, make_due_date(10), 42000), InvoiceParams = make_invoice_params(PartyID, ShopID, <<"rubberduck">>, make_due_date(10), make_cash(42000)),
InvoiceID = create_invoice(InvoiceParams, InvoicingClient), InvoiceID = create_invoice(InvoiceParams, InvoicingClient),
[?invoice_created(?invoice_w_status(?invoice_unpaid()))] = next_event(InvoiceID, InvoicingClient), [?invoice_created(?invoice_w_status(?invoice_unpaid()))] = next_event(InvoiceID, InvoicingClient),
PaymentParams = make_payment_params(), PaymentParams = make_payment_params(),
@ -2193,7 +2193,7 @@ external_account_posting(C) ->
PartyClient = hg_client_party:start(PartyID, hg_ct_helper:create_client(RootUrl, PartyID)), PartyClient = hg_client_party:start(PartyID, hg_ct_helper:create_client(RootUrl, PartyID)),
InvoicingClient = hg_client_invoicing:start_link(hg_ct_helper:create_client(RootUrl, PartyID)), InvoicingClient = hg_client_invoicing:start_link(hg_ct_helper:create_client(RootUrl, PartyID)),
ShopID = hg_ct_helper:create_party_and_shop(?cat(2), <<"RUB">>, ?tmpl(2), ?pinst(2), PartyClient), ShopID = hg_ct_helper:create_party_and_shop(?cat(2), <<"RUB">>, ?tmpl(2), ?pinst(2), PartyClient),
InvoiceParams = make_invoice_params(PartyID, ShopID, <<"rubbermoss">>, make_due_date(10), 42000), InvoiceParams = make_invoice_params(PartyID, ShopID, <<"rubbermoss">>, make_due_date(10), make_cash(42000)),
InvoiceID = create_invoice(InvoiceParams, InvoicingClient), InvoiceID = create_invoice(InvoiceParams, InvoicingClient),
[?invoice_created(?invoice_w_status(?invoice_unpaid()))] = next_event(InvoiceID, InvoicingClient), [?invoice_created(?invoice_w_status(?invoice_unpaid()))] = next_event(InvoiceID, InvoicingClient),
?payment_state( ?payment_state(
@ -2233,7 +2233,7 @@ terminal_cashflow_overrides_provider(C) ->
PartyClient = hg_client_party:start(PartyID, hg_ct_helper:create_client(RootUrl, PartyID)), PartyClient = hg_client_party:start(PartyID, hg_ct_helper:create_client(RootUrl, PartyID)),
InvoicingClient = hg_client_invoicing:start_link(hg_ct_helper:create_client(RootUrl, PartyID)), InvoicingClient = hg_client_invoicing:start_link(hg_ct_helper:create_client(RootUrl, PartyID)),
ShopID = hg_ct_helper:create_party_and_shop(?cat(4), <<"RUB">>, ?tmpl(2), ?pinst(2), PartyClient), ShopID = hg_ct_helper:create_party_and_shop(?cat(4), <<"RUB">>, ?tmpl(2), ?pinst(2), PartyClient),
InvoiceParams = make_invoice_params(PartyID, ShopID, <<"rubbermoss">>, make_due_date(10), 42000), InvoiceParams = make_invoice_params(PartyID, ShopID, <<"rubbermoss">>, make_due_date(10), make_cash(42000)),
InvoiceID = create_invoice(InvoiceParams, InvoicingClient), InvoiceID = create_invoice(InvoiceParams, InvoicingClient),
_ = next_event(InvoiceID, InvoicingClient), _ = next_event(InvoiceID, InvoicingClient),
_ = hg_client_invoicing:start_payment(InvoiceID, make_payment_params(), InvoicingClient), _ = hg_client_invoicing:start_payment(InvoiceID, make_payment_params(), InvoicingClient),
@ -4933,7 +4933,6 @@ construct_proxy(ID, Url, Options) ->
}}. }}.
%% %%
make_invoice_params(PartyID, ShopID, Product, Cost) -> make_invoice_params(PartyID, ShopID, Product, Cost) ->
hg_ct_helper:make_invoice_params(PartyID, ShopID, Product, Cost). hg_ct_helper:make_invoice_params(PartyID, ShopID, Product, Cost).
@ -4955,6 +4954,9 @@ make_invoice_context() ->
make_invoice_context(Ctx) -> make_invoice_context(Ctx) ->
hg_ct_helper:make_invoice_context(Ctx). hg_ct_helper:make_invoice_context(Ctx).
make_cash(Amount) ->
make_cash(Amount, <<"RUB">>).
make_cash(Amount, Currency) -> make_cash(Amount, Currency) ->
hg_ct_helper:make_cash(Amount, Currency). hg_ct_helper:make_cash(Amount, Currency).
@ -5213,7 +5215,7 @@ start_invoice(Product, Due, Amount, C) ->
start_invoice(ShopID, Product, Due, Amount, C) -> start_invoice(ShopID, Product, Due, Amount, C) ->
Client = cfg(client, C), Client = cfg(client, C),
PartyID = cfg(party_id, C), PartyID = cfg(party_id, C),
InvoiceParams = make_invoice_params(PartyID, ShopID, Product, Due, Amount), InvoiceParams = make_invoice_params(PartyID, ShopID, Product, Due, make_cash(Amount)),
InvoiceID = create_invoice(InvoiceParams, Client), InvoiceID = create_invoice(InvoiceParams, Client),
[?invoice_created(?invoice_w_status(?invoice_unpaid()))] = next_event(InvoiceID, Client), [?invoice_created(?invoice_w_status(?invoice_unpaid()))] = next_event(InvoiceID, Client),
InvoiceID. InvoiceID.
@ -5492,7 +5494,7 @@ party_revision_check_init_params(C) ->
{PartyID, PartyClient, Client, ShopID}. {PartyID, PartyClient, Client, ShopID}.
invoice_create_and_get_revision(PartyID, Client, ShopID) -> invoice_create_and_get_revision(PartyID, Client, ShopID) ->
InvoiceParams = make_invoice_params(PartyID, ShopID, <<"somePlace">>, make_due_date(10), 5000), InvoiceParams = make_invoice_params(PartyID, ShopID, <<"somePlace">>, make_due_date(10), make_cash(5000)),
InvoiceID = create_invoice(InvoiceParams, Client), InvoiceID = create_invoice(InvoiceParams, Client),
[?invoice_created(?invoice_w_status(?invoice_unpaid()) = ?invoice_w_revision(InvoiceRev))] = [?invoice_created(?invoice_w_status(?invoice_unpaid()) = ?invoice_w_revision(InvoiceRev))] =
next_event(InvoiceID, Client), next_event(InvoiceID, Client),

View File

@ -13,7 +13,7 @@
code_change/3 code_change/3
]). ]).
-spec start_link([]) -> pid(). -spec start_link([]) -> {ok, pid()}.
start_link(Args) -> start_link(Args) ->
gen_server:start_link({local, ?MODULE}, ?MODULE, Args, []). gen_server:start_link({local, ?MODULE}, ?MODULE, Args, []).
@ -25,29 +25,29 @@ put(Key, Value) ->
get(Key) -> get(Key) ->
gen_server:call(?MODULE, {get, Key}, 5000). gen_server:call(?MODULE, {get, Key}, 5000).
-spec init(term()) -> {ok, atom()}. -spec init(term()) -> {ok, map()}.
init(_) -> init(_) ->
{ok, #{}}. {ok, #{}}.
-spec handle_call(term(), pid(), atom()) -> {reply, atom(), atom()}. -spec handle_call(term(), pid(), map()) -> {reply, atom(), map()}.
handle_call({put, Key, Value}, _From, State) -> handle_call({put, Key, Value}, _From, State) ->
{reply, ok, State#{Key => Value}}; {reply, ok, State#{Key => Value}};
handle_call({get, Key}, _From, State) -> handle_call({get, Key}, _From, State) ->
Value = maps:get(Key, State, undefined), Value = maps:get(Key, State, undefined),
{reply, Value, State}. {reply, Value, State}.
-spec handle_cast(term(), atom()) -> {noreply, atom()}. -spec handle_cast(term(), map()) -> {noreply, map()}.
handle_cast(_Msg, State) -> handle_cast(_Msg, State) ->
{noreply, State}. {noreply, State}.
-spec handle_info(term(), atom()) -> {noreply, atom()}. -spec handle_info(term(), map()) -> {noreply, map()}.
handle_info(_Info, State) -> handle_info(_Info, State) ->
{noreply, State}. {noreply, State}.
-spec terminate(term(), atom()) -> atom(). -spec terminate(term(), map()) -> atom().
terminate(_Reason, _State) -> terminate(_Reason, _State) ->
ok. ok.
-spec code_change(term(), term(), term()) -> {ok, atom()}. -spec code_change(term(), map(), term()) -> {ok, map()}.
code_change(_OldVsn, State, _Extra) -> code_change(_OldVsn, State, _Extra) ->
{ok, State}. {ok, State}.

View File

@ -142,7 +142,7 @@ init_per_testcase(Name, C) ->
| C | C
]. ].
-spec end_per_testcase(test_case_name(), config()) -> config(). -spec end_per_testcase(test_case_name(), config()) -> _.
end_per_testcase(_Name, _C) -> end_per_testcase(_Name, _C) ->
ok. ok.
@ -429,9 +429,11 @@ start_proxies(Proxies) ->
setup_proxies(Proxies) -> setup_proxies(Proxies) ->
ok = hg_domain:upsert(Proxies). ok = hg_domain:upsert(Proxies).
-spec start_service_handler(module(), list(), map()) -> binary().
start_service_handler(Module, C, HandlerOpts) -> start_service_handler(Module, C, HandlerOpts) ->
start_service_handler(Module, Module, C, HandlerOpts). start_service_handler(Module, Module, C, HandlerOpts).
-spec start_service_handler(atom(), module(), list(), map()) -> binary().
start_service_handler(Name, Module, C, HandlerOpts) -> start_service_handler(Name, Module, C, HandlerOpts) ->
IP = "127.0.0.1", IP = "127.0.0.1",
Port = get_random_port(), Port = get_random_port(),
@ -440,6 +442,7 @@ start_service_handler(Name, Module, C, HandlerOpts) ->
{ok, _} = supervisor:start_child(cfg(test_sup, C), ChildSpec), {ok, _} = supervisor:start_child(cfg(test_sup, C), ChildSpec),
hg_test_proxy:get_url(Module, IP, Port). hg_test_proxy:get_url(Module, IP, Port).
-spec get_random_port() -> inet:port_number().
get_random_port() -> get_random_port() ->
rand:uniform(32768) + 32767. rand:uniform(32768) + 32767.

View File

@ -121,11 +121,12 @@ init_per_testcase(_, C) ->
}, },
Ctx0 Ctx0
), ),
Ctx2 = hg_context:set_party_client_context(#{woody_context => woody_context:new()}, Ctx1), PartyClientContext = party_client_context:create(#{}),
Ctx2 = hg_context:set_party_client_context(PartyClientContext, Ctx1),
ok = hg_context:save(Ctx2), ok = hg_context:save(Ctx2),
C. C.
-spec end_per_testcase(test_case_name(), config()) -> config(). -spec end_per_testcase(test_case_name(), config()) -> _.
end_per_testcase(_Name, _C) -> end_per_testcase(_Name, _C) ->
ok = hg_context:cleanup(), ok = hg_context:cleanup(),
ok. ok.

View File

@ -142,18 +142,13 @@ end_per_group(_GroupName, C) ->
-spec init_per_testcase(test_case_name(), config()) -> config(). -spec init_per_testcase(test_case_name(), config()) -> config().
init_per_testcase(_, C) -> init_per_testcase(_, C) ->
Ctx0 = hg_context:set_party_client(cfg(party_client, C), hg_context:create()), Ctx0 = hg_context:set_party_client(cfg(party_client, C), hg_context:create()),
Ctx1 = hg_context:set_user_identity( Ctx1 = hg_context:set_user_identity(#{id => cfg(party_id, C), realm => <<"internal">>}, Ctx0),
#{ PartyClientContext = party_client_context:create(#{}),
id => cfg(party_id, C), Ctx2 = hg_context:set_party_client_context(PartyClientContext, Ctx1),
realm => <<"internal">>
},
Ctx0
),
Ctx2 = hg_context:set_party_client_context(#{woody_context => woody_context:new()}, Ctx1),
ok = hg_context:save(Ctx2), ok = hg_context:save(Ctx2),
C. C.
-spec end_per_testcase(test_case_name(), config()) -> config(). -spec end_per_testcase(test_case_name(), config()) -> _.
end_per_testcase(_Name, _C) -> end_per_testcase(_Name, _C) ->
ok = hg_context:cleanup(), ok = hg_context:cleanup(),
ok. ok.
@ -370,12 +365,15 @@ prefer_alive(_C) ->
Revision = hg_domain:head(), Revision = hg_domain:head(),
PaymentInstitution = hg_domain:get(Revision, {payment_institution, ?pinst(1)}), PaymentInstitution = hg_domain:get(Revision, {payment_institution, ?pinst(1)}),
{[ {
{{?prv(200), _}, _}, [{{?prv(200), _}, _}, {{?prv(201), _}, _}, {{?prv(202), _}, _}] = Routes,
{{?prv(201), _}, _}, RejectContext
{{?prv(202), _}, _} } = hg_routing:gather_routes(
] = Routes, payment,
RejectContext} = gather_routes(PaymentInstitution, VS, Revision), PaymentInstitution,
VS,
Revision
),
{ProviderRefs, TerminalData} = lists:unzip(Routes), {ProviderRefs, TerminalData} = lists:unzip(Routes),
@ -420,12 +418,15 @@ prefer_normal_conversion(_C) ->
Revision = hg_domain:head(), Revision = hg_domain:head(),
PaymentInstitution = hg_domain:get(Revision, {payment_institution, ?pinst(1)}), PaymentInstitution = hg_domain:get(Revision, {payment_institution, ?pinst(1)}),
{[ {
{{?prv(200), _}, _}, [{{?prv(200), _}, _}, {{?prv(201), _}, _}, {{?prv(202), _}, _}] = Routes,
{{?prv(201), _}, _}, RC
{{?prv(202), _}, _} } = hg_routing:gather_routes(
] = Routes, payment,
RC} = gather_routes(PaymentInstitution, VS, Revision), PaymentInstitution,
VS,
Revision
),
{Providers, TerminalData} = lists:unzip(Routes), {Providers, TerminalData} = lists:unzip(Routes),
@ -469,12 +470,19 @@ prefer_higher_availability(_C) ->
Revision = hg_domain:head(), Revision = hg_domain:head(),
PaymentInstitution = hg_domain:get(Revision, {payment_institution, ?pinst(1)}), PaymentInstitution = hg_domain:get(Revision, {payment_institution, ?pinst(1)}),
{[ {
[
{{?prv(200), _}, _}, {{?prv(200), _}, _},
{{?prv(201), _}, _}, {{?prv(201), _}, _},
{{?prv(202), _}, _} {{?prv(202), _}, _}
] = Routes, ] = Routes,
RC} = gather_routes(PaymentInstitution, VS, Revision), RC
} = hg_routing:gather_routes(
payment,
PaymentInstitution,
VS,
Revision
),
{ProviderRefs, TerminalData} = lists:unzip(Routes), {ProviderRefs, TerminalData} = lists:unzip(Routes),
@ -504,12 +512,19 @@ prefer_higher_conversion(_C) ->
Revision = hg_domain:head(), Revision = hg_domain:head(),
PaymentInstitution = hg_domain:get(Revision, {payment_institution, ?pinst(1)}), PaymentInstitution = hg_domain:get(Revision, {payment_institution, ?pinst(1)}),
{[ {
[
{{?prv(200), _}, _}, {{?prv(200), _}, _},
{{?prv(201), _}, _}, {{?prv(201), _}, _},
{{?prv(202), _}, _} {{?prv(202), _}, _}
] = Routes, ] = Routes,
RC} = gather_routes(PaymentInstitution, VS, Revision), RC
} = hg_routing:gather_routes(
payment,
PaymentInstitution,
VS,
Revision
),
{Providers, TerminalData} = lists:unzip(Routes), {Providers, TerminalData} = lists:unzip(Routes),
@ -538,12 +553,19 @@ prefer_weight_over_availability(_C) ->
Revision = hg_domain:head(), Revision = hg_domain:head(),
PaymentInstitution = hg_domain:get(Revision, {payment_institution, ?pinst(1)}), PaymentInstitution = hg_domain:get(Revision, {payment_institution, ?pinst(1)}),
{[ {
[
{{?prv(200), _}, _}, {{?prv(200), _}, _},
{{?prv(201), _}, _}, {{?prv(201), _}, _},
{{?prv(202), _}, _} {{?prv(202), _}, _}
] = Routes, ] = Routes,
RC} = gather_routes(PaymentInstitution, VS, Revision), RC
} = hg_routing:gather_routes(
payment,
PaymentInstitution,
VS,
Revision
),
{Providers, TerminalData} = lists:unzip(Routes), {Providers, TerminalData} = lists:unzip(Routes),
@ -567,16 +589,16 @@ prefer_weight_over_conversion(_C) ->
flow => instant flow => instant
}, },
RiskScore = low, RiskScore = low,
Revision = hg_domain:head(), Revision = hg_domain:head(),
PaymentInstitution = hg_domain:get(Revision, {payment_institution, ?pinst(1)}), PaymentInstitution = hg_domain:get(Revision, {payment_institution, ?pinst(1)}),
{
{[ [
{{?prv(200), _}, _}, {{?prv(200), _}, _},
{{?prv(201), _}, _}, {{?prv(201), _}, _},
{{?prv(202), _}, _} {{?prv(202), _}, _}
] = Routes, ] = Routes,
RC} = gather_routes(PaymentInstitution, VS, Revision), RC
} = hg_routing:gather_routes(payment, PaymentInstitution, VS, Revision),
{Providers, TerminalData} = lists:unzip(Routes), {Providers, TerminalData} = lists:unzip(Routes),
@ -643,8 +665,7 @@ routes_selected_with_risk_score(_C, RiskScore, PrvIDList) ->
}, },
Revision = hg_domain:head(), Revision = hg_domain:head(),
PaymentInstitution = hg_domain:get(Revision, {payment_institution, ?pinst(1)}), PaymentInstitution = hg_domain:get(Revision, {payment_institution, ?pinst(1)}),
{SelectedProviders, _} = hg_routing:gather_routes(payment, PaymentInstitution, VS, Revision),
{SelectedProviders, _} = gather_routes(PaymentInstitution, VS, Revision),
%% Ensure list of selected provider ID match to given %% Ensure list of selected provider ID match to given
PrvIDList = [P || {{?prv(P), _}, _} <- SelectedProviders], PrvIDList = [P || {{?prv(P), _}, _} <- SelectedProviders],
ok. ok.
@ -884,6 +905,7 @@ maybe_set_risk_coverage(false, _) ->
maybe_set_risk_coverage(true, V) -> maybe_set_risk_coverage(true, V) ->
{value, V}. {value, V}.
-spec construct_domain_fixture() -> [hg_domain:object()].
construct_domain_fixture() -> construct_domain_fixture() ->
TestTermSet = #domain_TermSet{ TestTermSet = #domain_TermSet{
payments = #domain_PaymentsServiceTerms{ payments = #domain_PaymentsServiceTerms{
@ -1945,6 +1967,3 @@ terminal_priority_fixture(Revision, _C) ->
} }
}} }}
]. ].
gather_routes(PaymentInstitution, VS, Revision) ->
hg_routing:gather_routes(payment, PaymentInstitution, VS, Revision).

View File

@ -10,11 +10,11 @@
%% %%
-spec get_child_spec(Name :: atom(), module(), ip(), inet:port_number()) -> supervisor:child_spec(). -spec get_child_spec(atom(), module(), ip(), inet:port_number()) -> supervisor:child_spec().
get_child_spec(Name, Module, Host, Port) -> get_child_spec(Name, Module, Host, Port) ->
get_child_spec(Name, Module, Host, Port, #{}). get_child_spec(Name, Module, Host, Port, #{}).
-spec get_child_spec(Name :: atom(), module(), ip(), inet:port_number(), #{}) -> supervisor:child_spec(). -spec get_child_spec(atom(), module(), ip(), inet:port_number(), map()) -> supervisor:child_spec().
get_child_spec(Name, Module, IPStr, Port, Args) -> get_child_spec(Name, Module, IPStr, Port, Args) ->
{ok, IP} = inet:parse_address(IPStr), {ok, IP} = inet:parse_address(IPStr),
{Path, Service} = Module:get_service_spec(), {Path, Service} = Module:get_service_spec(),
@ -28,7 +28,7 @@ get_child_spec(Name, Module, IPStr, Port, Args) ->
} }
). ).
-spec get_url(module(), ip(), inet:port_number()) -> supervisor:child_spec(). -spec get_url(module(), ip(), inet:port_number()) -> binary().
get_url(Module, Host, Port) -> get_url(Module, Host, Port) ->
{Path, _Service} = Module:get_service_spec(), {Path, _Service} = Module:get_service_spec(),
iolist_to_binary(["http://", Host, ":", integer_to_list(Port), Path]). iolist_to_binary(["http://", Host, ":", integer_to_list(Port), Path]).

View File

@ -38,8 +38,8 @@ call(ServiceName, Function, Args, {RootUrl, Context}) ->
{Result, {RootUrl, Context}}. {Result, {RootUrl, Context}}.
-spec do_call(woody:request(), woody_client:options(), woody_context:ctx(), genlib_retry:strategy()) -> -spec do_call(woody:request(), woody_client:options(), woody_context:ctx(), genlib_retry:strategy()) ->
{ok, woody:result()} | {ok, woody:result()}
{exception, woody_error:business_error()}. | {exception, woody_error:business_error()}.
do_call(Request, Opts, Context, RetryStrategy) -> do_call(Request, Opts, Context, RetryStrategy) ->
try try
woody_client:call(Request, Opts, Context) woody_client:call(Request, Opts, Context)

View File

@ -76,7 +76,7 @@ get(ID, Client, EventRange) ->
delete(ID, Client) -> delete(ID, Client) ->
map_result_error(gen_server:call(Client, {call, 'Delete', [ID]})). map_result_error(gen_server:call(Client, {call, 'Delete', [ID]})).
-spec start_binding(pid(), customer_binding_params(), pid()) -> customer_binding(). -spec start_binding(id(), customer_binding_params(), pid()) -> customer_binding() | woody_error:business_error().
start_binding(ID, CustomerBindingParams, Client) -> start_binding(ID, CustomerBindingParams, Client) ->
map_result_error(gen_server:call(Client, {call, 'StartBinding', [ID, CustomerBindingParams]})). map_result_error(gen_server:call(Client, {call, 'StartBinding', [ID, CustomerBindingParams]})).
@ -102,27 +102,27 @@ map_result_error({error, Error}) ->
-type event() :: dmsl_payment_processing_thrift:'Event'(). -type event() :: dmsl_payment_processing_thrift:'Event'().
-record(st, { -record(state, {
pollers :: #{id() => hg_client_event_poller:st(event())}, pollers :: #{id() => hg_client_event_poller:st(event())},
client :: hg_client_api:t() client :: hg_client_api:t()
}). }).
-type st() :: #st{}. -type state() :: #state{}.
-type callref() :: {pid(), Tag :: reference()}. -type callref() :: {pid(), Tag :: reference()}.
-spec init(hg_client_api:t()) -> {ok, st()}. -spec init(hg_client_api:t()) -> {ok, state()}.
init(ApiClient) -> init(ApiClient) ->
{ok, #st{pollers = #{}, client = ApiClient}}. {ok, #state{pollers = #{}, client = ApiClient}}.
-spec handle_call(term(), callref(), st()) -> {reply, term(), st()} | {noreply, st()}. -spec handle_call(term(), callref(), state()) -> {reply, term(), state()} | {noreply, state()}.
handle_call({call, Function, Args}, _From, St = #st{client = Client}) -> handle_call({call, Function, Args}, _From, St = #state{client = Client}) ->
{Result, ClientNext} = hg_client_api:call(customer_management, Function, Args, Client), {Result, ClientNext} = hg_client_api:call(customer_management, Function, Args, Client),
{reply, Result, St#st{client = ClientNext}}; {reply, Result, St#state{client = ClientNext}};
handle_call({pull_event, CustomerID, Timeout}, _From, St = #st{client = Client}) -> handle_call({pull_event, CustomerID, Timeout}, _From, St = #state{client = Client}) ->
Poller = get_poller(CustomerID, St), Poller = get_poller(CustomerID, St),
{Result, ClientNext, PollerNext} = hg_client_event_poller:poll(1, Timeout, Client, Poller), {Result, ClientNext, PollerNext} = hg_client_event_poller:poll(1, Timeout, Client, Poller),
StNext = set_poller(CustomerID, PollerNext, St#st{client = ClientNext}), StNext = set_poller(CustomerID, PollerNext, St#state{client = ClientNext}),
case Result of case Result of
[] -> [] ->
{reply, timeout, StNext}; {reply, timeout, StNext};
@ -135,31 +135,31 @@ handle_call(Call, _From, State) ->
_ = logger:warning("unexpected call received: ~tp", [Call]), _ = logger:warning("unexpected call received: ~tp", [Call]),
{noreply, State}. {noreply, State}.
-spec handle_cast(_, st()) -> {noreply, st()}. -spec handle_cast(_, state()) -> {noreply, state()}.
handle_cast(Cast, State) -> handle_cast(Cast, State) ->
_ = logger:warning("unexpected cast received: ~tp", [Cast]), _ = logger:warning("unexpected cast received: ~tp", [Cast]),
{noreply, State}. {noreply, State}.
-spec handle_info(_, st()) -> {noreply, st()}. -spec handle_info(_, state()) -> {noreply, state()}.
handle_info(Info, State) -> handle_info(Info, State) ->
_ = logger:warning("unexpected info received: ~tp", [Info]), _ = logger:warning("unexpected info received: ~tp", [Info]),
{noreply, State}. {noreply, State}.
-spec terminate(Reason, st()) -> ok when Reason :: normal | shutdown | {shutdown, term()} | term(). -spec terminate(Reason, state()) -> ok when Reason :: normal | shutdown | {shutdown, term()} | term().
terminate(_Reason, _State) -> terminate(_Reason, _State) ->
ok. ok.
-spec code_change(Vsn | {down, Vsn}, st(), term()) -> {error, noimpl} when Vsn :: term(). -spec code_change(Vsn | {down, Vsn}, state(), term()) -> {error, noimpl} when Vsn :: term().
code_change(_OldVsn, _State, _Extra) -> code_change(_OldVsn, _State, _Extra) ->
{error, noimpl}. {error, noimpl}.
%% %%
get_poller(ID, #st{pollers = Pollers}) -> get_poller(ID, #state{pollers = Pollers}) ->
maps:get(ID, Pollers, construct_poller(ID)). maps:get(ID, Pollers, construct_poller(ID)).
set_poller(ID, Poller, St = #st{pollers = Pollers}) -> set_poller(ID, Poller, St = #state{pollers = Pollers}) ->
St#st{pollers = maps:put(ID, Poller, Pollers)}. St#state{pollers = maps:put(ID, Poller, Pollers)}.
construct_poller(ID) -> construct_poller(ID) ->
hg_client_event_poller:new( hg_client_event_poller:new(

View File

@ -74,19 +74,19 @@ pull_history(Client) ->
-type event() :: dmsl_payment_processing_thrift:'Event'(). -type event() :: dmsl_payment_processing_thrift:'Event'().
-record(st, { -record(state, {
poller :: hg_client_event_poller:st(event()), poller :: hg_client_event_poller:st(event()),
client :: hg_client_api:t() client :: hg_client_api:t()
}). }).
-type st() :: #st{}. -type state() :: #state{}.
-type callref() :: {pid(), Tag :: reference()}. -type callref() :: {pid(), Tag :: reference()}.
-define(SERVICE, payment_processing_eventsink). -define(SERVICE, payment_processing_eventsink).
-spec init(hg_client_api:t()) -> {ok, st()}. -spec init(hg_client_api:t()) -> {ok, state()}.
init(ApiClient) -> init(ApiClient) ->
{ok, #st{ {ok, #state{
client = ApiClient, client = ApiClient,
poller = hg_client_event_poller:new( poller = hg_client_event_poller:new(
{?SERVICE, 'GetEvents', []}, {?SERVICE, 'GetEvents', []},
@ -94,10 +94,10 @@ init(ApiClient) ->
) )
}}. }}.
-spec handle_call(term(), callref(), st()) -> {reply, term(), st()} | {noreply, st()}. -spec handle_call(term(), callref(), state()) -> {reply, term(), state()} | {noreply, state()}.
handle_call({call, Function, Args}, _From, St = #st{client = Client}) -> handle_call({call, Function, Args}, _From, St = #state{client = Client}) ->
{Result, ClientNext} = hg_client_api:call(?SERVICE, Function, Args, Client), {Result, ClientNext} = hg_client_api:call(?SERVICE, Function, Args, Client),
{reply, Result, St#st{client = ClientNext}}; {reply, Result, St#state{client = ClientNext}};
handle_call({pull_events, N, Timeout}, _From, St) -> handle_call({pull_events, N, Timeout}, _From, St) ->
{Result, StNext} = poll_events(N, Timeout, St), {Result, StNext} = poll_events(N, Timeout, St),
{reply, Result, StNext}; {reply, Result, StNext};
@ -108,29 +108,29 @@ handle_call(Call, _From, State) ->
_ = logger:warning("unexpected call received: ~tp", [Call]), _ = logger:warning("unexpected call received: ~tp", [Call]),
{noreply, State}. {noreply, State}.
-spec handle_cast(_, st()) -> {noreply, st()}. -spec handle_cast(_, state()) -> {noreply, state()}.
handle_cast(Cast, State) -> handle_cast(Cast, State) ->
_ = logger:warning("unexpected cast received: ~tp", [Cast]), _ = logger:warning("unexpected cast received: ~tp", [Cast]),
{noreply, State}. {noreply, State}.
-spec handle_info(_, st()) -> {noreply, st()}. -spec handle_info(_, state()) -> {noreply, state()}.
handle_info(Info, State) -> handle_info(Info, State) ->
_ = logger:warning("unexpected info received: ~tp", [Info]), _ = logger:warning("unexpected info received: ~tp", [Info]),
{noreply, State}. {noreply, State}.
-spec terminate(Reason, st()) -> ok when Reason :: normal | shutdown | {shutdown, term()} | term(). -spec terminate(Reason, state()) -> ok when Reason :: normal | shutdown | {shutdown, term()} | term().
terminate(_Reason, _State) -> terminate(_Reason, _State) ->
ok. ok.
-spec code_change(Vsn | {down, Vsn}, st(), term()) -> {error, noimpl} when Vsn :: term(). -spec code_change(Vsn | {down, Vsn}, state(), term()) -> {error, noimpl} when Vsn :: term().
code_change(_OldVsn, _State, _Extra) -> code_change(_OldVsn, _State, _Extra) ->
{error, noimpl}. {error, noimpl}.
%% %%
poll_events(N, Timeout, St = #st{client = Client, poller = Poller}) -> poll_events(N, Timeout, St = #state{client = Client, poller = Poller}) ->
{Result, ClientNext, PollerNext} = hg_client_event_poller:poll(N, Timeout, Client, Poller), {Result, ClientNext, PollerNext} = hg_client_event_poller:poll(N, Timeout, Client, Poller),
{Result, St#st{client = ClientNext, poller = PollerNext}}. {Result, St#state{client = ClientNext, poller = PollerNext}}.
poll_history(BatchSize, St) -> poll_history(BatchSize, St) ->
poll_history(BatchSize, [], St). poll_history(BatchSize, [], St).

View File

@ -90,27 +90,27 @@ map_result_error({error, Error}) ->
-type event() :: dmsl_payment_processing_thrift:'Event'(). -type event() :: dmsl_payment_processing_thrift:'Event'().
-record(st, { -record(state, {
user_info :: user_info(), user_info :: user_info(),
pollers :: #{id() => hg_client_event_poller:st(event())}, pollers :: #{id() => hg_client_event_poller:st(event())},
client :: hg_client_api:t() client :: hg_client_api:t()
}). }).
-type st() :: #st{}. -type state() :: #state{}.
-type callref() :: {pid(), Tag :: reference()}. -type callref() :: {pid(), Tag :: reference()}.
-spec init({user_info(), hg_client_api:t()}) -> {ok, st()}. -spec init({user_info(), hg_client_api:t()}) -> {ok, state()}.
init({UserInfo, ApiClient}) -> init({UserInfo, ApiClient}) ->
{ok, #st{user_info = UserInfo, pollers = #{}, client = ApiClient}}. {ok, #state{user_info = UserInfo, pollers = #{}, client = ApiClient}}.
-spec handle_call(term(), callref(), st()) -> {reply, term(), st()} | {noreply, st()}. -spec handle_call(term(), callref(), state()) -> {reply, term(), state()} | {noreply, state()}.
handle_call({call, Function, Args}, _From, St = #st{user_info = UserInfo, client = Client}) -> handle_call({call, Function, Args}, _From, St = #state{user_info = UserInfo, client = Client}) ->
{Result, ClientNext} = hg_client_api:call(invoice_templating, Function, [UserInfo | Args], Client), {Result, ClientNext} = hg_client_api:call(invoice_templating, Function, [UserInfo | Args], Client),
{reply, Result, St#st{client = ClientNext}}; {reply, Result, St#state{client = ClientNext}};
handle_call({pull_event, InvoiceID, Timeout}, _From, St = #st{client = Client}) -> handle_call({pull_event, InvoiceID, Timeout}, _From, St = #state{client = Client}) ->
Poller = get_poller(InvoiceID, St), Poller = get_poller(InvoiceID, St),
{Result, ClientNext, PollerNext} = hg_client_event_poller:poll(1, Timeout, Client, Poller), {Result, ClientNext, PollerNext} = hg_client_event_poller:poll(1, Timeout, Client, Poller),
StNext = set_poller(InvoiceID, PollerNext, St#st{client = ClientNext}), StNext = set_poller(InvoiceID, PollerNext, St#state{client = ClientNext}),
case Result of case Result of
[] -> [] ->
{reply, timeout, StNext}; {reply, timeout, StNext};
@ -123,31 +123,31 @@ handle_call(Call, _From, State) ->
_ = logger:warning("unexpected call received: ~tp", [Call]), _ = logger:warning("unexpected call received: ~tp", [Call]),
{noreply, State}. {noreply, State}.
-spec handle_cast(_, st()) -> {noreply, st()}. -spec handle_cast(_, state()) -> {noreply, state()}.
handle_cast(Cast, State) -> handle_cast(Cast, State) ->
_ = logger:warning("unexpected cast received: ~tp", [Cast]), _ = logger:warning("unexpected cast received: ~tp", [Cast]),
{noreply, State}. {noreply, State}.
-spec handle_info(_, st()) -> {noreply, st()}. -spec handle_info(_, state()) -> {noreply, state()}.
handle_info(Info, State) -> handle_info(Info, State) ->
_ = logger:warning("unexpected info received: ~tp", [Info]), _ = logger:warning("unexpected info received: ~tp", [Info]),
{noreply, State}. {noreply, State}.
-spec terminate(Reason, st()) -> ok when Reason :: normal | shutdown | {shutdown, term()} | term(). -spec terminate(Reason, state()) -> ok when Reason :: normal | shutdown | {shutdown, term()} | term().
terminate(_Reason, _State) -> terminate(_Reason, _State) ->
ok. ok.
-spec code_change(Vsn | {down, Vsn}, st(), term()) -> {error, noimpl} when Vsn :: term(). -spec code_change(Vsn | {down, Vsn}, state(), term()) -> {error, noimpl} when Vsn :: term().
code_change(_OldVsn, _State, _Extra) -> code_change(_OldVsn, _State, _Extra) ->
{error, noimpl}. {error, noimpl}.
%% %%
get_poller(ID, #st{user_info = UserInfo, pollers = Pollers}) -> get_poller(ID, #state{user_info = UserInfo, pollers = Pollers}) ->
maps:get(ID, Pollers, construct_poller(UserInfo, ID)). maps:get(ID, Pollers, construct_poller(UserInfo, ID)).
set_poller(ID, Poller, St = #st{pollers = Pollers}) -> set_poller(ID, Poller, St = #state{pollers = Pollers}) ->
St#st{pollers = maps:put(ID, Poller, Pollers)}. St#state{pollers = maps:put(ID, Poller, Pollers)}.
construct_poller(UserInfo, ID) -> construct_poller(UserInfo, ID) ->
hg_client_event_poller:new( hg_client_event_poller:new(

View File

@ -260,11 +260,11 @@ get_payment_refund(InvoiceID, PaymentID, RefundID, Client) ->
-spec create_payment_adjustment(invoice_id(), payment_id(), payment_adjustment_params(), pid()) -> -spec create_payment_adjustment(invoice_id(), payment_id(), payment_adjustment_params(), pid()) ->
payment_adjustment() | woody_error:business_error(). payment_adjustment() | woody_error:business_error().
create_payment_adjustment(InvoiceID, PaymentID, Params, Client) -> create_payment_adjustment(InvoiceID, PaymentID, ID, Client) ->
Args = [InvoiceID, PaymentID, Params], Args = [InvoiceID, PaymentID, ID],
map_result_error(gen_server:call(Client, {call, 'CreatePaymentAdjustment', Args})). map_result_error(gen_server:call(Client, {call, 'CreatePaymentAdjustment', Args})).
-spec get_payment_adjustment(invoice_id(), payment_id(), payment_adjustment_params(), pid()) -> -spec get_payment_adjustment(invoice_id(), payment_id(), payment_adjustment_id(), pid()) ->
payment_adjustment() | woody_error:business_error(). payment_adjustment() | woody_error:business_error().
get_payment_adjustment(InvoiceID, PaymentID, Params, Client) -> get_payment_adjustment(InvoiceID, PaymentID, Params, Client) ->
Args = [InvoiceID, PaymentID, Params], Args = [InvoiceID, PaymentID, Params],
@ -308,27 +308,27 @@ map_result_error({error, Error}) ->
-type event() :: dmsl_payment_processing_thrift:'Event'(). -type event() :: dmsl_payment_processing_thrift:'Event'().
-record(st, { -record(state, {
user_info :: user_info(), user_info :: user_info(),
pollers :: #{invoice_id() => hg_client_event_poller:st(event())}, pollers :: #{invoice_id() => hg_client_event_poller:st(event())},
client :: hg_client_api:t() client :: hg_client_api:t()
}). }).
-type st() :: #st{}. -type state() :: #state{}.
-type callref() :: {pid(), Tag :: reference()}. -type callref() :: {pid(), Tag :: reference()}.
-spec init({user_info(), hg_client_api:t()}) -> {ok, st()}. -spec init({user_info(), hg_client_api:t()}) -> {ok, state()}.
init({UserInfo, ApiClient}) -> init({UserInfo, ApiClient}) ->
{ok, #st{user_info = UserInfo, pollers = #{}, client = ApiClient}}. {ok, #state{user_info = UserInfo, pollers = #{}, client = ApiClient}}.
-spec handle_call(term(), callref(), st()) -> {reply, term(), st()} | {noreply, st()}. -spec handle_call(term(), callref(), state()) -> {reply, term(), state()} | {noreply, state()}.
handle_call({call, Function, Args}, _From, St = #st{user_info = UserInfo, client = Client}) -> handle_call({call, Function, Args}, _From, St = #state{user_info = UserInfo, client = Client}) ->
{Result, ClientNext} = hg_client_api:call(invoicing, Function, [UserInfo | Args], Client), {Result, ClientNext} = hg_client_api:call(invoicing, Function, [UserInfo | Args], Client),
{reply, Result, St#st{client = ClientNext}}; {reply, Result, St#state{client = ClientNext}};
handle_call({pull_event, InvoiceID, Timeout}, _From, St = #st{client = Client}) -> handle_call({pull_event, InvoiceID, Timeout}, _From, St = #state{client = Client}) ->
Poller = get_poller(InvoiceID, St), Poller = get_poller(InvoiceID, St),
{Result, ClientNext, PollerNext} = hg_client_event_poller:poll(1, Timeout, Client, Poller), {Result, ClientNext, PollerNext} = hg_client_event_poller:poll(1, Timeout, Client, Poller),
StNext = set_poller(InvoiceID, PollerNext, St#st{client = ClientNext}), StNext = set_poller(InvoiceID, PollerNext, St#state{client = ClientNext}),
case Result of case Result of
[] -> [] ->
{reply, timeout, StNext}; {reply, timeout, StNext};
@ -341,31 +341,31 @@ handle_call(Call, _From, State) ->
_ = logger:warning("unexpected call received: ~tp", [Call]), _ = logger:warning("unexpected call received: ~tp", [Call]),
{noreply, State}. {noreply, State}.
-spec handle_cast(_, st()) -> {noreply, st()}. -spec handle_cast(_, state()) -> {noreply, state()}.
handle_cast(Cast, State) -> handle_cast(Cast, State) ->
_ = logger:warning("unexpected cast received: ~tp", [Cast]), _ = logger:warning("unexpected cast received: ~tp", [Cast]),
{noreply, State}. {noreply, State}.
-spec handle_info(_, st()) -> {noreply, st()}. -spec handle_info(_, state()) -> {noreply, state()}.
handle_info(Info, State) -> handle_info(Info, State) ->
_ = logger:warning("unexpected info received: ~tp", [Info]), _ = logger:warning("unexpected info received: ~tp", [Info]),
{noreply, State}. {noreply, State}.
-spec terminate(Reason, st()) -> ok when Reason :: normal | shutdown | {shutdown, term()} | term(). -spec terminate(Reason, state()) -> ok when Reason :: normal | shutdown | {shutdown, term()} | term().
terminate(_Reason, _State) -> terminate(_Reason, _State) ->
ok. ok.
-spec code_change(Vsn | {down, Vsn}, st(), term()) -> {error, noimpl} when Vsn :: term(). -spec code_change(Vsn | {down, Vsn}, state(), term()) -> {error, noimpl} when Vsn :: term().
code_change(_OldVsn, _State, _Extra) -> code_change(_OldVsn, _State, _Extra) ->
{error, noimpl}. {error, noimpl}.
%% %%
get_poller(InvoiceID, #st{user_info = UserInfo, pollers = Pollers}) -> get_poller(InvoiceID, #state{user_info = UserInfo, pollers = Pollers}) ->
maps:get(InvoiceID, Pollers, construct_poller(UserInfo, InvoiceID)). maps:get(InvoiceID, Pollers, construct_poller(UserInfo, InvoiceID)).
set_poller(InvoiceID, Poller, St = #st{pollers = Pollers}) -> set_poller(InvoiceID, Poller, St = #state{pollers = Pollers}) ->
St#st{pollers = maps:put(InvoiceID, Poller, Pollers)}. St#state{pollers = maps:put(InvoiceID, Poller, Pollers)}.
construct_poller(UserInfo, InvoiceID) -> construct_poller(UserInfo, InvoiceID) ->
hg_client_event_poller:new( hg_client_event_poller:new(

View File

@ -138,19 +138,19 @@ map_result_error({error, Error}) ->
-type event() :: dmsl_payment_processing_thrift:'Event'(). -type event() :: dmsl_payment_processing_thrift:'Event'().
-record(st, { -record(state, {
user_info :: user_info(), user_info :: user_info(),
party_id :: party_id(), party_id :: party_id(),
poller :: hg_client_event_poller:st(event()), poller :: hg_client_event_poller:st(event()),
client :: hg_client_api:t() client :: hg_client_api:t()
}). }).
-type st() :: #st{}. -type state() :: #state{}.
-type callref() :: {pid(), Tag :: reference()}. -type callref() :: {pid(), Tag :: reference()}.
-spec init({user_info(), party_id(), hg_client_api:t()}) -> {ok, st()}. -spec init({user_info(), party_id(), hg_client_api:t()}) -> {ok, state()}.
init({UserInfo, PartyID, ApiClient}) -> init({UserInfo, PartyID, ApiClient}) ->
{ok, #st{ {ok, #state{
user_info = UserInfo, user_info = UserInfo,
party_id = PartyID, party_id = PartyID,
client = ApiClient, client = ApiClient,
@ -160,14 +160,14 @@ init({UserInfo, PartyID, ApiClient}) ->
) )
}}. }}.
-spec handle_call(term(), callref(), st()) -> {reply, term(), st()} | {noreply, st()}. -spec handle_call(term(), callref(), state()) -> {reply, term(), state()} | {noreply, state()}.
handle_call({call, Function, Args0}, _From, St = #st{client = Client}) -> handle_call({call, Function, Args0}, _From, St = #state{client = Client}) ->
Args = [St#st.user_info, St#st.party_id | Args0], Args = [St#state.user_info, St#state.party_id | Args0],
{Result, ClientNext} = hg_client_api:call(party_management, Function, Args, Client), {Result, ClientNext} = hg_client_api:call(party_management, Function, Args, Client),
{reply, Result, St#st{client = ClientNext}}; {reply, Result, St#state{client = ClientNext}};
handle_call({pull_event, Timeout}, _From, St = #st{poller = Poller, client = Client}) -> handle_call({pull_event, Timeout}, _From, St = #state{poller = Poller, client = Client}) ->
{Result, ClientNext, PollerNext} = hg_client_event_poller:poll(1, Timeout, Client, Poller), {Result, ClientNext, PollerNext} = hg_client_event_poller:poll(1, Timeout, Client, Poller),
StNext = St#st{poller = PollerNext, client = ClientNext}, StNext = St#state{poller = PollerNext, client = ClientNext},
case Result of case Result of
[] -> [] ->
{reply, timeout, StNext}; {reply, timeout, StNext};
@ -180,20 +180,20 @@ handle_call(Call, _From, State) ->
_ = logger:warning("unexpected call received: ~tp", [Call]), _ = logger:warning("unexpected call received: ~tp", [Call]),
{noreply, State}. {noreply, State}.
-spec handle_cast(_, st()) -> {noreply, st()}. -spec handle_cast(_, state()) -> {noreply, state()}.
handle_cast(Cast, State) -> handle_cast(Cast, State) ->
_ = logger:warning("unexpected cast received: ~tp", [Cast]), _ = logger:warning("unexpected cast received: ~tp", [Cast]),
{noreply, State}. {noreply, State}.
-spec handle_info(_, st()) -> {noreply, st()}. -spec handle_info(_, state()) -> {noreply, state()}.
handle_info(Info, State) -> handle_info(Info, State) ->
_ = logger:warning("unexpected info received: ~tp", [Info]), _ = logger:warning("unexpected info received: ~tp", [Info]),
{noreply, State}. {noreply, State}.
-spec terminate(Reason, st()) -> ok when Reason :: normal | shutdown | {shutdown, term()} | term(). -spec terminate(Reason, state()) -> ok when Reason :: normal | shutdown | {shutdown, term()} | term().
terminate(_Reason, _State) -> terminate(_Reason, _State) ->
ok. ok.
-spec code_change(Vsn | {down, Vsn}, st(), term()) -> {error, noimpl} when Vsn :: term(). -spec code_change(Vsn | {down, Vsn}, state(), term()) -> {error, noimpl} when Vsn :: term().
code_change(_OldVsn, _State, _Extra) -> code_change(_OldVsn, _State, _Extra) ->
{error, noimpl}. {error, noimpl}.

View File

@ -107,33 +107,33 @@ map_result_error({error, Error}) ->
-type event() :: dmsl_payment_processing_thrift:'RecurrentPaymentToolEvent'(). -type event() :: dmsl_payment_processing_thrift:'RecurrentPaymentToolEvent'().
-record(st, { -record(state, {
pollers :: #{recurrent_paytool_id() => hg_client_event_poller:st(event())}, pollers :: #{recurrent_paytool_id() => hg_client_event_poller:st(event())},
client :: hg_client_api:t() client :: hg_client_api:t()
}). }).
-type st() :: #st{}. -type state() :: #state{}.
-type callref() :: {pid(), Tag :: reference()}. -type callref() :: {pid(), Tag :: reference()}.
-spec init(hg_client_api:t()) -> {ok, st()}. -spec init(hg_client_api:t()) -> {ok, state()}.
init(ApiClient) -> init(ApiClient) ->
{ok, #st{pollers = #{}, client = ApiClient}}. {ok, #state{pollers = #{}, client = ApiClient}}.
-spec handle_call(term(), callref(), st()) -> {reply, term(), st()} | {noreply, st()}. -spec handle_call(term(), callref(), state()) -> {reply, term(), state()} | {noreply, state()}.
handle_call({call, 'GetLastEventID' = Function, [] = Args}, _From, St = #st{client = Client}) -> handle_call({call, 'GetLastEventID' = Function, [] = Args}, _From, St = #state{client = Client}) ->
{Result, ClientNext} = hg_client_api:call(recurrent_paytool_eventsink, Function, Args, Client), {Result, ClientNext} = hg_client_api:call(recurrent_paytool_eventsink, Function, Args, Client),
{reply, Result, St#st{client = ClientNext}}; {reply, Result, St#state{client = ClientNext}};
handle_call({call, 'GetEvents' = Function, [_Range] = Args}, _From, St = #st{client = Client}) -> handle_call({call, 'GetEvents' = Function, [_Range] = Args}, _From, St = #state{client = Client}) ->
{Result, ClientNext} = hg_client_api:call(recurrent_paytool_eventsink, Function, Args, Client), {Result, ClientNext} = hg_client_api:call(recurrent_paytool_eventsink, Function, Args, Client),
{reply, Result, St#st{client = ClientNext}}; {reply, Result, St#state{client = ClientNext}};
handle_call({call, Function, Args}, _From, St = #st{client = Client}) -> handle_call({call, Function, Args}, _From, St = #state{client = Client}) ->
{Result, ClientNext} = hg_client_api:call(?SERVICE, Function, Args, Client), {Result, ClientNext} = hg_client_api:call(?SERVICE, Function, Args, Client),
{reply, Result, St#st{client = ClientNext}}; {reply, Result, St#state{client = ClientNext}};
handle_call({pull_event, RecurrentPaytoolID, Timeout}, _From, St = #st{client = Client}) -> handle_call({pull_event, RecurrentPaytoolID, Timeout}, _From, St = #state{client = Client}) ->
Poller = get_poller(RecurrentPaytoolID, St), Poller = get_poller(RecurrentPaytoolID, St),
{Result, ClientNext, PollerNext} = hg_client_event_poller:poll(1, Timeout, Client, Poller), {Result, ClientNext, PollerNext} = hg_client_event_poller:poll(1, Timeout, Client, Poller),
StNext = set_poller(RecurrentPaytoolID, PollerNext, St#st{client = ClientNext}), StNext = set_poller(RecurrentPaytoolID, PollerNext, St#state{client = ClientNext}),
case Result of case Result of
[] -> [] ->
{reply, timeout, StNext}; {reply, timeout, StNext};
@ -146,31 +146,31 @@ handle_call(Call, _From, State) ->
_ = logger:warning("unexpected call received: ~tp", [Call]), _ = logger:warning("unexpected call received: ~tp", [Call]),
{noreply, State}. {noreply, State}.
-spec handle_cast(_, st()) -> {noreply, st()}. -spec handle_cast(_, state()) -> {noreply, state()}.
handle_cast(Cast, State) -> handle_cast(Cast, State) ->
_ = logger:warning("unexpected cast received: ~tp", [Cast]), _ = logger:warning("unexpected cast received: ~tp", [Cast]),
{noreply, State}. {noreply, State}.
-spec handle_info(_, st()) -> {noreply, st()}. -spec handle_info(_, state()) -> {noreply, state()}.
handle_info(Info, State) -> handle_info(Info, State) ->
_ = logger:warning("unexpected info received: ~tp", [Info]), _ = logger:warning("unexpected info received: ~tp", [Info]),
{noreply, State}. {noreply, State}.
-spec terminate(Reason, st()) -> ok when Reason :: normal | shutdown | {shutdown, term()} | term(). -spec terminate(Reason, state()) -> ok when Reason :: normal | shutdown | {shutdown, term()} | term().
terminate(_Reason, _State) -> terminate(_Reason, _State) ->
ok. ok.
-spec code_change(Vsn | {down, Vsn}, st(), term()) -> {error, noimpl} when Vsn :: term(). -spec code_change(Vsn | {down, Vsn}, state(), term()) -> {error, noimpl} when Vsn :: term().
code_change(_OldVsn, _State, _Extra) -> code_change(_OldVsn, _State, _Extra) ->
{error, noimpl}. {error, noimpl}.
%% %%
get_poller(ID, #st{pollers = Pollers}) -> get_poller(ID, #state{pollers = Pollers}) ->
maps:get(ID, Pollers, construct_poller(ID)). maps:get(ID, Pollers, construct_poller(ID)).
set_poller(ID, Poller, St = #st{pollers = Pollers}) -> set_poller(ID, Poller, St = #state{pollers = Pollers}) ->
St#st{pollers = maps:put(ID, Poller, Pollers)}. St#state{pollers = maps:put(ID, Poller, Pollers)}.
construct_poller(ID) -> construct_poller(ID) ->
hg_client_event_poller:new({?SERVICE, 'GetEvents', [ID]}, fun get_event_id/1). hg_client_event_poller:new({?SERVICE, 'GetEvents', [ID]}, fun get_event_id/1).

View File

@ -19,24 +19,24 @@
%% TODO: move it to the thrift runtime lib? %% TODO: move it to the thrift runtime lib?
-type thrift_type() :: -type thrift_type() ::
thrift_base_type() | thrift_base_type()
thrift_collection_type() | | thrift_collection_type()
thrift_enum_type() | | thrift_enum_type()
thrift_struct_type(). | thrift_struct_type().
-type thrift_base_type() :: -type thrift_base_type() ::
bool | bool
double | | double
i8 | | i8
i16 | | i16
i32 | | i32
i64 | | i64
string. | string.
-type thrift_collection_type() :: -type thrift_collection_type() ::
{list, thrift_type()} | {list, thrift_type()}
{set, thrift_type()} | | {set, thrift_type()}
{map, thrift_type(), thrift_type()}. | {map, thrift_type(), thrift_type()}.
-type thrift_enum_type() :: -type thrift_enum_type() ::
{enum, thrift_type_ref()}. {enum, thrift_type_ref()}.
@ -48,13 +48,14 @@
-type thrift_type_ref() :: {module(), Name :: atom()}. -type thrift_type_ref() :: {module(), Name :: atom()}.
-type thrift_struct_def() :: list({ -type thrift_struct_def() ::
Tag :: pos_integer(), list({
Requireness :: required | optional | undefined, Tag :: pos_integer(),
Type :: thrift_struct_type(), Requireness :: required | optional | undefined,
Name :: atom(), Type :: thrift_struct_type(),
Default :: any() Name :: atom(),
}). Default :: any()
}).
-type thrift_fun_ref() :: {Service :: atom(), Function :: atom()}. -type thrift_fun_ref() :: {Service :: atom(), Function :: atom()}.
-type thrift_fun_full_ref() :: {module(), thrift_fun_ref()}. -type thrift_fun_full_ref() :: {module(), thrift_fun_ref()}.

View File

@ -17,10 +17,10 @@
%% not exported from calendar module %% not exported from calendar module
-type rfc3339_time_unit() :: -type rfc3339_time_unit() ::
microsecond | microsecond
millisecond | | millisecond
nanosecond | | nanosecond
second. | second.
-export_type([timestamp/0]). -export_type([timestamp/0]).

View File

@ -267,9 +267,9 @@ handle_function_('ProcessCall', {Args}, #{ns := Ns} = _Opts) ->
-spec dispatch_signal(ns(), Signal, machine()) -> Result when -spec dispatch_signal(ns(), Signal, machine()) -> Result when
Signal :: Signal ::
mg_proto_state_processing_thrift:'InitSignal'() | mg_proto_state_processing_thrift:'InitSignal'()
mg_proto_state_processing_thrift:'TimeoutSignal'() | | mg_proto_state_processing_thrift:'TimeoutSignal'()
mg_proto_state_processing_thrift:'RepairSignal'(), | mg_proto_state_processing_thrift:'RepairSignal'(),
Result :: Result ::
mg_proto_state_processing_thrift:'SignalResult'(). mg_proto_state_processing_thrift:'SignalResult'().
dispatch_signal(Ns, #mg_stateproc_InitSignal{arg = Payload}, Machine) -> dispatch_signal(Ns, #mg_stateproc_InitSignal{arg = Payload}, Machine) ->

View File

@ -13,14 +13,14 @@
-type value() :: term(). -type value() :: term().
-type msgpack_value() :: -type msgpack_value() ::
undefined | undefined
boolean() | | boolean()
list() | | list()
map() | | map()
binary() | | binary()
{bin, binary()} | | {bin, binary()}
integer() | | integer()
float(). | float().
%% %%

View File

@ -14,22 +14,22 @@
%% %%
-type t() :: -type t() ::
dmsl_domain_thrift:'CurrencySelector'() | dmsl_domain_thrift:'CurrencySelector'()
dmsl_domain_thrift:'CategorySelector'() | | dmsl_domain_thrift:'CategorySelector'()
dmsl_domain_thrift:'CashLimitSelector'() | | dmsl_domain_thrift:'CashLimitSelector'()
dmsl_domain_thrift:'CashFlowSelector'() | | dmsl_domain_thrift:'CashFlowSelector'()
dmsl_domain_thrift:'PaymentMethodSelector'() | | dmsl_domain_thrift:'PaymentMethodSelector'()
dmsl_domain_thrift:'ProviderSelector'() | | dmsl_domain_thrift:'ProviderSelector'()
dmsl_domain_thrift:'TerminalSelector'() | | dmsl_domain_thrift:'TerminalSelector'()
dmsl_domain_thrift:'SystemAccountSetSelector'() | | dmsl_domain_thrift:'SystemAccountSetSelector'()
dmsl_domain_thrift:'ExternalAccountSetSelector'() | | dmsl_domain_thrift:'ExternalAccountSetSelector'()
dmsl_domain_thrift:'HoldLifetimeSelector'() | | dmsl_domain_thrift:'HoldLifetimeSelector'()
dmsl_domain_thrift:'CashValueSelector'() | | dmsl_domain_thrift:'CashValueSelector'()
dmsl_domain_thrift:'CumulativeLimitSelector'() | | dmsl_domain_thrift:'CumulativeLimitSelector'()
dmsl_domain_thrift:'TimeSpanSelector'() | | dmsl_domain_thrift:'TimeSpanSelector'()
dmsl_domain_thrift:'P2PProviderSelector'() | | dmsl_domain_thrift:'P2PProviderSelector'()
dmsl_domain_thrift:'FeeSelector'() | | dmsl_domain_thrift:'FeeSelector'()
dmsl_domain_thrift:'InspectorSelector'(). | dmsl_domain_thrift:'InspectorSelector'().
-type value() :: -type value() ::
%% FIXME %% FIXME
@ -99,9 +99,9 @@ reduce_decisions([], _, _) ->
[]. [].
-spec reduce_predicate(predicate(), varset(), pm_domain:revision()) -> -spec reduce_predicate(predicate(), varset(), pm_domain:revision()) ->
predicate() | predicate()
% for a partially reduced criterion % for a partially reduced criterion
{criterion, criterion()}. | {criterion, criterion()}.
reduce_predicate(?const(B), _, _) -> reduce_predicate(?const(B), _, _) ->
?const(B); ?const(B);
reduce_predicate({condition, C0}, VS, Rev) -> reduce_predicate({condition, C0}, VS, Rev) ->
@ -169,18 +169,18 @@ p2p_provider_test() ->
receiver_is = {bank_card, BankCardCondition} receiver_is = {bank_card, BankCardCondition}
}, },
P2PCondition2 = #domain_P2PToolCondition{ P2PCondition2 = #domain_P2PToolCondition{
sender_is = {payment_tool, {bank_card, BankCardCondition}}, sender_is = {bank_card, BankCardCondition},
receiver_is = {payment_tool, {bank_card, BankCardCondition2}} receiver_is = {bank_card, BankCardCondition2}
}, },
P2PProviderSelector = P2PProviderSelector =
{decisions, [ {decisions, [
#domain_P2PProviderDecision{ #domain_P2PProviderDecision{
if_ = {condition, {p2p_tool, P2PCondition1}}, if_ = {condition, {p2p_tool, P2PCondition1}},
then_ = {value, [#domain_ProviderRef{id = 1}]} then_ = {value, [#domain_P2PProviderRef{id = 1}]}
}, },
#domain_P2PProviderDecision{ #domain_P2PProviderDecision{
if_ = {condition, {p2p_tool, P2PCondition2}}, if_ = {condition, {p2p_tool, P2PCondition2}},
then_ = {value, [#domain_ProviderRef{id = 2}]} then_ = {value, [#domain_P2PProviderRef{id = 2}]}
} }
]}, ]},
BankCard1 = #domain_BankCard{ BankCard1 = #domain_BankCard{
@ -203,7 +203,7 @@ p2p_provider_test() ->
receiver = {bank_card, BankCard2} receiver = {bank_card, BankCard2}
} }
}, },
?assertEqual([{domain_ProviderRef, 1}], reduce_to_value(P2PProviderSelector, Vs, 1)). ?assertEqual([{domain_P2PProviderRef, 1}], reduce_to_value(P2PProviderSelector, Vs, 1)).
-spec p2p_allow_test() -> _. -spec p2p_allow_test() -> _.
p2p_allow_test() -> p2p_allow_test() ->

View File

@ -101,7 +101,7 @@ encode_decode_test() ->
provider = qiwi, provider = qiwi,
id = <<"digital_wallet_id">> id = <<"digital_wallet_id">>
}}, }},
payout_method => #domain_PayoutMethodRef{id = 1}, payout_method => #domain_PayoutMethodRef{id = any},
wallet_id => <<"wallet_id">>, wallet_id => <<"wallet_id">>,
p2p_tool => #domain_P2PTool{ p2p_tool => #domain_P2PTool{
sender = sender =

View File

@ -47,7 +47,7 @@ upsert(Revision, NewObjects) ->
ok = commit(Revision, Commit), ok = commit(Revision, Commit),
pm_domain:head(). pm_domain:head().
-spec reset(revision()) -> ok | no_return(). -spec reset(revision()) -> revision() | no_return().
reset(ToRevision) -> reset(ToRevision) ->
upsert(hg_domain:head(), maps:values(pm_domain:all(ToRevision))). upsert(hg_domain:head(), maps:values(pm_domain:all(ToRevision))).

View File

@ -97,8 +97,8 @@ construct_payment_method(?pmt(_Type, ?tkz_bank_card(Name, _)) = Ref) when is_ato
construct_payment_method(Name, Ref); construct_payment_method(Name, Ref);
construct_payment_method(?pmt(_Type, Name) = Ref) when is_atom(Name) -> construct_payment_method(?pmt(_Type, Name) = Ref) when is_atom(Name) ->
construct_payment_method(Name, Ref); construct_payment_method(Name, Ref);
construct_payment_method(?pmt(_Type, #domain_BankCardPaymentMethod{}) = Ref) -> construct_payment_method(?pmt(_Type, #domain_BankCardPaymentMethod{} = Card) = Ref) ->
construct_payment_method(Ref#domain_BankCardPaymentMethod.payment_system, Ref). construct_payment_method(Card#domain_BankCardPaymentMethod.payment_system, Ref).
construct_payment_method(Name, Ref) -> construct_payment_method(Name, Ref) ->
Def = erlang:atom_to_binary(Name, unicode), Def = erlang:atom_to_binary(Name, unicode),
@ -147,7 +147,7 @@ construct_inspector(Ref, Name, ProxyRef) ->
construct_inspector(Ref, Name, ProxyRef, Additional) -> construct_inspector(Ref, Name, ProxyRef, Additional) ->
construct_inspector(Ref, Name, ProxyRef, Additional, undefined). construct_inspector(Ref, Name, ProxyRef, Additional, undefined).
-spec construct_inspector(inspector(), name(), proxy(), Additional :: map(), risk_score()) -> -spec construct_inspector(inspector(), name(), proxy(), Additional :: map(), undefined | risk_score()) ->
{inspector, dmsl_domain_thrift:'InspectorObject'()}. {inspector, dmsl_domain_thrift:'InspectorObject'()}.
construct_inspector(Ref, Name, ProxyRef, Additional, FallBackScore) -> construct_inspector(Ref, Name, ProxyRef, Additional, FallBackScore) ->
{inspector, #domain_InspectorObject{ {inspector, #domain_InspectorObject{
@ -220,12 +220,12 @@ construct_system_account_set(Ref, Name, ?cur(CurrencyCode)) ->
}}. }}.
-spec construct_external_account_set(external_account_set()) -> -spec construct_external_account_set(external_account_set()) ->
{system_account_set, dmsl_domain_thrift:'ExternalAccountSetObject'()}. {external_account_set, dmsl_domain_thrift:'ExternalAccountSetObject'()}.
construct_external_account_set(Ref) -> construct_external_account_set(Ref) ->
construct_external_account_set(Ref, <<"Primaries">>, ?cur(<<"RUB">>)). construct_external_account_set(Ref, <<"Primaries">>, ?cur(<<"RUB">>)).
-spec construct_external_account_set(external_account_set(), name(), currency()) -> -spec construct_external_account_set(external_account_set(), name(), currency()) ->
{system_account_set, dmsl_domain_thrift:'ExternalAccountSetObject'()}. {external_account_set, dmsl_domain_thrift:'ExternalAccountSetObject'()}.
construct_external_account_set(Ref, Name, ?cur(CurrencyCode)) -> construct_external_account_set(Ref, Name, ?cur(CurrencyCode)) ->
ok = pm_context:save(pm_context:create()), ok = pm_context:save(pm_context:create()),
AccountID1 = pm_accounting:create_account(CurrencyCode), AccountID1 = pm_accounting:create_account(CurrencyCode),
@ -274,7 +274,7 @@ construct_criterion(Ref, Name, Pred) ->
} }
}}. }}.
-spec construct_term_set_hierarchy(term_set_hierarchy(), term_set_hierarchy(), term_set()) -> -spec construct_term_set_hierarchy(term_set_hierarchy(), undefined | term_set_hierarchy(), term_set()) ->
{term_set_hierarchy, dmsl_domain_thrift:'TermSetHierarchyObject'()}. {term_set_hierarchy, dmsl_domain_thrift:'TermSetHierarchyObject'()}.
construct_term_set_hierarchy(Ref, ParentRef, TermSet) -> construct_term_set_hierarchy(Ref, ParentRef, TermSet) ->
{term_set_hierarchy, #domain_TermSetHierarchyObject{ {term_set_hierarchy, #domain_TermSetHierarchyObject{
@ -290,8 +290,7 @@ construct_term_set_hierarchy(Ref, ParentRef, TermSet) ->
} }
}}. }}.
-spec construct_payment_routing_ruleset(payment_routing_ruleset(), name(), _) -> -spec construct_payment_routing_ruleset(payment_routing_ruleset(), name(), _) -> dmsl_domain_thrift:'DomainObject'().
dmsl_domain_thrift:'RoutingRulesetObject'().
construct_payment_routing_ruleset(Ref, Name, Decisions) -> construct_payment_routing_ruleset(Ref, Name, Decisions) ->
{routing_rules, #domain_RoutingRulesObject{ {routing_rules, #domain_RoutingRulesObject{
ref = Ref, ref = Ref,

View File

@ -47,7 +47,7 @@
-type app_name() :: atom(). -type app_name() :: atom().
-spec start_app(app_name()) -> [app_name()]. -spec start_app(app_name()) -> {[app_name()], map()}.
start_app(scoper = AppName) -> start_app(scoper = AppName) ->
{start_app(AppName, [ {start_app(AppName, [
{storage, scoper_storage_logger} {storage, scoper_storage_logger}
@ -226,12 +226,12 @@ start_app(cowboy = AppName, Env) ->
transport_opts := TransOpt, transport_opts := TransOpt,
proto_opts := ProtoOpt proto_opts := ProtoOpt
} = Env, } = Env,
cowboy:start_clear(Ref, [{num_acceptors, Count} | TransOpt], ProtoOpt), {ok, _} = cowboy:start_clear(Ref, [{num_acceptors, Count} | TransOpt], ProtoOpt),
[AppName]; [AppName];
start_app(AppName, Env) -> start_app(AppName, Env) ->
genlib_app:start_application_with(AppName, Env). genlib_app:start_application_with(AppName, Env).
-spec start_apps([app_name() | {app_name(), list()}]) -> [app_name()]. -spec start_apps([app_name() | {app_name(), list()}]) -> {[app_name()], map()}.
start_apps(Apps) -> start_apps(Apps) ->
lists:foldl( lists:foldl(
fun fun
@ -306,13 +306,8 @@ make_party_params() ->
} }
}. }.
-spec create_battle_ready_shop( -spec create_battle_ready_shop(category(), currency(), contract_tpl(), payment_institution(), Client :: pid()) ->
category(), shop_id().
currency(),
contract_tpl(),
payment_institution(),
Client :: pid()
) -> shop_id().
create_battle_ready_shop(Category, Currency, TemplateRef, PaymentInstitutionRef, Client) -> create_battle_ready_shop(Category, Currency, TemplateRef, PaymentInstitutionRef, Client) ->
ContractID = pm_utils:unique_id(), ContractID = pm_utils:unique_id(),
ContractParams = make_battle_ready_contract_params(TemplateRef, PaymentInstitutionRef), ContractParams = make_battle_ready_contract_params(TemplateRef, PaymentInstitutionRef),
@ -451,7 +446,7 @@ make_battle_ready_contract_params(TemplateRef, PaymentInstitutionRef) ->
payment_institution = PaymentInstitutionRef payment_institution = PaymentInstitutionRef
}. }.
-spec make_battle_ready_contractor() -> dmsl_payment_processing_thrift:'Contractor'(). -spec make_battle_ready_contractor() -> dmsl_domain_thrift:'Contractor'().
make_battle_ready_contractor() -> make_battle_ready_contractor() ->
BankAccount = #domain_RussianBankAccount{ BankAccount = #domain_RussianBankAccount{
account = <<"4276300010908312893">>, account = <<"4276300010908312893">>,
@ -489,7 +484,7 @@ make_battle_ready_payout_tool_params() ->
make_shop_details(Name) -> make_shop_details(Name) ->
make_shop_details(Name, undefined). make_shop_details(Name, undefined).
-spec make_shop_details(binary(), binary()) -> dmsl_domain_thrift:'ShopDetails'(). -spec make_shop_details(binary(), undefined | binary()) -> dmsl_domain_thrift:'ShopDetails'().
make_shop_details(Name, Description) -> make_shop_details(Name, Description) ->
#domain_ShopDetails{ #domain_ShopDetails{
name = Name, name = Name,

View File

@ -272,7 +272,7 @@ groups() ->
init_per_suite(C) -> init_per_suite(C) ->
{Apps, Ret} = pm_ct_helper:start_apps([woody, scoper, dmt_client, party_client, party_management, hellgate]), {Apps, Ret} = pm_ct_helper:start_apps([woody, scoper, dmt_client, party_client, party_management, hellgate]),
ok = pm_domain:insert(construct_domain_fixture()), ok = pm_domain:insert(construct_domain_fixture()),
[{root_url, maps:get(hellgate_root_url, Ret)}, {apps, Apps} | C]. [{root_url, maps:get(hellgate_root_url, Ret)}, {apps, Apps}] ++ C.
-spec end_per_suite(config()) -> _. -spec end_per_suite(config()) -> _.
end_per_suite(C) -> end_per_suite(C) ->
@ -299,7 +299,7 @@ end_per_group(_Group, C) ->
init_per_testcase(_Name, C) -> init_per_testcase(_Name, C) ->
C. C.
-spec end_per_testcase(test_case_name(), config()) -> config(). -spec end_per_testcase(test_case_name(), config()) -> _.
end_per_testcase(_Name, _C) -> end_per_testcase(_Name, _C) ->
ok. ok.

View File

@ -303,19 +303,19 @@ map_result_error({error, Error}) ->
-type event() :: dmsl_payment_processing_thrift:'Event'(). -type event() :: dmsl_payment_processing_thrift:'Event'().
-record(st, { -record(state, {
user_info :: user_info(), user_info :: user_info(),
party_id :: party_id(), party_id :: party_id(),
poller :: pm_client_event_poller:st(event()), poller :: pm_client_event_poller:st(event()),
client :: pm_client_api:t() client :: pm_client_api:t()
}). }).
-type st() :: #st{}. -type state() :: #state{}.
-type callref() :: {pid(), Tag :: reference()}. -type callref() :: {pid(), Tag :: reference()}.
-spec init({user_info(), party_id(), pm_client_api:t()}) -> {ok, st()}. -spec init({user_info(), party_id(), pm_client_api:t()}) -> {ok, state()}.
init({UserInfo, PartyID, ApiClient}) -> init({UserInfo, PartyID, ApiClient}) ->
{ok, #st{ {ok, #state{
user_info = UserInfo, user_info = UserInfo,
party_id = PartyID, party_id = PartyID,
client = ApiClient, client = ApiClient,
@ -325,18 +325,18 @@ init({UserInfo, PartyID, ApiClient}) ->
) )
}}. }}.
-spec handle_call(term(), callref(), st()) -> {reply, term(), st()} | {noreply, st()}. -spec handle_call(term(), callref(), state()) -> {reply, term(), state()} | {noreply, state()}.
handle_call({call, Function, Args0}, _From, St = #st{client = Client}) -> handle_call({call, Function, Args0}, _From, St = #state{client = Client}) ->
Args = [St#st.user_info, St#st.party_id | Args0], Args = [St#state.user_info, St#state.party_id | Args0],
{Result, ClientNext} = pm_client_api:call(party_management, Function, Args, Client), {Result, ClientNext} = pm_client_api:call(party_management, Function, Args, Client),
{reply, Result, St#st{client = ClientNext}}; {reply, Result, St#state{client = ClientNext}};
handle_call({call_without_party, Function, Args0}, _From, St = #st{client = Client}) -> handle_call({call_without_party, Function, Args0}, _From, St = #state{client = Client}) ->
Args = [St#st.user_info | Args0], Args = [St#state.user_info | Args0],
{Result, ClientNext} = pm_client_api:call(party_management, Function, Args, Client), {Result, ClientNext} = pm_client_api:call(party_management, Function, Args, Client),
{reply, Result, St#st{client = ClientNext}}; {reply, Result, St#state{client = ClientNext}};
handle_call({pull_event, Timeout}, _From, St = #st{poller = Poller, client = Client}) -> handle_call({pull_event, Timeout}, _From, St = #state{poller = Poller, client = Client}) ->
{Result, ClientNext, PollerNext} = pm_client_event_poller:poll(1, Timeout, Client, Poller), {Result, ClientNext, PollerNext} = pm_client_event_poller:poll(1, Timeout, Client, Poller),
StNext = St#st{poller = PollerNext, client = ClientNext}, StNext = St#state{poller = PollerNext, client = ClientNext},
case Result of case Result of
[] -> [] ->
{reply, timeout, StNext}; {reply, timeout, StNext};
@ -349,20 +349,20 @@ handle_call(Call, _From, State) ->
_ = logger:warning("unexpected call received: ~tp", [Call]), _ = logger:warning("unexpected call received: ~tp", [Call]),
{noreply, State}. {noreply, State}.
-spec handle_cast(_, st()) -> {noreply, st()}. -spec handle_cast(_, state()) -> {noreply, state()}.
handle_cast(Cast, State) -> handle_cast(Cast, State) ->
_ = logger:warning("unexpected cast received: ~tp", [Cast]), _ = logger:warning("unexpected cast received: ~tp", [Cast]),
{noreply, State}. {noreply, State}.
-spec handle_info(_, st()) -> {noreply, st()}. -spec handle_info(_, state()) -> {noreply, state()}.
handle_info(Info, State) -> handle_info(Info, State) ->
_ = logger:warning("unexpected info received: ~tp", [Info]), _ = logger:warning("unexpected info received: ~tp", [Info]),
{noreply, State}. {noreply, State}.
-spec terminate(Reason, st()) -> ok when Reason :: normal | shutdown | {shutdown, term()} | term(). -spec terminate(Reason, state()) -> ok when Reason :: normal | shutdown | {shutdown, term()} | term().
terminate(_Reason, _State) -> terminate(_Reason, _State) ->
ok. ok.
-spec code_change(Vsn | {down, Vsn}, st(), term()) -> {error, noimpl} when Vsn :: term(). -spec code_change(Vsn | {down, Vsn}, state(), term()) -> {error, noimpl} when Vsn :: term().
code_change(_OldVsn, _State, _Extra) -> code_change(_OldVsn, _State, _Extra) ->
{error, noimpl}. {error, noimpl}.

View File

@ -19,24 +19,24 @@
%% TODO: move it to the thrift runtime lib? %% TODO: move it to the thrift runtime lib?
-type thrift_type() :: -type thrift_type() ::
thrift_base_type() | thrift_base_type()
thrift_collection_type() | | thrift_collection_type()
thrift_enum_type() | | thrift_enum_type()
thrift_struct_type(). | thrift_struct_type().
-type thrift_base_type() :: -type thrift_base_type() ::
bool | bool
double | | double
i8 | | i8
i16 | | i16
i32 | | i32
i64 | | i64
string. | string.
-type thrift_collection_type() :: -type thrift_collection_type() ::
{list, thrift_type()} | {list, thrift_type()}
{set, thrift_type()} | | {set, thrift_type()}
{map, thrift_type(), thrift_type()}. | {map, thrift_type(), thrift_type()}.
-type thrift_enum_type() :: -type thrift_enum_type() ::
{enum, thrift_type_ref()}. {enum, thrift_type_ref()}.
@ -48,13 +48,14 @@
-type thrift_type_ref() :: {module(), Name :: atom()}. -type thrift_type_ref() :: {module(), Name :: atom()}.
-type thrift_struct_def() :: list({ -type thrift_struct_def() ::
Tag :: pos_integer(), list({
Requireness :: required | optional | undefined, Tag :: pos_integer(),
Type :: thrift_struct_type(), Requireness :: required | optional | undefined,
Name :: atom(), Type :: thrift_struct_type(),
Default :: any() Name :: atom(),
}). Default :: any()
}).
-type thrift_fun_ref() :: {Service :: atom(), Function :: atom()}. -type thrift_fun_ref() :: {Service :: atom(), Function :: atom()}.
-type thrift_fun_full_ref() :: {module(), thrift_fun_ref()}. -type thrift_fun_full_ref() :: {module(), thrift_fun_ref()}.

View File

@ -2,56 +2,43 @@
{elvis, [ {elvis, [
{config, [ {config, [
#{ #{
dirs => ["apps/*/src"], dirs => ["apps/*/**"],
filter => "*.erl", filter => "*.erl",
ignore => ["_thrift.erl$"],
rules => [ rules => [
{elvis_style, line_length, #{limit => 120, skip_comments => false}}, {elvis_text_style, line_length, #{limit => 120, skip_comments => false}},
{elvis_style, no_tabs}, {elvis_text_style, no_tabs},
{elvis_style, no_trailing_whitespace}, {elvis_text_style, no_trailing_whitespace},
{elvis_style, macro_module_names}, {elvis_style, macro_module_names},
{elvis_style, operator_spaces, #{rules => [{right, ","}, {right, "++"}, {left, "++"}]}}, {elvis_style, operator_spaces, #{rules => [{right, ","}, {right, "++"}, {left, "++"}]}},
{elvis_style, nesting_level, #{level => 3}}, {elvis_style, nesting_level, #{level => 4}},
{elvis_style, god_modules, #{ {elvis_style, god_modules, #{
limit => 30, limit => 30,
ignore => [hg_client_party, hg_invoice_payment, hg_client_invoicing, pm_client_party] ignore => [
hg_invoice_payment,
hg_client_invoicing,
hg_ct_helper,
hg_invoice_tests_SUITE,
pm_party_tests_SUITE,
pm_client_party
]
}}, }},
{elvis_style, no_if_expression}, {elvis_style, no_if_expression},
{elvis_style, invalid_dynamic_call, #{ignore => [ {elvis_style, invalid_dynamic_call, #{ignore => [hg_proto_utils, pm_proto_utils]}},
elvis,
hg_proto_utils, % Reads meta from autogenerated thrift modules
pm_proto_utils % Reads meta from autogenerated thrift modules
]}},
{elvis_style, used_ignored_variable}, {elvis_style, used_ignored_variable},
{elvis_style, no_behavior_info}, {elvis_style, no_behavior_info},
{elvis_style, module_naming_convention, #{regex => "^([a-z][a-z0-9]*_?)*(_SUITE)?$"}}, {elvis_style, module_naming_convention, #{regex => "^[a-z]([a-z0-9]*_?)*(_SUITE)?$"}},
{elvis_style, function_naming_convention, #{regex => "^([a-z][a-z0-9]*_?)*$"}}, {elvis_style, function_naming_convention, #{regex => "^[a-z]([a-z0-9]*_?)*$"}},
{elvis_style, state_record_and_type}, {elvis_style, state_record_and_type, #{ignore => []}},
{elvis_style, no_spec_with_records}, {elvis_style, no_spec_with_records},
{elvis_style, dont_repeat_yourself, #{min_complexity => 15}}, {elvis_style, dont_repeat_yourself, #{
{elvis_style, no_debug_call, #{ignore => [elvis, elvis_utils]}} min_complexity => 30,
] ignore => [
}, hg_routing,
#{ hg_routing_tests_SUITE,
dirs => ["apps/*/test"], hg_invoice_tests_SUITE
filter => "*.erl", ]
rules => [ }},
{elvis_style, line_length, #{limit => 120, skip_comments => false}}, {elvis_style, no_debug_call, #{}}
{elvis_style, no_tabs},
{elvis_style, no_trailing_whitespace},
{elvis_style, macro_module_names},
{elvis_style, operator_spaces, #{rules => [{right, ","}, {right, "++"}, {left, "++"}]}},
{elvis_style, nesting_level, #{level => 3}},
{elvis_style, no_if_expression},
{elvis_style, used_ignored_variable},
{elvis_style, no_behavior_info},
{elvis_style, module_naming_convention, #{regex => "^([a-z][a-z0-9]*_?)*(_SUITE)?$"}},
{elvis_style, function_naming_convention, #{regex => "^([a-z][a-z0-9]*_?)*$"}},
{elvis_style, no_spec_with_records},
{elvis_style, dont_repeat_yourself, #{min_complexity => 30, ignore => [
hg_ct_helper,
pm_ct_helper % will be moved to separate repo
]}}
] ]
}, },
#{ #{
@ -65,30 +52,21 @@
ruleset => elvis_config ruleset => elvis_config
}, },
#{ #{
dirs => ["apps", "apps/*"], dirs => [".", "apps/*/*"],
filter => "rebar.config", filter => "rebar.config",
rules => [ rules => [
{elvis_style, line_length, #{limit => 120, skip_comments => false}}, {elvis_text_style, line_length, #{limit => 120, skip_comments => false}},
{elvis_style, no_tabs}, {elvis_text_style, no_tabs},
{elvis_style, no_trailing_whitespace} {elvis_text_style, no_trailing_whitespace}
] ]
}, },
#{ #{
dirs => ["."], dirs => ["apps/**"],
filter => "rebar.config",
rules => [
{elvis_style, line_length, #{limit => 120, skip_comments => false}},
{elvis_style, no_tabs},
{elvis_style, no_trailing_whitespace}
]
},
#{
dirs => ["apps/*/src"],
filter => "*.app.src", filter => "*.app.src",
rules => [ rules => [
{elvis_style, line_length, #{limit => 120, skip_comments => false}}, {elvis_text_style, line_length, #{limit => 120, skip_comments => false}},
{elvis_style, no_tabs}, {elvis_text_style, no_tabs},
{elvis_style, no_trailing_whitespace} {elvis_text_style, no_trailing_whitespace}
] ]
} }
]} ]}

View File

@ -26,23 +26,24 @@
% Common project dependencies. % Common project dependencies.
{deps, [ {deps, [
{cache, "2.3.3"},
{prometheus, "4.6.0"}, {prometheus, "4.6.0"},
{prometheus_cowboy, "0.1.8"}, {prometheus_cowboy, "0.1.8"},
{gproc, "0.8.0"}, {gproc, "0.8.0"},
{genlib, {git, "https://github.com/rbkmoney/genlib.git", {branch, "master"}}}, {genlib, {git, "https://github.com/rbkmoney/genlib.git", {branch, "master"}}},
{woody, {git, "git@github.com:rbkmoney/woody_erlang.git", {branch, "master"}}}, {woody, {git, "https://github.com/rbkmoney/woody_erlang.git", {branch, "master"}}},
{woody_user_identity, {git, "git@github.com:rbkmoney/woody_erlang_user_identity.git", {branch, "master"}}}, {woody_user_identity, {git, "https://github.com/rbkmoney/woody_erlang_user_identity.git", {branch, "master"}}},
{damsel, {git, "git@github.com:rbkmoney/damsel.git", {branch, "release/erlang/master"}}}, {damsel, {git, "https://github.com/rbkmoney/damsel.git", {branch, "release/erlang/master"}}},
{payproc_errors, {git, "git@github.com:rbkmoney/payproc-errors-erlang.git", {branch, "master"}}}, {payproc_errors, {git, "https://github.com/rbkmoney/payproc-errors-erlang.git", {branch, "master"}}},
{mg_proto, {git, "git@github.com:rbkmoney/machinegun_proto.git", {branch, "master"}}}, {mg_proto, {git, "https://github.com/rbkmoney/machinegun_proto.git", {branch, "master"}}},
{shumpune_proto, {git, "git@github.com:rbkmoney/shumpune-proto.git", {branch, "master"}}}, {shumpune_proto,
{dmt_client, {git, "git@github.com:rbkmoney/dmt_client.git", {branch, "master"}}}, {git, "https://github.com/rbkmoney/shumpune-proto.git", {ref, "a0aed3bdce6aafdb832bbcde45e6278222b08c0b"}}},
{scoper, {git, "git@github.com:rbkmoney/scoper.git", {branch, "master"}}}, {dmt_client, {git, "https://github.com/rbkmoney/dmt_client.git", {branch, "master"}}},
{party_client, {git, "git@github.com:rbkmoney/party_client_erlang.git", {branch, "master"}}}, {scoper, {git, "https://github.com/rbkmoney/scoper.git", {branch, "master"}}},
{party_client, {git, "https://github.com/rbkmoney/party_client_erlang.git", {branch, "master"}}},
{how_are_you, {git, "https://github.com/rbkmoney/how_are_you.git", {branch, "master"}}}, {how_are_you, {git, "https://github.com/rbkmoney/how_are_you.git", {branch, "master"}}},
{erl_health, {git, "https://github.com/rbkmoney/erlang-health.git", {branch, "master"}}}, {erl_health, {git, "https://github.com/rbkmoney/erlang-health.git", {branch, "master"}}},
{fault_detector_proto, {git, "git@github.com:rbkmoney/fault-detector-proto.git", {branch, "master"}}}, {fault_detector_proto, {git, "https://github.com/rbkmoney/fault-detector-proto.git", {branch, "master"}}}
{cache, "2.3.2"}
]}. ]}.
{xref_checks, [ {xref_checks, [
@ -70,40 +71,37 @@
{profiles, [ {profiles, [
{prod, [ {prod, [
{deps, [ {deps, [
{logger_logstash_formatter,
{git, "https://github.com/rbkmoney/logger_logstash_formatter.git", {ref, "87e52c755"}}},
% for introspection on production % for introspection on production
{recon, "2.3.2"} {recon, "2.5.1"},
{logger_logstash_formatter,
{git, "https://github.com/rbkmoney/logger_logstash_formatter.git",
{ref, "87e52c755cf9e64d651e3ddddbfcd2ccd1db79db"}}}
]}, ]},
{relx, [ {relx, [
{release, {hellgate, "0.1"}, [ {release, {hellgate, "0.1"}, [
% tools for introspection
{recon, load}, {recon, load},
% debugger
{runtime_tools, load}, {runtime_tools, load},
% profiler
{tools, load}, {tools, load},
% log formatter
{logger_logstash_formatter, load}, {logger_logstash_formatter, load},
sasl, sasl,
hellgate hellgate
]}, ]},
{mode, minimal},
{sys_config, "./config/sys.config"}, {sys_config, "./config/sys.config"},
{vm_args, "./config/vm.args"}, {vm_args, "./config/vm.args"},
{mode, minimal},
{extended_start_script, true} {extended_start_script, true}
]} ]}
]}, ]},
{test, [ {test, [
{deps, []} {dialyzer, [{plt_extra_apps, [eunit, common_test, runtime_tools, damsel]}]}
]} ]}
]}. ]}.
{plugins, [ {plugins, [
{erlfmt, "0.7.0"} {erlfmt, "0.10.0"}
]}. ]}.
{erlfmt, [ {erlfmt, [
{print_width, 120}, {print_width, 120},
{files, "apps/*/{src,include,test}/*.{hrl,erl}"} {files, ["apps/*/{src,include,test}/*.{hrl,erl}", "rebar.config", "elvis.config"]}
]}. ]}.

View File

@ -1,8 +1,8 @@
{"1.2.0", {"1.2.0",
[{<<"accept">>,{pkg,<<"accept">>,<<"0.3.5">>},2}, [{<<"accept">>,{pkg,<<"accept">>,<<"0.3.5">>},2},
{<<"bear">>,{pkg,<<"bear">>,<<"0.8.7">>},2}, {<<"bear">>,{pkg,<<"bear">>,<<"0.8.7">>},2},
{<<"cache">>,{pkg,<<"cache">>,<<"2.3.2">>},0}, {<<"cache">>,{pkg,<<"cache">>,<<"2.3.3">>},0},
{<<"certifi">>,{pkg,<<"certifi">>,<<"2.5.1">>},2}, {<<"certifi">>,{pkg,<<"certifi">>,<<"2.5.3">>},2},
{<<"cg_mon">>, {<<"cg_mon">>,
{git,"https://github.com/rbkmoney/cg_mon.git", {git,"https://github.com/rbkmoney/cg_mon.git",
{ref,"5a87a37694e42b6592d3b4164ae54e0e87e24e18"}}, {ref,"5a87a37694e42b6592d3b4164ae54e0e87e24e18"}},
@ -10,11 +10,11 @@
{<<"cowboy">>,{pkg,<<"cowboy">>,<<"2.8.0">>},1}, {<<"cowboy">>,{pkg,<<"cowboy">>,<<"2.8.0">>},1},
{<<"cowlib">>,{pkg,<<"cowlib">>,<<"2.9.1">>},2}, {<<"cowlib">>,{pkg,<<"cowlib">>,<<"2.9.1">>},2},
{<<"damsel">>, {<<"damsel">>,
{git,"git@github.com:rbkmoney/damsel.git", {git,"https://github.com/rbkmoney/damsel.git",
{ref,"0eb2f7b6a1f521e76f439afaa2f2cee77411940e"}}, {ref,"9e0e884bfeaf8ad1cadd01802200f4e204cf27e3"}},
0}, 0},
{<<"dmt_client">>, {<<"dmt_client">>,
{git,"git@github.com:rbkmoney/dmt_client.git", {git,"https://github.com/rbkmoney/dmt_client.git",
{ref,"9e11f50e9c4db32fe46d6f8a2429ca060a3acd57"}}, {ref,"9e11f50e9c4db32fe46d6f8a2429ca060a3acd57"}},
0}, 0},
{<<"dmt_core">>, {<<"dmt_core">>,
@ -26,8 +26,8 @@
{ref,"982af88738ca062eea451436d830eef8c1fbe3f9"}}, {ref,"982af88738ca062eea451436d830eef8c1fbe3f9"}},
0}, 0},
{<<"fault_detector_proto">>, {<<"fault_detector_proto">>,
{git,"git@github.com:rbkmoney/fault-detector-proto.git", {git,"https://github.com/rbkmoney/fault-detector-proto.git",
{ref,"41d05a35dd6b71485455ed6a40f5e1ee948724ad"}}, {ref,"7087d8b22a718e0d8397ccfcb39f31b0f55779c9"}},
0}, 0},
{<<"folsom">>, {<<"folsom">>,
{git,"https://github.com/folsom-project/folsom.git", {git,"https://github.com/folsom-project/folsom.git",
@ -38,101 +38,97 @@
{ref,"4565a8d73f34a0b78cca32c9cd2b97d298bdadf8"}}, {ref,"4565a8d73f34a0b78cca32c9cd2b97d298bdadf8"}},
0}, 0},
{<<"gproc">>,{pkg,<<"gproc">>,<<"0.8.0">>},0}, {<<"gproc">>,{pkg,<<"gproc">>,<<"0.8.0">>},0},
{<<"hackney">>,{pkg,<<"hackney">>,<<"1.15.2">>},1}, {<<"hackney">>,{pkg,<<"hackney">>,<<"1.17.0">>},1},
{<<"how_are_you">>, {<<"how_are_you">>,
{git,"https://github.com/rbkmoney/how_are_you.git", {git,"https://github.com/rbkmoney/how_are_you.git",
{ref,"29f9d3d7c35f7a2d586c8571f572838df5ec91dd"}}, {ref,"29f9d3d7c35f7a2d586c8571f572838df5ec91dd"}},
0}, 0},
{<<"idna">>,{pkg,<<"idna">>,<<"6.0.0">>},2}, {<<"idna">>,{pkg,<<"idna">>,<<"6.1.1">>},2},
{<<"jsx">>,{pkg,<<"jsx">>,<<"3.0.0">>},1}, {<<"jsx">>,{pkg,<<"jsx">>,<<"3.0.0">>},1},
{<<"logger_logstash_formatter">>,
{git,"git@github.com:rbkmoney/logger_logstash_formatter.git",
{ref,"41e8e3cc3ba6d1f53f1f0a0c9eb07c32f0868205"}},
0},
{<<"metrics">>,{pkg,<<"metrics">>,<<"1.0.1">>},2}, {<<"metrics">>,{pkg,<<"metrics">>,<<"1.0.1">>},2},
{<<"mg_proto">>, {<<"mg_proto">>,
{git,"git@github.com:rbkmoney/machinegun_proto.git", {git,"https://github.com/rbkmoney/machinegun_proto.git",
{ref,"d814d6948d4ff13f6f41d12c6613f59c805750b2"}}, {ref,"d814d6948d4ff13f6f41d12c6613f59c805750b2"}},
0}, 0},
{<<"mimerl">>,{pkg,<<"mimerl">>,<<"1.2.0">>},2}, {<<"mimerl">>,{pkg,<<"mimerl">>,<<"1.2.0">>},2},
{<<"parse_trans">>,{pkg,<<"parse_trans">>,<<"3.3.0">>},3}, {<<"parse_trans">>,{pkg,<<"parse_trans">>,<<"3.3.1">>},2},
{<<"party_client">>, {<<"party_client">>,
{git,"git@github.com:rbkmoney/party_client_erlang.git", {git,"https://github.com/rbkmoney/party_client_erlang.git",
{ref,"d05c5f7b7797f914070b4e8b15870d915764eab0"}}, {ref,"255c54a72eb35183d4252de006f1eaee81c4f42c"}},
0}, 0},
{<<"payproc_errors">>, {<<"payproc_errors">>,
{git,"git@github.com:rbkmoney/payproc-errors-erlang.git", {git,"https://github.com/rbkmoney/payproc-errors-erlang.git",
{ref,"9c16b1fc683f01a14fc50440365662dbc2036d38"}}, {ref,"ebbfa3775c77d665f519d39ca9afa08c28d7733f"}},
0}, 0},
{<<"prometheus">>,{pkg,<<"prometheus">>,<<"4.6.0">>},0}, {<<"prometheus">>,{pkg,<<"prometheus">>,<<"4.6.0">>},0},
{<<"prometheus_cowboy">>,{pkg,<<"prometheus_cowboy">>,<<"0.1.8">>},0}, {<<"prometheus_cowboy">>,{pkg,<<"prometheus_cowboy">>,<<"0.1.8">>},0},
{<<"prometheus_httpd">>,{pkg,<<"prometheus_httpd">>,<<"2.1.11">>},1}, {<<"prometheus_httpd">>,{pkg,<<"prometheus_httpd">>,<<"2.1.11">>},1},
{<<"ranch">>,{pkg,<<"ranch">>,<<"1.7.1">>},2}, {<<"ranch">>,{pkg,<<"ranch">>,<<"1.7.1">>},2},
{<<"scoper">>, {<<"scoper">>,
{git,"git@github.com:rbkmoney/scoper.git", {git,"https://github.com/rbkmoney/scoper.git",
{ref,"89a973bf3cedc5a48c9fd89d719d25e79fe10027"}}, {ref,"89a973bf3cedc5a48c9fd89d719d25e79fe10027"}},
0}, 0},
{<<"shumpune_proto">>, {<<"shumpune_proto">>,
{git,"git@github.com:rbkmoney/shumpune-proto.git", {git,"https://github.com/rbkmoney/shumpune-proto.git",
{ref,"a0aed3bdce6aafdb832bbcde45e6278222b08c0b"}}, {ref,"a0aed3bdce6aafdb832bbcde45e6278222b08c0b"}},
0}, 0},
{<<"snowflake">>, {<<"snowflake">>,
{git,"https://github.com/rbkmoney/snowflake.git", {git,"https://github.com/rbkmoney/snowflake.git",
{ref,"7f379ad5e389e1c96389a8d60bae8117965d6a6d"}}, {ref,"de159486ef40cec67074afe71882bdc7f7deab72"}},
1}, 1},
{<<"ssl_verify_fun">>,{pkg,<<"ssl_verify_fun">>,<<"1.1.5">>},2}, {<<"ssl_verify_fun">>,{pkg,<<"ssl_verify_fun">>,<<"1.1.6">>},2},
{<<"thrift">>, {<<"thrift">>,
{git,"https://github.com/rbkmoney/thrift_erlang.git", {git,"https://github.com/rbkmoney/thrift_erlang.git",
{ref,"846a0819d9b6d09d0c31f160e33a78dbad2067b4"}}, {ref,"846a0819d9b6d09d0c31f160e33a78dbad2067b4"}},
1}, 1},
{<<"unicode_util_compat">>,{pkg,<<"unicode_util_compat">>,<<"0.4.1">>},3}, {<<"unicode_util_compat">>,{pkg,<<"unicode_util_compat">>,<<"0.7.0">>},2},
{<<"woody">>, {<<"woody">>,
{git,"git@github.com:rbkmoney/woody_erlang.git", {git,"https://github.com/rbkmoney/woody_erlang.git",
{ref,"58f56b462429ab1fee65e1bdb34b73512406ba00"}}, {ref,"f2cd30883d58eb1c3ab2172556956f757bc27e23"}},
0}, 0},
{<<"woody_user_identity">>, {<<"woody_user_identity">>,
{git,"git@github.com:rbkmoney/woody_erlang_user_identity.git", {git,"https://github.com/rbkmoney/woody_erlang_user_identity.git",
{ref,"a480762fea8d7c08f105fb39ca809482b6cb042e"}}, {ref,"a480762fea8d7c08f105fb39ca809482b6cb042e"}},
0}]}. 0}]}.
[ [
{pkg_hash,[ {pkg_hash,[
{<<"accept">>, <<"B33B127ABCA7CC948BBE6CAA4C263369ABF1347CFA9D8E699C6D214660F10CD1">>}, {<<"accept">>, <<"B33B127ABCA7CC948BBE6CAA4C263369ABF1347CFA9D8E699C6D214660F10CD1">>},
{<<"bear">>, <<"16264309AE5D005D03718A5C82641FCC259C9E8F09ADEB6FD79CA4271168656F">>}, {<<"bear">>, <<"16264309AE5D005D03718A5C82641FCC259C9E8F09ADEB6FD79CA4271168656F">>},
{<<"cache">>, <<"1E585CD9777C1F71E9038D61059D07438643C0022FDC6E2F7C2899B4A45C593E">>}, {<<"cache">>, <<"B23A5FE7095445A88412A6E614C933377E0137B44FFED77C9B3FEF1A731A20B2">>},
{<<"certifi">>, <<"867CE347F7C7D78563450A18A6A28A8090331E77FA02380B4A21962A65D36EE5">>}, {<<"certifi">>, <<"70BDD7E7188C804F3A30EE0E7C99655BC35D8AC41C23E12325F36AB449B70651">>},
{<<"cowboy">>, <<"F3DC62E35797ECD9AC1B50DB74611193C29815401E53BAC9A5C0577BD7BC667D">>}, {<<"cowboy">>, <<"F3DC62E35797ECD9AC1B50DB74611193C29815401E53BAC9A5C0577BD7BC667D">>},
{<<"cowlib">>, <<"61A6C7C50CF07FDD24B2F45B89500BB93B6686579B069A89F88CB211E1125C78">>}, {<<"cowlib">>, <<"61A6C7C50CF07FDD24B2F45B89500BB93B6686579B069A89F88CB211E1125C78">>},
{<<"gproc">>, <<"CEA02C578589C61E5341FCE149EA36CCEF236CC2ECAC8691FBA408E7EA77EC2F">>}, {<<"gproc">>, <<"CEA02C578589C61E5341FCE149EA36CCEF236CC2ECAC8691FBA408E7EA77EC2F">>},
{<<"hackney">>, <<"07E33C794F8F8964EE86CEBEC1A8ED88DB5070E52E904B8F12209773C1036085">>}, {<<"hackney">>, <<"717EA195FD2F898D9FE9F1CE0AFCC2621A41ECFE137FAE57E7FE6E9484B9AA99">>},
{<<"idna">>, <<"689C46CBCDF3524C44D5F3DDE8001F364CD7608A99556D8FBD8239A5798D4C10">>}, {<<"idna">>, <<"8A63070E9F7D0C62EB9D9FCB360A7DE382448200FBBD1B106CC96D3D8099DF8D">>},
{<<"jsx">>, <<"20A170ABD4335FC6DB24D5FAD1E5D677C55DADF83D1B20A8A33B5FE159892A39">>}, {<<"jsx">>, <<"20A170ABD4335FC6DB24D5FAD1E5D677C55DADF83D1B20A8A33B5FE159892A39">>},
{<<"metrics">>, <<"25F094DEA2CDA98213CECC3AEFF09E940299D950904393B2A29D191C346A8486">>}, {<<"metrics">>, <<"25F094DEA2CDA98213CECC3AEFF09E940299D950904393B2A29D191C346A8486">>},
{<<"mimerl">>, <<"67E2D3F571088D5CFD3E550C383094B47159F3EEE8FFA08E64106CDF5E981BE3">>}, {<<"mimerl">>, <<"67E2D3F571088D5CFD3E550C383094B47159F3EEE8FFA08E64106CDF5E981BE3">>},
{<<"parse_trans">>, <<"09765507A3C7590A784615CFD421D101AEC25098D50B89D7AA1D66646BC571C1">>}, {<<"parse_trans">>, <<"16328AB840CC09919BD10DAB29E431DA3AF9E9E7E7E6F0089DD5A2D2820011D8">>},
{<<"prometheus">>, <<"20510F381DB1CCAB818B4CF2FAC5FA6AB5CC91BC364A154399901C001465F46F">>}, {<<"prometheus">>, <<"20510F381DB1CCAB818B4CF2FAC5FA6AB5CC91BC364A154399901C001465F46F">>},
{<<"prometheus_cowboy">>, <<"CFCE0BC7B668C5096639084FCD873826E6220EA714BF60A716F5BD080EF2A99C">>}, {<<"prometheus_cowboy">>, <<"CFCE0BC7B668C5096639084FCD873826E6220EA714BF60A716F5BD080EF2A99C">>},
{<<"prometheus_httpd">>, <<"F616ED9B85B536B195D94104063025A91F904A4CFC20255363F49A197D96C896">>}, {<<"prometheus_httpd">>, <<"F616ED9B85B536B195D94104063025A91F904A4CFC20255363F49A197D96C896">>},
{<<"ranch">>, <<"6B1FAB51B49196860B733A49C07604465A47BDB78AA10C1C16A3D199F7F8C881">>}, {<<"ranch">>, <<"6B1FAB51B49196860B733A49C07604465A47BDB78AA10C1C16A3D199F7F8C881">>},
{<<"ssl_verify_fun">>, <<"6EAF7AD16CB568BB01753DBBD7A95FF8B91C7979482B95F38443FE2C8852A79B">>}, {<<"ssl_verify_fun">>, <<"CF344F5692C82D2CD7554F5EC8FD961548D4FD09E7D22F5B62482E5AEAEBD4B0">>},
{<<"unicode_util_compat">>, <<"D869E4C68901DD9531385BB0C8C40444EBF624E60B6962D95952775CAC5E90CD">>}]}, {<<"unicode_util_compat">>, <<"BC84380C9AB48177092F43AC89E4DFA2C6D62B40B8BD132B1059ECC7232F9A78">>}]},
{pkg_hash_ext,[ {pkg_hash_ext,[
{<<"accept">>, <<"11B18C220BCC2EAB63B5470C038EF10EB6783BCB1FCDB11AA4137DEFA5AC1BB8">>}, {<<"accept">>, <<"11B18C220BCC2EAB63B5470C038EF10EB6783BCB1FCDB11AA4137DEFA5AC1BB8">>},
{<<"bear">>, <<"534217DCE6A719D59E54FB0EB7A367900DBFC5F85757E8C1F94269DF383F6D9B">>}, {<<"bear">>, <<"534217DCE6A719D59E54FB0EB7A367900DBFC5F85757E8C1F94269DF383F6D9B">>},
{<<"cache">>, <<"E5559E1D71C5EF511C04E395F4B37AA71FA4A50ECC7365CA41DDEF0746FE907E">>}, {<<"cache">>, <<"44516CE6FA03594D3A2AF025DD3A87BFE711000EB730219E1DDEFC816E0AA2F4">>},
{<<"certifi">>, <<"805ABD97539CAF89EC6D4732C91E62BA9DA0CDA51AC462380BBD28EE697A8C42">>}, {<<"certifi">>, <<"ED516ACB3929B101208A9D700062D520F3953DA3B6B918D866106FFA980E1C10">>},
{<<"cowboy">>, <<"4643E4FBA74AC96D4D152C75803DE6FAD0B3FA5DF354C71AFDD6CBEEB15FAC8A">>}, {<<"cowboy">>, <<"4643E4FBA74AC96D4D152C75803DE6FAD0B3FA5DF354C71AFDD6CBEEB15FAC8A">>},
{<<"cowlib">>, <<"E4175DC240A70D996156160891E1C62238EDE1729E45740BDD38064DAD476170">>}, {<<"cowlib">>, <<"E4175DC240A70D996156160891E1C62238EDE1729E45740BDD38064DAD476170">>},
{<<"gproc">>, <<"580ADAFA56463B75263EF5A5DF4C86AF321F68694E7786CB057FD805D1E2A7DE">>}, {<<"gproc">>, <<"580ADAFA56463B75263EF5A5DF4C86AF321F68694E7786CB057FD805D1E2A7DE">>},
{<<"hackney">>, <<"E0100F8EF7D1124222C11AD362C857D3DF7CB5F4204054F9F0F4A728666591FC">>}, {<<"hackney">>, <<"64C22225F1EA8855F584720C0E5B3CD14095703AF1C9FBC845BA042811DC671C">>},
{<<"idna">>, <<"4BDD305EB64E18B0273864920695CB18D7A2021F31A11B9C5FBCD9A253F936E2">>}, {<<"idna">>, <<"92376EB7894412ED19AC475E4A86F7B413C1B9FBB5BD16DCCD57934157944CEA">>},
{<<"jsx">>, <<"37BECA0435F5CA8A2F45F76A46211E76418FBEF80C36F0361C249FC75059DC6D">>}, {<<"jsx">>, <<"37BECA0435F5CA8A2F45F76A46211E76418FBEF80C36F0361C249FC75059DC6D">>},
{<<"metrics">>, <<"69B09ADDDC4F74A40716AE54D140F93BEB0FB8978D8636EADED0C31B6F099F16">>}, {<<"metrics">>, <<"69B09ADDDC4F74A40716AE54D140F93BEB0FB8978D8636EADED0C31B6F099F16">>},
{<<"mimerl">>, <<"F278585650AA581986264638EBF698F8BB19DF297F66AD91B18910DFC6E19323">>}, {<<"mimerl">>, <<"F278585650AA581986264638EBF698F8BB19DF297F66AD91B18910DFC6E19323">>},
{<<"parse_trans">>, <<"17EF63ABDE837AD30680EA7F857DD9E7CED9476CDD7B0394432AF4BFC241B960">>}, {<<"parse_trans">>, <<"07CD9577885F56362D414E8C4C4E6BDF10D43A8767ABB92D24CBE8B24C54888B">>},
{<<"prometheus">>, <<"4905FD2992F8038ECCD7AA0CD22F40637ED618C0BED1F75C05AACEC15B7545DE">>}, {<<"prometheus">>, <<"4905FD2992F8038ECCD7AA0CD22F40637ED618C0BED1F75C05AACEC15B7545DE">>},
{<<"prometheus_cowboy">>, <<"BA286BECA9302618418892D37BCD5DC669A6CC001F4EB6D6AF85FF81F3F4F34C">>}, {<<"prometheus_cowboy">>, <<"BA286BECA9302618418892D37BCD5DC669A6CC001F4EB6D6AF85FF81F3F4F34C">>},
{<<"prometheus_httpd">>, <<"0BBE831452CFDF9588538EB2F570B26F30C348ADAE5E95A7D87F35A5910BCF92">>}, {<<"prometheus_httpd">>, <<"0BBE831452CFDF9588538EB2F570B26F30C348ADAE5E95A7D87F35A5910BCF92">>},
{<<"ranch">>, <<"451D8527787DF716D99DC36162FCA05934915DB0B6141BBDAC2EA8D3C7AFC7D7">>}, {<<"ranch">>, <<"451D8527787DF716D99DC36162FCA05934915DB0B6141BBDAC2EA8D3C7AFC7D7">>},
{<<"ssl_verify_fun">>, <<"13104D7897E38ED7F044C4DE953A6C28597D1C952075EB2E328BC6D6F2BFC496">>}, {<<"ssl_verify_fun">>, <<"BDB0D2471F453C88FF3908E7686F86F9BE327D065CC1EC16FA4540197EA04680">>},
{<<"unicode_util_compat">>, <<"1D1848C40487CDB0B30E8ED975E34E025860C02E419CB615D255849F3427439D">>}]} {<<"unicode_util_compat">>, <<"25EEE6D67DF61960CF6A794239566599B09E17E668D3700247BC498638152521">>}]}
]. ].