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.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_NAME := service-erlang
BASE_IMAGE_TAG := 54a794b4875ad79f90dba0a7708190b3b37d584f
BASE_IMAGE_TAG := 51bd5f25d00cbf75616e2d672601dfe7351dcaa4
# Build image tag to be used
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 \
release clean distclean format check_format
@ -49,7 +49,7 @@ xref: submodules
$(REBAR) xref
lint:
elvis rock
elvis rock -V
check_format:
$(REBAR) fmt -c
@ -58,7 +58,7 @@ format:
$(REBAR) fmt -w
dialyze: submodules
$(REBAR) dialyzer
$(REBAR) as test dialyzer
plt_update:
$(REBAR) dialyzer -u true -s false

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -8,12 +8,12 @@
-type retries_num() :: pos_integer() | infinity.
-type policy_spec() ::
{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(), timeout()} |
{intervals, [pos_integer(), ...]} |
{timecap, timeout(), policy_spec()} |
no_retry.
{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(), timeout()}
| {intervals, [pos_integer(), ...]}
| {timecap, timeout(), policy_spec()}
| no_retry.
-type strategy() :: genlib_retry:strategy().

View File

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

View File

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

View File

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

View File

@ -5,6 +5,7 @@
-define(ordset(Es), ordsets:from_list(Es)).
-define(match(Term), erlang:binary_to_term(erlang:term_to_binary(Term))).
-define(glob(), #domain_GlobalsRef{}).
-define(cur(ID), #domain_CurrencyRef{symbolic_code = ID}).
-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, 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'()}.
construct_inspector(Ref, Name, ProxyRef, Additional, FallBackScore) ->
{inspector, #domain_InspectorObject{
@ -218,12 +218,12 @@ construct_system_account_set(Ref, Name, ?cur(CurrencyCode)) ->
}}.
-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, <<"Primaries">>, ?cur(<<"RUB">>)).
-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)) ->
ok = hg_context:save(hg_context:create()),
AccountID1 = hg_accounting:create_account(CurrencyCode),
@ -266,8 +266,7 @@ construct_business_schedule(Ref) ->
construct_dummy_additional_info() ->
#domain_AdditionalTransactionInfo{rrn = <<"rrn">>, approval_code = <<"code">>}.
-spec construct_payment_routing_ruleset(payment_routing_ruleset(), name(), _) ->
dmsl_domain_thrift:'RoutingRulesetObject'().
-spec construct_payment_routing_ruleset(payment_routing_ruleset(), name(), _) -> dmsl_domain_thrift:'DomainObject'().
construct_payment_routing_ruleset(Ref, Name, Decisions) ->
{routing_rules, #domain_RoutingRulesObject{
ref = Ref,

View File

@ -79,7 +79,7 @@
-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(AppName, [
{storage, scoper_storage_logger}
@ -268,7 +268,7 @@ start_app(snowflake = AppName) ->
start_app(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) ->
#{
listener_ref := Ref,
@ -276,12 +276,12 @@ start_app(cowboy = AppName, Env) ->
transport_opts := TransOpt,
proto_opts := ProtoOpt
} = Env,
cowboy:start_clear(Ref, [{num_acceptors, Count} | TransOpt], ProtoOpt),
_ = cowboy:start_clear(Ref, [{num_acceptors, Count} | TransOpt], ProtoOpt),
[AppName];
start_app(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) ->
lists:foldl(
fun
@ -335,7 +335,6 @@ make_user_identity(UserID) ->
-type contract_id() :: dmsl_domain_thrift:'ContractID'().
-type contract_tpl() :: dmsl_domain_thrift:'ContractTemplateRef'().
-type shop_id() :: dmsl_domain_thrift:'ShopID'().
-type cost() :: integer() | {integer(), binary()}.
-type category() :: dmsl_domain_thrift:'CategoryRef'().
-type cash() :: dmsl_domain_thrift:'Cash'().
-type invoice_tpl_id() :: dmsl_domain_thrift:'InvoiceTemplateID'().
@ -346,7 +345,7 @@ make_user_identity(UserID) ->
-type lifetime_interval() :: dmsl_domain_thrift:'LifetimeInterval'().
-type invoice_details() :: dmsl_domain_thrift:'InvoiceDetails'().
-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 invoice_tpl_create_params() :: dmsl_payment_processing_thrift:'InvoiceTemplateCreateParams'().
-type invoice_tpl_update_params() :: dmsl_payment_processing_thrift:'InvoiceTemplateUpdateParams'().
@ -502,7 +501,7 @@ make_battle_ready_contract_params(TemplateRef, 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() ->
BankAccount = #domain_RussianBankAccount{
account = <<"4276300010908312893">>,
@ -540,20 +539,18 @@ make_battle_ready_payout_tool_params() ->
make_userinfo(PartyID) ->
#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, make_due_date(), Cost).
-spec make_invoice_params(party_id(), shop_id(), binary(), timestamp(), cost()) -> invoice_params().
make_invoice_params(PartyID, ShopID, Product, Due, Amount) when is_integer(Amount) ->
make_invoice_params(PartyID, ShopID, Product, Due, {Amount, <<"RUB">>});
make_invoice_params(PartyID, ShopID, Product, Due, {Amount, Currency}) ->
-spec make_invoice_params(party_id(), shop_id(), binary(), timestamp(), cash()) -> invoice_params().
make_invoice_params(PartyID, ShopID, Product, Due, Cost) ->
#payproc_InvoiceParams{
party_id = PartyID,
shop_id = ShopID,
details = make_invoice_details(Product),
due = hg_datetime:format_ts(Due),
cost = make_cash(Amount, Currency),
cost = Cost,
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, 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, 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) ->
#payproc_InvoiceWithTemplateParams{
template_id = TplID,
@ -596,7 +593,7 @@ make_invoice_tpl_create_params(PartyID, ShopID, Lifetime, Product, Details, Cont
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) ->
{product, #domain_InvoiceTemplateProduct{
product = Product,
@ -654,7 +651,7 @@ make_invoice_tpl_cost(range, {LowerType, LowerAm, LowerCur}, {UpperType, UpperAm
make_invoice_tpl_cost(unlim, _, _) ->
{unlim, #domain_InvoiceTemplateCostUnlimited{}}.
-spec make_cash(non_neg_integer(), currency()) -> cash().
-spec make_cash(integer(), currency()) -> cash().
make_cash(Amount, Currency) ->
#domain_Cash{
amount = Amount,
@ -679,15 +676,15 @@ make_invoice_context(Data) ->
make_shop_details(Name) ->
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) ->
#domain_ShopDetails{
name = Name,
description = Description
}.
-spec make_disposable_payment_resource({dmsl_domain_thrift:'PaymentTool'(), dmsl_domain_thrift:'SessionID'()}) ->
hg_domain_thrift:'DisposablePaymentResource'().
-spec make_disposable_payment_resource({dmsl_domain_thrift:'PaymentTool'(), dmsl_domain_thrift:'PaymentSessionID'()}) ->
dmsl_domain_thrift:'DisposablePaymentResource'().
make_disposable_payment_resource({PaymentTool, SessionID}) ->
#domain_DisposablePaymentResource{
payment_tool = PaymentTool,
@ -724,7 +721,7 @@ make_customer_params(PartyID, ShopID, EMail) ->
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'().
make_customer_binding_params(PaymentToolSession) ->
#payproc_CustomerBindingParams{

View File

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

View File

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

View File

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

View File

@ -36,7 +36,7 @@ all() ->
{group, history}
].
-spec groups() -> [{group_name(), [test_case_name()]}].
-spec groups() -> [{group_name(), list(), [test_case_name()]}].
groups() ->
[
{initial, [], [events_observed]},
@ -72,7 +72,7 @@ init_per_testcase(_Name, C) ->
create_api(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) ->
ok.

View File

@ -115,7 +115,7 @@ init_per_suite(C) ->
-spec end_per_suite(config()) -> _.
end_per_suite(C) ->
ok = hg_domain:cleanup(),
[application:stop(App) || App <- cfg(apps, C)],
_ = [application:stop(App) || App <- cfg(apps, C)],
exit(cfg(test_sup, C), shutdown).
-spec init_per_testcase(test_case_name(), config()) -> config().
@ -129,7 +129,7 @@ init_per_testcase(C) ->
ok = hg_context:save(hg_context:create()),
[{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) ->
ok = hg_context:cleanup().
@ -154,7 +154,7 @@ invoice_adjustment_capture(C) ->
Client = cfg(client, C),
ShopID = cfg(shop_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),
[?invoice_created(_Invoice)] = next_event(InvoiceID, Client),
PaymentID = process_payment(InvoiceID, make_payment_params(), Client),
@ -183,7 +183,7 @@ invoice_adjustment_cancel(C) ->
Client = cfg(client, C),
ShopID = cfg(shop_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),
[?invoice_created(_)] = next_event(InvoiceID, Client),
PaymentID = process_payment(InvoiceID, make_payment_params(), Client),
@ -213,7 +213,7 @@ invoice_adjustment_invalid_invoice_status(C) ->
Client = cfg(client, C),
ShopID = cfg(shop_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),
[?invoice_created(_)] = next_event(InvoiceID, Client),
PaymentID = process_payment(InvoiceID, make_payment_params(), Client),
@ -234,7 +234,7 @@ invoice_adjustment_existing_invoice_status(C) ->
Client = cfg(client, C),
ShopID = cfg(shop_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),
[?invoice_created(_)] = next_event(InvoiceID, Client),
PaymentID = process_payment(InvoiceID, make_payment_params(), Client),
@ -255,7 +255,7 @@ invoice_adjustment_invalid_adjustment_status(C) ->
Client = cfg(client, C),
ShopID = cfg(shop_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),
[?invoice_created(_)] = next_event(InvoiceID, Client),
PaymentID = process_payment(InvoiceID, make_payment_params(), Client),
@ -286,7 +286,7 @@ invoice_adjustment_payment_pending(C) ->
Client = cfg(client, C),
ShopID = cfg(shop_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),
[?invoice_created(_)] = next_event(InvoiceID, Client),
PaymentID = start_payment(InvoiceID, make_tds_payment_params(), Client),
@ -311,7 +311,7 @@ invoice_adjustment_pending_blocks_payment(C) ->
Client = cfg(client, C),
ShopID = cfg(shop_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),
[?invoice_created(_Invoice)] = next_event(InvoiceID, Client),
PaymentParams = make_payment_params({hold, capture}),
@ -341,7 +341,7 @@ invoice_adjustment_pending_no_invoice_expiration(C) ->
Client = cfg(client, C),
ShopID = cfg(shop_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),
[?invoice_created(_)] = next_event(InvoiceID, Client),
Paid = {paid, #domain_InvoicePaid{}},
@ -362,7 +362,7 @@ invoice_adjustment_invoice_expiration_after_capture(C) ->
Client = cfg(client, C),
ShopID = cfg(shop_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),
[?invoice_created(_)] = next_event(InvoiceID, Client),
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) ->
hg_ct_helper:make_invoice_params(PartyID, ShopID, Product, Cost).
@ -964,6 +967,8 @@ await_payment_process_interaction(InvoiceID, PaymentID, Client) ->
] = Events1,
UserInteraction.
-dialyzer({no_match, await_sessions_restarts/5}).
await_sessions_restarts(PaymentID, _Target, _InvoiceID, _Client, 0) ->
PaymentID;
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, Client} | C].
-spec end_per_testcase(test_case_name(), config()) -> config().
-spec end_per_testcase(test_case_name(), config()) -> _.
end_per_testcase(_Name, _C) ->
ok.
-spec create_invalid_party(config()) -> _ | no_return().
-spec create_invalid_party(config()) -> _.
create_invalid_party(C) ->
Client = cfg(client, C),
ShopID = cfg(shop_id, C),
@ -121,7 +121,7 @@ create_invalid_party(C) ->
Params = make_invoice_tpl_create_params(PartyID, ShopID),
{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) ->
Client = cfg(client, C),
ShopID = ?MISSING_SHOP_ID,
@ -129,7 +129,7 @@ create_invalid_shop(C) ->
Params = make_invoice_tpl_create_params(PartyID, ShopID),
{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) ->
PartyClient = cfg(party_client, C),
@ -145,7 +145,7 @@ create_invalid_party_status(C) ->
}} = create_invoice_tpl(C),
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) ->
PartyClient = cfg(party_client, C),
ShopID = cfg(shop_id, C),
@ -162,34 +162,34 @@ create_invalid_shop_status(C) ->
}} = create_invoice_tpl(C),
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) ->
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) ->
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) ->
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">>}),
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">>}),
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">>}),
create_invalid_cost(Cost4, currency, C),
ok = create_invalid_cost(Cost4, currency, C),
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) ->
ok = create_cost(make_cost(unlim, sale, "50%"), 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),
ok.
-spec get_invoice_template_anyhow(config()) -> _ | no_return().
-spec get_invoice_template_anyhow(config()) -> _.
get_invoice_template_anyhow(C) ->
Client = cfg(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),
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) ->
Client = cfg(client, C),
PartyClient = cfg(party_client, C),
@ -251,7 +251,7 @@ update_invalid_party_status(C) ->
}} = hg_client_invoice_templating:update(TplID, Diff, Client),
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) ->
Client = cfg(client, C),
PartyClient = cfg(party_client, C),
@ -272,41 +272,41 @@ update_invalid_shop_status(C) ->
}} = hg_client_invoice_templating:update(TplID, Diff, Client),
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) ->
Client = cfg(client, C),
?invoice_tpl(TplID) = create_invoice_tpl(C),
Cost = make_cost(fixed, -100, <<"RUB">>),
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) ->
Client = cfg(client, C),
?invoice_tpl(TplID) = create_invoice_tpl(C),
Cost = make_cost(fixed, 100, <<"KEK">>),
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) ->
Client = cfg(client, C),
?invoice_tpl(TplID) = create_invoice_tpl(C),
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">>}),
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">>}),
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">>}),
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">>}),
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) ->
Client = cfg(client, C),
PartyID = cfg(party_id, C),
@ -345,7 +345,7 @@ update_cost(Cost, Tpl, Client) ->
Client
).
-spec update_with_cart(config()) -> _ | no_return().
-spec update_with_cart(config()) -> _.
update_with_cart(C) ->
Client = cfg(client, C),
PartyID = cfg(party_id, C),
@ -379,7 +379,7 @@ update_with_cart(C) ->
} = hg_client_invoice_templating:update(TplID, Diff, 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) ->
Client = cfg(client, C),
PartyClient = cfg(party_client, C),
@ -397,7 +397,7 @@ delete_invalid_party_status(C) ->
}} = hg_client_invoice_templating:delete(TplID, Client),
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) ->
Client = cfg(client, C),
PartyClient = cfg(party_client, C),
@ -416,7 +416,7 @@ delete_invalid_shop_status(C) ->
}} = hg_client_invoice_templating:delete(TplID, Client),
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) ->
Client = cfg(client, 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:delete(TplID, Client).
-spec terms_retrieval(config()) -> _ | no_return().
-spec terms_retrieval(config()) -> _.
terms_retrieval(C) ->
Client = cfg(client, 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) ->
Details = hg_ct_helper:make_invoice_tpl_details(<<"RNGName">>, Cost),
Diff = make_invoice_tpl_update_params(#{details => Details}),
{exception, #'InvalidRequest'{
errors = [Error]
}} = hg_client_invoice_templating:update(TplID, Diff, Client).
{exception, #'InvalidRequest'{errors = [Error]}} = hg_client_invoice_templating:update(TplID, Diff, Client),
ok.
create_invalid_cost(Cost, 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) ->
Product = <<"rubberduck">>,
Lifetime = make_lifetime(0, 0, 2),
{exception, #'InvalidRequest'{
errors = [Error]
}} = create_invoice_tpl(Config, Product, Lifetime, Cost).
{exception, #'InvalidRequest'{errors = [Error]}} = create_invoice_tpl(Config, Product, Lifetime, Cost),
ok.
make_invoice_tpl_create_params(PartyID, ShopID) ->
Lifetime = make_lifetime(0, 0, 2),

View File

@ -433,7 +433,7 @@ init_per_suite(C) ->
-spec end_per_suite(config()) -> _.
end_per_suite(C) ->
ok = hg_domain:cleanup(),
[application:stop(App) || App <- cfg(apps, C)],
_ = [application:stop(App) || App <- cfg(apps, C)],
exit(cfg(test_sup, C), shutdown).
%% tests
@ -594,7 +594,7 @@ init_per_testcase(C) ->
ok = hg_context:save(hg_context:create()),
[{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) ->
ok = hg_context:cleanup(),
_ =
@ -612,7 +612,7 @@ invoice_creation_idempotency(C) ->
PartyID = cfg(party_id, C),
InvoiceID = hg_utils:unique_id(),
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{
id = InvoiceID,
external_id = ExternalID
@ -633,7 +633,7 @@ invalid_invoice_shop(C) ->
Client = cfg(client, C),
ShopID = genlib:unique(),
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).
-spec invalid_invoice_amount(config()) -> test_return().
@ -641,14 +641,14 @@ invalid_invoice_amount(C) ->
Client = cfg(client, C),
ShopID = cfg(shop_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'{
errors = [<<"Invalid amount">>]
}} = 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, _}}} =
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, _}}} =
hg_client_invoicing:create(InvoiceParams2, Client).
@ -657,7 +657,7 @@ invalid_invoice_currency(C) ->
Client = cfg(client, C),
ShopID = cfg(shop_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'{
errors = [<<"Invalid currency">>]
}} = hg_client_invoicing:create(InvoiceParams, Client).
@ -668,7 +668,7 @@ invalid_party_status(C) ->
PartyClient = cfg(party_client, C),
ShopID = cfg(shop_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),
InvoiceParamsWithTpl = make_invoice_params_tpl(TplID),
@ -696,7 +696,7 @@ invalid_shop_status(C) ->
PartyClient = cfg(party_client, C),
ShopID = cfg(shop_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),
InvoiceParamsWithTpl = make_invoice_params_tpl(TplID),
@ -878,7 +878,7 @@ invoice_cancellation(C) ->
Client = cfg(client, C),
ShopID = cfg(shop_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),
?invalid_invoice_status(_) = hg_client_invoicing:fulfill(InvoiceID, <<"perfect">>, 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)),
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),
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),
[?invoice_created(?invoice_w_status(?invoice_unpaid()))] = next_event(InvoiceID, Client),
%%
@ -1629,7 +1629,7 @@ party_revision_check(C) ->
party_revision_increment(ShopID, PartyClient),
% 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),
[?invoice_created(?invoice_w_status(?invoice_unpaid()))] = next_event(InvoiceID2, 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)),
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),
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),
[?invoice_created(?invoice_w_status(?invoice_unpaid()))] = next_event(InvoiceID, InvoicingClient),
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)),
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),
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),
[?invoice_created(?invoice_w_status(?invoice_unpaid()))] = next_event(InvoiceID, InvoicingClient),
?payment_state(
@ -2233,7 +2233,7 @@ terminal_cashflow_overrides_provider(C) ->
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)),
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),
_ = next_event(InvoiceID, 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) ->
hg_ct_helper:make_invoice_params(PartyID, ShopID, Product, Cost).
@ -4955,6 +4954,9 @@ make_invoice_context() ->
make_invoice_context(Ctx) ->
hg_ct_helper:make_invoice_context(Ctx).
make_cash(Amount) ->
make_cash(Amount, <<"RUB">>).
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) ->
Client = cfg(client, 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),
[?invoice_created(?invoice_w_status(?invoice_unpaid()))] = next_event(InvoiceID, Client),
InvoiceID.
@ -5492,7 +5494,7 @@ party_revision_check_init_params(C) ->
{PartyID, PartyClient, 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),
[?invoice_created(?invoice_w_status(?invoice_unpaid()) = ?invoice_w_revision(InvoiceRev))] =
next_event(InvoiceID, Client),

