projects
/
Business-OnlinePayment-PaymenTech.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
pass AVScountryCode, 2.05
[Business-OnlinePayment-PaymenTech.git]
/
lib
/
Business
/
OnlinePayment
/
PaymenTech.pm
diff --git
a/lib/Business/OnlinePayment/PaymenTech.pm
b/lib/Business/OnlinePayment/PaymenTech.pm
index
554bcde
..
3d060bb
100644
(file)
--- a/
lib/Business/OnlinePayment/PaymenTech.pm
+++ b/
lib/Business/OnlinePayment/PaymenTech.pm
@@
-8,7
+8,10
@@
use Tie::IxHash;
use vars qw($VERSION $DEBUG @ISA $me);
@ISA = qw(Business::OnlinePayment::HTTPS);
use vars qw($VERSION $DEBUG @ISA $me);
@ISA = qw(Business::OnlinePayment::HTTPS);
-$VERSION = '2.03';
+
+$VERSION = '2.05';
+$VERSION = eval $VERSION; # modperlstyle: convert the string into a number
+
$DEBUG = 0;
$me='Business::OnlinePayment::PaymenTech';
$DEBUG = 0;
$me='Business::OnlinePayment::PaymenTech';
@@
-39,6
+42,7
@@
tie my %new_order, 'Tie::IxHash', (
AVSaddress1 => [ ':address', 30 ],
AVScity => [ ':city', 20 ],
AVSstate => [ ':state', 2 ],
AVSaddress1 => [ ':address', 30 ],
AVScity => [ ':city', 20 ],
AVSstate => [ ':state', 2 ],
+ AVScountryCode => [ ':country', 2 ],
OrderID => [ ':invoice_number', 22 ],
Amount => [ ':amount', 12 ],
Comments => [ ':email', 64 ],
OrderID => [ ':invoice_number', 22 ],
Amount => [ ':amount', 12 ],
Comments => [ ':email', 64 ],
@@
-93,6
+97,8
@@
my %currency_code = (
MXN => [484, 2],
);
MXN => [484, 2],
);
+my %paymentech_countries = map { $_ => 1 } qw( US CA GB UK );
+
sub set_defaults {
my $self = shift;
sub set_defaults {
my $self = shift;
@@
-190,7
+196,15
@@
sub map_fields {
$content{invoice_number} ||= sprintf("%04x%04x",time % 2**16,int(rand() * 2**16));
}
$content{invoice_number} ||= sprintf("%04x%04x",time % 2**16,int(rand() * 2**16));
}
- $content{expiration} =~ s/\D//g; # Because Freeside sends it as mm/yy, not mmyy.
+ # Always send as MMYY
+ $content{expiration} =~ s/\D//g;
+ $content{expiration} = sprintf('%04d',$content{expiration});
+
+ $content{country} ||= 'US';
+ $content{country} = ( $paymentech_countries{ $content{country} }
+ ? $content{country}
+ : ''
+ ),
$self->content(%content);
return;
$self->content(%content);
return;