File Coverage

blib/lib/Business/Westpac/PaymentsPlus/Australian/Payment/Import/Payment/RealTime.pm
Criterion Covered Total %
statement 17 17 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod 1 2 50.0
total 24 25 96.0


line stmt bran cond sub pod time code
1             package Business::Westpac::PaymentsPlus::Australian::Payment::Import::Payment::RealTime;
2              
3             =head1 NAME
4              
5             Business::Westpac::PaymentsPlus::Australian::Payment::Import::Payment::RealTime
6              
7             =head1 SYNOPSIS
8              
9             use Business::Westpac::PaymentsPlus::Australian::Payment::Import::Payment::RealTime;
10              
11             my $RealTime = Business::Westpac::PaymentsPlus::Australian::Payment::Import::Payment::RealTime->new(
12             payer_payment_reference => 'REF00005',
13             payment_amount => '123.23',
14             recipient_reference => 'REF00005',
15             account_number => '000002',
16             account_name => 'Payee 5',
17             bsb_number => '062-000',
18             funding_bsb_number => '032-000',
19             funding_account_number => '000007',
20             );
21              
22             =head1 DESCRIPTION
23              
24             Class for modeling Real Time payments in the context of Westpac CSV files.
25              
26             Extends L<Business::Westpac::PaymentsPlus::Australian::Payment::Import::Payment>.
27              
28             =cut
29              
30 3     3   443230 use feature qw/ signatures /;
  3         8  
  3         586  
31              
32 3     3   683 use Moose;
  3         578463  
  3         28  
33             extends 'Business::Westpac::PaymentsPlus::Australian::Payment::Import::Payment::Cheque';
34 3     3   28973 no warnings qw/ experimental::signatures /;
  3         8  
  3         200  
35              
36 3         1011 use Business::Westpac::Types qw/
37             add_max_string_attribute
38 3     3   741 /;
  3         12  
39              
40             =head1 ATTRIBUTES
41              
42             All attributes are required, except were stated, and are read only
43              
44             =over
45              
46             =item recipient_reference (Str, max 16 chars)
47              
48             =item account_number (Str, max 15 chars)
49              
50             =item account_name (Str, max 35 chars)
51              
52             =item bsb_number (BSBNumber)
53              
54             =back
55              
56             =cut
57              
58             foreach my $str_attr (
59             'RecipientReference[16]',
60             'AccountNumber[15]',
61             'AccountName[35]',
62             ) {
63             __PACKAGE__->add_max_string_attribute(
64             $str_attr,
65             is => 'ro',
66             required => 1,
67             );
68             }
69              
70 2     2 0 7 sub record_type { 'RT' }
71              
72             has [ qw/
73             bsb_number
74             / ] => (
75             is => 'ro',
76             isa => 'BSBNumber',
77             required => 1,
78             );
79              
80             =head1 METHODS
81              
82             =head2 to_csv
83              
84             Convert the attributes to CSV line(s):
85              
86             my @csv = $RealTime->to_csv;
87              
88             =cut
89              
90 2     2 1 25 sub to_csv ( $self ) {
  2         5  
  2         4  
91              
92 2         41 return $self->attributes_to_csv(
93             qw/
94             record_type
95             recipient_number
96             payer_payment_reference
97             payment_amount
98             recipient_reference
99             bsb_number
100             account_number
101             account_name
102             funding_bsb_number
103             funding_account_number
104             /
105             );
106             }
107              
108             =head1 SEE ALSO
109              
110             L<Business::Westpac::PaymentsPlus::Australian::Payment::Import::Payment>
111              
112             L<Business::Westpac::Types>
113              
114             =cut
115              
116             __PACKAGE__->meta->make_immutable;