File Coverage

blib/lib/Finance/AMEX/Transaction/GRRCN/TxnPricing.pm
Criterion Covered Total %
statement 40 40 100.0
branch 2 2 100.0
condition n/a
subroutine 27 27 100.0
pod 24 24 100.0
total 93 93 100.0


line stmt bran cond sub pod time code
1             package Finance::AMEX::Transaction::GRRCN::TxnPricing 0.005;
2              
3 10     10   62362 use strict;
  10         27  
  10         251  
4 10     10   45 use warnings;
  10         17  
  10         224  
5              
6             # ABSTRACT: Parse AMEX Global Reconciliation (GRRCN) Transaction or ROC pricing Rows
7              
8 10     10   53 use base 'Finance::AMEX::Transaction::GRRCN::Base';
  10         16  
  10         6494  
9              
10             sub field_map {
11 84     84 1 378 my ($self) = @_;
12              
13             # order is important here for the CSV and TSV file formats
14 84         1277 my $map = [
15             {RECORD_TYPE => [1, 10]},
16             {PAYEE_MERCHANT_ID => [11, 15]},
17             {SETTLEMENT_ACCOUNT_TYPE_CODE => [26, 3]},
18             {AMERICAN_EXPRESS_PAYMENT_NUMBER => [29, 10]},
19             {PAYMENT_DATE => [39, 8]},
20             {PAYMENT_CURRENCY => [47, 3]},
21             {SUBMISSION_MERCHANT_ID => [50, 15]},
22             {MERCHANT_LOCATION_ID => [65, 15]},
23             {FILLER1 => [80, 15]},
24             {INVOICE_REFERENCE_NUMBER => [95, 30]},
25             {SELLER_ID => [125, 20]},
26             {CARDMEMBER_ACCOUNT_NUMBER => [145, 19]},
27             {TRANSACTION_AMOUNT => [164, 16]},
28             {TRANSACTION_DATE => [180, 8]},
29             {FEE_CODE => [188, 2]},
30             {FILLER2 => [190, 7]},
31             {FEE_AMOUNT => [197, 22]},
32             {DISCOUNT_RATE => [219, 7]},
33             {DISCOUNT_AMOUNT => [226, 22]},
34             {FILLER3 => [248, 553]},
35             ];
36              
37 84 100       261 if ($self->file_version >= 3.01) {
38 1         3 pop @{$map}; # the last filler column changes for v3.01, so we remove it
  1         2  
39              
40 1         3 push @{$map} => (
  1         9  
41             {ROUNDED_FEE_AMOUNT => [248, 16]}, # v3.01
42             {ROUNDED_DISCOUNT_AMOUNT => [264, 16]}, # v3.01
43             {FEE_AMOUNT_SETTLEMENT_CURRENCY => [280, 22]}, # v3.01
44             {DISCOUNT_AMOUNT_SETTLEMENT_CURRENCY => [302, 22]}, # v3.01
45             {TRANSACTION_AMOUNT_SETTLEMENT_CURRENCY => [324, 16]}, # v3.01
46             {FILLER3 => [340, 461]}, # v3.01
47             );
48             }
49              
50 84         214 return $map;
51             }
52              
53 82     82 1 20085 sub type {return 'TXNPRICING'}
54              
55 43     43 1 599 sub RECORD_TYPE {return $_[0]->_get_column('RECORD_TYPE')}
56 41     41 1 19765 sub PAYEE_MERCHANT_ID {return $_[0]->_get_column('PAYEE_MERCHANT_ID')}
57 41     41 1 19504 sub SETTLEMENT_ACCOUNT_TYPE_CODE {return $_[0]->_get_column('SETTLEMENT_ACCOUNT_TYPE_CODE')}
58 41     41 1 19524 sub AMERICAN_EXPRESS_PAYMENT_NUMBER {return $_[0]->_get_column('AMERICAN_EXPRESS_PAYMENT_NUMBER')}
59 41     41 1 19555 sub PAYMENT_DATE {return $_[0]->_get_column('PAYMENT_DATE')}
60 41     41 1 19529 sub PAYMENT_CURRENCY {return $_[0]->_get_column('PAYMENT_CURRENCY')}
61 41     41 1 19718 sub SUBMISSION_MERCHANT_ID {return $_[0]->_get_column('SUBMISSION_MERCHANT_ID')}
62 41     41 1 19472 sub MERCHANT_LOCATION_ID {return $_[0]->_get_column('MERCHANT_LOCATION_ID')}
63 41     41 1 19865 sub INVOICE_REFERENCE_NUMBER {return $_[0]->_get_column('INVOICE_REFERENCE_NUMBER')}
64 41     41 1 19480 sub SELLER_ID {return $_[0]->_get_column('SELLER_ID')}
65 41     41 1 19867 sub CARDMEMBER_ACCOUNT_NUMBER {return $_[0]->_get_column('CARDMEMBER_ACCOUNT_NUMBER')}
66 41     41 1 19595 sub TRANSACTION_AMOUNT {return $_[0]->_get_column('TRANSACTION_AMOUNT')}
67 41     41 1 19639 sub TRANSACTION_DATE {return $_[0]->_get_column('TRANSACTION_DATE')}
68 41     41 1 19418 sub FEE_CODE {return $_[0]->_get_column('FEE_CODE')}
69 41     41 1 19485 sub FEE_AMOUNT {return $_[0]->_get_column('FEE_AMOUNT')}
70 41     41 1 19584 sub DISCOUNT_RATE {return $_[0]->_get_column('DISCOUNT_RATE')}
71 41     41 1 21058 sub DISCOUNT_AMOUNT {return $_[0]->_get_column('DISCOUNT_AMOUNT')}
72              
73 2     2 1 1060 sub ROUNDED_FEE_AMOUNT {return $_[0]->_get_column('ROUNDED_FEE_AMOUNT')}
74 2     2 1 456 sub ROUNDED_DISCOUNT_AMOUNT {return $_[0]->_get_column('ROUNDED_DISCOUNT_AMOUNT')}
75 2     2 1 459 sub FEE_AMOUNT_SETTLEMENT_CURRENCY {return $_[0]->_get_column('FEE_AMOUNT_SETTLEMENT_CURRENCY')}
76 2     2 1 453 sub DISCOUNT_AMOUNT_SETTLEMENT_CURRENCY {return $_[0]->_get_column('DISCOUNT_AMOUNT_SETTLEMENT_CURRENCY')}
77 2     2 1 454 sub TRANSACTION_AMOUNT_SETTLEMENT_CURRENCY {return $_[0]->_get_column('TRANSACTION_AMOUNT_SETTLEMENT_CURRENCY')}
78              
79             1;
80              
81             __END__