« Westpac/PaymentsPlus/Australian/Payment/Import/Trailer.pm
↑ Summary
Westpac/PaymentsPlus/Australian/Payment/Import/Payment/RemittanceOnly.pm »
| 1 | package Business::Westpac::PaymentsPlus::Australian::Payment::Import::FileHeader; | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | Business::Westpac::PaymentsPlus::Australian::Payment::Import::FileHeader | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | use Business::Westpac::PaymentsPlus::Australian::Payment::Import::FileHeader; | ||
| 10 | my $Header = Business::Westpac::PaymentsPlus::Australian::Payment::Import::FileHeader->new( | ||
| 11 | customer_code => 'TESTPAYER', | ||
| 12 | customer_name => 'TESTPAYER NAME', | ||
| 13 | customer_file_reference => 'TESTFILE001', | ||
| 14 | scheduled_date => '26082016', | ||
| 15 | ); | ||
| 16 | |||
| 17 | my @csv = $Header->to_csv; | ||
| 18 | |||
| 19 | =head1 DESCRIPTION | ||
| 20 | |||
| 21 | Class for Westpac Australian payment import CSV file header | ||
| 22 | |||
| 23 | =cut | ||
| 24 | |||
| 25 | 2 | ▶ | use feature qw/ signatures /; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 26 | |||
| 27 | 2 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 28 | 2 | with 'Business::Westpac::Role::CSV'; | |
| 29 | 2 | ▶ | no warnings qw/ experimental::signatures /; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 30 | |||
| 31 | 2 | ▶ | use Business::Westpac::Types qw/ |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 32 | add_max_string_attribute | ||
| 33 | 2 | /; | |
| 34 | |||
| 35 | =head1 ATTRIBUTES | ||
| 36 | |||
| 37 | All attributes are required and are read only | ||
| 38 | |||
| 39 | =head2 customer_code (Str, max 10 chars) | ||
| 40 | |||
| 41 | =head2 customer_name (Str, max 40 chars) | ||
| 42 | |||
| 43 | =head2 customer_file_reference (Str, max 20 chars) | ||
| 44 | |||
| 45 | =head2 scheduled_date (DateTime, or coerced from DDMMYYYY) | ||
| 46 | |||
| 47 | =cut | ||
| 48 | |||
| 49 | 1 | ▶ | sub record_type { 'H' } |
|
Subroutine
record_type: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 50 | 1 | ▶ | sub currency { 'AUD' } |
|
Subroutine
currency: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 51 | 1 | ▶ | sub version { '6' } |
|
Subroutine
version: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 52 | |||
| 53 | 2 | foreach my $str_attr ( | |
| 54 | 'CustomerCode[10]', | ||
| 55 | 'CustomerName[40]', | ||
| 56 | 'CustomerFileReference[20]', | ||
| 57 | ) { | ||
| 58 | 6 | __PACKAGE__->add_max_string_attribute( | |
| 59 | $str_attr, | ||
| 60 | is => 'ro', | ||
| 61 | required => 1, | ||
| 62 | ); | ||
| 63 | } | ||
| 64 | |||
| 65 | 2 | has 'scheduled_date' => ( | |
| 66 | is => 'ro', | ||
| 67 | isa => 'WestpacDate', | ||
| 68 | required => 1, | ||
| 69 | coerce => 1, | ||
| 70 | handles => { | ||
| 71 | csv_date => [ strftime => '%d%m%C%y' ], | ||
| 72 | }, | ||
| 73 | ); | ||
| 74 | |||
| 75 | =head1 METHODS | ||
| 76 | |||
| 77 | =head2 to_csv | ||
| 78 | |||
| 79 | Convert the attributes to CSV line(s): | ||
| 80 | |||
| 81 | my @csv = $Header->to_csv; | ||
| 82 | |||
| 83 | =cut | ||
| 84 | |||
| 85 | 1 | ▶ | sub to_csv ( $self ) { |
|
Subroutine
to_csv: called CC=1 SCAR=0.0
Pod
documented
| |||
| 86 | |||
| 87 | 1 | return $self->attributes_to_csv( | |
| 88 | qw/ | ||
| 89 | record_type | ||
| 90 | customer_code | ||
| 91 | customer_name | ||
| 92 | customer_file_reference | ||
| 93 | csv_date | ||
| 94 | currency | ||
| 95 | version | ||
| 96 | / | ||
| 97 | ); | ||
| 98 | } | ||
| 99 | |||
| 100 | =head1 SEE ALSO | ||
| 101 | |||
| 102 | L<Business::Westpac::Types> | ||
| 103 | |||
| 104 | =cut | ||
| 105 | |||
| 106 | 2 | __PACKAGE__->meta->make_immutable; | |