[freeside-commits] branch master updated. 8a16e8aa94e23ad44c0d4d9713ca009913f15b5b

Christopher Burger burgerc at freeside.biz
Fri Mar 29 11:26:04 PDT 2019


The branch, master has been updated
       via  8a16e8aa94e23ad44c0d4d9713ca009913f15b5b (commit)
      from  fe10e6c6a2e5de7a2ff468497790d2a317ec0c77 (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 8a16e8aa94e23ad44c0d4d9713ca009913f15b5b
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 3c60035ce..e16b0ee39 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
@@ -145,20 +146,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 | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)




More information about the freeside-commits mailing list