File Coverage

blib/lib/Business/Westpac/PaymentsPlus/Australian/Payment/Import/Payment/OTT.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::OTT;
2              
3             =head1 NAME
4              
5             Business::Westpac::PaymentsPlus::Australian::Payment::Import::Payment::OTT
6              
7             =head1 SYNOPSIS
8              
9             use Business::Westpac::PaymentsPlus::Australian::Payment::Import::Payment::OTT;
10              
11             my $OTT = Business::Westpac::PaymentsPlus::Australian::Payment::Import::Payment::OTT->new(
12             payer_payment_reference => 'REF00007',
13             payment_amount => 759.63,
14             payment_currency => 'USD',
15             recipient_reference => 'REF00007',
16             swift_code => 'WBC12345XXX',
17             account_number_iban => '032000000026',
18             payee_account_name => 'Payee 07',
19             payee_street_1 => 'Level 1',
20             payee_street_2 => 'Wallsend Plaza',
21             payee_city => 'Wallsend',
22             payee_state => 'NSW',
23             payee_post_code => '2287',
24             payee_country => 'AU',
25             funding_amount => 995.58,
26             funding_currency => 'AUD',
27             dealer_reference => '0123456789',
28             exchange_rate => '0.7630',
29             funding_bsb_number => '032-000',
30             funding_account_number => '000007',
31             outgoing_payment_information_line_1 => 'REF00071',
32             outgoing_payment_information_line_2 => 'REF00072',
33             );
34              
35             =head1 DESCRIPTION
36              
37             Class for modeling Overseas Telegraphic Transfers in the context
38             of Westpac CSV files.
39              
40             Extends L<Business::Westpac::PaymentsPlus::Australian::Payment::Import::Payment>.
41              
42             =cut
43              
44 2     2   324069 use feature qw/ signatures /;
  2         5  
  2         275  
45              
46 2     2   661 use Moose;
  2         426099  
  2         16  
47             extends 'Business::Westpac::PaymentsPlus::Australian::Payment::Import::Payment';
48 2     2   16330 no warnings qw/ experimental::signatures /;
  2         5  
  2         137  
49              
50 2         948 use Business::Westpac::Types qw/
51             add_max_string_attribute
52 2     2   731 /;
  2         11  
53              
54 2     2 0 10 sub record_type { 'OTT' }
55              
56             =head1 ATTRIBUTES
57              
58             All attributes are required, except were stated, and are read only
59              
60             =over
61              
62             =item recipient_reference (Str, max 16 chars)
63              
64             =item payment_currency (Str, max 3 chars)
65              
66             =item swift_code (Str, max 11 chars)
67              
68             =item account_number_iban (Str, max 40 chars)
69              
70             =item payee_account_name (Str, max 128 chars)
71              
72             =item payee_street_1 (Str, max 35 chars)
73              
74             =item payee_country (Str, max 25 chars)
75              
76             =item payee_country (Str, max 2 chars)
77              
78             =item intermediary_swift_code (Str, required, max 11 chars)
79              
80             =item payee_street_2 (Str, required, max 35 chars)
81              
82             =item payee_street_3 (Str, required, max 35 chars)
83              
84             =item payee_state (Str, required, max 3 chars)
85              
86             =item payee_post_code (Str, required, max 9 chars)
87              
88             =item funding_currency (Str, required, max 3 chars)
89              
90             =item dealer_reference (Str, required, max 16 chars)
91              
92             =item outgoing_payment_information_line_1 (Str, required, max 35 chars)
93              
94             =item outgoing_payment_information_line_2 (Str, required, max 35 chars)
95              
96             =item charge_bearer_code (Str, required, max 4 chars)
97              
98             =back
99              
100             =cut
101              
102             foreach my $str_attr (
103             'RecipientReference[16]',
104             'PaymentCurrency[3]',
105             'SwiftCode[11]',
106             'AccountNumberIban[40]',
107             'PayeeAccountName[128]',
108             'PayeeStreet_1[35]',
109             'PayeeCity[25]',
110             'PayeeCountry[2]',
111             ) {
112             __PACKAGE__->add_max_string_attribute(
113             $str_attr,
114             is => 'ro',
115             required => 1,
116             );
117             }
118              
119             foreach my $str_attr (
120             'IntermediarySwiftCode[11]',
121             'PayeeStreet_2[35]',
122             'PayeeStreet_3[35]',
123             'PayeeState[3]',
124             'PayeePostCode[9]',
125             'FundingCurrency[3]',
126             'DealerReference[16]',
127             'OutgoingPaymentInformationLine_1[35]',
128             'OutgoingPaymentInformationLine_2[35]',
129             'ChargeBearerCode[4]',
130             ) {
131             __PACKAGE__->add_max_string_attribute(
132             $str_attr,
133             is => 'ro',
134             required => 0,
135             );
136             }
137              
138             has [ qw/
139             funding_amount
140             / ] => (
141             is => 'ro',
142             isa => 'PositiveNum',
143             required => 1,
144             );
145              
146             has [ qw/
147             exchange_rate
148             / ] => (
149             is => 'ro',
150             isa => 'PositiveNum',
151             required => 1,
152             );
153              
154             =head2 to_csv
155              
156             Convert the attributes to CSV line(s):
157              
158             my @csv = $OTT->to_csv;
159              
160             =cut
161              
162 2     2 1 7 sub to_csv ( $self ) {
  2         6  
  2         6  
163              
164 2         39 return $self->attributes_to_csv(
165             qw/
166             record_type
167             recipient_number
168             payer_payment_reference
169             payment_amount
170             payment_currency
171             recipient_reference
172             swift_code
173             account_number_iban
174             intermediary_swift_code
175             payee_account_name
176             payee_street_1
177             payee_street_2
178             payee_street_3
179             payee_city
180             payee_state
181             payee_post_code
182             payee_country
183             funding_amount
184             funding_currency
185             dealer_reference
186             exchange_rate
187             funding_bsb_number
188             funding_account_number
189             outgoing_payment_information_line_1
190             outgoing_payment_information_line_2
191             charge_bearer_code
192             /
193             );
194             }
195              
196             =head1 SEE ALSO
197              
198             L<Business::Westpac::PaymentsPlus::Australian::Payment::Import::Payment>
199              
200             L<Business::Westpac::Types>
201              
202             =cut
203              
204             __PACKAGE__->meta->make_immutable;