use warnings;
use strict;
#use vars qw( $DEBUG $me );
+use File::Slurp;
use MIME::Base64;
use Crypt::OpenSSL::RSA;
-our $VERSION = 0.01;
+our $VERSION = 0.03;
sub _info {
{
- 'info_version' => '0.01',
+ 'info_compat' => '0.01',
'module_version' => $VERSION,
'supported_types' => [ 'CC' ],
'supported_actions' => { 'CC' => [
'Post Authorization',
'Void',
'Credit',
+ 'Tokenize',
],
},
- 'token_support' => 'challenge/response',
+ 'token_support' => 1,
#need to figure out how to pass through for gateways that do... an option?
#'CC_void_requires_card' => 1,
};
my %content = $self->content;
$content{$_} = $self->$_() for qw( gateway gateway_login gateway_password );
+ $content{$_} = $self->$_() for grep $self->can($_), qw( bop_options );
+
my ($page,$server_response,%headers) = $self->https_post(%content);
die "$server_response\n" unless $server_response =~ /^200/;
fraud_score fraud_transaction_id
result_code avs_code cvv2_response
card_token
+ txn_date
)) {
$self->$_($response{$_});
}
#handle the challenge/response handshake
if ( $self->error_message eq '_challenge' ) { #XXX infinite loop protection?
- die "no private key available" unless $self->private_key;
+ my $private_key = $self->private_key
+ or die "no private key available";
+
+ $private_key = read_file($private_key)
+ if $private_key !~ /-----BEGIN/ && -r $private_key;
#decrypt the challenge with the private key
my $challenge = decode_base64($response{'card_challenge'});
#here is the hardest part to implement at each client side
- my $rsa_priv = Crypt::OpenSSL::RSA->new_private_key($self->private_key);
+ my $rsa_priv = Crypt::OpenSSL::RSA->new_private_key($private_key);
my $response = $rsa_priv->decrypt($challenge);
#try the transaction again with the challenge response
use Business::OnlinePayment;
- my $tx = new Business::OnlinePayment( 'CardFortress',
- 'gateway' => 'ProcessingGateway',
- 'gateway_login' => 'gwlogin',
- 'gateway_password' => 'gwpass',
- #private_key not necessary
- );
+ my $tx = new Business::OnlinePayment(
+ 'CardFortress',
+ 'gateway' => 'ProcessingGateway',
+ 'gateway_login' => 'gwlogin',
+ 'gateway_password' => 'gwpass',
+ #private_key not necessary
+ );
$tx->content(
type => 'VISA',
# ... time slips by ...
- my $rx = new Business::OnlinePayment( 'CardFortress',
- 'gateway' => 'ProcessingGateway',
- 'gateway_login' => 'gwlogin',
- 'gateway_password' => 'gwpass',
- 'private_key' => $private_key_string,
- );
+ my $rx = new Business::OnlinePayment(
+ 'CardFortress',
+ 'gateway' => 'ProcessingGateway',
+ 'gateway_login' => 'gwlogin',
+ 'gateway_password' => 'gwpass',
+ 'private_key' => $private_key_string, #or filename
+ 'bop_options' => join('/', map "$_=".$options{$_}, keys %options),
+ );
$rx->content(
type => 'VISA',