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