| Business-3DSecure documentation | Contained in the Business-3DSecure distribution. |
Business::3DSecure - Perl extension for 3D Secure Credit Card Verification
use Business::3DSecure; my $authentication = new Business::3DSecure( $processor ); $authentication->content( %content ); $authentication->submit(); $authentication->is_success()
This Module provide an interface to 3DSecure Authentication, it has been patterned of the Business::OnlinePayment module to provide an easy to understand interface
Create a new Business::3DSecure object, $processor is required, and defines the online processor to use.
Autoloading facility for methods to be returned by subclasses
Method to submit data to subclass
Dumps all key value pairs submited from content
Gets all required and optional fields for submission
Remaps any fields from the incoming client code to the subclasses fields
Checks if all required fields are there
Submits the 3DSecure call
Clayton Cottingham , <clayton@wintermarket.net>
Please report any bugs or feature requests to
bug-business-3dsecure at rt.cpan.org, or through the web interface at
http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Business-3DSecure.
I will be notified, and then you'll automatically be notified of progress on
your bug as I make changes.
You can find documentation for this module with the perldoc command.
perldoc Business::3DSecure
You can also look for information at:
Copyright 2008 Clayton Cottingham of Wintermarket Networks www.wintermarket.net , all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| Business-3DSecure documentation | Contained in the Business-3DSecure distribution. |
package Business::3DSecure; use strict; use warnings; use vars qw( $VERSION @ISA @EXPORT @EXPORT_OK $AUTOLOAD ); use Carp; require Exporter; @ISA = qw( Exporter AutoLoader ); @EXPORT = qw(); @EXPORT_OK = qw(); $VERSION = '0.02'; my %fields = ( is_success => undef, result_code => undef, test_transaction => undef, require_avs => undef, transaction_type => undef, error_message => undef, authorization => undef, server => undef, port => undef, path => undef, server_response => undef, ); sub new { my ( $class, $processor, %data ) = @_; Carp::croak( "unspecified processor" ) unless $processor; my $subclass = "${class}::$processor"; if ( !defined( &$subclass ) ) { eval "use $subclass"; Carp::croak( "unknown processor $processor ($@)" ) if $@; } my $self = bless { processor => $processor }, $subclass; $self->build_subs( keys %fields ); $self->set_defaults() if ( $self->can( "set_defaults" ) ); foreach( keys %data ) { my $key = lc( $_ ); my $value = $data{ $_ }; $key =~ s/^\-//; $self->build_subs( $key ); $self->$key( $value ); } return $self; } sub content { my ( $self, %params ) = @_; if ( %params ) { $self->transaction_type( $params{ type } ) if ( $params{ type } ); %{ $self->{ _content } } = %params; } return %{ $self->{ _content } }; } sub required_fields { my ( $self, @fields ) = @_; my %content = $self->content(); foreach( @fields ) { Carp::croak( "missing required field $_" ) unless exists $content{ $_ }; } } sub get_fields { my ( $self, @fields ) = @_; my %content = $self->content(); my %new = (); foreach( @fields ) { $new{ $_ } = $content{ $_ }; } return %new; } sub remap_fields { my ( $self, %map ) = @_; my %content = $self->content(); foreach( %map ) { $content{ $map{ $_ } } = $content{ $_ }; } $self->content( %content ); } sub submit { my ( $self ) = @_; Carp::croak( "Processor subclass did not override submit function" ); } sub dump_contents { my ( $self ) = @_; my %content = $self->content(); my $dump = ""; foreach( keys %content ) { $dump .= "$_ = $content{$_}\n"; } return $dump; } # didnt use AUTOLOAD because Net::SSLeay::AUTOLOAD passes right to # AutoLoader::AUTOLOAD, instead of passing up the chain sub build_subs { my $self = shift; foreach ( @_ ) { eval "sub $_ { my \$self = shift; if(\@_) { \$self->{$_} = shift; } return \$self->{$_}; }"; } } 1; __END__