mirror of
https://github.com/valitydev/hellgate.git
synced 2024-11-06 02:45:20 +00:00
added allow support
This commit is contained in:
parent
9a25ce678e
commit
f4e4ccc1f2
@ -617,6 +617,7 @@ check_terms_acceptability(recurrent_payment, Terms, VS) ->
|
||||
|
||||
acceptable_payment_terms(
|
||||
#domain_PaymentsProvisionTerms{
|
||||
allow = Allow,
|
||||
currencies = CurrenciesSelector,
|
||||
categories = CategoriesSelector,
|
||||
payment_methods = PMsSelector,
|
||||
@ -630,6 +631,7 @@ acceptable_payment_terms(
|
||||
% TODO varsets getting mixed up
|
||||
% it seems better to pass down here hierarchy of contexts w/ appropriate module accessors
|
||||
ParentName = 'PaymentsProvisionTerms',
|
||||
_ = acceptable_allow(ParentName, Allow),
|
||||
_ = try_accept_term(ParentName, currency, getv(currency, VS), CurrenciesSelector),
|
||||
_ = try_accept_term(ParentName, category, getv(category, VS), CategoriesSelector),
|
||||
_ = try_accept_term(ParentName, payment_tool, getv(payment_tool, VS), PMsSelector),
|
||||
@ -692,6 +694,15 @@ acceptable_partial_refunds_terms(
|
||||
acceptable_partial_refunds_terms(undefined, _RVS) ->
|
||||
throw(?rejected({'PartialRefundsProvisionTerms', undefined})).
|
||||
|
||||
acceptable_allow(_ParentName, undefined) ->
|
||||
true;
|
||||
acceptable_allow(_ParentName, {constant, true}) ->
|
||||
true;
|
||||
acceptable_allow(ParentName, {constant, false}) ->
|
||||
throw(?rejected({ParentName, allow}));
|
||||
acceptable_allow(_ParentName, Ambiguous) ->
|
||||
error({misconfiguration, {'Could not reduce predicate to a value', {allow, Ambiguous}}}).
|
||||
|
||||
%%
|
||||
|
||||
acceptable_recurrent_paytool_terms(
|
||||
|
@ -163,6 +163,7 @@
|
||||
}).
|
||||
|
||||
-define(payment_terms, #domain_PaymentsProvisionTerms{
|
||||
allow = {constant, true},
|
||||
currencies =
|
||||
{value,
|
||||
?ordset([
|
||||
|
@ -239,7 +239,8 @@ mock_party_management(SupPid) ->
|
||||
{candidates, [
|
||||
?candidate({constant, true}, ?trm(1)),
|
||||
?candidate({constant, true}, ?trm(2)),
|
||||
?candidate({constant, true}, ?trm(3))
|
||||
?candidate({constant, true}, ?trm(3)),
|
||||
?candidate({constant, true}, ?trm(4))
|
||||
]}
|
||||
}};
|
||||
('ComputeRoutingRuleset', {?ruleset(1), ?base_routing_rule_domain_revision, _}) ->
|
||||
@ -292,6 +293,12 @@ mock_party_management(SupPid) ->
|
||||
])}
|
||||
}
|
||||
}};
|
||||
('ComputeProviderTerminalTerms', {?prv(4), _, ?base_routing_rule_domain_revision, _}) ->
|
||||
{ok, #domain_ProvisionTermSet{
|
||||
payments = ?payment_terms#domain_PaymentsProvisionTerms{
|
||||
allow = {constant, false}
|
||||
}
|
||||
}};
|
||||
('ComputeProviderTerminalTerms', {?prv(1), _, ?routing_with_risk_coverage_set_domain_revision, _}) ->
|
||||
{ok, #domain_ProvisionTermSet{
|
||||
payments = ?payment_terms#domain_PaymentsProvisionTerms{
|
||||
@ -400,7 +407,8 @@ no_route_found_for_payment(_C) ->
|
||||
[
|
||||
{?prv(1), ?trm(1), {'PaymentsProvisionTerms', cost}},
|
||||
{?prv(2), ?trm(2), {'PaymentsProvisionTerms', category}},
|
||||
{?prv(3), ?trm(3), {'PaymentsProvisionTerms', payment_tool}}
|
||||
{?prv(3), ?trm(3), {'PaymentsProvisionTerms', payment_tool}},
|
||||
{?prv(4), ?trm(4), {'PaymentsProvisionTerms', allow}}
|
||||
],
|
||||
RejectedRoutes1
|
||||
),
|
||||
@ -418,7 +426,8 @@ no_route_found_for_payment(_C) ->
|
||||
[
|
||||
{?prv(1), ?trm(1), {'PaymentsProvisionTerms', currency}},
|
||||
{?prv(2), ?trm(2), {'PaymentsProvisionTerms', category}},
|
||||
{?prv(3), ?trm(3), {'PaymentsProvisionTerms', payment_tool}}
|
||||
{?prv(3), ?trm(3), {'PaymentsProvisionTerms', payment_tool}},
|
||||
{?prv(4), ?trm(4), {'PaymentsProvisionTerms', allow}}
|
||||
],
|
||||
RejectedRoutes2
|
||||
).
|
||||
@ -456,7 +465,8 @@ gather_route_success(_C) ->
|
||||
?assertMatch(
|
||||
[
|
||||
{?prv(2), ?trm(2), {'PaymentsProvisionTerms', category}},
|
||||
{?prv(3), ?trm(3), {'PaymentsProvisionTerms', payment_tool}}
|
||||
{?prv(3), ?trm(3), {'PaymentsProvisionTerms', payment_tool}},
|
||||
{?prv(4), ?trm(4), {'PaymentsProvisionTerms', allow}}
|
||||
],
|
||||
RejectedRoutes
|
||||
).
|
||||
@ -495,7 +505,8 @@ rejected_by_table_prohibitions(_C) ->
|
||||
[
|
||||
{?prv(3), ?trm(3), {'RoutingRule', undefined}},
|
||||
{?prv(1), ?trm(1), {'PaymentsProvisionTerms', payment_tool}},
|
||||
{?prv(2), ?trm(2), {'PaymentsProvisionTerms', category}}
|
||||
{?prv(2), ?trm(2), {'PaymentsProvisionTerms', category}},
|
||||
{?prv(4), ?trm(4), {'PaymentsProvisionTerms', allow}}
|
||||
],
|
||||
RejectedRoutes
|
||||
),
|
||||
@ -562,11 +573,11 @@ ruleset_misconfig(_C) ->
|
||||
|
||||
-spec routes_selected_for_low_risk_score(config()) -> test_return().
|
||||
routes_selected_for_low_risk_score(C) ->
|
||||
routes_selected_with_risk_score(C, low, [?prv(1), ?prv(2), ?prv(3)]).
|
||||
routes_selected_with_risk_score(C, low, [?prv(1), ?prv(2), ?prv(3), ?prv(4)]).
|
||||
|
||||
-spec routes_selected_for_high_risk_score(config()) -> test_return().
|
||||
routes_selected_for_high_risk_score(C) ->
|
||||
routes_selected_with_risk_score(C, high, [?prv(2), ?prv(3)]).
|
||||
routes_selected_with_risk_score(C, high, [?prv(2), ?prv(3), ?prv(4)]).
|
||||
|
||||
routes_selected_with_risk_score(_C, RiskScore, ProviderRefs) ->
|
||||
Currency = ?cur(<<"RUB">>),
|
||||
@ -755,6 +766,7 @@ construct_domain_fixture() ->
|
||||
{terminal, ?trm(1)} => {terminal, ?terminal_obj(?trm(1), ?prv(1))},
|
||||
{terminal, ?trm(2)} => {terminal, ?terminal_obj(?trm(2), ?prv(2))},
|
||||
{terminal, ?trm(3)} => {terminal, ?terminal_obj(?trm(3), ?prv(3))},
|
||||
{terminal, ?trm(4)} => {terminal, ?terminal_obj(?trm(4), ?prv(4))},
|
||||
{terminal, ?trm(11)} => {terminal, ?terminal_obj(?trm(11), ?prv(11))},
|
||||
{terminal, ?trm(12)} => {terminal, ?terminal_obj(?trm(12), ?prv(12))},
|
||||
{payment_institution, ?pinst(1)} =>
|
||||
|
@ -17,7 +17,7 @@
|
||||
{<<"cowlib">>,{pkg,<<"cowlib">>,<<"2.11.0">>},2},
|
||||
{<<"damsel">>,
|
||||
{git,"https://github.com/valitydev/damsel.git",
|
||||
{ref,"6655937cfd504d14bf83c40f5d09315dbffbdcfc"}},
|
||||
{ref,"d59017c42e41e2e94f79a9c2260a814fe0b0ca77"}},
|
||||
0},
|
||||
{<<"dmt_client">>,
|
||||
{git,"https://github.com/valitydev/dmt-client.git",
|
||||
|
Loading…
Reference in New Issue
Block a user