initial commit
[Business-BatchPayment.git] / BatchPayment.pm
1 package Business::BatchPayment;
2
3 use 5.006;
4 use strict;
5 use vars '$DEBUG';
6 use warnings;
7
8 use Class::MOP;
9 use Business::BatchPayment::Processor;
10 use Business::BatchPayment::Item;
11 use Business::BatchPayment::Transport;
12
13 $DEBUG = 0;
14
15 =head1 NAME
16
17 Business::BatchPayment - Batch-oriented payment processing
18
19 =head1 VERSION
20
21 Version 0.01
22
23 =cut
24
25 our $VERSION = '0.01';
26
27 =head1 SYNOPSIS
28
29   use Business::BatchPayment;
30
31   my %options = ( merchant_id => '00451', password => 'opensesame' );
32   my $processor = Business::BatchPayment->create(MyGateway => %options);
33
34   my @request;
35   push @request, Business::BatchPayment->create(Item =>
36     action        => 'payment', # as opposed to 'credit'
37     payment_type  => 'CC', #credit card, or 'ECHECK' for check/ACH
38     amount        => '49.95',
39     tid           => '0001234', # transaction id, like a customer/order number
40     card_number   => '1234123412341238',
41     expiration    => '0100', # MM/YY
42     # these fields are optional
43     first_name    => 'John',
44     last_name     => 'Doe',
45     address       => '123 Main Street',
46     address2      => 'Suite H',
47     city          => 'Anytown',
48     state         => 'CA',
49     country       => 'US',
50     zip           => '99015',
51   ); # returns a Business::OnlinePayment::Item;
52
53   $processor->submit(@request);
54
55   # at some point in the future
56   
57   my @reply = $processor->receive();
58   foreach my $item (@reply) {
59     ... process items and record successful/failed payments
60   }
61
62 =head1 CLASS METHODS
63
64 =over 4
65
66 =item create MODULE[, OPTIONS ]
67
68 Loads Business::BatchPayment::MODULE, then attempts to call 
69 Business::BatchPayment::MODULE->new(OPTIONS).
70
71 =cut
72
73 # not a Moose method
74
75 sub create {
76   my $class = shift;
77   my $subclass = shift;
78   $subclass = "Business::BatchPayment::$subclass";
79   Class::MOP::load_class($subclass);
80   $subclass->new(@_);
81 }
82
83 =back
84
85 =head1 AUTHOR
86
87 Mark Wells, C<< <mark at freeside.biz> >>
88
89 =head1 BUGS
90
91 =head1 SUPPORT
92
93 You can find documentation for this module with the perldoc command.
94
95     perldoc Business::BatchPayment
96
97 Commercial support is available from Freeside Internet Services,
98 L<http://www.freeside.biz>.
99
100 =head1 LICENSE AND COPYRIGHT
101
102 Copyright 2012 Mark Wells.
103
104 This program is free software; you can redistribute it and/or modify it
105 under the terms of either: the GNU General Public License as published
106 by the Free Software Foundation; or the Artistic License.
107
108 See http://dev.perl.org/licenses/ for more information.
109
110
111 =cut
112
113 1; # End of Business::BatchPayment