summaryrefslogtreecommitdiff
path: root/BatchPayment/Batch.pm
blob: d31baae976d121dd4d071755d3bdb26a20294e33 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
=head1 NAME

Business::BatchPayment::Batch

=head1 DESCRIPTION

A Business::BatchPayment::Batch object represents a group of payment 
requests or confirmations (L<Business::BatchPayment::Item>) submitted
to a bank (or returned from a bank) as a batch.

=head1 ATTRIBUTES

=over 4

=item incoming - Flag for one-way batches.  The processor must set
this if the batch was originated by the gateway.

=item batch_id - Batch identifier.  The format is processor-specific
but usually must be a positive integer, if it's used at all.

Processor modules may include C<batch_id> in a reply batch ONLY if 
it is guaranteed to match the batch_id of a request batch AND all 
the items in the reply batch come from that request batch.  Otherwise, 
C<batch_id> must be null.  It must always be null when using one-way
(receive-only) workflow, since there are no request batches.

=item items - An arrayref of L<Business::BatchPayment::Item> objects
included in the batch.

=back

=cut

package Business::BatchPayment::Batch;

use strict;
use Moose;

has incoming => (
  is => 'rw',
  isa => 'Bool',
);

has batch_id => (
  is => 'rw',
  isa => 'Str',
  default => '',
);

has items => (
  traits => ['Array'],
  is => 'rw',
  isa => 'ArrayRef[Business::BatchPayment::Item]',
  handles =>  {
    count     => 'count',
    elements  => 'elements',
    push      => 'push',
  },
);

1;