Business-OnlinePayment-PaperlessTrans
view release on metacpan or search on metacpan
lib/Business/OnlinePayment/PaperlessTrans.pm view on Meta::CPAN
sub _content_to_check {
my ( $self, %content ) = @_;
$self->required_fields(qw( routing_code account_number account_name ));
my %mapped = (
NameOnAccount => $content{account_name},
AccountNumber => $content{account_number},
RoutingNumber => $content{routing_code},
Identification => $content{identification} || {},
Address => $content{address},
EmailAddress => $content{email},
);
return \%mapped;
}
sub _content_to_card {
my ( $self, %content ) = @_;
$self->required_fields(qw( expiration name card_number ));
# expiration api is bad but conforms to Business::OnlinePayment 3.02 Spec
$content{expiration} =~ m/^(\d\d)(\d\d)$/xms;
my ( $exp_month, $exp_year ) = ( $1, $2 ); ## no critic ( ProhibitCaptureWithoutTest )
my %mapped = (
NameOnAccount => $content{name},
CardNumber => $content{card_number},
SecurityCode => $content{cvv2},
Identification => $content{identification} || {},
Address => $content{address},
EmailAddress => $content{email},
ExpirationMonth => $exp_month,
ExpirationYear => '20' . $exp_year,
);
$mapped{TrackData} = $content{track1} . $content{track2}
if $content{track1} && $content{track2};
return \%mapped;
}
1;
# ABSTRACT: Interface to Paperless Transaction Corporation BackOffice API
__END__
=pod
=head1 NAME
Business::OnlinePayment::PaperlessTrans - Interface to Paperless Transaction Corporation BackOffice API
=head1 VERSION
version 0.001006
=head1 SYNOPSIS
use Try::Tiny;
use Business::OnlinePayment;
my $tx = Business::OnlinePayment->new('PaperlessTrans');
$tx->test_transaction(1);
$tx->content(
login => 'TerminalID',
password => 'TerminalKey',
debug => '1', # 0, 1, 2
type => 'ECHECK',
action => 'Normal Authorization',
check_number => '132',
amount => 1.32,
currency => 'USD',
routing_code => 111111118,
account_name => 'Caleb Cushing',,
account_number => 12121214,
name => 'Caleb Cushing',
address => '400 E. Royal Lane #201',
city => 'Irving',
state => 'TX',
zip => '75039-2291',
country => 'US',
);
try {
$tx->submit;
}
catch {
# log errors
};
if ( $tx->is_success ) {
# do stuff with
$tx->order_number;
$tx->authorization;
}
else {
# log
$tx->error_message;
}
# start all over again credit cards
$tx->content(
login => 'TerminalID',
password => 'TerminalKey',
debug => '1', # 0, 1, 2
type => 'CC',
action => 'Authorization Only',
amount => 1.00,
currency => 'USD',
name => 'Caleb Cushing',
card_number => '5454545454545454',
expiration => '1215',
cvv2 => '111',
);
## ...
( run in 3.839 seconds using v1.01-cache-2.11-cpan-140bd7fdf52 )