X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_bill.pm;h=88f40da3c163874c6d53354473674b8959e39b27;hb=60d630b2052d208f9f8adb8a28706c731f366bc2;hp=353ab49eadcf7fcbfa33e769c99af6a61d894d70;hpb=4a46507233cdd366306562f97730eadaa09ae400;p=freeside.git diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index 353ab49ea..88f40da3c 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -594,7 +594,10 @@ sub realtime_bop { my( $self, $method ) = @_; my $cust_main = $self->cust_main; - my $amount = $self->owed; + my $balance = $cust_main->balance; + my $amount = ( $balance < $self->owed ) ? $balance : $self->owed; + $amount = sprintf("%.2f", $amount); + return "not run (balance $balance)" unless $amount > 0; my $description = 'Internet Services'; if ( $conf->exists('business-onlinepayment-description') ) {