From 2c8748ac26281934a1b75671c6a5d0125145660a Mon Sep 17 00:00:00 2001 From: jeff Date: Fri, 1 Dec 2006 06:31:55 +0000 Subject: [PATCH] chase canada E-xactBatch --- FS/FS/Conf.pm | 6 +++-- FS/FS/cust_pay_batch.pm | 50 ++++++++++++++++++++++++++++++++++++ httemplate/misc/download-batch.cgi | 16 ++++++++++++ httemplate/search/cust_pay_batch.cgi | 2 ++ 4 files changed, 72 insertions(+), 2 deletions(-) diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 639f06baa..566d8e8d9 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -1865,7 +1865,8 @@ httemplate/docs/config.html 'section' => 'billing', 'description' => 'Default format for batches.', 'type' => 'select', - 'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch', 'BoM', 'PAP' ] + 'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch', + 'csv-chase_canada-E-xactBatch', 'BoM', 'PAP' ] }, { @@ -1873,7 +1874,8 @@ httemplate/docs/config.html 'section' => 'billing', 'description' => 'Fixed (unchangeable) format for credit card batches.', 'type' => 'select', - 'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch', 'BoM', 'PAP' ] + 'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch', 'BoM', 'PAP' , + 'csv-chase_canada-E-xactBatch', 'BoM', 'PAP' ] }, { diff --git a/FS/FS/cust_pay_batch.pm b/FS/FS/cust_pay_batch.pm index 1eeabb69a..c9a546870 100644 --- a/FS/FS/cust_pay_batch.pm +++ b/FS/FS/cust_pay_batch.pm @@ -346,6 +346,56 @@ sub import_results { }; + }elsif ( $format eq 'csv-chase_canada-E-xactBatch' ) { + + $filetype = "CSV"; + + @fields = ( + '', # Internal(bank) id of the transaction + '', # Transaction Type: 00 - purchase, 01 - preauth, + # 02 - completion, 03 - forcepost, + # 04 - refund, 05 - auth, + # 06 - purchase corr, 07 - refund corr, + # 08 - void 09 - void return + '', # gateway used to process this transaction + 'paid', # Amount: Amount of the transaction. Dollars and cents + # with decimal entered. + 'auth', # Auth#: Authorization number (if approved) + 'payinfo', # Card Number: Card number for the transaction + '', # Expiry Date: Expiry date of the card + '', # Cardholder Name + 'bankcode', # Bank response code (3 alphanumeric) + 'bankmess', # Bank response message + 'etgcode', # ETG response code (2 alphanumeric) + 'etgmess', # ETG response message + '', # Returned customer number for the transaction + 'paybatchnum', # Reference#: paybatch number of the transaction + '', # Reference#: Invoice number of the transaction + 'result', # Processing Result: Approved of Declined + ); + + $end_condition = sub { + ''; + }; + + $hook = sub { + my $hash = shift; + $hash->{'paid'} = sprintf("%.2f", $hash->{'paid'}); #hmmmm + $hash->{'_date'} = time; # got a better one? + }; + + $approved_condition = sub { + my $hash = shift; + $hash->{'etgcode'} eq '00' && $hash->{'result'} eq "Approved"; + }; + + $declined_condition = sub { + my $hash = shift; + $hash->{'etgcode'} ne '00' # internal processing error + || ( $hash->{'result'} eq "Declined" ); + }; + + }elsif ( $format eq 'PAP' ) { $filetype = "Fixed264"; diff --git a/httemplate/misc/download-batch.cgi b/httemplate/misc/download-batch.cgi index 038aa2049..a1e7b5c44 100644 --- a/httemplate/misc/download-batch.cgi +++ b/httemplate/misc/download-batch.cgi @@ -40,6 +40,8 @@ %my $jdate = sprintf("%03d", $date[5] % 100).sprintf("%03d", $date[7] + 1); %my $cdate = sprintf("%02d", $date[3]).sprintf("%02d", $date[4] + 1). % sprintf("%02d", $date[5] % 100); +%my $sdate = sprintf("%02d", $date[5] % 100).'/'.sprintf("%02d", $date[4] + 1). +% '/'.sprintf("%02d", $date[3]); % %if ($format eq "BoM") { % @@ -63,6 +65,12 @@ % %}elsif ($format eq "csv-td_canada_trust-merchant_pc_batch"){ %# 1; +%}elsif ($format eq "csv-chase_canada-E-xactBatch"){ +% +% my($origid) = $conf->config("batchconfig-$format"); +<% sprintf( '$$E-xactBatchFileV1.0$$%s:%03u$$%s',$sdate,$pay_batch->batchnum, $origid) + %> +% %}else{ % die "Unknown format for batch in batchconfig. \n"; %} @@ -100,6 +108,12 @@ ,,,,<% $cust_pay_batch->payinfo %>,<% $exp %>,<% $cust_pay_batch->amount %>,<% $cust_pay_batch->paybatchnum %> % % +% } elsif ($format eq "csv-chase_canada-E-xactBatch"){ +% +% +<% $cust_pay_batch->paybatchnum %>,<% $cust_pay_batch->custnum %>,<% $cust_pay_batch->invnum %>,"<% $cust_pay_batch->payname %>",01,<% $cust_pay_batch->payinfo %>,<% $cust_pay_batch->amount %>,<% $exp %>,, +% +% % } else { % die "I'm already dead, but you did not know that.\n"; % } @@ -121,6 +135,8 @@ % %} elsif ($format eq "csv-td_canada_trust-merchant_pc_batch"){ % #1; +%} elsif ($format eq "csv-chase_canada-E-xactBatch"){ +% #1; %} else { % die "I'm already dead (again), but you did not know that.\n"; %} diff --git a/httemplate/search/cust_pay_batch.cgi b/httemplate/search/cust_pay_batch.cgi index d12e3c44f..b2354b24e 100755 --- a/httemplate/search/cust_pay_batch.cgi +++ b/httemplate/search/cust_pay_batch.cgi @@ -62,6 +62,7 @@ % $html_init .= qq!Download batch in format !; @@ -84,6 +85,7 @@ % $html_init .= qq!Format
!; -- 2.11.0