line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Finance::AMEX::Transaction::EPTRN 0.005; |
2
|
|
|
|
|
|
|
|
3
|
9
|
|
|
9
|
|
50
|
use strict; |
|
9
|
|
|
|
|
14
|
|
|
9
|
|
|
|
|
219
|
|
4
|
9
|
|
|
9
|
|
50
|
use warnings; |
|
9
|
|
|
|
|
12
|
|
|
9
|
|
|
|
|
188
|
|
5
|
|
|
|
|
|
|
|
6
|
9
|
|
|
9
|
|
3366
|
use Finance::AMEX::Transaction::EPTRN::Header; |
|
9
|
|
|
|
|
22
|
|
|
9
|
|
|
|
|
214
|
|
7
|
9
|
|
|
9
|
|
3316
|
use Finance::AMEX::Transaction::EPTRN::Summary; |
|
9
|
|
|
|
|
23
|
|
|
9
|
|
|
|
|
195
|
|
8
|
9
|
|
|
9
|
|
3720
|
use Finance::AMEX::Transaction::EPTRN::Detail::ChargeSummary; |
|
9
|
|
|
|
|
25
|
|
|
9
|
|
|
|
|
195
|
|
9
|
9
|
|
|
9
|
|
3592
|
use Finance::AMEX::Transaction::EPTRN::Detail::RecordSummary; |
|
9
|
|
|
|
|
19
|
|
|
9
|
|
|
|
|
240
|
|
10
|
9
|
|
|
9
|
|
3457
|
use Finance::AMEX::Transaction::EPTRN::Detail::Chargeback; |
|
9
|
|
|
|
|
23
|
|
|
9
|
|
|
|
|
222
|
|
11
|
9
|
|
|
9
|
|
3542
|
use Finance::AMEX::Transaction::EPTRN::Detail::Adjustment; |
|
9
|
|
|
|
|
25
|
|
|
9
|
|
|
|
|
188
|
|
12
|
9
|
|
|
9
|
|
3462
|
use Finance::AMEX::Transaction::EPTRN::Detail::Other; |
|
9
|
|
|
|
|
40
|
|
|
9
|
|
|
|
|
228
|
|
13
|
9
|
|
|
9
|
|
3313
|
use Finance::AMEX::Transaction::EPTRN::Trailer; |
|
9
|
|
|
|
|
21
|
|
|
9
|
|
|
|
|
195
|
|
14
|
9
|
|
|
9
|
|
3135
|
use Finance::AMEX::Transaction::EPTRN::Unknown; |
|
9
|
|
|
|
|
22
|
|
|
9
|
|
|
|
|
2726
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# ABSTRACT: Parse AMEX Transaction/Invoice Level Reconciliation (EPTRN) |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub new { |
19
|
1
|
|
|
1
|
1
|
4
|
my ($class, %props) = @_; |
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
|
|
7
|
my $type_map = { |
22
|
|
|
|
|
|
|
HEADER => 'Finance::AMEX::Transaction::EPTRN::Header', |
23
|
|
|
|
|
|
|
SUMMARY => 'Finance::AMEX::Transaction::EPTRN::Summary', |
24
|
|
|
|
|
|
|
SOC_DETAIL => 'Finance::AMEX::Transaction::EPTRN::Detail::ChargeSummary', |
25
|
|
|
|
|
|
|
ROC_DETAIL => 'Finance::AMEX::Transaction::EPTRN::Detail::RecordSummary', |
26
|
|
|
|
|
|
|
CHARGEBACK_DETAIL => 'Finance::AMEX::Transaction::EPTRN::Detail::Chargeback', |
27
|
|
|
|
|
|
|
ADJUSTMENT_DETAIL => 'Finance::AMEX::Transaction::EPTRN::Detail::Adjustment', |
28
|
|
|
|
|
|
|
OTHER_DETAIL => 'Finance::AMEX::Transaction::EPTRN::Detail::Other', |
29
|
|
|
|
|
|
|
TRAILER => 'Finance::AMEX::Transaction::EPTRN::Trailer', |
30
|
|
|
|
|
|
|
}; |
31
|
|
|
|
|
|
|
|
32
|
1
|
|
|
|
|
3
|
my $self = bless {_type_map => $type_map}, $class; |
33
|
|
|
|
|
|
|
|
34
|
1
|
|
|
|
|
3
|
return $self; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
3
|
|
|
3
|
1
|
9
|
sub file_format {return 'N/A'} |
38
|
3
|
|
|
3
|
1
|
9
|
sub file_version {return 'N/A'} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub line_indicator { |
41
|
5
|
|
|
5
|
1
|
8
|
my ($self, $line) = @_; |
42
|
|
|
|
|
|
|
|
43
|
5
|
50
|
|
|
|
9
|
return if not defined $line; |
44
|
|
|
|
|
|
|
|
45
|
5
|
|
|
|
|
11
|
my $header_trailer_indicator = substr($line, 0, 5); |
46
|
|
|
|
|
|
|
|
47
|
5
|
|
|
|
|
14
|
my $indicator_map = { |
48
|
|
|
|
|
|
|
DFHDR => 'HEADER', |
49
|
|
|
|
|
|
|
DFTRL => 'TRAILER', |
50
|
|
|
|
|
|
|
}; |
51
|
|
|
|
|
|
|
|
52
|
5
|
100
|
|
|
|
14
|
if (exists $indicator_map->{$header_trailer_indicator}) { |
53
|
2
|
|
|
|
|
9
|
return $indicator_map->{$header_trailer_indicator}; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# if it is not a header or trailer, we need to look deeper |
57
|
3
|
|
|
|
|
9
|
my $summary_detail_indicator = join('-', substr($line, 42, 1), substr($line, 43, 2)); |
58
|
|
|
|
|
|
|
|
59
|
3
|
|
|
|
|
16
|
my $summary_map = { |
60
|
|
|
|
|
|
|
'1-00' => 'SUMMARY', |
61
|
|
|
|
|
|
|
'2-10' => 'SOC_DETAIL', |
62
|
|
|
|
|
|
|
'3-11' => 'ROC_DETAIL', |
63
|
|
|
|
|
|
|
'2-20' => 'CHARGEBACK_DETAIL', |
64
|
|
|
|
|
|
|
'2-30' => 'ADJUSTMENT_DETAIL', |
65
|
|
|
|
|
|
|
'2-40' => 'OTHER_DETAIL', |
66
|
|
|
|
|
|
|
'2-41' => 'OTHER_DETAIL', |
67
|
|
|
|
|
|
|
'2-50' => 'OTHER_DETAIL', |
68
|
|
|
|
|
|
|
}; |
69
|
|
|
|
|
|
|
|
70
|
3
|
50
|
|
|
|
7
|
if (exists $summary_map->{$summary_detail_indicator}) { |
71
|
3
|
|
|
|
|
12
|
return $summary_map->{$summary_detail_indicator}; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
# we don't know what it is! |
75
|
0
|
|
|
|
|
0
|
return; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub parse_line { |
79
|
6
|
|
|
6
|
1
|
12
|
my ($self, $line) = @_; |
80
|
|
|
|
|
|
|
|
81
|
6
|
100
|
|
|
|
15
|
return if not defined $line; |
82
|
|
|
|
|
|
|
|
83
|
5
|
|
|
|
|
11
|
my $indicator = $self->line_indicator($line); |
84
|
|
|
|
|
|
|
|
85
|
5
|
50
|
33
|
|
|
25
|
if ($indicator and exists $self->{_type_map}->{$indicator}) { |
86
|
5
|
|
|
|
|
47
|
return $self->{_type_map}->{$indicator}->new(line => $line); |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
0
|
|
|
|
|
|
return Finance::AMEX::Transaction::EPTRN::Unknown->new(line => $line); |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
1; |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
__END__ |