From 8c67441ae837ff8d99d47239d5b5562ff310bd3f Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Mon, 14 Jan 2013 19:23:56 -0800 Subject: [PATCH] truncate state to 2 characters --- Changes | 3 +++ Paymentech.pm | 44 ++++++++++++++++++++------------------------ 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/Changes b/Changes index 0ea0bd8..1221a72 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,8 @@ Revision history for Business-BatchPayment-Paymentech +0.03 unreleased + - truncate state to 2 characters + 0.02 unreleased - fix avsCountryCode to not pass non-Paymentech countries diff --git a/Paymentech.pm b/Paymentech.pm index 09b5672..fd3f4ae 100644 --- a/Paymentech.pm +++ b/Paymentech.pm @@ -3,16 +3,12 @@ package Business::BatchPayment::Paymentech; use 5.006; use strict; use warnings; -our $VERSION = '0.02'; +our $VERSION = '0.03'; =head1 NAME Business::BatchPayment::Paymentech - Chase Paymentech XML batch format. -=head1 VERSION - -Version 0.01 - =head1 USAGE See L for general usage notes. @@ -71,14 +67,14 @@ with 'Business::BatchPayment::TestMode'; # could have some validation on all of these has [ qw(merchantID terminalID bin industryType login password) ] => ( - is => 'ro', - isa => 'Str', + is => 'ro', + isa => 'Str', required => 1, ); has 'fileDateTime' => ( - is => 'ro', - isa => 'Str', + is => 'ro', + isa => 'Str', default => sub { DateTime->now->strftime('%Y%m%d%H%M%S') }, @@ -110,8 +106,8 @@ sub format_request { my $output; my $xml = XML::Writer->new( - OUTPUT => \$output, - DATA_MODE => 1, + OUTPUT => \$output, + DATA_MODE => 1, DATA_INDENT => 2, ); $self->format_header($batch, $xml); @@ -145,25 +141,25 @@ sub format_item { if ( $item->action eq 'payment' ) { $xml->startTag('newOrder', BatchRequestNo => $count); my @order = ( - industryType => $self->industryType, - transType => 'AC', - bin => $self->bin, - merchantID => $self->merchantID, - terminalID => $self->terminalID, + industryType => $self->industryType, + transType => 'AC', + bin => $self->bin, + merchantID => $self->merchantID, + terminalID => $self->terminalID, ); if ($item->payment_type eq 'CC') { push @order, ( - ccAccountNum => $item->card_number, - ccExp => $item->expiration, + ccAccountNum => $item->card_number, + ccExp => $item->expiration, ); } elsif ( $item->payment_type eq 'ECHECK' ) { push @order, ( - cardBrand => 'EC', - ecpCheckRT => $item->routing_code, - ecpCheckDDA => $item->account_number, + cardBrand => 'EC', + ecpCheckRT => $item->routing_code, + ecpCheckDDA => $item->account_number, ecpBankAcctType => $BankAcctType{ $item->account_type }, - ecpDelvMethod => 'A', + ecpDelvMethod => 'A', ); } else { @@ -174,8 +170,8 @@ sub format_item { avsAddress1 => substr($item->address, 0, 30), avsAddress2 => substr($item->address2, 0, 30), avsCity => substr($item->city, 0, 20), - avsState => $item->state, - avsName => substr($item->first_name .' '. $item->last_name, 0, 30), + avsState => substr($item->state, 0, 2), + avsName => substr($item->first_name. ' '. $item->last_name, 0, 30), avsCountryCode => ( $paymentech_countries{ $item->country } ? $_->country : '' -- 2.11.0