summaryrefslogtreecommitdiff
path: root/Paymentech.pm
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2016-01-26 15:53:17 -0800
committerMark Wells <mark@freeside.biz>2016-01-26 15:53:17 -0800
commiteb9a65c5268111c149c787246d0dc7dc89b121ea (patch)
treeb66dbb93c90a25b3fdb51ffa396a21d608683e07 /Paymentech.pm
parent1667d469317704ae542a9b1f6fdc8e498e0eff59 (diff)
0.05
Diffstat (limited to 'Paymentech.pm')
-rw-r--r--Paymentech.pm20
1 files changed, 13 insertions, 7 deletions
diff --git a/Paymentech.pm b/Paymentech.pm
index 9eec935..e5af614 100644
--- a/Paymentech.pm
+++ b/Paymentech.pm
@@ -152,12 +152,13 @@ sub format_item {
terminalID => $self->terminalID,
);
if ($item->payment_type eq 'CC') {
+ my $expiration = $item->expiration;
+ $expiration =~ s/\D//g;
push @order, (
ccAccountNum => $item->card_number,
- ccExp => $item->expiration,
+ ccExp => $expiration,
);
- }
- elsif ( $item->payment_type eq 'ECHECK' ) {
+ } elsif ( $item->payment_type eq 'ECHECK' ) {
push @order, (
cardBrand => 'EC',
ecpCheckRT => $item->routing_code,
@@ -165,10 +166,15 @@ sub format_item {
ecpBankAcctType => $BankAcctType{ $item->account_type },
ecpDelvMethod => 'A',
);
- }
- else {
+ } else {
die "payment type ".$item->type." not supported";
}
+ if ( $item->recurring_billing eq 'F' ) {
+ push @order, ( recurringInd => 'RF' );
+ } elsif ( $item->recurring_billing eq 'S' ) {
+ push @order, ( recurringInd => 'RS' );
+ } # else don't send recurringInd at all
+
push @order, (
avsZip => $item->zip,
avsAddress1 => bytes_substr($item->address, 0, 30),
@@ -294,10 +300,10 @@ sub parse_item {
sub bytes_substr {
my ($string, $offset, $length, $repl) = @_;
my $bytes = substr(
- Encode::encode('utf8', $string),
+ Encode::encode('utf8', $string || ''),
$offset,
$length,
- Encode::encode('utf8', $repl)
+ Encode::encode('utf8', $repl || '')
);
return Encode::decode('utf8', $bytes, Encode::FB_QUIET);
}