X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpay_batch%2FRBC.pm;h=c4388d156fee1cfd922d78e726d7c1bd264e8b7a;hb=e57a68b492b2f3f78969333d7b3a8af9fa9b1b12;hp=644c73c8bf190c7abe4008107adbd6e7bdaf9e89;hpb=56cfb20bc9c9771b66007fabe1e15cbaa153624c;p=freeside.git diff --git a/FS/FS/pay_batch/RBC.pm b/FS/FS/pay_batch/RBC.pm index 644c73c8b..c4388d156 100644 --- a/FS/FS/pay_batch/RBC.pm +++ b/FS/FS/pay_batch/RBC.pm @@ -66,7 +66,7 @@ $name = 'RBC'; }, 'approved' => sub { my $hash = shift; - $hash->{'status'} eq ' ' + ($hash->{'status'} eq ' ') || ($hash->{'status'} eq 'W'); }, 'declined' => sub { my $hash = shift; @@ -127,12 +127,6 @@ $name = 'RBC'; if $hash->{'status'} eq ' '; #false laziness with 'approved' above return 1; } - #skipping W for now (maybe it should be declined?) - if ($hash->{'status'} eq 'W') { - #file counts this as part of total, but we skip - $totaloffset += sprintf("%.2f", $hash->{'paid'} / 100 ); - return 1; - } return ($hash->{'recordtype'} eq '3') || #Account Trailer Record, concludes returned items ($hash->{'subtype'} ne '0'); #error messages, etc, too late to apply to previous entry @@ -180,9 +174,19 @@ $name = 'RBC'; die "invalid branch/routing number '$aba'\n"; } + ## set custname to business name if business checking or savings account is used otherwise leave as first and last name. + my $custname = $cust_pay_batch->cust_main->first . ' ' . $cust_pay_batch->cust_main->last; + $custname = $cust_pay_batch->cust_main->company + if (($cust_pay_batch->cust_main->paytype eq "Business checking" || $cust_pay_batch->cust_main->paytype eq "Business savings") && $cust_pay_batch->cust_main->company); + $i++; + + ## set to D for debit by default, then override to what cust_pay_batch has as payments may not have paycode. + my $debitorcredit = 'D'; + $debitorcredit = $cust_pay_batch->paycode unless !$cust_pay_batch->paycode; + sprintf("%06u", $i). - 'D'. + $debitorcredit. sprintf("%3s",$trans_code). sprintf("%10s",$client_num). ' '. @@ -195,8 +199,7 @@ $name = 'RBC'; sprintf("%010.0f",$cust_pay_batch->amount*100). ' '. time2str("%Y%j", time + 86400). - sprintf("%-30.30s", encode('utf8', $cust_pay_batch->cust_main->first . ' ' . - $cust_pay_batch->cust_main->last)). + sprintf("%-30.30s", encode('utf8', $custname)). 'E'. # English ' '. sprintf("%-15s", $shortname). @@ -227,5 +230,10 @@ $name = 'RBC'; }, ); +## this format can handle credit transactions +sub can_handle_credits { + 1; +} + 1;