EFT template – Wells Fargo bank

<#– format specific processing –>

  <#assign newSeqId = “” >

  <#function isBalanceLine>

    <#return cbank.custpage_eft_custrecord_2663_balance_line >

  </#function>

  <#function getBankServiceClassCode>

    <#assign value = “”>

    <#if isBalanceLine() >

      <#assign value = “200”>

    <#else>

      <#assign value = “220”>

    </#if>

    <#return value>

  </#function>

   

  <#function getEntityBankAccountType bankAccount>

    <#assign value = “”>

    <#if bankAccount == “Savings” >

      <#assign value = “32”>

    <#else>

      <#assign value = “22”>

    </#if>

    <#return value>

  </#function>   

   

  <#function computeTotalDebitAmt batchPayments>

    <#assign value = “”>

    <#if isBalanceLine() >

      <#assign value = 0>

      <#list batchPayments as payment>

        <#assign value = value + getAmount(payment)>

      </#list>

    <#else>

      <#assign value = 0>

    </#if>

    <#return value>   

  </#function>

   

  <#function computeTotalRecords recordCount>

    <#assign value = (recordCount / 10) >

    <#assign value = value?ceiling >   

    <#return value>

  </#function>

   

  <#function getBalanceLineTransactionCode ebanks>

    <#assign value = “”>

    <#if isBalanceLine() >

      <#assign cbankAcctType = cbank.custpage_eft_custrecord_2663_bank_acct_type>

      <#if cbankAcctType == “Savings”>

        <#assign value = “32”>

      <#else>

        <#assign value = “22”>

      </#if>       

      <#list ebanks as ebank>

        <#assign bankAccount = ebank.custrecord_2663_entity_bank_acct_type >

        <#assign ebankAcctType = getEntityBankAccountType(bankAccount) >

        <#if ebankAcctType == “22” || ebankAcctType == “32” >

          <#if cbankAcctType == “Savings”>

            <#assign value = “37”>

          <#else>

            <#assign value = “27”>

          </#if>

          <#break>

        </#if>

      </#list>

    </#if>

    <#return value>   

  </#function>

<#assign timeValue = pfa.custrecord_2663_file_creation_timestamp?time>

<#assign isPM = timeValue?string(“a”) == “PM”>

<#assign hour = timeValue?string(“HH”)?number>

<#assign minute = timeValue?string(“mm”)>

<#if isPM && hour != 12>

 <#assign hour24 = hour + 12>

<#elseif !isPM && hour == 12>

 <#assign hour24 = 0>

<#else>

 <#assign hour24 = hour>

</#if>

<#assign formattedTime = (hour24)?string(“00”) + minute>

  <#function computeSequenceId>

    <#assign lastSeqId = getSequenceId(true)>

     

    <#– store new sequence id to be returned later –>

    <#assign newSeqId = lastSeqId + 1>     

    <#– do char code to character conversion –>

    <#assign seqId = (lastSeqId % 26) + 65>

    <#assign seqId = seqId?string?replace(“65″,”A”)>

    <#assign seqId = seqId?string?replace(“66″,”B”)>

    <#assign seqId = seqId?string?replace(“67″,”C”)>

    <#assign seqId = seqId?string?replace(“68″,”D”)>

    <#assign seqId = seqId?string?replace(“69″,”E”)>

    <#assign seqId = seqId?string?replace(“70″,”F”)>

    <#assign seqId = seqId?string?replace(“71″,”G”)>

    <#assign seqId = seqId?string?replace(“72″,”H”)>

    <#assign seqId = seqId?string?replace(“73″,”I”)>

    <#assign seqId = seqId?string?replace(“74″,”J”)>

    <#assign seqId = seqId?string?replace(“75″,”K”)>

    <#assign seqId = seqId?string?replace(“76″,”L”)>

    <#assign seqId = seqId?string?replace(“77″,”M”)>

    <#assign seqId = seqId?string?replace(“78″,”N”)>

    <#assign seqId = seqId?string?replace(“79″,”O”)>

    <#assign seqId = seqId?string?replace(“80″,”P”)>

    <#assign seqId = seqId?string?replace(“81″,”Q”)>

    <#assign seqId = seqId?string?replace(“82″,”R”)>

    <#assign seqId = seqId?string?replace(“83″,”S”)>

    <#assign seqId = seqId?string?replace(“84″,”T”)>

    <#assign seqId = seqId?string?replace(“85″,”U”)>

    <#assign seqId = seqId?string?replace(“86″,”V”)>

    <#assign seqId = seqId?string?replace(“87″,”W”)>

    <#assign seqId = seqId?string?replace(“88″,”X”)>

    <#assign seqId = seqId?string?replace(“89″,”Y”)>

    <#assign seqId = seqId?string?replace(“90″,”Z”)>

    <#return seqId>     

  </#function>

   

  <#function getAggregationLineCount payment>

    <#assign subTrans = transHash[payment.internalid]>     

    <#return subTrans?size>

  </#function>  

   

  <#function getReferenceAmount payment accountType transaction>     

    <#assign tranAmount = 0 >         

    <#if payment.currency?has_content>

      <#if accountType == “Bank”>

        <#assign tranAmount = transaction.appliedtoforeignamount>

      <#else>

        <#assign tranAmount = transaction.applyingforeignamount>

      </#if>

    <#else>

      <#if accountType == “Bank”>

        <#assign tranAmount = transaction.appliedtolinkamount>

      <#else>

        <#assign tranAmount = transaction.applyinglinkamount>

      </#if>

    </#if>     

    <#if (tranAmount < 0)>

      <#assign tranAmount = tranAmount * -1>

    </#if>

    <#return tranAmount>

  </#function>

