summaryrefslogtreecommitdiff
path: root/FS/FS/pay_batch/td_eftack264.pm
blob: 9ab16ef2ddf0709d2b8fa9d3cd052354c1df5414 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package FS::pay_batch::td_eftack264;

use strict;
use vars qw(@ISA %import_info %export_info $name);
use Date::Format 'time2str';
use FS::Conf;
use FS::Record qw(qsearch);

=head1 NAME

td_eftack264 - TD Commercial Banking EFT 264 byte acknowledgement file

=cut

$name = 'td_eftack264';

%import_info = (
  'filetype'    => 'fixed',
  'formatre'    => 
  '^(.)(.{9})(.{10})(.{4})(.{3})(.{10})(.{6})(.{9})(.{12}).{25}(.{15})(.{30})(.{30})(.{10})(.{19})(.{9})(.{12}).{15}.{22}(..)(.{11})$',
  'fields' => [ qw(
    recordtype
    count
    origid
    fcn
    cpacode
    paid
    duedate
    bank
    payinfo
    shortname
    custname
    longname
    origid2
    paybatchnum
    retbranch
    retacct
    usdcode
    invfield
    ) ],
  'hook' => sub {
    my $hash = shift;
    $hash->{'_date'} = time;
    $hash->{'paid'} = sprintf('%.2f', $hash->{'paid'} / 100);
    $hash->{'payinfo'} =~ s/^(\S+).*/$1/; # remove trailing spaces
    $hash->{'payinfo'} = $hash->{'payinfo'} . '@' . $hash->{'bank'};
  },
  'approved'    => sub { 0 },
  'declined'    => sub { 1 },
  'skip_condition' => sub {
    my $hash = shift;
    $hash->{'recordtype'} ne 'D'; # Debit Detail record
  },
  'close_condition' => sub { 0 },
);

%export_info = ( filetype => 'NONE' );
1;