Business-OnlinePayment-CardFortress
view release on metacpan or search on metacpan
Makefile.PL
README
ignore.txt
lib/Business/OnlinePayment/CardFortress.pm
t/00-load.t
t/boilerplate.t
t/manifest.t
t/pod-coverage.t
t/pod.t
t/transaction.t
t/private_key.txt
META.yml Module YAML meta-data (added by MakeMaker)
META.json Module JSON meta-data (added by MakeMaker)
lib/Business/OnlinePayment/CardFortress.pm view on Meta::CPAN
my $self = shift;
my %opts = @_;
$self->server('gw.cardfortress.com') unless $self->server;
$self->port('443') unless $self->port;
$self->path('/bop/index.html') unless $self->path;
$self->build_subs(qw( order_number avs_code cvv2_response
response_page response_code response_headers
card_token private_key txn_date
));
}
sub submit {
my $self = shift;
$self->server('test.cardfortress.com') if $self->test_transaction;
my %content = $self->content;
$content{$_} = $self->$_() for qw( gateway gateway_login gateway_password );
lib/Business/OnlinePayment/CardFortress.pm view on Meta::CPAN
}
#map these to gateway_response_code, etc?
# response_code()
# response_headers()
# response_page()
#handle the challenge/response handshake
if ( $self->error_message eq '_challenge' ) { #XXX infinite loop protection?
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($private_key);
my $response = $rsa_priv->decrypt($challenge);
#try the transaction again with the challenge response
# (B:OP could sure use a better way to alter one value)
my %content = $self->content;
$content{'card_response'} = encode_base64($response, '');
$self->content(%content);
$self->submit;
}
lib/Business/OnlinePayment/CardFortress.pm view on Meta::CPAN
=head1 SYNOPSIS
use Business::OnlinePayment;
my $tx = new Business::OnlinePayment(
'CardFortress',
'gateway' => 'ProcessingGateway',
'gateway_login' => 'gwlogin',
'gateway_password' => 'gwpass',
#private_key not necessary
);
$tx->content(
type => 'VISA',
login => 'cardfortress_login',
password => 'cardfortress_pass',
action => 'Normal Authorization',
description => 'Business::OnlinePayment test',
amount => '49.95',
customer_id => 'tfb',
lib/Business/OnlinePayment/CardFortress.pm view on Meta::CPAN
print "Card was rejected: ".$tx->error_message."\n";
}
# ... time slips by ...
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',
login => 'cardfortress_login',
password => 'cardfortress_pass',
action => 'Normal Authorization',
description => 'Business::OnlinePayment test',
amount => '49.95',
t/transaction.t view on Meta::CPAN
ok($tx->is_success, 'Transaction successful');
warn $tx->error_message."\n" unless $tx->is_success;
#use Data::Dumper; warn Dumper($tx);
my $token = $tx->card_token;
ok(length($token), 'Token returned');
SKIP: {
my $private_key = read_file('t/private_key.txt') or skip 'no private key', 2;
like( $private_key, qr/-----BEGIN RSA PRIVATE KEY-----/, 'private key good' );
my $rx = new Business::OnlinePayment( @opt,
'private_key' => $private_key,
);
$rx->test_transaction(1);
$rx->content(
type => 'VISA',
login => 'user',
password => 'secret',
action => 'Normal Authorization',
description => 'Business::OnlinePayment test',
( run in 0.251 second using v1.01-cache-2.11-cpan-4d50c553e7e )