<#– counters / dynamic values–>

<#assign recordCount = 0>

<#assign batchCount = 0>

<#assign lineCount = 0>

<#assign batchLineNum = 0>

<#assign padBlocksString = “”>

<#assign totalBankNumberHash = 0>

  <#assign fieldValue = cbank.custpage_eft_custrecord_2663_bank_num>

<#assign ninthDigit = fieldValue?substring(8, 9)>

<#– template building –>

#OUTPUT START#

101 ${setLength(cbank.custpage_eft_custrecord_2663_bank_num, 9)}${setLength(cbank.custpage_eft_custrecord_2663_bank_comp_id, 10)}${setLength(pfa.custrecord_2663_file_creation_timestamp?date?string(“yyMMdd”),6)}${formattedTime}${setLength(computeSequenceId(),1)}094101${setLength(cbank.custpage_eft_custrecord_2663_bank_name, 23)}${setLength(cbank.custrecord_2663_legal_name, 23)}     

<#assign recordCount = recordCount + 1>

<#assign batchCount = batchCount + 1>

5${getBankServiceClassCode()}${setLength(cbank.custrecord_2663_legal_name,16)}${setLength(cbank.custpage_eft_custrecord_2663_issuer_num,20)}${setLength(cbank.custpage_eft_custrecord_2663_bank_comp_id, 10)}CCD${setLength(pfa.custrecord_2663_ref_note,10)}${pfa.custrecord_2663_process_date?string(“MMM dd”)}${pfa.custrecord_2663_process_date?string(“yyMMdd”)}${setLength(“”,3)}1${setLength(cbank.custpage_eft_custrecord_2663_bank_num, 8)}${setPadding(batchCount,”left”,”0″,7)}

<#assign recordCount = recordCount + 1>

<#list payments as payment>

  <#assign batchLineNum = batchLineNum + 1>

  <#assign ebank = ebanks[payment_index]>   

<#assign ebankAccNum = ebank_accountnums.list[payment_index]>

  <#assign entity = entities[payment_index]>

  <#assign totalBankNumberHash = totalBankNumberHash + ebank.custrecord_2663_entity_bank_no?substring(0,8)?number>

6${getEntityBankAccountType(ebank.custrecord_2663_entity_bank_acct_type)}${setLength(ebank.custrecord_2663_entity_bank_no,8)}${setLength(ninthDigit,1)}${setLength(ebankAccNum.custrecord_2663_entity_acct_no,17)}${setPadding(formatAmount(getAmount(payment)),”left”,”0″,10)}${setLength(entity.internalid,15)}${setLength(cbank.custrecord_2663_print_company_name,22)}${setLength(“”,2)}1${setLength(cbank.custpage_eft_custrecord_2663_bank_num,8)}${setPadding(batchLineNum,”left”,”0″,7)}

  <#assign recordCount = recordCount + 1>

  <#list transHash[payment.internalid] as transaction>

  <#assign lineCount = lineCount + 1>

705${setLength(transaction.tranid,80)}0001${setPadding(batchLineNum,”left”,”0″,7)}

    <#assign recordCount = recordCount + 1>

  </#list>

</#list>

<#if isBalanceLine()>

  <#assign batchLineNum = batchLineNum + 1>

  <#assign totalBankNumberHash = totalBankNumberHash + cbank.custpage_eft_custrecord_2663_bank_num?substring(0,8)?number>

6${getBalanceLineTransactionCode(ebanks)}${setLength(cbank.custpage_eft_custrecord_2663_bank_num,9)}${setLength(cbank.custpage_eft_custrecord_2663_acct_num,17)}${setPadding(formatAmount(computeTotalAmount(payments)),”left”,”0″,10)}        ${setLength(cbank.custrecord_2663_print_company_name,22)} 0${setLength(cbank.custpage_eft_custrecord_2663_processor_code,4)}${setLength(cbank.custpage_eft_custrecord_2663_bank_code,4)}${setPadding(batchLineNum,”left”,”0″,7)}

<#assign recordCount = recordCount + 1>

</#if>

<#assign lineCount = lineCount + batchLineNum>

8${getBankServiceClassCode()}${setPadding(lineCount,”left”,”0″,6)}${setPadding(totalBankNumberHash,”left”,”0″,10)}${setPadding(formatAmount(computeTotalDebitAmt(payments)),”left”,”0″,12)}${setPadding(formatAmount(computeTotalAmount(payments)),”left”,”0″,12)}${setLength(cbank.custpage_eft_custrecord_2663_bank_comp_id,10)}${setLength(“”,25)}${setLength(cbank.custpage_eft_custrecord_2663_bank_num, 8)}${setPadding(batchCount,”left”,”0″,7)}

<#assign recordCount = recordCount + 2>

<#if cbank.custpage_eft_custrecord_2663_pad_blocks && (recordCount % 10 > 0)>   

  <#assign numBlocks = 10 – (recordCount % 10) >

  <#assign padding = “9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999”>   

  <#assign padBlocksString = “n”>

  <#list 1..numBlocks as i>

    <#assign padBlocksString = padBlocksString + padding + “n”>

  </#list>

</#if>

9${setPadding(batchCount,”left”,”0″,6)}${setPadding(computeTotalRecords(recordCount),”left”,”0″,6)}${setPadding(lineCount,”left”,”0″,8)}${setPadding(totalBankNumberHash,”left”,”0″,10)}000000000000${setPadding(formatAmount(computeTotalAmount(payments)),”left”,”0″,12)}${setLength(“”,39)}

#OUTPUT END#

#RETURN START#

sequenceId:${newSeqId}

#RETURN END#

Leave a comment

Your email address will not be published. Required fields are marked *