summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--META.yml3
-rw-r--r--Makefile.PL1
-rw-r--r--Paymentech.pm44
-rw-r--r--debian/changelog6
-rw-r--r--debian/control3
5 files changed, 35 insertions, 22 deletions
diff --git a/META.yml b/META.yml
index a8600fe..3cb1085 100644
--- a/META.yml
+++ b/META.yml
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: Business-BatchPayment-Paymentech
-version: 0.01
+version: 0.07
abstract: Chase Paymentech XML batch format.
author:
- Mark Wells <mark@freeside.biz>
@@ -14,6 +14,7 @@ requires:
Business::BatchPayment: 0
Moose: 1.09
Test::More: 0
+ Unicode::Truncate: 0.303
no_index:
directory:
- t
diff --git a/Makefile.PL b/Makefile.PL
index e791751..292d967 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -16,6 +16,7 @@ WriteMakefile(
'Business::BatchPayment' => 0,
'Moose' => 1.09,
'Test::More' => 0,
+ 'Unicode::Truncate' => 0.303,
},
dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
clean => { FILES => 'Business-BatchPayment-Paymentech-*' },
diff --git a/Paymentech.pm b/Paymentech.pm
index df652ed..a64eb97 100644
--- a/Paymentech.pm
+++ b/Paymentech.pm
@@ -3,7 +3,9 @@ package Business::BatchPayment::Paymentech;
use 5.006;
use strict;
use warnings;
-our $VERSION = '0.03';
+our $VERSION = '0.07';
+
+use Unicode::Truncate 'truncate_egc';
=head1 NAME
@@ -186,13 +188,15 @@ sub format_item {
}
} # else don't send recurringInd at all
- push @order, (
- avsZip => $item->zip,
- avsAddress1 => bytes_substr($item->address, 0, 30),
- avsAddress2 => bytes_substr($item->address2, 0, 30),
- avsCity => bytes_substr($item->city, 0, 20),
- avsState => bytes_substr($item->state, 0, 2),
- avsName => bytes_substr($item->first_name. ' '. $item->last_name, 0, 30),
+ push @order, ( # truncate_egc will die() on empty string
+ avsZip => $item->zip,
+ avsAddress1 => $item->address ? truncate_egc($item->address, 30) : undef,
+ avsAddress2 => $item->address2 ? truncate_egc($item->address2, 30) : undef,
+ avsCity => $item->city ? truncate_egc($item->city, 20) : undef,
+ avsState => $item->state ? truncate_egc($item->state, 2) : undef,
+ avsName => ($item->first_name || $item->last_name)
+ ? truncate_egc($item->first_name.' '.$item->last_name, 30)
+ : undef,
( $paymentech_countries{ $item->country }
? ( avsCountryCode => $item->country )
: ()
@@ -306,18 +310,18 @@ sub parse_item {
$item;
}
-# internal use
-
-sub bytes_substr {
- my ($string, $offset, $length, $repl) = @_;
- my $bytes = substr(
- Encode::encode('utf8', $string || ''),
- $offset,
- $length,
- Encode::encode('utf8', $repl || '')
- );
- return Encode::decode('utf8', $bytes, Encode::FB_QUIET);
-}
+# DEPRECATED
+
+# sub bytes_substr {
+# my ($string, $offset, $length, $repl) = @_;
+# my $bytes = substr(
+# Encode::encode('utf8', $string || ''),
+# $offset,
+# $length,
+# Encode::encode('utf8', $repl || '')
+# );
+# return Encode::decode('utf8', $bytes, Encode::FB_QUIET);
+# }
package Business::BatchPayment::Paymentech::Transport;
diff --git a/debian/changelog b/debian/changelog
index 607e19d..b050b26 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+libbusiness-batchpayment-paymentech-perl (0.07) unstable; urgency=medium
+
+ * Start using Unicode::Truncate.
+
+ -- Mitch Jackson <mitch@freeside.biz> Wed, 24 Jan 2018 01:00:00 -0600
+
libbusiness-batchpayment-paymentech-perl (0.06) unstable; urgency=medium
* Add with_recurringInd option to control use of recurring indicator.
diff --git a/debian/control b/debian/control
index ddb1aed..36b4755 100644
--- a/debian/control
+++ b/debian/control
@@ -14,7 +14,8 @@ Depends:
libxml-writer-perl,
libxml-simple-perl,
libdatetime-perl,
- libmoose-perl (>= 1.09)
+ libmoose-perl (>= 1.09),
+ libunicode-truncate-perl (>= 0.303)
Description: Chase Paymentech XML batch format.
(no description was found)
.