web/website/node/claim-funding.mjs

12 lines
865 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import {entityId} from './postbank-authority.mjs';
import {BankError} from './postbank-service.mjs';
import {clanBankingEligible} from './clan-banking-policy.mjs';
// Shared by quotes and acceptance. Mother-account financing is a later,
// separately authorised mandate; it is not enabled by this Basic-clan policy.
export async function resolveClaimFunding(central,clan,charter){
if(!clanBankingEligible({charter_kind:charter,institution_key:clan.institution_key})){
if(!clan.owner_id)throw new BankError('The Basic clan owner could not be confirmed.',409);
return {kind:'person',entityId:entityId('person',clan.owner_id),name:'Clan owner’s personal account',ownerId:clan.owner_id,accountTypes:['102','108'],claimsOnly:false};
}
return {kind:'clan',entityId:entityId('clan',clan.id),name:clan.name,clanId:clan.id,accountTypes:['105'],claimsOnly:false};
}