summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2002-06-10 22:48:03 +0000
committerivan <ivan>2002-06-10 22:48:03 +0000
commitf21edcf70602d7f2ea314d65382bd8c40f51d530 (patch)
tree4bec8b8837c12f432217a5bd09b6053b5679e107
parent25354a69186b74866b163d2b5c2b3aa52aa5658c (diff)
also retry cards when user clicks "Bill now" (closes: Bug#417)
-rw-r--r--FS/FS/cust_main.pm25
-rwxr-xr-xhttemplate/misc/bill.cgi7
2 files changed, 29 insertions, 3 deletions
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index 8a0124a9b..b6600fb29 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -485,6 +485,7 @@ sub replace {
if ( $self->payby eq 'CARD' &&
grep { $self->get($_) ne $old->get($_) } qw(payinfo paydate payname) ) {
# card info has changed, want to retry realtime_card invoice events
+ #false laziness w/collect
foreach my $cust_bill_event (
grep {
#$_->part_bill_event->plan eq 'realtime-card'
@@ -500,6 +501,7 @@ sub replace {
return "error scheduling invoice events for retry: $error";
}
}
+ #eslaf
}
@@ -1192,6 +1194,8 @@ invoice_time - Use this time when deciding when to print invoices and
late notices on those invoices. The default is now. It is specified as a UNIX timestamp; see L<perlfunc/"time">). Also see L<Time::Local> and L<Date::Parse>
for conversion functions.
+retry_card - Retry cards even when not scheduled by invoice events.
+
batch_card - This option is deprecated. See the invoice events web interface
to control whether cards are batched or run against a realtime gateway.
@@ -1224,6 +1228,26 @@ sub collect {
return '';
}
+ if ( exists($options{'retry_card'}) && $options{'retry_card'} ) {
+ #false laziness w/replace
+ foreach my $cust_bill_event (
+ grep {
+ #$_->part_bill_event->plan eq 'realtime-card'
+ $_->part_bill_event->eventcode eq '$cust_bill->realtime_card();'
+ && $_->status eq 'done'
+ && $_->statustext
+ }
+ $self->open_cust_bill->cust_bill_event
+ ) {
+ my $error = $cust_bill_event->retry;
+ if ( $error ) {
+ $dbh->rollback if $oldAutoCommit;
+ return "error scheduling invoice events for retry: $error";
+ }
+ }
+ #eslaf
+ }
+
foreach my $cust_bill ( $self->cust_bill ) {
#this has to be before next's
@@ -1242,6 +1266,7 @@ sub collect {
next unless $amount > 0;
+
foreach my $part_bill_event (
sort { $a->seconds <=> $b->seconds
|| $a->weight <=> $b->weight
diff --git a/httemplate/misc/bill.cgi b/httemplate/misc/bill.cgi
index 6f523a52c..f048e5559 100755
--- a/httemplate/misc/bill.cgi
+++ b/httemplate/misc/bill.cgi
@@ -18,9 +18,10 @@ unless ( $error ) {
$error = $cust_main->collect(
# 'invoice-time'=>$time,
- # 'batch_card'=> 'yes',
- 'batch_card'=> 'no',
- 'report_badcard'=> 'yes',
+ #'batch_card'=> 'yes',
+ #'batch_card'=> 'no',
+ #'report_badcard'=> 'yes',
+ 'retry_card' => 'yes',
);
}
#&eidiot($error) if $error;