Subject: | [PATCH] Truncate fields to maximum length |
Hi,
This patch truncates fields to their maximum lengths per the documentation.
If you would like help maintaining this module or would like to wash your hands of it entirely, I'd be happy to help or take over. My CPAN ID is IVAN.
Thanks!
--
Ivan Kohler
President and Head Geek, Freeside Internet Services, Inc. http://freeside.biz/
Debian GNU/Linux developer | CPAN author | cat person | ski addict
Subject: | maxlength.patch |
diff -urN Business-OnlinePayment-ElavonVirtualMerchant-0.02/Changes Business-OnlinePayment-ElavonVirtualMerchant/Changes
--- Business-OnlinePayment-ElavonVirtualMerchant-0.02/Changes 2011-03-02 16:05:44.000000000 -0800
+++ Business-OnlinePayment-ElavonVirtualMerchant/Changes 2016-03-31 09:59:16.022088424 -0700
@@ -1,5 +1,8 @@
Revision history for Perl extension Business::OnlinePayment::ElavonVirtualMerchant.
+0.03 unreleased
+ - Truncate fields to their maximum lengths
+
0.02 Fri Mar 04 19:00:05 2011
- Added ship-to and company fields. Patch from Josh Rosenbaum.
- Modified response parser to handle magic numbers surrounding the name/value
Binary files Business-OnlinePayment-ElavonVirtualMerchant-0.02/.Changes.swp and Business-OnlinePayment-ElavonVirtualMerchant/.Changes.swp differ
diff -urN Business-OnlinePayment-ElavonVirtualMerchant-0.02/ElavonVirtualMerchant.pm Business-OnlinePayment-ElavonVirtualMerchant/ElavonVirtualMerchant.pm
--- Business-OnlinePayment-ElavonVirtualMerchant-0.02/ElavonVirtualMerchant.pm 2011-03-02 15:58:35.000000000 -0800
+++ Business-OnlinePayment-ElavonVirtualMerchant/ElavonVirtualMerchant.pm 2016-03-31 10:10:07.181440660 -0700
@@ -1,12 +1,10 @@
package Business::OnlinePayment::ElavonVirtualMerchant;
+use base qw(Business::OnlinePayment::viaKLIX);
use strict;
-use vars qw($VERSION);
-
-use Business::OnlinePayment::viaKLIX;
-use base qw(Business::OnlinePayment::viaKLIX);
+use vars qw( $VERSION %maxlength );
-$VERSION = '0.02';
+$VERSION = '0.03';
$VERSION = eval $VERSION;
=head1 NAME
@@ -121,6 +119,26 @@
=cut
+%maxlength = (
+ ssl_description => 255,
+ ssl_invoice_number => 25,
+ ssl_customer_code => 17,
+
+ ssl_first_name => 20,
+ ssl_last_name => 30,
+ ssl_company => 50,
+ ssl_avs_address => 30,
+ ssl_city => 30,
+ ssl_phone => 20,
+
+ ssl_ship_to_first_name => 20,
+ ssl_ship_to_last_name => 30,
+ ssl_ship_to_company => 50,
+ ssl_ship_to_address1 => 30,
+ ssl_ship_to_city => 30,
+ ssl_ship_to_phone => 20, #though we don't map anything to this...
+);
+
sub submit {
my ($self) = @_;
@@ -202,6 +220,9 @@
@{$optional{$type_action}},
);
+ $params{$_} = substr($params{$_},0,$maxlength{$_})
+ foreach grep exists($maxlength{$_}), keys %params;
+
foreach ( keys ( %{($self->{_defaults})} ) ) {
$params{$_} = $self->{_defaults}->{$_} unless exists($params{$_});
}