TD-435: Add allow support (#24)

* added allow support

* bumped damsel

* added withdrawal allow
This commit is contained in:
Артем 2022-11-11 13:04:03 +04:00 committed by GitHub
parent 1c7f97d16c
commit af7046e3db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 1 deletions

View File

@ -34,6 +34,7 @@ reduce_withdrawal_terms(undefined = Terms, _VS, _Rev) ->
Terms; Terms;
reduce_withdrawal_terms(#domain_WithdrawalProvisionTerms{} = Terms, VS, Rev) -> reduce_withdrawal_terms(#domain_WithdrawalProvisionTerms{} = Terms, VS, Rev) ->
Terms#domain_WithdrawalProvisionTerms{ Terms#domain_WithdrawalProvisionTerms{
allow = reduce_predicate_if_defined(Terms#domain_WithdrawalProvisionTerms.allow, VS, Rev),
currencies = reduce_if_defined(Terms#domain_WithdrawalProvisionTerms.currencies, VS, Rev), currencies = reduce_if_defined(Terms#domain_WithdrawalProvisionTerms.currencies, VS, Rev),
payout_methods = reduce_if_defined(Terms#domain_WithdrawalProvisionTerms.payout_methods, VS, Rev), payout_methods = reduce_if_defined(Terms#domain_WithdrawalProvisionTerms.payout_methods, VS, Rev),
cash_limit = reduce_if_defined(Terms#domain_WithdrawalProvisionTerms.cash_limit, VS, Rev), cash_limit = reduce_if_defined(Terms#domain_WithdrawalProvisionTerms.cash_limit, VS, Rev),
@ -63,6 +64,7 @@ reduce_payment_terms(undefined = PaymentTerms, _VS, _DomainRevision) ->
PaymentTerms; PaymentTerms;
reduce_payment_terms(PaymentTerms, VS, DomainRevision) -> reduce_payment_terms(PaymentTerms, VS, DomainRevision) ->
PaymentTerms#domain_PaymentsProvisionTerms{ PaymentTerms#domain_PaymentsProvisionTerms{
allow = reduce_predicate_if_defined(PaymentTerms#domain_PaymentsProvisionTerms.allow, VS, DomainRevision),
currencies = reduce_if_defined(PaymentTerms#domain_PaymentsProvisionTerms.currencies, VS, DomainRevision), currencies = reduce_if_defined(PaymentTerms#domain_PaymentsProvisionTerms.currencies, VS, DomainRevision),
categories = reduce_if_defined(PaymentTerms#domain_PaymentsProvisionTerms.categories, VS, DomainRevision), categories = reduce_if_defined(PaymentTerms#domain_PaymentsProvisionTerms.categories, VS, DomainRevision),
payment_methods = reduce_if_defined( payment_methods = reduce_if_defined(
@ -270,6 +272,9 @@ merge_withdrawal_terms(ProviderTerms, TerminalTerms) ->
reduce_if_defined(Selector, VS, Rev) -> reduce_if_defined(Selector, VS, Rev) ->
pm_maybe:apply(fun(X) -> pm_selector:reduce(X, VS, Rev) end, Selector). pm_maybe:apply(fun(X) -> pm_selector:reduce(X, VS, Rev) end, Selector).
reduce_predicate_if_defined(Predicate, VS, Rev) ->
pm_maybe:apply(fun(X) -> pm_selector:reduce_predicate(X, VS, Rev) end, Predicate).
-spec compute_proxy(provider(), terminal(), domain_revision()) -> -spec compute_proxy(provider(), terminal(), domain_revision()) ->
dmsl_domain_thrift:'ProxyDefinition'(). dmsl_domain_thrift:'ProxyDefinition'().
compute_proxy(Provider, Terminal, DomainRevision) -> compute_proxy(Provider, Terminal, DomainRevision) ->

View File

@ -1648,6 +1648,7 @@ compute_provider_ok(C) ->
#domain_Provider{ #domain_Provider{
terms = #domain_ProvisionTermSet{ terms = #domain_ProvisionTermSet{
payments = #domain_PaymentsProvisionTerms{ payments = #domain_PaymentsProvisionTerms{
allow = {constant, true},
cash_flow = {value, [CashFlow]} cash_flow = {value, [CashFlow]}
}, },
recurrent_paytools = #domain_RecurrentPaytoolsProvisionTerms{ recurrent_paytools = #domain_RecurrentPaytoolsProvisionTerms{
@ -2740,6 +2741,7 @@ construct_domain_fixture() ->
accounts = pm_ct_fixture:construct_provider_account_set([?cur(<<"RUB">>)]), accounts = pm_ct_fixture:construct_provider_account_set([?cur(<<"RUB">>)]),
terms = #domain_ProvisionTermSet{ terms = #domain_ProvisionTermSet{
payments = #domain_PaymentsProvisionTerms{ payments = #domain_PaymentsProvisionTerms{
allow = {constant, true},
currencies = {value, ?ordset([?cur(<<"RUB">>)])}, currencies = {value, ?ordset([?cur(<<"RUB">>)])},
categories = {value, ?ordset([?cat(1)])}, categories = {value, ?ordset([?cat(1)])},
payment_methods = payment_methods =

View File

@ -9,7 +9,7 @@
{<<"cowlib">>,{pkg,<<"cowlib">>,<<"2.11.0">>},2}, {<<"cowlib">>,{pkg,<<"cowlib">>,<<"2.11.0">>},2},
{<<"damsel">>, {<<"damsel">>,
{git,"https://github.com/valitydev/damsel.git", {git,"https://github.com/valitydev/damsel.git",
{ref,"03bbf48194f81132743da79cdeed2b3e8ad9d155"}}, {ref,"d59017c42e41e2e94f79a9c2260a814fe0b0ca77"}},
0}, 0},
{<<"dmt_client">>, {<<"dmt_client">>,
{git,"https://github.com/valitydev/dmt_client.git", {git,"https://github.com/valitydev/dmt_client.git",