#################### main pod documentation begin ################### =head1 NAME Zymonic::Decryptor::Message::PayerAuthentication - Zymonic Decryptor Message. =head1 SYNOPSIS This Message calls a PayerAuthentication to authenticate a card. =head1 DESCRIPTION This Message calls a PayerAuthentication to authenticate a card.. Uses a Zymonic::PayerAuthentication object to do the call. =head1 USAGE The message should simply be: { messagetype => 'PayerAuthentication', payer_authentication_type => 'Arcot', # or another payer authentication implementation card_number => 'ENCRYPTRED[token]ENCRYPTED', pares => ... } The response will be: { error => ... } or { enrolled => 'true', acs_url => ..., pareq => ... } If card enrolled or { enrolled => '' } If card not enrolled or { pares => ..., pares_id => ..., pares_auth_code => ... } If auth is sucessfull All with option status fields. =head1 BUGS None we're aware of... =head1 SUPPORT As in the license, Zymonic is provided without warranty or support unless purchased separately, however... If you email zymonic-support@zednax.com your issue will be noted and may receive a response. For security issues, please contact zymonic-security@zednax.com and someone will respond within 8 working hours. =head1 AUTHOR Alex Masidlover et al. CPAN ID: MODAUTHOR Zednax Limited alex.masidlover@zednax.com http://www.zednax.com =head1 COPYRIGHT This program is free software licensed under the... Zymonic Public License 1.0 The full text of the license can be found in the LICENSE file included with this module. Other licenses may be acceptable if including parts of Zymonic in larger projects, please contact Zednax for details. =head1 SEE ALSO Zymonic::PayerAuthentication perl(1). =cut #################### main pod documentation end ################### package Zymonic::Decryptor::Message::PayerAuthentication; use strict; use warnings; BEGIN { use Exporter (); use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); $VERSION = '0.01'; @ISA = qw(Exporter); #Give a hoot don't pollute, do not export more than needed by default @EXPORT = qw(); @EXPORT_OK = qw(); %EXPORT_TAGS = (); } use base 'Zymonic::Decryptor::Message'; use Zymonic::PayerAuthentication; use Zymonic::Utils qw(death_handler rethrow_exception); #################### subroutine header begin #################### =head2 respond Usage : my $response = $mh->repsond($in) Purpose : This is the response handler method for decryptor messages. Returns : a response hashref Argument : a message hashref Throws : nothing Comment : See Also : =cut #################### subroutine header end #################### sub respond { my $self = shift; my $in = shift; return { error => 'No Payer Authentication type specified.' } unless $in->{payer_authentication_type}; return { error => 'No card number specified.' } unless $in->{card_number}; $self->{decryptor_server}->connection_log("$in->{payer_authentication_type} PayerAuthentication Requested"); # check module exists then load it my $pa; my $module = "Zymonic::PayerAuthentication::$in->{payer_authentication_type}"; eval { eval "require $module"; $pa = $module->new( parent => $self, config => $self->{decryptor_server}->{config}, DB => $self->{decryptor_server}->{DB} ); } or do { my $err = $@; if ( $err =~ /Can't locate/ ) { return { error => "Cannot find PayerAuthentication module: $in->{payer_authentication_type}" }; } else { rethrow_exception($err); } }; return { error => "Unable to create PayerAuthentication object" } unless $pa; # TODO: any need to retry? As is done in Payment Gateway # if no pares then check enrolled status if ( $in->{pares} ) { return $pa->pares_result( $in->{card_number}, $in ); } else { return $pa->enrolled_result( $in->{card_number}, $in ); } } 1;