summaryrefslogtreecommitdiff
path: root/FS/FS/pay_batch
diff options
context:
space:
mode:
authorChristopher Burger <burgerc@freeside.biz>2019-03-29 14:24:41 -0400
committerChristopher Burger <burgerc@freeside.biz>2019-04-01 09:34:41 -0400
commite375a026a7b95ae4bd238441c1d8716ef32e3519 (patch)
tree2b03c47bfd67478475d29e431922c89a809ee816 /FS/FS/pay_batch
parent7b081112d1036437511db1227055eb1f82ebbb31 (diff)
RT# 74789 - updated format to handle credits in seperated batch files
Diffstat (limited to 'FS/FS/pay_batch')
-rw-r--r--FS/FS/pay_batch/td_eft1464.pm18
1 files changed, 14 insertions, 4 deletions
diff --git a/FS/FS/pay_batch/td_eft1464.pm b/FS/FS/pay_batch/td_eft1464.pm
index 93612f1..609a728 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');