ED-100: Use domain revision to while compute system account (#384)

This commit is contained in:
Sergey Yelin 2021-03-31 12:05:17 +03:00 committed by GitHub
parent 4ef1e2d964
commit 2c49e05d56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 7 deletions

View File

@ -980,7 +980,11 @@ make_final_cash_flow(Withdrawal) ->
{ok, PaymentInstitutionID} = ff_party:get_identity_payment_institution_id(Identity),
{ok, PaymentInstitution} = ff_payment_institution:get(PaymentInstitutionID, DomainRevision),
{ok, SystemAccounts} = ff_payment_institution:compute_system_accounts(PaymentInstitution, PartyVarset),
{ok, SystemAccounts} = ff_payment_institution:compute_system_accounts(
PaymentInstitution,
PartyVarset,
DomainRevision
),
SystemAccount = maps:get(CurrencyID, SystemAccounts, #{}),
SettlementAccount = maps:get(settlement, SystemAccount, undefined),
SubagentAccount = maps:get(subagent, SystemAccount, undefined),

View File

@ -35,7 +35,7 @@
-export([compute_withdrawal_providers/2]).
-export([compute_p2p_transfer_providers/2]).
-export([compute_p2p_inspector/2]).
-export([compute_system_accounts/2]).
-export([compute_system_accounts/3]).
%% Pipeline
@ -93,15 +93,16 @@ compute_p2p_inspector(#{p2p_inspector := InspectorSelector}, VS) ->
Error
end.
-spec compute_system_accounts(payment_institution(), hg_selector:varset()) -> {ok, system_accounts()} | {error, term()}.
compute_system_accounts(PaymentInstitution, VS) ->
-spec compute_system_accounts(payment_institution(), hg_selector:varset(), ff_domain_config:revision()) ->
{ok, system_accounts()} | {error, term()}.
compute_system_accounts(PaymentInstitution, VS, DomainRevision) ->
#{
identity := Identity,
system_accounts := SystemAccountsSelector
} = PaymentInstitution,
do(fun() ->
SystemAccountSetRef = unwrap(hg_selector:reduce_to_value(SystemAccountsSelector, VS)),
SystemAccountSet = unwrap(ff_domain_config:object({system_account_set, SystemAccountSetRef})),
SystemAccountSet = unwrap(ff_domain_config:object(DomainRevision, {system_account_set, SystemAccountSetRef})),
decode_system_account_set(Identity, SystemAccountSet)
end).

View File

@ -942,7 +942,11 @@ make_final_cash_flow(P2PTransferState) ->
{ok, PaymentInstitutionID} = ff_party:get_identity_payment_institution_id(Identity),
{ok, PaymentInstitution} = ff_payment_institution:get(PaymentInstitutionID, DomainRevision),
{ok, SystemAccounts} = ff_payment_institution:compute_system_accounts(PaymentInstitution, PartyVarset),
{ok, SystemAccounts} = ff_payment_institution:compute_system_accounts(
PaymentInstitution,
PartyVarset,
DomainRevision
),
SystemAccount = maps:get(CurrencyID, SystemAccounts, #{}),
SettlementAccount = maps:get(settlement, SystemAccount, undefined),
SubagentAccount = maps:get(subagent, SystemAccount, undefined),

View File

@ -476,7 +476,7 @@ make_final_cash_flow(W2WTransferState) ->
}),
{ok, PaymentInstitutionID} = ff_party:get_identity_payment_institution_id(Identity),
{ok, PaymentInstitution} = ff_payment_institution:get(PaymentInstitutionID, DomainRevision),
{ok, SystemAccounts} = ff_payment_institution:compute_system_accounts(PaymentInstitution, Varset),
{ok, SystemAccounts} = ff_payment_institution:compute_system_accounts(PaymentInstitution, Varset, DomainRevision),
SystemAccount = maps:get(CurrencyID, SystemAccounts, #{}),
SettlementAccount = maps:get(settlement, SystemAccount, undefined),
SubagentAccount = maps:get(subagent, SystemAccount, undefined),