line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Finance::AMEX::Transaction::EPRAW; |
2
|
|
|
|
|
|
|
$Finance::AMEX::Transaction::EPRAW::VERSION = '0.003'; |
3
|
7
|
|
|
7
|
|
44
|
use strict; |
|
7
|
|
|
|
|
14
|
|
|
7
|
|
|
|
|
186
|
|
4
|
7
|
|
|
7
|
|
35
|
use warnings; |
|
7
|
|
|
|
|
14
|
|
|
7
|
|
|
|
|
204
|
|
5
|
|
|
|
|
|
|
|
6
|
7
|
|
|
7
|
|
2907
|
use Finance::AMEX::Transaction::EPRAW::Header; |
|
7
|
|
|
|
|
17
|
|
|
7
|
|
|
|
|
186
|
|
7
|
7
|
|
|
7
|
|
2940
|
use Finance::AMEX::Transaction::EPRAW::Summary; |
|
7
|
|
|
|
|
17
|
|
|
7
|
|
|
|
|
168
|
|
8
|
7
|
|
|
7
|
|
3220
|
use Finance::AMEX::Transaction::EPRAW::Detail::ChargeSummary; |
|
7
|
|
|
|
|
19
|
|
|
7
|
|
|
|
|
188
|
|
9
|
7
|
|
|
7
|
|
3149
|
use Finance::AMEX::Transaction::EPRAW::Detail::Chargeback; |
|
7
|
|
|
|
|
19
|
|
|
7
|
|
|
|
|
174
|
|
10
|
7
|
|
|
7
|
|
3121
|
use Finance::AMEX::Transaction::EPRAW::Detail::Adjustment; |
|
7
|
|
|
|
|
17
|
|
|
7
|
|
|
|
|
169
|
|
11
|
7
|
|
|
7
|
|
3147
|
use Finance::AMEX::Transaction::EPRAW::Detail::Other; |
|
7
|
|
|
|
|
20
|
|
|
7
|
|
|
|
|
174
|
|
12
|
7
|
|
|
7
|
|
2913
|
use Finance::AMEX::Transaction::EPRAW::Trailer; |
|
7
|
|
|
|
|
18
|
|
|
7
|
|
|
|
|
176
|
|
13
|
7
|
|
|
7
|
|
2810
|
use Finance::AMEX::Transaction::EPRAW::Unknown; |
|
7
|
|
|
|
|
19
|
|
|
7
|
|
|
|
|
1818
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# ABSTRACT: Parse AMEX Reconciliation Files (EPRAW) |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub new { |
18
|
2
|
|
|
2
|
1
|
8
|
my ($class, %props) = @_; |
19
|
|
|
|
|
|
|
|
20
|
2
|
|
|
|
|
14
|
my $type_map = { |
21
|
|
|
|
|
|
|
HEADER => 'Finance::AMEX::Transaction::EPRAW::Header', |
22
|
|
|
|
|
|
|
SUMMARY => 'Finance::AMEX::Transaction::EPRAW::Summary', |
23
|
|
|
|
|
|
|
SOC_DETAIL => 'Finance::AMEX::Transaction::EPRAW::Detail::ChargeSummary', |
24
|
|
|
|
|
|
|
CHARGEBACK_DETAIL => 'Finance::AMEX::Transaction::EPRAW::Detail::Chargeback', |
25
|
|
|
|
|
|
|
ADJUSTMENT_DETAIL => 'Finance::AMEX::Transaction::EPRAW::Detail::Adjustment', |
26
|
|
|
|
|
|
|
OTHER_DETAIL => 'Finance::AMEX::Transaction::EPRAW::Detail::Other', |
27
|
|
|
|
|
|
|
TRAILER => 'Finance::AMEX::Transaction::EPRAW::Trailer', |
28
|
|
|
|
|
|
|
}; |
29
|
|
|
|
|
|
|
|
30
|
2
|
|
|
|
|
7
|
my $self = bless { |
31
|
|
|
|
|
|
|
_type_map => $type_map, |
32
|
|
|
|
|
|
|
}, $class; |
33
|
|
|
|
|
|
|
|
34
|
2
|
|
|
|
|
9
|
return $self; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub parse_line { |
38
|
42
|
|
|
42
|
1
|
100
|
my ($self, $line) = @_; |
39
|
|
|
|
|
|
|
|
40
|
42
|
100
|
|
|
|
138
|
return if not defined $line; |
41
|
|
|
|
|
|
|
|
42
|
40
|
|
|
|
|
113
|
my $header_trailer_indicator = substr($line, 0, 5); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# DFHDR = header |
45
|
|
|
|
|
|
|
# DFTRL = trailer |
46
|
|
|
|
|
|
|
# 1-00 = summary |
47
|
|
|
|
|
|
|
# 2-10 = SOC detail |
48
|
|
|
|
|
|
|
# 2-20 = Chargeback detail |
49
|
|
|
|
|
|
|
# 2-30 = Adjustment detail |
50
|
|
|
|
|
|
|
# 2-40, 2-41, 2-50 = Other Fees and Revenues detail |
51
|
|
|
|
|
|
|
|
52
|
40
|
|
|
|
|
73
|
my $indicator = 'UNKNOWN'; |
53
|
|
|
|
|
|
|
|
54
|
40
|
100
|
|
|
|
210
|
if ($header_trailer_indicator eq 'DFHDR') { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
55
|
6
|
|
|
|
|
15
|
$indicator = 'HEADER'; |
56
|
|
|
|
|
|
|
} elsif ($header_trailer_indicator eq 'DFTRL') { |
57
|
6
|
|
|
|
|
16
|
$indicator = 'TRAILER'; |
58
|
|
|
|
|
|
|
} elsif ($indicator eq 'UNKNOWN') { |
59
|
28
|
|
|
|
|
109
|
my $summary_detail_indicator = join('-', substr($line, 42, 1), substr($line, 43, 2)); |
60
|
28
|
100
|
33
|
|
|
136
|
if ($summary_detail_indicator eq '1-00') { |
|
|
100
|
33
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
61
|
6
|
|
|
|
|
19
|
$indicator = 'SUMMARY'; |
62
|
|
|
|
|
|
|
} elsif ($summary_detail_indicator eq '2-10') { |
63
|
14
|
|
|
|
|
29
|
$indicator = 'SOC_DETAIL'; |
64
|
|
|
|
|
|
|
} elsif ($summary_detail_indicator eq '2-20') { |
65
|
5
|
|
|
|
|
12
|
$indicator = 'CHARGEBACK_DETAIL'; |
66
|
|
|
|
|
|
|
} elsif ($summary_detail_indicator eq '2-30') { |
67
|
1
|
|
|
|
|
4
|
$indicator = 'ADJUSTMENT_DETAIL'; |
68
|
|
|
|
|
|
|
} elsif ($summary_detail_indicator eq '2-40' or $summary_detail_indicator eq '2-41' or $summary_detail_indicator eq '2-50') { |
69
|
2
|
|
|
|
|
7
|
$indicator = 'OTHER_DETAIL'; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
} |
72
|
40
|
50
|
|
|
|
137
|
if (exists $self->{_type_map}->{$indicator}) { |
73
|
40
|
|
|
|
|
319
|
return $self->{_type_map}->{$indicator}->new(line => $line); |
74
|
|
|
|
|
|
|
} |
75
|
0
|
|
|
|
|
|
return Finance::AMEX::Transaction::EPRAW::Unknown->new(line => $line); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
1; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
__END__ |