mirror of
https://github.com/valitydev/fistful-server.git
synced 2024-11-06 02:35:18 +00:00
ED-100: Use domain revision to while compute system account (#384)
This commit is contained in:
parent
4ef1e2d964
commit
2c49e05d56
@ -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),
|
||||
|
@ -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).
|
||||
|
||||
|
@ -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),
|
||||
|
@ -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),
|
||||
|
Loading…
Reference in New Issue
Block a user