diff options
| author | mark <mark> | 2009-10-24 23:37:42 +0000 |
|---|---|---|
| committer | mark <mark> | 2009-10-24 23:37:42 +0000 |
| commit | 978cc3533b38efa38c63898fa7814a4b38efdee3 (patch) | |
| tree | 4ff4a4d2a22c93365d4fc4ecbb0b3d5221c6e0aa /FS | |
| parent | ca16e6099d6b0b979badb1bca5d2b7413aa70206 (diff) | |
Scripts for paymentech batch transfer
Diffstat (limited to 'FS')
| -rw-r--r-- | FS/FS/Conf.pm | 2 | ||||
| -rw-r--r-- | FS/FS/pay_batch.pm | 17 | ||||
| -rw-r--r-- | FS/FS/pay_batch/paymentech.pm | 2 |
3 files changed, 13 insertions, 8 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index fafd73837..56dae5801 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -2451,7 +2451,7 @@ worry that config_items is freeside-specific and icky. { 'key' => 'batchconfig-paymentech', 'section' => 'billing', - 'description' => 'Configuration for Chase Paymentech batching, four lines: 1. BIN, 2. Terminal ID, 3. Merchant ID, 4. Username', + 'description' => 'Configuration for Chase Paymentech batching, four lines: 1. BIN, 2. Terminal ID, 3. Merchant ID, 4. Username, 5. Password', 'type' => 'textarea', }, diff --git a/FS/FS/pay_batch.pm b/FS/FS/pay_batch.pm index 83bf7a3dc..e0531f445 100644 --- a/FS/FS/pay_batch.pm +++ b/FS/FS/pay_batch.pm @@ -196,7 +196,7 @@ sub import_results { or die "unknown format $format"; my $filetype = $info->{'filetype'}; # CSV or fixed - my @fields = @{ $info->{'fields'} }; + my @fields = @{ $info->{'fields'}}; my $formatre = $info->{'formatre'}; # for fixed my @all_values; my $begin_condition = $info->{'begin_condition'}; @@ -256,7 +256,7 @@ sub import_results { } $rows = [ $rows ] if ref($rows) ne 'ARRAY'; foreach my $row (@$rows) { - push @all_values, [ @{$row}{@xmlkeys} ]; + push @all_values, [ @{$row}{@xmlkeys}, $row ]; } } else { @@ -269,9 +269,9 @@ sub import_results { $dbh->rollback if $oldAutoCommit; return "can't parse: ". $csv->error_input(); }; - push @all_values, [ $csv->fields() ]; + push @all_values, [ $csv->fields(), $line ]; }elsif ($filetype eq 'fixed'){ - my @values = $line =~ /$formatre/; + my @values = ( $line =~ /$formatre/, $line ); unless (@values) { $dbh->rollback if $oldAutoCommit; return "can't parse: ". $line; @@ -288,15 +288,20 @@ sub import_results { my @values = @$_; my %hash; + my $line = pop @values; foreach my $field ( @fields ) { my $value = shift @values; next unless $field; $hash{$field} = $value; } - if ( defined($end_condition) and &{$end_condition}(\%hash) ) { + if ( defined($begin_condition) and &{$begin_condition}(\%hash, $line)) { + undef $begin_condition; + } + + if ( defined($end_condition) and &{$end_condition}(\%hash, $line) ) { my $error; - $error = &{$end_hook}(\%hash, $total) if defined($end_hook); + $error = &{$end_hook}(\%hash, $total, $line) if defined($end_hook); if ( $error ) { $dbh->rollback if $oldAutoCommit; return $error; diff --git a/FS/FS/pay_batch/paymentech.pm b/FS/FS/pay_batch/paymentech.pm index 44fa78a10..c1e9c9a59 100644 --- a/FS/FS/pay_batch/paymentech.pm +++ b/FS/FS/pay_batch/paymentech.pm @@ -66,7 +66,7 @@ my %paytype = ( batchFileID => { userID => $username, fileDateTime => time2str('%Y%m%d%H%M%s',time), - fileID => 'batch'.time2str('%Y%m%d',time), + fileID => 'FILEID', }, newOrder => [ map { { # $_ here refers to a cust_pay_batch record. |
