summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2002-11-16 10:33:17 +0000
committerivan <ivan>2002-11-16 10:33:17 +0000
commit1d7ced0cc1cbfeee93b69d1c92d450ac0833673a (patch)
treec706d2b1a7feda140dbd542102f32b54f3ebbf73
parentf0109932209a0277931e65ec6ea3c8232d6c08e2 (diff)
separate ACH processor support
-rw-r--r--FS/FS/Conf.pm11
-rw-r--r--FS/FS/cust_bill.pm67
2 files changed, 54 insertions, 24 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index bc40e01..e0db2bf 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -269,6 +269,13 @@ httemplate/docs/config.html
},
{
+ 'key' => 'business-onlinepayment-ach',
+ 'section' => 'billing',
+ 'description' => 'Alternate <a href="http://search.cpan.org/search?mode=module&query=Business%3A%3AOnlinePayment">Business::OnlinePayment</a> support for ACH transactions (defaults to regular <b>business-onlinepayment</b>). At least three lines: processor, login, and password. An optional fourth line specifies the action or actions (multiple actions are separated with `,\': for example: `Authorization Only, Post Authorization\'). Optional additional lines are passed to Business::OnlinePayment as %processor_options.',
+ 'type' => 'textarea',
+ },
+
+ {
'key' => 'business-onlinepayment-description',
'section' => 'billing',
'description' => 'String passed as the description field to <a href="http://search.cpan.org/search?mode=module&query=Business%3A%3AOnlinePayment">Business::OnlinePayment</a>. Evaluated as a double-quoted perl string, with the following variables available: <code>$agent</code> (the agent name), and <code>$pkgs</code> (a comma-separated list of packages to which the invoiced being charged applies)',
@@ -891,7 +898,7 @@ httemplate/docs/config.html
'section' => '',
'description' => 'Acceptable payment types for the signup server',
'type' => 'selectmultiple',
- 'select_enum' => [ qw(CARD CHEK PREPAY BILL COMP) ],
+ 'select_enum' => [ qw(CARD CHEK LECB PREPAY BILL COMP) ],
},
{
@@ -978,7 +985,7 @@ httemplate/docs/config.html
'section' => 'UI',
'description' => 'Default payment type. HIDE disables display of billing information and sets customers to BILL.',
'type' => 'select',
- 'select_enum' => [ '', qw(CARD CHEK BILL COMP HIDE) ],
+ 'select_enum' => [ '', qw(CARD CHEK LECB BILL COMP HIDE) ],
},
{
diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm
index e723c63..3d76f34 100644
--- a/FS/FS/cust_bill.pm
+++ b/FS/FS/cust_bill.pm
@@ -3,9 +3,10 @@ package FS::cust_bill;
use strict;
use vars qw( @ISA $conf $money_char );
use vars qw( $lpr $invoice_from $smtpmachine );
-use vars qw( $processor );
+use vars qw( $cybercash );
use vars qw( $xaction $E_NoErr );
use vars qw( $bop_processor $bop_login $bop_password $bop_action @bop_options );
+use vars qw( $ach_processor $ach_login $ach_password $ach_action @ach_options );
use vars qw( $invoice_lines @buf ); #yuck
use Date::Format;
use Mail::Internet 1.44;
@@ -55,7 +56,7 @@ $FS::UID::callback{'FS::cust_bill'} = sub {
my($errmsg) = &CCMckErrno3_2::MCKGetErrorMessage($status);
die "CCMckLib3_2::InitConfig fatal error: $errmsg\n";
}
- $processor='cybercash3.2';
+ $cybercash='cybercash3.2';
} elsif ( $conf->exists('business-onlinepayment') ) {
( $bop_processor,
$bop_login,
@@ -64,8 +65,20 @@ $FS::UID::callback{'FS::cust_bill'} = sub {
@bop_options
) = $conf->config('business-onlinepayment');
$bop_action ||= 'normal authorization';
+ ( $ach_processor, $ach_login, $ach_password, $ach_action, @ach_options ) =
+ ( $bop_processor, $bop_login, $bop_password, $bop_action, @bop_options );
+ eval "use Business::OnlinePayment";
+ }
+
+ if ( $conf->exists('business-onlinepayment-ach') ) {
+ ( $ach_processor,
+ $ach_login,
+ $ach_password,
+ $ach_action,
+ @ach_options
+ ) = $conf->config('business-onlinepayment-ach');
+ $ach_action ||= 'normal authorization';
eval "use Business::OnlinePayment";
- $processor="Business::OnlinePayment::$bop_processor";
}
};
@@ -610,7 +623,15 @@ for supported processors.
sub realtime_card {
my $self = shift;
- $self->realtime_bop('CC', @_);
+ $self->realtime_bop(
+ 'CC',
+ $bop_processor,
+ $bop_login,
+ $bop_password,
+ $bop_action,
+ \@bop_options,
+ @_
+ );
}
=item realtime_ach
@@ -624,20 +645,22 @@ for supported processors.
sub realtime_ach {
my $self = shift;
- $self->realtime_bop('CHECK', @_);
+ $self->realtime_bop(
+ 'CHECK',
+ $ach_processor,
+ $ach_login,
+ $ach_password,
+ $ach_action,
+ \@ach_options,
+ @_
+ );
}
sub realtime_bop {
- my $self = shift;
- my $method = shift;
+ my( $self, $method, $processor, $login, $password, $action, $options ) = @_;
my $cust_main = $self->cust_main;
my $amount = $self->owed;
- unless ( $processor =~ /^Business::OnlinePayment::(.*)$/ ) {
- return "Real-time card/ACH processing not enabled (processor $processor)";
- }
- my $bop_processor = $1; #hmm?
-
my $address = $cust_main->address1;
$address .= ", ". $cust_main->address2 if $cust_main->address2;
@@ -663,7 +686,7 @@ sub realtime_bop {
}
my $email = $invoicing_list[0];
- my( $action1, $action2 ) = split(/\s*\,\s*/, $bop_action );
+ my( $action1, $action2 ) = split(/\s*\,\s*/, $action );
my $description = 'Internet Services';
if ( $conf->exists('business-onlinepayment-description') ) {
@@ -694,12 +717,12 @@ sub realtime_bop {
}
my $transaction =
- new Business::OnlinePayment( $bop_processor, @bop_options );
+ new Business::OnlinePayment( $processor, @$options );
$transaction->content(
%content,
'type' => $method,
- 'login' => $bop_login,
- 'password' => $bop_password,
+ 'login' => $login,
+ 'password' => $password,
'action' => $action1,
'description' => $description,
'amount' => $amount,
@@ -728,14 +751,14 @@ sub realtime_bop {
#warn "********* $auth ***********\n";
#warn "********* $ordernum ***********\n";
my $capture =
- new Business::OnlinePayment( $bop_processor, @bop_options );
+ new Business::OnlinePayment( $processor, @$options );
my %capture = (
%content,
type => $method,
action => $action2,
- login => $bop_login,
- password => $bop_password,
+ login => $login,
+ password => $password,
order_number => $ordernum,
amount => $amount,
authorization => $auth,
@@ -847,7 +870,7 @@ sub realtime_card_cybercash {
my $amount = $self->owed;
return "CyberCash CashRegister real-time card processing not enabled!"
- unless $processor eq 'cybercash3.2';
+ unless $cybercash eq 'cybercash3.2';
my $address = $cust_main->address1;
$address .= ", ". $cust_main->address2 if $cust_main->address2;
@@ -890,7 +913,7 @@ sub realtime_card_cybercash {
'_date' => '',
'payby' => 'CARD',
'payinfo' => $cust_main->payinfo,
- 'paybatch' => "$processor:$paybatch",
+ 'paybatch' => "$cybercash:$paybatch",
} );
my $error = $cust_pay->insert;
if ( $error ) {
@@ -1165,7 +1188,7 @@ sub print_text {
=head1 VERSION
-$Id: cust_bill.pm,v 1.41.2.7 2002-10-15 09:54:22 ivan Exp $
+$Id: cust_bill.pm,v 1.41.2.8 2002-11-16 10:33:17 ivan Exp $
=head1 BUGS