line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Finance::AMEX::Transaction::EPRAW; |
2
|
|
|
|
|
|
|
$Finance::AMEX::Transaction::EPRAW::VERSION = '0.004'; |
3
|
8
|
|
|
8
|
|
58
|
use strict; |
|
8
|
|
|
|
|
15
|
|
|
8
|
|
|
|
|
234
|
|
4
|
8
|
|
|
8
|
|
42
|
use warnings; |
|
8
|
|
|
|
|
17
|
|
|
8
|
|
|
|
|
216
|
|
5
|
|
|
|
|
|
|
|
6
|
8
|
|
|
8
|
|
3883
|
use Finance::AMEX::Transaction::EPRAW::Header; |
|
8
|
|
|
|
|
21
|
|
|
8
|
|
|
|
|
231
|
|
7
|
8
|
|
|
8
|
|
3841
|
use Finance::AMEX::Transaction::EPRAW::Summary; |
|
8
|
|
|
|
|
23
|
|
|
8
|
|
|
|
|
210
|
|
8
|
8
|
|
|
8
|
|
4120
|
use Finance::AMEX::Transaction::EPRAW::Detail::ChargeSummary; |
|
8
|
|
|
|
|
84
|
|
|
8
|
|
|
|
|
286
|
|
9
|
8
|
|
|
8
|
|
4291
|
use Finance::AMEX::Transaction::EPRAW::Detail::Chargeback; |
|
8
|
|
|
|
|
28
|
|
|
8
|
|
|
|
|
216
|
|
10
|
8
|
|
|
8
|
|
4216
|
use Finance::AMEX::Transaction::EPRAW::Detail::Adjustment; |
|
8
|
|
|
|
|
25
|
|
|
8
|
|
|
|
|
212
|
|
11
|
8
|
|
|
8
|
|
4021
|
use Finance::AMEX::Transaction::EPRAW::Detail::Other; |
|
8
|
|
|
|
|
28
|
|
|
8
|
|
|
|
|
215
|
|
12
|
8
|
|
|
8
|
|
3745
|
use Finance::AMEX::Transaction::EPRAW::Trailer; |
|
8
|
|
|
|
|
26
|
|
|
8
|
|
|
|
|
213
|
|
13
|
8
|
|
|
8
|
|
3675
|
use Finance::AMEX::Transaction::EPRAW::Unknown; |
|
8
|
|
|
|
|
22
|
|
|
8
|
|
|
|
|
3540
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# ABSTRACT: Parse AMEX Reconciliation Files (EPRAW) |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub new { |
18
|
2
|
|
|
2
|
1
|
9
|
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
|
|
|
|
|
8
|
my $self = bless { |
31
|
|
|
|
|
|
|
_type_map => $type_map, |
32
|
|
|
|
|
|
|
}, $class; |
33
|
|
|
|
|
|
|
|
34
|
2
|
|
|
|
|
8
|
return $self; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub parse_line { |
38
|
42
|
|
|
42
|
1
|
130
|
my ($self, $line) = @_; |
39
|
|
|
|
|
|
|
|
40
|
42
|
100
|
|
|
|
142
|
return if not defined $line; |
41
|
|
|
|
|
|
|
|
42
|
40
|
|
|
|
|
112
|
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
|
|
|
|
|
93
|
my $indicator = 'UNKNOWN'; |
53
|
|
|
|
|
|
|
|
54
|
40
|
100
|
|
|
|
232
|
if ($header_trailer_indicator eq 'DFHDR') { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
55
|
6
|
|
|
|
|
17
|
$indicator = 'HEADER'; |
56
|
|
|
|
|
|
|
} elsif ($header_trailer_indicator eq 'DFTRL') { |
57
|
6
|
|
|
|
|
19
|
$indicator = 'TRAILER'; |
58
|
|
|
|
|
|
|
} elsif ($indicator eq 'UNKNOWN') { |
59
|
28
|
|
|
|
|
130
|
my $summary_detail_indicator = join('-', substr($line, 42, 1), substr($line, 43, 2)); |
60
|
28
|
100
|
33
|
|
|
131
|
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
|
|
|
|
|
31
|
$indicator = 'SOC_DETAIL'; |
64
|
|
|
|
|
|
|
} elsif ($summary_detail_indicator eq '2-20') { |
65
|
5
|
|
|
|
|
18
|
$indicator = 'CHARGEBACK_DETAIL'; |
66
|
|
|
|
|
|
|
} elsif ($summary_detail_indicator eq '2-30') { |
67
|
1
|
|
|
|
|
3
|
$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
|
|
|
|
178
|
if (exists $self->{_type_map}->{$indicator}) { |
73
|
40
|
|
|
|
|
341
|
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__ |