Business::CPI::Gateway::Base - Father of all gateways
version 0.924
The name of the driver for this gateway. This is built automatically, but can be customized.
Example: for Business::CPI::Gateway::TestGateway, the driver name will be TestGateway.
Business::CPI::Gateway::TestGateway
TestGateway
Provide a logger to the gateway. It's the user's responsibility to configure the logger. By default, nothing is logged. You could set this to a Log::Log4perl object, for instance, to get full logging.
The class for the items (products) being purchased. Defaults to Business::CPI::${driver_name}::Item if it exists, or Business::CPI::Base::Item otherwise.
The class for the shopping cart (the complete order). Defaults to Business::CPI::${driver_name}::Cart if it exists, or Business::CPI::Base::Cart otherwise.
The class for the buyer (the sender). Defaults to Business::CPI::${driver_name}::Buyer if it exists, or Business::CPI::Base::Buyer otherwise.
The class for the accounts. Defaults to Business::CPI::${driver_name}::Account if it exists, or Business::CPI::Base::Account otherwise.
The class for the addresses for the accounts. Defaults to Business::CPI::${driver_name}::Account::Address if it exists, or Business::CPI::Base::Account::Address otherwise.
The class for the business information of accounts. Defaults to Business::CPI::${driver_name}::Account::Business if it exists, or Business::CPI::Base::Account::Business otherwise.
ID, login or e-mail of the business owner. The way the gateway uniquely identifies the account owner.
Currency code, such as BRL, EUR, USD, etc.
The url for the gateway to postback, notifying payment changes.
The url for the customer to return to, after they finished the payment.
Boolean attribute to determine whether the form will hold the entire cart, or it will use the payment token generated for it. Defaults to false.
The url the application will post the form to. Defined by the gateway.
User agent object (using LWP::UserAgent's API) to make requests to the gateway.
Whenever an exception is thrown, this attribute will also hold the exception object. This is because $@ may be overwritten before the exception is handled.
So one can use:
try { # do something that will trigger an exception $cpi->get_cart('something that doesnt exist'); } catch { if ($cpi->error->type eq 'resource_not_found') { warn "Oops, it doesn't exist."; } # $cpi->error is the same as $_ and $_[0], unless someone messed up # with $@, e.g., using $SIG{__DIE__} or something nasty like that. In # that case, $_ is lost, but $cpi->error is safe. }
Whenever a request is made to the gateway, this attribute will hold the HTTP::Response object returned by the request.
Note: this is meant to be used for custom logging in the application. Usually, it's better to keep all the request-related details handled by Business::CPI, and abstract all the low-level details to the user. That includes logging, for the most part. The object returned by each method implemented by Business::CPI should be enough in most cases.
If you find yourself having to use this attribute too much, it probably means that gateway's Business::CPI driver is not doing what it should.
Creates a new Business::CPI::Role::Cart connected to this gateway.
Creates a new instance of an account. In general, you shouldn't need to use this, except for testing. Use create_account, instead, if your driver provides it.
create_account
Generates a payment token for a given cart. Do not call this method directly. Instead, see "get_checkout_code" in Business::CPI::Role::Cart.
Get the payment notification (such as PayPal's IPN), and return a hashref with the details.
Search past transactions.
Get more details about a given transaction.
This is supposed to be called when the gateway sends a notification about a payment status change to the application. Receives the request as a parameter (in a CGI-compatible format), and returns data about the payment. The format is still under discussion, and is soon to be documented.
Helper method for get_hidden_inputs to translate between Business::CPI and the gateway, using methods like checkout_form_items_map, checkout_form_buyer_map, etc.
André Walker <andre@andrewalker.net>
This software is copyright (c) 2015 by André Walker.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Business::CPI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Business::CPI
CPAN shell
perl -MCPAN -e shell install Business::CPI
For more information on module installation, please visit the detailed CPAN module installation guide.