View File

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

View File

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

View File

@ -121,11 +121,12 @@ init_per_testcase(_, C) ->
},
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),
C.
-spec end_per_testcase(test_case_name(), config()) -> config().
-spec end_per_testcase(test_case_name(), config()) -> _.
end_per_testcase(_Name, _C) ->
ok = hg_context:cleanup(),
ok.

View File

@ -142,18 +142,13 @@ end_per_group(_GroupName, C) ->
-spec init_per_testcase(test_case_name(), config()) -> config().
init_per_testcase(_, C) ->
Ctx0 = hg_context:set_party_client(cfg(party_client, C), hg_context:create()),
Ctx1 = hg_context:set_user_identity(
#{
id => cfg(party_id, C),
realm => <<"internal">>
},
Ctx0
),
Ctx2 = hg_context:set_party_client_context(#{woody_context => woody_context:new()}, Ctx1),
Ctx1 = hg_context:set_user_identity(#{id => cfg(party_id, C), realm => <<"internal">>}, Ctx0),
PartyClientContext = party_client_context:create(#{}),
Ctx2 = hg_context:set_party_client_context(PartyClientContext, Ctx1),
ok = hg_context:save(Ctx2),
C.
-spec end_per_testcase(test_case_name(), config()) -> config().
-spec end_per_testcase(test_case_name(), config()) -> _.
end_per_testcase(_Name, _C) ->
ok = hg_context:cleanup(),
ok.
@ -370,12 +365,15 @@ prefer_alive(_C) ->
Revision = hg_domain:head(),
PaymentInstitution = hg_domain:get(Revision, {payment_institution, ?pinst(1)}),
{[
{{?prv(200), _}, _},
{{?prv(201), _}, _},
{{?prv(202), _}, _}
] = Routes,
RejectContext} = gather_routes(PaymentInstitution, VS, Revision),
{
[{{?prv(200), _}, _}, {{?prv(201), _}, _}, {{?prv(202), _}, _}] = Routes,
RejectContext
} = hg_routing:gather_routes(
payment,
PaymentInstitution,
VS,
Revision
),
{ProviderRefs, TerminalData} = lists:unzip(Routes),
@ -420,12 +418,15 @@ prefer_normal_conversion(_C) ->
Revision = hg_domain:head(),
PaymentInstitution = hg_domain:get(Revision, {payment_institution, ?pinst(1)}),
{[
{{?prv(200), _}, _},
{{?prv(201), _}, _},
{{?prv(202), _}, _}
] = Routes,
RC} = gather_routes(PaymentInstitution, VS, Revision),
{
[{{?prv(200), _}, _}, {{?prv(201), _}, _}, {{?prv(202), _}, _}] = Routes,
RC
} = hg_routing:gather_routes(
payment,
PaymentInstitution,
VS,
Revision
),
{Providers, TerminalData} = lists:unzip(Routes),
@ -469,12 +470,19 @@ prefer_higher_availability(_C) ->
Revision = hg_domain:head(),
PaymentInstitution = hg_domain:get(Revision, {payment_institution, ?pinst(1)}),
{[
{
[
{{?prv(200), _}, _},
{{?prv(201), _}, _},
{{?prv(202), _}, _}
] = Routes,
RC} = gather_routes(PaymentInstitution, VS, Revision),
RC
} = hg_routing:gather_routes(
payment,
PaymentInstitution,
VS,
Revision
),
{ProviderRefs, TerminalData} = lists:unzip(Routes),
@ -504,12 +512,19 @@ prefer_higher_conversion(_C) ->
Revision = hg_domain:head(),
PaymentInstitution = hg_domain:get(Revision, {payment_institution, ?pinst(1)}),
{[
{
[
{{?prv(200), _}, _},
{{?prv(201), _}, _},
{{?prv(202), _}, _}
] = Routes,
RC} = gather_routes(PaymentInstitution, VS, Revision),
RC
} = hg_routing:gather_routes(
payment,
PaymentInstitution,
VS,
Revision
),
{Providers, TerminalData} = lists:unzip(Routes),
@ -538,12 +553,19 @@ prefer_weight_over_availability(_C) ->
Revision = hg_domain:head(),
PaymentInstitution = hg_domain:get(Revision, {payment_institution, ?pinst(1)}),
{[
{
[
{{?prv(200), _}, _},
{{?prv(201), _}, _},
{{?prv(202), _}, _}
] = Routes,
RC} = gather_routes(PaymentInstitution, VS, Revision),
RC
} = hg_routing:gather_routes(
payment,
PaymentInstitution,
VS,
Revision
),
{Providers, TerminalData} = lists:unzip(Routes),
@ -567,16 +589,16 @@ prefer_weight_over_conversion(_C) ->
flow => instant
},
RiskScore = low,
Revision = hg_domain:head(),
PaymentInstitution = hg_domain:get(Revision, {payment_institution, ?pinst(1)}),
{[
{
[
{{?prv(200), _}, _},
{{?prv(201), _}, _},
{{?prv(202), _}, _}
] = Routes,
RC} = gather_routes(PaymentInstitution, VS, Revision),
RC
} = hg_routing:gather_routes(payment, PaymentInstitution, VS, Revision),
{Providers, TerminalData} = lists:unzip(Routes),
@ -643,8 +665,7 @@ routes_selected_with_risk_score(_C, RiskScore, PrvIDList) ->
},
Revision = hg_domain:head(),
PaymentInstitution = hg_domain:get(Revision, {payment_institution, ?pinst(1)}),
{SelectedProviders, _} = gather_routes(PaymentInstitution, VS, Revision),
{SelectedProviders, _} = hg_routing:gather_routes(payment, PaymentInstitution, VS, Revision),
%% Ensure list of selected provider ID match to given
PrvIDList = [P || {{?prv(P), _}, _} <- SelectedProviders],
ok.
@ -884,6 +905,7 @@ maybe_set_risk_coverage(false, _) ->
maybe_set_risk_coverage(true, V) ->
{value, V}.
-spec construct_domain_fixture() -> [hg_domain:object()].
construct_domain_fixture() ->
TestTermSet = #domain_TermSet{
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, #{}).
-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) ->
{ok, IP} = inet:parse_address(IPStr),
{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) ->
{Path, _Service} = Module:get_service_spec(),
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}}.
-spec do_call(woody:request(), woody_client:options(), woody_context:ctx(), genlib_retry:strategy()) ->
{ok, woody:result()} |
{exception, woody_error:business_error()}.
{ok, woody:result()}
| {exception, woody_error:business_error()}.
do_call(Request, Opts, Context, RetryStrategy) ->
try
woody_client:call(Request, Opts, Context)

View File

@ -76,7 +76,7 @@ get(ID, Client, EventRange) ->
delete(ID, Client) ->
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) ->
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'().
-record(st, {
-record(state, {
pollers :: #{id() => hg_client_event_poller:st(event())},
client :: hg_client_api:t()
}).
-type st() :: #st{}.
-type state() :: #state{}.
-type callref() :: {pid(), Tag :: reference()}.
-spec init(hg_client_api:t()) -> {ok, st()}.
-spec init(hg_client_api:t()) -> {ok, state()}.
init(ApiClient) ->
{ok, #st{pollers = #{}, client = ApiClient}}.
{ok, #state{pollers = #{}, client = ApiClient}}.
-spec handle_call(term(), callref(), st()) -> {reply, term(), st()} | {noreply, st()}.
handle_call({call, Function, Args}, _From, St = #st{client = Client}) ->
-spec handle_call(term(), callref(), state()) -> {reply, term(), state()} | {noreply, state()}.
handle_call({call, Function, Args}, _From, St = #state{client = Client}) ->
{Result, ClientNext} = hg_client_api:call(customer_management, Function, Args, Client),
{reply, Result, St#st{client = ClientNext}};
handle_call({pull_event, CustomerID, Timeout}, _From, St = #st{client = Client}) ->
{reply, Result, St#state{client = ClientNext}};
handle_call({pull_event, CustomerID, Timeout}, _From, St = #state{client = Client}) ->
Poller = get_poller(CustomerID, St),
{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
[] ->
{reply, timeout, StNext};
@ -135,31 +135,31 @@ handle_call(Call, _From, State) ->
_ = logger:warning("unexpected call received: ~tp", [Call]),
{noreply, State}.
-spec handle_cast(_, st()) -> {noreply, st()}.
-spec handle_cast(_, state()) -> {noreply, state()}.
handle_cast(Cast, State) ->
_ = logger:warning("unexpected cast received: ~tp", [Cast]),
{noreply, State}.
-spec handle_info(_, st()) -> {noreply, st()}.
-spec handle_info(_, state()) -> {noreply, state()}.
handle_info(Info, State) ->
_ = logger:warning("unexpected info received: ~tp", [Info]),
{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) ->
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) ->
{error, noimpl}.
%%
get_poller(ID, #st{pollers = Pollers}) ->
get_poller(ID, #state{pollers = Pollers}) ->
maps:get(ID, Pollers, construct_poller(ID)).
set_poller(ID, Poller, St = #st{pollers = Pollers}) ->
St#st{pollers = maps:put(ID, Poller, Pollers)}.
set_poller(ID, Poller, St = #state{pollers = Pollers}) ->
St#state{pollers = maps:put(ID, Poller, Pollers)}.
construct_poller(ID) ->
hg_client_event_poller:new(

View File

@ -74,19 +74,19 @@ pull_history(Client) ->
-type event() :: dmsl_payment_processing_thrift:'Event'().
-record(st, {
-record(state, {
poller :: hg_client_event_poller:st(event()),
client :: hg_client_api:t()
}).
-type st() :: #st{}.
-type state() :: #state{}.
-type callref() :: {pid(), Tag :: reference()}.
-define(SERVICE, payment_processing_eventsink).
-spec init(hg_client_api:t()) -> {ok, st()}.
-spec init(hg_client_api:t()) -> {ok, state()}.
init(ApiClient) ->
{ok, #st{
{ok, #state{
client = ApiClient,
poller = hg_client_event_poller:new(
{?SERVICE, 'GetEvents', []},
@ -94,10 +94,10 @@ init(ApiClient) ->
)
}}.
-spec handle_call(term(), callref(), st()) -> {reply, term(), st()} | {noreply, st()}.
handle_call({call, Function, Args}, _From, St = #st{client = Client}) ->
-spec handle_call(term(), callref(), state()) -> {reply, term(), state()} | {noreply, state()}.
handle_call({call, Function, Args}, _From, St = #state{client = 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) ->
{Result, StNext} = poll_events(N, Timeout, St),
{reply, Result, StNext};
@ -108,29 +108,29 @@ handle_call(Call, _From, State) ->
_ = logger:warning("unexpected call received: ~tp", [Call]),
{noreply, State}.
-spec handle_cast(_, st()) -> {noreply, st()}.
-spec handle_cast(_, state()) -> {noreply, state()}.
handle_cast(Cast, State) ->
_ = logger:warning("unexpected cast received: ~tp", [Cast]),
{noreply, State}.
-spec handle_info(_, st()) -> {noreply, st()}.
-spec handle_info(_, state()) -> {noreply, state()}.
handle_info(Info, State) ->
_ = logger:warning("unexpected info received: ~tp", [Info]),
{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) ->
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) ->
{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, St#st{client = ClientNext, poller = PollerNext}}.
{Result, St#state{client = ClientNext, poller = PollerNext}}.
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'().
-record(st, {
-record(state, {
user_info :: user_info(),
pollers :: #{id() => hg_client_event_poller:st(event())},
client :: hg_client_api:t()
}).
-type st() :: #st{}.
-type state() :: #state{}.
-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}) ->
{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()}.
handle_call({call, Function, Args}, _From, St = #st{user_info = UserInfo, client = Client}) ->
-spec handle_call(term(), callref(), state()) -> {reply, term(), state()} | {noreply, state()}.
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),
{reply, Result, St#st{client = ClientNext}};
handle_call({pull_event, InvoiceID, Timeout}, _From, St = #st{client = Client}) ->
{reply, Result, St#state{client = ClientNext}};
handle_call({pull_event, InvoiceID, Timeout}, _From, St = #state{client = Client}) ->
Poller = get_poller(InvoiceID, St),
{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
[] ->
{reply, timeout, StNext};
@ -123,31 +123,31 @@ handle_call(Call, _From, State) ->
_ = logger:warning("unexpected call received: ~tp", [Call]),
{noreply, State}.
-spec handle_cast(_, st()) -> {noreply, st()}.
-spec handle_cast(_, state()) -> {noreply, state()}.
handle_cast(Cast, State) ->
_ = logger:warning("unexpected cast received: ~tp", [Cast]),
{noreply, State}.
-spec handle_info(_, st()) -> {noreply, st()}.
-spec handle_info(_, state()) -> {noreply, state()}.
handle_info(Info, State) ->
_ = logger:warning("unexpected info received: ~tp", [Info]),
{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) ->
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) ->
{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)).
set_poller(ID, Poller, St = #st{pollers = Pollers}) ->
St#st{pollers = maps:put(ID, Poller, Pollers)}.
set_poller(ID, Poller, St = #state{pollers = Pollers}) ->
St#state{pollers = maps:put(ID, Poller, Pollers)}.
construct_poller(UserInfo, ID) ->
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()) ->
payment_adjustment() | woody_error:business_error().
create_payment_adjustment(InvoiceID, PaymentID, Params, Client) ->
Args = [InvoiceID, PaymentID, Params],
create_payment_adjustment(InvoiceID, PaymentID, ID, Client) ->
Args = [InvoiceID, PaymentID, ID],
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().
get_payment_adjustment(InvoiceID, PaymentID, Params, Client) ->
Args = [InvoiceID, PaymentID, Params],
@ -308,27 +308,27 @@ map_result_error({error, Error}) ->
-type event() :: dmsl_payment_processing_thrift:'Event'().
-record(st, {
-record(state, {
user_info :: user_info(),
pollers :: #{invoice_id() => hg_client_event_poller:st(event())},
client :: hg_client_api:t()
}).
-type st() :: #st{}.
-type state() :: #state{}.
-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}) ->
{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()}.
handle_call({call, Function, Args}, _From, St = #st{user_info = UserInfo, client = Client}) ->
-spec handle_call(term(), callref(), state()) -> {reply, term(), state()} | {noreply, state()}.
handle_call({call, Function, Args}, _From, St = #state{user_info = UserInfo, client = Client}) ->
{Result, ClientNext} = hg_client_api:call(invoicing, Function, [UserInfo | Args], Client),
{reply, Result, St#st{client = ClientNext}};
handle_call({pull_event, InvoiceID, Timeout}, _From, St = #st{client = Client}) ->
{reply, Result, St#state{client = ClientNext}};
handle_call({pull_event, InvoiceID, Timeout}, _From, St = #state{client = Client}) ->
Poller = get_poller(InvoiceID, St),
{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
[] ->
{reply, timeout, StNext};
@ -341,31 +341,31 @@ handle_call(Call, _From, State) ->
_ = logger:warning("unexpected call received: ~tp", [Call]),
{noreply, State}.
-spec handle_cast(_, st()) -> {noreply, st()}.
-spec handle_cast(_, state()) -> {noreply, state()}.
handle_cast(Cast, State) ->
_ = logger:warning("unexpected cast received: ~tp", [Cast]),
{noreply, State}.
-spec handle_info(_, st()) -> {noreply, st()}.
-spec handle_info(_, state()) -> {noreply, state()}.
handle_info(Info, State) ->
_ = logger:warning("unexpected info received: ~tp", [Info]),
{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) ->
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) ->
{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)).
set_poller(InvoiceID, Poller, St = #st{pollers = Pollers}) ->
St#st{pollers = maps:put(InvoiceID, Poller, Pollers)}.
set_poller(InvoiceID, Poller, St = #state{pollers = Pollers}) ->
St#state{pollers = maps:put(InvoiceID, Poller, Pollers)}.
construct_poller(UserInfo, InvoiceID) ->
hg_client_event_poller:new(

View File

@ -138,19 +138,19 @@ map_result_error({error, Error}) ->
-type event() :: dmsl_payment_processing_thrift:'Event'().
-record(st, {
-record(state, {
user_info :: user_info(),
party_id :: party_id(),
poller :: hg_client_event_poller:st(event()),
client :: hg_client_api:t()
}).
-type st() :: #st{}.
-type state() :: #state{}.
-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}) ->
{ok, #st{
{ok, #state{
user_info = UserInfo,
party_id = PartyID,
client = ApiClient,
@ -160,14 +160,14 @@ init({UserInfo, PartyID, ApiClient}) ->
)
}}.
-spec handle_call(term(), callref(), st()) -> {reply, term(), st()} | {noreply, st()}.
handle_call({call, Function, Args0}, _From, St = #st{client = Client}) ->
Args = [St#st.user_info, St#st.party_id | Args0],
-spec handle_call(term(), callref(), state()) -> {reply, term(), state()} | {noreply, state()}.
handle_call({call, Function, Args0}, _From, St = #state{client = Client}) ->
Args = [St#state.user_info, St#state.party_id | Args0],
{Result, ClientNext} = hg_client_api:call(party_management, Function, Args, Client),
{reply, Result, St#st{client = ClientNext}};
handle_call({pull_event, Timeout}, _From, St = #st{poller = Poller, client = Client}) ->
{reply, Result, St#state{client = ClientNext}};
handle_call({pull_event, Timeout}, _From, St = #state{poller = Poller, client = Client}) ->
{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
[] ->
{reply, timeout, StNext};
@ -180,20 +180,20 @@ handle_call(Call, _From, State) ->
_ = logger:warning("unexpected call received: ~tp", [Call]),
{noreply, State}.
-spec handle_cast(_, st()) -> {noreply, st()}.
-spec handle_cast(_, state()) -> {noreply, state()}.
handle_cast(Cast, State) ->
_ = logger:warning("unexpected cast received: ~tp", [Cast]),
{noreply, State}.
-spec handle_info(_, st()) -> {noreply, st()}.
-spec handle_info(_, state()) -> {noreply, state()}.
handle_info(Info, State) ->
_ = logger:warning("unexpected info received: ~tp", [Info]),
{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) ->
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) ->
{error, noimpl}.

View File

@ -107,33 +107,33 @@ map_result_error({error, Error}) ->
-type event() :: dmsl_payment_processing_thrift:'RecurrentPaymentToolEvent'().
-record(st, {
-record(state, {
pollers :: #{recurrent_paytool_id() => hg_client_event_poller:st(event())},
client :: hg_client_api:t()
}).
-type st() :: #st{}.
-type state() :: #state{}.
-type callref() :: {pid(), Tag :: reference()}.
-spec init(hg_client_api:t()) -> {ok, st()}.
-spec init(hg_client_api:t()) -> {ok, state()}.
init(ApiClient) ->
{ok, #st{pollers = #{}, client = ApiClient}}.
{ok, #state{pollers = #{}, client = ApiClient}}.
-spec handle_call(term(), callref(), st()) -> {reply, term(), st()} | {noreply, st()}.
handle_call({call, 'GetLastEventID' = Function, [] = Args}, _From, St = #st{client = Client}) ->
-spec handle_call(term(), callref(), state()) -> {reply, term(), state()} | {noreply, state()}.
handle_call({call, 'GetLastEventID' = Function, [] = Args}, _From, St = #state{client = Client}) ->
{Result, ClientNext} = hg_client_api:call(recurrent_paytool_eventsink, Function, Args, Client),
{reply, Result, St#st{client = ClientNext}};
handle_call({call, 'GetEvents' = Function, [_Range] = Args}, _From, St = #st{client = Client}) ->
{reply, Result, St#state{client = ClientNext}};
handle_call({call, 'GetEvents' = Function, [_Range] = Args}, _From, St = #state{client = Client}) ->
{Result, ClientNext} = hg_client_api:call(recurrent_paytool_eventsink, Function, Args, Client),
{reply, Result, St#st{client = ClientNext}};
handle_call({call, Function, Args}, _From, St = #st{client = Client}) ->
{reply, Result, St#state{client = ClientNext}};
handle_call({call, Function, Args}, _From, St = #state{client = Client}) ->
{Result, ClientNext} = hg_client_api:call(?SERVICE, Function, Args, Client),
{reply, Result, St#st{client = ClientNext}};
handle_call({pull_event, RecurrentPaytoolID, Timeout}, _From, St = #st{client = Client}) ->
{reply, Result, St#state{client = ClientNext}};
handle_call({pull_event, RecurrentPaytoolID, Timeout}, _From, St = #state{client = Client}) ->
Poller = get_poller(RecurrentPaytoolID, St),
{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
[] ->
{reply, timeout, StNext};
@ -146,31 +146,31 @@ handle_call(Call, _From, State) ->
_ = logger:warning("unexpected call received: ~tp", [Call]),
{noreply, State}.
-spec handle_cast(_, st()) -> {noreply, st()}.
-spec handle_cast(_, state()) -> {noreply, state()}.
handle_cast(Cast, State) ->
_ = logger:warning("unexpected cast received: ~tp", [Cast]),
{noreply, State}.
-spec handle_info(_, st()) -> {noreply, st()}.
-spec handle_info(_, state()) -> {noreply, state()}.
handle_info(Info, State) ->
_ = logger:warning("unexpected info received: ~tp", [Info]),
{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) ->
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) ->
{error, noimpl}.
%%
get_poller(ID, #st{pollers = Pollers}) ->
get_poller(ID, #state{pollers = Pollers}) ->
maps:get(ID, Pollers, construct_poller(ID)).
set_poller(ID, Poller, St = #st{pollers = Pollers}) ->
St#st{pollers = maps:put(ID, Poller, Pollers)}.
set_poller(ID, Poller, St = #state{pollers = Pollers}) ->
St#state{pollers = maps:put(ID, Poller, Pollers)}.
construct_poller(ID) ->
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?
-type thrift_type() ::
thrift_base_type() |
thrift_collection_type() |
thrift_enum_type() |
thrift_struct_type().
thrift_base_type()
| thrift_collection_type()
| thrift_enum_type()
| thrift_struct_type().
-type thrift_base_type() ::
bool |
double |
i8 |
i16 |
i32 |
i64 |
string.
bool
| double
| i8
| i16
| i32
| i64
| string.
-type thrift_collection_type() ::
{list, thrift_type()} |
{set, thrift_type()} |
{map, thrift_type(), thrift_type()}.
{list, thrift_type()}
| {set, thrift_type()}
| {map, thrift_type(), thrift_type()}.
-type thrift_enum_type() ::
{enum, thrift_type_ref()}.
@ -48,13 +48,14 @@
-type thrift_type_ref() :: {module(), Name :: atom()}.
-type thrift_struct_def() :: list({
Tag :: pos_integer(),
Requireness :: required | optional | undefined,
Type :: thrift_struct_type(),
Name :: atom(),
Default :: any()
}).
-type thrift_struct_def() ::
list({
Tag :: pos_integer(),
Requireness :: required | optional | undefined,
Type :: thrift_struct_type(),
Name :: atom(),
Default :: any()
}).
-type thrift_fun_ref() :: {Service :: atom(), Function :: atom()}.
-type thrift_fun_full_ref() :: {module(), thrift_fun_ref()}.

View File

@ -17,10 +17,10 @@
%% not exported from calendar module
-type rfc3339_time_unit() ::
microsecond |
millisecond |
nanosecond |
second.
microsecond
| millisecond
| nanosecond
| second.
-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
Signal ::
mg_proto_state_processing_thrift:'InitSignal'() |
mg_proto_state_processing_thrift:'TimeoutSignal'() |
mg_proto_state_processing_thrift:'RepairSignal'(),
mg_proto_state_processing_thrift:'InitSignal'()
| mg_proto_state_processing_thrift:'TimeoutSignal'()
| mg_proto_state_processing_thrift:'RepairSignal'(),
Result ::
mg_proto_state_processing_thrift:'SignalResult'().
dispatch_signal(Ns, #mg_stateproc_InitSignal{arg = Payload}, Machine) ->

View File

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

View File

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

View File

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

View File

@ -47,7 +47,7 @@ upsert(Revision, NewObjects) ->
ok = commit(Revision, Commit),
pm_domain:head().
-spec reset(revision()) -> ok | no_return().
-spec reset(revision()) -> revision() | no_return().
reset(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(?pmt(_Type, Name) = Ref) when is_atom(Name) ->
construct_payment_method(Name, Ref);
construct_payment_method(?pmt(_Type, #domain_BankCardPaymentMethod{}) = Ref) ->
construct_payment_method(Ref#domain_BankCardPaymentMethod.payment_system, Ref).
construct_payment_method(?pmt(_Type, #domain_BankCardPaymentMethod{} = Card) = Ref) ->
construct_payment_method(Card#domain_BankCardPaymentMethod.payment_system, Ref).
construct_payment_method(Name, Ref) ->
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, 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'()}.
construct_inspector(Ref, Name, ProxyRef, Additional, FallBackScore) ->
{inspector, #domain_InspectorObject{
@ -220,12 +220,12 @@ construct_system_account_set(Ref, Name, ?cur(CurrencyCode)) ->
}}.
-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, <<"Primaries">>, ?cur(<<"RUB">>)).
-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)) ->
ok = pm_context:save(pm_context:create()),
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'()}.
construct_term_set_hierarchy(Ref, ParentRef, TermSet) ->
{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(), _) ->
dmsl_domain_thrift:'RoutingRulesetObject'().
-spec construct_payment_routing_ruleset(payment_routing_ruleset(), name(), _) -> dmsl_domain_thrift:'DomainObject'().
construct_payment_routing_ruleset(Ref, Name, Decisions) ->
{routing_rules, #domain_RoutingRulesObject{
ref = Ref,

View File

@ -47,7 +47,7 @@
-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(AppName, [
{storage, scoper_storage_logger}
@ -226,12 +226,12 @@ start_app(cowboy = AppName, Env) ->
transport_opts := TransOpt,
proto_opts := ProtoOpt
} = Env,
cowboy:start_clear(Ref, [{num_acceptors, Count} | TransOpt], ProtoOpt),
{ok, _} = cowboy:start_clear(Ref, [{num_acceptors, Count} | TransOpt], ProtoOpt),
[AppName];
start_app(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) ->
lists:foldl(
fun
@ -306,13 +306,8 @@ make_party_params() ->
}
}.
-spec create_battle_ready_shop(
category(),
currency(),
contract_tpl(),
payment_institution(),
Client :: pid()
) -> shop_id().
-spec create_battle_ready_shop(category(), currency(), contract_tpl(), payment_institution(), Client :: pid()) ->
shop_id().
create_battle_ready_shop(Category, Currency, TemplateRef, PaymentInstitutionRef, Client) ->
ContractID = pm_utils:unique_id(),
ContractParams = make_battle_ready_contract_params(TemplateRef, PaymentInstitutionRef),
@ -451,7 +446,7 @@ make_battle_ready_contract_params(TemplateRef, 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() ->
BankAccount = #domain_RussianBankAccount{
account = <<"4276300010908312893">>,
@ -489,7 +484,7 @@ make_battle_ready_payout_tool_params() ->
make_shop_details(Name) ->
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) ->
#domain_ShopDetails{
name = Name,

View File

@ -272,7 +272,7 @@ groups() ->
init_per_suite(C) ->
{Apps, Ret} = pm_ct_helper:start_apps([woody, scoper, dmt_client, party_client, party_management, hellgate]),
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()) -> _.
end_per_suite(C) ->
@ -299,7 +299,7 @@ end_per_group(_Group, C) ->
init_per_testcase(_Name, C) ->
C.
-spec end_per_testcase(test_case_name(), config()) -> config().
-spec end_per_testcase(test_case_name(), config()) -> _.
end_per_testcase(_Name, _C) ->
ok.

View File

@ -303,19 +303,19 @@ map_result_error({error, Error}) ->
-type event() :: dmsl_payment_processing_thrift:'Event'().
-record(st, {
-record(state, {
user_info :: user_info(),
party_id :: party_id(),
poller :: pm_client_event_poller:st(event()),
client :: pm_client_api:t()
}).
-type st() :: #st{}.
-type state() :: #state{}.
-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}) ->
{ok, #st{
{ok, #state{
user_info = UserInfo,
party_id = PartyID,
client = ApiClient,
@ -325,18 +325,18 @@ init({UserInfo, PartyID, ApiClient}) ->
)
}}.
-spec handle_call(term(), callref(), st()) -> {reply, term(), st()} | {noreply, st()}.
handle_call({call, Function, Args0}, _From, St = #st{client = Client}) ->
Args = [St#st.user_info, St#st.party_id | Args0],
-spec handle_call(term(), callref(), state()) -> {reply, term(), state()} | {noreply, state()}.
handle_call({call, Function, Args0}, _From, St = #state{client = Client}) ->
Args = [St#state.user_info, St#state.party_id | Args0],
{Result, ClientNext} = pm_client_api:call(party_management, Function, Args, Client),
{reply, Result, St#st{client = ClientNext}};
handle_call({call_without_party, Function, Args0}, _From, St = #st{client = Client}) ->
Args = [St#st.user_info | Args0],
{reply, Result, St#state{client = ClientNext}};
handle_call({call_without_party, Function, Args0}, _From, St = #state{client = Client}) ->
Args = [St#state.user_info | Args0],
{Result, ClientNext} = pm_client_api:call(party_management, Function, Args, Client),
{reply, Result, St#st{client = ClientNext}};
handle_call({pull_event, Timeout}, _From, St = #st{poller = Poller, client = Client}) ->
{reply, Result, St#state{client = ClientNext}};
handle_call({pull_event, Timeout}, _From, St = #state{poller = Poller, client = Client}) ->
{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
[] ->
{reply, timeout, StNext};
@ -349,20 +349,20 @@ handle_call(Call, _From, State) ->
_ = logger:warning("unexpected call received: ~tp", [Call]),
{noreply, State}.
-spec handle_cast(_, st()) -> {noreply, st()}.
-spec handle_cast(_, state()) -> {noreply, state()}.
handle_cast(Cast, State) ->
_ = logger:warning("unexpected cast received: ~tp", [Cast]),
{noreply, State}.
-spec handle_info(_, st()) -> {noreply, st()}.
-spec handle_info(_, state()) -> {noreply, state()}.
handle_info(Info, State) ->
_ = logger:warning("unexpected info received: ~tp", [Info]),
{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) ->
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) ->
{error, noimpl}.

View File

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

View File

@ -2,56 +2,43 @@
{elvis, [
{config, [
#{
dirs => ["apps/*/src"],
dirs => ["apps/*/**"],
filter => "*.erl",
ignore => ["_thrift.erl$"],
rules => [
{elvis_style, line_length, #{limit => 120, skip_comments => false}},
{elvis_style, no_tabs},
{elvis_style, no_trailing_whitespace},
{elvis_text_style, line_length, #{limit => 120, skip_comments => false}},
{elvis_text_style, no_tabs},
{elvis_text_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, nesting_level, #{level => 4}},
{elvis_style, god_modules, #{
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, invalid_dynamic_call, #{ignore => [
elvis,
hg_proto_utils, % Reads meta from autogenerated thrift modules
pm_proto_utils % Reads meta from autogenerated thrift modules
]}},
{elvis_style, invalid_dynamic_call, #{ignore => [hg_proto_utils, pm_proto_utils]}},
{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, state_record_and_type},
{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, state_record_and_type, #{ignore => []}},
{elvis_style, no_spec_with_records},
{elvis_style, dont_repeat_yourself, #{min_complexity => 15}},
{elvis_style, no_debug_call, #{ignore => [elvis, elvis_utils]}}
]
},
#{
dirs => ["apps/*/test"],
filter => "*.erl",
rules => [
{elvis_style, line_length, #{limit => 120, skip_comments => false}},
{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
]}}
{elvis_style, dont_repeat_yourself, #{
min_complexity => 30,
ignore => [
hg_routing,
hg_routing_tests_SUITE,
hg_invoice_tests_SUITE
]
}},
{elvis_style, no_debug_call, #{}}
]
},
#{
@ -65,30 +52,21 @@
ruleset => elvis_config
},
#{
dirs => ["apps", "apps/*"],
dirs => [".", "apps/*/*"],
filter => "rebar.config",
rules => [
{elvis_style, line_length, #{limit => 120, skip_comments => false}},
{elvis_style, no_tabs},
{elvis_style, no_trailing_whitespace}
{elvis_text_style, line_length, #{limit => 120, skip_comments => false}},
{elvis_text_style, no_tabs},
{elvis_text_style, no_trailing_whitespace}
]
},
#{
dirs => ["."],
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"],
dirs => ["apps/**"],
filter => "*.app.src",
rules => [
{elvis_style, line_length, #{limit => 120, skip_comments => false}},
{elvis_style, no_tabs},
{elvis_style, no_trailing_whitespace}
{elvis_text_style, line_length, #{limit => 120, skip_comments => false}},
{elvis_text_style, no_tabs},
{elvis_text_style, no_trailing_whitespace}
]
}
]}

View File

@ -26,23 +26,24 @@
% Common project dependencies.
{deps, [
{cache, "2.3.3"},
{prometheus, "4.6.0"},
{prometheus_cowboy, "0.1.8"},
{gproc, "0.8.0"},
{genlib, {git, "https://github.com/rbkmoney/genlib.git", {branch, "master"}}},
{woody, {git, "git@github.com:rbkmoney/woody_erlang.git", {branch, "master"}}},
{woody_user_identity, {git, "git@github.com:rbkmoney/woody_erlang_user_identity.git", {branch, "master"}}},
{damsel, {git, "git@github.com:rbkmoney/damsel.git", {branch, "release/erlang/master"}}},
{payproc_errors, {git, "git@github.com:rbkmoney/payproc-errors-erlang.git", {branch, "master"}}},
{mg_proto, {git, "git@github.com:rbkmoney/machinegun_proto.git", {branch, "master"}}},
{shumpune_proto, {git, "git@github.com:rbkmoney/shumpune-proto.git", {branch, "master"}}},
{dmt_client, {git, "git@github.com:rbkmoney/dmt_client.git", {branch, "master"}}},
{scoper, {git, "git@github.com:rbkmoney/scoper.git", {branch, "master"}}},
{party_client, {git, "git@github.com:rbkmoney/party_client_erlang.git", {branch, "master"}}},
{woody, {git, "https://github.com/rbkmoney/woody_erlang.git", {branch, "master"}}},
{woody_user_identity, {git, "https://github.com/rbkmoney/woody_erlang_user_identity.git", {branch, "master"}}},
{damsel, {git, "https://github.com/rbkmoney/damsel.git", {branch, "release/erlang/master"}}},
{payproc_errors, {git, "https://github.com/rbkmoney/payproc-errors-erlang.git", {branch, "master"}}},
{mg_proto, {git, "https://github.com/rbkmoney/machinegun_proto.git", {branch, "master"}}},
{shumpune_proto,
{git, "https://github.com/rbkmoney/shumpune-proto.git", {ref, "a0aed3bdce6aafdb832bbcde45e6278222b08c0b"}}},
{dmt_client, {git, "https://github.com/rbkmoney/dmt_client.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"}}},
{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"}}},
{cache, "2.3.2"}
{fault_detector_proto, {git, "https://github.com/rbkmoney/fault-detector-proto.git", {branch, "master"}}}
]}.
{xref_checks, [
@ -70,40 +71,37 @@
{profiles, [
{prod, [
{deps, [
{logger_logstash_formatter,
{git, "https://github.com/rbkmoney/logger_logstash_formatter.git", {ref, "87e52c755"}}},
% 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, [
{release, {hellgate, "0.1"}, [
% tools for introspection
{recon, load},
% debugger
{runtime_tools, load},
% profiler
{tools, load},
% log formatter
{logger_logstash_formatter, load},
sasl,
hellgate
]},
{mode, minimal},
{sys_config, "./config/sys.config"},
{vm_args, "./config/vm.args"},
{mode, minimal},
{extended_start_script, true}
]}
]},
{test, [
{deps, []}
{dialyzer, [{plt_extra_apps, [eunit, common_test, runtime_tools, damsel]}]}
]}
]}.
{plugins, [
{erlfmt, "0.7.0"}
{erlfmt, "0.10.0"}
]}.
{erlfmt, [
{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",
[{<<"accept">>,{pkg,<<"accept">>,<<"0.3.5">>},2},
{<<"bear">>,{pkg,<<"bear">>,<<"0.8.7">>},2},
{<<"cache">>,{pkg,<<"cache">>,<<"2.3.2">>},0},
{<<"certifi">>,{pkg,<<"certifi">>,<<"2.5.1">>},2},
{<<"cache">>,{pkg,<<"cache">>,<<"2.3.3">>},0},
{<<"certifi">>,{pkg,<<"certifi">>,<<"2.5.3">>},2},
{<<"cg_mon">>,
{git,"https://github.com/rbkmoney/cg_mon.git",
{ref,"5a87a37694e42b6592d3b4164ae54e0e87e24e18"}},
@ -10,11 +10,11 @@
{<<"cowboy">>,{pkg,<<"cowboy">>,<<"2.8.0">>},1},
{<<"cowlib">>,{pkg,<<"cowlib">>,<<"2.9.1">>},2},
{<<"damsel">>,
{git,"git@github.com:rbkmoney/damsel.git",
{ref,"0eb2f7b6a1f521e76f439afaa2f2cee77411940e"}},
{git,"https://github.com/rbkmoney/damsel.git",
{ref,"9e0e884bfeaf8ad1cadd01802200f4e204cf27e3"}},
0},
{<<"dmt_client">>,
{git,"git@github.com:rbkmoney/dmt_client.git",
{git,"https://github.com/rbkmoney/dmt_client.git",
{ref,"9e11f50e9c4db32fe46d6f8a2429ca060a3acd57"}},
0},
{<<"dmt_core">>,
@ -26,8 +26,8 @@
{ref,"982af88738ca062eea451436d830eef8c1fbe3f9"}},
0},
{<<"fault_detector_proto">>,
{git,"git@github.com:rbkmoney/fault-detector-proto.git",
{ref,"41d05a35dd6b71485455ed6a40f5e1ee948724ad"}},
{git,"https://github.com/rbkmoney/fault-detector-proto.git",
{ref,"7087d8b22a718e0d8397ccfcb39f31b0f55779c9"}},
0},
{<<"folsom">>,
{git,"https://github.com/folsom-project/folsom.git",
@ -38,101 +38,97 @@
{ref,"4565a8d73f34a0b78cca32c9cd2b97d298bdadf8"}},
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">>,
{git,"https://github.com/rbkmoney/how_are_you.git",
{ref,"29f9d3d7c35f7a2d586c8571f572838df5ec91dd"}},
0},
{<<"idna">>,{pkg,<<"idna">>,<<"6.0.0">>},2},
{<<"idna">>,{pkg,<<"idna">>,<<"6.1.1">>},2},
{<<"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},
{<<"mg_proto">>,
{git,"git@github.com:rbkmoney/machinegun_proto.git",
{git,"https://github.com/rbkmoney/machinegun_proto.git",
{ref,"d814d6948d4ff13f6f41d12c6613f59c805750b2"}},
0},
{<<"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">>,
{git,"git@github.com:rbkmoney/party_client_erlang.git",
{ref,"d05c5f7b7797f914070b4e8b15870d915764eab0"}},
{git,"https://github.com/rbkmoney/party_client_erlang.git",
{ref,"255c54a72eb35183d4252de006f1eaee81c4f42c"}},
0},
{<<"payproc_errors">>,
{git,"git@github.com:rbkmoney/payproc-errors-erlang.git",
{ref,"9c16b1fc683f01a14fc50440365662dbc2036d38"}},
{git,"https://github.com/rbkmoney/payproc-errors-erlang.git",
{ref,"ebbfa3775c77d665f519d39ca9afa08c28d7733f"}},
0},
{<<"prometheus">>,{pkg,<<"prometheus">>,<<"4.6.0">>},0},
{<<"prometheus_cowboy">>,{pkg,<<"prometheus_cowboy">>,<<"0.1.8">>},0},
{<<"prometheus_httpd">>,{pkg,<<"prometheus_httpd">>,<<"2.1.11">>},1},
{<<"ranch">>,{pkg,<<"ranch">>,<<"1.7.1">>},2},
{<<"scoper">>,
{git,"git@github.com:rbkmoney/scoper.git",
{git,"https://github.com/rbkmoney/scoper.git",
{ref,"89a973bf3cedc5a48c9fd89d719d25e79fe10027"}},
0},
{<<"shumpune_proto">>,
{git,"git@github.com:rbkmoney/shumpune-proto.git",
{git,"https://github.com/rbkmoney/shumpune-proto.git",
{ref,"a0aed3bdce6aafdb832bbcde45e6278222b08c0b"}},
0},
{<<"snowflake">>,
{git,"https://github.com/rbkmoney/snowflake.git",
{ref,"7f379ad5e389e1c96389a8d60bae8117965d6a6d"}},
{ref,"de159486ef40cec67074afe71882bdc7f7deab72"}},
1},
{<<"ssl_verify_fun">>,{pkg,<<"ssl_verify_fun">>,<<"1.1.5">>},2},
{<<"ssl_verify_fun">>,{pkg,<<"ssl_verify_fun">>,<<"1.1.6">>},2},
{<<"thrift">>,
{git,"https://github.com/rbkmoney/thrift_erlang.git",
{ref,"846a0819d9b6d09d0c31f160e33a78dbad2067b4"}},
1},
{<<"unicode_util_compat">>,{pkg,<<"unicode_util_compat">>,<<"0.4.1">>},3},
{<<"unicode_util_compat">>,{pkg,<<"unicode_util_compat">>,<<"0.7.0">>},2},
{<<"woody">>,
{git,"git@github.com:rbkmoney/woody_erlang.git",
{ref,"58f56b462429ab1fee65e1bdb34b73512406ba00"}},
{git,"https://github.com/rbkmoney/woody_erlang.git",
{ref,"f2cd30883d58eb1c3ab2172556956f757bc27e23"}},
0},
{<<"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"}},
0}]}.
[
{pkg_hash,[
{<<"accept">>, <<"B33B127ABCA7CC948BBE6CAA4C263369ABF1347CFA9D8E699C6D214660F10CD1">>},
{<<"bear">>, <<"16264309AE5D005D03718A5C82641FCC259C9E8F09ADEB6FD79CA4271168656F">>},
{<<"cache">>, <<"1E585CD9777C1F71E9038D61059D07438643C0022FDC6E2F7C2899B4A45C593E">>},
{<<"certifi">>, <<"867CE347F7C7D78563450A18A6A28A8090331E77FA02380B4A21962A65D36EE5">>},
{<<"cache">>, <<"B23A5FE7095445A88412A6E614C933377E0137B44FFED77C9B3FEF1A731A20B2">>},
{<<"certifi">>, <<"70BDD7E7188C804F3A30EE0E7C99655BC35D8AC41C23E12325F36AB449B70651">>},
{<<"cowboy">>, <<"F3DC62E35797ECD9AC1B50DB74611193C29815401E53BAC9A5C0577BD7BC667D">>},
{<<"cowlib">>, <<"61A6C7C50CF07FDD24B2F45B89500BB93B6686579B069A89F88CB211E1125C78">>},
{<<"gproc">>, <<"CEA02C578589C61E5341FCE149EA36CCEF236CC2ECAC8691FBA408E7EA77EC2F">>},
{<<"hackney">>, <<"07E33C794F8F8964EE86CEBEC1A8ED88DB5070E52E904B8F12209773C1036085">>},
{<<"idna">>, <<"689C46CBCDF3524C44D5F3DDE8001F364CD7608A99556D8FBD8239A5798D4C10">>},
{<<"hackney">>, <<"717EA195FD2F898D9FE9F1CE0AFCC2621A41ECFE137FAE57E7FE6E9484B9AA99">>},
{<<"idna">>, <<"8A63070E9F7D0C62EB9D9FCB360A7DE382448200FBBD1B106CC96D3D8099DF8D">>},
{<<"jsx">>, <<"20A170ABD4335FC6DB24D5FAD1E5D677C55DADF83D1B20A8A33B5FE159892A39">>},
{<<"metrics">>, <<"25F094DEA2CDA98213CECC3AEFF09E940299D950904393B2A29D191C346A8486">>},
{<<"mimerl">>, <<"67E2D3F571088D5CFD3E550C383094B47159F3EEE8FFA08E64106CDF5E981BE3">>},
{<<"parse_trans">>, <<"09765507A3C7590A784615CFD421D101AEC25098D50B89D7AA1D66646BC571C1">>},
{<<"parse_trans">>, <<"16328AB840CC09919BD10DAB29E431DA3AF9E9E7E7E6F0089DD5A2D2820011D8">>},
{<<"prometheus">>, <<"20510F381DB1CCAB818B4CF2FAC5FA6AB5CC91BC364A154399901C001465F46F">>},
{<<"prometheus_cowboy">>, <<"CFCE0BC7B668C5096639084FCD873826E6220EA714BF60A716F5BD080EF2A99C">>},
{<<"prometheus_httpd">>, <<"F616ED9B85B536B195D94104063025A91F904A4CFC20255363F49A197D96C896">>},
{<<"ranch">>, <<"6B1FAB51B49196860B733A49C07604465A47BDB78AA10C1C16A3D199F7F8C881">>},
{<<"ssl_verify_fun">>, <<"6EAF7AD16CB568BB01753DBBD7A95FF8B91C7979482B95F38443FE2C8852A79B">>},
{<<"unicode_util_compat">>, <<"D869E4C68901DD9531385BB0C8C40444EBF624E60B6962D95952775CAC5E90CD">>}]},
{<<"ssl_verify_fun">>, <<"CF344F5692C82D2CD7554F5EC8FD961548D4FD09E7D22F5B62482E5AEAEBD4B0">>},
{<<"unicode_util_compat">>, <<"BC84380C9AB48177092F43AC89E4DFA2C6D62B40B8BD132B1059ECC7232F9A78">>}]},
{pkg_hash_ext,[
{<<"accept">>, <<"11B18C220BCC2EAB63B5470C038EF10EB6783BCB1FCDB11AA4137DEFA5AC1BB8">>},
{<<"bear">>, <<"534217DCE6A719D59E54FB0EB7A367900DBFC5F85757E8C1F94269DF383F6D9B">>},
{<<"cache">>, <<"E5559E1D71C5EF511C04E395F4B37AA71FA4A50ECC7365CA41DDEF0746FE907E">>},
{<<"certifi">>, <<"805ABD97539CAF89EC6D4732C91E62BA9DA0CDA51AC462380BBD28EE697A8C42">>},
{<<"cache">>, <<"44516CE6FA03594D3A2AF025DD3A87BFE711000EB730219E1DDEFC816E0AA2F4">>},
{<<"certifi">>, <<"ED516ACB3929B101208A9D700062D520F3953DA3B6B918D866106FFA980E1C10">>},
{<<"cowboy">>, <<"4643E4FBA74AC96D4D152C75803DE6FAD0B3FA5DF354C71AFDD6CBEEB15FAC8A">>},
{<<"cowlib">>, <<"E4175DC240A70D996156160891E1C62238EDE1729E45740BDD38064DAD476170">>},
{<<"gproc">>, <<"580ADAFA56463B75263EF5A5DF4C86AF321F68694E7786CB057FD805D1E2A7DE">>},
{<<"hackney">>, <<"E0100F8EF7D1124222C11AD362C857D3DF7CB5F4204054F9F0F4A728666591FC">>},
{<<"idna">>, <<"4BDD305EB64E18B0273864920695CB18D7A2021F31A11B9C5FBCD9A253F936E2">>},
{<<"hackney">>, <<"64C22225F1EA8855F584720C0E5B3CD14095703AF1C9FBC845BA042811DC671C">>},
{<<"idna">>, <<"92376EB7894412ED19AC475E4A86F7B413C1B9FBB5BD16DCCD57934157944CEA">>},
{<<"jsx">>, <<"37BECA0435F5CA8A2F45F76A46211E76418FBEF80C36F0361C249FC75059DC6D">>},
{<<"metrics">>, <<"69B09ADDDC4F74A40716AE54D140F93BEB0FB8978D8636EADED0C31B6F099F16">>},
{<<"mimerl">>, <<"F278585650AA581986264638EBF698F8BB19DF297F66AD91B18910DFC6E19323">>},
{<<"parse_trans">>, <<"17EF63ABDE837AD30680EA7F857DD9E7CED9476CDD7B0394432AF4BFC241B960">>},
{<<"parse_trans">>, <<"07CD9577885F56362D414E8C4C4E6BDF10D43A8767ABB92D24CBE8B24C54888B">>},
{<<"prometheus">>, <<"4905FD2992F8038ECCD7AA0CD22F40637ED618C0BED1F75C05AACEC15B7545DE">>},
{<<"prometheus_cowboy">>, <<"BA286BECA9302618418892D37BCD5DC669A6CC001F4EB6D6AF85FF81F3F4F34C">>},
{<<"prometheus_httpd">>, <<"0BBE831452CFDF9588538EB2F570B26F30C348ADAE5E95A7D87F35A5910BCF92">>},
{<<"ranch">>, <<"451D8527787DF716D99DC36162FCA05934915DB0B6141BBDAC2EA8D3C7AFC7D7">>},
{<<"ssl_verify_fun">>, <<"13104D7897E38ED7F044C4DE953A6C28597D1C952075EB2E328BC6D6F2BFC496">>},
{<<"unicode_util_compat">>, <<"1D1848C40487CDB0B30E8ED975E34E025860C02E419CB615D255849F3427439D">>}]}
{<<"ssl_verify_fun">>, <<"BDB0D2471F453C88FF3908E7686F86F9BE327D065CC1EC16FA4540197EA04680">>},
{<<"unicode_util_compat">>, <<"25EEE6D67DF61960CF6A794239566599B09E17E668D3700247BC498638152521">>}]}
].