[freeside-commits] branch FREESIDE_3_BRANCH updated. c07f2dfd1acd4994a41b6cfb0deecc1d73290ac5
Jeremy Davis
jeremyd at 420.am
Thu Nov 13 14:03:46 PST 2014
The branch, FREESIDE_3_BRANCH has been updated
via c07f2dfd1acd4994a41b6cfb0deecc1d73290ac5 (commit)
from 1d252045c95388483c957634696daaed7729b84c (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 c07f2dfd1acd4994a41b6cfb0deecc1d73290ac5
Author: Jeremy Davis <jeremyd at freeside.biz>
Date: Thu Nov 13 16:58:55 2014 -0500
Ticket #31847 CIBC batch format
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 6b59574..9c35966 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -3714,7 +3714,7 @@ and customer address. Include units.',
'type' => 'select',
'select_enum' => [ 'NACHA', 'csv-td_canada_trust-merchant_pc_batch',
'csv-chase_canada-E-xactBatch', 'BoM', 'PAP',
- 'paymentech', 'ach-spiritone', 'RBC'
+ 'paymentech', 'ach-spiritone', 'RBC', 'CIBC',
]
},
@@ -3776,7 +3776,7 @@ and customer address. Include units.',
'type' => 'select',
'select_enum' => [ 'NACHA', 'csv-td_canada_trust-merchant_pc_batch', 'BoM',
'PAP', 'paymentech', 'ach-spiritone', 'RBC',
- 'td_eft1464', 'eft_canada'
+ 'td_eft1464', 'eft_canada', 'CIBC'
]
},
@@ -3794,6 +3794,13 @@ and customer address. Include units.',
'type' => 'textarea',
},
+{
+ 'key' => 'batchconfig-CIBC',
+ 'section' => 'billing',
+ 'description' => 'Configuration for Canadian Imperial Bank of Commerce, six lines: 1. Origin ID, 2. Datacenter, 3. Typecode, 4. Short name, 5. Bank, 6. Bank account',
+ 'type' => 'textarea',
+ },
+
{
'key' => 'batchconfig-PAP',
'section' => 'billing',
diff --git a/FS/FS/pay_batch/CIBC.pm b/FS/FS/pay_batch/CIBC.pm
new file mode 100644
index 0000000..2c72bef
--- /dev/null
+++ b/FS/FS/pay_batch/CIBC.pm
@@ -0,0 +1,87 @@
+package FS::pay_batch::CIBC;
+
+use strict;
+use vars qw(@ISA %import_info %export_info $name);
+use Date::Format 'time2str';
+use FS::Conf;
+
+my $conf;
+my ($origid, $datacenter, $transcode, $shortname, $mybank, $myacct);
+
+$name = 'CIBC';
+
+%import_info = (
+ 'filetype' => 'CSV',
+ 'fields' => [],
+ 'hook' => sub { die "Can't import CIBC" },
+ 'approved' => sub { 1 },
+ 'declined' => sub { 0 },
+);
+
+%export_info = (
+ init => sub {
+ $conf = shift;
+ ($origid,
+ $datacenter,
+ $transcode,
+ $shortname,
+ $mybank,
+ $myacct) = $conf->config("batchconfig-CIBC");
+ },
+ header => sub {
+ my $pay_batch = shift;
+ sprintf( "1%2s%05u%-5s%010u%6s%04u%1s%04u%5u%-12u%2s%-15s%1s%3s%4s \n", #80
+ '',
+ substr(0,5, $origid),
+ '',
+ $origid,
+ time2str('%y%m%d', $pay_batch->download),
+ $pay_batch->batchnum,
+ ' ',
+ '0010',
+ $mybank,
+ $myacct,
+ '',
+ $shortname,
+ ' ',
+ 'CAD',
+ '', ) .
+ sprintf( "5%46s%03u%-10s%6s%14s", #80
+ '',
+ $transcode,
+ ' ',
+ time2str('%y%m%d', $pay_batch->download),
+ ' ');
+ },
+ row => sub {
+ my ($cust_pay_batch, $pay_batch) = @_;
+ my ($account, $aba) = split('@', $cust_pay_batch->payinfo);
+ my($bankno, $branch);
+ if ( $aba =~ /^0(\d{3})(\d{5})$/ ) { # standard format for Canadian bank ID
+ ($bankno, $branch) = ( $1, $2 );
+ } elsif ( $aba =~ /^(\d{5})\.(\d{3})$/ ) { #how we store branches
+ ($branch, $bankno) = ( $1, $2 );
+ } else {
+ die "invalid branch/routing number '$aba'\n";
+ }
+ sprintf( "6%1s%1s%04u%05u%-12u%5u%10s%-13s%-22s%6s ", #80
+ 'D',
+ '',
+ $bankno,
+ $branch,
+ $account,
+ '',
+ $cust_pay_batch->amount * 100,
+ $cust_pay_batch->paybatchnum,
+ $cust_pay_batch->payname,
+ ' ',
+ );
+ },
+ footer => sub {
+ my ($pay_batch, $batchcount, $batchtotal) = @_;
+ sprintf( "7%03u%06f%010s%20s%012s%28s \n", $transcode, $batchcount,'0','',$batchtotal*100,''). #80
+ sprintf( "9%06s%06s%67s", 1, $batchcount,''); #80
+ },
+);
+
+1;
diff --git a/httemplate/search/elements/cust_pay_batch_top.html b/httemplate/search/elements/cust_pay_batch_top.html
index a773dd0..2dbf620 100644
--- a/httemplate/search/elements/cust_pay_batch_top.html
+++ b/httemplate/search/elements/cust_pay_batch_top.html
@@ -149,6 +149,7 @@ tie my %download_formats, 'Tie::IxHash', (
'RBC' => 'Royal Bank of Canada PDS batch',
'td_eft1464' => '1464 byte file for TD Commercial Banking EFT',
'eft_canada' => 'EFT Canada CSV batch',
+ 'CIBC' => '80 byte file for Canadian Imperial Bank of Commerce',
# insert new batch formats here
);
-----------------------------------------------------------------------
Summary of changes:
FS/FS/Conf.pm | 11 ++-
FS/FS/pay_batch/CIBC.pm | 87 ++++++++++++++++++++
httemplate/search/elements/cust_pay_batch_top.html | 1 +
3 files changed, 97 insertions(+), 2 deletions(-)
create mode 100644 FS/FS/pay_batch/CIBC.pm
More information about the freeside-commits
mailing list