File Coverage

blib/lib/Business/NAB/Australian/DirectEntry/Report/PaymentRecord.pm
Criterion Covered Total %
statement 31 31 100.0
branch 2 2 100.0
condition n/a
subroutine 10 10 100.0
pod 0 2 0.0
total 43 45 95.5


line stmt bran cond sub pod time code
1             package Business::NAB::Australian::DirectEntry::Report::PaymentRecord;
2             $Business::NAB::Australian::DirectEntry::Report::PaymentRecord::VERSION = '0.03';
3             =head1 NAME
4              
5             Business::NAB::Australian::DirectEntry::Report::PaymentRecord
6              
7             =head1 SYNOPSIS
8              
9             =head1 DESCRIPTION
10              
11             Class for payment record in the Australian Direct Entry Report file
12              
13             =cut;
14              
15 3     3   1080049 use strict;
  3         9  
  3         122  
16 3     3   17 use warnings;
  3         7  
  3         236  
17 3     3   21 use feature qw/ signatures /;
  3         7  
  3         425  
18              
19 3     3   686 use Moose;
  3         581494  
  3         25  
20             extends 'Business::NAB::CSV';
21 3     3   26247 no warnings qw/ experimental::signatures /;
  3         8  
  3         173  
22              
23 3         1456 use Business::NAB::Types qw/
24             add_max_string_attribute
25 3     3   842 /;
  3         10  
26              
27             =head1 ATTRIBUTES
28              
29             All are Str types, required, except where stated
30              
31             =over
32              
33             =item payment_type
34              
35             =item lodgement_ref
36              
37             =item amount (NAB::Type::PositiveInt)
38              
39             =item currency
40              
41             =item credit_debit
42              
43             =item title_of_account
44              
45             =item bsb_number (NAB::Type::BSBNumber)
46              
47             =item account_number (NAB::Type::AccountNumber)
48              
49             =back
50              
51             =cut
52              
53 16 100   16   38 sub _record_type ( $self ) { $self->is_credit ? '53' : '57' }
  16         34  
  16         29  
  16         48  
54              
55             sub _attributes {
56 26     26   165 return qw/
57             payment_type
58             lodgement_ref
59             amount
60             currency
61             credit_debit
62             title_of_account
63             bsb_number
64             account_number
65             /;
66             }
67              
68             has [ qw/ amount / ] => (
69             is => 'ro',
70             isa => 'NAB::Type::PositiveInt',
71             required => 1,
72             );
73              
74             has [ qw/ bsb_number / ] => (
75             is => 'ro',
76             isa => 'NAB::Type::BSBNumber',
77             required => 1,
78             coerce => 1,
79             );
80              
81             has [ qw/ account_number / ] => (
82             is => 'ro',
83             isa => 'NAB::Type::AccountNumber',
84             required => 1,
85             );
86              
87             foreach my $str_attr (
88             grep { $_ !~ /bsb|amount|account_number/ } __PACKAGE__->_attributes
89             ) {
90             __PACKAGE__->add_max_string_attribute(
91             $str_attr,
92             is => 'ro',
93             required => 1,
94             );
95             }
96              
97 32     32 0 90 sub is_credit ( $self ) { return $self->credit_debit eq 'CR' }
  32         61  
  32         88  
  32         104  
98 16     16 0 2335 sub is_debit ( $self ) { return $self->credit_debit eq 'DR' }
  16         32  
  16         28  
  16         53  
99              
100             __PACKAGE__->meta->make_immutable;