0d6176bf65e0439a9d4dad37d908e17e279bcfae
[Business-BatchPayment.git] / BatchPayment / Batch.pm
1 =head1 NAME
2
3 Business::BatchPayment::Batch
4
5 =head1 DESCRIPTION
6
7 A Business::BatchPayment::Batch object represents a group of payment 
8 requests or confirmations (L<Business::BatchPayment::Item>) submitted
9 to a bank (or returned from a bank) as a batch.
10
11 =head1 ATTRIBUTES
12
13 =over 4
14
15 =item incoming - Flag for one-way batches.  The processor must set
16 this if the batch was originated by the gateway.
17
18 =item batch_id - Batch identifier.  The format is processor-specific
19 but usually must be a positive integer, if it's used at all.
20
21 Processor modules may include C<batch_id> in a reply batch ONLY if 
22 it is guaranteed to match the batch_id of a request batch AND all 
23 the items in the reply batch come from that request batch.  Otherwise, 
24 C<batch_id> must be null.  It must always be null when using one-way
25 (receive-only) workflow, since there are no request batches.
26
27 =item items - An arrayref of L<Business::BatchPayment::Item> objects
28 included in the batch.
29
30 =back
31
32 =cut
33
34 package Business::BatchPayment::Batch;
35
36 use strict;
37 use Moose;
38
39 has incoming => (
40   is => 'rw',
41   isa => 'Bool',
42 );
43
44 has batch_id => (
45   is => 'rw',
46   isa => 'Str',
47   default => '',
48 );
49
50 has items => (
51   traits => ['Array'],
52   is => 'rw',
53   isa => 'ArrayRef[Business::BatchPayment::Item]',
54   handles =>  {
55     count     => 'count',
56     elements  => 'elements',
57     push      => 'push',
58   },
59   default => sub { [] },
60 );
61
62 1;