| 1 | package Finance::AMEX::Transaction::EPRAW; | ||||||||||||||||||||||||||||||||||
| 2 | 7 | $Finance::AMEX::Transaction::EPRAW::VERSION = '0.003'; | |||||||||||||||||||||||||||||||||
| 3 | 7 | ▶ | use strict; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 4 | 7 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||
| 6 | 7 | ▶ | use Finance::AMEX::Transaction::EPRAW::Header; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 7 | 7 | ▶ | use Finance::AMEX::Transaction::EPRAW::Summary; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 8 | 7 | ▶ | use Finance::AMEX::Transaction::EPRAW::Detail::ChargeSummary; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 9 | 7 | ▶ | use Finance::AMEX::Transaction::EPRAW::Detail::Chargeback; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 10 | 7 | ▶ | use Finance::AMEX::Transaction::EPRAW::Detail::Adjustment; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 11 | 7 | ▶ | use Finance::AMEX::Transaction::EPRAW::Detail::Other; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 12 | 7 | ▶ | use Finance::AMEX::Transaction::EPRAW::Trailer; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 13 | 7 | ▶ | use Finance::AMEX::Transaction::EPRAW::Unknown; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||
| 15 | # ABSTRACT: Parse AMEX Reconciliation Files (EPRAW) | ||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||
| 17 | sub new { | ||||||||||||||||||||||||||||||||||
| 18 | 2 | ▶ | my ($class, %props) = @_; | ||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||
| 20 | 2 | 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 | my $self = bless { | |||||||||||||||||||||||||||||||||
| 31 | _type_map => $type_map, | ||||||||||||||||||||||||||||||||||
| 32 | }, $class; | ||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||
| 34 | 2 | return $self; | |||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||
| 37 | sub parse_line { | ||||||||||||||||||||||||||||||||||
| 38 | 42 | ▶ | my ($self, $line) = @_; | ||||||||||||||||||||||||||||||||
|
Subroutine
parse_line: called CC=13 SCAR=26.5
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||
| 40 | 42 | ▶ | return if not defined $line; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||
| 42 | 40 | 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 | my $indicator = 'UNKNOWN'; | |||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||
| 54 | 40 | ▶ | if ($header_trailer_indicator eq 'DFHDR') { | ||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||
| 55 | 6 | $indicator = 'HEADER'; | |||||||||||||||||||||||||||||||||
| 56 | } elsif ($header_trailer_indicator eq 'DFTRL') { | ||||||||||||||||||||||||||||||||||
| 57 | 6 | $indicator = 'TRAILER'; | |||||||||||||||||||||||||||||||||
| 58 | } elsif ($indicator eq 'UNKNOWN') { | ||||||||||||||||||||||||||||||||||
| 59 | 28 | my $summary_detail_indicator = join('-', substr($line, 42, 1), substr($line, 43, 2)); | |||||||||||||||||||||||||||||||||
| 60 | 28 | ▶ | if ($summary_detail_indicator eq '1-00') { | ||||||||||||||||||||||||||||||||
|
Branch: 5 branches
| |||||||||||||||||||||||||||||||||||
| 61 | 6 | $indicator = 'SUMMARY'; | |||||||||||||||||||||||||||||||||
| 62 | } elsif ($summary_detail_indicator eq '2-10') { | ||||||||||||||||||||||||||||||||||
| 63 | 14 | $indicator = 'SOC_DETAIL'; | |||||||||||||||||||||||||||||||||
| 64 | } elsif ($summary_detail_indicator eq '2-20') { | ||||||||||||||||||||||||||||||||||
| 65 | 5 | $indicator = 'CHARGEBACK_DETAIL'; | |||||||||||||||||||||||||||||||||
| 66 | } elsif ($summary_detail_indicator eq '2-30') { | ||||||||||||||||||||||||||||||||||
| 67 | 1 | $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') { | |||||||||||||||||||||||||||||||||
|
Condition33%2/6
$summary_detail_indicator eq "2-40" or $summary_detail_indicator eq "2-41" or $summary_detail_indicator eq "2-50"
$summary_detail_indicator eq "2-40" or $summary_detail_indicator eq "2-41"
MC/DC0%0/3
$summary_detail_indicator eq "2-40" or $summary_detail_indicator eq "2-41" or $summary_detail_indicator eq "2-50"
$summary_detail_indicator eq "2-40"
$summary_detail_indicator eq "2-41"
$summary_detail_indicator eq "2-50"
Truth table25%1/4
A or B or C
A= $summary_detail_indicator eq "2-40"B= $summary_detail_indicator eq "2-41"C= $summary_detail_indicator eq "2-50"
| |||||||||||||||||||||||||||||||||||
| 69 | 2 | $indicator = 'OTHER_DETAIL'; | |||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||||||||
| 72 | 40 | ▶ | if (exists $self->{_type_map}->{$indicator}) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 73 | 40 | return $self->{_type_map}->{$indicator}->new(line => $line); | |||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||||
| 75 | 0 | return Finance::AMEX::Transaction::EPRAW::Unknown->new(line => $line); | |||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||
| 78 | 7 | 1; | |||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||
| 80 | __END__ | ||||||||||||||||||||||||||||||||||