[freeside-commits] branch FREESIDE_4_BRANCH updated. 3d864cbee010079d9062d0f8569d6d1d8ab31a1d

Christopher Burger burgerc at freeside.biz
Mon Apr 1 07:01:40 PDT 2019


The branch, FREESIDE_4_BRANCH has been updated
       via  3d864cbee010079d9062d0f8569d6d1d8ab31a1d (commit)
       via  e375a026a7b95ae4bd238441c1d8716ef32e3519 (commit)
      from  7b081112d1036437511db1227055eb1f82ebbb31 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 3d864cbee010079d9062d0f8569d6d1d8ab31a1d
Author: Christopher Burger <burgerc at freeside.biz>
Date:   Fri May 19 09:10:30 2017 -0400

    RT# 74789 - Updated electronic check batch td_eft1464 format to except refunds (bank credit).

diff --git a/FS/FS/pay_batch/td_eft1464.pm b/FS/FS/pay_batch/td_eft1464.pm
index 609a728f7..e16b0ee39 100644
--- a/FS/FS/pay_batch/td_eft1464.pm
+++ b/FS/FS/pay_batch/td_eft1464.pm
@@ -108,8 +108,13 @@ $name = 'td_eft1464';
     $i++;
     # The 1464 byte format supports up to 5 payments per line,
     # but we're only going to send 1.
+
+    ## set to D for debit by default, then override to what cust_pay_batch has as payments may not have paycode.
+    my $debitorcredit = 'D';
+    $debitorcredit = $cust_pay_batch->paycode unless !$cust_pay_batch->paycode;
+
     my $control = join('',
-      'D',                  # for 'debit'
+      $debitorcredit,       # D for 'debit' or C for Credit
       sprintf("%09u", $i),  #record number
       $opt{'origid'},
       $opt{'fcn'},

commit e375a026a7b95ae4bd238441c1d8716ef32e3519
Author: Christopher Burger <burgerc at freeside.biz>
Date:   Fri Mar 29 14:24:41 2019 -0400

    RT# 74789 - updated format to handle credits in seperated batch files

diff --git a/FS/FS/pay_batch/td_eft1464.pm b/FS/FS/pay_batch/td_eft1464.pm
index 93612f1ea..609a728f7 100644
--- a/FS/FS/pay_batch/td_eft1464.pm
+++ b/FS/FS/pay_batch/td_eft1464.pm
@@ -48,6 +48,7 @@ my $i;
 
 $name = 'td_eft1464';
 # TD Bank EFT 1464 Byte format
+# https://www.payments.ca/sites/default/files/standard-005.pdf
 
 %import_info = ( filetype => 'NONE' ); 
 # just to suppress warning; importing this format is a fatal error
@@ -140,20 +141,29 @@ $name = 'td_eft1464';
   },
   footer => sub {
     my ($pay_batch, $batchcount, $batchtotal) = @_;
+    my $totaldebittxns = $pay_batch->type eq "DEBIT" ? $batchtotal*100 : 0;
+    my $countdebittxns = $pay_batch->type eq "DEBIT" ? $batchcount : 0;
+    my $totalcredittxns = $pay_batch->type eq "CREDIT" ? $batchtotal*100 : 0;
+    my $countcredittxns = $pay_batch->type eq "CREDIT" ? $batchcount : 0;
     join('',
       'Z',
       sprintf('%09u', $batchcount + 2),
       $opt{'origid'}, 
       $opt{'fcn'},
-      sprintf('%014.0f', $batchtotal*100), # total of debit txns
-      sprintf('%08u', $batchcount), # number of debit txns
-      '0' x 14, # total of credit txns
-      '0' x 8, # total of credit txns
+      sprintf('%014.0f', $totaldebittxns), # total of debit txns
+      sprintf('%08u', $countdebittxns), # number of debit txns
+      sprintf('%014.0f', $totalcredittxns), # total of debit txns
+      sprintf('%08u', $countcredittxns), # number of debit txns
       ' ' x 1396,
     )
   },
 );
 
+## this format can handle credit transactions
+sub can_handle_credits {
+  1;
+}
+
 sub _upgrade_gateway {
   my $conf = FS::Conf->new;
   my @batchconfig = $conf->config('batchconfig-td_eft1464');

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/pay_batch/td_eft1464.pm | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)




More information about the freeside-commits mailing list