the invoice.
The I<method> and I<payinfo> options can be used to influence the choice
-as well. Presently only 'CC' and 'ECHECK' methods are meaningful.
+as well. Presently only 'CC', 'ECHECK', and 'PAYPAL' methods are meaningful.
When the I<method> is 'CC' then the card number in I<payinfo> can direct
this routine to route to a gateway suited for that type of card.
}
#look for an agent gateway override first
- my $cardtype;
- if ( $options{method} && $options{method} eq 'CC' ) {
- $cardtype = cardtype($options{payinfo});
- } elsif ( $options{method} && $options{method} eq 'ECHECK' ) {
- $cardtype = 'ACH';
- } else {
- $cardtype = $options{method} || '';
+ my $cardtype = '';
+ if ( $options{method} ) {
+ if ( $options{method} eq 'CC' && $options{payinfo} ) {
+ $cardtype = cardtype($options{payinfo});
+ } elsif ( $options{method} eq 'ECHECK' ) {
+ $cardtype = 'ACH';
+ } elsif ( $options{method} eq 'PAYPAL' ) {
+ $cardtype = 'PayPal';
+ } else {
+ $cardtype = $options{method}
+ }
}
my $override =
cardtype => '',
taxclass => '', } );
- my $payment_gateway = new FS::payment_gateway;
+ my $payment_gateway;
+ my $conf = new FS::Conf;
if ( $override ) { #use a payment gateway override
$payment_gateway = $override->payment_gateway;
+ $payment_gateway->gateway_namespace('Business::OnlinePayment')
+ unless $payment_gateway->gateway_namespace;
+
} else { #use the standard settings from the config
+
# the standard settings from the config could be moved to a null agent
# agent_payment_gateway referenced payment_gateway
- my $conf = new FS::Conf;
unless ( $conf->exists('business-onlinepayment') ) {
if ( $options{'nofatal'} ) {
return '';
"did you set the business-onlinepayment configuration value?\n"
unless $processor;
+ $payment_gateway = new FS::payment_gateway;
+
$payment_gateway->gateway_namespace( $conf->config('business-onlinepayment-namespace') ||
'Business::OnlinePayment');
$payment_gateway->gateway_module($processor);
}
+ unless ( $payment_gateway->gateway_namespace ) {
+ $payment_gateway->gateway_namespace(
+ scalar($conf->config('business-onlinepayment-namespace'))
+ || 'Business::OnlinePayment'
+ );
+ }
+
$payment_gateway;
}