Business-OnlinePayment-PaymenTech
view release on metacpan or search on metacpan
lib/Business/OnlinePayment/PaymenTech.pm view on Meta::CPAN
TerminalID => [ ':terminal_id', 3 ],
TxRefNum => [ ':order_number', 40 ],
);
tie my %reversal, 'Tie::IxHash', (
OrbitalConnectionUsername => [ ':login', 32 ],
OrbitalConnectionPassword => [ ':password', 32 ],
TxRefNum => [ ':order_number', 40 ],
TxRefIdx => [ '0', 4 ],
OrderID => [ ':invoice_number', 22 ],
BIN => [ ':bin', 6 ],
MerchantID => [ ':merchant_id', 12 ],
TerminalID => [ ':terminal_id', 3 ],
OnlineReversalInd => [ 'Y', 1 ],
# Always attempt to reverse authorization.
);
my %defaults = (
terminal_id => '001',
currency => 'USD',
cvvind => '',
);
my @required = ( qw(
login
password
action
bin
merchant_id
invoice_number
amount
)
);
my %currency_code = (
# Per ISO 4217. Add to this as needed.
USD => [840, 2],
CAD => [124, 2],
MXN => [484, 2],
);
my %paymentech_countries = map { $_ => 1 } qw( US CA GB UK );
my %failure_status = (
# values of the RespCode element
# in theory RespMsg should be set to a descriptive message, but it looks
# like that's not reliable
# XXX we should have a way to indicate other actions required by the
# processor, such as "honor with identification", "call for instructions",
# etc.
'00' => undef, # Approved
'04' => 'pickup', # Pickup
'33' => 'expired', # Card is Expired
'41' => 'stolen', # Lost/Stolen
'42' => 'inactive', # Account Not Active
'43' => 'stolen', # Lost/Stolen Card
'44' => 'inactive', # Account Not Active
#'45' duplicate transaction, should also have its own status
'B7' => 'blacklisted', # Fraud
'B9' => 'blacklisted', # On Negative File
'BB' => 'stolen', # Possible Compromise
'BG' => 'blacklisted', # Blocked Account
'BQ' => 'blacklisted', # Issuer has Flagged Account as Suspected Fraud
'C4' => 'nsf', # Over Credit Limit
'D5' => 'blacklisted', # On Negative File
'D7' => 'nsf', # Insufficient Funds
'F3' => 'inactive', # Account Closed
'K6' => 'nsf', # NSF
);
sub set_defaults {
my $self = shift;
$self->server('orbitalvar1.chasepaymentech.com') unless $self->server; # this is the test server.
$self->port('443') unless $self->port;
$self->path('/authorize') unless $self->path;
$self->build_subs(qw(
order_number
));
#leaking gateway-specific anmes? need to be mapped to B:OP standards :)
# ProcStatus
# ApprovalStatus
# StatusMsg
# RespCode
# AuthCode
# AVSRespCode
# CVV2RespCode
# Response
}
sub build {
my $self = shift;
my %content = $self->content();
my $skel = shift;
tie my %data, 'Tie::IxHash';
ref($skel) eq 'HASH' or die 'Tried to build non-hash';
foreach my $k (keys(%$skel)) {
my $v = $skel->{$k};
my $l;
($v, $l) = @$v if(ref $v eq 'ARRAY');
if($v =~ /^:(.*)/) {
# Get the content field with that name.
$data{$k} = $content{$1};
}
else {
$data{$k} = $v;
}
# Ruthlessly enforce field length.
$data{$k} = substr($data{$k}, 0, $l) if($data{$k} and $l);
}
return \%data;
}
sub map_fields {
my($self) = @_;
my %content = $self->content();
foreach(qw(merchant_id terminal_id currency)) {
$content{$_} = $self->{$_} if exists($self->{$_});
}
( run in 0.510 second using v1.01-cache-2.11-cpan-c966e8aa7e8 )