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}; }