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.
-batch_card - Set this true to batch cards (see L<cust_pay_batch>). By
+batch_card - Set this true to batch cards (see L<FS::cust_pay_batch>). By
default, cards are processed immediately, which will generate an error if
CyberCash is not installed.
$paylast = $self->getfield('first');
$payname = "$payfirst $paylast";
}
+
+ my @invoicing_list = grep { $_ ne 'POST' } $self->invoicing_list;
+ if ( $conf->exists('emailinvoiceonly') ) {
+ @invoicing_list = $self->default_invoicing_list
+ unless @invoicing_list;
+ }
+ my $email = $invoicing_list[0];
+
+ my( $action1, $action2 ) = split(/\s*\,\s*/, $bop_action );
my $transaction =
new Business::OnlinePayment( $bop_processor, @bop_options );
'type' => 'CC',
'login' => $bop_login,
'password' => $bop_password,
- 'action' => $bop_action,
+ 'action' => $action1,
+ 'description' => 'Internet Services',
'amount' => $amount,
'invoice_number' => $cust_bill->invnum,
'customer_id' => $self->custnum,
'country' => $self->country,
'card_number' => $self->payinfo,
'expiration' => $exp,
+ 'referer' => 'http://cleanwhisker.420.am/',
+ 'email' => $email,
);
$transaction->submit();
- if ( $transaction->is_success()) {
+ if ( $transaction->is_success() && $action2 ) {
+ my $auth = $transaction->authorization;
+ my $ordernum = $transaction->order_number;
+ #warn "********* $auth ***********\n";
+ #warn "********* $ordernum ***********\n";
+ my $capture =
+ new Business::OnlinePayment( $bop_processor, @bop_options );
+
+ $capture->content(
+ action => $action2,
+ login => $bop_login,
+ password => $bop_password,
+ order_number => $ordernum,
+ amount => $amount,
+ authorization => $auth,
+ description => 'Internet Services',
+ );
+
+ $capture->submit();
+
+ unless ( $capture->is_success ) {
+ my $e = "Authorization sucessful but capture failed, invnum #".
+ $cust_bill->invnum. ': '. $capture->result_code.
+ ": ". $capture->error_message;
+ warn $e;
+ return $e;
+ }
+
+ }
+
+ if ( $transaction->is_success() ) {
+
my $cust_pay = new FS::cust_pay ( {
'invnum' => $cust_bill->invnum,
'paid' => $amount,
'';
}
+=item default_invoicing_list
+
+=cut
+
+sub default_invoicing_list {
+ my $self = shift;
+ my @list = ();
+ foreach my $cust_pkg ( $self->all_pkgs ) {
+ my @cust_svc = qsearch('cust_svc', { 'pkgnum' => $cust_pkg->pkgnum } );
+ my @svc_acct =
+ map { qsearchs('svc_acct', { 'svcnum' => $_->svcnum } ) }
+ grep { qsearchs('svc_acct', { 'svcnum' => $_->svcnum } ) }
+ @cust_svc;
+ push @list, map { $_->email } @svc_acct;
+ }
+ $self->invoicing_list(\@list);
+}
+
=item referral_cust_main [ DEPTH [ EXCLUDE_HASHREF ] ]
Returns an array of customers referred by this customer (referral_custnum set
my $dir = $FS::UID::conf_dir. "cache.". $FS::UID::datasrc;
open(LASTCACHE,"<$dir/cust_main.last")
or die "can't open $dir/cust_main.last: $!";
- my @array = split(/\n/, <LASTCACHE> );
+ my @array = map { chomp; $_; } <LASTCACHE>;
close LASTCACHE;
\@array;
}
my $dir = $FS::UID::conf_dir. "cache.". $FS::UID::datasrc;
open(COMPANYCACHE,"<$dir/cust_main.company")
or die "can't open $dir/cust_main.last: $!";
- my @array = split(/\n/, <COMPANYCACHE> );
+ my @array = map { chomp; $_; } <COMPANYCACHE>;
close COMPANYCACHE;
\@array;
}
=head1 VERSION
-$Id: cust_main.pm,v 1.32 2001-09-11 12:10:56 ivan Exp $
+$Id: cust_main.pm,v 1.38 2001-09-26 09:17:06 ivan Exp $
=head1 BUGS