line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Finance::AMEX::Transaction::EPRAW 0.005; |
2
|
|
|
|
|
|
|
|
3
|
9
|
|
|
9
|
|
52
|
use strict; |
|
9
|
|
|
|
|
15
|
|
|
9
|
|
|
|
|
215
|
|
4
|
9
|
|
|
9
|
|
37
|
use warnings; |
|
9
|
|
|
|
|
14
|
|
|
9
|
|
|
|
|
177
|
|
5
|
|
|
|
|
|
|
|
6
|
9
|
|
|
9
|
|
3377
|
use Finance::AMEX::Transaction::EPRAW::Header; |
|
9
|
|
|
|
|
24
|
|
|
9
|
|
|
|
|
235
|
|
7
|
9
|
|
|
9
|
|
3439
|
use Finance::AMEX::Transaction::EPRAW::Summary; |
|
9
|
|
|
|
|
19
|
|
|
9
|
|
|
|
|
200
|
|
8
|
9
|
|
|
9
|
|
3685
|
use Finance::AMEX::Transaction::EPRAW::Detail::ChargeSummary; |
|
9
|
|
|
|
|
22
|
|
|
9
|
|
|
|
|
193
|
|
9
|
9
|
|
|
9
|
|
3642
|
use Finance::AMEX::Transaction::EPRAW::Detail::Chargeback; |
|
9
|
|
|
|
|
23
|
|
|
9
|
|
|
|
|
192
|
|
10
|
9
|
|
|
9
|
|
3628
|
use Finance::AMEX::Transaction::EPRAW::Detail::Adjustment; |
|
9
|
|
|
|
|
20
|
|
|
9
|
|
|
|
|
190
|
|
11
|
9
|
|
|
9
|
|
3552
|
use Finance::AMEX::Transaction::EPRAW::Detail::Other; |
|
9
|
|
|
|
|
20
|
|
|
9
|
|
|
|
|
201
|
|
12
|
9
|
|
|
9
|
|
3235
|
use Finance::AMEX::Transaction::EPRAW::Trailer; |
|
9
|
|
|
|
|
22
|
|
|
9
|
|
|
|
|
197
|
|
13
|
9
|
|
|
9
|
|
3184
|
use Finance::AMEX::Transaction::EPRAW::Unknown; |
|
9
|
|
|
|
|
20
|
|
|
9
|
|
|
|
|
2533
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# ABSTRACT: Parse AMEX Reconciliation Files (EPRAW) |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub new { |
18
|
2
|
|
|
2
|
1
|
9
|
my ($class, %props) = @_; |
19
|
|
|
|
|
|
|
|
20
|
2
|
|
|
|
|
11
|
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
|
|
|
|
|
6
|
my $self = bless {_type_map => $type_map}, $class; |
31
|
|
|
|
|
|
|
|
32
|
2
|
|
|
|
|
6
|
return $self; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
6
|
|
|
6
|
1
|
18
|
sub file_format {return 'N/A'} |
36
|
6
|
|
|
6
|
1
|
14
|
sub file_version {return 'N/A'} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub line_indicator { |
39
|
40
|
|
|
40
|
1
|
65
|
my ($self, $line) = @_; |
40
|
|
|
|
|
|
|
|
41
|
40
|
50
|
|
|
|
79
|
return if not defined $line; |
42
|
|
|
|
|
|
|
|
43
|
40
|
|
|
|
|
79
|
my $header_trailer_indicator = substr($line, 0, 5); |
44
|
|
|
|
|
|
|
|
45
|
40
|
|
|
|
|
112
|
my $indicator_map = { |
46
|
|
|
|
|
|
|
DFHDR => 'HEADER', |
47
|
|
|
|
|
|
|
DFTRL => 'TRAILER', |
48
|
|
|
|
|
|
|
}; |
49
|
|
|
|
|
|
|
|
50
|
40
|
100
|
|
|
|
104
|
if (exists $indicator_map->{$header_trailer_indicator}) { |
51
|
12
|
|
|
|
|
38
|
return $indicator_map->{$header_trailer_indicator}; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# if it is not a header or trailer, we need to look deeper |
55
|
28
|
|
|
|
|
74
|
my $summary_detail_indicator = join('-', substr($line, 42, 1), substr($line, 43, 2)); |
56
|
|
|
|
|
|
|
|
57
|
28
|
|
|
|
|
119
|
my $summary_map = { |
58
|
|
|
|
|
|
|
'1-00' => 'SUMMARY', |
59
|
|
|
|
|
|
|
'2-10' => 'SOC_DETAIL', |
60
|
|
|
|
|
|
|
'2-20' => 'CHARGEBACK_DETAIL', |
61
|
|
|
|
|
|
|
'2-30' => 'ADJUSTMENT_DETAIL', |
62
|
|
|
|
|
|
|
'2-40' => 'OTHER_DETAIL', |
63
|
|
|
|
|
|
|
'2-41' => 'OTHER_DETAIL', |
64
|
|
|
|
|
|
|
'2-50' => 'OTHER_DETAIL', |
65
|
|
|
|
|
|
|
}; |
66
|
|
|
|
|
|
|
|
67
|
28
|
50
|
|
|
|
64
|
if (exists $summary_map->{$summary_detail_indicator}) { |
68
|
28
|
|
|
|
|
104
|
return $summary_map->{$summary_detail_indicator}; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
# we don't know what it is! |
72
|
0
|
|
|
|
|
0
|
return; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub parse_line { |
76
|
42
|
|
|
42
|
1
|
76
|
my ($self, $line) = @_; |
77
|
|
|
|
|
|
|
|
78
|
42
|
100
|
|
|
|
99
|
return if not defined $line; |
79
|
|
|
|
|
|
|
|
80
|
40
|
|
|
|
|
79
|
my $indicator = $self->line_indicator($line); |
81
|
|
|
|
|
|
|
|
82
|
40
|
50
|
33
|
|
|
186
|
if ($indicator and exists $self->{_type_map}->{$indicator}) { |
83
|
40
|
|
|
|
|
218
|
return $self->{_type_map}->{$indicator}->new(line => $line); |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
0
|
|
|
|
|
|
return Finance::AMEX::Transaction::EPRAW::Unknown->new(line => $line); |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
1; |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
__END__ |