The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Business::Payment::ClearingHouse - ClearingHouse for Business::Payment

SYNOPSIS

    use Business::Payment::ClearingHouse;

    my $house = Business::Payment::ClearingHouse->new();

    # Create a charge
    my $charge = Business::Payment::ClearingHouse::Charge->new(
        subtotal => 100,
        tax      => 10
    );
    # Authorizate it and get the uuid
    my $uuid = $house->auth($charge);

    # Settle!
    my $total = $house->settle;

DESCRIPTION

Business::Payment::ClearingHouse provides an API that emulates a payment processor like the ones used with credit cards. The operations it provides are inspired by those present with a credit card processor: preauth (reserve), postauth (consume the reserved funds), auth (immediately charge), credit (refund) and void (remove a charge).

This module is intended to provide a testbed for features of Business::Payment and to provide a testing processor for use in development environments. The settle method allows a developer to examine the net results of a series of transactions.

Notice: This module is in development. The API will likely change.

ATTRIBUTES

charges

Hashref of charges. Keys are the UUIDs and values are the charge objects.

states

Hashref of charge states. Keys are the UUIDs and the values are the strings that represent state. One of preauth, postauth, auth or credit.

uuid

The UUID generator used by this object, a lazily insantiated Data::UUID object.

METHODS

auth ($charge)

Performs an immediate auth for the supplied charge.

credit ($charge)

Performs a credit for the supplied charge.

info ($uuid)

Returns the charge associated with the supplied UUID.

postauth ($uuid)

Performs a post-authorization for the charge tied to the supplied UUID. This is the second operation after a preauth.

preauth ($charge)

Performs a pre-authorization for the supplied charge. This should be followed by a postauth.

settle

Totals up and removes all pending transactions. Returns the total (sum of all auth and postauth, less any credits). Any remaining preauth transactions are left in the clearinghouse to be postauthed later.

void ($uuid)

Voids the charge with the supplied UUID. Removes any information about the charge from the clearinghouse.

AUTHOR

Cory G Watson, <gphat at cpan.org>

COPYRIGHT & LICENSE

Copyright 2009 Cold Hard Code, LLC.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.